diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index a02063ef6..ad548b855 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1230 +v1260 \ No newline at end of file diff --git a/init.php b/init.php index 66d9183ce..63fcfe467 100644 --- a/init.php +++ b/init.php @@ -140,6 +140,7 @@ require __DIR__ . '/lib/Invoice.php'; require __DIR__ . '/lib/InvoiceItem.php'; require __DIR__ . '/lib/InvoiceLineItem.php'; +require __DIR__ . '/lib/InvoiceRenderingTemplate.php'; require __DIR__ . '/lib/Issuing/Authorization.php'; require __DIR__ . '/lib/Issuing/Card.php'; require __DIR__ . '/lib/Issuing/Cardholder.php'; @@ -222,6 +223,7 @@ require __DIR__ . '/lib/Service/Identity/VerificationReportService.php'; require __DIR__ . '/lib/Service/Identity/VerificationSessionService.php'; require __DIR__ . '/lib/Service/InvoiceItemService.php'; +require __DIR__ . '/lib/Service/InvoiceRenderingTemplateService.php'; require __DIR__ . '/lib/Service/InvoiceService.php'; require __DIR__ . '/lib/Service/Issuing/AuthorizationService.php'; require __DIR__ . '/lib/Service/Issuing/CardService.php'; diff --git a/lib/Checkout/Session.php b/lib/Checkout/Session.php index 3d5689999..d00d5b148 100644 --- a/lib/Checkout/Session.php +++ b/lib/Checkout/Session.php @@ -59,7 +59,7 @@ * @property string $payment_status The payment status of the Checkout Session, one of paid, unpaid, or no_payment_required. You can use this value to decide when to fulfill your customer's order. * @property null|\Stripe\StripeObject $phone_number_collection * @property null|string $recovered_from The ID of the original expired Checkout Session that triggered the recovery flow. - * @property null|string $redirect_on_completion This parameter applies to ui_mode: embedded. Learn more about the redirect behavior of embedded sessions. Defaults to always. + * @property null|string $redirect_on_completion This parameter applies to ui_mode: embedded. Learn more about the redirect behavior of embedded sessions. Defaults to always. * @property null|string $return_url Applies to Checkout Sessions with ui_mode: embedded. The URL to redirect your customer back to after they authenticate or cancel their payment on the payment method's app or site. * @property null|\Stripe\StripeObject $saved_payment_method_options Controls saved payment method settings for the session. Only available in payment and subscription mode. * @property null|string|\Stripe\SetupIntent $setup_intent The ID of the SetupIntent for Checkout Sessions in setup mode. You can't confirm or cancel the SetupIntent for a Checkout Session. To cancel, expire the Checkout Session instead. diff --git a/lib/InvoiceLineItem.php b/lib/InvoiceLineItem.php index 6a1626171..2344d115a 100644 --- a/lib/InvoiceLineItem.php +++ b/lib/InvoiceLineItem.php @@ -30,8 +30,8 @@ * @property null|int $quantity The quantity of the subscription, if the line item is a subscription or a proration. * @property null|string|\Stripe\Subscription $subscription The subscription that the invoice item pertains to, if any. * @property null|string|\Stripe\SubscriptionItem $subscription_item The subscription item that generated this line item. Left empty if the line item is not an explicit result of a subscription. - * @property null|\Stripe\StripeObject[] $tax_amounts The amount of tax calculated per tax rate for this line item - * @property null|\Stripe\TaxRate[] $tax_rates The tax rates which apply to the line item. + * @property \Stripe\StripeObject[] $tax_amounts The amount of tax calculated per tax rate for this line item + * @property \Stripe\TaxRate[] $tax_rates The tax rates which apply to the line item. * @property string $type A string identifying the type of the source of this line item, either an invoiceitem or a subscription. * @property null|string $unit_amount_excluding_tax The amount in cents (or local equivalent) representing the unit amount for this line item, excluding all tax and discounts. */ diff --git a/lib/InvoiceRenderingTemplate.php b/lib/InvoiceRenderingTemplate.php new file mode 100644 index 000000000..576fd5945 --- /dev/null +++ b/lib/InvoiceRenderingTemplate.php @@ -0,0 +1,96 @@ +true if the object exists in live mode or the value false if the object exists in test mode. + * @property null|\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. + * @property null|string $nickname A brief description of the template, hidden from customers + * @property string $status The status of the template, one of active or archived. + * @property int $version Version of this template; version increases by one when an update on the template changes any field that controls invoice rendering + */ +class InvoiceRenderingTemplate extends ApiResource +{ + const OBJECT_NAME = 'invoice_rendering_template'; + + const STATUS_ACTIVE = 'active'; + const STATUS_ARCHIVED = 'archived'; + + /** + * List all templates, ordered by creation date, with the most recently created + * template appearing first. + * + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection<\Stripe\InvoiceRenderingTemplate> of ApiResources + */ + public static function all($params = null, $opts = null) + { + $url = static::classUrl(); + + return static::_requestPage($url, \Stripe\Collection::class, $params, $opts); + } + + /** + * Retrieves an invoice rendering template with the given ID. It by default returns + * the latest version of the template. Optionally, specify a version to see + * previous versions. + * + * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\InvoiceRenderingTemplate + */ + public static function retrieve($id, $opts = null) + { + $opts = \Stripe\Util\RequestOptions::parse($opts); + $instance = new static($id, $opts); + $instance->refresh(); + + return $instance; + } + + /** + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\InvoiceRenderingTemplate the archived invoice rendering template + */ + public function archive($params = null, $opts = null) + { + $url = $this->instanceUrl() . '/archive'; + list($response, $opts) = $this->_request('post', $url, $params, $opts); + $this->refreshFrom($response, $opts); + + return $this; + } + + /** + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\InvoiceRenderingTemplate the unarchived invoice rendering template + */ + public function unarchive($params = null, $opts = null) + { + $url = $this->instanceUrl() . '/unarchive'; + list($response, $opts) = $this->_request('post', $url, $params, $opts); + $this->refreshFrom($response, $opts); + + return $this; + } +} diff --git a/lib/Service/CoreServiceFactory.php b/lib/Service/CoreServiceFactory.php index e292c2a18..6c9af6d1b 100644 --- a/lib/Service/CoreServiceFactory.php +++ b/lib/Service/CoreServiceFactory.php @@ -37,6 +37,7 @@ * @property Forwarding\ForwardingServiceFactory $forwarding * @property Identity\IdentityServiceFactory $identity * @property InvoiceItemService $invoiceItems + * @property InvoiceRenderingTemplateService $invoiceRenderingTemplates * @property InvoiceService $invoices * @property Issuing\IssuingServiceFactory $issuing * @property MandateService $mandates @@ -114,6 +115,7 @@ class CoreServiceFactory extends \Stripe\Service\AbstractServiceFactory 'forwarding' => Forwarding\ForwardingServiceFactory::class, 'identity' => Identity\IdentityServiceFactory::class, 'invoiceItems' => InvoiceItemService::class, + 'invoiceRenderingTemplates' => InvoiceRenderingTemplateService::class, 'invoices' => InvoiceService::class, 'issuing' => Issuing\IssuingServiceFactory::class, 'mandates' => MandateService::class, diff --git a/lib/Service/InvoiceRenderingTemplateService.php b/lib/Service/InvoiceRenderingTemplateService.php new file mode 100644 index 000000000..90d8f23a5 --- /dev/null +++ b/lib/Service/InvoiceRenderingTemplateService.php @@ -0,0 +1,82 @@ + + */ + public function all($params = null, $opts = null) + { + return $this->requestCollection('get', '/v1/invoice_rendering_templates', $params, $opts); + } + + /** + * Updates the status of an invoice rendering template to ‘archived’ so no new + * Stripe objects (customers, invoices, etc.) can reference it. The template can + * also no longer be updated. However, if the template is already set on a Stripe + * object, it will continue to be applied on invoices generated by it. + * + * @param string $id + * @param null|array $params + * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\InvoiceRenderingTemplate + */ + public function archive($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/invoice_rendering_templates/%s/archive', $id), $params, $opts); + } + + /** + * Retrieves an invoice rendering template with the given ID. It by default returns + * the latest version of the template. Optionally, specify a version to see + * previous versions. + * + * @param string $id + * @param null|array $params + * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\InvoiceRenderingTemplate + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/invoice_rendering_templates/%s', $id), $params, $opts); + } + + /** + * Unarchive an invoice rendering template so it can be used on new Stripe objects + * again. + * + * @param string $id + * @param null|array $params + * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\InvoiceRenderingTemplate + */ + public function unarchive($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/invoice_rendering_templates/%s/unarchive', $id), $params, $opts); + } +} diff --git a/lib/Service/PaymentIntentService.php b/lib/Service/PaymentIntentService.php index 99aad6f3e..58b54bd33 100644 --- a/lib/Service/PaymentIntentService.php +++ b/lib/Service/PaymentIntentService.php @@ -115,7 +115,10 @@ public function capture($id, $params = null, $opts = null) * If any actions are required for the payment, the PaymentIntent will return to * the requires_confirmation state after those actions are completed. * Your server needs to then explicitly re-confirm the PaymentIntent to initiate - * the next payment attempt. + * the next payment attempt. There is a variable upper limit on how many times a + * PaymentIntent can be confirmed. After this limit is reached, any further calls + * to this endpoint will transition the PaymentIntent to the canceled + * state. * * @param string $id * @param null|array $params diff --git a/lib/StripeClient.php b/lib/StripeClient.php index 4103c5c79..d46751f14 100644 --- a/lib/StripeClient.php +++ b/lib/StripeClient.php @@ -37,6 +37,7 @@ * @property \Stripe\Service\Forwarding\ForwardingServiceFactory $forwarding * @property \Stripe\Service\Identity\IdentityServiceFactory $identity * @property \Stripe\Service\InvoiceItemService $invoiceItems + * @property \Stripe\Service\InvoiceRenderingTemplateService $invoiceRenderingTemplates * @property \Stripe\Service\InvoiceService $invoices * @property \Stripe\Service\Issuing\IssuingServiceFactory $issuing * @property \Stripe\Service\MandateService $mandates diff --git a/lib/TestHelpers/TestClock.php b/lib/TestHelpers/TestClock.php index cd9fc4456..361b2692f 100644 --- a/lib/TestHelpers/TestClock.php +++ b/lib/TestHelpers/TestClock.php @@ -17,7 +17,7 @@ * @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 null|string $name The custom name supplied at creation. * @property string $status The status of the Test Clock. - * @property null|\Stripe\StripeObject $status_details + * @property \Stripe\StripeObject $status_details */ class TestClock extends \Stripe\ApiResource { diff --git a/lib/Transfer.php b/lib/Transfer.php index d0b766db8..16c7b1b28 100644 --- a/lib/Transfer.php +++ b/lib/Transfer.php @@ -30,7 +30,7 @@ * @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. * @property \Stripe\Collection<\Stripe\TransferReversal> $reversals A list of reversals that have been applied to the transfer. * @property bool $reversed Whether the transfer has been fully reversed. If the transfer is only partially reversed, this attribute will still be false. - * @property null|string|\Stripe\Charge $source_transaction ID of the charge or payment that was used to fund the transfer. If null, the transfer was funded from the available balance. + * @property null|string|\Stripe\Charge $source_transaction ID of the charge that was used to fund the transfer. If null, the transfer was funded from the available balance. * @property null|string $source_type The source balance this transfer came from. One of card, fpx, or bank_account. * @property null|string $transfer_group A string that identifies this transaction as part of a group. See the Connect documentation for details. */ diff --git a/lib/Util/ObjectTypes.php b/lib/Util/ObjectTypes.php index c79cc6bb6..cbe5a4f70 100644 --- a/lib/Util/ObjectTypes.php +++ b/lib/Util/ObjectTypes.php @@ -73,6 +73,7 @@ class ObjectTypes \Stripe\Invoice::OBJECT_NAME => \Stripe\Invoice::class, \Stripe\InvoiceItem::OBJECT_NAME => \Stripe\InvoiceItem::class, \Stripe\InvoiceLineItem::OBJECT_NAME => \Stripe\InvoiceLineItem::class, + \Stripe\InvoiceRenderingTemplate::OBJECT_NAME => \Stripe\InvoiceRenderingTemplate::class, \Stripe\Issuing\Authorization::OBJECT_NAME => \Stripe\Issuing\Authorization::class, \Stripe\Issuing\Card::OBJECT_NAME => \Stripe\Issuing\Card::class, \Stripe\Issuing\Cardholder::OBJECT_NAME => \Stripe\Issuing\Cardholder::class,