Skip to content

Commit

Permalink
Merge pull request #72 from gocardless/template-changes
Browse files Browse the repository at this point in the history
Release v3.2.1 - allow integrator to specify HTTP timeout
  • Loading branch information
paprikati authored Dec 6, 2019
2 parents 5d72849 + 08f086f commit f11eefe
Show file tree
Hide file tree
Showing 19 changed files with 70 additions and 55 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": "3.2.0",
"version": "3.2.1",
"keywords": [
"gocardless",
"direct debit",
Expand Down
11 changes: 9 additions & 2 deletions lib/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class Client
*
* @type string $environment
* @type string $access_token
* @type float $timeout
* @type string $http_client
*/
public function __construct($config)
Expand All @@ -43,16 +44,22 @@ public function __construct($config)
$stack = \GuzzleHttp\HandlerStack::create();
$stack->push(RetryMiddlewareFactory::buildMiddleware());

$timeout = 0;
if(isset($config['timeout'])) {
$timeout = $config['timeout'];
}

$http_client = new \GuzzleHttp\Client(
[
'base_uri' => $endpoint_url,
'timeout' => $timeout,
'headers' => array(
'GoCardless-Version' => '2015-07-06',
'Accept' => 'application/json',
'Content-Type' => 'application/json',
'Authorization' => "Bearer " . $access_token,
'GoCardless-Client-Library' => 'gocardless-pro-php',
'GoCardless-Client-Version' => '3.2.0',
'GoCardless-Client-Version' => '3.2.1',
'User-Agent' => $this->getUserAgent()
),
'http_errors' => false,
Expand Down Expand Up @@ -330,7 +337,7 @@ private function getUserAgent()
{
$curlinfo = curl_version();
$uagent = array();
$uagent[] = 'gocardless-pro-php/3.2.0';
$uagent[] = 'gocardless-pro-php/3.2.1';
$uagent[] = 'schema-version/2015-07-06';
$uagent[] = 'GuzzleHttp/' . \GuzzleHttp\Client::VERSION;
$uagent[] = 'php/' . phpversion();
Expand Down
5 changes: 4 additions & 1 deletion lib/Resources/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,10 @@ class Customer extends BaseResource
protected $postal_code;

/**
* The customer's address region, county or department.
* The customer's address region, county or department. For US customers a 2
* letter state code ([ISO
* 3166-2:US](https://en.wikipedia.org/wiki/ISO_3166-2:US) e.g CA) is
* required.
*/
protected $region;

Expand Down
6 changes: 4 additions & 2 deletions lib/Resources/Payout.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ class Payout extends BaseResource
*
* For each `late_failure_settled` or `chargeback_settled` action, we refund
* the transaction fees in a payout. This means that a payout can have a
* negative `deducted_fees`. This field is calculated as `GoCardless fees +
* app fees - refunded fees`
* negative `deducted_fees` value.
*
* This field is calculated as `(GoCardless fees + app fees + surcharge
* fees) - (refunded fees)`
*
* If the merchant is invoiced for fees separately from the payout, then
* `deducted_fees` will be 0.
Expand Down
3 changes: 3 additions & 0 deletions lib/Resources/PayoutItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ class PayoutItem extends BaseResource
* collected which some partner integrations receive when their users take
* payments. Only shown in partner payouts. In the case of a payment failure
* or chargeback, these will appear as credits.</li>
* <li>`surcharge_fee` (credit/debit): GoCardless deducted a surcharge fee
* as the payment failed or was charged back, or refunded a surcharge fee as
* the bank or customer cancelled the chargeback.</li>
* </ul>
*/
protected $type;
Expand Down
6 changes: 3 additions & 3 deletions tests/fixtures/creditor_bank_accounts.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"method": "POST",
"path_template": "/creditor_bank_accounts",
"url_params": {},
"body": {"creditor_bank_accounts":{"account_holder_name":"Billie Jean","account_number_ending":"11","account_type":"savings","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":null,"enabled":true,"id":"BA123","links":{"creditor":"CR123"},"metadata":{}}}
"body": {"creditor_bank_accounts":{"account_holder_name":"Billie Jean","account_number_ending":"11","account_type":null,"bank_name":"BARCLAYS BANK PLC","country_code":null,"created_at":"2014-01-01T12:00:00.000Z","currency":null,"enabled":true,"id":"BA123","links":{"creditor":"CR123"},"metadata":{}}}
},
"list": {
"method": "GET",
"path_template": "/creditor_bank_accounts",
"url_params": {},
"body": {"creditor_bank_accounts":[{"account_holder_name":"Billie Jean","account_number_ending":"11","account_type":"savings","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","enabled":true,"id":"BA123","links":{"creditor":"CR123"},"metadata":{}},{"account_holder_name":"Billie Jean","account_number_ending":"11","account_type":"savings","bank_name":"BARCLAYS BANK PLC","country_code":null,"created_at":"2014-01-01T12:00:00.000Z","currency":null,"enabled":true,"id":"BA123","links":{"creditor":"CR123"},"metadata":{}}],"meta":{"cursors":{"after":"example after 9271","before":"example before 6137"},"limit":50}}
"body": {"creditor_bank_accounts":[{"account_holder_name":"Billie Jean","account_number_ending":"11","account_type":null,"bank_name":"BARCLAYS BANK PLC","country_code":null,"created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","enabled":true,"id":"BA123","links":{"creditor":"CR123"},"metadata":{}},{"account_holder_name":"Billie Jean","account_number_ending":"11","account_type":"savings","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":null,"enabled":true,"id":"BA123","links":{"creditor":"CR123"},"metadata":{}}],"meta":{"cursors":{"after":"example after 493","before":"example before 1270"},"limit":50}}
},
"get": {
"method": "GET",
Expand All @@ -21,7 +21,7 @@
"method": "POST",
"path_template": "/creditor_bank_accounts/:identity/actions/disable",
"url_params": {"identity": "BA123"},
"body": {"creditor_bank_accounts":{"account_holder_name":"Billie Jean","account_number_ending":"11","account_type":"savings","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":null,"enabled":true,"id":"BA123","links":{"creditor":"CR123"},"metadata":{}}}
"body": {"creditor_bank_accounts":{"account_holder_name":"Billie Jean","account_number_ending":"11","account_type":null,"bank_name":"BARCLAYS BANK PLC","country_code":null,"created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","enabled":true,"id":"BA123","links":{"creditor":"CR123"},"metadata":{}}}
}
}

8 changes: 4 additions & 4 deletions tests/fixtures/creditors.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@
"method": "POST",
"path_template": "/creditors",
"url_params": {},
"body": {"creditors":{"address_line1":"338-346 Goswell Road","address_line2":null,"address_line3":"example address_line3 2081","can_create_refunds":false,"city":null,"country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","fx_payout_currency":"EUR","id":"CR123","links":{"default_aud_payout_account":null,"default_cad_payout_account":null,"default_dkk_payout_account":"BA790","default_eur_payout_account":null,"default_gbp_payout_account":"BA123","default_nzd_payout_account":"BA791","default_sek_payout_account":"BA789"},"logo_url":"https://uploads.gocardless.com/logo.png","name":"Nude Wines","postal_code":"EC1V 7LQ","region":"example region 3274","scheme_identifiers":[{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":"City of Westminster","can_specify_mandate_reference":false,"city":"London","country_code":"GB","currency":"EUR","email":"user@example.com","minimum_advance_notice":3,"name":"example name 694","phone_number":"+44 20 1234 1234","postal_code":"NW1 6XE","reference":"example reference 8511","region":"Greater London","scheme":"bacs"}],"verification_status":"action_required"}}
"body": {"creditors":{"address_line1":"338-346 Goswell Road","address_line2":"Islington","address_line3":null,"can_create_refunds":false,"city":"London","country_code":null,"created_at":"2014-01-01T12:00:00.000Z","fx_payout_currency":"EUR","id":"CR123","links":{"default_aud_payout_account":"BA234","default_cad_payout_account":null,"default_dkk_payout_account":"BA790","default_eur_payout_account":"BA456","default_gbp_payout_account":"BA123","default_nzd_payout_account":null,"default_sek_payout_account":"BA789","default_usd_payout_account":"BA792"},"logo_url":"https://uploads.gocardless.com/logo.png","name":"Nude Wines","postal_code":"EC1V 7LQ","region":"example region 3237","scheme_identifiers":[{"address_line1":"221B Baker Street","address_line2":null,"address_line3":null,"can_specify_mandate_reference":false,"city":"London","country_code":"GB","currency":"EUR","email":"user@example.com","minimum_advance_notice":3,"name":"example name 9106","phone_number":"+44 20 1234 1234","postal_code":"NW1 6XE","reference":"example reference 5466","region":"Greater London","scheme":"bacs"}],"verification_status":"action_required"}}
},
"list": {
"method": "GET",
"path_template": "/creditors",
"url_params": {},
"body": {"creditors":[{"address_line1":"338-346 Goswell Road","address_line2":null,"address_line3":null,"can_create_refunds":false,"city":"London","country_code":null,"created_at":"2014-01-01T12:00:00.000Z","fx_payout_currency":"EUR","id":"CR123","links":{"default_aud_payout_account":"BA234","default_cad_payout_account":null,"default_dkk_payout_account":null,"default_eur_payout_account":null,"default_gbp_payout_account":"BA123","default_nzd_payout_account":null,"default_sek_payout_account":null},"logo_url":"https://uploads.gocardless.com/logo.png","name":"Nude Wines","postal_code":"EC1V 7LQ","region":null,"scheme_identifiers":[{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":"City of Westminster","can_specify_mandate_reference":false,"city":"London","country_code":"GB","currency":"EUR","email":"user@example.com","minimum_advance_notice":3,"name":"example name 5194","phone_number":"+44 20 1234 1234","postal_code":"NW1 6XE","reference":"example reference 3090","region":"Greater London","scheme":"bacs"}],"verification_status":"action_required"},{"address_line1":"338-346 Goswell Road","address_line2":null,"address_line3":null,"can_create_refunds":false,"city":null,"country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","fx_payout_currency":"EUR","id":"CR123","links":{"default_aud_payout_account":null,"default_cad_payout_account":"BA792","default_dkk_payout_account":"BA790","default_eur_payout_account":null,"default_gbp_payout_account":null,"default_nzd_payout_account":"BA791","default_sek_payout_account":null},"logo_url":"https://uploads.gocardless.com/logo.png","name":"Nude Wines","postal_code":"EC1V 7LQ","region":"example region 5561","scheme_identifiers":[{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":null,"can_specify_mandate_reference":false,"city":"London","country_code":"GB","currency":"EUR","email":"user@example.com","minimum_advance_notice":3,"name":"example name 2888","phone_number":"+44 20 1234 1234","postal_code":"NW1 6XE","reference":"example reference 4538","region":"Greater London","scheme":"bacs"}],"verification_status":"action_required"}],"meta":{"cursors":{"after":"example after 9947","before":"example before 8047"},"limit":50}}
"body": {"creditors":[{"address_line1":null,"address_line2":"Islington","address_line3":"example address_line3 2433","can_create_refunds":false,"city":"London","country_code":null,"created_at":"2014-01-01T12:00:00.000Z","fx_payout_currency":"EUR","id":"CR123","links":{"default_aud_payout_account":null,"default_cad_payout_account":"BA792","default_dkk_payout_account":null,"default_eur_payout_account":null,"default_gbp_payout_account":"BA123","default_nzd_payout_account":"BA791","default_sek_payout_account":null,"default_usd_payout_account":"BA792"},"logo_url":null,"name":"Nude Wines","postal_code":null,"region":"example region 3090","scheme_identifiers":[{"address_line1":"221B Baker Street","address_line2":null,"address_line3":"City of Westminster","can_specify_mandate_reference":false,"city":"London","country_code":"GB","currency":"EUR","email":"user@example.com","minimum_advance_notice":3,"name":"example name 5356","phone_number":"+44 20 1234 1234","postal_code":"NW1 6XE","reference":"example reference 1737","region":"Greater London","scheme":"bacs"}],"verification_status":"action_required"},{"address_line1":null,"address_line2":"Islington","address_line3":"example address_line3 4538","can_create_refunds":false,"city":null,"country_code":null,"created_at":"2014-01-01T12:00:00.000Z","fx_payout_currency":"EUR","id":"CR123","links":{"default_aud_payout_account":null,"default_cad_payout_account":null,"default_dkk_payout_account":null,"default_eur_payout_account":null,"default_gbp_payout_account":"BA123","default_nzd_payout_account":"BA791","default_sek_payout_account":"BA789","default_usd_payout_account":"BA792"},"logo_url":"https://uploads.gocardless.com/logo.png","name":"Nude Wines","postal_code":"EC1V 7LQ","region":null,"scheme_identifiers":[{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":null,"can_specify_mandate_reference":false,"city":"London","country_code":"GB","currency":"EUR","email":"user@example.com","minimum_advance_notice":3,"name":"example name 5561","phone_number":"+44 20 1234 1234","postal_code":"NW1 6XE","reference":"example reference 9828","region":null,"scheme":"bacs"}],"verification_status":"action_required"}],"meta":{"cursors":{"after":"example after 5746","before":"example before 1563"},"limit":50}}
},
"get": {
"method": "GET",
"path_template": "/creditors/:identity",
"url_params": {"identity": "CR123"},
"body": {"creditors":{"address_line1":"338-346 Goswell Road","address_line2":null,"address_line3":null,"can_create_refunds":false,"city":null,"country_code":null,"created_at":"2014-01-01T12:00:00.000Z","fx_payout_currency":"EUR","id":"CR123","links":{"default_aud_payout_account":"BA234","default_cad_payout_account":null,"default_dkk_payout_account":"BA790","default_eur_payout_account":null,"default_gbp_payout_account":"BA123","default_nzd_payout_account":null,"default_sek_payout_account":null},"logo_url":"https://uploads.gocardless.com/logo.png","name":"Nude Wines","postal_code":"EC1V 7LQ","region":null,"scheme_identifiers":[{"address_line1":"221B Baker Street","address_line2":null,"address_line3":null,"can_specify_mandate_reference":false,"city":"London","country_code":"GB","currency":"EUR","email":"user@example.com","minimum_advance_notice":3,"name":"example name 6420","phone_number":"+44 20 1234 1234","postal_code":"NW1 6XE","reference":"example reference 5094","region":null,"scheme":"bacs"}],"verification_status":"action_required"}}
"body": {"creditors":{"address_line1":null,"address_line2":null,"address_line3":"example address_line3 3033","can_create_refunds":false,"city":null,"country_code":null,"created_at":"2014-01-01T12:00:00.000Z","fx_payout_currency":"EUR","id":"CR123","links":{"default_aud_payout_account":null,"default_cad_payout_account":null,"default_dkk_payout_account":"BA790","default_eur_payout_account":null,"default_gbp_payout_account":null,"default_nzd_payout_account":null,"default_sek_payout_account":"BA789","default_usd_payout_account":null},"logo_url":"https://uploads.gocardless.com/logo.png","name":"Nude Wines","postal_code":"EC1V 7LQ","region":"example region 9107","scheme_identifiers":[{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":null,"can_specify_mandate_reference":false,"city":"London","country_code":"GB","currency":"EUR","email":"user@example.com","minimum_advance_notice":3,"name":"example name 9336","phone_number":"+44 20 1234 1234","postal_code":"NW1 6XE","reference":"example reference 8643","region":null,"scheme":"bacs"}],"verification_status":"action_required"}}
},
"update": {
"method": "PUT",
"path_template": "/creditors/:identity",
"url_params": {"identity": "CR123"},
"body": {"creditors":{"address_line1":"338-346 Goswell Road","address_line2":null,"address_line3":"example address_line3 552","can_create_refunds":false,"city":null,"country_code":null,"created_at":"2014-01-01T12:00:00.000Z","fx_payout_currency":"EUR","id":"CR123","links":{"default_aud_payout_account":"BA234","default_cad_payout_account":"BA792","default_dkk_payout_account":"BA790","default_eur_payout_account":null,"default_gbp_payout_account":null,"default_nzd_payout_account":null,"default_sek_payout_account":"BA789"},"logo_url":null,"name":"Nude Wines","postal_code":null,"region":null,"scheme_identifiers":[{"address_line1":"221B Baker Street","address_line2":null,"address_line3":"City of Westminster","can_specify_mandate_reference":false,"city":"London","country_code":"GB","currency":"EUR","email":"user@example.com","minimum_advance_notice":3,"name":"example name 1598","phone_number":"+44 20 1234 1234","postal_code":"NW1 6XE","reference":"example reference 7425","region":"Greater London","scheme":"bacs"}],"verification_status":"action_required"}}
"body": {"creditors":{"address_line1":"338-346 Goswell Road","address_line2":"Islington","address_line3":"example address_line3 5285","can_create_refunds":false,"city":"London","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","fx_payout_currency":"EUR","id":"CR123","links":{"default_aud_payout_account":"BA234","default_cad_payout_account":null,"default_dkk_payout_account":null,"default_eur_payout_account":"BA456","default_gbp_payout_account":"BA123","default_nzd_payout_account":null,"default_sek_payout_account":null,"default_usd_payout_account":null},"logo_url":"https://uploads.gocardless.com/logo.png","name":"Nude Wines","postal_code":null,"region":null,"scheme_identifiers":[{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":"City of Westminster","can_specify_mandate_reference":false,"city":"London","country_code":"GB","currency":"EUR","email":"user@example.com","minimum_advance_notice":3,"name":"example name 3098","phone_number":"+44 20 1234 1234","postal_code":"NW1 6XE","reference":"example reference 8591","region":"Greater London","scheme":"bacs"}],"verification_status":"action_required"}}
}
}

Loading

0 comments on commit f11eefe

Please sign in to comment.