-
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.
Changes generated by aa4cbec30e45d359738061e94d8d43a65bb90767
This commit was automatically created from gocardless/gocardless-pro-php-template@aa4cbec by the `push-files` action. Workflow run: https://github.com/gocardless/gocardless-pro-php-template/actions/runs/10176820043
- Loading branch information
1 parent
72c6ceb
commit 411c463
Showing
31 changed files
with
338 additions
and
70 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?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 export, providing access to its | ||
* attributes | ||
* | ||
* @property-read $created_at | ||
* @property-read $currency | ||
* @property-read $download_url | ||
* @property-read $export_type | ||
* @property-read $id | ||
*/ | ||
class Export extends BaseResource | ||
{ | ||
protected $model_name = "Export"; | ||
|
||
/** | ||
* Fixed [timestamp](#api-usage-time-zones--dates), recording when this | ||
* resource was created. | ||
*/ | ||
protected $created_at; | ||
|
||
/** | ||
* The currency of the export (if applicable) | ||
*/ | ||
protected $currency; | ||
|
||
/** | ||
* Download url for the export file. Subject to expiry. | ||
*/ | ||
protected $download_url; | ||
|
||
/** | ||
* The type of the export | ||
*/ | ||
protected $export_type; | ||
|
||
/** | ||
* Unique identifier, beginning with "EX". | ||
*/ | ||
protected $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,95 @@ | ||
<?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\Export; | ||
use \GoCardlessPro\Core\Exception\InvalidStateException; | ||
|
||
|
||
/** | ||
* Service that provides access to the Export | ||
* endpoints of the API | ||
* | ||
* @method get() | ||
* @method list() | ||
*/ | ||
class ExportsService extends BaseService | ||
{ | ||
|
||
protected $envelope_key = 'exports'; | ||
protected $resource_class = '\GoCardlessPro\Resources\Export'; | ||
|
||
|
||
/** | ||
* Get a single export | ||
* | ||
* Example URL: /exports/:identity | ||
* | ||
* @param string $identity Unique identifier, beginning with "EX". | ||
* @param string[mixed] $params An associative array for any params | ||
* @return Export | ||
**/ | ||
public function get($identity, $params = array()) | ||
{ | ||
$path = Util::subUrl( | ||
'/exports/: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); | ||
} | ||
|
||
/** | ||
* List exports | ||
* | ||
* Example URL: /exports | ||
* | ||
* @param string[mixed] $params An associative array for any params | ||
* @return ListResponse | ||
**/ | ||
protected function _doList($params = array()) | ||
{ | ||
$path = "/exports"; | ||
if(isset($params['params'])) { $params['query'] = $params['params']; | ||
unset($params['params']); | ||
} | ||
|
||
|
||
$response = $this->api_client->get($path, $params); | ||
|
||
|
||
return $this->getResourceForResponse($response); | ||
} | ||
|
||
/** | ||
* List exports | ||
* | ||
* Example URL: /exports | ||
* | ||
* @param string[mixed] $params | ||
* @return Paginator | ||
**/ | ||
public function all($params = array()) | ||
{ | ||
return new Paginator($this, $params); | ||
} | ||
|
||
} |
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,93 @@ | ||
<?php | ||
// | ||
// WARNING: Do not edit by hand, this file was generated by Crank: | ||
// https://github.com/gocardless/crank | ||
// | ||
|
||
namespace GoCardlessPro\Integration; | ||
|
||
class ExportsIntegrationTest extends IntegrationTestBase | ||
{ | ||
public function testResourceModelExists() | ||
{ | ||
$obj = new \GoCardlessPro\Resources\Export(array()); | ||
$this->assertNotNull($obj); | ||
} | ||
|
||
public function testExportsGet() | ||
{ | ||
$fixture = $this->loadJsonFixture('exports')->get; | ||
$this->stub_request($fixture); | ||
|
||
$service = $this->client->exports(); | ||
$response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params); | ||
|
||
$body = $fixture->body->exports; | ||
|
||
$this->assertInstanceOf('\GoCardlessPro\Resources\Export', $response); | ||
|
||
$this->assertEquals($body->created_at, $response->created_at); | ||
$this->assertEquals($body->currency, $response->currency); | ||
$this->assertEquals($body->download_url, $response->download_url); | ||
$this->assertEquals($body->export_type, $response->export_type); | ||
$this->assertEquals($body->id, $response->id); | ||
|
||
|
||
$expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); | ||
$dispatchedRequest = $this->history[0]['request']; | ||
$this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); | ||
} | ||
|
||
|
||
public function testExportsList() | ||
{ | ||
$fixture = $this->loadJsonFixture('exports')->list; | ||
$this->stub_request($fixture); | ||
|
||
$service = $this->client->exports(); | ||
$response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params); | ||
|
||
$body = $fixture->body->exports; | ||
|
||
$records = $response->records; | ||
$this->assertInstanceOf('\GoCardlessPro\Core\ListResponse', $response); | ||
$this->assertInstanceOf('\GoCardlessPro\Resources\Export', $records[0]); | ||
if (!is_null($fixture->body) && property_exists($fixture->body, 'meta') && !is_null($fixture->body->meta)) { | ||
$this->assertEquals($fixture->body->meta->cursors->before, $response->before); | ||
$this->assertEquals($fixture->body->meta->cursors->after, $response->after); | ||
} | ||
|
||
|
||
|
||
foreach (range(0, count($body) - 1) as $num) { | ||
$record = $records[$num]; | ||
|
||
if (isset($body[$num]->created_at)) { | ||
$this->assertEquals($body[$num]->created_at, $record->created_at); | ||
} | ||
|
||
if (isset($body[$num]->currency)) { | ||
$this->assertEquals($body[$num]->currency, $record->currency); | ||
} | ||
|
||
if (isset($body[$num]->download_url)) { | ||
$this->assertEquals($body[$num]->download_url, $record->download_url); | ||
} | ||
|
||
if (isset($body[$num]->export_type)) { | ||
$this->assertEquals($body[$num]->export_type, $record->export_type); | ||
} | ||
|
||
if (isset($body[$num]->id)) { | ||
$this->assertEquals($body[$num]->id, $record->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":true,"created_at":"2024-07-26T16:10:31.345Z","customer_details_captured":false,"exit_uri":"https://my-website.com/abc/callback","expires_at":"2024-07-26T16:10:31.345Z","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":true}} | ||
"body": {"billing_request_flows":{"authorisation_url":"https://monzo.com/abc-123-things","auto_fulfil":true,"created_at":"2024-07-31T08:32:25.611Z","customer_details_captured":true,"exit_uri":"https://my-website.com/abc/callback","expires_at":"2024-07-31T08:32:25.611Z","id":"BRF123","language":"en","links":{"billing_request":"BRQ123"},"lock_bank_account":true,"lock_currency":false,"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}} | ||
}, | ||
"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":"2024-07-26T16:10:31.345Z","customer_details_captured":true,"exit_uri":"https://my-website.com/abc/callback","expires_at":"2024-07-26T16:10:31.345Z","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":true,"show_success_redirect_button":true}} | ||
"body": {"billing_request_flows":{"authorisation_url":"https://monzo.com/abc-123-things","auto_fulfil":true,"created_at":"2024-07-31T08:32:25.611Z","customer_details_captured":false,"exit_uri":"https://my-website.com/abc/callback","expires_at":"2024-07-31T08:32:25.611Z","id":"BRF123","language":"en","links":{"billing_request":"BRQ123"},"lock_bank_account":true,"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":true,"show_success_redirect_button":true}} | ||
} | ||
} | ||
|
Oops, something went wrong.