Skip to content

Commit

Permalink
Merge pull request #172 from gocardless/template-changes
Browse files Browse the repository at this point in the history
Changes from gocardless/gocardless-pro-php-template
  • Loading branch information
jessezach authored Oct 26, 2023
2 parents 0e68767 + 7ad93be commit 5e331c2
Show file tree
Hide file tree
Showing 27 changed files with 85 additions and 59 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gocardless/gocardless-pro",
"description": "GoCardless Pro PHP Client Library",
"version": "5.3.0",
"version": "5.4.0",
"keywords": [
"gocardless",
"direct debit",
Expand Down
4 changes: 2 additions & 2 deletions lib/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function __construct($config)
'Content-Type' => 'application/json',
'Authorization' => "Bearer " . $access_token,
'GoCardless-Client-Library' => 'gocardless-pro-php',
'GoCardless-Client-Version' => '5.3.0',
'GoCardless-Client-Version' => '5.4.0',
'User-Agent' => $this->getUserAgent()
),
'http_errors' => false,
Expand Down Expand Up @@ -568,7 +568,7 @@ private function getUserAgent()
{
$curlinfo = curl_version();
$uagent = array();
$uagent[] = 'gocardless-pro-php/5.3.0';
$uagent[] = 'gocardless-pro-php/5.4.0';
$uagent[] = 'schema-version/2015-07-06';
if (defined('\GuzzleHttp\Client::MAJOR_VERSION')) {
$uagent[] = 'GuzzleHttp/' . \GuzzleHttp\Client::MAJOR_VERSION;
Expand Down
7 changes: 7 additions & 0 deletions lib/Resources/CreditorBankAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* @property-read $id
* @property-read $links
* @property-read $metadata
* @property-read $verification_status
*/
class CreditorBankAccount extends BaseResource
{
Expand Down Expand Up @@ -95,4 +96,10 @@ class CreditorBankAccount extends BaseResource
*/
protected $metadata;

/**
* Verification status of the Bank Account. Can be one of `pending`,
* `in_review` or `successful`
*/
protected $verification_status;

}
6 changes: 6 additions & 0 deletions lib/Resources/MandateImport.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*
* @property-read $created_at
* @property-read $id
* @property-read $links
* @property-read $scheme
* @property-read $status
*/
Expand All @@ -31,6 +32,11 @@ class MandateImport extends BaseResource
*/
protected $id;

/**
* Related resources
*/
protected $links;

/**
* The scheme of the mandates to be imported.<br>All mandates in a single
* mandate
Expand Down
8 changes: 8 additions & 0 deletions tests/Integration/CreditorBankAccountsIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public function testCreditorBankAccountsCreate()
$this->assertEquals($body->id, $response->id);
$this->assertEquals($body->links, $response->links);
$this->assertEquals($body->metadata, $response->metadata);
$this->assertEquals($body->verification_status, $response->verification_status);


$expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture);
Expand Down Expand Up @@ -75,6 +76,7 @@ public function testCreditorBankAccountsCreateWithIdempotencyConflict()
$this->assertEquals($body->id, $response->id);
$this->assertEquals($body->links, $response->links);
$this->assertEquals($body->metadata, $response->metadata);
$this->assertEquals($body->verification_status, $response->verification_status);


$expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture);
Expand Down Expand Up @@ -151,6 +153,10 @@ public function testCreditorBankAccountsList()
$this->assertEquals($body[$num]->metadata, $record->metadata);
}

if (isset($body[$num]->verification_status)) {
$this->assertEquals($body[$num]->verification_status, $record->verification_status);
}

}

$expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture);
Expand Down Expand Up @@ -182,6 +188,7 @@ public function testCreditorBankAccountsGet()
$this->assertEquals($body->id, $response->id);
$this->assertEquals($body->links, $response->links);
$this->assertEquals($body->metadata, $response->metadata);
$this->assertEquals($body->verification_status, $response->verification_status);


$expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture);
Expand Down Expand Up @@ -213,6 +220,7 @@ public function testCreditorBankAccountsDisable()
$this->assertEquals($body->id, $response->id);
$this->assertEquals($body->links, $response->links);
$this->assertEquals($body->metadata, $response->metadata);
$this->assertEquals($body->verification_status, $response->verification_status);


$expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture);
Expand Down
5 changes: 5 additions & 0 deletions tests/Integration/MandateImportsIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public function testMandateImportsCreate()

$this->assertEquals($body->created_at, $response->created_at);
$this->assertEquals($body->id, $response->id);
$this->assertEquals($body->links, $response->links);
$this->assertEquals($body->scheme, $response->scheme);
$this->assertEquals($body->status, $response->status);

Expand Down Expand Up @@ -59,6 +60,7 @@ public function testMandateImportsCreateWithIdempotencyConflict()

$this->assertEquals($body->created_at, $response->created_at);
$this->assertEquals($body->id, $response->id);
$this->assertEquals($body->links, $response->links);
$this->assertEquals($body->scheme, $response->scheme);
$this->assertEquals($body->status, $response->status);

Expand All @@ -84,6 +86,7 @@ public function testMandateImportsGet()

$this->assertEquals($body->created_at, $response->created_at);
$this->assertEquals($body->id, $response->id);
$this->assertEquals($body->links, $response->links);
$this->assertEquals($body->scheme, $response->scheme);
$this->assertEquals($body->status, $response->status);

Expand All @@ -108,6 +111,7 @@ public function testMandateImportsSubmit()

$this->assertEquals($body->created_at, $response->created_at);
$this->assertEquals($body->id, $response->id);
$this->assertEquals($body->links, $response->links);
$this->assertEquals($body->scheme, $response->scheme);
$this->assertEquals($body->status, $response->status);

Expand All @@ -132,6 +136,7 @@ public function testMandateImportsCancel()

$this->assertEquals($body->created_at, $response->created_at);
$this->assertEquals($body->id, $response->id);
$this->assertEquals($body->links, $response->links);
$this->assertEquals($body->scheme, $response->scheme);
$this->assertEquals($body->status, $response->status);

Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/bank_authorisations.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"method": "POST",
"path_template": "/bank_authorisations",
"url_params": {},
"body": {"bank_authorisations":{"authorisation_type":"example authorisation_type 8081","authorised_at":"2020-01-01T12:00:00.000Z","created_at":"2023-08-17T13:20:41.179Z","expires_at":"2023-08-17T13:20:41.179Z","id":"BAU123","last_visited_at":"2020-01-01T12:00:00.000Z","links":{"billing_request":"BRQ123","institution":"monzo"},"qr_code_url":"https://pay.gocardless.com/obauth/BAU123/qr_code","redirect_uri":"https://my-website.com/abc/callback","url":"https://pay.gocardless.com/obauth/BAU123"}}
"body": {"bank_authorisations":{"authorisation_type":"example authorisation_type 8081","authorised_at":"2020-01-01T12:00:00.000Z","created_at":"2023-10-26T13:07:05.665Z","expires_at":"2023-10-26T13:07:05.665Z","id":"BAU123","last_visited_at":"2020-01-01T12:00:00.000Z","links":{"billing_request":"BRQ123","institution":"monzo"},"qr_code_url":"https://pay.gocardless.com/obauth/BAU123/qr_code","redirect_uri":"https://my-website.com/abc/callback","url":"https://pay.gocardless.com/obauth/BAU123"}}
},
"get": {
"method": "GET",
"path_template": "/bank_authorisations/:identity",
"url_params": {"identity": "BAU123"},
"body": {"bank_authorisations":{"authorisation_type":"example authorisation_type 7887","authorised_at":"2020-01-01T12:00:00.000Z","created_at":"2023-08-17T13:20:41.179Z","expires_at":"2023-08-17T13:20:41.179Z","id":"BAU123","last_visited_at":"2020-01-01T12:00:00.000Z","links":{"billing_request":"BRQ123","institution":"monzo"},"qr_code_url":"https://pay.gocardless.com/obauth/BAU123/qr_code","redirect_uri":"https://my-website.com/abc/callback","url":"https://pay.gocardless.com/obauth/BAU123"}}
"body": {"bank_authorisations":{"authorisation_type":"example authorisation_type 7887","authorised_at":"2020-01-01T12:00:00.000Z","created_at":"2023-10-26T13:07:05.665Z","expires_at":"2023-10-26T13:07:05.665Z","id":"BAU123","last_visited_at":"2020-01-01T12:00:00.000Z","links":{"billing_request":"BRQ123","institution":"monzo"},"qr_code_url":"https://pay.gocardless.com/obauth/BAU123/qr_code","redirect_uri":"https://my-website.com/abc/callback","url":"https://pay.gocardless.com/obauth/BAU123"}}
}
}

4 changes: 2 additions & 2 deletions tests/fixtures/billing_request_flows.json
Original file line number Diff line number Diff line change
Expand Up @@ -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-08-17T13:20:41.184Z","exit_uri":"https://my-website.com/abc/callback","expires_at":"2023-08-17T13:20:41.184Z","id":"BRF123","language":"en","links":{"billing_request":"BRQ123"},"lock_bank_account":false,"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":true,"show_success_redirect_button":false}}
"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}}
},
"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":false,"created_at":"2023-08-17T13:20:41.184Z","exit_uri":"https://my-website.com/abc/callback","expires_at":"2023-08-17T13:20:41.184Z","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":true}}
"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}}
}
}

Loading

0 comments on commit 5e331c2

Please sign in to comment.