Skip to content

Commit

Permalink
Changes generated by f6a75ed6c5208c657439eb35201bc860eb9d1fb5
Browse files Browse the repository at this point in the history
This commit was automatically created from gocardless/gocardless-pro-php-template@f6a75ed
by the `push-files` action.

Workflow run: https://github.com/gocardless/gocardless-pro-php-template/actions/runs/6978658471
  • Loading branch information
gocardless-ci-robot[bot] committed Nov 24, 2023
1 parent 7292a6a commit b6a12fa
Show file tree
Hide file tree
Showing 21 changed files with 216 additions and 45 deletions.
14 changes: 14 additions & 0 deletions lib/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,20 @@ public function taxRates()
return $this->tax_rates;
}

/**
* Service for interacting with transferred mandate
*
* @return Services\TransferredMandatesService
*/
public function transferredMandates()
{
if (!isset($this->transferred_mandates)) {
$this->transferred_mandates = new Services\TransferredMandatesService($this->api_client);
}

return $this->transferred_mandates;
}

/**
* Service for interacting with verification details
*
Expand Down
47 changes: 47 additions & 0 deletions lib/Resources/TransferredMandate.php
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;

}
60 changes: 60 additions & 0 deletions lib/Services/TransferredMandatesService.php
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);
}

}
41 changes: 41 additions & 0 deletions tests/Integration/TransferredMandatesIntegrationTest.php
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());
}


}
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-11-13T13:41:06.014Z","expires_at":"2023-11-13T13:41:06.014Z","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-11-24T08:51:24.441Z","expires_at":"2023-11-24T08:51:24.441Z","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-11-13T13:41:06.014Z","expires_at":"2023-11-13T13:41:06.014Z","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-11-24T08:51:24.441Z","expires_at":"2023-11-24T08:51:24.441Z","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-11-13T13:41:06.019Z","customer_details_captured":true,"exit_uri":"https://my-website.com/abc/callback","expires_at":"2023-11-13T13:41:06.019Z","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":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-24T08:51:24.445Z","customer_details_captured":false,"exit_uri":"https://my-website.com/abc/callback","expires_at":"2023-11-24T08:51:24.445Z","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":true,"created_at":"2023-11-13T13:41:06.019Z","customer_details_captured":true,"exit_uri":"https://my-website.com/abc/callback","expires_at":"2023-11-13T13:41:06.019Z","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":false,"show_success_redirect_button":true}}
"body": {"billing_request_flows":{"authorisation_url":"https://monzo.com/abc-123-things","auto_fulfil":true,"created_at":"2023-11-24T08:51:24.445Z","customer_details_captured":true,"exit_uri":"https://my-website.com/abc/callback","expires_at":"2023-11-24T08:51:24.445Z","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":false,"show_success_redirect_button":true}}
}
}

Loading

0 comments on commit b6a12fa

Please sign in to comment.