diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index f3da18c95..4e134f2a9 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v219 \ No newline at end of file +v223 \ No newline at end of file diff --git a/lib/CreditNote.php b/lib/CreditNote.php index b950087fa..65425e12a 100644 --- a/lib/CreditNote.php +++ b/lib/CreditNote.php @@ -14,6 +14,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 int $amount The integer amount in %s representing the total amount of the credit note, including tax. + * @property int $amount_shipping This is the sum of all the shipping amounts. * @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. * @property string|\Stripe\Customer $customer ID of the customer. @@ -30,6 +31,7 @@ * @property string $pdf The link to download the PDF of the credit note. * @property null|string $reason Reason for issuing this credit note, one of duplicate, fraudulent, order_change, or product_unsatisfactory * @property null|string|\Stripe\Refund $refund Refund related to this credit note. + * @property null|\Stripe\StripeObject $shipping_cost The details of the cost of shipping, including the ShippingRate applied to the invoice. * @property string $status Status of this credit note, one of issued or void. Learn more about voiding credit notes. * @property int $subtotal The integer amount in %s representing the amount of the credit note, excluding exclusive tax and invoice level discounts. * @property null|int $subtotal_excluding_tax The integer amount in %s representing the amount of the credit note, excluding all tax and invoice level discounts. diff --git a/lib/CustomerCashBalanceTransaction.php b/lib/CustomerCashBalanceTransaction.php index 143875a4f..f492bb623 100644 --- a/lib/CustomerCashBalanceTransaction.php +++ b/lib/CustomerCashBalanceTransaction.php @@ -34,6 +34,7 @@ class CustomerCashBalanceTransaction extends ApiResource const TYPE_APPLIED_TO_PAYMENT = 'applied_to_payment'; const TYPE_FUNDED = 'funded'; + const TYPE_FUNDING_REVERSED = 'funding_reversed'; const TYPE_REFUNDED_FROM_PAYMENT = 'refunded_from_payment'; const TYPE_RETURN_CANCELED = 'return_canceled'; const TYPE_RETURN_INITIATED = 'return_initiated'; diff --git a/lib/Event.php b/lib/Event.php index 360943f61..51731d54c 100644 --- a/lib/Event.php +++ b/lib/Event.php @@ -109,8 +109,10 @@ class Event extends ApiResource const CUSTOMER_SOURCE_UPDATED = 'customer.source.updated'; const CUSTOMER_SUBSCRIPTION_CREATED = 'customer.subscription.created'; const CUSTOMER_SUBSCRIPTION_DELETED = 'customer.subscription.deleted'; + const CUSTOMER_SUBSCRIPTION_PAUSED = 'customer.subscription.paused'; const CUSTOMER_SUBSCRIPTION_PENDING_UPDATE_APPLIED = 'customer.subscription.pending_update_applied'; const CUSTOMER_SUBSCRIPTION_PENDING_UPDATE_EXPIRED = 'customer.subscription.pending_update_expired'; + const CUSTOMER_SUBSCRIPTION_RESUMED = 'customer.subscription.resumed'; const CUSTOMER_SUBSCRIPTION_TRIAL_WILL_END = 'customer.subscription.trial_will_end'; const CUSTOMER_SUBSCRIPTION_UPDATED = 'customer.subscription.updated'; const CUSTOMER_TAX_ID_CREATED = 'customer.tax_id.created'; diff --git a/lib/Invoice.php b/lib/Invoice.php index 490724256..eb5aa469b 100644 --- a/lib/Invoice.php +++ b/lib/Invoice.php @@ -49,6 +49,7 @@ * @property int $amount_due Final amount due at this time for this invoice. If the invoice's total is smaller than the minimum charge amount, for example, or if there is account credit that can be applied to the invoice, the amount_due may be 0. If there is a positive starting_balance for the invoice (the customer owes money), the amount_due will also take that into account. The charge that gets generated for the invoice will be for the amount specified in amount_due. * @property int $amount_paid The amount, in %s, that was paid. * @property int $amount_remaining The difference between amount_due and amount_paid, in %s. + * @property int $amount_shipping This is the sum of all the shipping amounts. * @property null|string|\Stripe\StripeObject $application ID of the Connect Application that created the invoice. * @property null|int $application_fee_amount The fee in %s that will be applied to the invoice and transferred to the application owner's Stripe account when the invoice is paid. * @property int $attempt_count Number of payment attempts made for this invoice, from the perspective of the payment retry schedule. Any payment attempt counts as the first attempt, and subsequently only automatic retries increment the attempt count. In other words, manual payment attempts after the first attempt do not affect the retry schedule. @@ -100,6 +101,8 @@ * @property null|string|\Stripe\Quote $quote The quote this invoice was generated from. * @property null|string $receipt_number This is the transaction number that appears on email receipts sent for this invoice. * @property null|\Stripe\StripeObject $rendering_options Options for invoice PDF rendering. + * @property null|\Stripe\StripeObject $shipping_cost The details of the cost of shipping, including the ShippingRate applied on the invoice. + * @property null|\Stripe\StripeObject $shipping_details Shipping details for the invoice. The Invoice PDF will use the shipping_details value if it is set, otherwise the PDF will render the shipping address from the customer. * @property int $starting_balance Starting customer balance before the invoice is finalized. If the invoice has not been finalized yet, this will be the current customer balance. For revision invoices, this also includes any customer balance that was applied to the original invoice. * @property null|string $statement_descriptor Extra information about an invoice for the customer's credit card statement. * @property null|string $status The status of the invoice, one of draft, open, paid, uncollectible, or void. Learn more diff --git a/lib/PaymentLink.php b/lib/PaymentLink.php index 5c3462e69..eeeecc4ff 100644 --- a/lib/PaymentLink.php +++ b/lib/PaymentLink.php @@ -30,6 +30,7 @@ * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. * @property \Stripe\StripeObject $custom_text * @property string $customer_creation Configuration for Customer creation during checkout. + * @property null|\Stripe\StripeObject $invoice_creation Configuration for creating invoice for payment mode payment links. * @property \Stripe\Collection<\Stripe\LineItem> $line_items The line items representing what is being sold. * @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 \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. diff --git a/lib/Service/SubscriptionService.php b/lib/Service/SubscriptionService.php index f81310c11..dcbc8e648 100644 --- a/lib/Service/SubscriptionService.php +++ b/lib/Service/SubscriptionService.php @@ -97,6 +97,27 @@ public function deleteDiscount($id, $params = null, $opts = null) return $this->request('delete', $this->buildPath('/v1/subscriptions/%s/discount', $id), $params, $opts); } + /** + * Initiates resumption of a paused subscription, optionally resetting the billing + * cycle anchor and creating prorations. If a resumption invoice is generated, it + * must be paid or marked uncollectible before the subscription will be unpaused. + * If payment succeeds the subscription will become active, and if + * payment fails the subscription will be past_due. The resumption + * invoice will void automatically if not paid by the expiration date. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Subscription + */ + public function resume($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/subscriptions/%s/resume', $id), $params, $opts); + } + /** * Retrieves the subscription with the given ID. * diff --git a/lib/StripeClient.php b/lib/StripeClient.php index 5ae09360c..73522abc7 100644 --- a/lib/StripeClient.php +++ b/lib/StripeClient.php @@ -72,27 +72,12 @@ class StripeClient extends BaseStripeClient */ private $coreServiceFactory; - /** - * @param $name - * - * @return null|Service\AbstractService|Service\AbstractServiceFactory - */ public function __get($name) - { - return $this->getService($name); - } - - /** - * @param $name - * - * @return null|Service\AbstractService|Service\AbstractServiceFactory - */ - public function getService($name) { if (null === $this->coreServiceFactory) { $this->coreServiceFactory = new \Stripe\Service\CoreServiceFactory($this); } - return $this->coreServiceFactory->getService($name); + return $this->coreServiceFactory->__get($name); } } diff --git a/lib/Subscription.php b/lib/Subscription.php index 0c7a8209b..29dd681f9 100644 --- a/lib/Subscription.php +++ b/lib/Subscription.php @@ -51,6 +51,7 @@ * @property null|string|\Stripe\TestHelpers\TestClock $test_clock ID of the test clock this subscription belongs to. * @property null|\Stripe\StripeObject $transfer_data The account (if any) the subscription's payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the subscription's invoices. * @property null|int $trial_end If the subscription has a trial, the end of that trial. + * @property null|\Stripe\StripeObject $trial_settings Settings related to subscription trials. * @property null|int $trial_start If the subscription has a trial, the beginning of that trial. */ class Subscription extends ApiResource @@ -77,6 +78,7 @@ class Subscription extends ApiResource const STATUS_INCOMPLETE = 'incomplete'; const STATUS_INCOMPLETE_EXPIRED = 'incomplete_expired'; const STATUS_PAST_DUE = 'past_due'; + const STATUS_PAUSED = 'paused'; const STATUS_TRIALING = 'trialing'; const STATUS_UNPAID = 'unpaid'; @@ -130,6 +132,23 @@ public function cancel($params = null, $opts = null) return $this; } + /** + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Subscription the resumed subscription + */ + public function resume($params = null, $opts = null) + { + $url = $this->instanceUrl() . '/resume'; + list($response, $opts) = $this->_request('post', $url, $params, $opts); + $this->refreshFrom($response, $opts); + + return $this; + } + /** * @param null|array $params * @param null|array|string $opts diff --git a/tests/Stripe/GeneratedExamplesTest.php b/tests/Stripe/GeneratedExamplesTest.php index 994d3c2bb..f07962da9 100644 --- a/tests/Stripe/GeneratedExamplesTest.php +++ b/tests/Stripe/GeneratedExamplesTest.php @@ -725,6 +725,16 @@ public function testUpdateCapability() static::assertInstanceOf(\Stripe\Capability::class, $result); } + public function testResumeSubscription() + { + $this->expectsRequest('post', '/v1/subscriptions/sub_xxxxxxxxxxxxx/resume'); + $result = $this->client->subscriptions->resume( + 'sub_xxxxxxxxxxxxx', + ['proration_date' => 1675400000, 'proration_behavior' => 'always_invoice'] + ); + static::assertInstanceOf(\Stripe\Subscription::class, $result); + } + public function testCreateLoginLink() { $this->expectsRequest(