From ecfd03cd1c159cce9ab588f36d783d2349d81dd0 Mon Sep 17 00:00:00 2001 From: Jonathan Pepin Date: Tue, 26 May 2020 09:32:11 -0700 Subject: [PATCH 1/4] [wip] started AbstractService::RequestCollection --- lib/BaseStripeClient.php | 18 ++++++++++++++++++ lib/Service/AbstractService.php | 5 +++++ lib/Service/SubscriptionService.php | 2 +- .../Stripe/Service/SubscriptionServiceTest.php | 18 ++++++++++++++++++ 4 files changed, 42 insertions(+), 1 deletion(-) diff --git a/lib/BaseStripeClient.php b/lib/BaseStripeClient.php index 125b51368..3c1305f59 100644 --- a/lib/BaseStripeClient.php +++ b/lib/BaseStripeClient.php @@ -139,6 +139,24 @@ public function request($method, $path, $params, $opts) return $obj; } + /** + * Sends a request to Stripe's API. + * + * @param string $method the HTTP method + * @param string $path the path of the request + * @param array $params the parameters of the request + * @param array|\Stripe\Util\RequestOptions $opts the special modifiers of the request + * + * @return \Stripe\Collection of ApiResources + */ + public function requestCollection($method, $path, $params, $opts) + { + $obj = $this->request($method, $path, $params, $opts); + $obj->setFilters($params); + + return $obj; + } + /** * @param \Stripe\Util\RequestOptions $opts * diff --git a/lib/Service/AbstractService.php b/lib/Service/AbstractService.php index 2cc759c07..ed092c8b8 100644 --- a/lib/Service/AbstractService.php +++ b/lib/Service/AbstractService.php @@ -59,6 +59,11 @@ protected function request($method, $path, $params, $opts) return $this->getClient()->request($method, $path, static::formatParams($params), $opts); } + protected function requestCollection($method, $path, $params, $opts) + { + return $this->getClient()->requestCollection($method, $path, static::formatParams($params), $opts); + } + protected function buildPath($basePath, ...$ids) { foreach ($ids as $id) { diff --git a/lib/Service/SubscriptionService.php b/lib/Service/SubscriptionService.php index 972f91818..0a818c2bf 100644 --- a/lib/Service/SubscriptionService.php +++ b/lib/Service/SubscriptionService.php @@ -17,7 +17,7 @@ class SubscriptionService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/subscriptions', $params, $opts); + return $this->requestCollection('get', '/v1/subscriptions', $params, $opts); } /** diff --git a/tests/Stripe/Service/SubscriptionServiceTest.php b/tests/Stripe/Service/SubscriptionServiceTest.php index d587a79e7..2b84aa891 100644 --- a/tests/Stripe/Service/SubscriptionServiceTest.php +++ b/tests/Stripe/Service/SubscriptionServiceTest.php @@ -38,6 +38,24 @@ public function testAll() static::assertInstanceOf(\Stripe\Subscription::class, $resources->data[0]); } + public function testAllPagination() + { + $this->expectsRequest( + 'get', + '/v1/subscriptions' + ); + $resources = $this->service->all([ + 'status' => 'all', + 'limit' => 100, + ]); + var_dump($resources->getFilters()); + $filters = $resources->getFilters(); + static::assertEquals($filters, [ + 'status' => 'all', + 'limit' => 100, + ]); + } + public function testCancel() { $this->expectsRequest( From 90c4669d62c6b03a303a970142838e4fa878fc54 Mon Sep 17 00:00:00 2001 From: Richard Marmorstein Date: Tue, 26 May 2020 13:42:38 -0400 Subject: [PATCH 2/4] Throw when requestCollection receives non-collection --- lib/BaseStripeClient.php | 6 ++++++ tests/Stripe/BaseStripeClientTest.php | 18 ++++++++++++++++++ .../Stripe/Service/SubscriptionServiceTest.php | 1 - 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/lib/BaseStripeClient.php b/lib/BaseStripeClient.php index 3c1305f59..570b2dd86 100644 --- a/lib/BaseStripeClient.php +++ b/lib/BaseStripeClient.php @@ -152,6 +152,12 @@ public function request($method, $path, $params, $opts) public function requestCollection($method, $path, $params, $opts) { $obj = $this->request($method, $path, $params, $opts); + if (!($obj instanceof \Stripe\Collection)) { + $received_class = \get_class($obj); + $msg = "Expected to receive `Stripe\Collection` object from Stripe API. Instead received `{$received_class}`."; + throw new \Stripe\Exception\UnexpectedValueException + ($msg); + } $obj->setFilters($params); return $obj; diff --git a/tests/Stripe/BaseStripeClientTest.php b/tests/Stripe/BaseStripeClientTest.php index 6a938e0e2..dffef1ad5 100644 --- a/tests/Stripe/BaseStripeClientTest.php +++ b/tests/Stripe/BaseStripeClientTest.php @@ -161,4 +161,22 @@ public function testRequestWithOptsStripeAccount() static::assertNotNull($charge); static::assertSame('acct_456', $this->optsReflector->getValue($charge)->headers['Stripe-Account']); } + + public function testRequestCollectionWithClientApiKey() + { + $client = new BaseStripeClient(['api_key' => 'sk_test_client', 'api_base' => MOCK_URL]); + $charges = $client->requestCollection('get', '/v1/charges', [], []); + static::assertNotNull($charges); + static::assertSame('sk_test_client', $this->optsReflector->getValue($charges)->apiKey); + + } + + public function testRequestCollectionThrowsForNonList() + { + $this->expectException(\Stripe\Exception\UnexpectedValueException::class); + $this->expectExceptionMessage('Expected to receive `Stripe\Collection` object from Stripe API. Instead received `Stripe\Charge`.'); + + $client = new BaseStripeClient(['api_key' => 'sk_test_client', 'api_base' => MOCK_URL]); + $client->requestCollection('get', '/v1/charges/ch_123', [], []); + } } diff --git a/tests/Stripe/Service/SubscriptionServiceTest.php b/tests/Stripe/Service/SubscriptionServiceTest.php index 2b84aa891..4768f5c2e 100644 --- a/tests/Stripe/Service/SubscriptionServiceTest.php +++ b/tests/Stripe/Service/SubscriptionServiceTest.php @@ -48,7 +48,6 @@ public function testAllPagination() 'status' => 'all', 'limit' => 100, ]); - var_dump($resources->getFilters()); $filters = $resources->getFilters(); static::assertEquals($filters, [ 'status' => 'all', From e285d7b50d094905e66efe0404c1937bc491f3c6 Mon Sep 17 00:00:00 2001 From: Richard Marmorstein Date: Wed, 27 May 2020 09:27:12 -0400 Subject: [PATCH 3/4] format --- lib/BaseStripeClient.php | 20 +++++++++---------- tests/Stripe/BaseStripeClientTest.php | 1 - .../Service/SubscriptionServiceTest.php | 10 +++++----- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/lib/BaseStripeClient.php b/lib/BaseStripeClient.php index 570b2dd86..8d09a6c87 100644 --- a/lib/BaseStripeClient.php +++ b/lib/BaseStripeClient.php @@ -151,16 +151,16 @@ public function request($method, $path, $params, $opts) */ public function requestCollection($method, $path, $params, $opts) { - $obj = $this->request($method, $path, $params, $opts); - if (!($obj instanceof \Stripe\Collection)) { - $received_class = \get_class($obj); - $msg = "Expected to receive `Stripe\Collection` object from Stripe API. Instead received `{$received_class}`."; - throw new \Stripe\Exception\UnexpectedValueException - ($msg); - } - $obj->setFilters($params); - - return $obj; + $obj = $this->request($method, $path, $params, $opts); + if (!($obj instanceof \Stripe\Collection)) { + $received_class = \get_class($obj); + $msg = "Expected to receive `Stripe\\Collection` object from Stripe API. Instead received `{$received_class}`."; + + throw new \Stripe\Exception\UnexpectedValueException($msg); + } + $obj->setFilters($params); + + return $obj; } /** diff --git a/tests/Stripe/BaseStripeClientTest.php b/tests/Stripe/BaseStripeClientTest.php index dffef1ad5..2dd6c45b1 100644 --- a/tests/Stripe/BaseStripeClientTest.php +++ b/tests/Stripe/BaseStripeClientTest.php @@ -168,7 +168,6 @@ public function testRequestCollectionWithClientApiKey() $charges = $client->requestCollection('get', '/v1/charges', [], []); static::assertNotNull($charges); static::assertSame('sk_test_client', $this->optsReflector->getValue($charges)->apiKey); - } public function testRequestCollectionThrowsForNonList() diff --git a/tests/Stripe/Service/SubscriptionServiceTest.php b/tests/Stripe/Service/SubscriptionServiceTest.php index 4768f5c2e..6e40e8a86 100644 --- a/tests/Stripe/Service/SubscriptionServiceTest.php +++ b/tests/Stripe/Service/SubscriptionServiceTest.php @@ -45,13 +45,13 @@ public function testAllPagination() '/v1/subscriptions' ); $resources = $this->service->all([ - 'status' => 'all', - 'limit' => 100, + 'status' => 'all', + 'limit' => 100, ]); $filters = $resources->getFilters(); - static::assertEquals($filters, [ - 'status' => 'all', - 'limit' => 100, + static::assertSame($filters, [ + 'status' => 'all', + 'limit' => 100, ]); } From ad050fc408d91682dbdc213b07f6788624bd5366 Mon Sep 17 00:00:00 2001 From: Richard Marmorstein Date: Wed, 27 May 2020 09:29:05 -0400 Subject: [PATCH 4/4] codegen rest of ->all methods --- lib/Service/AccountService.php | 8 ++++---- lib/Service/ApplePayDomainService.php | 2 +- lib/Service/ApplicationFeeService.php | 4 ++-- lib/Service/BalanceTransactionService.php | 2 +- lib/Service/ChargeService.php | 2 +- lib/Service/Checkout/SessionService.php | 4 ++-- lib/Service/CountrySpecService.php | 2 +- lib/Service/CouponService.php | 2 +- lib/Service/CreditNoteService.php | 4 ++-- lib/Service/CustomerService.php | 8 ++++---- lib/Service/DisputeService.php | 2 +- lib/Service/EventService.php | 2 +- lib/Service/ExchangeRateService.php | 2 +- lib/Service/FileLinkService.php | 2 +- lib/Service/FileService.php | 2 +- lib/Service/InvoiceItemService.php | 2 +- lib/Service/InvoiceService.php | 4 ++-- lib/Service/Issuing/AuthorizationService.php | 2 +- lib/Service/Issuing/CardService.php | 2 +- lib/Service/Issuing/CardholderService.php | 2 +- lib/Service/Issuing/DisputeService.php | 2 +- lib/Service/Issuing/TransactionService.php | 2 +- lib/Service/OrderReturnService.php | 2 +- lib/Service/OrderService.php | 2 +- lib/Service/PaymentIntentService.php | 2 +- lib/Service/PaymentMethodService.php | 2 +- lib/Service/PayoutService.php | 2 +- lib/Service/PlanService.php | 2 +- lib/Service/PriceService.php | 2 +- lib/Service/ProductService.php | 2 +- lib/Service/Radar/EarlyFraudWarningService.php | 2 +- lib/Service/Radar/ValueListItemService.php | 2 +- lib/Service/Radar/ValueListService.php | 2 +- lib/Service/RefundService.php | 2 +- lib/Service/Reporting/ReportRunService.php | 2 +- lib/Service/Reporting/ReportTypeService.php | 2 +- lib/Service/ReviewService.php | 2 +- lib/Service/SetupIntentService.php | 2 +- lib/Service/Sigma/ScheduledQueryRunService.php | 2 +- lib/Service/SkuService.php | 2 +- lib/Service/SubscriptionItemService.php | 4 ++-- lib/Service/SubscriptionScheduleService.php | 2 +- lib/Service/TaxRateService.php | 2 +- lib/Service/Terminal/LocationService.php | 2 +- lib/Service/Terminal/ReaderService.php | 2 +- lib/Service/TopupService.php | 2 +- lib/Service/TransferService.php | 4 ++-- lib/Service/WebhookEndpointService.php | 2 +- 48 files changed, 60 insertions(+), 60 deletions(-) diff --git a/lib/Service/AccountService.php b/lib/Service/AccountService.php index 2963125b1..660d3bcbe 100644 --- a/lib/Service/AccountService.php +++ b/lib/Service/AccountService.php @@ -17,7 +17,7 @@ class AccountService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/accounts', $params, $opts); + return $this->requestCollection('get', '/v1/accounts', $params, $opts); } /** @@ -35,7 +35,7 @@ public function all($params = null, $opts = null) */ public function allCapabilities($parentId, $params = null, $opts = null) { - return $this->request('get', $this->buildPath('/v1/accounts/%s/capabilities', $parentId), $params, $opts); + return $this->requestCollection('get', $this->buildPath('/v1/accounts/%s/capabilities', $parentId), $params, $opts); } /** @@ -51,7 +51,7 @@ public function allCapabilities($parentId, $params = null, $opts = null) */ public function allExternalAccounts($parentId, $params = null, $opts = null) { - return $this->request('get', $this->buildPath('/v1/accounts/%s/external_accounts', $parentId), $params, $opts); + return $this->requestCollection('get', $this->buildPath('/v1/accounts/%s/external_accounts', $parentId), $params, $opts); } /** @@ -69,7 +69,7 @@ public function allExternalAccounts($parentId, $params = null, $opts = null) */ public function allPersons($parentId, $params = null, $opts = null) { - return $this->request('get', $this->buildPath('/v1/accounts/%s/persons', $parentId), $params, $opts); + return $this->requestCollection('get', $this->buildPath('/v1/accounts/%s/persons', $parentId), $params, $opts); } /** diff --git a/lib/Service/ApplePayDomainService.php b/lib/Service/ApplePayDomainService.php index 90b322668..d8a079035 100644 --- a/lib/Service/ApplePayDomainService.php +++ b/lib/Service/ApplePayDomainService.php @@ -16,7 +16,7 @@ class ApplePayDomainService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/apple_pay/domains', $params, $opts); + return $this->requestCollection('get', '/v1/apple_pay/domains', $params, $opts); } /** diff --git a/lib/Service/ApplicationFeeService.php b/lib/Service/ApplicationFeeService.php index 67cb75bc4..6a93316c3 100644 --- a/lib/Service/ApplicationFeeService.php +++ b/lib/Service/ApplicationFeeService.php @@ -17,7 +17,7 @@ class ApplicationFeeService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/application_fees', $params, $opts); + return $this->requestCollection('get', '/v1/application_fees', $params, $opts); } /** @@ -37,7 +37,7 @@ public function all($params = null, $opts = null) */ public function allRefunds($parentId, $params = null, $opts = null) { - return $this->request('get', $this->buildPath('/v1/application_fees/%s/refunds', $parentId), $params, $opts); + return $this->requestCollection('get', $this->buildPath('/v1/application_fees/%s/refunds', $parentId), $params, $opts); } /** diff --git a/lib/Service/BalanceTransactionService.php b/lib/Service/BalanceTransactionService.php index 17113486e..61d78191a 100644 --- a/lib/Service/BalanceTransactionService.php +++ b/lib/Service/BalanceTransactionService.php @@ -21,7 +21,7 @@ class BalanceTransactionService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/balance_transactions', $params, $opts); + return $this->requestCollection('get', '/v1/balance_transactions', $params, $opts); } /** diff --git a/lib/Service/ChargeService.php b/lib/Service/ChargeService.php index 2bcb92e84..f09695c03 100644 --- a/lib/Service/ChargeService.php +++ b/lib/Service/ChargeService.php @@ -17,7 +17,7 @@ class ChargeService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/charges', $params, $opts); + return $this->requestCollection('get', '/v1/charges', $params, $opts); } /** diff --git a/lib/Service/Checkout/SessionService.php b/lib/Service/Checkout/SessionService.php index 080914d34..445b6d5f4 100644 --- a/lib/Service/Checkout/SessionService.php +++ b/lib/Service/Checkout/SessionService.php @@ -16,7 +16,7 @@ class SessionService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/checkout/sessions', $params, $opts); + return $this->requestCollection('get', '/v1/checkout/sessions', $params, $opts); } /** @@ -35,7 +35,7 @@ public function all($params = null, $opts = null) */ public function allLineItems($parentId, $params = null, $opts = null) { - return $this->request('get', $this->buildPath('/v1/checkout/sessions/%s/line_items', $parentId), $params, $opts); + return $this->requestCollection('get', $this->buildPath('/v1/checkout/sessions/%s/line_items', $parentId), $params, $opts); } /** diff --git a/lib/Service/CountrySpecService.php b/lib/Service/CountrySpecService.php index 49fd860fe..65e59b960 100644 --- a/lib/Service/CountrySpecService.php +++ b/lib/Service/CountrySpecService.php @@ -16,7 +16,7 @@ class CountrySpecService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/country_specs', $params, $opts); + return $this->requestCollection('get', '/v1/country_specs', $params, $opts); } /** diff --git a/lib/Service/CouponService.php b/lib/Service/CouponService.php index 76bec8a4f..af92e1537 100644 --- a/lib/Service/CouponService.php +++ b/lib/Service/CouponService.php @@ -16,7 +16,7 @@ class CouponService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/coupons', $params, $opts); + return $this->requestCollection('get', '/v1/coupons', $params, $opts); } /** diff --git a/lib/Service/CreditNoteService.php b/lib/Service/CreditNoteService.php index f511733fe..cfb368700 100644 --- a/lib/Service/CreditNoteService.php +++ b/lib/Service/CreditNoteService.php @@ -16,7 +16,7 @@ class CreditNoteService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/credit_notes', $params, $opts); + return $this->requestCollection('get', '/v1/credit_notes', $params, $opts); } /** @@ -34,7 +34,7 @@ public function all($params = null, $opts = null) */ public function allLines($parentId, $params = null, $opts = null) { - return $this->request('get', $this->buildPath('/v1/credit_notes/%s/lines', $parentId), $params, $opts); + return $this->requestCollection('get', $this->buildPath('/v1/credit_notes/%s/lines', $parentId), $params, $opts); } /** diff --git a/lib/Service/CustomerService.php b/lib/Service/CustomerService.php index 64aaa3ca6..2feafd375 100644 --- a/lib/Service/CustomerService.php +++ b/lib/Service/CustomerService.php @@ -17,7 +17,7 @@ class CustomerService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/customers', $params, $opts); + return $this->requestCollection('get', '/v1/customers', $params, $opts); } /** @@ -34,7 +34,7 @@ public function all($params = null, $opts = null) */ public function allBalanceTransactions($parentId, $params = null, $opts = null) { - return $this->request('get', $this->buildPath('/v1/customers/%s/balance_transactions', $parentId), $params, $opts); + return $this->requestCollection('get', $this->buildPath('/v1/customers/%s/balance_transactions', $parentId), $params, $opts); } /** @@ -50,7 +50,7 @@ public function allBalanceTransactions($parentId, $params = null, $opts = null) */ public function allSources($parentId, $params = null, $opts = null) { - return $this->request('get', $this->buildPath('/v1/customers/%s/sources', $parentId), $params, $opts); + return $this->requestCollection('get', $this->buildPath('/v1/customers/%s/sources', $parentId), $params, $opts); } /** @@ -66,7 +66,7 @@ public function allSources($parentId, $params = null, $opts = null) */ public function allTaxIds($parentId, $params = null, $opts = null) { - return $this->request('get', $this->buildPath('/v1/customers/%s/tax_ids', $parentId), $params, $opts); + return $this->requestCollection('get', $this->buildPath('/v1/customers/%s/tax_ids', $parentId), $params, $opts); } /** diff --git a/lib/Service/DisputeService.php b/lib/Service/DisputeService.php index e080a635e..39502f4f5 100644 --- a/lib/Service/DisputeService.php +++ b/lib/Service/DisputeService.php @@ -16,7 +16,7 @@ class DisputeService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/disputes', $params, $opts); + return $this->requestCollection('get', '/v1/disputes', $params, $opts); } /** diff --git a/lib/Service/EventService.php b/lib/Service/EventService.php index 14b7c6aa6..33bfbcdd8 100644 --- a/lib/Service/EventService.php +++ b/lib/Service/EventService.php @@ -20,7 +20,7 @@ class EventService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/events', $params, $opts); + return $this->requestCollection('get', '/v1/events', $params, $opts); } /** diff --git a/lib/Service/ExchangeRateService.php b/lib/Service/ExchangeRateService.php index 5776df415..4df4a8b73 100644 --- a/lib/Service/ExchangeRateService.php +++ b/lib/Service/ExchangeRateService.php @@ -17,7 +17,7 @@ class ExchangeRateService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/exchange_rates', $params, $opts); + return $this->requestCollection('get', '/v1/exchange_rates', $params, $opts); } /** diff --git a/lib/Service/FileLinkService.php b/lib/Service/FileLinkService.php index 6ce9d2e4d..3506383c3 100644 --- a/lib/Service/FileLinkService.php +++ b/lib/Service/FileLinkService.php @@ -16,7 +16,7 @@ class FileLinkService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/file_links', $params, $opts); + return $this->requestCollection('get', '/v1/file_links', $params, $opts); } /** diff --git a/lib/Service/FileService.php b/lib/Service/FileService.php index f3570d3f6..ac9945abb 100644 --- a/lib/Service/FileService.php +++ b/lib/Service/FileService.php @@ -18,7 +18,7 @@ class FileService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/files', $params, $opts); + return $this->requestCollection('get', '/v1/files', $params, $opts); } /** diff --git a/lib/Service/InvoiceItemService.php b/lib/Service/InvoiceItemService.php index 833ce5c2e..6647ac28a 100644 --- a/lib/Service/InvoiceItemService.php +++ b/lib/Service/InvoiceItemService.php @@ -17,7 +17,7 @@ class InvoiceItemService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/invoiceitems', $params, $opts); + return $this->requestCollection('get', '/v1/invoiceitems', $params, $opts); } /** diff --git a/lib/Service/InvoiceService.php b/lib/Service/InvoiceService.php index 1abf5783e..31d3766a5 100644 --- a/lib/Service/InvoiceService.php +++ b/lib/Service/InvoiceService.php @@ -18,7 +18,7 @@ class InvoiceService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/invoices', $params, $opts); + return $this->requestCollection('get', '/v1/invoices', $params, $opts); } /** @@ -37,7 +37,7 @@ public function all($params = null, $opts = null) */ public function allLines($parentId, $params = null, $opts = null) { - return $this->request('get', $this->buildPath('/v1/invoices/%s/lines', $parentId), $params, $opts); + return $this->requestCollection('get', $this->buildPath('/v1/invoices/%s/lines', $parentId), $params, $opts); } /** diff --git a/lib/Service/Issuing/AuthorizationService.php b/lib/Service/Issuing/AuthorizationService.php index 95b49504a..f5b013d1b 100644 --- a/lib/Service/Issuing/AuthorizationService.php +++ b/lib/Service/Issuing/AuthorizationService.php @@ -18,7 +18,7 @@ class AuthorizationService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/issuing/authorizations', $params, $opts); + return $this->requestCollection('get', '/v1/issuing/authorizations', $params, $opts); } /** diff --git a/lib/Service/Issuing/CardService.php b/lib/Service/Issuing/CardService.php index 3b16fa77b..d4a2dad2a 100644 --- a/lib/Service/Issuing/CardService.php +++ b/lib/Service/Issuing/CardService.php @@ -18,7 +18,7 @@ class CardService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/issuing/cards', $params, $opts); + return $this->requestCollection('get', '/v1/issuing/cards', $params, $opts); } /** diff --git a/lib/Service/Issuing/CardholderService.php b/lib/Service/Issuing/CardholderService.php index eb50490d3..10e3a35a8 100644 --- a/lib/Service/Issuing/CardholderService.php +++ b/lib/Service/Issuing/CardholderService.php @@ -18,7 +18,7 @@ class CardholderService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/issuing/cardholders', $params, $opts); + return $this->requestCollection('get', '/v1/issuing/cardholders', $params, $opts); } /** diff --git a/lib/Service/Issuing/DisputeService.php b/lib/Service/Issuing/DisputeService.php index 667249046..a1e08b4dd 100644 --- a/lib/Service/Issuing/DisputeService.php +++ b/lib/Service/Issuing/DisputeService.php @@ -18,7 +18,7 @@ class DisputeService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/issuing/disputes', $params, $opts); + return $this->requestCollection('get', '/v1/issuing/disputes', $params, $opts); } /** diff --git a/lib/Service/Issuing/TransactionService.php b/lib/Service/Issuing/TransactionService.php index c77200e0e..56773ded1 100644 --- a/lib/Service/Issuing/TransactionService.php +++ b/lib/Service/Issuing/TransactionService.php @@ -18,7 +18,7 @@ class TransactionService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/issuing/transactions', $params, $opts); + return $this->requestCollection('get', '/v1/issuing/transactions', $params, $opts); } /** diff --git a/lib/Service/OrderReturnService.php b/lib/Service/OrderReturnService.php index 6ca6cf46f..cdb27a3bb 100644 --- a/lib/Service/OrderReturnService.php +++ b/lib/Service/OrderReturnService.php @@ -17,7 +17,7 @@ class OrderReturnService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/order_returns', $params, $opts); + return $this->requestCollection('get', '/v1/order_returns', $params, $opts); } /** diff --git a/lib/Service/OrderService.php b/lib/Service/OrderService.php index eb04d1caf..c08eafd32 100644 --- a/lib/Service/OrderService.php +++ b/lib/Service/OrderService.php @@ -17,7 +17,7 @@ class OrderService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/orders', $params, $opts); + return $this->requestCollection('get', '/v1/orders', $params, $opts); } /** diff --git a/lib/Service/PaymentIntentService.php b/lib/Service/PaymentIntentService.php index 5dac7c306..616631a4c 100644 --- a/lib/Service/PaymentIntentService.php +++ b/lib/Service/PaymentIntentService.php @@ -16,7 +16,7 @@ class PaymentIntentService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/payment_intents', $params, $opts); + return $this->requestCollection('get', '/v1/payment_intents', $params, $opts); } /** diff --git a/lib/Service/PaymentMethodService.php b/lib/Service/PaymentMethodService.php index b92fd769f..851164c2f 100644 --- a/lib/Service/PaymentMethodService.php +++ b/lib/Service/PaymentMethodService.php @@ -16,7 +16,7 @@ class PaymentMethodService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/payment_methods', $params, $opts); + return $this->requestCollection('get', '/v1/payment_methods', $params, $opts); } /** diff --git a/lib/Service/PayoutService.php b/lib/Service/PayoutService.php index 6f1a73429..610d02cb9 100644 --- a/lib/Service/PayoutService.php +++ b/lib/Service/PayoutService.php @@ -18,7 +18,7 @@ class PayoutService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/payouts', $params, $opts); + return $this->requestCollection('get', '/v1/payouts', $params, $opts); } /** diff --git a/lib/Service/PlanService.php b/lib/Service/PlanService.php index f5c772047..8cc486a0a 100644 --- a/lib/Service/PlanService.php +++ b/lib/Service/PlanService.php @@ -16,7 +16,7 @@ class PlanService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/plans', $params, $opts); + return $this->requestCollection('get', '/v1/plans', $params, $opts); } /** diff --git a/lib/Service/PriceService.php b/lib/Service/PriceService.php index 8e57569c5..f1463b0dc 100644 --- a/lib/Service/PriceService.php +++ b/lib/Service/PriceService.php @@ -16,7 +16,7 @@ class PriceService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/prices', $params, $opts); + return $this->requestCollection('get', '/v1/prices', $params, $opts); } /** diff --git a/lib/Service/ProductService.php b/lib/Service/ProductService.php index 0ce24f7b7..7e217b285 100644 --- a/lib/Service/ProductService.php +++ b/lib/Service/ProductService.php @@ -17,7 +17,7 @@ class ProductService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/products', $params, $opts); + return $this->requestCollection('get', '/v1/products', $params, $opts); } /** diff --git a/lib/Service/Radar/EarlyFraudWarningService.php b/lib/Service/Radar/EarlyFraudWarningService.php index 7c08978f7..ffe17d323 100644 --- a/lib/Service/Radar/EarlyFraudWarningService.php +++ b/lib/Service/Radar/EarlyFraudWarningService.php @@ -16,7 +16,7 @@ class EarlyFraudWarningService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/radar/early_fraud_warnings', $params, $opts); + return $this->requestCollection('get', '/v1/radar/early_fraud_warnings', $params, $opts); } /** diff --git a/lib/Service/Radar/ValueListItemService.php b/lib/Service/Radar/ValueListItemService.php index fc8da729b..8d3277624 100644 --- a/lib/Service/Radar/ValueListItemService.php +++ b/lib/Service/Radar/ValueListItemService.php @@ -18,7 +18,7 @@ class ValueListItemService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/radar/value_list_items', $params, $opts); + return $this->requestCollection('get', '/v1/radar/value_list_items', $params, $opts); } /** diff --git a/lib/Service/Radar/ValueListService.php b/lib/Service/Radar/ValueListService.php index 9c8480934..21616ad79 100644 --- a/lib/Service/Radar/ValueListService.php +++ b/lib/Service/Radar/ValueListService.php @@ -18,7 +18,7 @@ class ValueListService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/radar/value_lists', $params, $opts); + return $this->requestCollection('get', '/v1/radar/value_lists', $params, $opts); } /** diff --git a/lib/Service/RefundService.php b/lib/Service/RefundService.php index d25fa4dc5..207c9a4b5 100644 --- a/lib/Service/RefundService.php +++ b/lib/Service/RefundService.php @@ -19,7 +19,7 @@ class RefundService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/refunds', $params, $opts); + return $this->requestCollection('get', '/v1/refunds', $params, $opts); } /** diff --git a/lib/Service/Reporting/ReportRunService.php b/lib/Service/Reporting/ReportRunService.php index dfe3b84ed..ea9dfa4cd 100644 --- a/lib/Service/Reporting/ReportRunService.php +++ b/lib/Service/Reporting/ReportRunService.php @@ -17,7 +17,7 @@ class ReportRunService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/reporting/report_runs', $params, $opts); + return $this->requestCollection('get', '/v1/reporting/report_runs', $params, $opts); } /** diff --git a/lib/Service/Reporting/ReportTypeService.php b/lib/Service/Reporting/ReportTypeService.php index 706ee04e2..d640db9eb 100644 --- a/lib/Service/Reporting/ReportTypeService.php +++ b/lib/Service/Reporting/ReportTypeService.php @@ -17,7 +17,7 @@ class ReportTypeService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/reporting/report_types', $params, $opts); + return $this->requestCollection('get', '/v1/reporting/report_types', $params, $opts); } /** diff --git a/lib/Service/ReviewService.php b/lib/Service/ReviewService.php index e5a4eab73..2900a3ded 100644 --- a/lib/Service/ReviewService.php +++ b/lib/Service/ReviewService.php @@ -18,7 +18,7 @@ class ReviewService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/reviews', $params, $opts); + return $this->requestCollection('get', '/v1/reviews', $params, $opts); } /** diff --git a/lib/Service/SetupIntentService.php b/lib/Service/SetupIntentService.php index 908acd5d6..d346db6f8 100644 --- a/lib/Service/SetupIntentService.php +++ b/lib/Service/SetupIntentService.php @@ -16,7 +16,7 @@ class SetupIntentService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/setup_intents', $params, $opts); + return $this->requestCollection('get', '/v1/setup_intents', $params, $opts); } /** diff --git a/lib/Service/Sigma/ScheduledQueryRunService.php b/lib/Service/Sigma/ScheduledQueryRunService.php index b220c5901..dbb93ddec 100644 --- a/lib/Service/Sigma/ScheduledQueryRunService.php +++ b/lib/Service/Sigma/ScheduledQueryRunService.php @@ -16,7 +16,7 @@ class ScheduledQueryRunService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/sigma/scheduled_query_runs', $params, $opts); + return $this->requestCollection('get', '/v1/sigma/scheduled_query_runs', $params, $opts); } /** diff --git a/lib/Service/SkuService.php b/lib/Service/SkuService.php index 5cf4f0306..d8e54a83a 100644 --- a/lib/Service/SkuService.php +++ b/lib/Service/SkuService.php @@ -17,7 +17,7 @@ class SkuService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/skus', $params, $opts); + return $this->requestCollection('get', '/v1/skus', $params, $opts); } /** diff --git a/lib/Service/SubscriptionItemService.php b/lib/Service/SubscriptionItemService.php index 1b9eb65f0..e64255fa2 100644 --- a/lib/Service/SubscriptionItemService.php +++ b/lib/Service/SubscriptionItemService.php @@ -16,7 +16,7 @@ class SubscriptionItemService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/subscription_items', $params, $opts); + return $this->requestCollection('get', '/v1/subscription_items', $params, $opts); } /** @@ -41,7 +41,7 @@ public function all($params = null, $opts = null) */ public function allUsageRecordSummaries($parentId, $params = null, $opts = null) { - return $this->request('get', $this->buildPath('/v1/subscription_items/%s/usage_record_summaries', $parentId), $params, $opts); + return $this->requestCollection('get', $this->buildPath('/v1/subscription_items/%s/usage_record_summaries', $parentId), $params, $opts); } /** diff --git a/lib/Service/SubscriptionScheduleService.php b/lib/Service/SubscriptionScheduleService.php index 9869dc6d6..1d2e82e74 100644 --- a/lib/Service/SubscriptionScheduleService.php +++ b/lib/Service/SubscriptionScheduleService.php @@ -16,7 +16,7 @@ class SubscriptionScheduleService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/subscription_schedules', $params, $opts); + return $this->requestCollection('get', '/v1/subscription_schedules', $params, $opts); } /** diff --git a/lib/Service/TaxRateService.php b/lib/Service/TaxRateService.php index 8b4a37e9d..34aee9bee 100644 --- a/lib/Service/TaxRateService.php +++ b/lib/Service/TaxRateService.php @@ -17,7 +17,7 @@ class TaxRateService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/tax_rates', $params, $opts); + return $this->requestCollection('get', '/v1/tax_rates', $params, $opts); } /** diff --git a/lib/Service/Terminal/LocationService.php b/lib/Service/Terminal/LocationService.php index 5cc95cfd0..048093494 100644 --- a/lib/Service/Terminal/LocationService.php +++ b/lib/Service/Terminal/LocationService.php @@ -16,7 +16,7 @@ class LocationService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/terminal/locations', $params, $opts); + return $this->requestCollection('get', '/v1/terminal/locations', $params, $opts); } /** diff --git a/lib/Service/Terminal/ReaderService.php b/lib/Service/Terminal/ReaderService.php index 8dfda9db6..f52ac10ee 100644 --- a/lib/Service/Terminal/ReaderService.php +++ b/lib/Service/Terminal/ReaderService.php @@ -16,7 +16,7 @@ class ReaderService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/terminal/readers', $params, $opts); + return $this->requestCollection('get', '/v1/terminal/readers', $params, $opts); } /** diff --git a/lib/Service/TopupService.php b/lib/Service/TopupService.php index 289540496..5bb0bdcb0 100644 --- a/lib/Service/TopupService.php +++ b/lib/Service/TopupService.php @@ -16,7 +16,7 @@ class TopupService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/topups', $params, $opts); + return $this->requestCollection('get', '/v1/topups', $params, $opts); } /** diff --git a/lib/Service/TransferService.php b/lib/Service/TransferService.php index 830823ca9..2f6acebfa 100644 --- a/lib/Service/TransferService.php +++ b/lib/Service/TransferService.php @@ -18,7 +18,7 @@ class TransferService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/transfers', $params, $opts); + return $this->requestCollection('get', '/v1/transfers', $params, $opts); } /** @@ -38,7 +38,7 @@ public function all($params = null, $opts = null) */ public function allReversals($parentId, $params = null, $opts = null) { - return $this->request('get', $this->buildPath('/v1/transfers/%s/reversals', $parentId), $params, $opts); + return $this->requestCollection('get', $this->buildPath('/v1/transfers/%s/reversals', $parentId), $params, $opts); } /** diff --git a/lib/Service/WebhookEndpointService.php b/lib/Service/WebhookEndpointService.php index b90e3fe30..eeac8fd84 100644 --- a/lib/Service/WebhookEndpointService.php +++ b/lib/Service/WebhookEndpointService.php @@ -16,7 +16,7 @@ class WebhookEndpointService extends \Stripe\Service\AbstractService */ public function all($params = null, $opts = null) { - return $this->request('get', '/v1/webhook_endpoints', $params, $opts); + return $this->requestCollection('get', '/v1/webhook_endpoints', $params, $opts); } /**