-
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 #182 from gocardless/template-changes
Changes from gocardless/gocardless-pro-php-template
- Loading branch information
Showing
39 changed files
with
375 additions
and
79 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?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 logo, providing access to its | ||
* attributes | ||
* | ||
* @property-read $id | ||
*/ | ||
class Logo extends BaseResource | ||
{ | ||
protected $model_name = "Logo"; | ||
|
||
/** | ||
* Unique identifier, beginning with "LO". | ||
*/ | ||
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,25 @@ | ||
<?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 payer_theme, providing access to its | ||
* attributes | ||
* | ||
* @property-read $id | ||
*/ | ||
class PayerTheme extends BaseResource | ||
{ | ||
protected $model_name = "PayerTheme"; | ||
|
||
/** | ||
* Unique identifier, beginning with "PTH". | ||
*/ | ||
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,61 @@ | ||
<?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\Logo; | ||
use \GoCardlessPro\Core\Exception\InvalidStateException; | ||
|
||
|
||
/** | ||
* Service that provides access to the Logo | ||
* endpoints of the API | ||
* | ||
* @method createForCreditor() | ||
*/ | ||
class LogosService extends BaseService | ||
{ | ||
|
||
protected $envelope_key = 'logos'; | ||
protected $resource_class = '\GoCardlessPro\Resources\Logo'; | ||
|
||
|
||
/** | ||
* Create a logo associated with a creditor | ||
* | ||
* Example URL: /creditors/:identity/branding/logos | ||
* | ||
* @param string $identity Unique identifier, beginning with "CR". | ||
* @param string[mixed] $params An associative array for any params | ||
* @return Logo | ||
**/ | ||
public function createForCreditor($identity, $params = array()) | ||
{ | ||
$path = Util::subUrl( | ||
'/creditors/:identity/branding/logos', | ||
array( | ||
|
||
'identity' => $identity | ||
) | ||
); | ||
if(isset($params['params'])) { | ||
$params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); | ||
|
||
unset($params['params']); | ||
} | ||
|
||
|
||
$response = $this->api_client->post($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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?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\PayerTheme; | ||
use \GoCardlessPro\Core\Exception\InvalidStateException; | ||
|
||
|
||
/** | ||
* Service that provides access to the PayerTheme | ||
* endpoints of the API | ||
* | ||
* @method createForCreditor() | ||
*/ | ||
class PayerThemesService extends BaseService | ||
{ | ||
|
||
protected $envelope_key = 'payer_themes'; | ||
protected $resource_class = '\GoCardlessPro\Resources\PayerTheme'; | ||
|
||
|
||
/** | ||
* Create a payer theme associated with a creditor | ||
* | ||
* Example URL: /creditors/:identity/branding/payer_themes | ||
* | ||
* @param string $identity Unique identifier, beginning with "CR". | ||
* @param string[mixed] $params An associative array for any params | ||
* @return PayerTheme | ||
**/ | ||
public function createForCreditor($identity, $params = array()) | ||
{ | ||
$path = Util::subUrl( | ||
'/creditors/:identity/branding/payer_themes', | ||
array( | ||
|
||
'identity' => $identity | ||
) | ||
); | ||
if(isset($params['params'])) { | ||
$params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); | ||
|
||
unset($params['params']); | ||
} | ||
|
||
|
||
$response = $this->api_client->post($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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
// | ||
// WARNING: Do not edit by hand, this file was generated by Crank: | ||
// https://github.com/gocardless/crank | ||
// | ||
|
||
namespace GoCardlessPro\Integration; | ||
|
||
class LogosIntegrationTest extends IntegrationTestBase | ||
{ | ||
public function testResourceModelExists() | ||
{ | ||
$obj = new \GoCardlessPro\Resources\Logo(array()); | ||
$this->assertNotNull($obj); | ||
} | ||
|
||
public function testLogosCreateForCreditor() | ||
{ | ||
$fixture = $this->loadJsonFixture('logos')->create_for_creditor; | ||
$this->stub_request($fixture); | ||
|
||
$service = $this->client->logos(); | ||
$response = call_user_func_array(array($service, 'createForCreditor'), (array)$fixture->url_params); | ||
|
||
$body = $fixture->body->logos; | ||
|
||
$this->assertInstanceOf('\GoCardlessPro\Resources\Logo', $response); | ||
|
||
$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()); | ||
} | ||
|
||
|
||
} |
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,38 @@ | ||
<?php | ||
// | ||
// WARNING: Do not edit by hand, this file was generated by Crank: | ||
// https://github.com/gocardless/crank | ||
// | ||
|
||
namespace GoCardlessPro\Integration; | ||
|
||
class PayerThemesIntegrationTest extends IntegrationTestBase | ||
{ | ||
public function testResourceModelExists() | ||
{ | ||
$obj = new \GoCardlessPro\Resources\PayerTheme(array()); | ||
$this->assertNotNull($obj); | ||
} | ||
|
||
public function testPayerThemesCreateForCreditor() | ||
{ | ||
$fixture = $this->loadJsonFixture('payer_themes')->create_for_creditor; | ||
$this->stub_request($fixture); | ||
|
||
$service = $this->client->payerThemes(); | ||
$response = call_user_func_array(array($service, 'createForCreditor'), (array)$fixture->url_params); | ||
|
||
$body = $fixture->body->payer_themes; | ||
|
||
$this->assertInstanceOf('\GoCardlessPro\Resources\PayerTheme', $response); | ||
|
||
$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()); | ||
} | ||
|
||
|
||
} |
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":"2024-01-18T10:46:40.094Z","customer_details_captured":true,"exit_uri":"https://my-website.com/abc/callback","expires_at":"2024-01-18T10:46:40.094Z","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}} | ||
"body": {"billing_request_flows":{"authorisation_url":"https://monzo.com/abc-123-things","auto_fulfil":true,"created_at":"2024-05-23T09:00:16.721Z","customer_details_captured":true,"exit_uri":"https://my-website.com/abc/callback","expires_at":"2024-05-23T09:00:16.721Z","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":"2024-01-18T10:46:40.094Z","customer_details_captured":false,"exit_uri":"https://my-website.com/abc/callback","expires_at":"2024-01-18T10:46:40.094Z","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":true,"created_at":"2024-05-23T09:00:16.721Z","customer_details_captured":true,"exit_uri":"https://my-website.com/abc/callback","expires_at":"2024-05-23T09:00:16.721Z","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}} | ||
} | ||
} | ||
|
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.