Skip to content

Commit

Permalink
Merge pull request #132 from CurrencyCloud/sdkphp-104
Browse files Browse the repository at this point in the history
Adds terms_and_conditions_accepted parameter to Account
  • Loading branch information
jonathancouchman authored Jan 17, 2022
2 parents 3adf51a + 6613fb2 commit e372fd1
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 7 deletions.
6 changes: 4 additions & 2 deletions src/EntryPoint/AccountsEntryPoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ public function convertAccountToRequest(Account $account, $convertForSearch = fa
return $common + [
'spread_table' => $account->getSpreadTable(),
'identification_type' => $account->getIdentificationType(),
'identification_value' => $account->getIdentificationValue()
'identification_value' => $account->getIdentificationValue(),
'terms_and_conditions_accepted' => $account->isTermsAndConditionsAccepted()
];
}

Expand All @@ -143,7 +144,8 @@ public function createAccountFromResponse(stdClass $response)
->setUpdatedAt(new DateTime($response->updated_at))
->setIdentificationType($response->identification_type)
->setIdentificationValue($response->identification_value)
->setShortReference($response->short_reference);
->setShortReference($response->short_reference)
->setTermsAndConditionsAccepted($response->terms_and_conditions_accepted);

$this->setIdProperty($account, $response->id);
return $account;
Expand Down
25 changes: 25 additions & 0 deletions src/Model/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ class Account implements EntityInterface
* @var string
*/
private $shortReference;
/**
* @var bool
*/
private $termsAndConditionsAccepted;

/**
* @param string $accountName
Expand Down Expand Up @@ -399,4 +403,25 @@ public function setShortReference($shortReference)
$this->shortReference = (null === $shortReference) ? null : (string) $shortReference;
return $this;
}

/**
* @return bool
*/
public function isTermsAndConditionsAccepted()
{
return $this->termsAndConditionsAccepted;
}

/**
* @param bool $termsAndConditionsAccepted
*
* @return $this
*/
public function setTermsAndConditionsAccepted($termsAndConditionsAccepted)
{
$this->termsAndConditionsAccepted = $termsAndConditionsAccepted;
return $this;
}


}
10 changes: 7 additions & 3 deletions tests/EntryPoint/AccountsEntryPointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ class AccountsEntryPointTest extends BaseCurrencyCloudTestCase
'updated_at' => '2014-01-12T00:00:00+00:00',
'identification_type' => 'green_card',
'identification_value' => '123',
'short_reference' => '110104-00004'
'short_reference' => '110104-00004',
'terms_and_conditions_accepted' => null
];

protected $in = [
Expand All @@ -46,7 +47,8 @@ class AccountsEntryPointTest extends BaseCurrencyCloudTestCase
'spread_table' => null,
'identification_type' => null,
'identification_value' => null,
'on_behalf_of' => null
'on_behalf_of' => null,
'terms_and_conditions_accepted' => null
];

/**
Expand Down Expand Up @@ -89,7 +91,8 @@ public function allFieldsCanBeSet()
'spread_table' => 'K',
'identification_type' => 'L',
'identification_value' => 'M',
'on_behalf_of' => null
'on_behalf_of' => null,
'terms_and_conditions_accepted' => false
];

$entryPoint = new AccountsEntryPoint(
Expand Down Expand Up @@ -163,6 +166,7 @@ public function accountsCanBeFound()
unset($in['identification_type']);
unset($in['identification_value']);
unset($in['on_behalf_of']);
unset($in['terms_and_conditions_accepted']);
$entryPoint = new AccountsEntryPoint(
new SimpleEntityManager(), $this->getMockedClient(
json_decode(
Expand Down
2 changes: 1 addition & 1 deletion tests/VCR/Actions/Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public function canCurrent()

$dummy =
json_decode(
'{"id":"8ec3a69b-02d1-4f09-9a6b-6bd54a61b3a8","account_name":"Currency Cloud","brand":"currencycloud","your_reference":null,"status":"enabled","street":null,"city":null,"state_or_province":null,"country":null,"postal_code":null,"spread_table":"fxcg_rfx_default","legal_entity_type":null,"created_at":"2015-04-24T15:57:55+00:00","updated_at":"2015-04-24T15:57:55+00:00","identification_type":null,"identification_value":null,"short_reference":"150424-00002"}', true
'{"id":"8ec3a69b-02d1-4f09-9a6b-6bd54a61b3a8","account_name":"Currency Cloud","brand":"currencycloud","your_reference":null,"status":"enabled","street":null,"city":null,"state_or_province":null,"country":null,"postal_code":null,"spread_table":"fxcg_rfx_default","legal_entity_type":null,"created_at":"2015-04-24T15:57:55+00:00","updated_at":"2015-04-24T15:57:55+00:00","identification_type":null,"identification_value":null,"short_reference":"150424-00002","terms_and_conditions_accepted":null}', true
);

$this->validateObjectStrictName($account, $dummy);
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/Actions/can_current.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
Content-Type: application/json
Content-Length: '459'
X-Request-Id: '2773776363343519430'
body: '{"id":"8ec3a69b-02d1-4f09-9a6b-6bd54a61b3a8","account_name":"Currency Cloud","brand":"currencycloud","your_reference":null,"status":"enabled","street":null,"city":null,"state_or_province":null,"country":null,"postal_code":null,"spread_table":"fxcg_rfx_default","legal_entity_type":null,"created_at":"2015-04-24T15:57:55+00:00","updated_at":"2015-04-24T15:57:55+00:00","identification_type":null,"identification_value":null,"short_reference":"150424-00002"}'
body: '{"id":"8ec3a69b-02d1-4f09-9a6b-6bd54a61b3a8","account_name":"Currency Cloud","brand":"currencycloud","your_reference":null,"status":"enabled","street":null,"city":null,"state_or_province":null,"country":null,"postal_code":null,"spread_table":"fxcg_rfx_default","legal_entity_type":null,"created_at":"2015-04-24T15:57:55+00:00","updated_at":"2015-04-24T15:57:55+00:00","identification_type":null,"identification_value":null,"short_reference":"150424-00002","terms_and_conditions_accepted":null}'

0 comments on commit e372fd1

Please sign in to comment.