From 4070e9ba070d37826efe12d2d1b4d9bad3944ca6 Mon Sep 17 00:00:00 2001 From: Richard Marmorstein Date: Thu, 3 Jun 2021 13:45:33 -0400 Subject: [PATCH] Codegen for openapi 1ad8d09 --- init.php | 2 ++ lib/Checkout/Session.php | 1 + lib/Customer.php | 1 + lib/Invoice.php | 1 + lib/Price.php | 5 ++++ lib/Product.php | 1 + lib/Service/CoreServiceFactory.php | 2 ++ lib/Service/TaxCodeService.php | 41 ++++++++++++++++++++++++++++++ lib/StripeClient.php | 1 + lib/Subscription.php | 1 + lib/TaxCode.php | 22 ++++++++++++++++ lib/TaxRate.php | 8 ++++++ lib/Util/ObjectTypes.php | 1 + 13 files changed, 87 insertions(+) create mode 100644 lib/Service/TaxCodeService.php create mode 100644 lib/TaxCode.php diff --git a/init.php b/init.php index cb87abaf1..b242ddf81 100644 --- a/init.php +++ b/init.php @@ -146,6 +146,7 @@ require __DIR__ . '/lib/Subscription.php'; require __DIR__ . '/lib/SubscriptionItem.php'; require __DIR__ . '/lib/SubscriptionSchedule.php'; +require __DIR__ . '/lib/TaxCode.php'; require __DIR__ . '/lib/TaxId.php'; require __DIR__ . '/lib/TaxRate.php'; require __DIR__ . '/lib/Terminal/ConnectionToken.php'; @@ -215,6 +216,7 @@ require __DIR__ . '/lib/Service/SubscriptionService.php'; require __DIR__ . '/lib/Service/SubscriptionItemService.php'; require __DIR__ . '/lib/Service/SubscriptionScheduleService.php'; +require __DIR__ . '/lib/Service/TaxCodeService.php'; require __DIR__ . '/lib/Service/TaxRateService.php'; require __DIR__ . '/lib/Service/Terminal/ConnectionTokenService.php'; require __DIR__ . '/lib/Service/Terminal/LocationService.php'; diff --git a/lib/Checkout/Session.php b/lib/Checkout/Session.php index f916cc04f..759c49ae8 100644 --- a/lib/Checkout/Session.php +++ b/lib/Checkout/Session.php @@ -27,6 +27,7 @@ * @property null|bool $allow_promotion_codes Enables user redeemable promotion codes. * @property null|int $amount_subtotal Total of all items before discounts or taxes are applied. * @property null|int $amount_total Total of all items after discounts and taxes are applied. + * @property \Stripe\StripeObject $automatic_tax * @property null|string $billing_address_collection Describes whether Checkout should collect the customer's billing address. * @property string $cancel_url The URL the customer will be directed to if they decide to cancel payment and return to your website. * @property null|string $client_reference_id A unique string to reference the Checkout Session. This can be a customer ID, a cart ID, or similar, and can be used to reconcile the Session with your internal systems. diff --git a/lib/Customer.php b/lib/Customer.php index c3a42cd8a..6cc983a72 100644 --- a/lib/Customer.php +++ b/lib/Customer.php @@ -36,6 +36,7 @@ * @property null|\Stripe\StripeObject $shipping Mailing and shipping address for the customer. Appears on invoices emailed to this customer. * @property \Stripe\Collection $sources The customer's payment sources, if any. * @property \Stripe\Collection $subscriptions The customer's current subscriptions, if any. + * @property \Stripe\StripeObject $tax * @property null|string $tax_exempt Describes the customer's tax exemption status. One of none, exempt, or reverse. When set to reverse, invoice and receipt PDFs include the text "Reverse charge". * @property \Stripe\Collection $tax_ids The customer's tax IDs. */ diff --git a/lib/Invoice.php b/lib/Invoice.php index 3a20cd080..5ced41d50 100644 --- a/lib/Invoice.php +++ b/lib/Invoice.php @@ -53,6 +53,7 @@ * @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. * @property bool $attempted Whether an attempt has been made to pay the invoice. An invoice is not attempted until 1 hour after the invoice.created webhook, for example, so you might not want to display that invoice as unpaid to your users. * @property bool $auto_advance Controls whether Stripe will perform automatic collection of the invoice. When false, the invoice's state will not automatically advance without an explicit action. + * @property \Stripe\StripeObject $automatic_tax * @property null|string $billing_reason Indicates the reason why the invoice was created. subscription_cycle indicates an invoice created by a subscription advancing into a new period. subscription_create indicates an invoice created due to creating a subscription. subscription_update indicates an invoice created due to updating a subscription. subscription is set for all old invoices to indicate either a change to a subscription or a period advancement. manual is set for all invoices unrelated to a subscription (for example: created via the invoice editor). The upcoming value is reserved for simulated invoices per the upcoming invoice endpoint. subscription_threshold indicates an invoice created due to a billing threshold being reached. * @property null|string|\Stripe\Charge $charge ID of the latest charge generated for this invoice, if any. * @property null|string $collection_method Either charge_automatically, or send_invoice. When charging automatically, Stripe will attempt to pay this invoice using the default source attached to the customer. When sending an invoice, Stripe will email this invoice to the customer with payment instructions. diff --git a/lib/Price.php b/lib/Price.php index 4ac5bd33c..8f994d548 100644 --- a/lib/Price.php +++ b/lib/Price.php @@ -35,6 +35,7 @@ * @property null|string $nickname A brief description of the price, hidden from customers. * @property string|\Stripe\Product $product The ID of the product this price is associated with. * @property null|\Stripe\StripeObject $recurring The recurring components of a price such as interval and usage_type. + * @property null|string $tax_behavior Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of inclusive, exclusive, or unspecified. Once specified as either inclusive or exclusive, it cannot be changed. * @property \Stripe\StripeObject[] $tiers Each element represents a pricing tier. This parameter requires billing_scheme to be set to tiered. See also the documentation for billing_scheme. * @property null|string $tiers_mode Defines if the tiering price should be graduated or volume based. In volume-based tiering, the maximum quantity within a period determines the per unit price. In graduated tiering, pricing can change as the quantity grows. * @property null|\Stripe\StripeObject $transform_quantity Apply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined with tiers. @@ -54,6 +55,10 @@ class Price extends ApiResource const BILLING_SCHEME_PER_UNIT = 'per_unit'; const BILLING_SCHEME_TIERED = 'tiered'; + const TAX_BEHAVIOR_EXCLUSIVE = 'exclusive'; + const TAX_BEHAVIOR_INCLUSIVE = 'inclusive'; + const TAX_BEHAVIOR_UNSPECIFIED = 'unspecified'; + const TIERS_MODE_GRADUATED = 'graduated'; const TIERS_MODE_VOLUME = 'volume'; diff --git a/lib/Product.php b/lib/Product.php index 265326a88..316409692 100644 --- a/lib/Product.php +++ b/lib/Product.php @@ -33,6 +33,7 @@ * @property null|\Stripe\StripeObject $package_dimensions The dimensions of this product for shipping purposes. * @property null|bool $shippable Whether this product is shipped (i.e., physical goods). * @property null|string $statement_descriptor Extra information about a product which will appear on your customer's credit card statement. In the case that multiple products are billed at once, the first statement descriptor will be used. + * @property null|string|\Stripe\TaxCode $tax_code A tax code ID. * @property string $type The type of the product. The product is either of type good, which is eligible for use with Orders and SKUs, or service, which is eligible for use with Subscriptions and Plans. * @property null|string $unit_label A label that represents units of this product in Stripe and on customers’ receipts and invoices. When set, this will be included in associated invoice line item descriptions. * @property int $updated Time at which the object was last updated. Measured in seconds since the Unix epoch. diff --git a/lib/Service/CoreServiceFactory.php b/lib/Service/CoreServiceFactory.php index 386992622..41454bd0a 100644 --- a/lib/Service/CoreServiceFactory.php +++ b/lib/Service/CoreServiceFactory.php @@ -53,6 +53,7 @@ * @property SubscriptionItemService $subscriptionItems * @property SubscriptionService $subscriptions * @property SubscriptionScheduleService $subscriptionSchedules + * @property TaxCodeService $taxCodes * @property TaxRateService $taxRates * @property Terminal\TerminalServiceFactory $terminal * @property TokenService $tokens @@ -112,6 +113,7 @@ class CoreServiceFactory extends \Stripe\Service\AbstractServiceFactory 'subscriptionItems' => SubscriptionItemService::class, 'subscriptions' => SubscriptionService::class, 'subscriptionSchedules' => SubscriptionScheduleService::class, + 'taxCodes' => TaxCodeService::class, 'taxRates' => TaxRateService::class, 'terminal' => Terminal\TerminalServiceFactory::class, 'tokens' => TokenService::class, diff --git a/lib/Service/TaxCodeService.php b/lib/Service/TaxCodeService.php new file mode 100644 index 000000000..007b77136 --- /dev/null +++ b/lib/Service/TaxCodeService.php @@ -0,0 +1,41 @@ +all tax codes + * available to add to Products in order to allow specific tax calculations. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection + */ + public function all($params = null, $opts = null) + { + return $this->requestCollection('get', '/v1/tax_codes', $params, $opts); + } + + /** + * Retrieves the details of an existing tax code. Supply the unique tax code ID and + * Stripe will return the corresponding tax code information. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\TaxCode + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/tax_codes/%s', $id), $params, $opts); + } +} diff --git a/lib/StripeClient.php b/lib/StripeClient.php index 9f780f220..ecf87dc42 100644 --- a/lib/StripeClient.php +++ b/lib/StripeClient.php @@ -53,6 +53,7 @@ * @property \Stripe\Service\SubscriptionItemService $subscriptionItems * @property \Stripe\Service\SubscriptionScheduleService $subscriptionSchedules * @property \Stripe\Service\SubscriptionService $subscriptions + * @property \Stripe\Service\TaxCodeService $taxCodes * @property \Stripe\Service\TaxRateService $taxRates * @property \Stripe\Service\Terminal\TerminalServiceFactory $terminal * @property \Stripe\Service\TokenService $tokens diff --git a/lib/Subscription.php b/lib/Subscription.php index fcb55a31d..a768ac187 100644 --- a/lib/Subscription.php +++ b/lib/Subscription.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 null|float $application_fee_percent A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice subtotal that will be transferred to the application owner's Stripe account. + * @property \Stripe\StripeObject $automatic_tax * @property int $billing_cycle_anchor Determines the date of the first full invoice, and, for plans with month or year intervals, the day of the month for subsequent invoices. * @property null|\Stripe\StripeObject $billing_thresholds Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period * @property null|int $cancel_at A date in the future at which the subscription will automatically get canceled diff --git a/lib/TaxCode.php b/lib/TaxCode.php new file mode 100644 index 000000000..bfdbf03ac --- /dev/null +++ b/lib/TaxCode.php @@ -0,0 +1,22 @@ +Tax codes classify goods and + * services for tax purposes. + * + * @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 string $description A detailed description of which types of products the tax code represents. + * @property string $name A short name for the tax code. + */ +class TaxCode extends ApiResource +{ + const OBJECT_NAME = 'tax_code'; + + use ApiOperations\All; + use ApiOperations\Retrieve; +} diff --git a/lib/TaxRate.php b/lib/TaxRate.php index e0ce630c3..903363893 100644 --- a/lib/TaxRate.php +++ b/lib/TaxRate.php @@ -28,6 +28,7 @@ * @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 float $percentage This represents the tax rate percent out of 100. * @property null|string $state ISO 3166-2 subdivision code, without country prefix. For example, "NY" for New York, United States. + * @property null|string $tax_type The high-level tax type, such as vat or sales_tax. */ class TaxRate extends ApiResource { @@ -37,4 +38,11 @@ class TaxRate extends ApiResource use ApiOperations\Create; use ApiOperations\Retrieve; use ApiOperations\Update; + + const TAX_TYPE_GST = 'gst'; + const TAX_TYPE_HST = 'hst'; + const TAX_TYPE_PST = 'pst'; + const TAX_TYPE_QST = 'qst'; + const TAX_TYPE_SALES_TAX = 'sales_tax'; + const TAX_TYPE_VAT = 'vat'; } diff --git a/lib/Util/ObjectTypes.php b/lib/Util/ObjectTypes.php index dea2104fe..66247609b 100644 --- a/lib/Util/ObjectTypes.php +++ b/lib/Util/ObjectTypes.php @@ -85,6 +85,7 @@ class ObjectTypes \Stripe\Subscription::OBJECT_NAME => \Stripe\Subscription::class, \Stripe\SubscriptionItem::OBJECT_NAME => \Stripe\SubscriptionItem::class, \Stripe\SubscriptionSchedule::OBJECT_NAME => \Stripe\SubscriptionSchedule::class, + \Stripe\TaxCode::OBJECT_NAME => \Stripe\TaxCode::class, \Stripe\TaxId::OBJECT_NAME => \Stripe\TaxId::class, \Stripe\TaxRate::OBJECT_NAME => \Stripe\TaxRate::class, \Stripe\Terminal\ConnectionToken::OBJECT_NAME => \Stripe\Terminal\ConnectionToken::class,