From 74581ac3633cda47e40112feb9cb3b387662504e Mon Sep 17 00:00:00 2001 From: Flavius Cosmin Date: Sat, 4 Mar 2023 02:53:19 +0200 Subject: [PATCH 1/6] Update CustomerService.php (#1446) fix the return type hint Co-authored-by: pakrym-stripe <99349468+pakrym-stripe@users.noreply.github.com> --- lib/Service/CustomerService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Service/CustomerService.php b/lib/Service/CustomerService.php index 5cb7910a2..1592f04ef 100644 --- a/lib/Service/CustomerService.php +++ b/lib/Service/CustomerService.php @@ -337,7 +337,7 @@ public function retrieveCashBalanceTransaction($parentId, $id, $params = null, $ * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Customer + * @return \Stripe\PaymentMethod */ public function retrievePaymentMethod($parentId, $id, $params = null, $opts = null) { From ff447d95bebb6e3bb0c5c455015606cbd0f079e8 Mon Sep 17 00:00:00 2001 From: anniel-stripe <97691964+anniel-stripe@users.noreply.github.com> Date: Thu, 9 Mar 2023 11:40:49 -0800 Subject: [PATCH 2/6] Codegen for openapi v249 (#1450) --- OPENAPI_VERSION | 2 +- lib/Service/CustomerService.php | 10 +++++----- lib/Service/SourceService.php | 2 +- lib/Service/SubscriptionService.php | 2 +- lib/Service/TestHelpers/CustomerService.php | 2 +- lib/Service/Treasury/FinancialAccountService.php | 4 ++-- lib/Subscription.php | 1 + 7 files changed, 12 insertions(+), 11 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index eb6678972..f93f657af 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v237 \ No newline at end of file +v249 \ No newline at end of file diff --git a/lib/Service/CustomerService.php b/lib/Service/CustomerService.php index 1592f04ef..c934503cf 100644 --- a/lib/Service/CustomerService.php +++ b/lib/Service/CustomerService.php @@ -81,7 +81,7 @@ public function allPaymentMethods($id, $params = null, $opts = null) * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Collection<\Stripe\BankAccount|\Stripe\Card|\Stripe\Source> + * @return \Stripe\Collection<\Stripe\Account|\Stripe\BankAccount|\Stripe\Card|\Stripe\Source> */ public function allSources($parentId, $params = null, $opts = null) { @@ -149,7 +149,7 @@ public function createBalanceTransaction($parentId, $params = null, $opts = null * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Customer + * @return \Stripe\FundingInstructions */ public function createFundingInstructions($id, $params = null, $opts = null) { @@ -171,7 +171,7 @@ public function createFundingInstructions($id, $params = null, $opts = null) * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\BankAccount|\Stripe\Card|\Stripe\Source + * @return \Stripe\Account|\Stripe\BankAccount|\Stripe\Card|\Stripe\Source */ public function createSource($parentId, $params = null, $opts = null) { @@ -220,7 +220,7 @@ public function delete($id, $params = null, $opts = null) * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Customer + * @return \Stripe\Discount */ public function deleteDiscount($id, $params = null, $opts = null) { @@ -354,7 +354,7 @@ public function retrievePaymentMethod($parentId, $id, $params = null, $opts = nu * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\BankAccount|\Stripe\Card|\Stripe\Source + * @return \Stripe\Account|\Stripe\BankAccount|\Stripe\Card|\Stripe\Source */ public function retrieveSource($parentId, $id, $params = null, $opts = null) { diff --git a/lib/Service/SourceService.php b/lib/Service/SourceService.php index b55717883..e3c2b6445 100644 --- a/lib/Service/SourceService.php +++ b/lib/Service/SourceService.php @@ -47,7 +47,7 @@ public function create($params = null, $opts = null) * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Source + * @return \Stripe\Account|\Stripe\BankAccount|\Stripe\Card|\Stripe\Source */ public function detach($parentId, $id, $params = null, $opts = null) { diff --git a/lib/Service/SubscriptionService.php b/lib/Service/SubscriptionService.php index dcbc8e648..31e2aa51c 100644 --- a/lib/Service/SubscriptionService.php +++ b/lib/Service/SubscriptionService.php @@ -90,7 +90,7 @@ public function create($params = null, $opts = null) * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Subscription + * @return \Stripe\Discount */ public function deleteDiscount($id, $params = null, $opts = null) { diff --git a/lib/Service/TestHelpers/CustomerService.php b/lib/Service/TestHelpers/CustomerService.php index c46b57975..b65882838 100644 --- a/lib/Service/TestHelpers/CustomerService.php +++ b/lib/Service/TestHelpers/CustomerService.php @@ -15,7 +15,7 @@ class CustomerService extends \Stripe\Service\AbstractService * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Customer + * @return \Stripe\CustomerCashBalanceTransaction */ public function fundCashBalance($id, $params = null, $opts = null) { diff --git a/lib/Service/Treasury/FinancialAccountService.php b/lib/Service/Treasury/FinancialAccountService.php index f273bd9c1..7aa4791ca 100644 --- a/lib/Service/Treasury/FinancialAccountService.php +++ b/lib/Service/Treasury/FinancialAccountService.php @@ -62,7 +62,7 @@ public function retrieve($id, $params = null, $opts = null) * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Treasury\FinancialAccount + * @return \Stripe\Treasury\FinancialAccountFeatures */ public function retrieveFeatures($id, $params = null, $opts = null) { @@ -94,7 +94,7 @@ public function update($id, $params = null, $opts = null) * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Treasury\FinancialAccount + * @return \Stripe\Treasury\FinancialAccountFeatures */ public function updateFeatures($id, $params = null, $opts = null) { diff --git a/lib/Subscription.php b/lib/Subscription.php index 29dd681f9..a6b99670d 100644 --- a/lib/Subscription.php +++ b/lib/Subscription.php @@ -21,6 +21,7 @@ * @property null|int $cancel_at A date in the future at which the subscription will automatically get canceled * @property bool $cancel_at_period_end If the subscription has been canceled with the at_period_end flag set to true, cancel_at_period_end on the subscription will be true. You can use this attribute to determine whether a subscription that has a status of active is scheduled to be canceled at the end of the current period. * @property null|int $canceled_at If the subscription has been canceled, the date of that cancellation. If the subscription was canceled with cancel_at_period_end, canceled_at will reflect the time of the most recent update request, not the end of the subscription period when the subscription is automatically moved to a canceled state. + * @property null|\Stripe\StripeObject $cancellation_details Details about why this subscription was cancelled * @property string $collection_method Either charge_automatically, or send_invoice. When charging automatically, Stripe will attempt to pay this subscription at the end of the cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as active. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. From aa25c11fb08ce149d609de0f3e54d0238dc1ff98 Mon Sep 17 00:00:00 2001 From: Annie Li Date: Thu, 9 Mar 2023 11:55:35 -0800 Subject: [PATCH 3/6] Bump version to 10.9.0 --- CHANGELOG.md | 7 +++++++ VERSION | 2 +- lib/Stripe.php | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 04d49819a..1bfa44f43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## 10.9.0 - 2023-03-09 +* [#1450](https://github.com/stripe/stripe-php/pull/1450) API Updates + * Add support for `cancellation_details` on `Subscription` + * Fix return types on custom methods (extends https://github.com/stripe/stripe-php/pull/1446) + +* [#1446](https://github.com/stripe/stripe-php/pull/1446) stripe->customers->retrievePaymentMethod returns the wrong class (type hint) + ## 10.8.0 - 2023-03-02 * [#1447](https://github.com/stripe/stripe-php/pull/1447) API Updates * Add support for `reconciliation_status` on `Payout` diff --git a/VERSION b/VERSION index 2a3262d8a..fe6d2ac74 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -10.8.0 +10.9.0 diff --git a/lib/Stripe.php b/lib/Stripe.php index 6925fad25..118357734 100644 --- a/lib/Stripe.php +++ b/lib/Stripe.php @@ -58,7 +58,7 @@ class Stripe /** @var float Initial delay between retries, in seconds */ private static $initialNetworkRetryDelay = 0.5; - const VERSION = '10.8.0'; + const VERSION = '10.9.0'; /** * @return string the API key used for requests From 2dbddb28cfd25fa86e903dd9e3200acc958be3e1 Mon Sep 17 00:00:00 2001 From: Annie Li Date: Thu, 9 Mar 2023 12:02:22 -0800 Subject: [PATCH 4/6] Set version to 10.9.0 to simplify merge --- VERSION | 2 +- lib/Stripe.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 0ec171bb2..fe6d2ac74 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -10.9.0-beta.1 +10.9.0 diff --git a/lib/Stripe.php b/lib/Stripe.php index e7681b0fc..118357734 100644 --- a/lib/Stripe.php +++ b/lib/Stripe.php @@ -58,7 +58,7 @@ class Stripe /** @var float Initial delay between retries, in seconds */ private static $initialNetworkRetryDelay = 0.5; - const VERSION = '10.9.0-beta.1'; + const VERSION = '10.9.0'; /** * @return string the API key used for requests From 091aac9bdfba26798848c1a5dc905e2fff974bee Mon Sep 17 00:00:00 2001 From: Annie Li Date: Thu, 9 Mar 2023 12:02:23 -0800 Subject: [PATCH 5/6] Reset version to 10.9.0-beta.1 --- VERSION | 2 +- lib/Stripe.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index fe6d2ac74..0ec171bb2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -10.9.0 +10.9.0-beta.1 diff --git a/lib/Stripe.php b/lib/Stripe.php index 118357734..e7681b0fc 100644 --- a/lib/Stripe.php +++ b/lib/Stripe.php @@ -58,7 +58,7 @@ class Stripe /** @var float Initial delay between retries, in seconds */ private static $initialNetworkRetryDelay = 0.5; - const VERSION = '10.9.0'; + const VERSION = '10.9.0-beta.1'; /** * @return string the API key used for requests From 0d864818170d9d142499bfd6f96f88b5cb5d3d51 Mon Sep 17 00:00:00 2001 From: Annie Li Date: Thu, 9 Mar 2023 12:02:41 -0800 Subject: [PATCH 6/6] Codegen for openapi v249 --- lib/Service/QuoteService.php | 2 +- lib/Service/Tax/TransactionService.php | 15 --------------- lib/SubscriptionSchedule.php | 2 +- lib/Tax/Calculation.php | 2 +- lib/Tax/Transaction.php | 18 ------------------ 5 files changed, 3 insertions(+), 36 deletions(-) diff --git a/lib/Service/QuoteService.php b/lib/Service/QuoteService.php index f228ebbcf..f1aa9b333 100644 --- a/lib/Service/QuoteService.php +++ b/lib/Service/QuoteService.php @@ -85,7 +85,7 @@ public function allLineItems($id, $params = null, $opts = null) * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Collection<\Stripe\QuoteLine> + * @return \Stripe\Collection<\Stripe\Quote> */ public function allLines($id, $params = null, $opts = null) { diff --git a/lib/Service/Tax/TransactionService.php b/lib/Service/Tax/TransactionService.php index 6aa7a7da8..3148049bd 100644 --- a/lib/Service/Tax/TransactionService.php +++ b/lib/Service/Tax/TransactionService.php @@ -22,21 +22,6 @@ public function allLineItems($id, $params = null, $opts = null) return $this->requestCollection('get', $this->buildPath('/v1/tax/transactions/%s/line_items', $id), $params, $opts); } - /** - * Lists Tax Transaction objects. - * - * @param null|array $params - * @param null|array|\Stripe\Util\RequestOptions $opts - * - * @throws \Stripe\Exception\ApiErrorException if the request fails - * - * @return \Stripe\Collection<\Stripe\Tax\Transaction> - */ - public function allTransactions($params = null, $opts = null) - { - return $this->requestCollection('get', '/v1/tax/transactions', $params, $opts); - } - /** * Creates a Tax Transaction from a calculation. * diff --git a/lib/SubscriptionSchedule.php b/lib/SubscriptionSchedule.php index 18a30761e..ec0895d3f 100644 --- a/lib/SubscriptionSchedule.php +++ b/lib/SubscriptionSchedule.php @@ -15,7 +15,7 @@ * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property null|string|\Stripe\StripeObject $application ID of the Connect Application that created the schedule. - * @property null|\Stripe\StripeObject $applies_to Details to identify the subscription schedule the quote line applies to. + * @property null|\Stripe\StripeObject $applies_to * @property null|string $billing_behavior Configures when the subscription schedule generates prorations for phase transitions. Possible values are prorate_on_next_phase or prorate_up_front with the default being prorate_on_next_phase. prorate_on_next_phase will apply phase changes and generate prorations at transition time.prorate_up_front will bill for all phases within the current billing cycle up front. * @property null|int $canceled_at Time at which the subscription schedule was canceled. Measured in seconds since the Unix epoch. * @property null|int $completed_at Time at which the subscription schedule was completed. Measured in seconds since the Unix epoch. diff --git a/lib/Tax/Calculation.php b/lib/Tax/Calculation.php index 3bca5a80b..def80b97a 100644 --- a/lib/Tax/Calculation.php +++ b/lib/Tax/Calculation.php @@ -19,8 +19,8 @@ * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. * @property int $tax_amount_exclusive The amount of tax to be collected on top of the line item prices. * @property int $tax_amount_inclusive The amount of tax already included in the line item prices. - * @property \Stripe\StripeObject[] $tax_breakdown Breakdown of individual tax amounts that add up to the total. * @property int $tax_date Timestamp of date at which the tax rules and rates in effect applies for the calculation. + * @property \Stripe\StripeObject[] $tax_summary Summary of individual tax amounts that add up to the total. */ class Calculation extends \Stripe\ApiResource { diff --git a/lib/Tax/Transaction.php b/lib/Tax/Transaction.php index da7e77e4f..f392b316f 100644 --- a/lib/Tax/Transaction.php +++ b/lib/Tax/Transaction.php @@ -68,22 +68,4 @@ public static function allLineItems($id, $params = null, $opts = null) return $obj; } - - /** - * @param null|array $params - * @param null|array|string $opts - * - * @throws \Stripe\Exception\ApiErrorException if the request fails - * - * @return \Stripe\Collection<\Stripe\Tax\Transaction> list of TaxProductResourceTaxTransactions - */ - public static function allTransactions($params = null, $opts = null) - { - $url = static::classUrl(); - list($response, $opts) = static::_staticRequest('get', $url, $params, $opts); - $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts); - $obj->setLastResponse($response); - - return $obj; - } }