From f4b938e72fd5447155c7d8b4fe19198273dcad6e Mon Sep 17 00:00:00 2001 From: "gocardless-ci-robot[bot]" <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> Date: Mon, 23 Mar 2026 17:00:47 +0000 Subject: [PATCH 01/10] Changes generated by 3be91a644360483e5342390b8a3021593cd65d66 This commit was automatically created from gocardless/client-library-templates@3be91a644360483e5342390b8a3021593cd65d66 by the `push-files` action. Workflow run: https://github.com/gocardless/client-library-templates/actions/runs/23449633750 --- lib/Client.php | 4 +- lib/Core/Exception/ApiConnectionException.php | 2 +- .../Exception/AuthenticationException.php | 2 +- .../Exception/GoCardlessInternalException.php | 2 +- lib/Core/Exception/GoCardlessProException.php | 2 +- .../Exception/InvalidApiUsageException.php | 2 +- .../Exception/InvalidSignatureException.php | 2 +- lib/Core/Exception/InvalidStateException.php | 2 +- .../Exception/MalformedResponseException.php | 2 +- lib/Core/Exception/PermissionsException.php | 2 +- lib/Core/Exception/RateLimitException.php | 2 +- .../Exception/ValidationFailedException.php | 2 +- lib/Core/Paginator.php | 16 +++--- phpcs.xml | 23 +++++++++ tests/Core/ListResponseTest.php | 1 + tests/Core/PaginatorTest.php | 7 +-- tests/Integration/BalancesIntegrationTest.php | 4 +- .../BankAccountDetailsIntegrationTest.php | 4 +- ...ountHolderVerificationsIntegrationTest.php | 10 ++-- .../BankAuthorisationsIntegrationTest.php | 10 ++-- .../BankDetailsLookupsIntegrationTest.php | 4 +- .../BillingRequestFlowsIntegrationTest.php | 8 +-- ...BillingRequestTemplatesIntegrationTest.php | 18 +++---- ...llingRequestWithActionsIntegrationTest.php | 4 +- .../BillingRequestsIntegrationTest.php | 50 +++++++++---------- tests/Integration/BlocksIntegrationTest.php | 26 +++++----- .../CreditorBankAccountsIntegrationTest.php | 18 +++---- .../Integration/CreditorsIntegrationTest.php | 18 +++---- .../CurrencyExchangeRatesIntegrationTest.php | 4 +- .../CustomerBankAccountsIntegrationTest.php | 22 ++++---- .../CustomerNotificationsIntegrationTest.php | 4 +- .../Integration/CustomersIntegrationTest.php | 22 ++++---- tests/Integration/EventsIntegrationTest.php | 8 +-- tests/Integration/ExportsIntegrationTest.php | 8 +-- .../FundsAvailabilitiesIntegrationTest.php | 4 +- .../InstalmentSchedulesIntegrationTest.php | 28 +++++------ .../InstitutionsIntegrationTest.php | 8 +-- tests/Integration/IntegrationTestBase.php | 4 +- tests/Integration/LogosIntegrationTest.php | 4 +- .../MandateImportEntriesIntegrationTest.php | 8 +-- .../MandateImportsIntegrationTest.php | 18 +++---- .../MandatePdfsIntegrationTest.php | 4 +- tests/Integration/MandatesIntegrationTest.php | 26 +++++----- .../NegativeBalanceLimitsIntegrationTest.php | 4 +- .../OutboundPaymentsIntegrationTest.php | 34 ++++++------- .../PayerAuthorisationsIntegrationTest.php | 22 ++++---- .../PayerThemesIntegrationTest.php | 4 +- ...mentAccountTransactionsIntegrationTest.php | 8 +-- .../PaymentAccountsIntegrationTest.php | 8 +-- tests/Integration/PaymentsIntegrationTest.php | 26 +++++----- .../PayoutItemsIntegrationTest.php | 4 +- tests/Integration/PayoutsIntegrationTest.php | 12 ++--- .../RedirectFlowsIntegrationTest.php | 14 +++--- tests/Integration/RefundsIntegrationTest.php | 18 +++---- .../ScenarioSimulatorsIntegrationTest.php | 4 +- .../SchemeIdentifiersIntegrationTest.php | 14 +++--- .../SubscriptionsIntegrationTest.php | 30 +++++------ tests/Integration/TaxRatesIntegrationTest.php | 8 +-- .../TransferredMandatesIntegrationTest.php | 4 +- .../VerificationDetailsIntegrationTest.php | 8 +-- tests/Integration/WebhooksIntegrationTest.php | 12 ++--- tests/Resources/ResourceTest.php | 1 + 62 files changed, 340 insertions(+), 314 deletions(-) create mode 100644 phpcs.xml diff --git a/lib/Client.php b/lib/Client.php index cafd697e6..22bc566fe 100644 --- a/lib/Client.php +++ b/lib/Client.php @@ -24,7 +24,7 @@ class Client */ public function __construct($config) { - $this->validate_config($config); + $this->validateConfig($config); $access_token = $config['access_token']; @@ -706,7 +706,7 @@ private function getUrlForEnvironment($environment) * * @param array[string]mixed $config the client configuration options */ - private function validate_config(&$config) + private function validateConfig(&$config) { $required_option_keys = array('access_token', 'environment'); diff --git a/lib/Core/Exception/ApiConnectionException.php b/lib/Core/Exception/ApiConnectionException.php index d9a4e978d..95749d9cf 100644 --- a/lib/Core/Exception/ApiConnectionException.php +++ b/lib/Core/Exception/ApiConnectionException.php @@ -4,4 +4,4 @@ class ApiConnectionException extends GoCardlessProException { -}; +} diff --git a/lib/Core/Exception/AuthenticationException.php b/lib/Core/Exception/AuthenticationException.php index 0f9e90b3a..690d00b56 100644 --- a/lib/Core/Exception/AuthenticationException.php +++ b/lib/Core/Exception/AuthenticationException.php @@ -4,4 +4,4 @@ class AuthenticationException extends InvalidApiUsageException { -}; +} diff --git a/lib/Core/Exception/GoCardlessInternalException.php b/lib/Core/Exception/GoCardlessInternalException.php index 3e9d4a608..e16017f7a 100644 --- a/lib/Core/Exception/GoCardlessInternalException.php +++ b/lib/Core/Exception/GoCardlessInternalException.php @@ -4,4 +4,4 @@ class GoCardlessInternalException extends ApiException { -}; +} diff --git a/lib/Core/Exception/GoCardlessProException.php b/lib/Core/Exception/GoCardlessProException.php index a1295e92a..d417ea520 100644 --- a/lib/Core/Exception/GoCardlessProException.php +++ b/lib/Core/Exception/GoCardlessProException.php @@ -4,4 +4,4 @@ class GoCardlessProException extends \Exception { -}; +} diff --git a/lib/Core/Exception/InvalidApiUsageException.php b/lib/Core/Exception/InvalidApiUsageException.php index 49a18101f..544a5490a 100644 --- a/lib/Core/Exception/InvalidApiUsageException.php +++ b/lib/Core/Exception/InvalidApiUsageException.php @@ -4,4 +4,4 @@ class InvalidApiUsageException extends ApiException { -}; +} diff --git a/lib/Core/Exception/InvalidSignatureException.php b/lib/Core/Exception/InvalidSignatureException.php index 6d6e5bd1d..7baffa271 100644 --- a/lib/Core/Exception/InvalidSignatureException.php +++ b/lib/Core/Exception/InvalidSignatureException.php @@ -4,4 +4,4 @@ class InvalidSignatureException extends GoCardlessProException { -}; +} diff --git a/lib/Core/Exception/InvalidStateException.php b/lib/Core/Exception/InvalidStateException.php index 96c7fd5c3..9a4a92e98 100644 --- a/lib/Core/Exception/InvalidStateException.php +++ b/lib/Core/Exception/InvalidStateException.php @@ -26,4 +26,4 @@ private function getIdempotentCreationConflictError() } } } -}; +} diff --git a/lib/Core/Exception/MalformedResponseException.php b/lib/Core/Exception/MalformedResponseException.php index fd31774b7..312d682b6 100644 --- a/lib/Core/Exception/MalformedResponseException.php +++ b/lib/Core/Exception/MalformedResponseException.php @@ -17,4 +17,4 @@ public function response() { return $this->response; } -}; +} diff --git a/lib/Core/Exception/PermissionsException.php b/lib/Core/Exception/PermissionsException.php index 612e86e08..91926df83 100644 --- a/lib/Core/Exception/PermissionsException.php +++ b/lib/Core/Exception/PermissionsException.php @@ -4,4 +4,4 @@ class PermissionsException extends InvalidApiUsageException { -}; +} diff --git a/lib/Core/Exception/RateLimitException.php b/lib/Core/Exception/RateLimitException.php index 94250de36..a97f3f100 100644 --- a/lib/Core/Exception/RateLimitException.php +++ b/lib/Core/Exception/RateLimitException.php @@ -4,4 +4,4 @@ class RateLimitException extends InvalidApiUsageException { -}; +} diff --git a/lib/Core/Exception/ValidationFailedException.php b/lib/Core/Exception/ValidationFailedException.php index 43e73d1fb..cef682abe 100644 --- a/lib/Core/Exception/ValidationFailedException.php +++ b/lib/Core/Exception/ValidationFailedException.php @@ -12,4 +12,4 @@ protected function extractErrorMessage($error) return $error->message; } } -}; +} diff --git a/lib/Core/Paginator.php b/lib/Core/Paginator.php index c73c5f407..f9d4c2a3f 100644 --- a/lib/Core/Paginator.php +++ b/lib/Core/Paginator.php @@ -11,7 +11,7 @@ class Paginator implements \Iterator /** * Default max records to retrieve per page */ - const HARD_RECORD_LIMIT = 500; + public const HARD_RECORD_LIMIT = 500; /** * @var \GoCardlessPro\Services\BaseService The resource service to fetch records with @@ -63,7 +63,7 @@ public function rewind() { $this->current_position = 0; $this->current_page_position = 0; - $this->current_response = $this->initial_response(); + $this->current_response = $this->initialResponse(); } /** @@ -74,7 +74,7 @@ public function rewind() #[\ReturnTypeWillChange] public function current() { - return $this->current_records()[$this->key()]; + return $this->currentRecords()[$this->key()]; } /** @@ -98,7 +98,7 @@ public function next() ++$this->current_position; if (!$this->valid()) { - $this->current_response = $this->next_response(); + $this->current_response = $this->nextResponse(); $this->current_page_position = $this->current_position; } } @@ -112,7 +112,7 @@ public function next() public function valid() { return !is_null($this->current_response) && - array_key_exists($this->key(), $this->current_records()); + array_key_exists($this->key(), $this->currentRecords()); } /** @@ -120,7 +120,7 @@ public function valid() * * @return ListResponse */ - private function initial_response() + private function initialResponse() { $options = $this->options; $options['params']['after'] = null; @@ -132,7 +132,7 @@ private function initial_response() * * @return ListResponse */ - private function next_response() + private function nextResponse() { $options = $this->options; $options['params']['after'] = $this->current_response->after; @@ -148,7 +148,7 @@ private function next_response() * * @return \GoCardlessPro\Resources\BaseResource[] */ - private function current_records() + private function currentRecords() { return $this->current_response->records; } diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 000000000..c0e5dc5eb --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,23 @@ + + + PHP CodeSniffer configuration for GoCardlessPro + + + + + + + + + lib + tests + + + + + + + + + + diff --git a/tests/Core/ListResponseTest.php b/tests/Core/ListResponseTest.php index 2263ea08f..a8fc62123 100644 --- a/tests/Core/ListResponseTest.php +++ b/tests/Core/ListResponseTest.php @@ -6,6 +6,7 @@ use GoCardlessPro\Core\Exceptions; use GoCardlessPro\Resources\BaseResource; +// phpcs:disable PSR1.Classes.ClassDeclaration.MultipleClasses class FakeResource extends BaseResource { protected $model_name = "FakeResource"; diff --git a/tests/Core/PaginatorTest.php b/tests/Core/PaginatorTest.php index 25421a3dc..e1f6ada5d 100644 --- a/tests/Core/PaginatorTest.php +++ b/tests/Core/PaginatorTest.php @@ -5,6 +5,7 @@ use PHPUnit\Framework\TestCase; use GoCardlessPro\Resources\BaseResource; +// phpcs:disable PSR1.Classes.ClassDeclaration.MultipleClasses class FakePaginationResource extends BaseResource { protected $model_name = "FakeResource"; @@ -16,7 +17,7 @@ class PaginatorTest extends TestCase { private $paginator; - private function build_list_response($raw_body) + private function buildListResponse($raw_body) { $raw_response = new \GuzzleHttp\Psr7\Response(200, [], $raw_body); $decoded_body = json_decode($raw_body); @@ -34,8 +35,8 @@ public function setUp(): void $fake_service = new Mocks\MockService( array( - $this->build_list_response($body_1), - $this->build_list_response($body_2) + $this->buildListResponse($body_1), + $this->buildListResponse($body_2) ) ); diff --git a/tests/Integration/BalancesIntegrationTest.php b/tests/Integration/BalancesIntegrationTest.php index 2c74f6fb3..00c1de4aa 100644 --- a/tests/Integration/BalancesIntegrationTest.php +++ b/tests/Integration/BalancesIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testBalancesList() { $fixture = $this->loadJsonFixture('balances')->list; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->balances(); $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params); @@ -59,7 +59,7 @@ public function testBalancesList() } } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/BankAccountDetailsIntegrationTest.php b/tests/Integration/BankAccountDetailsIntegrationTest.php index e22c70928..6c4dac570 100644 --- a/tests/Integration/BankAccountDetailsIntegrationTest.php +++ b/tests/Integration/BankAccountDetailsIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testBankAccountDetailsGet() { $fixture = $this->loadJsonFixture('bank_account_details')->get; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->bankAccountDetails(); $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params); @@ -49,7 +49,7 @@ public function testBankAccountDetailsGet() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/BankAccountHolderVerificationsIntegrationTest.php b/tests/Integration/BankAccountHolderVerificationsIntegrationTest.php index 173a211e5..8d877d042 100644 --- a/tests/Integration/BankAccountHolderVerificationsIntegrationTest.php +++ b/tests/Integration/BankAccountHolderVerificationsIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testBankAccountHolderVerificationsCreate() { $fixture = $this->loadJsonFixture('bank_account_holder_verifications')->create; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->bankAccountHolderVerifications(); $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params); @@ -49,7 +49,7 @@ public function testBankAccountHolderVerificationsCreate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -91,7 +91,7 @@ public function testBankAccountHolderVerificationsCreateWithIdempotencyConflict( } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $conflictRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $conflictRequest->getUri()->getPath()); $getRequest = $this->history[1]['request']; @@ -101,7 +101,7 @@ public function testBankAccountHolderVerificationsCreateWithIdempotencyConflict( public function testBankAccountHolderVerificationsGet() { $fixture = $this->loadJsonFixture('bank_account_holder_verifications')->get; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->bankAccountHolderVerifications(); $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params); @@ -132,7 +132,7 @@ public function testBankAccountHolderVerificationsGet() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/BankAuthorisationsIntegrationTest.php b/tests/Integration/BankAuthorisationsIntegrationTest.php index 0a9aea85b..9ea8a18d5 100644 --- a/tests/Integration/BankAuthorisationsIntegrationTest.php +++ b/tests/Integration/BankAuthorisationsIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testBankAuthorisationsCreate() { $fixture = $this->loadJsonFixture('bank_authorisations')->create; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->bankAuthorisations(); $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params); @@ -69,7 +69,7 @@ public function testBankAuthorisationsCreate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -126,7 +126,7 @@ public function testBankAuthorisationsCreateWithIdempotencyConflict() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $conflictRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $conflictRequest->getUri()->getPath()); $getRequest = $this->history[1]['request']; @@ -136,7 +136,7 @@ public function testBankAuthorisationsCreateWithIdempotencyConflict() public function testBankAuthorisationsGet() { $fixture = $this->loadJsonFixture('bank_authorisations')->get; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->bankAuthorisations(); $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params); @@ -187,7 +187,7 @@ public function testBankAuthorisationsGet() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/BankDetailsLookupsIntegrationTest.php b/tests/Integration/BankDetailsLookupsIntegrationTest.php index 18fc0fafc..699e33bd8 100644 --- a/tests/Integration/BankDetailsLookupsIntegrationTest.php +++ b/tests/Integration/BankDetailsLookupsIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testBankDetailsLookupsCreate() { $fixture = $this->loadJsonFixture('bank_details_lookups')->create; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->bankDetailsLookups(); $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params); @@ -41,7 +41,7 @@ public function testBankDetailsLookupsCreate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/BillingRequestFlowsIntegrationTest.php b/tests/Integration/BillingRequestFlowsIntegrationTest.php index 057a0279f..2a4489b8f 100644 --- a/tests/Integration/BillingRequestFlowsIntegrationTest.php +++ b/tests/Integration/BillingRequestFlowsIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testBillingRequestFlowsCreate() { $fixture = $this->loadJsonFixture('billing_request_flows')->create; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->billingRequestFlows(); $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params); @@ -105,7 +105,7 @@ public function testBillingRequestFlowsCreate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -114,7 +114,7 @@ public function testBillingRequestFlowsCreate() public function testBillingRequestFlowsInitialise() { $fixture = $this->loadJsonFixture('billing_request_flows')->initialise; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->billingRequestFlows(); $response = call_user_func_array(array($service, 'initialise'), (array)$fixture->url_params); @@ -201,7 +201,7 @@ public function testBillingRequestFlowsInitialise() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/BillingRequestTemplatesIntegrationTest.php b/tests/Integration/BillingRequestTemplatesIntegrationTest.php index d0b8e1762..d837f0321 100644 --- a/tests/Integration/BillingRequestTemplatesIntegrationTest.php +++ b/tests/Integration/BillingRequestTemplatesIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testBillingRequestTemplatesList() { $fixture = $this->loadJsonFixture('billing_request_templates')->list; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->billingRequestTemplates(); $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params); @@ -111,7 +111,7 @@ public function testBillingRequestTemplatesList() } } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -120,7 +120,7 @@ public function testBillingRequestTemplatesList() public function testBillingRequestTemplatesGet() { $fixture = $this->loadJsonFixture('billing_request_templates')->get; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->billingRequestTemplates(); $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params); @@ -203,7 +203,7 @@ public function testBillingRequestTemplatesGet() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -212,7 +212,7 @@ public function testBillingRequestTemplatesGet() public function testBillingRequestTemplatesCreate() { $fixture = $this->loadJsonFixture('billing_request_templates')->create; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->billingRequestTemplates(); $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params); @@ -295,7 +295,7 @@ public function testBillingRequestTemplatesCreate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -376,7 +376,7 @@ public function testBillingRequestTemplatesCreateWithIdempotencyConflict() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $conflictRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $conflictRequest->getUri()->getPath()); $getRequest = $this->history[1]['request']; @@ -386,7 +386,7 @@ public function testBillingRequestTemplatesCreateWithIdempotencyConflict() public function testBillingRequestTemplatesUpdate() { $fixture = $this->loadJsonFixture('billing_request_templates')->update; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->billingRequestTemplates(); $response = call_user_func_array(array($service, 'update'), (array)$fixture->url_params); @@ -469,7 +469,7 @@ public function testBillingRequestTemplatesUpdate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/BillingRequestWithActionsIntegrationTest.php b/tests/Integration/BillingRequestWithActionsIntegrationTest.php index fbe7ef54a..98a044418 100644 --- a/tests/Integration/BillingRequestWithActionsIntegrationTest.php +++ b/tests/Integration/BillingRequestWithActionsIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testBillingRequestWithActionsCreateWithActions() { $fixture = $this->loadJsonFixture('billing_request_with_actions')->create_with_actions; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->billingRequestWithActions(); $response = call_user_func_array(array($service, 'createWithActions'), (array)$fixture->url_params); @@ -37,7 +37,7 @@ public function testBillingRequestWithActionsCreateWithActions() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/BillingRequestsIntegrationTest.php b/tests/Integration/BillingRequestsIntegrationTest.php index 33dc19833..4565591cb 100644 --- a/tests/Integration/BillingRequestsIntegrationTest.php +++ b/tests/Integration/BillingRequestsIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testBillingRequestsCreate() { $fixture = $this->loadJsonFixture('billing_requests')->create; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->billingRequests(); $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params); @@ -93,7 +93,7 @@ public function testBillingRequestsCreate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -168,7 +168,7 @@ public function testBillingRequestsCreateWithIdempotencyConflict() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $conflictRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $conflictRequest->getUri()->getPath()); $getRequest = $this->history[1]['request']; @@ -178,7 +178,7 @@ public function testBillingRequestsCreateWithIdempotencyConflict() public function testBillingRequestsCollectCustomerDetails() { $fixture = $this->loadJsonFixture('billing_requests')->collect_customer_details; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->billingRequests(); $response = call_user_func_array(array($service, 'collectCustomerDetails'), (array)$fixture->url_params); @@ -253,7 +253,7 @@ public function testBillingRequestsCollectCustomerDetails() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -262,7 +262,7 @@ public function testBillingRequestsCollectCustomerDetails() public function testBillingRequestsCollectBankAccount() { $fixture = $this->loadJsonFixture('billing_requests')->collect_bank_account; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->billingRequests(); $response = call_user_func_array(array($service, 'collectBankAccount'), (array)$fixture->url_params); @@ -337,7 +337,7 @@ public function testBillingRequestsCollectBankAccount() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -346,7 +346,7 @@ public function testBillingRequestsCollectBankAccount() public function testBillingRequestsConfirmPayerDetails() { $fixture = $this->loadJsonFixture('billing_requests')->confirm_payer_details; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->billingRequests(); $response = call_user_func_array(array($service, 'confirmPayerDetails'), (array)$fixture->url_params); @@ -421,7 +421,7 @@ public function testBillingRequestsConfirmPayerDetails() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -430,7 +430,7 @@ public function testBillingRequestsConfirmPayerDetails() public function testBillingRequestsFulfil() { $fixture = $this->loadJsonFixture('billing_requests')->fulfil; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->billingRequests(); $response = call_user_func_array(array($service, 'fulfil'), (array)$fixture->url_params); @@ -505,7 +505,7 @@ public function testBillingRequestsFulfil() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -514,7 +514,7 @@ public function testBillingRequestsFulfil() public function testBillingRequestsCancel() { $fixture = $this->loadJsonFixture('billing_requests')->cancel; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->billingRequests(); $response = call_user_func_array(array($service, 'cancel'), (array)$fixture->url_params); @@ -589,7 +589,7 @@ public function testBillingRequestsCancel() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -598,7 +598,7 @@ public function testBillingRequestsCancel() public function testBillingRequestsList() { $fixture = $this->loadJsonFixture('billing_requests')->list; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->billingRequests(); $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params); @@ -683,7 +683,7 @@ public function testBillingRequestsList() } } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -692,7 +692,7 @@ public function testBillingRequestsList() public function testBillingRequestsGet() { $fixture = $this->loadJsonFixture('billing_requests')->get; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->billingRequests(); $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params); @@ -767,7 +767,7 @@ public function testBillingRequestsGet() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -776,7 +776,7 @@ public function testBillingRequestsGet() public function testBillingRequestsNotify() { $fixture = $this->loadJsonFixture('billing_requests')->notify; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->billingRequests(); $response = call_user_func_array(array($service, 'notify'), (array)$fixture->url_params); @@ -851,7 +851,7 @@ public function testBillingRequestsNotify() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -860,7 +860,7 @@ public function testBillingRequestsNotify() public function testBillingRequestsFallback() { $fixture = $this->loadJsonFixture('billing_requests')->fallback; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->billingRequests(); $response = call_user_func_array(array($service, 'fallback'), (array)$fixture->url_params); @@ -935,7 +935,7 @@ public function testBillingRequestsFallback() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -944,7 +944,7 @@ public function testBillingRequestsFallback() public function testBillingRequestsChooseCurrency() { $fixture = $this->loadJsonFixture('billing_requests')->choose_currency; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->billingRequests(); $response = call_user_func_array(array($service, 'chooseCurrency'), (array)$fixture->url_params); @@ -1019,7 +1019,7 @@ public function testBillingRequestsChooseCurrency() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -1028,7 +1028,7 @@ public function testBillingRequestsChooseCurrency() public function testBillingRequestsSelectInstitution() { $fixture = $this->loadJsonFixture('billing_requests')->select_institution; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->billingRequests(); $response = call_user_func_array(array($service, 'selectInstitution'), (array)$fixture->url_params); @@ -1103,7 +1103,7 @@ public function testBillingRequestsSelectInstitution() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/BlocksIntegrationTest.php b/tests/Integration/BlocksIntegrationTest.php index 07b95d6fe..49e514d66 100644 --- a/tests/Integration/BlocksIntegrationTest.php +++ b/tests/Integration/BlocksIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testBlocksCreate() { $fixture = $this->loadJsonFixture('blocks')->create; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->blocks(); $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params); @@ -61,7 +61,7 @@ public function testBlocksCreate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -112,7 +112,7 @@ public function testBlocksCreateWithIdempotencyConflict() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $conflictRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $conflictRequest->getUri()->getPath()); $getRequest = $this->history[1]['request']; @@ -122,7 +122,7 @@ public function testBlocksCreateWithIdempotencyConflict() public function testBlocksGet() { $fixture = $this->loadJsonFixture('blocks')->get; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->blocks(); $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params); @@ -165,7 +165,7 @@ public function testBlocksGet() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -174,7 +174,7 @@ public function testBlocksGet() public function testBlocksList() { $fixture = $this->loadJsonFixture('blocks')->list; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->blocks(); $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params); @@ -227,7 +227,7 @@ public function testBlocksList() } } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -236,7 +236,7 @@ public function testBlocksList() public function testBlocksDisable() { $fixture = $this->loadJsonFixture('blocks')->disable; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->blocks(); $response = call_user_func_array(array($service, 'disable'), (array)$fixture->url_params); @@ -279,7 +279,7 @@ public function testBlocksDisable() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -288,7 +288,7 @@ public function testBlocksDisable() public function testBlocksEnable() { $fixture = $this->loadJsonFixture('blocks')->enable; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->blocks(); $response = call_user_func_array(array($service, 'enable'), (array)$fixture->url_params); @@ -331,7 +331,7 @@ public function testBlocksEnable() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -340,7 +340,7 @@ public function testBlocksEnable() public function testBlocksBlockByRef() { $fixture = $this->loadJsonFixture('blocks')->block_by_ref; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->blocks(); $response = call_user_func_array(array($service, 'blockByRef'), (array)$fixture->url_params); @@ -393,7 +393,7 @@ public function testBlocksBlockByRef() } } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/CreditorBankAccountsIntegrationTest.php b/tests/Integration/CreditorBankAccountsIntegrationTest.php index 432b2b42a..32daf7e53 100644 --- a/tests/Integration/CreditorBankAccountsIntegrationTest.php +++ b/tests/Integration/CreditorBankAccountsIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testCreditorBankAccountsCreate() { $fixture = $this->loadJsonFixture('creditor_bank_accounts')->create; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->creditorBankAccounts(); $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params); @@ -77,7 +77,7 @@ public function testCreditorBankAccountsCreate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -140,7 +140,7 @@ public function testCreditorBankAccountsCreateWithIdempotencyConflict() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $conflictRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $conflictRequest->getUri()->getPath()); $getRequest = $this->history[1]['request']; @@ -150,7 +150,7 @@ public function testCreditorBankAccountsCreateWithIdempotencyConflict() public function testCreditorBankAccountsList() { $fixture = $this->loadJsonFixture('creditor_bank_accounts')->list; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->creditorBankAccounts(); $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params); @@ -219,7 +219,7 @@ public function testCreditorBankAccountsList() } } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -228,7 +228,7 @@ public function testCreditorBankAccountsList() public function testCreditorBankAccountsGet() { $fixture = $this->loadJsonFixture('creditor_bank_accounts')->get; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->creditorBankAccounts(); $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params); @@ -287,7 +287,7 @@ public function testCreditorBankAccountsGet() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -296,7 +296,7 @@ public function testCreditorBankAccountsGet() public function testCreditorBankAccountsDisable() { $fixture = $this->loadJsonFixture('creditor_bank_accounts')->disable; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->creditorBankAccounts(); $response = call_user_func_array(array($service, 'disable'), (array)$fixture->url_params); @@ -355,7 +355,7 @@ public function testCreditorBankAccountsDisable() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/CreditorsIntegrationTest.php b/tests/Integration/CreditorsIntegrationTest.php index b32588db1..d7af44eae 100644 --- a/tests/Integration/CreditorsIntegrationTest.php +++ b/tests/Integration/CreditorsIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testCreditorsCreate() { $fixture = $this->loadJsonFixture('creditors')->create; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->creditors(); $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params); @@ -113,7 +113,7 @@ public function testCreditorsCreate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -203,7 +203,7 @@ public function testCreditorsCreateWithIdempotencyConflict() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $conflictRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $conflictRequest->getUri()->getPath()); $getRequest = $this->history[1]['request']; @@ -213,7 +213,7 @@ public function testCreditorsCreateWithIdempotencyConflict() public function testCreditorsList() { $fixture = $this->loadJsonFixture('creditors')->list; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->creditors(); $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params); @@ -318,7 +318,7 @@ public function testCreditorsList() } } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -327,7 +327,7 @@ public function testCreditorsList() public function testCreditorsGet() { $fixture = $this->loadJsonFixture('creditors')->get; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->creditors(); $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params); @@ -422,7 +422,7 @@ public function testCreditorsGet() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -431,7 +431,7 @@ public function testCreditorsGet() public function testCreditorsUpdate() { $fixture = $this->loadJsonFixture('creditors')->update; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->creditors(); $response = call_user_func_array(array($service, 'update'), (array)$fixture->url_params); @@ -526,7 +526,7 @@ public function testCreditorsUpdate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/CurrencyExchangeRatesIntegrationTest.php b/tests/Integration/CurrencyExchangeRatesIntegrationTest.php index be6db7963..0d3cac531 100644 --- a/tests/Integration/CurrencyExchangeRatesIntegrationTest.php +++ b/tests/Integration/CurrencyExchangeRatesIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testCurrencyExchangeRatesList() { $fixture = $this->loadJsonFixture('currency_exchange_rates')->list; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->currencyExchangeRates(); $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params); @@ -55,7 +55,7 @@ public function testCurrencyExchangeRatesList() } } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/CustomerBankAccountsIntegrationTest.php b/tests/Integration/CustomerBankAccountsIntegrationTest.php index 298eca247..6b52b45ca 100644 --- a/tests/Integration/CustomerBankAccountsIntegrationTest.php +++ b/tests/Integration/CustomerBankAccountsIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testCustomerBankAccountsCreate() { $fixture = $this->loadJsonFixture('customer_bank_accounts')->create; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->customerBankAccounts(); $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params); @@ -77,7 +77,7 @@ public function testCustomerBankAccountsCreate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -140,7 +140,7 @@ public function testCustomerBankAccountsCreateWithIdempotencyConflict() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $conflictRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $conflictRequest->getUri()->getPath()); $getRequest = $this->history[1]['request']; @@ -150,7 +150,7 @@ public function testCustomerBankAccountsCreateWithIdempotencyConflict() public function testCustomerBankAccountsList() { $fixture = $this->loadJsonFixture('customer_bank_accounts')->list; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->customerBankAccounts(); $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params); @@ -219,7 +219,7 @@ public function testCustomerBankAccountsList() } } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -228,7 +228,7 @@ public function testCustomerBankAccountsList() public function testCustomerBankAccountsGet() { $fixture = $this->loadJsonFixture('customer_bank_accounts')->get; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->customerBankAccounts(); $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params); @@ -287,7 +287,7 @@ public function testCustomerBankAccountsGet() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -296,7 +296,7 @@ public function testCustomerBankAccountsGet() public function testCustomerBankAccountsUpdate() { $fixture = $this->loadJsonFixture('customer_bank_accounts')->update; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->customerBankAccounts(); $response = call_user_func_array(array($service, 'update'), (array)$fixture->url_params); @@ -355,7 +355,7 @@ public function testCustomerBankAccountsUpdate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -364,7 +364,7 @@ public function testCustomerBankAccountsUpdate() public function testCustomerBankAccountsDisable() { $fixture = $this->loadJsonFixture('customer_bank_accounts')->disable; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->customerBankAccounts(); $response = call_user_func_array(array($service, 'disable'), (array)$fixture->url_params); @@ -423,7 +423,7 @@ public function testCustomerBankAccountsDisable() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/CustomerNotificationsIntegrationTest.php b/tests/Integration/CustomerNotificationsIntegrationTest.php index 339d2836d..e9f41d66c 100644 --- a/tests/Integration/CustomerNotificationsIntegrationTest.php +++ b/tests/Integration/CustomerNotificationsIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testCustomerNotificationsHandle() { $fixture = $this->loadJsonFixture('customer_notifications')->handle; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->customerNotifications(); $response = call_user_func_array(array($service, 'handle'), (array)$fixture->url_params); @@ -53,7 +53,7 @@ public function testCustomerNotificationsHandle() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/CustomersIntegrationTest.php b/tests/Integration/CustomersIntegrationTest.php index 383901a5f..6b8e5304d 100644 --- a/tests/Integration/CustomersIntegrationTest.php +++ b/tests/Integration/CustomersIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testCustomersCreate() { $fixture = $this->loadJsonFixture('customers')->create; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->customers(); $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params); @@ -101,7 +101,7 @@ public function testCustomersCreate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -182,7 +182,7 @@ public function testCustomersCreateWithIdempotencyConflict() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $conflictRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $conflictRequest->getUri()->getPath()); $getRequest = $this->history[1]['request']; @@ -192,7 +192,7 @@ public function testCustomersCreateWithIdempotencyConflict() public function testCustomersList() { $fixture = $this->loadJsonFixture('customers')->list; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->customers(); $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params); @@ -285,7 +285,7 @@ public function testCustomersList() } } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -294,7 +294,7 @@ public function testCustomersList() public function testCustomersGet() { $fixture = $this->loadJsonFixture('customers')->get; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->customers(); $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params); @@ -377,7 +377,7 @@ public function testCustomersGet() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -386,7 +386,7 @@ public function testCustomersGet() public function testCustomersUpdate() { $fixture = $this->loadJsonFixture('customers')->update; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->customers(); $response = call_user_func_array(array($service, 'update'), (array)$fixture->url_params); @@ -469,7 +469,7 @@ public function testCustomersUpdate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -478,7 +478,7 @@ public function testCustomersUpdate() public function testCustomersRemove() { $fixture = $this->loadJsonFixture('customers')->remove; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->customers(); $response = call_user_func_array(array($service, 'remove'), (array)$fixture->url_params); @@ -561,7 +561,7 @@ public function testCustomersRemove() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/EventsIntegrationTest.php b/tests/Integration/EventsIntegrationTest.php index 06985537b..288ea3f5f 100644 --- a/tests/Integration/EventsIntegrationTest.php +++ b/tests/Integration/EventsIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testEventsList() { $fixture = $this->loadJsonFixture('events')->list; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->events(); $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params); @@ -79,7 +79,7 @@ public function testEventsList() } } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -88,7 +88,7 @@ public function testEventsList() public function testEventsGet() { $fixture = $this->loadJsonFixture('events')->get; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->events(); $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params); @@ -139,7 +139,7 @@ public function testEventsGet() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/ExportsIntegrationTest.php b/tests/Integration/ExportsIntegrationTest.php index 69a3c8d47..3a12998f2 100644 --- a/tests/Integration/ExportsIntegrationTest.php +++ b/tests/Integration/ExportsIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testExportsGet() { $fixture = $this->loadJsonFixture('exports')->get; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->exports(); $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params); @@ -49,7 +49,7 @@ public function testExportsGet() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -58,7 +58,7 @@ public function testExportsGet() public function testExportsList() { $fixture = $this->loadJsonFixture('exports')->list; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->exports(); $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params); @@ -99,7 +99,7 @@ public function testExportsList() } } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/FundsAvailabilitiesIntegrationTest.php b/tests/Integration/FundsAvailabilitiesIntegrationTest.php index 5fba8edf5..8b8225219 100644 --- a/tests/Integration/FundsAvailabilitiesIntegrationTest.php +++ b/tests/Integration/FundsAvailabilitiesIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testFundsAvailabilitiesCheck() { $fixture = $this->loadJsonFixture('funds_availabilities')->check; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->fundsAvailabilities(); $response = call_user_func_array(array($service, 'check'), (array)$fixture->url_params); @@ -33,7 +33,7 @@ public function testFundsAvailabilitiesCheck() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/InstalmentSchedulesIntegrationTest.php b/tests/Integration/InstalmentSchedulesIntegrationTest.php index 6e2138deb..2ffb42547 100644 --- a/tests/Integration/InstalmentSchedulesIntegrationTest.php +++ b/tests/Integration/InstalmentSchedulesIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testInstalmentSchedulesCreateWithDates() { $fixture = $this->loadJsonFixture('instalment_schedules')->create_with_dates; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->instalmentSchedules(); $response = call_user_func_array(array($service, 'createWithDates'), (array)$fixture->url_params); @@ -65,7 +65,7 @@ public function testInstalmentSchedulesCreateWithDates() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -119,7 +119,7 @@ public function testInstalmentSchedulesCreateWithDatesWithIdempotencyConflict() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $conflictRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $conflictRequest->getUri()->getPath()); $getRequest = $this->history[1]['request']; @@ -129,7 +129,7 @@ public function testInstalmentSchedulesCreateWithDatesWithIdempotencyConflict() public function testInstalmentSchedulesCreateWithSchedule() { $fixture = $this->loadJsonFixture('instalment_schedules')->create_with_schedule; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->instalmentSchedules(); $response = call_user_func_array(array($service, 'createWithSchedule'), (array)$fixture->url_params); @@ -176,7 +176,7 @@ public function testInstalmentSchedulesCreateWithSchedule() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -230,7 +230,7 @@ public function testInstalmentSchedulesCreateWithScheduleWithIdempotencyConflict } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $conflictRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $conflictRequest->getUri()->getPath()); $getRequest = $this->history[1]['request']; @@ -240,7 +240,7 @@ public function testInstalmentSchedulesCreateWithScheduleWithIdempotencyConflict public function testInstalmentSchedulesList() { $fixture = $this->loadJsonFixture('instalment_schedules')->list; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->instalmentSchedules(); $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params); @@ -297,7 +297,7 @@ public function testInstalmentSchedulesList() } } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -306,7 +306,7 @@ public function testInstalmentSchedulesList() public function testInstalmentSchedulesGet() { $fixture = $this->loadJsonFixture('instalment_schedules')->get; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->instalmentSchedules(); $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params); @@ -353,7 +353,7 @@ public function testInstalmentSchedulesGet() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -362,7 +362,7 @@ public function testInstalmentSchedulesGet() public function testInstalmentSchedulesUpdate() { $fixture = $this->loadJsonFixture('instalment_schedules')->update; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->instalmentSchedules(); $response = call_user_func_array(array($service, 'update'), (array)$fixture->url_params); @@ -409,7 +409,7 @@ public function testInstalmentSchedulesUpdate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -418,7 +418,7 @@ public function testInstalmentSchedulesUpdate() public function testInstalmentSchedulesCancel() { $fixture = $this->loadJsonFixture('instalment_schedules')->cancel; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->instalmentSchedules(); $response = call_user_func_array(array($service, 'cancel'), (array)$fixture->url_params); @@ -465,7 +465,7 @@ public function testInstalmentSchedulesCancel() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/InstitutionsIntegrationTest.php b/tests/Integration/InstitutionsIntegrationTest.php index e378c540d..ada0629fe 100644 --- a/tests/Integration/InstitutionsIntegrationTest.php +++ b/tests/Integration/InstitutionsIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testInstitutionsList() { $fixture = $this->loadJsonFixture('institutions')->list; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->institutions(); $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params); @@ -71,7 +71,7 @@ public function testInstitutionsList() } } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -80,7 +80,7 @@ public function testInstitutionsList() public function testInstitutionsListForBillingRequest() { $fixture = $this->loadJsonFixture('institutions')->list_for_billing_request; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->institutions(); $response = call_user_func_array(array($service, 'listForBillingRequest'), (array)$fixture->url_params); @@ -133,7 +133,7 @@ public function testInstitutionsListForBillingRequest() } } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/IntegrationTestBase.php b/tests/Integration/IntegrationTestBase.php index fb1c3495d..102970a3d 100644 --- a/tests/Integration/IntegrationTestBase.php +++ b/tests/Integration/IntegrationTestBase.php @@ -47,7 +47,7 @@ public function tearDown(): void parent::tearDown(); } - public function stub_request($resource_fixture) + public function stubRequest($resource_fixture) { $path = preg_replace("/:(\w+)/", "\\w+", $resource_fixture->path_template); $path_regexp = "|" . str_replace("\\\\w\+", "\\w+", preg_quote($path)) . "|"; @@ -57,7 +57,7 @@ public function stub_request($resource_fixture) $this->mock->append($response); } - public function extract_resource_fixture_path_regex($resource_fixture) + public function extractResourceFixturePathRegex($resource_fixture) { $path = preg_replace("/:(\w+)/", "\\w+", $resource_fixture->path_template); return "|" . str_replace("\\\\w\+", "\\w+", preg_quote($path)) . "|"; diff --git a/tests/Integration/LogosIntegrationTest.php b/tests/Integration/LogosIntegrationTest.php index 5c9cd4d19..04a9c2b27 100644 --- a/tests/Integration/LogosIntegrationTest.php +++ b/tests/Integration/LogosIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testLogosCreateForCreditor() { $fixture = $this->loadJsonFixture('logos')->create_for_creditor; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->logos(); $response = call_user_func_array(array($service, 'createForCreditor'), (array)$fixture->url_params); @@ -33,7 +33,7 @@ public function testLogosCreateForCreditor() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/MandateImportEntriesIntegrationTest.php b/tests/Integration/MandateImportEntriesIntegrationTest.php index 572c751b9..d95c0a7ca 100644 --- a/tests/Integration/MandateImportEntriesIntegrationTest.php +++ b/tests/Integration/MandateImportEntriesIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testMandateImportEntriesCreate() { $fixture = $this->loadJsonFixture('mandate_import_entries')->create; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->mandateImportEntries(); $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params); @@ -45,7 +45,7 @@ public function testMandateImportEntriesCreate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -54,7 +54,7 @@ public function testMandateImportEntriesCreate() public function testMandateImportEntriesList() { $fixture = $this->loadJsonFixture('mandate_import_entries')->list; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->mandateImportEntries(); $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params); @@ -91,7 +91,7 @@ public function testMandateImportEntriesList() } } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/MandateImportsIntegrationTest.php b/tests/Integration/MandateImportsIntegrationTest.php index 4a753e198..79249d6e4 100644 --- a/tests/Integration/MandateImportsIntegrationTest.php +++ b/tests/Integration/MandateImportsIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testMandateImportsCreate() { $fixture = $this->loadJsonFixture('mandate_imports')->create; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->mandateImports(); $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params); @@ -49,7 +49,7 @@ public function testMandateImportsCreate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -91,7 +91,7 @@ public function testMandateImportsCreateWithIdempotencyConflict() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $conflictRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $conflictRequest->getUri()->getPath()); $getRequest = $this->history[1]['request']; @@ -101,7 +101,7 @@ public function testMandateImportsCreateWithIdempotencyConflict() public function testMandateImportsGet() { $fixture = $this->loadJsonFixture('mandate_imports')->get; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->mandateImports(); $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params); @@ -132,7 +132,7 @@ public function testMandateImportsGet() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -141,7 +141,7 @@ public function testMandateImportsGet() public function testMandateImportsSubmit() { $fixture = $this->loadJsonFixture('mandate_imports')->submit; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->mandateImports(); $response = call_user_func_array(array($service, 'submit'), (array)$fixture->url_params); @@ -172,7 +172,7 @@ public function testMandateImportsSubmit() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -181,7 +181,7 @@ public function testMandateImportsSubmit() public function testMandateImportsCancel() { $fixture = $this->loadJsonFixture('mandate_imports')->cancel; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->mandateImports(); $response = call_user_func_array(array($service, 'cancel'), (array)$fixture->url_params); @@ -212,7 +212,7 @@ public function testMandateImportsCancel() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/MandatePdfsIntegrationTest.php b/tests/Integration/MandatePdfsIntegrationTest.php index 56ca67385..9f345e876 100644 --- a/tests/Integration/MandatePdfsIntegrationTest.php +++ b/tests/Integration/MandatePdfsIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testMandatePdfsCreate() { $fixture = $this->loadJsonFixture('mandate_pdfs')->create; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->mandatePdfs(); $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params); @@ -37,7 +37,7 @@ public function testMandatePdfsCreate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/MandatesIntegrationTest.php b/tests/Integration/MandatesIntegrationTest.php index 62ef0b257..a3357d12f 100644 --- a/tests/Integration/MandatesIntegrationTest.php +++ b/tests/Integration/MandatesIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testMandatesCreate() { $fixture = $this->loadJsonFixture('mandates')->create; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->mandates(); $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params); @@ -89,7 +89,7 @@ public function testMandatesCreate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -161,7 +161,7 @@ public function testMandatesCreateWithIdempotencyConflict() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $conflictRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $conflictRequest->getUri()->getPath()); $getRequest = $this->history[1]['request']; @@ -171,7 +171,7 @@ public function testMandatesCreateWithIdempotencyConflict() public function testMandatesList() { $fixture = $this->loadJsonFixture('mandates')->list; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->mandates(); $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params); @@ -252,7 +252,7 @@ public function testMandatesList() } } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -261,7 +261,7 @@ public function testMandatesList() public function testMandatesGet() { $fixture = $this->loadJsonFixture('mandates')->get; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->mandates(); $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params); @@ -332,7 +332,7 @@ public function testMandatesGet() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -341,7 +341,7 @@ public function testMandatesGet() public function testMandatesUpdate() { $fixture = $this->loadJsonFixture('mandates')->update; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->mandates(); $response = call_user_func_array(array($service, 'update'), (array)$fixture->url_params); @@ -412,7 +412,7 @@ public function testMandatesUpdate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -421,7 +421,7 @@ public function testMandatesUpdate() public function testMandatesCancel() { $fixture = $this->loadJsonFixture('mandates')->cancel; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->mandates(); $response = call_user_func_array(array($service, 'cancel'), (array)$fixture->url_params); @@ -492,7 +492,7 @@ public function testMandatesCancel() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -501,7 +501,7 @@ public function testMandatesCancel() public function testMandatesReinstate() { $fixture = $this->loadJsonFixture('mandates')->reinstate; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->mandates(); $response = call_user_func_array(array($service, 'reinstate'), (array)$fixture->url_params); @@ -572,7 +572,7 @@ public function testMandatesReinstate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/NegativeBalanceLimitsIntegrationTest.php b/tests/Integration/NegativeBalanceLimitsIntegrationTest.php index 29b71c543..f88708152 100644 --- a/tests/Integration/NegativeBalanceLimitsIntegrationTest.php +++ b/tests/Integration/NegativeBalanceLimitsIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testNegativeBalanceLimitsList() { $fixture = $this->loadJsonFixture('negative_balance_limits')->list; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->negativeBalanceLimits(); $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params); @@ -59,7 +59,7 @@ public function testNegativeBalanceLimitsList() } } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/OutboundPaymentsIntegrationTest.php b/tests/Integration/OutboundPaymentsIntegrationTest.php index 70846735d..c1e0be419 100644 --- a/tests/Integration/OutboundPaymentsIntegrationTest.php +++ b/tests/Integration/OutboundPaymentsIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testOutboundPaymentsCreate() { $fixture = $this->loadJsonFixture('outbound_payments')->create; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->outboundPayments(); $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params); @@ -81,7 +81,7 @@ public function testOutboundPaymentsCreate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -147,7 +147,7 @@ public function testOutboundPaymentsCreateWithIdempotencyConflict() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $conflictRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $conflictRequest->getUri()->getPath()); $getRequest = $this->history[1]['request']; @@ -157,7 +157,7 @@ public function testOutboundPaymentsCreateWithIdempotencyConflict() public function testOutboundPaymentsWithdraw() { $fixture = $this->loadJsonFixture('outbound_payments')->withdraw; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->outboundPayments(); $response = call_user_func_array(array($service, 'withdraw'), (array)$fixture->url_params); @@ -220,7 +220,7 @@ public function testOutboundPaymentsWithdraw() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -229,7 +229,7 @@ public function testOutboundPaymentsWithdraw() public function testOutboundPaymentsCancel() { $fixture = $this->loadJsonFixture('outbound_payments')->cancel; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->outboundPayments(); $response = call_user_func_array(array($service, 'cancel'), (array)$fixture->url_params); @@ -292,7 +292,7 @@ public function testOutboundPaymentsCancel() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -301,7 +301,7 @@ public function testOutboundPaymentsCancel() public function testOutboundPaymentsApprove() { $fixture = $this->loadJsonFixture('outbound_payments')->approve; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->outboundPayments(); $response = call_user_func_array(array($service, 'approve'), (array)$fixture->url_params); @@ -364,7 +364,7 @@ public function testOutboundPaymentsApprove() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -373,7 +373,7 @@ public function testOutboundPaymentsApprove() public function testOutboundPaymentsGet() { $fixture = $this->loadJsonFixture('outbound_payments')->get; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->outboundPayments(); $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params); @@ -436,7 +436,7 @@ public function testOutboundPaymentsGet() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -445,7 +445,7 @@ public function testOutboundPaymentsGet() public function testOutboundPaymentsList() { $fixture = $this->loadJsonFixture('outbound_payments')->list; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->outboundPayments(); $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params); @@ -518,7 +518,7 @@ public function testOutboundPaymentsList() } } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -527,7 +527,7 @@ public function testOutboundPaymentsList() public function testOutboundPaymentsUpdate() { $fixture = $this->loadJsonFixture('outbound_payments')->update; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->outboundPayments(); $response = call_user_func_array(array($service, 'update'), (array)$fixture->url_params); @@ -590,7 +590,7 @@ public function testOutboundPaymentsUpdate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -599,7 +599,7 @@ public function testOutboundPaymentsUpdate() public function testOutboundPaymentsStats() { $fixture = $this->loadJsonFixture('outbound_payments')->stats; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->outboundPayments(); $response = call_user_func_array(array($service, 'stats'), (array)$fixture->url_params); @@ -662,7 +662,7 @@ public function testOutboundPaymentsStats() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/PayerAuthorisationsIntegrationTest.php b/tests/Integration/PayerAuthorisationsIntegrationTest.php index 0fec5acd9..c688096bb 100644 --- a/tests/Integration/PayerAuthorisationsIntegrationTest.php +++ b/tests/Integration/PayerAuthorisationsIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testPayerAuthorisationsGet() { $fixture = $this->loadJsonFixture('payer_authorisations')->get; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->payerAuthorisations(); $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params); @@ -61,7 +61,7 @@ public function testPayerAuthorisationsGet() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -70,7 +70,7 @@ public function testPayerAuthorisationsGet() public function testPayerAuthorisationsCreate() { $fixture = $this->loadJsonFixture('payer_authorisations')->create; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->payerAuthorisations(); $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params); @@ -113,7 +113,7 @@ public function testPayerAuthorisationsCreate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -164,7 +164,7 @@ public function testPayerAuthorisationsCreateWithIdempotencyConflict() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $conflictRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $conflictRequest->getUri()->getPath()); $getRequest = $this->history[1]['request']; @@ -174,7 +174,7 @@ public function testPayerAuthorisationsCreateWithIdempotencyConflict() public function testPayerAuthorisationsUpdate() { $fixture = $this->loadJsonFixture('payer_authorisations')->update; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->payerAuthorisations(); $response = call_user_func_array(array($service, 'update'), (array)$fixture->url_params); @@ -217,7 +217,7 @@ public function testPayerAuthorisationsUpdate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -226,7 +226,7 @@ public function testPayerAuthorisationsUpdate() public function testPayerAuthorisationsSubmit() { $fixture = $this->loadJsonFixture('payer_authorisations')->submit; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->payerAuthorisations(); $response = call_user_func_array(array($service, 'submit'), (array)$fixture->url_params); @@ -269,7 +269,7 @@ public function testPayerAuthorisationsSubmit() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -278,7 +278,7 @@ public function testPayerAuthorisationsSubmit() public function testPayerAuthorisationsConfirm() { $fixture = $this->loadJsonFixture('payer_authorisations')->confirm; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->payerAuthorisations(); $response = call_user_func_array(array($service, 'confirm'), (array)$fixture->url_params); @@ -321,7 +321,7 @@ public function testPayerAuthorisationsConfirm() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/PayerThemesIntegrationTest.php b/tests/Integration/PayerThemesIntegrationTest.php index 4602ecefe..7ad742132 100644 --- a/tests/Integration/PayerThemesIntegrationTest.php +++ b/tests/Integration/PayerThemesIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testPayerThemesCreateForCreditor() { $fixture = $this->loadJsonFixture('payer_themes')->create_for_creditor; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->payerThemes(); $response = call_user_func_array(array($service, 'createForCreditor'), (array)$fixture->url_params); @@ -33,7 +33,7 @@ public function testPayerThemesCreateForCreditor() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/PaymentAccountTransactionsIntegrationTest.php b/tests/Integration/PaymentAccountTransactionsIntegrationTest.php index 53f0221f8..0849da1a7 100644 --- a/tests/Integration/PaymentAccountTransactionsIntegrationTest.php +++ b/tests/Integration/PaymentAccountTransactionsIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testPaymentAccountTransactionsGet() { $fixture = $this->loadJsonFixture('payment_account_transactions')->get; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->paymentAccountTransactions(); $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params); @@ -69,7 +69,7 @@ public function testPaymentAccountTransactionsGet() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -78,7 +78,7 @@ public function testPaymentAccountTransactionsGet() public function testPaymentAccountTransactionsList() { $fixture = $this->loadJsonFixture('payment_account_transactions')->list; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->paymentAccountTransactions(); $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params); @@ -139,7 +139,7 @@ public function testPaymentAccountTransactionsList() } } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/PaymentAccountsIntegrationTest.php b/tests/Integration/PaymentAccountsIntegrationTest.php index 6e9a54259..c146076cd 100644 --- a/tests/Integration/PaymentAccountsIntegrationTest.php +++ b/tests/Integration/PaymentAccountsIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testPaymentAccountsGet() { $fixture = $this->loadJsonFixture('payment_accounts')->get; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->paymentAccounts(); $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params); @@ -57,7 +57,7 @@ public function testPaymentAccountsGet() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -66,7 +66,7 @@ public function testPaymentAccountsGet() public function testPaymentAccountsList() { $fixture = $this->loadJsonFixture('payment_accounts')->list; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->paymentAccounts(); $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params); @@ -115,7 +115,7 @@ public function testPaymentAccountsList() } } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/PaymentsIntegrationTest.php b/tests/Integration/PaymentsIntegrationTest.php index 066d2567b..89ae94e37 100644 --- a/tests/Integration/PaymentsIntegrationTest.php +++ b/tests/Integration/PaymentsIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testPaymentsCreate() { $fixture = $this->loadJsonFixture('payments')->create; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->payments(); $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params); @@ -89,7 +89,7 @@ public function testPaymentsCreate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -161,7 +161,7 @@ public function testPaymentsCreateWithIdempotencyConflict() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $conflictRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $conflictRequest->getUri()->getPath()); $getRequest = $this->history[1]['request']; @@ -171,7 +171,7 @@ public function testPaymentsCreateWithIdempotencyConflict() public function testPaymentsList() { $fixture = $this->loadJsonFixture('payments')->list; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->payments(); $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params); @@ -252,7 +252,7 @@ public function testPaymentsList() } } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -261,7 +261,7 @@ public function testPaymentsList() public function testPaymentsGet() { $fixture = $this->loadJsonFixture('payments')->get; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->payments(); $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params); @@ -332,7 +332,7 @@ public function testPaymentsGet() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -341,7 +341,7 @@ public function testPaymentsGet() public function testPaymentsUpdate() { $fixture = $this->loadJsonFixture('payments')->update; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->payments(); $response = call_user_func_array(array($service, 'update'), (array)$fixture->url_params); @@ -412,7 +412,7 @@ public function testPaymentsUpdate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -421,7 +421,7 @@ public function testPaymentsUpdate() public function testPaymentsCancel() { $fixture = $this->loadJsonFixture('payments')->cancel; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->payments(); $response = call_user_func_array(array($service, 'cancel'), (array)$fixture->url_params); @@ -492,7 +492,7 @@ public function testPaymentsCancel() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -501,7 +501,7 @@ public function testPaymentsCancel() public function testPaymentsRetry() { $fixture = $this->loadJsonFixture('payments')->retry; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->payments(); $response = call_user_func_array(array($service, 'retry'), (array)$fixture->url_params); @@ -572,7 +572,7 @@ public function testPaymentsRetry() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/PayoutItemsIntegrationTest.php b/tests/Integration/PayoutItemsIntegrationTest.php index 3a27149f7..a9caf5c8a 100644 --- a/tests/Integration/PayoutItemsIntegrationTest.php +++ b/tests/Integration/PayoutItemsIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testPayoutItemsList() { $fixture = $this->loadJsonFixture('payout_items')->list; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->payoutItems(); $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params); @@ -55,7 +55,7 @@ public function testPayoutItemsList() } } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/PayoutsIntegrationTest.php b/tests/Integration/PayoutsIntegrationTest.php index e647fed8e..0b295c019 100644 --- a/tests/Integration/PayoutsIntegrationTest.php +++ b/tests/Integration/PayoutsIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testPayoutsList() { $fixture = $this->loadJsonFixture('payouts')->list; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->payouts(); $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params); @@ -91,7 +91,7 @@ public function testPayoutsList() } } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -100,7 +100,7 @@ public function testPayoutsList() public function testPayoutsGet() { $fixture = $this->loadJsonFixture('payouts')->get; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->payouts(); $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params); @@ -163,7 +163,7 @@ public function testPayoutsGet() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -172,7 +172,7 @@ public function testPayoutsGet() public function testPayoutsUpdate() { $fixture = $this->loadJsonFixture('payouts')->update; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->payouts(); $response = call_user_func_array(array($service, 'update'), (array)$fixture->url_params); @@ -235,7 +235,7 @@ public function testPayoutsUpdate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/RedirectFlowsIntegrationTest.php b/tests/Integration/RedirectFlowsIntegrationTest.php index a56f45476..c06189959 100644 --- a/tests/Integration/RedirectFlowsIntegrationTest.php +++ b/tests/Integration/RedirectFlowsIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testRedirectFlowsCreate() { $fixture = $this->loadJsonFixture('redirect_flows')->create; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->redirectFlows(); $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params); @@ -73,7 +73,7 @@ public function testRedirectFlowsCreate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -133,7 +133,7 @@ public function testRedirectFlowsCreateWithIdempotencyConflict() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $conflictRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $conflictRequest->getUri()->getPath()); $getRequest = $this->history[1]['request']; @@ -143,7 +143,7 @@ public function testRedirectFlowsCreateWithIdempotencyConflict() public function testRedirectFlowsGet() { $fixture = $this->loadJsonFixture('redirect_flows')->get; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->redirectFlows(); $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params); @@ -198,7 +198,7 @@ public function testRedirectFlowsGet() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -207,7 +207,7 @@ public function testRedirectFlowsGet() public function testRedirectFlowsComplete() { $fixture = $this->loadJsonFixture('redirect_flows')->complete; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->redirectFlows(); $response = call_user_func_array(array($service, 'complete'), (array)$fixture->url_params); @@ -262,7 +262,7 @@ public function testRedirectFlowsComplete() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/RefundsIntegrationTest.php b/tests/Integration/RefundsIntegrationTest.php index 465eaa98a..2d2467d65 100644 --- a/tests/Integration/RefundsIntegrationTest.php +++ b/tests/Integration/RefundsIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testRefundsCreate() { $fixture = $this->loadJsonFixture('refunds')->create; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->refunds(); $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params); @@ -65,7 +65,7 @@ public function testRefundsCreate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -119,7 +119,7 @@ public function testRefundsCreateWithIdempotencyConflict() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $conflictRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $conflictRequest->getUri()->getPath()); $getRequest = $this->history[1]['request']; @@ -129,7 +129,7 @@ public function testRefundsCreateWithIdempotencyConflict() public function testRefundsList() { $fixture = $this->loadJsonFixture('refunds')->list; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->refunds(); $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params); @@ -186,7 +186,7 @@ public function testRefundsList() } } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -195,7 +195,7 @@ public function testRefundsList() public function testRefundsGet() { $fixture = $this->loadJsonFixture('refunds')->get; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->refunds(); $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params); @@ -242,7 +242,7 @@ public function testRefundsGet() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -251,7 +251,7 @@ public function testRefundsGet() public function testRefundsUpdate() { $fixture = $this->loadJsonFixture('refunds')->update; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->refunds(); $response = call_user_func_array(array($service, 'update'), (array)$fixture->url_params); @@ -298,7 +298,7 @@ public function testRefundsUpdate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/ScenarioSimulatorsIntegrationTest.php b/tests/Integration/ScenarioSimulatorsIntegrationTest.php index 0de756ff4..38243ed7b 100644 --- a/tests/Integration/ScenarioSimulatorsIntegrationTest.php +++ b/tests/Integration/ScenarioSimulatorsIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testScenarioSimulatorsRun() { $fixture = $this->loadJsonFixture('scenario_simulators')->run; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->scenarioSimulators(); $response = call_user_func_array(array($service, 'run'), (array)$fixture->url_params); @@ -33,7 +33,7 @@ public function testScenarioSimulatorsRun() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/SchemeIdentifiersIntegrationTest.php b/tests/Integration/SchemeIdentifiersIntegrationTest.php index a32d18ad6..fdaa9e4db 100644 --- a/tests/Integration/SchemeIdentifiersIntegrationTest.php +++ b/tests/Integration/SchemeIdentifiersIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testSchemeIdentifiersCreate() { $fixture = $this->loadJsonFixture('scheme_identifiers')->create; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->schemeIdentifiers(); $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params); @@ -101,7 +101,7 @@ public function testSchemeIdentifiersCreate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -182,7 +182,7 @@ public function testSchemeIdentifiersCreateWithIdempotencyConflict() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $conflictRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $conflictRequest->getUri()->getPath()); $getRequest = $this->history[1]['request']; @@ -192,7 +192,7 @@ public function testSchemeIdentifiersCreateWithIdempotencyConflict() public function testSchemeIdentifiersList() { $fixture = $this->loadJsonFixture('scheme_identifiers')->list; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->schemeIdentifiers(); $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params); @@ -285,7 +285,7 @@ public function testSchemeIdentifiersList() } } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -294,7 +294,7 @@ public function testSchemeIdentifiersList() public function testSchemeIdentifiersGet() { $fixture = $this->loadJsonFixture('scheme_identifiers')->get; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->schemeIdentifiers(); $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params); @@ -377,7 +377,7 @@ public function testSchemeIdentifiersGet() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/SubscriptionsIntegrationTest.php b/tests/Integration/SubscriptionsIntegrationTest.php index b14e0c044..97f15d03f 100644 --- a/tests/Integration/SubscriptionsIntegrationTest.php +++ b/tests/Integration/SubscriptionsIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testSubscriptionsCreate() { $fixture = $this->loadJsonFixture('subscriptions')->create; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->subscriptions(); $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params); @@ -113,7 +113,7 @@ public function testSubscriptionsCreate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -203,7 +203,7 @@ public function testSubscriptionsCreateWithIdempotencyConflict() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $conflictRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $conflictRequest->getUri()->getPath()); $getRequest = $this->history[1]['request']; @@ -213,7 +213,7 @@ public function testSubscriptionsCreateWithIdempotencyConflict() public function testSubscriptionsList() { $fixture = $this->loadJsonFixture('subscriptions')->list; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->subscriptions(); $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params); @@ -318,7 +318,7 @@ public function testSubscriptionsList() } } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -327,7 +327,7 @@ public function testSubscriptionsList() public function testSubscriptionsGet() { $fixture = $this->loadJsonFixture('subscriptions')->get; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->subscriptions(); $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params); @@ -422,7 +422,7 @@ public function testSubscriptionsGet() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -431,7 +431,7 @@ public function testSubscriptionsGet() public function testSubscriptionsUpdate() { $fixture = $this->loadJsonFixture('subscriptions')->update; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->subscriptions(); $response = call_user_func_array(array($service, 'update'), (array)$fixture->url_params); @@ -526,7 +526,7 @@ public function testSubscriptionsUpdate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -535,7 +535,7 @@ public function testSubscriptionsUpdate() public function testSubscriptionsPause() { $fixture = $this->loadJsonFixture('subscriptions')->pause; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->subscriptions(); $response = call_user_func_array(array($service, 'pause'), (array)$fixture->url_params); @@ -630,7 +630,7 @@ public function testSubscriptionsPause() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -639,7 +639,7 @@ public function testSubscriptionsPause() public function testSubscriptionsResume() { $fixture = $this->loadJsonFixture('subscriptions')->resume; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->subscriptions(); $response = call_user_func_array(array($service, 'resume'), (array)$fixture->url_params); @@ -734,7 +734,7 @@ public function testSubscriptionsResume() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -743,7 +743,7 @@ public function testSubscriptionsResume() public function testSubscriptionsCancel() { $fixture = $this->loadJsonFixture('subscriptions')->cancel; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->subscriptions(); $response = call_user_func_array(array($service, 'cancel'), (array)$fixture->url_params); @@ -838,7 +838,7 @@ public function testSubscriptionsCancel() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/TaxRatesIntegrationTest.php b/tests/Integration/TaxRatesIntegrationTest.php index e6d9364fa..848cf28d5 100644 --- a/tests/Integration/TaxRatesIntegrationTest.php +++ b/tests/Integration/TaxRatesIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testTaxRatesList() { $fixture = $this->loadJsonFixture('tax_rates')->list; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->taxRates(); $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params); @@ -63,7 +63,7 @@ public function testTaxRatesList() } } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -72,7 +72,7 @@ public function testTaxRatesList() public function testTaxRatesGet() { $fixture = $this->loadJsonFixture('tax_rates')->get; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->taxRates(); $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params); @@ -107,7 +107,7 @@ public function testTaxRatesGet() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/TransferredMandatesIntegrationTest.php b/tests/Integration/TransferredMandatesIntegrationTest.php index e73ba8055..e378fa343 100644 --- a/tests/Integration/TransferredMandatesIntegrationTest.php +++ b/tests/Integration/TransferredMandatesIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testTransferredMandatesTransferredMandates() { $fixture = $this->loadJsonFixture('transferred_mandates')->transferred_mandates; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->transferredMandates(); $response = call_user_func_array(array($service, 'transferredMandates'), (array)$fixture->url_params); @@ -45,7 +45,7 @@ public function testTransferredMandatesTransferredMandates() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/VerificationDetailsIntegrationTest.php b/tests/Integration/VerificationDetailsIntegrationTest.php index 6f83ffcf6..9effe5f5f 100644 --- a/tests/Integration/VerificationDetailsIntegrationTest.php +++ b/tests/Integration/VerificationDetailsIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testVerificationDetailsCreate() { $fixture = $this->loadJsonFixture('verification_details')->create; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->verificationDetails(); $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params); @@ -69,7 +69,7 @@ public function testVerificationDetailsCreate() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -78,7 +78,7 @@ public function testVerificationDetailsCreate() public function testVerificationDetailsList() { $fixture = $this->loadJsonFixture('verification_details')->list; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->verificationDetails(); $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params); @@ -139,7 +139,7 @@ public function testVerificationDetailsList() } } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Integration/WebhooksIntegrationTest.php b/tests/Integration/WebhooksIntegrationTest.php index 9a99e18df..f033fa9b0 100644 --- a/tests/Integration/WebhooksIntegrationTest.php +++ b/tests/Integration/WebhooksIntegrationTest.php @@ -18,7 +18,7 @@ public function testResourceModelExists() public function testWebhooksList() { $fixture = $this->loadJsonFixture('webhooks')->list; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->webhooks(); $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params); @@ -91,7 +91,7 @@ public function testWebhooksList() } } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -100,7 +100,7 @@ public function testWebhooksList() public function testWebhooksGet() { $fixture = $this->loadJsonFixture('webhooks')->get; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->webhooks(); $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params); @@ -163,7 +163,7 @@ public function testWebhooksGet() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } @@ -172,7 +172,7 @@ public function testWebhooksGet() public function testWebhooksRetry() { $fixture = $this->loadJsonFixture('webhooks')->retry; - $this->stub_request($fixture); + $this->stubRequest($fixture); $service = $this->client->webhooks(); $response = call_user_func_array(array($service, 'retry'), (array)$fixture->url_params); @@ -235,7 +235,7 @@ public function testWebhooksRetry() } - $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } diff --git a/tests/Resources/ResourceTest.php b/tests/Resources/ResourceTest.php index 54f988327..08a9e86be 100644 --- a/tests/Resources/ResourceTest.php +++ b/tests/Resources/ResourceTest.php @@ -4,6 +4,7 @@ use PHPUnit\Framework\TestCase; +// phpcs:disable PSR1.Classes.ClassDeclaration.MultipleClasses class FakeResource extends BaseResource { protected $model_name = "FakeResource"; From 409dea8020fed4cb3b0e060ca330d6eacdf72d32 Mon Sep 17 00:00:00 2001 From: "gocardless-ci-robot[bot]" <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> Date: Fri, 1 May 2026 10:46:16 +0000 Subject: [PATCH 02/10] Changes generated by 8b11b29c01bad5a3e25ac50c5641547d4c0311ed This commit was automatically created from gocardless/client-library-templates@8b11b29c01bad5a3e25ac50c5641547d4c0311ed by the `push-files` action. Workflow run: https://github.com/gocardless/client-library-templates/actions/runs/25208955189 --- lib/Client.php | 28 +++ lib/Resources/Export.php | 6 + lib/Resources/OutboundPaymentImport.php | 82 ++++++ lib/Resources/OutboundPaymentImportEntry.php | 85 +++++++ .../OutboundPaymentImportEntriesService.php | 64 +++++ .../OutboundPaymentImportsService.php | 129 ++++++++++ tests/Integration/ExportsIntegrationTest.php | 8 + ...undPaymentImportEntriesIntegrationTest.php | 86 +++++++ .../OutboundPaymentImportsIntegrationTest.php | 234 ++++++++++++++++++ tests/fixtures/exports.json | 2 +- .../outbound_payment_import_entries.json | 11 + tests/fixtures/outbound_payment_imports.json | 23 ++ 12 files changed, 757 insertions(+), 1 deletion(-) create mode 100644 lib/Resources/OutboundPaymentImport.php create mode 100644 lib/Resources/OutboundPaymentImportEntry.php create mode 100644 lib/Services/OutboundPaymentImportEntriesService.php create mode 100644 lib/Services/OutboundPaymentImportsService.php create mode 100644 tests/Integration/OutboundPaymentImportEntriesIntegrationTest.php create mode 100644 tests/Integration/OutboundPaymentImportsIntegrationTest.php create mode 100644 tests/fixtures/outbound_payment_import_entries.json create mode 100644 tests/fixtures/outbound_payment_imports.json diff --git a/lib/Client.php b/lib/Client.php index 22bc566fe..91013f6ed 100644 --- a/lib/Client.php +++ b/lib/Client.php @@ -125,6 +125,10 @@ public function __construct($config) $this->services['outbound_payments'] = new Services\OutboundPaymentsService($this->api_client); + $this->services['outbound_payment_imports'] = new Services\OutboundPaymentImportsService($this->api_client); + + $this->services['outbound_payment_import_entries'] = new Services\OutboundPaymentImportEntriesService($this->api_client); + $this->services['payer_authorisations'] = new Services\PayerAuthorisationsService($this->api_client); $this->services['payer_themes'] = new Services\PayerThemesService($this->api_client); @@ -495,6 +499,30 @@ public function outboundPayments() return $this->services['outbound_payments']; } + /** + * Service for interacting with outbound payment imports + * @return Services\OutboundPaymentImportsService + */ + public function outboundPaymentImports() + { + if (!isset($this->services['outbound_payment_imports'])) { + throw new \Exception('Key outbound_payment_imports does not exist in services array'); + } + return $this->services['outbound_payment_imports']; + } + + /** + * Service for interacting with outbound payment import entries + * @return Services\OutboundPaymentImportEntriesService + */ + public function outboundPaymentImportEntries() + { + if (!isset($this->services['outbound_payment_import_entries'])) { + throw new \Exception('Key outbound_payment_import_entries does not exist in services array'); + } + return $this->services['outbound_payment_import_entries']; + } + /** * Service for interacting with payer authorisations * @return Services\PayerAuthorisationsService diff --git a/lib/Resources/Export.php b/lib/Resources/Export.php index 0f853998e..7f2ee36b2 100644 --- a/lib/Resources/Export.php +++ b/lib/Resources/Export.php @@ -15,6 +15,7 @@ * @property-read mixed $created_at * @property-read mixed $currency * @property-read mixed $download_url + * @property-read mixed $error_message * @property-read mixed $export_type * @property-read mixed $id */ @@ -38,6 +39,11 @@ class Export extends BaseResource */ protected $download_url; + /** + * Error message if the export encountered an error during processing. + */ + protected $error_message; + /** * The type of the export */ diff --git a/lib/Resources/OutboundPaymentImport.php b/lib/Resources/OutboundPaymentImport.php new file mode 100644 index 000000000..91a1f4379 --- /dev/null +++ b/lib/Resources/OutboundPaymentImport.php @@ -0,0 +1,82 @@ + + *
  • `created`: The initial state of a new import.
  • + *
  • `validating`: Import validation in progress.
  • + *
  • `invalid`: Import validation failed.
  • + *
  • `valid`: Import validation succeeded.
  • + *
  • `processing`: Authorisation received; payments are being + * generated.
  • + *
  • `processed`: All entries have been successfully converted into + * outbound payments.
  • + *
  • `cancelled`: The import was cancelled by a user or automatically + * expired by the system.
  • + * + */ + protected $status; +} diff --git a/lib/Resources/OutboundPaymentImportEntry.php b/lib/Resources/OutboundPaymentImportEntry.php new file mode 100644 index 000000000..7a988f793 --- /dev/null +++ b/lib/Resources/OutboundPaymentImportEntry.php @@ -0,0 +1,85 @@ + $params An associative array for any params + * @return ListResponse + **/ + protected function _doList($params = array()) + { + $path = "/outbound_payment_import_entries"; + if (isset($params['params'])) { + $params['query'] = $params['params']; + unset($params['params']); + } + + + $response = $this->api_client->get($path, $params); + + + return $this->getResourceForResponse($response); + } + + /** + * List outbound payment import entries + * + * Example URL: /outbound_payment_import_entries + * + * @param string[mixed] $params + * @return Paginator + **/ + public function all($params = array()) + { + return new Paginator($this, $params); + } +} diff --git a/lib/Services/OutboundPaymentImportsService.php b/lib/Services/OutboundPaymentImportsService.php new file mode 100644 index 000000000..1300db213 --- /dev/null +++ b/lib/Services/OutboundPaymentImportsService.php @@ -0,0 +1,129 @@ + $params An associative array for any params + * @return OutboundPaymentImport + **/ + public function create($params = array()) + { + $path = "/outbound_payment_imports"; + if (isset($params['params'])) { + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + + unset($params['params']); + } + + + try { + $response = $this->api_client->post($path, $params); + } catch (InvalidStateException $e) { + if ($e->isIdempotentCreationConflict()) { + if ($this->api_client->error_on_idempotency_conflict) { + throw $e; + } + return $this->get($e->getConflictingResourceId()); + } + + throw $e; + } + + + return $this->getResourceForResponse($response); + } + + /** + * Get an outbound payment import + * + * Example URL: /outbound_payment_imports/:identity + * + * @param string $identity Unique identifier, beginning with "IM". + * @param array $params An associative array for any params + * @return OutboundPaymentImport + **/ + public function get($identity, $params = array()) + { + $path = Util::subUrl( + '/outbound_payment_imports/: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 outbound payment imports + * + * Example URL: /outbound_payment_imports + * + * @param array $params An associative array for any params + * @return ListResponse + **/ + protected function _doList($params = array()) + { + $path = "/outbound_payment_imports"; + if (isset($params['params'])) { + $params['query'] = $params['params']; + unset($params['params']); + } + + + $response = $this->api_client->get($path, $params); + + + return $this->getResourceForResponse($response); + } + + /** + * List outbound payment imports + * + * Example URL: /outbound_payment_imports + * + * @param string[mixed] $params + * @return Paginator + **/ + public function all($params = array()) + { + return new Paginator($this, $params); + } +} diff --git a/tests/Integration/ExportsIntegrationTest.php b/tests/Integration/ExportsIntegrationTest.php index 3a12998f2..34977e9d6 100644 --- a/tests/Integration/ExportsIntegrationTest.php +++ b/tests/Integration/ExportsIntegrationTest.php @@ -40,6 +40,10 @@ public function testExportsGet() $this->assertEquals($body->download_url, $response->download_url); } + if (property_exists($body, 'error_message')) { + $this->assertEquals($body->error_message, $response->error_message); + } + if (property_exists($body, 'export_type')) { $this->assertEquals($body->export_type, $response->export_type); } @@ -90,6 +94,10 @@ public function testExportsList() $this->assertEquals($body[$num]->download_url, $record->download_url); } + if (isset($body[$num]->error_message)) { + $this->assertEquals($body[$num]->error_message, $record->error_message); + } + if (isset($body[$num]->export_type)) { $this->assertEquals($body[$num]->export_type, $record->export_type); } diff --git a/tests/Integration/OutboundPaymentImportEntriesIntegrationTest.php b/tests/Integration/OutboundPaymentImportEntriesIntegrationTest.php new file mode 100644 index 000000000..8a9a9accd --- /dev/null +++ b/tests/Integration/OutboundPaymentImportEntriesIntegrationTest.php @@ -0,0 +1,86 @@ +assertNotNull($obj); + } + + public function testOutboundPaymentImportEntriesList() + { + $fixture = $this->loadJsonFixture('outbound_payment_import_entries')->list; + $this->stubRequest($fixture); + + $service = $this->client->outboundPaymentImportEntries(); + $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params); + + $body = $fixture->body->outbound_payment_import_entries; + + $records = $response->records; + $this->assertInstanceOf('\GoCardlessPro\Core\ListResponse', $response); + $this->assertInstanceOf('\GoCardlessPro\Resources\OutboundPaymentImportEntry', $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]->amount)) { + $this->assertEquals($body[$num]->amount, $record->amount); + } + + if (isset($body[$num]->created_at)) { + $this->assertEquals($body[$num]->created_at, $record->created_at); + } + + if (isset($body[$num]->id)) { + $this->assertEquals($body[$num]->id, $record->id); + } + + if (isset($body[$num]->links)) { + $this->assertEquals($body[$num]->links, $record->links); + } + + if (isset($body[$num]->metadata)) { + $this->assertEquals($body[$num]->metadata, $record->metadata); + } + + if (isset($body[$num]->processed_at)) { + $this->assertEquals($body[$num]->processed_at, $record->processed_at); + } + + if (isset($body[$num]->reference)) { + $this->assertEquals($body[$num]->reference, $record->reference); + } + + if (isset($body[$num]->scheme)) { + $this->assertEquals($body[$num]->scheme, $record->scheme); + } + + if (isset($body[$num]->validation_errors)) { + $this->assertEquals($body[$num]->validation_errors, $record->validation_errors); + } + + if (isset($body[$num]->verification_result)) { + $this->assertEquals($body[$num]->verification_result, $record->verification_result); + } + } + + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); + $dispatchedRequest = $this->history[0]['request']; + $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); + } +} diff --git a/tests/Integration/OutboundPaymentImportsIntegrationTest.php b/tests/Integration/OutboundPaymentImportsIntegrationTest.php new file mode 100644 index 000000000..f6e75e841 --- /dev/null +++ b/tests/Integration/OutboundPaymentImportsIntegrationTest.php @@ -0,0 +1,234 @@ +assertNotNull($obj); + } + + public function testOutboundPaymentImportsCreate() + { + $fixture = $this->loadJsonFixture('outbound_payment_imports')->create; + $this->stubRequest($fixture); + + $service = $this->client->outboundPaymentImports(); + $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params); + + $body = $fixture->body->outbound_payment_imports; + + $this->assertInstanceOf('\GoCardlessPro\Resources\OutboundPaymentImport', $response); + + + if (property_exists($body, 'amount_sum')) { + $this->assertEquals($body->amount_sum, $response->amount_sum); + } + + if (property_exists($body, 'authorisation_url')) { + $this->assertEquals($body->authorisation_url, $response->authorisation_url); + } + + if (property_exists($body, 'created_at')) { + $this->assertEquals($body->created_at, $response->created_at); + } + + if (property_exists($body, 'currency')) { + $this->assertEquals($body->currency, $response->currency); + } + + if (property_exists($body, 'entry_counts')) { + $this->assertEquals($body->entry_counts, $response->entry_counts); + } + + if (property_exists($body, 'id')) { + $this->assertEquals($body->id, $response->id); + } + + if (property_exists($body, 'links')) { + $this->assertEquals($body->links, $response->links); + } + + if (property_exists($body, 'status')) { + $this->assertEquals($body->status, $response->status); + } + + + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); + $dispatchedRequest = $this->history[0]['request']; + $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); + } + + public function testOutboundPaymentImportsCreateWithIdempotencyConflict() + { + $fixture = $this->loadJsonFixture('outbound_payment_imports')->create; + + $idempotencyConflictResponseFixture = $this->loadFixture('idempotent_creation_conflict_invalid_state_error'); + + // The POST request responds with a 409 to our original POST, due to an idempotency conflict + $this->mock->append(new \GuzzleHttp\Psr7\Response(409, [], $idempotencyConflictResponseFixture)); + + // The client makes a second request to fetch the resource that was already + // created using our idempotency key. It responds with the created resource, + // which looks just like the response for a successful POST request. + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], json_encode($fixture->body))); + + $service = $this->client->outboundPaymentImports(); + $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params); + $body = $fixture->body->outbound_payment_imports; + + $this->assertInstanceOf('\GoCardlessPro\Resources\OutboundPaymentImport', $response); + + if (property_exists($body, 'amount_sum')) { + $this->assertEquals($body->amount_sum, $response->amount_sum); + } + if (property_exists($body, 'authorisation_url')) { + $this->assertEquals($body->authorisation_url, $response->authorisation_url); + } + if (property_exists($body, 'created_at')) { + $this->assertEquals($body->created_at, $response->created_at); + } + if (property_exists($body, 'currency')) { + $this->assertEquals($body->currency, $response->currency); + } + if (property_exists($body, 'entry_counts')) { + $this->assertEquals($body->entry_counts, $response->entry_counts); + } + if (property_exists($body, 'id')) { + $this->assertEquals($body->id, $response->id); + } + if (property_exists($body, 'links')) { + $this->assertEquals($body->links, $response->links); + } + if (property_exists($body, 'status')) { + $this->assertEquals($body->status, $response->status); + } + + + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); + $conflictRequest = $this->history[0]['request']; + $this->assertMatchesRegularExpression($expectedPathRegex, $conflictRequest->getUri()->getPath()); + $getRequest = $this->history[1]['request']; + $this->assertEquals($getRequest->getUri()->getPath(), '/outbound_payment_imports/ID123'); + } + + public function testOutboundPaymentImportsGet() + { + $fixture = $this->loadJsonFixture('outbound_payment_imports')->get; + $this->stubRequest($fixture); + + $service = $this->client->outboundPaymentImports(); + $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params); + + $body = $fixture->body->outbound_payment_imports; + + $this->assertInstanceOf('\GoCardlessPro\Resources\OutboundPaymentImport', $response); + + + if (property_exists($body, 'amount_sum')) { + $this->assertEquals($body->amount_sum, $response->amount_sum); + } + + if (property_exists($body, 'authorisation_url')) { + $this->assertEquals($body->authorisation_url, $response->authorisation_url); + } + + if (property_exists($body, 'created_at')) { + $this->assertEquals($body->created_at, $response->created_at); + } + + if (property_exists($body, 'currency')) { + $this->assertEquals($body->currency, $response->currency); + } + + if (property_exists($body, 'entry_counts')) { + $this->assertEquals($body->entry_counts, $response->entry_counts); + } + + if (property_exists($body, 'id')) { + $this->assertEquals($body->id, $response->id); + } + + if (property_exists($body, 'links')) { + $this->assertEquals($body->links, $response->links); + } + + if (property_exists($body, 'status')) { + $this->assertEquals($body->status, $response->status); + } + + + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); + $dispatchedRequest = $this->history[0]['request']; + $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); + } + + + public function testOutboundPaymentImportsList() + { + $fixture = $this->loadJsonFixture('outbound_payment_imports')->list; + $this->stubRequest($fixture); + + $service = $this->client->outboundPaymentImports(); + $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params); + + $body = $fixture->body->outbound_payment_imports; + + $records = $response->records; + $this->assertInstanceOf('\GoCardlessPro\Core\ListResponse', $response); + $this->assertInstanceOf('\GoCardlessPro\Resources\OutboundPaymentImport', $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]->amount_sum)) { + $this->assertEquals($body[$num]->amount_sum, $record->amount_sum); + } + + if (isset($body[$num]->authorisation_url)) { + $this->assertEquals($body[$num]->authorisation_url, $record->authorisation_url); + } + + 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]->entry_counts)) { + $this->assertEquals($body[$num]->entry_counts, $record->entry_counts); + } + + if (isset($body[$num]->id)) { + $this->assertEquals($body[$num]->id, $record->id); + } + + if (isset($body[$num]->links)) { + $this->assertEquals($body[$num]->links, $record->links); + } + + if (isset($body[$num]->status)) { + $this->assertEquals($body[$num]->status, $record->status); + } + } + + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); + $dispatchedRequest = $this->history[0]['request']; + $this->assertMatchesRegularExpression($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); + } +} diff --git a/tests/fixtures/exports.json b/tests/fixtures/exports.json index 8682ab1ee..5693f5e38 100644 --- a/tests/fixtures/exports.json +++ b/tests/fixtures/exports.json @@ -5,7 +5,7 @@ "method": "GET", "path_template": "/exports/:identity", "url_params": {"identity": "EX123"}, - "body": {"exports":{"created_at":"2014-01-01T12:00:00.000Z","currency":"GBP","download_url":"example download_url 101","export_type":"payments_index","id":"EX123"}} + "body": {"exports":{"created_at":"2014-01-01T12:00:00.000Z","currency":"GBP","download_url":"example download_url 101","error_message":"example error_message 101","export_type":"payments_index","id":"EX123"}} }, "list": { "method": "GET", diff --git a/tests/fixtures/outbound_payment_import_entries.json b/tests/fixtures/outbound_payment_import_entries.json new file mode 100644 index 000000000..a998e8449 --- /dev/null +++ b/tests/fixtures/outbound_payment_import_entries.json @@ -0,0 +1,11 @@ +{ + + + "list": { + "method": "GET", + "path_template": "/outbound_payment_import_entries", + "url_params": {}, + "body": {"meta":{"cursors":{"after":"example after 101","before":"example before 101"},"limit":50},"outbound_payment_import_entries":[{"amount":1000,"created_at":"2014-01-01T12:00:00.000Z","id":"IE123","links":{"outbound_payment":"OUT123","outbound_payment_import":"IM123","recipient_bank_account":"BA123"},"metadata":{},"processed_at":"2014-01-01T12:00:00.000Z","reference":"Invoice 12345","scheme":"faster_payments","validation_errors":{"outbound_payment":{"amount":["example amount 101"],"recipient_bank_account":["example recipient_bank_account 101"],"reference":["example reference 101"],"scheme":"faster_payments"}},"verification_result":"full_match"},{"amount":1000,"created_at":"2014-01-01T12:00:00.000Z","id":"IE123","links":{"outbound_payment":"OUT123","outbound_payment_import":"IM123","recipient_bank_account":"BA123"},"metadata":{},"processed_at":"2014-01-01T12:00:00.000Z","reference":"Invoice 12345","scheme":"faster_payments","validation_errors":{"outbound_payment":{"amount":["example amount 102"],"recipient_bank_account":["example recipient_bank_account 102"],"reference":["example reference 102"],"scheme":"faster_payments"}},"verification_result":"full_match"}]} + } +} + diff --git a/tests/fixtures/outbound_payment_imports.json b/tests/fixtures/outbound_payment_imports.json new file mode 100644 index 000000000..d38ffe1b0 --- /dev/null +++ b/tests/fixtures/outbound_payment_imports.json @@ -0,0 +1,23 @@ +{ + + + "create": { + "method": "POST", + "path_template": "/outbound_payment_imports", + "url_params": {}, + "body": {"outbound_payment_imports":{"amount_sum":1000,"authorisation_url":"https://manage.gocardless.com/imports/IM123","created_at":"2014-01-01T12:00:00.000Z","currency":"GBP","entry_counts":{"failed_to_process":0,"invalid":0,"processed":1000,"total":1000,"valid":1000,"verified":0,"verified_with_full_match":0,"verified_with_no_match":0,"verified_with_partial_match":0,"verified_with_unable_to_match":0},"id":"IM123","links":{"creditor":"CR123"},"status":"created"}} + }, + "get": { + "method": "GET", + "path_template": "/outbound_payment_imports/:identity", + "url_params": {"identity": "IM123"}, + "body": {"outbound_payment_imports":{"amount_sum":1000,"authorisation_url":"https://manage.gocardless.com/imports/IM123","created_at":"2014-01-01T12:00:00.000Z","currency":"GBP","entry_counts":{"failed_to_process":0,"invalid":0,"processed":1000,"total":1000,"valid":1000,"verified":0,"verified_with_full_match":0,"verified_with_no_match":0,"verified_with_partial_match":0,"verified_with_unable_to_match":0},"id":"IM123","links":{"creditor":"CR123"},"status":"created"}} + }, + "list": { + "method": "GET", + "path_template": "/outbound_payment_imports", + "url_params": {}, + "body": {"meta":{"cursors":{"after":"example after 101","before":"example before 101"},"limit":50},"outbound_payment_imports":[{"amount_sum":1000,"authorisation_url":"https://manage.gocardless.com/imports/IM123","created_at":"2014-01-01T12:00:00.000Z","currency":"GBP","entry_counts":{"failed_to_process":0,"invalid":0,"processed":1000,"total":1000,"valid":1000,"verified":0,"verified_with_full_match":0,"verified_with_no_match":0,"verified_with_partial_match":0,"verified_with_unable_to_match":0},"id":"IM123","links":{"creditor":"CR123"},"status":"created"},{"amount_sum":1000,"authorisation_url":"https://manage.gocardless.com/imports/IM123","created_at":"2014-01-01T12:00:00.000Z","currency":"GBP","entry_counts":{"failed_to_process":0,"invalid":0,"processed":1000,"total":1000,"valid":1000,"verified":0,"verified_with_full_match":0,"verified_with_no_match":0,"verified_with_partial_match":0,"verified_with_unable_to_match":0},"id":"IM123","links":{"creditor":"CR123"},"status":"created"}]} + } +} + From 304a58398dbd64e3f34a4cbc7d4d38fea86086a6 Mon Sep 17 00:00:00 2001 From: "gocardless-ci-robot[bot]" <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> Date: Fri, 8 May 2026 11:17:10 +0000 Subject: [PATCH 03/10] Changes generated by b173d4bd48fb87ad99068b740e8e83e52fdca485 This commit was automatically created from gocardless/client-library-templates@b173d4bd48fb87ad99068b740e8e83e52fdca485 by the `push-files` action. Workflow run: https://github.com/gocardless/client-library-templates/actions/runs/25552539866 --- lib/Core/ApiClient.php | 4 +-- .../Exception/MalformedResponseException.php | 34 +++++++++++++++++-- tests/Core/ApiClientTest.php | 15 ++++++++ 3 files changed, 49 insertions(+), 4 deletions(-) diff --git a/lib/Core/ApiClient.php b/lib/Core/ApiClient.php index 3a0892574..4878e3d06 100644 --- a/lib/Core/ApiClient.php +++ b/lib/Core/ApiClient.php @@ -125,14 +125,14 @@ private function handleErrors(Response $response) return null; } + $status_code = $response->getStatusCode(); $json = json_decode($response->getBody()); if ($json === null) { $msg = "Malformed response received from server"; - throw new Exception\MalformedResponseException($msg, $response); + throw new Exception\MalformedResponseException($msg, $response, $status_code); } - $status_code = $response->getStatusCode(); if ($status_code < 400) { return null; } diff --git a/lib/Core/Exception/MalformedResponseException.php b/lib/Core/Exception/MalformedResponseException.php index 312d682b6..631f1229a 100644 --- a/lib/Core/Exception/MalformedResponseException.php +++ b/lib/Core/Exception/MalformedResponseException.php @@ -4,12 +4,16 @@ class MalformedResponseException extends GoCardlessProException { + const BODY_PREVIEW_MAX_LENGTH = 500; + private $response; + private $statusCode; - public function __construct($message, $response) + public function __construct($message, $response, $statusCode = null) { $this->response = $response; - parent::__construct($message); + $this->statusCode = $statusCode; + parent::__construct(self::buildMessage($message, $response, $statusCode)); } @@ -17,4 +21,30 @@ public function response() { return $this->response; } + + public function statusCode() + { + return $this->statusCode; + } + + private static function buildMessage($message, $response, $statusCode) + { + $full = $message; + if ($statusCode !== null) { + $full .= ' (HTTP ' . $statusCode . ')'; + } + $body = null; + if (is_string($response)) { + $body = $response; + } elseif (is_object($response) && method_exists($response, 'getBody')) { + $body = (string) $response->getBody(); + } + if ($body !== null && $body !== '') { + if (strlen($body) > self::BODY_PREVIEW_MAX_LENGTH) { + $body = substr($body, 0, self::BODY_PREVIEW_MAX_LENGTH) . '...'; + } + $full .= ': ' . $body; + } + return $full; + } } diff --git a/tests/Core/ApiClientTest.php b/tests/Core/ApiClientTest.php index 8d3682ab3..8dd8465df 100644 --- a/tests/Core/ApiClientTest.php +++ b/tests/Core/ApiClientTest.php @@ -115,6 +115,21 @@ public function testMalformedResponse() $this->api_client->get('/some_endpoint'); } + public function testMalformedResponseIncludesStatusCodeAndBody() + { + $body = "502 Bad Gateway"; + $this->mock->append(new \GuzzleHttp\Psr7\Response(502, [], $body)); + + try { + $this->api_client->get('/some_endpoint'); + $this->fail('expected MalformedResponseException'); + } catch (\GoCardlessPro\Core\Exception\MalformedResponseException $e) { + $this->assertEquals(502, $e->statusCode()); + $this->assertStringContainsString('HTTP 502', $e->getMessage()); + $this->assertStringContainsString('502 Bad Gateway', $e->getMessage()); + } + } + public function testInvalidStateErrorResponse() { $fixture = $this->loadFixture('invalid_state_error'); From 76d9bbe2ac7efee089c996f0861a85ea02520b7f Mon Sep 17 00:00:00 2001 From: "gocardless-ci-robot[bot]" <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> Date: Fri, 8 May 2026 14:41:58 +0000 Subject: [PATCH 04/10] Changes generated by 2ef8e5130f5a0bcedd89b298dc2f742fd6417b41 This commit was automatically created from gocardless/client-library-templates@2ef8e5130f5a0bcedd89b298dc2f742fd6417b41 by the `push-files` action. Workflow run: https://github.com/gocardless/client-library-templates/actions/runs/25561717348 --- lib/Services/BillingRequestFlowsService.php | 2 +- lib/Services/BillingRequestsService.php | 18 +++++++++--------- lib/Services/BlocksService.php | 6 +++--- lib/Services/CreditorBankAccountsService.php | 2 +- lib/Services/CustomerBankAccountsService.php | 2 +- lib/Services/CustomerNotificationsService.php | 2 +- lib/Services/InstalmentSchedulesService.php | 2 +- lib/Services/MandateImportsService.php | 4 ++-- lib/Services/MandatesService.php | 4 ++-- lib/Services/OutboundPaymentsService.php | 6 +++--- lib/Services/PayerAuthorisationsService.php | 4 ++-- lib/Services/PaymentsService.php | 4 ++-- lib/Services/RedirectFlowsService.php | 2 +- lib/Services/ScenarioSimulatorsService.php | 2 +- lib/Services/SubscriptionsService.php | 6 +++--- lib/Services/WebhooksService.php | 2 +- 16 files changed, 34 insertions(+), 34 deletions(-) diff --git a/lib/Services/BillingRequestFlowsService.php b/lib/Services/BillingRequestFlowsService.php index 42f620293..10e1ee0d0 100644 --- a/lib/Services/BillingRequestFlowsService.php +++ b/lib/Services/BillingRequestFlowsService.php @@ -67,7 +67,7 @@ public function initialise($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array("data" => (object)$params['params'])); + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); unset($params['params']); } diff --git a/lib/Services/BillingRequestsService.php b/lib/Services/BillingRequestsService.php index 11a1b2760..c94272f05 100644 --- a/lib/Services/BillingRequestsService.php +++ b/lib/Services/BillingRequestsService.php @@ -80,7 +80,7 @@ public function collectCustomerDetails($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array("data" => (object)$params['params'])); + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); unset($params['params']); } @@ -122,7 +122,7 @@ public function collectBankAccount($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array("data" => (object)$params['params'])); + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); unset($params['params']); } @@ -164,7 +164,7 @@ public function confirmPayerDetails($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array("data" => (object)$params['params'])); + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); unset($params['params']); } @@ -206,7 +206,7 @@ public function fulfil($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array("data" => (object)$params['params'])); + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); unset($params['params']); } @@ -248,7 +248,7 @@ public function cancel($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array("data" => (object)$params['params'])); + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); unset($params['params']); } @@ -343,7 +343,7 @@ public function notify($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array("data" => (object)$params['params'])); + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); unset($params['params']); } @@ -385,7 +385,7 @@ public function fallback($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array("data" => (object)$params['params'])); + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); unset($params['params']); } @@ -427,7 +427,7 @@ public function chooseCurrency($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array("data" => (object)$params['params'])); + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); unset($params['params']); } @@ -469,7 +469,7 @@ public function selectInstitution($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array("data" => (object)$params['params'])); + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); unset($params['params']); } diff --git a/lib/Services/BlocksService.php b/lib/Services/BlocksService.php index fb24d1bde..3d8b44095 100644 --- a/lib/Services/BlocksService.php +++ b/lib/Services/BlocksService.php @@ -133,7 +133,7 @@ public function disable($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array("data" => (object)$params['params'])); + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); unset($params['params']); } @@ -175,7 +175,7 @@ public function enable($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array("data" => (object)$params['params'])); + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); unset($params['params']); } @@ -210,7 +210,7 @@ public function blockByRef($params = array()) { $path = "/blocks/block_by_ref"; if (isset($params['params'])) { - $params['body'] = json_encode(array("data" => (object)$params['params'])); + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); unset($params['params']); } diff --git a/lib/Services/CreditorBankAccountsService.php b/lib/Services/CreditorBankAccountsService.php index aae52dc08..45cabee01 100644 --- a/lib/Services/CreditorBankAccountsService.php +++ b/lib/Services/CreditorBankAccountsService.php @@ -133,7 +133,7 @@ public function disable($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array("data" => (object)$params['params'])); + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); unset($params['params']); } diff --git a/lib/Services/CustomerBankAccountsService.php b/lib/Services/CustomerBankAccountsService.php index 334274cad..aadb25711 100644 --- a/lib/Services/CustomerBankAccountsService.php +++ b/lib/Services/CustomerBankAccountsService.php @@ -164,7 +164,7 @@ public function disable($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array("data" => (object)$params['params'])); + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); unset($params['params']); } diff --git a/lib/Services/CustomerNotificationsService.php b/lib/Services/CustomerNotificationsService.php index bd6a12b9b..8ca8f78aa 100644 --- a/lib/Services/CustomerNotificationsService.php +++ b/lib/Services/CustomerNotificationsService.php @@ -43,7 +43,7 @@ public function handle($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array("data" => (object)$params['params'])); + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); unset($params['params']); } diff --git a/lib/Services/InstalmentSchedulesService.php b/lib/Services/InstalmentSchedulesService.php index 9f50d0ef1..5e4ce1a47 100644 --- a/lib/Services/InstalmentSchedulesService.php +++ b/lib/Services/InstalmentSchedulesService.php @@ -199,7 +199,7 @@ public function cancel($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array("data" => (object)$params['params'])); + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); unset($params['params']); } diff --git a/lib/Services/MandateImportsService.php b/lib/Services/MandateImportsService.php index 369a6f30d..90c3292cd 100644 --- a/lib/Services/MandateImportsService.php +++ b/lib/Services/MandateImportsService.php @@ -108,7 +108,7 @@ public function submit($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array("data" => (object)$params['params'])); + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); unset($params['params']); } @@ -150,7 +150,7 @@ public function cancel($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array("data" => (object)$params['params'])); + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); unset($params['params']); } diff --git a/lib/Services/MandatesService.php b/lib/Services/MandatesService.php index 84bfc0775..e24a253e6 100644 --- a/lib/Services/MandatesService.php +++ b/lib/Services/MandatesService.php @@ -167,7 +167,7 @@ public function cancel($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array("data" => (object)$params['params'])); + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); unset($params['params']); } @@ -210,7 +210,7 @@ public function reinstate($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array("data" => (object)$params['params'])); + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); unset($params['params']); } diff --git a/lib/Services/OutboundPaymentsService.php b/lib/Services/OutboundPaymentsService.php index e85fb5167..46b8bd164 100644 --- a/lib/Services/OutboundPaymentsService.php +++ b/lib/Services/OutboundPaymentsService.php @@ -73,7 +73,7 @@ public function withdraw($params = array()) { $path = "/outbound_payments/withdrawal"; if (isset($params['params'])) { - $params['body'] = json_encode(array("data" => (object)$params['params'])); + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); unset($params['params']); } @@ -115,7 +115,7 @@ public function cancel($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array("data" => (object)$params['params'])); + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); unset($params['params']); } @@ -157,7 +157,7 @@ public function approve($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array("data" => (object)$params['params'])); + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); unset($params['params']); } diff --git a/lib/Services/PayerAuthorisationsService.php b/lib/Services/PayerAuthorisationsService.php index 297989617..4ba05b922 100644 --- a/lib/Services/PayerAuthorisationsService.php +++ b/lib/Services/PayerAuthorisationsService.php @@ -139,7 +139,7 @@ public function submit($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array("data" => (object)$params['params'])); + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); unset($params['params']); } @@ -181,7 +181,7 @@ public function confirm($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array("data" => (object)$params['params'])); + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); unset($params['params']); } diff --git a/lib/Services/PaymentsService.php b/lib/Services/PaymentsService.php index a4bd2c9bb..e493b255b 100644 --- a/lib/Services/PaymentsService.php +++ b/lib/Services/PaymentsService.php @@ -164,7 +164,7 @@ public function cancel($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array("data" => (object)$params['params'])); + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); unset($params['params']); } @@ -206,7 +206,7 @@ public function retry($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array("data" => (object)$params['params'])); + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); unset($params['params']); } diff --git a/lib/Services/RedirectFlowsService.php b/lib/Services/RedirectFlowsService.php index d29c8995a..50df8b72e 100644 --- a/lib/Services/RedirectFlowsService.php +++ b/lib/Services/RedirectFlowsService.php @@ -108,7 +108,7 @@ public function complete($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array("data" => (object)$params['params'])); + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); unset($params['params']); } diff --git a/lib/Services/ScenarioSimulatorsService.php b/lib/Services/ScenarioSimulatorsService.php index 834449d5b..d52cf339e 100644 --- a/lib/Services/ScenarioSimulatorsService.php +++ b/lib/Services/ScenarioSimulatorsService.php @@ -200,7 +200,7 @@ public function run($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array("data" => (object)$params['params'])); + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); unset($params['params']); } diff --git a/lib/Services/SubscriptionsService.php b/lib/Services/SubscriptionsService.php index e4f5beb9e..2d3d70ac7 100644 --- a/lib/Services/SubscriptionsService.php +++ b/lib/Services/SubscriptionsService.php @@ -164,7 +164,7 @@ public function pause($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array("data" => (object)$params['params'])); + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); unset($params['params']); } @@ -206,7 +206,7 @@ public function resume($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array("data" => (object)$params['params'])); + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); unset($params['params']); } @@ -248,7 +248,7 @@ public function cancel($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array("data" => (object)$params['params'])); + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); unset($params['params']); } diff --git a/lib/Services/WebhooksService.php b/lib/Services/WebhooksService.php index d59f3b326..df7006cda 100644 --- a/lib/Services/WebhooksService.php +++ b/lib/Services/WebhooksService.php @@ -98,7 +98,7 @@ public function retry($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array("data" => (object)$params['params'])); + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); unset($params['params']); } From b618b273bd24afd3db49c93a3d9d17b8be8b9bf4 Mon Sep 17 00:00:00 2001 From: "gocardless-ci-robot[bot]" <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> Date: Wed, 13 May 2026 09:19:27 +0000 Subject: [PATCH 05/10] Changes generated by fe5b9706d5cd471e209b7dbeb90ac9927ef6da5d This commit was automatically created from gocardless/client-library-templates@fe5b9706d5cd471e209b7dbeb90ac9927ef6da5d by the `push-files` action. Workflow run: https://github.com/gocardless/client-library-templates/actions/runs/25789979698 --- lib/Resources/CustomerBankAccount.php | 8 +++++++ .../CustomerBankAccountsIntegrationTest.php | 23 +++++++++++++++++++ tests/fixtures/customer_bank_accounts.json | 10 ++++---- 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/lib/Resources/CustomerBankAccount.php b/lib/Resources/CustomerBankAccount.php index d7a089020..6cad2fc37 100644 --- a/lib/Resources/CustomerBankAccount.php +++ b/lib/Resources/CustomerBankAccount.php @@ -24,6 +24,7 @@ * @property-read mixed $id * @property-read mixed $links * @property-read mixed $metadata + * @property-read mixed $trusted_recipient */ class CustomerBankAccount extends BaseResource { @@ -104,4 +105,11 @@ class CustomerBankAccount extends BaseResource * names up to 50 characters and values up to 500 characters. */ protected $metadata; + + /** + * Whether this customer bank account is registered as a trusted recipient + * for Outbound Payments. Only present when the feature is enabled for the + * organisation. + */ + protected $trusted_recipient; } diff --git a/tests/Integration/CustomerBankAccountsIntegrationTest.php b/tests/Integration/CustomerBankAccountsIntegrationTest.php index 6b52b45ca..24984740c 100644 --- a/tests/Integration/CustomerBankAccountsIntegrationTest.php +++ b/tests/Integration/CustomerBankAccountsIntegrationTest.php @@ -76,6 +76,10 @@ public function testCustomerBankAccountsCreate() $this->assertEquals($body->metadata, $response->metadata); } + if (property_exists($body, 'trusted_recipient')) { + $this->assertEquals($body->trusted_recipient, $response->trusted_recipient); + } + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; @@ -138,6 +142,9 @@ public function testCustomerBankAccountsCreateWithIdempotencyConflict() if (property_exists($body, 'metadata')) { $this->assertEquals($body->metadata, $response->metadata); } + if (property_exists($body, 'trusted_recipient')) { + $this->assertEquals($body->trusted_recipient, $response->trusted_recipient); + } $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); @@ -217,6 +224,10 @@ public function testCustomerBankAccountsList() if (isset($body[$num]->metadata)) { $this->assertEquals($body[$num]->metadata, $record->metadata); } + + if (isset($body[$num]->trusted_recipient)) { + $this->assertEquals($body[$num]->trusted_recipient, $record->trusted_recipient); + } } $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); @@ -286,6 +297,10 @@ public function testCustomerBankAccountsGet() $this->assertEquals($body->metadata, $response->metadata); } + if (property_exists($body, 'trusted_recipient')) { + $this->assertEquals($body->trusted_recipient, $response->trusted_recipient); + } + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; @@ -354,6 +369,10 @@ public function testCustomerBankAccountsUpdate() $this->assertEquals($body->metadata, $response->metadata); } + if (property_exists($body, 'trusted_recipient')) { + $this->assertEquals($body->trusted_recipient, $response->trusted_recipient); + } + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; @@ -422,6 +441,10 @@ public function testCustomerBankAccountsDisable() $this->assertEquals($body->metadata, $response->metadata); } + if (property_exists($body, 'trusted_recipient')) { + $this->assertEquals($body->trusted_recipient, $response->trusted_recipient); + } + $expectedPathRegex = $this->extractResourceFixturePathRegex($fixture); $dispatchedRequest = $this->history[0]['request']; diff --git a/tests/fixtures/customer_bank_accounts.json b/tests/fixtures/customer_bank_accounts.json index 5a5274cb1..72f3e99c5 100644 --- a/tests/fixtures/customer_bank_accounts.json +++ b/tests/fixtures/customer_bank_accounts.json @@ -5,31 +5,31 @@ "method": "POST", "path_template": "/customer_bank_accounts", "url_params": {}, - "body": {"customer_bank_accounts":{"account_holder_name":"Billie Jean","account_number_ending":"1234","account_type":"savings","bank_account_token":"bat_f975ab3c-ecee-47a1-9590-5bb1d56fa113","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","enabled":true,"id":"BA123","links":{"customer":"example customer 101"},"metadata":{}}} + "body": {"customer_bank_accounts":{"account_holder_name":"Billie Jean","account_number_ending":"1234","account_type":"savings","bank_account_token":"bat_f975ab3c-ecee-47a1-9590-5bb1d56fa113","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","enabled":true,"id":"BA123","links":{"customer":"example customer 101"},"metadata":{},"trusted_recipient":true}} }, "list": { "method": "GET", "path_template": "/customer_bank_accounts", "url_params": {}, - "body": {"customer_bank_accounts":[{"account_holder_name":"Billie Jean","account_number_ending":"1234","account_type":"savings","bank_account_token":"bat_f975ab3c-ecee-47a1-9590-5bb1d56fa113","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","enabled":true,"id":"BA123","links":{"customer":"example customer 102"},"metadata":{}},{"account_holder_name":"Billie Jean","account_number_ending":"1234","account_type":"savings","bank_account_token":"bat_f975ab3c-ecee-47a1-9590-5bb1d56fa113","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","enabled":true,"id":"BA123","links":{"customer":"example customer 103"},"metadata":{}}],"meta":{"cursors":{"after":"example after 101","before":"example before 101"},"limit":50}} + "body": {"customer_bank_accounts":[{"account_holder_name":"Billie Jean","account_number_ending":"1234","account_type":"savings","bank_account_token":"bat_f975ab3c-ecee-47a1-9590-5bb1d56fa113","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","enabled":true,"id":"BA123","links":{"customer":"example customer 102"},"metadata":{},"trusted_recipient":true},{"account_holder_name":"Billie Jean","account_number_ending":"1234","account_type":"savings","bank_account_token":"bat_f975ab3c-ecee-47a1-9590-5bb1d56fa113","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","enabled":true,"id":"BA123","links":{"customer":"example customer 103"},"metadata":{},"trusted_recipient":true}],"meta":{"cursors":{"after":"example after 101","before":"example before 101"},"limit":50}} }, "get": { "method": "GET", "path_template": "/customer_bank_accounts/:identity", "url_params": {"identity": "BA123"}, - "body": {"customer_bank_accounts":{"account_holder_name":"Billie Jean","account_number_ending":"1234","account_type":"savings","bank_account_token":"bat_f975ab3c-ecee-47a1-9590-5bb1d56fa113","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","enabled":true,"id":"BA123","links":{"customer":"example customer 104"},"metadata":{}}} + "body": {"customer_bank_accounts":{"account_holder_name":"Billie Jean","account_number_ending":"1234","account_type":"savings","bank_account_token":"bat_f975ab3c-ecee-47a1-9590-5bb1d56fa113","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","enabled":true,"id":"BA123","links":{"customer":"example customer 104"},"metadata":{},"trusted_recipient":true}} }, "update": { "method": "PUT", "path_template": "/customer_bank_accounts/:identity", "url_params": {"identity": "BA123"}, - "body": {"customer_bank_accounts":{"account_holder_name":"Billie Jean","account_number_ending":"1234","account_type":"savings","bank_account_token":"bat_f975ab3c-ecee-47a1-9590-5bb1d56fa113","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","enabled":true,"id":"BA123","links":{"customer":"example customer 105"},"metadata":{}}} + "body": {"customer_bank_accounts":{"account_holder_name":"Billie Jean","account_number_ending":"1234","account_type":"savings","bank_account_token":"bat_f975ab3c-ecee-47a1-9590-5bb1d56fa113","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","enabled":true,"id":"BA123","links":{"customer":"example customer 105"},"metadata":{},"trusted_recipient":true}} }, "disable": { "method": "POST", "path_template": "/customer_bank_accounts/:identity/actions/disable", "url_params": {"identity": "BA123"}, - "body": {"customer_bank_accounts":{"account_holder_name":"Billie Jean","account_number_ending":"1234","account_type":"savings","bank_account_token":"bat_f975ab3c-ecee-47a1-9590-5bb1d56fa113","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","enabled":true,"id":"BA123","links":{"customer":"example customer 106"},"metadata":{}}} + "body": {"customer_bank_accounts":{"account_holder_name":"Billie Jean","account_number_ending":"1234","account_type":"savings","bank_account_token":"bat_f975ab3c-ecee-47a1-9590-5bb1d56fa113","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","enabled":true,"id":"BA123","links":{"customer":"example customer 106"},"metadata":{},"trusted_recipient":true}} } } From ac0a23d82d7da9caa5383c827016b6e49147c789 Mon Sep 17 00:00:00 2001 From: "gocardless-ci-robot[bot]" <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> Date: Thu, 14 May 2026 11:59:01 +0000 Subject: [PATCH 06/10] Changes generated by 3f78777e56609f4ccdddafe8228375716322d807 This commit was automatically created from gocardless/client-library-templates@3f78777e56609f4ccdddafe8228375716322d807 by the `push-files` action. Workflow run: https://github.com/gocardless/client-library-templates/actions/runs/25858705251 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4dc9c41bb..3cb9fb464 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# GoCardless Pro PHP client library +# GoCardless PHP client library -A PHP client for interacting with the GoCardless Pro API. +A PHP client for interacting with the GoCardless API. [![PHP version](https://badge.fury.io/ph/gocardless%2Fgocardless-pro.svg)](https://badge.fury.io/ph/gocardless%2Fgocardless-pro) [![CircleCI](https://circleci.com/gh/gocardless/gocardless-pro-php.svg?style=shield)](https://circleci.com/gh/gocardless/gocardless-pro-php) From 63e4d4c1b6eb15ef49e46e13287db8ae7418e165 Mon Sep 17 00:00:00 2001 From: "gocardless-ci-robot[bot]" <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> Date: Thu, 14 May 2026 13:45:58 +0000 Subject: [PATCH 07/10] Changes generated by 6ca63e56bfca4f8ea6d5563c1df8ddc59404db3c This commit was automatically created from gocardless/client-library-templates@6ca63e56bfca4f8ea6d5563c1df8ddc59404db3c by the `push-files` action. Workflow run: https://github.com/gocardless/client-library-templates/actions/runs/25863477360 --- lib/Resources/Balance.php | 2 +- lib/Resources/BillingRequestTemplate.php | 4 ++-- lib/Resources/Creditor.php | 4 ++-- lib/Resources/CreditorBankAccount.php | 4 ++-- lib/Resources/Customer.php | 4 ++-- lib/Resources/CustomerBankAccount.php | 4 ++-- lib/Resources/InstalmentSchedule.php | 2 +- lib/Resources/Institution.php | 2 +- lib/Resources/NegativeBalanceLimit.php | 2 +- lib/Resources/OutboundPayment.php | 2 +- lib/Resources/OutboundPaymentImport.php | 2 +- lib/Resources/Payment.php | 2 +- lib/Resources/PaymentAccount.php | 2 +- lib/Resources/Payout.php | 4 ++-- lib/Resources/Refund.php | 2 +- lib/Resources/SchemeIdentifier.php | 2 +- lib/Resources/Subscription.php | 2 +- tests/fixtures/events.json | 2 +- tests/fixtures/outbound_payments.json | 14 +++++++------- 19 files changed, 31 insertions(+), 31 deletions(-) diff --git a/lib/Resources/Balance.php b/lib/Resources/Balance.php index d24d446a7..ca6211700 100644 --- a/lib/Resources/Balance.php +++ b/lib/Resources/Balance.php @@ -50,7 +50,7 @@ class Balance extends BaseResource protected $balance_type; /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency * code. Currently "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" * are supported. */ diff --git a/lib/Resources/BillingRequestTemplate.php b/lib/Resources/BillingRequestTemplate.php index 720d173a7..47f1d3c3f 100644 --- a/lib/Resources/BillingRequestTemplate.php +++ b/lib/Resources/BillingRequestTemplate.php @@ -59,7 +59,7 @@ class BillingRequestTemplate extends BaseResource protected $mandate_request_constraints; /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency * code. */ protected $mandate_request_currency; @@ -134,7 +134,7 @@ class BillingRequestTemplate extends BaseResource protected $payment_request_amount; /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency * code. `GBP` and `EUR` supported; `GBP` with your customers in the UK and * for `EUR` with your customers in supported Eurozone countries only. */ diff --git a/lib/Resources/Creditor.php b/lib/Resources/Creditor.php index 0c9fb1d46..b81ddab89 100644 --- a/lib/Resources/Creditor.php +++ b/lib/Resources/Creditor.php @@ -77,7 +77,7 @@ class Creditor extends BaseResource /** * [ISO 3166-1 alpha-2 - * code.](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * code.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) */ protected $country_code; @@ -101,7 +101,7 @@ class Creditor extends BaseResource protected $custom_payment_pages_enabled; /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) code for + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) code for * the currency in which amounts will be paid out (after foreign exchange). * Currently "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are * supported. Present only if payouts will be (or were) made via foreign diff --git a/lib/Resources/CreditorBankAccount.php b/lib/Resources/CreditorBankAccount.php index 37572186a..43a466566 100644 --- a/lib/Resources/CreditorBankAccount.php +++ b/lib/Resources/CreditorBankAccount.php @@ -57,7 +57,7 @@ class CreditorBankAccount extends BaseResource /** * [ISO 3166-1 alpha-2 - * code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). + * code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). * Defaults to the country code of the `iban` if supplied, otherwise is * required. */ @@ -70,7 +70,7 @@ class CreditorBankAccount extends BaseResource protected $created_at; /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency * code. Currently "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" * are supported. */ diff --git a/lib/Resources/Customer.php b/lib/Resources/Customer.php index b03a762a5..3b2cc51ea 100644 --- a/lib/Resources/Customer.php +++ b/lib/Resources/Customer.php @@ -66,7 +66,7 @@ class Customer extends BaseResource /** * [ISO 3166-1 alpha-2 - * code.](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * code.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) */ protected $country_code; @@ -105,7 +105,7 @@ class Customer extends BaseResource protected $id; /** - * [ISO 639-1](http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) code. + * [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) code. * Used as the language for notification emails sent by GoCardless if your * organisation does not send its own (see [compliance * requirements](#appendix-compliance-requirements)). Currently only "en", diff --git a/lib/Resources/CustomerBankAccount.php b/lib/Resources/CustomerBankAccount.php index 6cad2fc37..7f7fa9067 100644 --- a/lib/Resources/CustomerBankAccount.php +++ b/lib/Resources/CustomerBankAccount.php @@ -66,7 +66,7 @@ class CustomerBankAccount extends BaseResource /** * [ISO 3166-1 alpha-2 - * code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). + * code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). * Defaults to the country code of the `iban` if supplied, otherwise is * required. */ @@ -79,7 +79,7 @@ class CustomerBankAccount extends BaseResource protected $created_at; /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency * code. Currently "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" * are supported. */ diff --git a/lib/Resources/InstalmentSchedule.php b/lib/Resources/InstalmentSchedule.php index 8a2a4b2f3..9f3fa8f88 100644 --- a/lib/Resources/InstalmentSchedule.php +++ b/lib/Resources/InstalmentSchedule.php @@ -33,7 +33,7 @@ class InstalmentSchedule extends BaseResource protected $created_at; /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency * code. Currently "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" * are supported. */ diff --git a/lib/Resources/Institution.php b/lib/Resources/Institution.php index 7f0d0af4b..65843ee03 100644 --- a/lib/Resources/Institution.php +++ b/lib/Resources/Institution.php @@ -34,7 +34,7 @@ class Institution extends BaseResource /** * [ISO - * 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) * alpha-2 code. The country code of the institution. If nothing is * provided, institutions with the country code 'GB' are returned by * default. diff --git a/lib/Resources/NegativeBalanceLimit.php b/lib/Resources/NegativeBalanceLimit.php index 8579c6151..e6112d700 100644 --- a/lib/Resources/NegativeBalanceLimit.php +++ b/lib/Resources/NegativeBalanceLimit.php @@ -34,7 +34,7 @@ class NegativeBalanceLimit extends BaseResource protected $created_at; /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency * code. Currently "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" * are supported. */ diff --git a/lib/Resources/OutboundPayment.php b/lib/Resources/OutboundPayment.php index 227c193ae..2533e31c2 100644 --- a/lib/Resources/OutboundPayment.php +++ b/lib/Resources/OutboundPayment.php @@ -43,7 +43,7 @@ class OutboundPayment extends BaseResource protected $created_at; /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency. + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency. * Currently only "GBP" is supported. */ protected $currency; diff --git a/lib/Resources/OutboundPaymentImport.php b/lib/Resources/OutboundPaymentImport.php index 91a1f4379..a403e6dc4 100644 --- a/lib/Resources/OutboundPaymentImport.php +++ b/lib/Resources/OutboundPaymentImport.php @@ -43,7 +43,7 @@ class OutboundPaymentImport extends BaseResource protected $created_at; /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency. + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency. * Currently only "GBP" is supported. */ protected $currency; diff --git a/lib/Resources/Payment.php b/lib/Resources/Payment.php index bea12d1fd..2f4239915 100644 --- a/lib/Resources/Payment.php +++ b/lib/Resources/Payment.php @@ -60,7 +60,7 @@ class Payment extends BaseResource protected $created_at; /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency * code. Currently "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" * are supported. */ diff --git a/lib/Resources/PaymentAccount.php b/lib/Resources/PaymentAccount.php index 217d99cd0..a7bfd0650 100644 --- a/lib/Resources/PaymentAccount.php +++ b/lib/Resources/PaymentAccount.php @@ -51,7 +51,7 @@ class PaymentAccount extends BaseResource protected $bank_name; /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency * code. Currently "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" * are supported. */ diff --git a/lib/Resources/Payout.php b/lib/Resources/Payout.php index 127645eb5..56a745737 100644 --- a/lib/Resources/Payout.php +++ b/lib/Resources/Payout.php @@ -55,7 +55,7 @@ class Payout extends BaseResource protected $created_at; /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency * code. Currently "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" * are supported. */ @@ -123,7 +123,7 @@ class Payout extends BaseResource protected $status; /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) code for + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) code for * the currency in which tax is paid out to the tax authorities of your tax * jurisdiction. Currently “EUR”, “GBP”, for French or British merchants, * this will be `null` if tax is not applicable beta diff --git a/lib/Resources/Refund.php b/lib/Resources/Refund.php index 4c5467f2e..e35c7191d 100644 --- a/lib/Resources/Refund.php +++ b/lib/Resources/Refund.php @@ -38,7 +38,7 @@ class Refund extends BaseResource protected $created_at; /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency * code. This is set to the currency of the refund's * [payment](#core-endpoints-payments). */ diff --git a/lib/Resources/SchemeIdentifier.php b/lib/Resources/SchemeIdentifier.php index 69b567156..3683396f5 100644 --- a/lib/Resources/SchemeIdentifier.php +++ b/lib/Resources/SchemeIdentifier.php @@ -63,7 +63,7 @@ class SchemeIdentifier extends BaseResource /** * [ISO 3166-1 alpha-2 - * code.](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * code.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) */ protected $country_code; diff --git a/lib/Resources/Subscription.php b/lib/Resources/Subscription.php index fda79cac9..0c6495317 100644 --- a/lib/Resources/Subscription.php +++ b/lib/Resources/Subscription.php @@ -63,7 +63,7 @@ class Subscription extends BaseResource protected $created_at; /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency * code. Currently "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" * are supported. */ diff --git a/tests/fixtures/events.json b/tests/fixtures/events.json index cc736de72..5eab13d4e 100644 --- a/tests/fixtures/events.json +++ b/tests/fixtures/events.json @@ -5,7 +5,7 @@ "method": "GET", "path_template": "/events", "url_params": {}, - "body": {"events":[{"action":"cancelled","created_at":"2014-01-01T12:00:00.000Z","customer_notifications":[{"deadline":"2024-01-15T10:00:00.000Z","id":"PCN123","mandatory":false,"type":"example type 101"}],"details":{"bank_account_id":"BA123","cause":"bank_account_disabled","currency":"GBP","description":"Customer's bank account closed","item_count":10,"not_retried_reason":"failure_filter_applied","origin":"bank","property":"fx_payout_currency","reason_code":"ADDACS-B","scheme":"bacs","will_attempt_retry":true},"id":"EV123","links":{"bank_authorisation":"BAU123","billing_request":"BRQ123","billing_request_flow":"BRF123","creditor":"CR123","customer":"CU123","customer_bank_account":"BA123","instalment_schedule":"IS123","mandate":"MD123","mandate_request":"MRQ123","mandate_request_mandate":"MD123","new_customer_bank_account":"BA123","new_mandate":"MD123","organisation":"OR123","outbound_payment":"OUT123","parent_event":"EV123","payer_authorisation":"PAU123","payment":"PM123","payment_account_transaction":"PATR123","payment_request_payment":"PM123","payout":"PO123","previous_customer_bank_account":"BA123","refund":"RF123","scheme_identifier":"SU123","subscription":"SB123"},"metadata":{},"resource_metadata":{},"resource_type":"mandates","source":{"name":"Joe Bloggs","type":"gc_team"}},{"action":"cancelled","created_at":"2014-01-01T12:00:00.000Z","customer_notifications":[{"deadline":"2024-01-15T10:00:00.000Z","id":"PCN123","mandatory":true,"type":"example type 103"}],"details":{"bank_account_id":"BA123","cause":"bank_account_disabled","currency":"GBP","description":"Customer's bank account closed","item_count":10,"not_retried_reason":"failure_filter_applied","origin":"bank","property":"fx_payout_currency","reason_code":"ADDACS-B","scheme":"bacs","will_attempt_retry":true},"id":"EV123","links":{"bank_authorisation":"BAU123","billing_request":"BRQ123","billing_request_flow":"BRF123","creditor":"CR123","customer":"CU123","customer_bank_account":"BA123","instalment_schedule":"IS123","mandate":"MD123","mandate_request":"MRQ123","mandate_request_mandate":"MD123","new_customer_bank_account":"BA123","new_mandate":"MD123","organisation":"OR123","outbound_payment":"OUT123","parent_event":"EV123","payer_authorisation":"PAU123","payment":"PM123","payment_account_transaction":"PATR123","payment_request_payment":"PM123","payout":"PO123","previous_customer_bank_account":"BA123","refund":"RF123","scheme_identifier":"SU123","subscription":"SB123"},"metadata":{},"resource_metadata":{},"resource_type":"mandates","source":{"name":"Joe Bloggs","type":"app"}}],"linked":{"billing_requests":[{"actions":[{"available_currencies":["GBP"],"bank_authorisation":{"adapter":"example adapter 101","authorisation_type":"example authorisation_type 101"},"collect_customer_details":{"default_country_code":"example default_country_code 101","incomplete_fields":{"customer":["example customer 101"],"customer_billing_detail":["example customer_billing_detail 101"]}},"completes_actions":["collect_bank_account"],"institution_guess_status":"pending","required":true,"requires_actions":["collect_bank_account"],"status":"pending","type":"collect_bank_account"}],"created_at":"2015-01-01T12:00:00.000Z","fallback_enabled":false,"fallback_occurred":false,"id":"BRQ123","instalment_schedule_request":{"app_fee":100,"currency":"USD","instalments_with_dates":[{"amount":250,"charge_date":"2020-11-03"}],"instalments_with_schedule":{"amounts":[1000],"interval":1,"interval_unit":"monthly","start_date":"2014-10-21"},"links":{"instalment_schedule":"example instalment_schedule 101"},"metadata":{},"name":"Invoice 4404","payment_reference":"GOLDPLAN","retry_if_possible":false,"total_amount":1000},"links":{"bank_authorisation":"example bank_authorisation 101","creditor":"CR123","customer":"CU123","customer_bank_account":"BA123","customer_billing_detail":"example customer_billing_detail 102","instalment_schedule_request":"ISR123","instalment_schedule_request_instalment_schedule":"IS123","mandate_request":"MRQ123","mandate_request_mandate":"MD123","organisation":"OR123","payment_provider":"PP123","payment_request":"PRQ123","payment_request_payment":"PM123","subscription_request":"SBR123","subscription_request_subscription":"SB123"},"mandate_request":{"authorisation_source":"telephone","consent_type":"example consent_type 101","constraints":{"end_date":"example end_date 101","max_amount_per_payment":101,"payment_method":"example payment_method 101","periodic_limits":[{"alignment":"creation_date","max_payments":101,"max_total_amount":101,"period":"week"}],"start_date":"example start_date 101"},"currency":"GBP","description":"Top-up Payment","funds_settlement":"direct","links":{"mandate":"example mandate 101"},"metadata":{},"payer_requested_dual_signature":false,"scheme":"bacs","sweeping":false,"verify":"recommended"},"metadata":{},"payment_context_code":"billing_goods_and_services_in_arrears","payment_purpose_code":"example payment_purpose_code 101","payment_request":{"amount":1000,"app_fee":100,"currency":"GBP","description":"Top-up Payment","funds_settlement":"managed","links":{"payment":"example payment 101"},"metadata":{},"reference":"some-custom-ref","scheme":"faster_payments"},"purpose_code":"utility","resources":{"customer":{"company_name":"Hamilton Trading Ltd.","created_at":"2014-01-01T12:00:00.000Z","email":"user@example.com","family_name":"Osborne","given_name":"Frank","id":"CU123","language":"en","metadata":{},"phone_number":"+64 4 817 9999"},"customer_bank_account":{"account_holder_name":"Billie Jean","account_number_ending":"1234","account_type":"savings","bank_account_token":"bat_f975ab3c-ecee-47a1-9590-5bb1d56fa113","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","enabled":true,"id":"BA123","links":{"customer":"example customer 102"},"metadata":{}},"customer_billing_detail":{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":"City of Westminster","city":"London","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","danish_identity_number":"220550-6218","id":"CU123","ip_address":"127.0.0.1","postal_code":"NW1 6XE","region":"Greater London","schemes":["example schemes 101"],"swedish_identity_number":"556564-5404"}},"status":"pending","subscription_request":{"amount":1000,"app_fee":100,"count":5,"currency":"USD","day_of_month":28,"interval":1,"interval_unit":"monthly","links":{"subscription":"example subscription 101"},"metadata":{},"month":"january","name":"12 month subscription","payment_reference":"GOLDPLAN","retry_if_possible":true,"start_date":"2014-10-21"}}],"creditors":[{"address_line1":"338-346 Goswell Road","address_line2":"Islington","address_line3":"example address_line3 101","bank_reference_prefix":"ACME","can_create_refunds":false,"city":"London","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","creditor_type":"company","custom_payment_pages_enabled":true,"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":"BA456","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","mandate_imports_enabled":true,"merchant_responsible_for_notifications":true,"name":"Acme","postal_code":"EC1V 7LQ","region":"example region 101","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","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","email":"user@example.com","id":"SU123","minimum_advance_notice":3,"name":"example name 101","phone_number":"+44 20 1234 1234","postal_code":"NW1 6XE","reference":"example reference 101","region":"Greater London","scheme":"bacs","status":"pending"}],"verification_status":"action_required"}],"customers":[{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":"City of Westminster","city":"London","company_name":"Hamilton Trading Ltd.","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","danish_identity_number":"220550-6218","email":"user@example.com","family_name":"Osborne","given_name":"Frank","id":"CU123","language":"en","metadata":{},"phone_number":"+64 4 817 9999","postal_code":"NW1 6XE","region":"Greater London","swedish_identity_number":"556564-5404"}],"instalment_schedules":[{"created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","id":"IS123","links":{"customer":"CU123","mandate":"MD123","payments":["PM123","PM456"]},"metadata":{},"name":"Invoice 4404","payment_errors":{"0":[{"field":"charge_date","message":"must be on or after mandate's next_possible_customer_charge_date"}]},"status":"active","total_amount":1000}],"mandates":[{"authorisation_source":"paper","consent_parameters":{"end_date":"example end_date 102","max_amount_per_payment":102,"max_amount_per_period":101,"max_payments_per_period":101,"period":"month","start_date":"example start_date 102"},"consent_type":"example consent_type 102","created_at":"2014-01-01T12:00:00.000Z","funds_settlement":"direct","id":"MD123","links":{"creditor":"CR123","customer":"CU123","customer_bank_account":"BA123","new_mandate":"MD123"},"metadata":{},"next_possible_charge_date":"2014-10-27","next_possible_standard_ach_charge_date":"2014-10-27","payments_require_approval":false,"reference":"REF-123","scheme":"bacs","status":"pending_submission","verified_at":"2021-01-01T12:00:00.000Z"}],"outbound_payments":[{"amount":1000,"created_at":"2024-01-01T12:00:00.000Z","currency":"GBP","description":"Reward Payment (August 2024)","execution_date":"2024-08-31","id":"OUT123","is_withdrawal":true,"links":{"creditor":"CR123","customer":"CU123","outbound_payment_import":"IM123","recipient_bank_account":"BA123"},"metadata":{},"reference":"GC-QC2FI7GBEW7VCXL","scheme":"faster_payments","status":"cancelled","verifications":{"recipient_bank_account_holder_verification":{"actual_account_name":"Jo Doe","result":"partial_match","type":"confirmation_of_payee"}}}],"payer_authorisations":[{"bank_account":{"account_holder_name":"Billie Jean","account_number":"55779911","account_number_ending":"1234","account_number_suffix":"00","account_type":"savings","bank_code":"example bank_code 101","branch_code":"20-00-00","country_code":"GB","currency":"EUR","iban":"GB60BARC20000055779911","metadata":{}},"created_at":"2020-01-01T12:00:00.000Z","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":"user@example.com","family_name":"Osborne","given_name":"Frank","locale":"en-GB","metadata":{},"postal_code":"NW1 6XE","region":"Greater London","swedish_identity_number":"556564-5404"},"id":"PA123","incomplete_fields":[{"field":"example field 101","message":"example message 101","request_pointer":"example request_pointer 101"}],"links":{"bank_account":"BA123","customer":"CU123","mandate":"MD123"},"mandate":{"metadata":{},"payer_ip_address":"127.0.0.1","reference":"REF-123","scheme":"bacs"},"status":"created"}],"payment_account_transactions":[{"amount":1000,"balance_after_transaction":1000,"counterparty_name":"Acme Ltd","currency":"example currency 101","description":"Reward Payment (August 2024)","direction":"credit","id":"PATR1234","links":{"outbound_payment":"OUT123","payment_bank_account":"BA123","payout":"PO123"},"reference":"GC-058408d9","value_date":"2014-01-01"}],"payments":[{"amount":1000,"amount_refunded":150,"charge_date":"2014-05-21","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","description":"One-off upgrade fee","faster_ach":false,"fx":{"estimated_exchange_rate":"1.1234567890","exchange_rate":"1.1234567890","fx_amount":1150,"fx_currency":"EUR"},"id":"PM123","links":{"creditor":"CR123","instalment_schedule":"IS123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":"WINEBOX001","retry_if_possible":false,"scheme":"bacs","status":"submitted"}],"payouts":[{"amount":1000,"arrival_date":"2014-01-01","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","deducted_fees":20,"fx":{"estimated_exchange_rate":"1.1234567890","exchange_rate":"1.1234567890","fx_amount":1150,"fx_currency":"EUR"},"id":"PO123","links":{"creditor":"CR123","creditor_bank_account":"BA123"},"metadata":{"salesforce_id":"ABCD1234"},"payout_type":"merchant","reference":"ref-1","status":"pending","tax_currency":"EUR"}],"refunds":[{"amount":150,"created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","fx":{"estimated_exchange_rate":"1.1234567890","exchange_rate":"1.1234567890","fx_amount":1150,"fx_currency":"EUR"},"id":"RF123","links":{"mandate":"MD123","payment":"PM123"},"metadata":{},"reference":"WINEBOX001","status":"submitted"}],"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","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","email":"user@example.com","id":"SU123","minimum_advance_notice":3,"name":"example name 102","phone_number":"+44 20 1234 1234","postal_code":"NW1 6XE","reference":"example reference 102","region":"Greater London","scheme":"bacs","status":"pending"}],"subscriptions":[{"amount":1000,"app_fee":100,"count":5,"created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","day_of_month":28,"earliest_charge_date_after_resume":"2014-11-03","end_date":"2015-10-21","id":"SB123","interval":1,"interval_unit":"monthly","links":{"mandate":"MD123"},"metadata":{},"month":"january","name":"12 month subscription","parent_plan_paused":false,"payment_reference":"GOLDPLAN","retry_if_possible":true,"start_date":"2014-10-21","status":"active","upcoming_payments":[{"amount":2500,"charge_date":"2014-11-03"}]}]},"meta":{"cursors":{"after":"example after 101","before":"example before 101"},"limit":50}} + "body": {"events":[{"action":"cancelled","created_at":"2014-01-01T12:00:00.000Z","customer_notifications":[{"deadline":"2024-01-15T10:00:00.000Z","id":"PCN123","mandatory":false,"type":"example type 101"}],"details":{"bank_account_id":"BA123","cause":"bank_account_disabled","currency":"GBP","description":"Customer's bank account closed","item_count":10,"not_retried_reason":"failure_filter_applied","origin":"bank","property":"fx_payout_currency","reason_code":"ADDACS-B","scheme":"bacs","will_attempt_retry":true},"id":"EV123","links":{"bank_authorisation":"BAU123","billing_request":"BRQ123","billing_request_flow":"BRF123","creditor":"CR123","customer":"CU123","customer_bank_account":"BA123","instalment_schedule":"IS123","mandate":"MD123","mandate_request":"MRQ123","mandate_request_mandate":"MD123","new_customer_bank_account":"BA123","new_mandate":"MD123","organisation":"OR123","outbound_payment":"OUT123","parent_event":"EV123","payer_authorisation":"PAU123","payment":"PM123","payment_account_transaction":"PATR123","payment_request_payment":"PM123","payout":"PO123","previous_customer_bank_account":"BA123","refund":"RF123","scheme_identifier":"SU123","subscription":"SB123"},"metadata":{},"resource_metadata":{},"resource_type":"mandates","source":{"name":"Joe Bloggs","type":"gc_team"}},{"action":"cancelled","created_at":"2014-01-01T12:00:00.000Z","customer_notifications":[{"deadline":"2024-01-15T10:00:00.000Z","id":"PCN123","mandatory":true,"type":"example type 103"}],"details":{"bank_account_id":"BA123","cause":"bank_account_disabled","currency":"GBP","description":"Customer's bank account closed","item_count":10,"not_retried_reason":"failure_filter_applied","origin":"bank","property":"fx_payout_currency","reason_code":"ADDACS-B","scheme":"bacs","will_attempt_retry":true},"id":"EV123","links":{"bank_authorisation":"BAU123","billing_request":"BRQ123","billing_request_flow":"BRF123","creditor":"CR123","customer":"CU123","customer_bank_account":"BA123","instalment_schedule":"IS123","mandate":"MD123","mandate_request":"MRQ123","mandate_request_mandate":"MD123","new_customer_bank_account":"BA123","new_mandate":"MD123","organisation":"OR123","outbound_payment":"OUT123","parent_event":"EV123","payer_authorisation":"PAU123","payment":"PM123","payment_account_transaction":"PATR123","payment_request_payment":"PM123","payout":"PO123","previous_customer_bank_account":"BA123","refund":"RF123","scheme_identifier":"SU123","subscription":"SB123"},"metadata":{},"resource_metadata":{},"resource_type":"mandates","source":{"name":"Joe Bloggs","type":"app"}}],"linked":{"billing_requests":[{"actions":[{"available_currencies":["GBP"],"bank_authorisation":{"adapter":"example adapter 101","authorisation_type":"example authorisation_type 101"},"collect_customer_details":{"default_country_code":"example default_country_code 101","incomplete_fields":{"customer":["example customer 101"],"customer_billing_detail":["example customer_billing_detail 101"]}},"completes_actions":["collect_bank_account"],"institution_guess_status":"pending","required":true,"requires_actions":["collect_bank_account"],"status":"pending","type":"collect_bank_account"}],"created_at":"2015-01-01T12:00:00.000Z","fallback_enabled":false,"fallback_occurred":false,"id":"BRQ123","instalment_schedule_request":{"app_fee":100,"currency":"USD","instalments_with_dates":[{"amount":250,"charge_date":"2020-11-03"}],"instalments_with_schedule":{"amounts":[1000],"interval":1,"interval_unit":"monthly","start_date":"2014-10-21"},"links":{"instalment_schedule":"example instalment_schedule 101"},"metadata":{},"name":"Invoice 4404","payment_reference":"GOLDPLAN","retry_if_possible":false,"total_amount":1000},"links":{"bank_authorisation":"example bank_authorisation 101","creditor":"CR123","customer":"CU123","customer_bank_account":"BA123","customer_billing_detail":"example customer_billing_detail 102","instalment_schedule_request":"ISR123","instalment_schedule_request_instalment_schedule":"IS123","mandate_request":"MRQ123","mandate_request_mandate":"MD123","organisation":"OR123","payment_provider":"PP123","payment_request":"PRQ123","payment_request_payment":"PM123","subscription_request":"SBR123","subscription_request_subscription":"SB123"},"mandate_request":{"authorisation_source":"telephone","consent_type":"example consent_type 101","constraints":{"end_date":"example end_date 101","max_amount_per_payment":101,"payment_method":"example payment_method 101","periodic_limits":[{"alignment":"creation_date","max_payments":101,"max_total_amount":101,"period":"week"}],"start_date":"example start_date 101"},"currency":"GBP","description":"Top-up Payment","funds_settlement":"direct","links":{"mandate":"example mandate 101"},"metadata":{},"payer_requested_dual_signature":false,"scheme":"bacs","sweeping":false,"verify":"recommended"},"metadata":{},"payment_context_code":"billing_goods_and_services_in_arrears","payment_purpose_code":"example payment_purpose_code 101","payment_request":{"amount":1000,"app_fee":100,"currency":"GBP","description":"Top-up Payment","funds_settlement":"managed","links":{"payment":"example payment 101"},"metadata":{},"reference":"some-custom-ref","scheme":"faster_payments"},"purpose_code":"utility","resources":{"customer":{"company_name":"Hamilton Trading Ltd.","created_at":"2014-01-01T12:00:00.000Z","email":"user@example.com","family_name":"Osborne","given_name":"Frank","id":"CU123","language":"en","metadata":{},"phone_number":"+64 4 817 9999"},"customer_bank_account":{"account_holder_name":"Billie Jean","account_number_ending":"1234","account_type":"savings","bank_account_token":"bat_f975ab3c-ecee-47a1-9590-5bb1d56fa113","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","enabled":true,"id":"BA123","links":{"customer":"example customer 102"},"metadata":{}},"customer_billing_detail":{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":"City of Westminster","city":"London","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","danish_identity_number":"220550-6218","id":"CU123","ip_address":"127.0.0.1","postal_code":"NW1 6XE","region":"Greater London","schemes":["example schemes 101"],"swedish_identity_number":"556564-5404"}},"status":"pending","subscription_request":{"amount":1000,"app_fee":100,"count":5,"currency":"USD","day_of_month":28,"interval":1,"interval_unit":"monthly","links":{"subscription":"example subscription 101"},"metadata":{},"month":"january","name":"12 month subscription","payment_reference":"GOLDPLAN","retry_if_possible":true,"start_date":"2014-10-21"}}],"creditors":[{"address_line1":"338-346 Goswell Road","address_line2":"Islington","address_line3":"example address_line3 101","bank_reference_prefix":"ACME","can_create_refunds":false,"city":"London","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","creditor_type":"company","custom_payment_pages_enabled":true,"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":"BA456","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","mandate_imports_enabled":true,"merchant_responsible_for_notifications":true,"name":"Acme","postal_code":"EC1V 7LQ","region":"example region 101","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","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","email":"user@example.com","id":"SU123","minimum_advance_notice":3,"name":"example name 101","phone_number":"+44 20 1234 1234","postal_code":"NW1 6XE","reference":"example reference 101","region":"Greater London","scheme":"bacs","status":"pending"}],"verification_status":"action_required"}],"customers":[{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":"City of Westminster","city":"London","company_name":"Hamilton Trading Ltd.","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","danish_identity_number":"220550-6218","email":"user@example.com","family_name":"Osborne","given_name":"Frank","id":"CU123","language":"en","metadata":{},"phone_number":"+64 4 817 9999","postal_code":"NW1 6XE","region":"Greater London","swedish_identity_number":"556564-5404"}],"instalment_schedules":[{"created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","id":"IS123","links":{"customer":"CU123","mandate":"MD123","payments":["PM123","PM456"]},"metadata":{},"name":"Invoice 4404","payment_errors":{"0":[{"field":"charge_date","message":"must be on or after mandate's next_possible_customer_charge_date"}]},"status":"active","total_amount":1000}],"mandates":[{"authorisation_source":"paper","consent_parameters":{"end_date":"example end_date 102","max_amount_per_payment":102,"max_amount_per_period":101,"max_payments_per_period":101,"period":"month","start_date":"example start_date 102"},"consent_type":"example consent_type 102","created_at":"2014-01-01T12:00:00.000Z","funds_settlement":"direct","id":"MD123","links":{"creditor":"CR123","customer":"CU123","customer_bank_account":"BA123","new_mandate":"MD123"},"metadata":{},"next_possible_charge_date":"2014-10-27","next_possible_standard_ach_charge_date":"2014-10-27","payments_require_approval":false,"reference":"REF-123","scheme":"bacs","status":"pending_submission","verified_at":"2021-01-01T12:00:00.000Z"}],"outbound_payments":[{"amount":1000,"created_at":"2024-01-01T12:00:00.001Z","currency":"GBP","description":"Reward Payment (August 2024)","execution_date":"2024-08-31","id":"OUT123","is_withdrawal":true,"links":{"creditor":"CR123","customer":"CU123","outbound_payment_import":"IM123","recipient_bank_account":"BA123"},"metadata":{},"reference":"GC-QC2FI7GBEW7VCXL","scheme":"faster_payments","status":"cancelled","verifications":{"recipient_bank_account_holder_verification":{"actual_account_name":"Jo Doe","result":"partial_match","type":"confirmation_of_payee"}}}],"payer_authorisations":[{"bank_account":{"account_holder_name":"Billie Jean","account_number":"55779911","account_number_ending":"1234","account_number_suffix":"00","account_type":"savings","bank_code":"example bank_code 101","branch_code":"20-00-00","country_code":"GB","currency":"EUR","iban":"GB60BARC20000055779911","metadata":{}},"created_at":"2020-01-01T12:00:00.000Z","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":"user@example.com","family_name":"Osborne","given_name":"Frank","locale":"en-GB","metadata":{},"postal_code":"NW1 6XE","region":"Greater London","swedish_identity_number":"556564-5404"},"id":"PA123","incomplete_fields":[{"field":"example field 101","message":"example message 101","request_pointer":"example request_pointer 101"}],"links":{"bank_account":"BA123","customer":"CU123","mandate":"MD123"},"mandate":{"metadata":{},"payer_ip_address":"127.0.0.1","reference":"REF-123","scheme":"bacs"},"status":"created"}],"payment_account_transactions":[{"amount":1000,"balance_after_transaction":1000,"counterparty_name":"Acme Ltd","currency":"example currency 101","description":"Reward Payment (August 2024)","direction":"credit","id":"PATR1234","links":{"outbound_payment":"OUT123","payment_bank_account":"BA123","payout":"PO123"},"reference":"GC-058408d9","value_date":"2014-01-01"}],"payments":[{"amount":1000,"amount_refunded":150,"charge_date":"2014-05-21","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","description":"One-off upgrade fee","faster_ach":false,"fx":{"estimated_exchange_rate":"1.1234567890","exchange_rate":"1.1234567890","fx_amount":1150,"fx_currency":"EUR"},"id":"PM123","links":{"creditor":"CR123","instalment_schedule":"IS123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":"WINEBOX001","retry_if_possible":false,"scheme":"bacs","status":"submitted"}],"payouts":[{"amount":1000,"arrival_date":"2014-01-01","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","deducted_fees":20,"fx":{"estimated_exchange_rate":"1.1234567890","exchange_rate":"1.1234567890","fx_amount":1150,"fx_currency":"EUR"},"id":"PO123","links":{"creditor":"CR123","creditor_bank_account":"BA123"},"metadata":{"salesforce_id":"ABCD1234"},"payout_type":"merchant","reference":"ref-1","status":"pending","tax_currency":"EUR"}],"refunds":[{"amount":150,"created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","fx":{"estimated_exchange_rate":"1.1234567890","exchange_rate":"1.1234567890","fx_amount":1150,"fx_currency":"EUR"},"id":"RF123","links":{"mandate":"MD123","payment":"PM123"},"metadata":{},"reference":"WINEBOX001","status":"submitted"}],"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","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","email":"user@example.com","id":"SU123","minimum_advance_notice":3,"name":"example name 102","phone_number":"+44 20 1234 1234","postal_code":"NW1 6XE","reference":"example reference 102","region":"Greater London","scheme":"bacs","status":"pending"}],"subscriptions":[{"amount":1000,"app_fee":100,"count":5,"created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","day_of_month":28,"earliest_charge_date_after_resume":"2014-11-03","end_date":"2015-10-21","id":"SB123","interval":1,"interval_unit":"monthly","links":{"mandate":"MD123"},"metadata":{},"month":"january","name":"12 month subscription","parent_plan_paused":false,"payment_reference":"GOLDPLAN","retry_if_possible":true,"start_date":"2014-10-21","status":"active","upcoming_payments":[{"amount":2500,"charge_date":"2014-11-03"}]}]},"meta":{"cursors":{"after":"example after 101","before":"example before 101"},"limit":50}} }, "get": { "method": "GET", diff --git a/tests/fixtures/outbound_payments.json b/tests/fixtures/outbound_payments.json index adad738c6..535f61c89 100644 --- a/tests/fixtures/outbound_payments.json +++ b/tests/fixtures/outbound_payments.json @@ -5,43 +5,43 @@ "method": "POST", "path_template": "/outbound_payments", "url_params": {}, - "body": {"outbound_payments":{"amount":1000,"created_at":"2024-01-01T12:00:00.000Z","currency":"GBP","description":"Reward Payment (August 2024)","execution_date":"2024-08-31","id":"OUT123","is_withdrawal":true,"links":{"creditor":"CR123","customer":"CU123","outbound_payment_import":"IM123","recipient_bank_account":"BA123"},"metadata":{},"reference":"GC-QC2FI7GBEW7VCXL","scheme":"faster_payments","status":"cancelled","verifications":{"recipient_bank_account_holder_verification":{"actual_account_name":"Jo Doe","result":"partial_match","type":"confirmation_of_payee"}}}} + "body": {"outbound_payments":{"amount":1000,"created_at":"2024-01-01T12:00:00.001Z","currency":"GBP","description":"Reward Payment (August 2024)","execution_date":"2024-08-31","id":"OUT123","is_withdrawal":true,"links":{"creditor":"CR123","customer":"CU123","outbound_payment_import":"IM123","recipient_bank_account":"BA123"},"metadata":{},"reference":"GC-QC2FI7GBEW7VCXL","scheme":"faster_payments","status":"cancelled","verifications":{"recipient_bank_account_holder_verification":{"actual_account_name":"Jo Doe","result":"partial_match","type":"confirmation_of_payee"}}}} }, "withdraw": { "method": "POST", "path_template": "/outbound_payments/withdrawal", "url_params": {}, - "body": {"outbound_payments":{"amount":1000,"created_at":"2024-01-01T12:00:00.000Z","currency":"GBP","description":"Reward Payment (August 2024)","execution_date":"2024-08-31","id":"OUT123","is_withdrawal":true,"links":{"creditor":"CR123","customer":"CU123","outbound_payment_import":"IM123","recipient_bank_account":"BA123"},"metadata":{},"reference":"GC-QC2FI7GBEW7VCXL","scheme":"faster_payments","status":"cancelled","verifications":{"recipient_bank_account_holder_verification":{"actual_account_name":"Jo Doe","result":"partial_match","type":"confirmation_of_payee"}}}} + "body": {"outbound_payments":{"amount":1000,"created_at":"2024-01-01T12:00:00.001Z","currency":"GBP","description":"Reward Payment (August 2024)","execution_date":"2024-08-31","id":"OUT123","is_withdrawal":true,"links":{"creditor":"CR123","customer":"CU123","outbound_payment_import":"IM123","recipient_bank_account":"BA123"},"metadata":{},"reference":"GC-QC2FI7GBEW7VCXL","scheme":"faster_payments","status":"cancelled","verifications":{"recipient_bank_account_holder_verification":{"actual_account_name":"Jo Doe","result":"partial_match","type":"confirmation_of_payee"}}}} }, "cancel": { "method": "POST", "path_template": "/outbound_payments/:identity/actions/cancel", "url_params": {"identity": "OUT123"}, - "body": {"outbound_payments":{"amount":1000,"created_at":"2024-01-01T12:00:00.000Z","currency":"GBP","description":"Reward Payment (August 2024)","execution_date":"2024-08-31","id":"OUT123","is_withdrawal":true,"links":{"creditor":"CR123","customer":"CU123","outbound_payment_import":"IM123","recipient_bank_account":"BA123"},"metadata":{},"reference":"GC-QC2FI7GBEW7VCXL","scheme":"faster_payments","status":"cancelled","verifications":{"recipient_bank_account_holder_verification":{"actual_account_name":"Jo Doe","result":"partial_match","type":"confirmation_of_payee"}}}} + "body": {"outbound_payments":{"amount":1000,"created_at":"2024-01-01T12:00:00.001Z","currency":"GBP","description":"Reward Payment (August 2024)","execution_date":"2024-08-31","id":"OUT123","is_withdrawal":true,"links":{"creditor":"CR123","customer":"CU123","outbound_payment_import":"IM123","recipient_bank_account":"BA123"},"metadata":{},"reference":"GC-QC2FI7GBEW7VCXL","scheme":"faster_payments","status":"cancelled","verifications":{"recipient_bank_account_holder_verification":{"actual_account_name":"Jo Doe","result":"partial_match","type":"confirmation_of_payee"}}}} }, "approve": { "method": "POST", "path_template": "/outbound_payments/:identity/actions/approve", "url_params": {"identity": "OUT123"}, - "body": {"outbound_payments":{"amount":1000,"created_at":"2024-01-01T12:00:00.000Z","currency":"GBP","description":"Reward Payment (August 2024)","execution_date":"2024-08-31","id":"OUT123","is_withdrawal":true,"links":{"creditor":"CR123","customer":"CU123","outbound_payment_import":"IM123","recipient_bank_account":"BA123"},"metadata":{},"reference":"GC-QC2FI7GBEW7VCXL","scheme":"faster_payments","status":"cancelled","verifications":{"recipient_bank_account_holder_verification":{"actual_account_name":"Jo Doe","result":"partial_match","type":"confirmation_of_payee"}}}} + "body": {"outbound_payments":{"amount":1000,"created_at":"2024-01-01T12:00:00.001Z","currency":"GBP","description":"Reward Payment (August 2024)","execution_date":"2024-08-31","id":"OUT123","is_withdrawal":true,"links":{"creditor":"CR123","customer":"CU123","outbound_payment_import":"IM123","recipient_bank_account":"BA123"},"metadata":{},"reference":"GC-QC2FI7GBEW7VCXL","scheme":"faster_payments","status":"cancelled","verifications":{"recipient_bank_account_holder_verification":{"actual_account_name":"Jo Doe","result":"partial_match","type":"confirmation_of_payee"}}}} }, "get": { "method": "GET", "path_template": "/outbound_payments/:identity", "url_params": {"identity": "OUT123"}, - "body": {"outbound_payments":{"amount":1000,"created_at":"2024-01-01T12:00:00.000Z","currency":"GBP","description":"Reward Payment (August 2024)","execution_date":"2024-08-31","id":"OUT123","is_withdrawal":true,"links":{"creditor":"CR123","customer":"CU123","outbound_payment_import":"IM123","recipient_bank_account":"BA123"},"metadata":{},"reference":"GC-QC2FI7GBEW7VCXL","scheme":"faster_payments","status":"cancelled","verifications":{"recipient_bank_account_holder_verification":{"actual_account_name":"Jo Doe","result":"partial_match","type":"confirmation_of_payee"}}}} + "body": {"outbound_payments":{"amount":1000,"created_at":"2024-01-01T12:00:00.001Z","currency":"GBP","description":"Reward Payment (August 2024)","execution_date":"2024-08-31","id":"OUT123","is_withdrawal":true,"links":{"creditor":"CR123","customer":"CU123","outbound_payment_import":"IM123","recipient_bank_account":"BA123"},"metadata":{},"reference":"GC-QC2FI7GBEW7VCXL","scheme":"faster_payments","status":"cancelled","verifications":{"recipient_bank_account_holder_verification":{"actual_account_name":"Jo Doe","result":"partial_match","type":"confirmation_of_payee"}}}} }, "list": { "method": "GET", "path_template": "/outbound_payments", "url_params": {}, - "body": {"meta":{"cursors":{"after":"example after 101","before":"example before 101"},"limit":50},"outbound_payments":[{"amount":1000,"created_at":"2024-01-01T12:00:00.000Z","currency":"GBP","description":"Reward Payment (August 2024)","execution_date":"2024-08-31","id":"OUT123","is_withdrawal":true,"links":{"creditor":"CR123","customer":"CU123","outbound_payment_import":"IM123","recipient_bank_account":"BA123"},"metadata":{},"reference":"GC-QC2FI7GBEW7VCXL","scheme":"faster_payments","status":"cancelled","verifications":{"recipient_bank_account_holder_verification":{"actual_account_name":"Jo Doe","result":"partial_match","type":"confirmation_of_payee"}}},{"amount":1000,"created_at":"2024-01-01T12:00:00.000Z","currency":"GBP","description":"Reward Payment (August 2024)","execution_date":"2024-08-31","id":"OUT123","is_withdrawal":true,"links":{"creditor":"CR123","customer":"CU123","outbound_payment_import":"IM123","recipient_bank_account":"BA123"},"metadata":{},"reference":"GC-QC2FI7GBEW7VCXL","scheme":"faster_payments","status":"cancelled","verifications":{"recipient_bank_account_holder_verification":{"actual_account_name":"Jo Doe","result":"partial_match","type":"confirmation_of_payee"}}}]} + "body": {"meta":{"cursors":{"after":"example after 101","before":"example before 101"},"limit":50},"outbound_payments":[{"amount":1000,"created_at":"2024-01-01T12:00:00.001Z","currency":"GBP","description":"Reward Payment (August 2024)","execution_date":"2024-08-31","id":"OUT123","is_withdrawal":true,"links":{"creditor":"CR123","customer":"CU123","outbound_payment_import":"IM123","recipient_bank_account":"BA123"},"metadata":{},"reference":"GC-QC2FI7GBEW7VCXL","scheme":"faster_payments","status":"cancelled","verifications":{"recipient_bank_account_holder_verification":{"actual_account_name":"Jo Doe","result":"partial_match","type":"confirmation_of_payee"}}},{"amount":1000,"created_at":"2024-01-01T12:00:00.001Z","currency":"GBP","description":"Reward Payment (August 2024)","execution_date":"2024-08-31","id":"OUT123","is_withdrawal":true,"links":{"creditor":"CR123","customer":"CU123","outbound_payment_import":"IM123","recipient_bank_account":"BA123"},"metadata":{},"reference":"GC-QC2FI7GBEW7VCXL","scheme":"faster_payments","status":"cancelled","verifications":{"recipient_bank_account_holder_verification":{"actual_account_name":"Jo Doe","result":"partial_match","type":"confirmation_of_payee"}}}]} }, "update": { "method": "PUT", "path_template": "/outbound_payments/:identity", "url_params": {"identity": "OUT123"}, - "body": {"outbound_payments":{"amount":1000,"created_at":"2024-01-01T12:00:00.000Z","currency":"GBP","description":"Reward Payment (August 2024)","execution_date":"2024-08-31","id":"OUT123","is_withdrawal":true,"links":{"creditor":"CR123","customer":"CU123","outbound_payment_import":"IM123","recipient_bank_account":"BA123"},"metadata":{},"reference":"GC-QC2FI7GBEW7VCXL","scheme":"faster_payments","status":"cancelled","verifications":{"recipient_bank_account_holder_verification":{"actual_account_name":"Jo Doe","result":"partial_match","type":"confirmation_of_payee"}}}} + "body": {"outbound_payments":{"amount":1000,"created_at":"2024-01-01T12:00:00.001Z","currency":"GBP","description":"Reward Payment (August 2024)","execution_date":"2024-08-31","id":"OUT123","is_withdrawal":true,"links":{"creditor":"CR123","customer":"CU123","outbound_payment_import":"IM123","recipient_bank_account":"BA123"},"metadata":{},"reference":"GC-QC2FI7GBEW7VCXL","scheme":"faster_payments","status":"cancelled","verifications":{"recipient_bank_account_holder_verification":{"actual_account_name":"Jo Doe","result":"partial_match","type":"confirmation_of_payee"}}}} }, "stats": { "method": "GET", From a3adb6821201aaa3d088783b748ebe3e0a06a7cf Mon Sep 17 00:00:00 2001 From: "gocardless-ci-robot[bot]" <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> Date: Wed, 20 May 2026 16:43:14 +0000 Subject: [PATCH 08/10] Changes generated by 072c0250a5cabd3578679c838c7bf8d678094c03 This commit was automatically created from gocardless/client-library-templates@072c0250a5cabd3578679c838c7bf8d678094c03 by the `push-files` action. Workflow run: https://github.com/gocardless/client-library-templates/actions/runs/26176239683 --- tests/CodeSamples/BalancesCodeSamplesTest.php | 72 +++++ .../BankAccountDetailsCodeSamplesTest.php | 70 +++++ ...ountHolderVerificationsCodeSamplesTest.php | 98 ++++++ .../BankAuthorisationsCodeSamplesTest.php | 98 ++++++ .../BankDetailsLookupsCodeSamplesTest.php | 72 +++++ .../BillingRequestFlowsCodeSamplesTest.php | 104 +++++++ ...BillingRequestTemplatesCodeSamplesTest.php | 152 ++++++++++ ...llingRequestWithActionsCodeSamplesTest.php | 43 +++ .../BillingRequestsCodeSamplesTest.php | 286 ++++++++++++++++++ tests/CodeSamples/BlocksCodeSamplesTest.php | 198 ++++++++++++ .../CreditorBankAccountsCodeSamplesTest.php | 147 +++++++++ .../CodeSamples/CreditorsCodeSamplesTest.php | 148 +++++++++ .../CurrencyExchangeRatesCodeSamplesTest.php | 70 +++++ .../CustomerBankAccountsCodeSamplesTest.php | 173 +++++++++++ .../CustomerNotificationsCodeSamplesTest.php | 68 +++++ .../CodeSamples/CustomersCodeSamplesTest.php | 171 +++++++++++ tests/CodeSamples/EventsCodeSamplesTest.php | 95 ++++++ tests/CodeSamples/ExportsCodeSamplesTest.php | 91 ++++++ .../FundsAvailabilitiesCodeSamplesTest.php | 70 +++++ .../InstalmentSchedulesCodeSamplesTest.php | 243 +++++++++++++++ .../InstitutionsCodeSamplesTest.php | 95 ++++++ tests/CodeSamples/LogosCodeSamplesTest.php | 75 +++++ .../MandateImportEntriesCodeSamplesTest.php | 113 +++++++ .../MandateImportsCodeSamplesTest.php | 139 +++++++++ .../MandatePdfsCodeSamplesTest.php | 81 +++++ tests/CodeSamples/MandatesCodeSamplesTest.php | 193 ++++++++++++ .../NegativeBalanceLimitsCodeSamplesTest.php | 73 +++++ ...undPaymentImportEntriesCodeSamplesTest.php | 73 +++++ .../OutboundPaymentImportsCodeSamplesTest.php | 139 +++++++++ .../OutboundPaymentsCodeSamplesTest.php | 257 ++++++++++++++++ .../PayerAuthorisationsCodeSamplesTest.php | 196 ++++++++++++ .../PayerThemesCodeSamplesTest.php | 78 +++++ ...mentAccountTransactionsCodeSamplesTest.php | 96 ++++++ .../PaymentAccountsCodeSamplesTest.php | 43 +++ tests/CodeSamples/PaymentsCodeSamplesTest.php | 198 ++++++++++++ .../PayoutItemsCodeSamplesTest.php | 70 +++++ tests/CodeSamples/PayoutsCodeSamplesTest.php | 120 ++++++++ .../RedirectFlowsCodeSamplesTest.php | 125 ++++++++ tests/CodeSamples/RefundsCodeSamplesTest.php | 149 +++++++++ .../ScenarioSimulatorsCodeSamplesTest.php | 70 +++++ .../SchemeIdentifiersCodeSamplesTest.php | 119 ++++++++ .../SubscriptionsCodeSamplesTest.php | 221 ++++++++++++++ tests/CodeSamples/TaxRatesCodeSamplesTest.php | 93 ++++++ .../TransferredMandatesCodeSamplesTest.php | 68 +++++ .../VerificationDetailsCodeSamplesTest.php | 116 +++++++ tests/CodeSamples/WebhooksCodeSamplesTest.php | 118 ++++++++ 46 files changed, 5587 insertions(+) create mode 100644 tests/CodeSamples/BalancesCodeSamplesTest.php create mode 100644 tests/CodeSamples/BankAccountDetailsCodeSamplesTest.php create mode 100644 tests/CodeSamples/BankAccountHolderVerificationsCodeSamplesTest.php create mode 100644 tests/CodeSamples/BankAuthorisationsCodeSamplesTest.php create mode 100644 tests/CodeSamples/BankDetailsLookupsCodeSamplesTest.php create mode 100644 tests/CodeSamples/BillingRequestFlowsCodeSamplesTest.php create mode 100644 tests/CodeSamples/BillingRequestTemplatesCodeSamplesTest.php create mode 100644 tests/CodeSamples/BillingRequestWithActionsCodeSamplesTest.php create mode 100644 tests/CodeSamples/BillingRequestsCodeSamplesTest.php create mode 100644 tests/CodeSamples/BlocksCodeSamplesTest.php create mode 100644 tests/CodeSamples/CreditorBankAccountsCodeSamplesTest.php create mode 100644 tests/CodeSamples/CreditorsCodeSamplesTest.php create mode 100644 tests/CodeSamples/CurrencyExchangeRatesCodeSamplesTest.php create mode 100644 tests/CodeSamples/CustomerBankAccountsCodeSamplesTest.php create mode 100644 tests/CodeSamples/CustomerNotificationsCodeSamplesTest.php create mode 100644 tests/CodeSamples/CustomersCodeSamplesTest.php create mode 100644 tests/CodeSamples/EventsCodeSamplesTest.php create mode 100644 tests/CodeSamples/ExportsCodeSamplesTest.php create mode 100644 tests/CodeSamples/FundsAvailabilitiesCodeSamplesTest.php create mode 100644 tests/CodeSamples/InstalmentSchedulesCodeSamplesTest.php create mode 100644 tests/CodeSamples/InstitutionsCodeSamplesTest.php create mode 100644 tests/CodeSamples/LogosCodeSamplesTest.php create mode 100644 tests/CodeSamples/MandateImportEntriesCodeSamplesTest.php create mode 100644 tests/CodeSamples/MandateImportsCodeSamplesTest.php create mode 100644 tests/CodeSamples/MandatePdfsCodeSamplesTest.php create mode 100644 tests/CodeSamples/MandatesCodeSamplesTest.php create mode 100644 tests/CodeSamples/NegativeBalanceLimitsCodeSamplesTest.php create mode 100644 tests/CodeSamples/OutboundPaymentImportEntriesCodeSamplesTest.php create mode 100644 tests/CodeSamples/OutboundPaymentImportsCodeSamplesTest.php create mode 100644 tests/CodeSamples/OutboundPaymentsCodeSamplesTest.php create mode 100644 tests/CodeSamples/PayerAuthorisationsCodeSamplesTest.php create mode 100644 tests/CodeSamples/PayerThemesCodeSamplesTest.php create mode 100644 tests/CodeSamples/PaymentAccountTransactionsCodeSamplesTest.php create mode 100644 tests/CodeSamples/PaymentAccountsCodeSamplesTest.php create mode 100644 tests/CodeSamples/PaymentsCodeSamplesTest.php create mode 100644 tests/CodeSamples/PayoutItemsCodeSamplesTest.php create mode 100644 tests/CodeSamples/PayoutsCodeSamplesTest.php create mode 100644 tests/CodeSamples/RedirectFlowsCodeSamplesTest.php create mode 100644 tests/CodeSamples/RefundsCodeSamplesTest.php create mode 100644 tests/CodeSamples/ScenarioSimulatorsCodeSamplesTest.php create mode 100644 tests/CodeSamples/SchemeIdentifiersCodeSamplesTest.php create mode 100644 tests/CodeSamples/SubscriptionsCodeSamplesTest.php create mode 100644 tests/CodeSamples/TaxRatesCodeSamplesTest.php create mode 100644 tests/CodeSamples/TransferredMandatesCodeSamplesTest.php create mode 100644 tests/CodeSamples/VerificationDetailsCodeSamplesTest.php create mode 100644 tests/CodeSamples/WebhooksCodeSamplesTest.php diff --git a/tests/CodeSamples/BalancesCodeSamplesTest.php b/tests/CodeSamples/BalancesCodeSamplesTest.php new file mode 100644 index 000000000..b047b7d78 --- /dev/null +++ b/tests/CodeSamples/BalancesCodeSamplesTest.php @@ -0,0 +1,72 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testListCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "balances": [{}], "meta": { "cursors": {}, "limit": 50 } }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->balances()->list([ + "params" => [ + "creditor" => "CR123", + ] + ]); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/BankAccountDetailsCodeSamplesTest.php b/tests/CodeSamples/BankAccountDetailsCodeSamplesTest.php new file mode 100644 index 000000000..875848a9f --- /dev/null +++ b/tests/CodeSamples/BankAccountDetailsCodeSamplesTest.php @@ -0,0 +1,70 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testGetCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "bank_account_details": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->bankAccountDetails()->get("BA123", [ + "headers" => ['Gc-Key-Id' => 'PK123'] + ]); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/BankAccountHolderVerificationsCodeSamplesTest.php b/tests/CodeSamples/BankAccountHolderVerificationsCodeSamplesTest.php new file mode 100644 index 000000000..baf57e19a --- /dev/null +++ b/tests/CodeSamples/BankAccountHolderVerificationsCodeSamplesTest.php @@ -0,0 +1,98 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testCreateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "bank_account_holder_verifications": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->bankAccountHolderVerifications()->create([ + "params" => [ + "type" => "confirmation_of_payee", + "links" => [ + "bank_account" => "BA123" + ] + ] + ]); + + ob_end_clean(); + } + + + + + public function testGetCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "bank_account_holder_verifications": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->bankAccountHolderVerifications()->get("BAHV123"); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/BankAuthorisationsCodeSamplesTest.php b/tests/CodeSamples/BankAuthorisationsCodeSamplesTest.php new file mode 100644 index 000000000..6bc0e7abc --- /dev/null +++ b/tests/CodeSamples/BankAuthorisationsCodeSamplesTest.php @@ -0,0 +1,98 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testCreateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "bank_authorisations": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->bankAuthorisations()->create([ + "params" => [ + "redirect_uri" => "https://my-company.com/landing", + "links" => [ + "billing_request" => "BRQ123" + ] + ] + ]); + + ob_end_clean(); + } + + + + + public function testGetCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "bank_authorisations": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->bankAuthorisations()->get("BAU123"); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/BankDetailsLookupsCodeSamplesTest.php b/tests/CodeSamples/BankDetailsLookupsCodeSamplesTest.php new file mode 100644 index 000000000..c219eafe3 --- /dev/null +++ b/tests/CodeSamples/BankDetailsLookupsCodeSamplesTest.php @@ -0,0 +1,72 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testCreateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "bank_details_lookups": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->bankDetailsLookups()->create([ + "params" => ["account_number" => "55779911", + "branch_code" => "200000", + "country_code" => "GB"] + ]); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/BillingRequestFlowsCodeSamplesTest.php b/tests/CodeSamples/BillingRequestFlowsCodeSamplesTest.php new file mode 100644 index 000000000..23b9f4bb4 --- /dev/null +++ b/tests/CodeSamples/BillingRequestFlowsCodeSamplesTest.php @@ -0,0 +1,104 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testCreateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "billing_request_flows": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->billingRequestFlows()->create([ + "params" => [ + "redirect_uri" => "https://my-company.com/landing", + "exit_uri" => "https://my-company.com/exit", + "prefilled_customer" => [ + "given_name" => "Frank", + "family_name" => "Osborne", + "email" => "frank.osborne@acmeplc.com" + ], + "links" => [ + "billing_request" => "BRQ123" + ] + ] + ]); + + ob_end_clean(); + } + + + + + public function testInitialiseCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "billing_request_flows": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->billingRequestFlows()->initialise("BRF123"); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/BillingRequestTemplatesCodeSamplesTest.php b/tests/CodeSamples/BillingRequestTemplatesCodeSamplesTest.php new file mode 100644 index 000000000..f2fe90937 --- /dev/null +++ b/tests/CodeSamples/BillingRequestTemplatesCodeSamplesTest.php @@ -0,0 +1,152 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testListCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "billing_request_templates": [{}], "meta": { "cursors": {}, "limit": 50 } }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->billingRequestTemplates()->list(); + + ob_end_clean(); + } + + + + + public function testGetCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "billing_request_templates": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->billingRequestTemplates()->get("BRT123"); + + ob_end_clean(); + } + + + + + public function testCreateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "billing_request_templates": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->billingRequestTemplates()->create([ + "params" => [ + "name" => "12 Month Gold Plan", + "payment_request_description" => "One-time joining fee", + "mandate_request_description" => "Recurring fee", + "payment_request_currency" => "GBP", + "payment_request_amount" => "69.99", + "mandate_request_currency" => "GBP", + "redirect_uri" => "https://my-company.com/landing", + ] + ]); + + ob_end_clean(); + } + + + + + public function testUpdateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "billing_request_templates": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->billingRequestTemplates()->update("BRT123", [ + "params" => [ + "name" => "12 Month Silver Plan", + "payment_request_amount" => "49.99" + ] + ]); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/BillingRequestWithActionsCodeSamplesTest.php b/tests/CodeSamples/BillingRequestWithActionsCodeSamplesTest.php new file mode 100644 index 000000000..4b214b618 --- /dev/null +++ b/tests/CodeSamples/BillingRequestWithActionsCodeSamplesTest.php @@ -0,0 +1,43 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } +} diff --git a/tests/CodeSamples/BillingRequestsCodeSamplesTest.php b/tests/CodeSamples/BillingRequestsCodeSamplesTest.php new file mode 100644 index 000000000..65d38f11e --- /dev/null +++ b/tests/CodeSamples/BillingRequestsCodeSamplesTest.php @@ -0,0 +1,286 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testCreateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "billing_requests": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->billingRequests()->create([ + "params" => [ + "payment_request" => [ + "description" => "First Payment", + "amount" => "500", + "currency" => "GBP", + ], + "mandate_request" => [ + "scheme" => "bacs" + ] + ] + ]); + + ob_end_clean(); + } + + + + + public function testCollectCustomerDetailsCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "billing_requests": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->billingRequests()->collectCustomerDetails("BR123", [ + "params" => [ + "customer" => [ + "email" => "alice@example.com", + "given_name" => "Alice", + "family_name" => "Smith" + ], + "customer_billing_detail" => [ + "address_line1" => "1 Somewhere Lane" + ] + ] + ]); + + ob_end_clean(); + } + + + + + public function testCollectBankAccountCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "billing_requests": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->billingRequests()->collectBankAccount("BR123", [ + "params" => [ + "account_number" => "55779911", + "branch_code" => "200000", + "account_holder_name" => "Frank Osborne", + "country_code" => "GB" + ] + ]); + + ob_end_clean(); + } + + + + + public function testConfirmPayerDetailsCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "billing_requests": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->billingRequests()->confirmPayerDetails("BR123"); + + ob_end_clean(); + } + + + + + public function testFulfilCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "billing_requests": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->billingRequests()->fulfil("BR123"); + + ob_end_clean(); + } + + + + + public function testCancelCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "billing_requests": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->billingRequests()->cancel("BR123"); + + ob_end_clean(); + } + + + + + public function testListCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "billing_requests": [{}], "meta": { "cursors": {}, "limit": 50 } }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->billingRequests()->list(); + + ob_end_clean(); + } + + + + + public function testGetCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "billing_requests": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->billingRequests()->get("BR123"); + + ob_end_clean(); + } + + + + + public function testNotifyCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "billing_requests": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->billingRequests()->notify("BR123", [ + "params" => [ + "notification_type" => "email", + "redirect_uri" => "https://my-company.com" + ] + ]); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/BlocksCodeSamplesTest.php b/tests/CodeSamples/BlocksCodeSamplesTest.php new file mode 100644 index 000000000..f6381a4dd --- /dev/null +++ b/tests/CodeSamples/BlocksCodeSamplesTest.php @@ -0,0 +1,198 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testCreateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "blocks": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $block = $client->blocks()->create([ + "params" => [ + "block_type" => "email", + "reason_type" => "no_intent_to_pay", + "resource_reference" => "example@example.com", + ] + ]); + + ob_end_clean(); + } + + + + + public function testGetCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "blocks": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $block = $client->blocks()->get("BLC456"); + + ob_end_clean(); + } + + + + + public function testListCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "blocks": [{}], "meta": { "cursors": {}, "limit": 50 } }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + foreach ($client->blocks()->all() as $record) { + echo $record->id; + echo $record->block_type; + } + + ob_end_clean(); + } + + + + + public function testDisableCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "blocks": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $block = $client->blocks()->disable("BLC123"); + + ob_end_clean(); + } + + + + + public function testEnableCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "blocks": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $block = $client->blocks()->enable("BLC123"); + + ob_end_clean(); + } + + + + + public function testBlockByRefCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "blocks": [{}], "meta": { "cursors": {}, "limit": 50 } }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $block = $client->blocks()->blockByRef([ + "params" => [ + "reference_type" => "customer", + "reference_value" => "CU123", + "reason_type" => "no_intent_to_pay", + ] + ]); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/CreditorBankAccountsCodeSamplesTest.php b/tests/CodeSamples/CreditorBankAccountsCodeSamplesTest.php new file mode 100644 index 000000000..4b175caf9 --- /dev/null +++ b/tests/CodeSamples/CreditorBankAccountsCodeSamplesTest.php @@ -0,0 +1,147 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testCreateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "creditor_bank_accounts": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->creditorBankAccounts()->create([ + "params" => ["account_number" => "55779911", + "branch_code" => "200000", + "country_code" => "GB", + "account_holder_name" => "Acme", + "links" => ["creditor" => "CR123"]] + ]); + + ob_end_clean(); + } + + + + + public function testListCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "creditor_bank_accounts": [{}], "meta": { "cursors": {}, "limit": 50 } }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->creditorBankAccounts()->list(); + + $client->creditorBankAccounts()->list([ + "params" => ["enabled" => true] + ]); + + ob_end_clean(); + } + + + + + public function testGetCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "creditor_bank_accounts": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->creditorBankAccounts()->get("BA123"); + + ob_end_clean(); + } + + + + + public function testDisableCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "creditor_bank_accounts": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->creditorBankAccounts()->disable("BA123"); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/CreditorsCodeSamplesTest.php b/tests/CodeSamples/CreditorsCodeSamplesTest.php new file mode 100644 index 000000000..2ddb2a824 --- /dev/null +++ b/tests/CodeSamples/CreditorsCodeSamplesTest.php @@ -0,0 +1,148 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testCreateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "creditors": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->creditors()->create([ + 'params' => ['name' => 'Acme', + 'country_code' => 'GB', + 'bank_reference_prefix' => 'ACME', + 'creditor_type' => 'company'] + ]); + + ob_end_clean(); + } + + + + + public function testListCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "creditors": [{}], "meta": { "cursors": {}, "limit": 50 } }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->creditors()->list(); + + $client->creditors()->list([ + 'params' => ['created_at[gt]' => '2014-05-08T17:01:06.000Z'] + ]); + + ob_end_clean(); + } + + + + + public function testGetCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "creditors": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->creditors()->get('CR123'); + + ob_end_clean(); + } + + + + + public function testUpdateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "creditors": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->creditors()->update('CR123', [ + 'params' => ['links' => ['default_gbp_payout_account' => 'BA789']] + ]); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/CurrencyExchangeRatesCodeSamplesTest.php b/tests/CodeSamples/CurrencyExchangeRatesCodeSamplesTest.php new file mode 100644 index 000000000..4bb2abcbc --- /dev/null +++ b/tests/CodeSamples/CurrencyExchangeRatesCodeSamplesTest.php @@ -0,0 +1,70 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testListCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "currency_exchange_rates": [{}], "meta": { "cursors": {}, "limit": 50 } }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->currencyExchangeRates()->list([ + "params" => ["source" => "EUR", "target" => "GBP"] + ]); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/CustomerBankAccountsCodeSamplesTest.php b/tests/CodeSamples/CustomerBankAccountsCodeSamplesTest.php new file mode 100644 index 000000000..217de1a5f --- /dev/null +++ b/tests/CodeSamples/CustomerBankAccountsCodeSamplesTest.php @@ -0,0 +1,173 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testCreateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "customer_bank_accounts": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->customerBankAccounts()->create([ + "params" => ["account_number" => "55779911", + "branch_code" => "200000", + "account_holder_name" => "Frank Osborne", + "country_code" => "GB", + "links" => ["customer" => "CU123"]] + ]); + + ob_end_clean(); + } + + + + + public function testListCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "customer_bank_accounts": [{}], "meta": { "cursors": {}, "limit": 50 } }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->customerBankAccounts()->list(); + + $client->customerBankAccounts()->list([ + "params" => ["customer" => "CU123", + "enabled" => true] + ]); + + ob_end_clean(); + } + + + + + public function testGetCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "customer_bank_accounts": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->customerBankAccounts()->get("BA123"); + + ob_end_clean(); + } + + + + + public function testUpdateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "customer_bank_accounts": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->customerBankAccounts()->update("BA123", [ + "params" => ["metadata" => ["key" => "value"]] + ]); + + ob_end_clean(); + } + + + + + public function testDisableCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "customer_bank_accounts": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->customerBankAccounts()->disable("BA123"); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/CustomerNotificationsCodeSamplesTest.php b/tests/CodeSamples/CustomerNotificationsCodeSamplesTest.php new file mode 100644 index 000000000..a37e9d96b --- /dev/null +++ b/tests/CodeSamples/CustomerNotificationsCodeSamplesTest.php @@ -0,0 +1,68 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testHandleCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "customer_notifications": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->customerNotifications()->handle("PCN123"); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/CustomersCodeSamplesTest.php b/tests/CodeSamples/CustomersCodeSamplesTest.php new file mode 100644 index 000000000..97110bfb4 --- /dev/null +++ b/tests/CodeSamples/CustomersCodeSamplesTest.php @@ -0,0 +1,171 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testCreateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "customers": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->customers()->create([ + "params" => ["email" => "tim@gocardless.com", + "given_name" => "Tim", + "family_name" => "Rogers", + "country_code" => "GB"] + ]); + + ob_end_clean(); + } + + + + + public function testListCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "customers": [{}], "meta": { "cursors": {}, "limit": 50 } }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->customers()->list(); + + $client->customers()->list([ + "params" => ["created_at[gt]" => "2015-11-03T09:30:00Z"] + ]); + + ob_end_clean(); + } + + + + + public function testGetCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "customers": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->customers()->get("CU123"); + + ob_end_clean(); + } + + + + + public function testUpdateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "customers": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->customers()->update("CU123", [ + "params" => ["email" => "tim@gocardless.com"] + ]); + + ob_end_clean(); + } + + + + + public function testRemoveCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "customers": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->customers()->remove("CU123"); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/EventsCodeSamplesTest.php b/tests/CodeSamples/EventsCodeSamplesTest.php new file mode 100644 index 000000000..0eb62a603 --- /dev/null +++ b/tests/CodeSamples/EventsCodeSamplesTest.php @@ -0,0 +1,95 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testListCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "events": [{}], "meta": { "cursors": {}, "limit": 50 } }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->events()->list(); + + $client->events()->list([ + "params" => ["resource_type" => "payments"] + ]); + + ob_end_clean(); + } + + + + + public function testGetCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "events": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->events()->get("EV123"); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/ExportsCodeSamplesTest.php b/tests/CodeSamples/ExportsCodeSamplesTest.php new file mode 100644 index 000000000..9c843875c --- /dev/null +++ b/tests/CodeSamples/ExportsCodeSamplesTest.php @@ -0,0 +1,91 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testGetCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "exports": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->exports()->get('EX123'); + + ob_end_clean(); + } + + + + + public function testListCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "exports": [{}], "meta": { "cursors": {}, "limit": 50 } }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->exports()->list(); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/FundsAvailabilitiesCodeSamplesTest.php b/tests/CodeSamples/FundsAvailabilitiesCodeSamplesTest.php new file mode 100644 index 000000000..ca3d11e40 --- /dev/null +++ b/tests/CodeSamples/FundsAvailabilitiesCodeSamplesTest.php @@ -0,0 +1,70 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testCheckCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "funds_availability": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->fundsAvailabilities()->check("MD123", [ + "params" => ["amount" => "1000"] + ]); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/InstalmentSchedulesCodeSamplesTest.php b/tests/CodeSamples/InstalmentSchedulesCodeSamplesTest.php new file mode 100644 index 000000000..dc2782c63 --- /dev/null +++ b/tests/CodeSamples/InstalmentSchedulesCodeSamplesTest.php @@ -0,0 +1,243 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testCreateWithDatesCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "instalment_schedules": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $instalment_schedule = $client->instalmentSchedules()->createWithDates([ + "params" => [ + "name" => "ACME Invoice 103", + "total_amount" => 10000, // 100 GBP in pence, collected from the customer + "app_fee" => 10, // Your 10 pence fee, applied to each instalment, + // to be paid out to you + "currency" => 'GBP', + "instalments" => [ + [ + "charge_date" => '2019-08-20', + "amount" => 3400 + ], + [ + "charge_date" => '2019-09-03', + "amount" => 3400 + ], + [ + "charge_date" => '2019-09-17', + "amount" => 3200 + ], + ], + "links" => [ + "mandate" => 'MD0000XH9A3T4C' + ], + "metadata" => [] + ], + "headers" => [ + 'Idempotency-Key' => 'random_instalment_schedule_specific_string' + ] + ]); + + ob_end_clean(); + } + + + + + public function testCreateWithScheduleCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "instalment_schedules": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $instalment_schedule = $client->instalmentSchedules()->createWithSchedule([ + "params" => [ + "name" => "ACME Invoice 103", + "total_amount" => 10000, // 100 GBP in pence, collected from the customer + "app_fee" => 10, // Your 10 pence fee, applied to each instalment, + // to be paid out to you + "currency" => "GBP", + "instalments" => [ + "start_date" => "2019-08-20", + "interval_unit" => "weekly", + "interval" => 2, + "amounts" => [ + 3400, + 3400, + 3200 + ] + ], + "links" => [ + "mandate" => "MD0000XH9A3T4C" + ], + "metadata" => [] + ], + "headers" => [ + "Idempotency-Key" => "random_instalment_schedule_specific_string" + ] + ]); + + ob_end_clean(); + } + + + + + public function testListCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "instalment_schedules": [{}], "meta": { "cursors": {}, "limit": 50 } }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->instalmentSchedules()->list(); + + $client->instalmentSchedules()->list([ + "params" => ["created_at[gt]" => "2015-11-03T09:30:00Z"] + ]); + + ob_end_clean(); + } + + + + + public function testGetCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "instalment_schedules": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->instalmentSchedules()->get("IS123"); + + ob_end_clean(); + } + + + + + public function testUpdateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "instalment_schedules": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->instalmentSchedules()->update("IS123", [ + "params" => ["metadata" => ["key" => "value"]] + ]); + + ob_end_clean(); + } + + + + + public function testCancelCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "instalment_schedules": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->instalmentSchedules()->cancel("IS123"); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/InstitutionsCodeSamplesTest.php b/tests/CodeSamples/InstitutionsCodeSamplesTest.php new file mode 100644 index 000000000..7d87d156a --- /dev/null +++ b/tests/CodeSamples/InstitutionsCodeSamplesTest.php @@ -0,0 +1,95 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testListCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "institutions": [{}], "meta": { "cursors": {}, "limit": 50 } }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->institutions()->list([ + "params" => ["country_code" => "GB"] + ]); + + ob_end_clean(); + } + + + + + public function testListForBillingRequestCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "institutions": [{}], "meta": { "cursors": {}, "limit": 50 } }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->institutions()->listForBillingRequest("BR123", [ + "params" => ["country_code" => "GB"] + ]); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/LogosCodeSamplesTest.php b/tests/CodeSamples/LogosCodeSamplesTest.php new file mode 100644 index 000000000..c58affc7d --- /dev/null +++ b/tests/CodeSamples/LogosCodeSamplesTest.php @@ -0,0 +1,75 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testCreateForCreditorCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "logos": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->logos()->createForCreditor([ + "params" => [ + "image" => "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAA", + "links" => [ + "creditor" => "CR123" + ] + ] + ]); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/MandateImportEntriesCodeSamplesTest.php b/tests/CodeSamples/MandateImportEntriesCodeSamplesTest.php new file mode 100644 index 000000000..794122c8f --- /dev/null +++ b/tests/CodeSamples/MandateImportEntriesCodeSamplesTest.php @@ -0,0 +1,113 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testCreateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "mandate_import_entries": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->mandateImportEntries()->create([ + "params" => [ + "links" => [ + "mandate_import" => "IM000010790WX1" + ], + "record_identifier" => "bank-file.xml/line-1", + "customer" => [ + "company_name" => "Jane's widgets", + "email" => "jane@janeswidgets.fr" + ], + "bank_account" => [ + "account_holder_name" => "Jane Doe", + "iban" => "FR14BARC20000055779911" + ], + "amendment" => [ + "original_mandate_reference" => "REFNMANDATE", + "original_creditor_id" => "FR123OTHERBANK", + "original_creditor_name" => "Existing DD Provider" + ] + ] + ]); + + ob_end_clean(); + } + + + + + public function testListCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "mandate_import_entries": [{}], "meta": { "cursors": {}, "limit": 50 } }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->mandateImportEntries()->all([ + "params" => ["mandate_import" => "IM000010790WX1"] + ]); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/MandateImportsCodeSamplesTest.php b/tests/CodeSamples/MandateImportsCodeSamplesTest.php new file mode 100644 index 000000000..445131428 --- /dev/null +++ b/tests/CodeSamples/MandateImportsCodeSamplesTest.php @@ -0,0 +1,139 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testCreateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "mandate_imports": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->mandateImports()->create([ + "params" => ["scheme" => "bacs"] + ]); + + ob_end_clean(); + } + + + + + public function testGetCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "mandate_imports": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->mandateImports()->get("IM123"); + + ob_end_clean(); + } + + + + + public function testSubmitCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "mandate_imports": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->mandateImports()->submit("IM123"); + + ob_end_clean(); + } + + + + + public function testCancelCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "mandate_imports": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->mandateImports()->cancel("IM123"); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/MandatePdfsCodeSamplesTest.php b/tests/CodeSamples/MandatePdfsCodeSamplesTest.php new file mode 100644 index 000000000..c035d236d --- /dev/null +++ b/tests/CodeSamples/MandatePdfsCodeSamplesTest.php @@ -0,0 +1,81 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testCreateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "mandate_pdfs": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->mandatePdfs()->create([ + "params" => ["links" => ["mandate" => "MD123"]] + ]); + + $client->mandatePdfs()->create([ + "params" => ["account_number" => "44779911", + "branch_code" => "200000", + "country_code" => "GB"] + ]); + + $client->mandatePdfs()->create([ + "params" => ["iban" => "FR14BARC20000055779911"], + "headers" => ['accept-language' => 'fr'] + ]); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/MandatesCodeSamplesTest.php b/tests/CodeSamples/MandatesCodeSamplesTest.php new file mode 100644 index 000000000..56f52a813 --- /dev/null +++ b/tests/CodeSamples/MandatesCodeSamplesTest.php @@ -0,0 +1,193 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testCreateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "mandates": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->mandates()->create([ + "params" => ["scheme" => "bacs", + "metadata" => ["contract" => "ABCD1234"], + "links" => ["customer_bank_account" => "BA123"]] + ]); + + ob_end_clean(); + } + + + + + public function testListCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "mandates": [{}], "meta": { "cursors": {}, "limit": 50 } }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->mandates()->list(); + + $client->mandates()->list([ + "params" => ["customer" => "CU123"] + ]); + + ob_end_clean(); + } + + + + + public function testGetCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "mandates": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->mandates()->get("MD123"); + + ob_end_clean(); + } + + + + + public function testUpdateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "mandates": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->mandates()->update("MD123", [ + "params" => ["metadata" => ["key" => "value"]] + ]); + + ob_end_clean(); + } + + + + + public function testCancelCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "mandates": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->mandates()->cancel("MD123"); + + ob_end_clean(); + } + + + + + public function testReinstateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "mandates": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->mandates()->reinstate("MD123"); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/NegativeBalanceLimitsCodeSamplesTest.php b/tests/CodeSamples/NegativeBalanceLimitsCodeSamplesTest.php new file mode 100644 index 000000000..803533cab --- /dev/null +++ b/tests/CodeSamples/NegativeBalanceLimitsCodeSamplesTest.php @@ -0,0 +1,73 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testListCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "negative_balance_limits": [{}], "meta": { "cursors": {}, "limit": 50 } }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->negativeBalanceLimits()->list([ + "params" => [ + "currency" => "GBP", + "creditor" => "CR123", + ] + ]); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/OutboundPaymentImportEntriesCodeSamplesTest.php b/tests/CodeSamples/OutboundPaymentImportEntriesCodeSamplesTest.php new file mode 100644 index 000000000..b3bf6f856 --- /dev/null +++ b/tests/CodeSamples/OutboundPaymentImportEntriesCodeSamplesTest.php @@ -0,0 +1,73 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testListCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "outbound_payment_import_entries": [{}], "meta": { "cursors": {}, "limit": 50 } }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->outboundPaymentImportEntries()->list([ + "params" => [ + "outbound_payment_import" => "IM123", + "limit" => 10 + ] + ]); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/OutboundPaymentImportsCodeSamplesTest.php b/tests/CodeSamples/OutboundPaymentImportsCodeSamplesTest.php new file mode 100644 index 000000000..78b5102b8 --- /dev/null +++ b/tests/CodeSamples/OutboundPaymentImportsCodeSamplesTest.php @@ -0,0 +1,139 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testCreateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "outbound_payment_imports": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->outboundPaymentImports()->create([ + "params" => [ + "entry_items" => [ + [ + "amount" => 1000, + "scheme" => "faster_payments", + "reference" => "Invoice 123", + "recipient_bank_account_id" => "BA123" + ], + [ + "amount" => 2000, + "scheme" => "faster_payments", + "reference" => "Invoice 124", + "recipient_bank_account_id" => "BA456", + "metadata" => [ + "order_id" => "ORD-789" + ] + ] + ], + "links" => [ + "creditor" => "CR123" + ] + ] + ]); + + ob_end_clean(); + } + + + + + public function testGetCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "outbound_payment_imports": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->outboundPaymentImports()->get("IM123"); + + ob_end_clean(); + } + + + + + public function testListCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "outbound_payment_imports": [{}], "meta": { "cursors": {}, "limit": 50 } }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->outboundPaymentImports()->list([ + "params" => ["limit" => 10] + ]); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/OutboundPaymentsCodeSamplesTest.php b/tests/CodeSamples/OutboundPaymentsCodeSamplesTest.php new file mode 100644 index 000000000..8c3151908 --- /dev/null +++ b/tests/CodeSamples/OutboundPaymentsCodeSamplesTest.php @@ -0,0 +1,257 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testCreateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "outbound_payments": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->outboundPayments()->create([ + "params" => [ + "amount" => 1000, + "scheme" => "faster_payments", + "description" => "Reward Payment (August 2024)", + "reference" => "Invoice 123", + "links" => [ + "creditor" => "CR123", + "recipient_bank_account" => "BA123" + ] + ] + ]); + + ob_end_clean(); + } + + + + + public function testWithdrawCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "outbound_payments": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->outboundPayments()->withdraw([ + "params" => [ + "amount" => 5000, + "scheme" => "faster_payments", + "description" => "Withdraw funds to business account", + "links" => [ + "creditor" => "CR123" + ] + ] + ]); + + ob_end_clean(); + } + + + + + public function testCancelCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "outbound_payments": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->outboundPayments()->cancel("OUT123"); + + ob_end_clean(); + } + + + + + public function testApproveCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "outbound_payments": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->outboundPayments()->approve("OUT123"); + + ob_end_clean(); + } + + + + + public function testGetCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "outbound_payments": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->outboundPayments()->get("OUT123"); + + ob_end_clean(); + } + + + + + public function testListCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "outbound_payments": [{}], "meta": { "cursors": {}, "limit": 50 } }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->outboundPayments()->list([ + "params" => ["limit" => 10] + ]); + + ob_end_clean(); + } + + + + + public function testUpdateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "outbound_payments": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->outboundPayments()->update("OUT123", [ + "params" => [ + "metadata" => [ + "invoice_id" => "INV-1234" + ] + ] + ]); + + ob_end_clean(); + } + + + + + public function testStatsCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "outbound_payments": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->outboundPayments()->stats(); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/PayerAuthorisationsCodeSamplesTest.php b/tests/CodeSamples/PayerAuthorisationsCodeSamplesTest.php new file mode 100644 index 000000000..ffd322dc5 --- /dev/null +++ b/tests/CodeSamples/PayerAuthorisationsCodeSamplesTest.php @@ -0,0 +1,196 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testGetCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "payer_authorisations": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->payerAuthorisations()->get("PAU123"); + + ob_end_clean(); + } + + + + + public function testCreateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "payer_authorisations": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->payerAuthorisations()->create([ + "params" => ["customer" => [ + "email" => "mail@example.com", + "given_name" => "Name", + "family_name" => "Surname", + "metadata" => [ + "salesforce_id" => "EFGH5678" + ] + ], + "bank_account" => [ + "account_holder_name" => "Name Surname", + "branch_code" => "200000", + "account_number" => "55779911", + "metadata" => [] + ], + "mandate" => [ + "reference" => "XYZ789", + "metadata" => [] + ]] + ]); + + ob_end_clean(); + } + + + + + public function testUpdateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "payer_authorisations": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->payerAuthorisations()->update("PA123", [ + "params" => ["customer" => [ + "email" => "mail@example.com", + "given_name" => "Name", + "family_name" => "Surname", + "metadata" => [ + "salesforce_id" => "EFGH5678" + ] + ], + "bank_account" => [ + "account_holder_name" => "Name Surname", + "branch_code" => "200000", + "account_number" => "55779911", + ], + "mandate" => [ + "reference" => "XYZ789", + ]] + ]); + + ob_end_clean(); + } + + + + + public function testSubmitCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "payer_authorisations": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->payerAuthorisations()->submit("PAU123"); + + ob_end_clean(); + } + + + + + public function testConfirmCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "payer_authorisations": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->payerAuthorisations()->confirm("PAU123"); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/PayerThemesCodeSamplesTest.php b/tests/CodeSamples/PayerThemesCodeSamplesTest.php new file mode 100644 index 000000000..d906bc684 --- /dev/null +++ b/tests/CodeSamples/PayerThemesCodeSamplesTest.php @@ -0,0 +1,78 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testCreateForCreditorCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "payer_themes": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->payerThemes()->createForCreditor([ + "params" => [ + "header_background_colour" => "#BD10E0", + "link_text_colour" => "#7ED321", + "button_background_colour" => "#128DAA", + "content_box_border_colour" => "#BD10E0", + "links" => [ + "creditor" => "CR123" + ] + ] + ]); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/PaymentAccountTransactionsCodeSamplesTest.php b/tests/CodeSamples/PaymentAccountTransactionsCodeSamplesTest.php new file mode 100644 index 000000000..5ac297bd8 --- /dev/null +++ b/tests/CodeSamples/PaymentAccountTransactionsCodeSamplesTest.php @@ -0,0 +1,96 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testGetCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "payment_account_transactions": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->paymentAccountTransactions()->get("PATR1234"); + + ob_end_clean(); + } + + + + + public function testListCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "payment_account_transactions": [{}], "meta": { "cursors": {}, "limit": 50 } }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->paymentAccountTransactions()->list("BA12345", [ + "params" => [ + "value_date_from" => "2024-01-01", + "value_date_to" => "2024-01-31" + ] + ]); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/PaymentAccountsCodeSamplesTest.php b/tests/CodeSamples/PaymentAccountsCodeSamplesTest.php new file mode 100644 index 000000000..9420d2742 --- /dev/null +++ b/tests/CodeSamples/PaymentAccountsCodeSamplesTest.php @@ -0,0 +1,43 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } +} diff --git a/tests/CodeSamples/PaymentsCodeSamplesTest.php b/tests/CodeSamples/PaymentsCodeSamplesTest.php new file mode 100644 index 000000000..7e588d3a8 --- /dev/null +++ b/tests/CodeSamples/PaymentsCodeSamplesTest.php @@ -0,0 +1,198 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testCreateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "payments": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->payments()->create([ + "params" => ["amount" => 100, + "currency" => "GBP", + "metadata" => [ + "order_dispatch_date" => "2016-08-04" + ], + "links" => [ + "mandate" => "MD123" + ]] + ]); + + ob_end_clean(); + } + + + + + public function testListCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "payments": [{}], "meta": { "cursors": {}, "limit": 50 } }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->payments()->list(); + + $client->payments()->list([ + "params" => ["customer" => "CU123"] + ]); + + ob_end_clean(); + } + + + + + public function testGetCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "payments": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->payments()->get("PM123"); + + ob_end_clean(); + } + + + + + public function testUpdateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "payments": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->payments()->update("PM123", [ + "params" => ["metadata" => ["internal_id" => "XX123"]] + ]); + + ob_end_clean(); + } + + + + + public function testCancelCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "payments": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->payments()->cancel("PM123"); + + ob_end_clean(); + } + + + + + public function testRetryCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "payments": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->payments()->retry("PM123"); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/PayoutItemsCodeSamplesTest.php b/tests/CodeSamples/PayoutItemsCodeSamplesTest.php new file mode 100644 index 000000000..01401eb9c --- /dev/null +++ b/tests/CodeSamples/PayoutItemsCodeSamplesTest.php @@ -0,0 +1,70 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testListCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "payout_items": [{}], "meta": { "cursors": {}, "limit": 50 } }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->payoutItems()->list([ + 'params' => ['payout' => 'PO123'] + ]); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/PayoutsCodeSamplesTest.php b/tests/CodeSamples/PayoutsCodeSamplesTest.php new file mode 100644 index 000000000..11974df35 --- /dev/null +++ b/tests/CodeSamples/PayoutsCodeSamplesTest.php @@ -0,0 +1,120 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testListCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "payouts": [{}], "meta": { "cursors": {}, "limit": 50 } }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->payouts()->list(); + + $client->payouts()->list([ + "params" => ["creditor" => "CR123"] + ]); + + ob_end_clean(); + } + + + + + public function testGetCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "payouts": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->payouts()->get("PO123"); + + ob_end_clean(); + } + + + + + public function testUpdateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "payouts": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->payouts()->update("PO123", [ + "params" => ["metadata" => ["key" => "value"]] + ]); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/RedirectFlowsCodeSamplesTest.php b/tests/CodeSamples/RedirectFlowsCodeSamplesTest.php new file mode 100644 index 000000000..ebf84d8f0 --- /dev/null +++ b/tests/CodeSamples/RedirectFlowsCodeSamplesTest.php @@ -0,0 +1,125 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testCreateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "redirect_flows": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->redirectFlows()->create([ + "params" => ["description" => "Wine boxes", + "session_token" => "SESS_wSs0uGYMISxzqOBq", + "success_redirect_url" => "https://example.com/pay/confirm", + "prefilled_customer" => [ + "given_name" => "Frank", + "family_name" => "Osborne", + "email" => "frank.osborne@acmeplc.com" + ]] + ]); + + ob_end_clean(); + } + + + + + public function testGetCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "redirect_flows": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->redirectFlows()->get("RE123"); + + ob_end_clean(); + } + + + + + public function testCompleteCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "redirect_flows": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->redirectFlows()->complete("RE123", [ + "params" => ["session_token" => "SESS_wSs0uGYMISxzqOBq"] + ]); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/RefundsCodeSamplesTest.php b/tests/CodeSamples/RefundsCodeSamplesTest.php new file mode 100644 index 000000000..dc9659a7e --- /dev/null +++ b/tests/CodeSamples/RefundsCodeSamplesTest.php @@ -0,0 +1,149 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testCreateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "refunds": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->refunds()->create([ + "params" => ["amount" => 100, + "total_amount_confirmation" => 150, + "reference" => "Acme refund", + "metadata" => ["reason" => "Late delivery"], + "links" => ["payment" => "PM123"]] + ]); + + ob_end_clean(); + } + + + + + public function testListCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "refunds": [{}], "meta": { "cursors": {}, "limit": 50 } }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->refunds()->list(); + + $client->refunds()->list([ + "params" => ["payment" => "PM123"] + ]); + + ob_end_clean(); + } + + + + + public function testGetCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "refunds": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->refunds()->get("RF123"); + + ob_end_clean(); + } + + + + + public function testUpdateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "refunds": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->refunds()->update("RF123", [ + "params" => ["metadata" => ["key" => "value"]] + ]); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/ScenarioSimulatorsCodeSamplesTest.php b/tests/CodeSamples/ScenarioSimulatorsCodeSamplesTest.php new file mode 100644 index 000000000..fc9496eb9 --- /dev/null +++ b/tests/CodeSamples/ScenarioSimulatorsCodeSamplesTest.php @@ -0,0 +1,70 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testRunCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "scenario_simulators": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->scenarioSimulators()->run("payment_failed", [ + "params" => ["links" => ["resource" => "PM123"]] + ]); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/SchemeIdentifiersCodeSamplesTest.php b/tests/CodeSamples/SchemeIdentifiersCodeSamplesTest.php new file mode 100644 index 000000000..2a3d9bce9 --- /dev/null +++ b/tests/CodeSamples/SchemeIdentifiersCodeSamplesTest.php @@ -0,0 +1,119 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testCreateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "scheme_identifiers": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->schemeIdentifiers()->create([ + 'params' => ['scheme' => 'bacs', + 'name' => 'Example Ltd', + 'links' => ['creditor' => 'CR123'] + ] + ]); + + ob_end_clean(); + } + + + + + public function testListCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "scheme_identifiers": [{}], "meta": { "cursors": {}, "limit": 50 } }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->schemeIdentifiers()->list()->records; + + ob_end_clean(); + } + + + + + public function testGetCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "scheme_identifiers": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->schemeIdentifiers()->get('SU123'); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/SubscriptionsCodeSamplesTest.php b/tests/CodeSamples/SubscriptionsCodeSamplesTest.php new file mode 100644 index 000000000..da504ff5b --- /dev/null +++ b/tests/CodeSamples/SubscriptionsCodeSamplesTest.php @@ -0,0 +1,221 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testCreateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "subscriptions": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->subscriptions()->create([ + "params" => ["amount" => 2500, + "currency" => "GBP", + "name" => "Monthly Magazine", + "interval_unit" => "monthly", + "day_of_month" => 1, + "metadata" => ["order_no" => "ABCD1234"], + "links" => ["mandate" => "MA123"]] + ]); + + ob_end_clean(); + } + + + + + public function testListCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "subscriptions": [{}], "meta": { "cursors": {}, "limit": 50 } }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->subscriptions()->list(); + + $client->subscriptions()->list([ + "params" => ["customer" => "CU123"] + ]); + + ob_end_clean(); + } + + + + + public function testGetCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "subscriptions": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->subscriptions()->get("SB123"); + + ob_end_clean(); + } + + + + + public function testUpdateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "subscriptions": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->subscriptions()->update("SB123", [ + "params" => ["name" => "New name", + "metadata" => ["order_no" => "ABCD4321"]] + ]); + + ob_end_clean(); + } + + + + + public function testPauseCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "subscriptions": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->subscriptions()->pause("SB123"); + + ob_end_clean(); + } + + + + + public function testResumeCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "subscriptions": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->subscriptions()->resume("SB123"); + + ob_end_clean(); + } + + + + + public function testCancelCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "subscriptions": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->subscriptions()->cancel("SB123"); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/TaxRatesCodeSamplesTest.php b/tests/CodeSamples/TaxRatesCodeSamplesTest.php new file mode 100644 index 000000000..1411c7899 --- /dev/null +++ b/tests/CodeSamples/TaxRatesCodeSamplesTest.php @@ -0,0 +1,93 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testListCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "tax_rates": [{}], "meta": { "cursors": {}, "limit": 50 } }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->taxRates()->list([ + "params" => ["jurisdiction" => "GB"] + ]); + + ob_end_clean(); + } + + + + + public function testGetCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "tax_rates": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->taxRates()->get("GB_VAT_1"); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/TransferredMandatesCodeSamplesTest.php b/tests/CodeSamples/TransferredMandatesCodeSamplesTest.php new file mode 100644 index 000000000..ac3816614 --- /dev/null +++ b/tests/CodeSamples/TransferredMandatesCodeSamplesTest.php @@ -0,0 +1,68 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testTransferredMandatesCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "transferred_mandates": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->transferredMandates()->transferredMandates("MD123"); + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/VerificationDetailsCodeSamplesTest.php b/tests/CodeSamples/VerificationDetailsCodeSamplesTest.php new file mode 100644 index 000000000..5a9545f16 --- /dev/null +++ b/tests/CodeSamples/VerificationDetailsCodeSamplesTest.php @@ -0,0 +1,116 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testCreateCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "verification_details": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $verification_details = $client->verificationDetails()->create([ + 'params' => [ + 'name' => 'Acme', + 'company_number' => '03768189', + 'address_line1' => '12 Drury lane', + 'city' => 'London', + 'description' => 'wine and cheese seller', + 'postal_code' => 'B4 7NJ', + 'directors' => [[ + 'given_name' => 'Gandalf', + 'family_name' => 'Grey', + 'city' => 'London', + 'date_of_birth' => '1986-02-19', + 'street' => 'Drury lane', + 'postal_code' => 'B4 7NJ', + 'country_code' => 'GB' + ]], + 'links' => [ + 'creditor' => 'CR123' + ] + ] + ]); + + ob_end_clean(); + } + + + + + public function testListCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "verification_details": [{}], "meta": { "cursors": {}, "limit": 50 } }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $response = $client->verificationDetails()->list([ + 'params' => [ + 'creditor' => 'CR123' + ] + ])->records; + + ob_end_clean(); + } +} diff --git a/tests/CodeSamples/WebhooksCodeSamplesTest.php b/tests/CodeSamples/WebhooksCodeSamplesTest.php new file mode 100644 index 000000000..6209e2a0a --- /dev/null +++ b/tests/CodeSamples/WebhooksCodeSamplesTest.php @@ -0,0 +1,118 @@ +mock = new \GuzzleHttp\Handler\MockHandler([]); + $handler = \GuzzleHttp\HandlerStack::create($this->mock); + + $mock_http_client = new \GuzzleHttp\Client([ + 'handler' => $handler, + 'http_errors' => false + ]); + $this->client = new \GoCardlessPro\Client( + array( + 'access_token' => 'SECRET_TOKEN', + 'environment' => Environment::LIVE, + 'http_client' => $mock_http_client + ) + ); + } + + + + + + + public function testListCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "webhooks": [{}], "meta": { "cursors": {}, "limit": 50 } }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->webhooks()->list(); + + $client->webhooks()->list([ + "params" => ["successful" => true] + ]); + + ob_end_clean(); + } + + + + + public function testGetCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "webhooks": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->webhooks()->get("WB123"); + + ob_end_clean(); + } + + + + + public function testRetryCodeSample() + { + $this->expectNotToPerformAssertions(); + + // Mock response - enqueue multiple times to handle code samples with multiple API calls + $responseBody = '{ "webhooks": {} }'; + for ($i = 0; $i < 5; $i++) { + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $responseBody)); + } + + // Suppress output from code samples + ob_start(); + + $client = $this->client; + + $client->webhooks()->retry("WB123"); + + ob_end_clean(); + } +} From 92ae34c8cfd6d9e0523604628d796144ad03c9ef Mon Sep 17 00:00:00 2001 From: "gocardless-ci-robot[bot]" <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> Date: Thu, 21 May 2026 14:27:03 +0000 Subject: [PATCH 09/10] Changes generated by bf5abdca6f98fa1650947e8c026d66fe23221d21 This commit was automatically created from gocardless/client-library-templates@bf5abdca6f98fa1650947e8c026d66fe23221d21 by the `push-files` action. Workflow run: https://github.com/gocardless/client-library-templates/actions/runs/26232153078 --- README.md | 12 ++++++++++ lib/Webhook.php | 29 ++++++++++++++++++++++++ lib/WebhookParseResult.php | 46 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 lib/WebhookParseResult.php diff --git a/README.md b/README.md index 3cb9fb464..8a6dff23a 100644 --- a/README.md +++ b/README.md @@ -236,6 +236,18 @@ try { } ``` +#### Accessing the webhook ID + +If you need to access the webhook ID for debugging purposes, you can use `Webhook::parseWithMeta` instead: + +```php +$result = GoCardlessPro\Webhook::parseWithMeta($request_body, $signature_header, $webhook_endpoint_secret); +$events = $result->getEvents(); +$webhookId = $result->getWebhookId(); // e.g. "WB123" - useful for debugging +``` + +Note: The webhook ID is intended for debugging and logging purposes only. It should not be used for deduplication - instead, use the event IDs to deduplicate, as each event has a unique ID that remains consistent if the same event is sent multiple times. + For more details on working with webhooks, see our ["Getting started" guide](https://developer.gocardless.com/getting-started/api/introduction/?lang=php). ## Supporting PHP >= 8.1 diff --git a/lib/Webhook.php b/lib/Webhook.php index f6b6d3f28..f8d682e80 100644 --- a/lib/Webhook.php +++ b/lib/Webhook.php @@ -38,6 +38,35 @@ public static function parse($request_body, $signature_header, $webhook_endpoint } } + /** + * Validates that a webhook was genuinely sent by GoCardless using `isValidSignature`, + * and then parses it into a WebhookParseResult containing both the events and the + * webhook ID from the meta field. + * + * @param string $request_body the request body + * @param string $signature_header the signature included in the request, found in the + * `Webhook-Signature` header + * @param string $webhook_endpoint_secret the webhook endpoint secret for your webhook + * endpoint, as configured in your GoCardless Dashboard + * @return WebhookParseResult containing the events and webhook ID + * @throws Core\Exception\InvalidSignatureException if the + * signature header specified does not match the signature computed using the + * request body and webhook endpoint secret + */ + public static function parseWithMeta($request_body, $signature_header, $webhook_endpoint_secret) + { + if (self::isSignatureValid($request_body, $signature_header, $webhook_endpoint_secret)) { + $parsed = json_decode($request_body); + $events = array_map([Webhook::class, 'buildEvent'], $parsed->events); + $webhookId = isset($parsed->meta) && isset($parsed->meta->webhook_id) + ? $parsed->meta->webhook_id + : null; + return new WebhookParseResult($events, $webhookId); + } else { + throw new Core\Exception\InvalidSignatureException(self::INVALID_SIGNATURE_MESSAGE); + } + } + /** * Validates that a webhook was genuinely sent by GoCardless by computing its * signature using the body and your webhook endpoint secret, and comparing that with diff --git a/lib/WebhookParseResult.php b/lib/WebhookParseResult.php new file mode 100644 index 000000000..a2f270080 --- /dev/null +++ b/lib/WebhookParseResult.php @@ -0,0 +1,46 @@ +events = $events; + $this->webhookId = $webhookId; + } + + /** + * Returns the list of events included in the webhook. + * + * @return Resources\Event[] + */ + public function getEvents() + { + return $this->events; + } + + /** + * Returns the webhook ID from the meta field, or null if not present. + * + * @return string|null + */ + public function getWebhookId() + { + return $this->webhookId; + } +} From c2013f3faaee28befc94ef24f4bc2b014920d1cf Mon Sep 17 00:00:00 2001 From: "gocardless-ci-robot[bot]" <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> Date: Wed, 27 May 2026 11:53:49 +0000 Subject: [PATCH 10/10] Changes generated by 910ac344ba159c3062fd091a93180b6d691acee4 This commit was automatically created from gocardless/client-library-templates@910ac344ba159c3062fd091a93180b6d691acee4 by the `push-files` action. Workflow run: https://github.com/gocardless/client-library-templates/actions/runs/26509277526 --- lib/Services/BillingRequestFlowsService.php | 2 +- lib/Services/BillingRequestsService.php | 18 +++++++++--------- lib/Services/BlocksService.php | 6 +++--- lib/Services/CreditorBankAccountsService.php | 2 +- lib/Services/CustomerBankAccountsService.php | 2 +- lib/Services/CustomerNotificationsService.php | 2 +- lib/Services/InstalmentSchedulesService.php | 2 +- lib/Services/MandateImportsService.php | 4 ++-- lib/Services/MandatesService.php | 4 ++-- lib/Services/OutboundPaymentsService.php | 6 +++--- lib/Services/PayerAuthorisationsService.php | 4 ++-- lib/Services/PaymentsService.php | 4 ++-- lib/Services/RedirectFlowsService.php | 2 +- lib/Services/ScenarioSimulatorsService.php | 2 +- lib/Services/SubscriptionsService.php | 6 +++--- lib/Services/WebhooksService.php | 2 +- 16 files changed, 34 insertions(+), 34 deletions(-) diff --git a/lib/Services/BillingRequestFlowsService.php b/lib/Services/BillingRequestFlowsService.php index 10e1ee0d0..42f620293 100644 --- a/lib/Services/BillingRequestFlowsService.php +++ b/lib/Services/BillingRequestFlowsService.php @@ -67,7 +67,7 @@ public function initialise($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + $params['body'] = json_encode(array("data" => (object)$params['params'])); unset($params['params']); } diff --git a/lib/Services/BillingRequestsService.php b/lib/Services/BillingRequestsService.php index c94272f05..11a1b2760 100644 --- a/lib/Services/BillingRequestsService.php +++ b/lib/Services/BillingRequestsService.php @@ -80,7 +80,7 @@ public function collectCustomerDetails($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + $params['body'] = json_encode(array("data" => (object)$params['params'])); unset($params['params']); } @@ -122,7 +122,7 @@ public function collectBankAccount($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + $params['body'] = json_encode(array("data" => (object)$params['params'])); unset($params['params']); } @@ -164,7 +164,7 @@ public function confirmPayerDetails($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + $params['body'] = json_encode(array("data" => (object)$params['params'])); unset($params['params']); } @@ -206,7 +206,7 @@ public function fulfil($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + $params['body'] = json_encode(array("data" => (object)$params['params'])); unset($params['params']); } @@ -248,7 +248,7 @@ public function cancel($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + $params['body'] = json_encode(array("data" => (object)$params['params'])); unset($params['params']); } @@ -343,7 +343,7 @@ public function notify($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + $params['body'] = json_encode(array("data" => (object)$params['params'])); unset($params['params']); } @@ -385,7 +385,7 @@ public function fallback($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + $params['body'] = json_encode(array("data" => (object)$params['params'])); unset($params['params']); } @@ -427,7 +427,7 @@ public function chooseCurrency($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + $params['body'] = json_encode(array("data" => (object)$params['params'])); unset($params['params']); } @@ -469,7 +469,7 @@ public function selectInstitution($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + $params['body'] = json_encode(array("data" => (object)$params['params'])); unset($params['params']); } diff --git a/lib/Services/BlocksService.php b/lib/Services/BlocksService.php index 3d8b44095..fb24d1bde 100644 --- a/lib/Services/BlocksService.php +++ b/lib/Services/BlocksService.php @@ -133,7 +133,7 @@ public function disable($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + $params['body'] = json_encode(array("data" => (object)$params['params'])); unset($params['params']); } @@ -175,7 +175,7 @@ public function enable($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + $params['body'] = json_encode(array("data" => (object)$params['params'])); unset($params['params']); } @@ -210,7 +210,7 @@ public function blockByRef($params = array()) { $path = "/blocks/block_by_ref"; if (isset($params['params'])) { - $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + $params['body'] = json_encode(array("data" => (object)$params['params'])); unset($params['params']); } diff --git a/lib/Services/CreditorBankAccountsService.php b/lib/Services/CreditorBankAccountsService.php index 45cabee01..aae52dc08 100644 --- a/lib/Services/CreditorBankAccountsService.php +++ b/lib/Services/CreditorBankAccountsService.php @@ -133,7 +133,7 @@ public function disable($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + $params['body'] = json_encode(array("data" => (object)$params['params'])); unset($params['params']); } diff --git a/lib/Services/CustomerBankAccountsService.php b/lib/Services/CustomerBankAccountsService.php index aadb25711..334274cad 100644 --- a/lib/Services/CustomerBankAccountsService.php +++ b/lib/Services/CustomerBankAccountsService.php @@ -164,7 +164,7 @@ public function disable($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + $params['body'] = json_encode(array("data" => (object)$params['params'])); unset($params['params']); } diff --git a/lib/Services/CustomerNotificationsService.php b/lib/Services/CustomerNotificationsService.php index 8ca8f78aa..bd6a12b9b 100644 --- a/lib/Services/CustomerNotificationsService.php +++ b/lib/Services/CustomerNotificationsService.php @@ -43,7 +43,7 @@ public function handle($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + $params['body'] = json_encode(array("data" => (object)$params['params'])); unset($params['params']); } diff --git a/lib/Services/InstalmentSchedulesService.php b/lib/Services/InstalmentSchedulesService.php index 5e4ce1a47..9f50d0ef1 100644 --- a/lib/Services/InstalmentSchedulesService.php +++ b/lib/Services/InstalmentSchedulesService.php @@ -199,7 +199,7 @@ public function cancel($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + $params['body'] = json_encode(array("data" => (object)$params['params'])); unset($params['params']); } diff --git a/lib/Services/MandateImportsService.php b/lib/Services/MandateImportsService.php index 90c3292cd..369a6f30d 100644 --- a/lib/Services/MandateImportsService.php +++ b/lib/Services/MandateImportsService.php @@ -108,7 +108,7 @@ public function submit($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + $params['body'] = json_encode(array("data" => (object)$params['params'])); unset($params['params']); } @@ -150,7 +150,7 @@ public function cancel($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + $params['body'] = json_encode(array("data" => (object)$params['params'])); unset($params['params']); } diff --git a/lib/Services/MandatesService.php b/lib/Services/MandatesService.php index e24a253e6..84bfc0775 100644 --- a/lib/Services/MandatesService.php +++ b/lib/Services/MandatesService.php @@ -167,7 +167,7 @@ public function cancel($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + $params['body'] = json_encode(array("data" => (object)$params['params'])); unset($params['params']); } @@ -210,7 +210,7 @@ public function reinstate($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + $params['body'] = json_encode(array("data" => (object)$params['params'])); unset($params['params']); } diff --git a/lib/Services/OutboundPaymentsService.php b/lib/Services/OutboundPaymentsService.php index 46b8bd164..e85fb5167 100644 --- a/lib/Services/OutboundPaymentsService.php +++ b/lib/Services/OutboundPaymentsService.php @@ -73,7 +73,7 @@ public function withdraw($params = array()) { $path = "/outbound_payments/withdrawal"; if (isset($params['params'])) { - $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + $params['body'] = json_encode(array("data" => (object)$params['params'])); unset($params['params']); } @@ -115,7 +115,7 @@ public function cancel($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + $params['body'] = json_encode(array("data" => (object)$params['params'])); unset($params['params']); } @@ -157,7 +157,7 @@ public function approve($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + $params['body'] = json_encode(array("data" => (object)$params['params'])); unset($params['params']); } diff --git a/lib/Services/PayerAuthorisationsService.php b/lib/Services/PayerAuthorisationsService.php index 4ba05b922..297989617 100644 --- a/lib/Services/PayerAuthorisationsService.php +++ b/lib/Services/PayerAuthorisationsService.php @@ -139,7 +139,7 @@ public function submit($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + $params['body'] = json_encode(array("data" => (object)$params['params'])); unset($params['params']); } @@ -181,7 +181,7 @@ public function confirm($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + $params['body'] = json_encode(array("data" => (object)$params['params'])); unset($params['params']); } diff --git a/lib/Services/PaymentsService.php b/lib/Services/PaymentsService.php index e493b255b..a4bd2c9bb 100644 --- a/lib/Services/PaymentsService.php +++ b/lib/Services/PaymentsService.php @@ -164,7 +164,7 @@ public function cancel($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + $params['body'] = json_encode(array("data" => (object)$params['params'])); unset($params['params']); } @@ -206,7 +206,7 @@ public function retry($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + $params['body'] = json_encode(array("data" => (object)$params['params'])); unset($params['params']); } diff --git a/lib/Services/RedirectFlowsService.php b/lib/Services/RedirectFlowsService.php index 50df8b72e..d29c8995a 100644 --- a/lib/Services/RedirectFlowsService.php +++ b/lib/Services/RedirectFlowsService.php @@ -108,7 +108,7 @@ public function complete($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + $params['body'] = json_encode(array("data" => (object)$params['params'])); unset($params['params']); } diff --git a/lib/Services/ScenarioSimulatorsService.php b/lib/Services/ScenarioSimulatorsService.php index d52cf339e..834449d5b 100644 --- a/lib/Services/ScenarioSimulatorsService.php +++ b/lib/Services/ScenarioSimulatorsService.php @@ -200,7 +200,7 @@ public function run($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + $params['body'] = json_encode(array("data" => (object)$params['params'])); unset($params['params']); } diff --git a/lib/Services/SubscriptionsService.php b/lib/Services/SubscriptionsService.php index 2d3d70ac7..e4f5beb9e 100644 --- a/lib/Services/SubscriptionsService.php +++ b/lib/Services/SubscriptionsService.php @@ -164,7 +164,7 @@ public function pause($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + $params['body'] = json_encode(array("data" => (object)$params['params'])); unset($params['params']); } @@ -206,7 +206,7 @@ public function resume($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + $params['body'] = json_encode(array("data" => (object)$params['params'])); unset($params['params']); } @@ -248,7 +248,7 @@ public function cancel($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + $params['body'] = json_encode(array("data" => (object)$params['params'])); unset($params['params']); } diff --git a/lib/Services/WebhooksService.php b/lib/Services/WebhooksService.php index df7006cda..d59f3b326 100644 --- a/lib/Services/WebhooksService.php +++ b/lib/Services/WebhooksService.php @@ -98,7 +98,7 @@ public function retry($identity, $params = array()) ) ); if (isset($params['params'])) { - $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + $params['body'] = json_encode(array("data" => (object)$params['params'])); unset($params['params']); }