-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #175 from gocardless/template-changes
Changes from gocardless/gocardless-pro-php-template
- Loading branch information
Showing
36 changed files
with
262 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
/** | ||
* WARNING: Do not edit by hand, this file was generated by Crank: | ||
* | ||
* https://github.com/gocardless/crank | ||
*/ | ||
|
||
namespace GoCardlessPro\Resources; | ||
|
||
/** | ||
* A thin wrapper around a transferred_mandate, providing access to its | ||
* attributes | ||
* | ||
* @property-read $encrypted_customer_bank_details | ||
* @property-read $encrypted_decryption_key | ||
* @property-read $links | ||
* @property-read $public_key_id | ||
*/ | ||
class TransferredMandate extends BaseResource | ||
{ | ||
protected $model_name = "TransferredMandate"; | ||
|
||
/** | ||
* Encrypted customer bank account details, containing: | ||
* `iban`, `account_holder_name`, `swift_bank_code`, `swift_branch_code`, | ||
* `swift_account_number` | ||
*/ | ||
protected $encrypted_customer_bank_details; | ||
|
||
/** | ||
* Random AES-256 key used to encrypt bank account details, itself encrypted | ||
* with your public key. | ||
*/ | ||
protected $encrypted_decryption_key; | ||
|
||
/** | ||
* | ||
*/ | ||
protected $links; | ||
|
||
/** | ||
* The ID of an RSA-2048 public key, from your JWKS, used to encrypt the AES | ||
* key. | ||
*/ | ||
protected $public_key_id; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
/** | ||
* WARNING: Do not edit by hand, this file was generated by Crank: | ||
* | ||
* https://github.com/gocardless/crank | ||
*/ | ||
|
||
namespace GoCardlessPro\Services; | ||
|
||
use \GoCardlessPro\Core\Paginator; | ||
use \GoCardlessPro\Core\Util; | ||
use \GoCardlessPro\Core\ListResponse; | ||
use \GoCardlessPro\Resources\TransferredMandate; | ||
use \GoCardlessPro\Core\Exception\InvalidStateException; | ||
|
||
|
||
/** | ||
* Service that provides access to the TransferredMandate | ||
* endpoints of the API | ||
* | ||
* @method transferredMandates() | ||
*/ | ||
class TransferredMandatesService extends BaseService | ||
{ | ||
|
||
protected $envelope_key = 'transferred_mandates'; | ||
protected $resource_class = '\GoCardlessPro\Resources\TransferredMandate'; | ||
|
||
|
||
/** | ||
* Get updated customer bank details | ||
* | ||
* Example URL: /transferred_mandates/:identity | ||
* | ||
* @param string $identity Unique identifier, beginning with "MD". Note that this | ||
prefix may not apply to mandates created before 2016. | ||
* @param string[mixed] $params An associative array for any params | ||
* @return TransferredMandate | ||
**/ | ||
public function transferredMandates($identity, $params = array()) | ||
{ | ||
$path = Util::subUrl( | ||
'/transferred_mandates/:identity', | ||
array( | ||
|
||
'identity' => $identity | ||
) | ||
); | ||
if(isset($params['params'])) { $params['query'] = $params['params']; | ||
unset($params['params']); | ||
} | ||
|
||
|
||
$response = $this->api_client->get($path, $params); | ||
|
||
|
||
return $this->getResourceForResponse($response); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
// | ||
// WARNING: Do not edit by hand, this file was generated by Crank: | ||
// https://github.com/gocardless/crank | ||
// | ||
|
||
namespace GoCardlessPro\Integration; | ||
|
||
class TransferredMandatesIntegrationTest extends IntegrationTestBase | ||
{ | ||
public function testResourceModelExists() | ||
{ | ||
$obj = new \GoCardlessPro\Resources\TransferredMandate(array()); | ||
$this->assertNotNull($obj); | ||
} | ||
|
||
public function testTransferredMandatesTransferredMandates() | ||
{ | ||
$fixture = $this->loadJsonFixture('transferred_mandates')->transferred_mandates; | ||
$this->stub_request($fixture); | ||
|
||
$service = $this->client->transferredMandates(); | ||
$response = call_user_func_array(array($service, 'transferredMandates'), (array)$fixture->url_params); | ||
|
||
$body = $fixture->body->transferred_mandates; | ||
|
||
$this->assertInstanceOf('\GoCardlessPro\Resources\TransferredMandate', $response); | ||
|
||
$this->assertEquals($body->encrypted_customer_bank_details, $response->encrypted_customer_bank_details); | ||
$this->assertEquals($body->encrypted_decryption_key, $response->encrypted_decryption_key); | ||
$this->assertEquals($body->links, $response->links); | ||
$this->assertEquals($body->public_key_id, $response->public_key_id); | ||
|
||
|
||
$expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); | ||
$dispatchedRequest = $this->history[0]['request']; | ||
$this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,13 +3,13 @@ | |
"method": "POST", | ||
"path_template": "/billing_request_flows", | ||
"url_params": {}, | ||
"body": {"billing_request_flows":{"authorisation_url":"https://monzo.com/abc-123-things","auto_fulfil":false,"created_at":"2023-10-26T13:07:05.670Z","exit_uri":"https://my-website.com/abc/callback","expires_at":"2023-10-26T13:07:05.670Z","id":"BRF123","language":"en","links":{"billing_request":"BRQ123"},"lock_bank_account":false,"lock_currency":true,"lock_customer_details":true,"prefilled_bank_account":{"account_type":"savings"},"prefilled_customer":{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":"City of Westminster","city":"London","company_name":"Hamilton Trading Ltd.","country_code":"GB","danish_identity_number":"220550-6218","email":"[email protected]","family_name":"Osborne","given_name":"Frank","postal_code":"NW1 6XE","region":"Greater London","swedish_identity_number":"556564-5404"},"redirect_uri":"https://my-website.com/abc/callback","session_token":"sesh_123","show_redirect_buttons":false,"show_success_redirect_button":false}} | ||
"body": {"billing_request_flows":{"authorisation_url":"https://monzo.com/abc-123-things","auto_fulfil":false,"created_at":"2023-11-24T11:31:50.813Z","customer_details_captured":false,"exit_uri":"https://my-website.com/abc/callback","expires_at":"2023-11-24T11:31:50.813Z","id":"BRF123","language":"en","links":{"billing_request":"BRQ123"},"lock_bank_account":false,"lock_currency":false,"lock_customer_details":true,"prefilled_bank_account":{"account_type":"savings"},"prefilled_customer":{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":"City of Westminster","city":"London","company_name":"Hamilton Trading Ltd.","country_code":"GB","danish_identity_number":"220550-6218","email":"[email protected]","family_name":"Osborne","given_name":"Frank","postal_code":"NW1 6XE","region":"Greater London","swedish_identity_number":"556564-5404"},"redirect_uri":"https://my-website.com/abc/callback","session_token":"sesh_123","show_redirect_buttons":true,"show_success_redirect_button":false}} | ||
}, | ||
"initialise": { | ||
"method": "POST", | ||
"path_template": "/billing_request_flows/:identity/actions/initialise", | ||
"url_params": {"identity": "BRF123"}, | ||
"body": {"billing_request_flows":{"authorisation_url":"https://monzo.com/abc-123-things","auto_fulfil":true,"created_at":"2023-10-26T13:07:05.670Z","exit_uri":"https://my-website.com/abc/callback","expires_at":"2023-10-26T13:07:05.670Z","id":"BRF123","language":"en","links":{"billing_request":"BRQ123"},"lock_bank_account":false,"lock_currency":false,"lock_customer_details":true,"prefilled_bank_account":{"account_type":"savings"},"prefilled_customer":{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":"City of Westminster","city":"London","company_name":"Hamilton Trading Ltd.","country_code":"GB","danish_identity_number":"220550-6218","email":"[email protected]","family_name":"Osborne","given_name":"Frank","postal_code":"NW1 6XE","region":"Greater London","swedish_identity_number":"556564-5404"},"redirect_uri":"https://my-website.com/abc/callback","session_token":"sesh_123","show_redirect_buttons":true,"show_success_redirect_button":false}} | ||
"body": {"billing_request_flows":{"authorisation_url":"https://monzo.com/abc-123-things","auto_fulfil":false,"created_at":"2023-11-24T11:31:50.813Z","customer_details_captured":true,"exit_uri":"https://my-website.com/abc/callback","expires_at":"2023-11-24T11:31:50.813Z","id":"BRF123","language":"en","links":{"billing_request":"BRQ123"},"lock_bank_account":true,"lock_currency":true,"lock_customer_details":false,"prefilled_bank_account":{"account_type":"savings"},"prefilled_customer":{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":"City of Westminster","city":"London","company_name":"Hamilton Trading Ltd.","country_code":"GB","danish_identity_number":"220550-6218","email":"[email protected]","family_name":"Osborne","given_name":"Frank","postal_code":"NW1 6XE","region":"Greater London","swedish_identity_number":"556564-5404"},"redirect_uri":"https://my-website.com/abc/callback","session_token":"sesh_123","show_redirect_buttons":false,"show_success_redirect_button":true}} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.