From e9aa43da074f3b35a20d6aadcd26398ffcfa14df Mon Sep 17 00:00:00 2001 From: "stripe-openapi[bot]" <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Thu, 13 Jul 2023 15:04:35 -0700 Subject: [PATCH 1/2] Update generated code (#1525) * Update generated code for v412 * Update generated code for v413 * Update generated code for v417 --------- Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> --- OPENAPI_VERSION | 2 +- init.php | 2 ++ lib/ErrorObject.php | 1 + lib/Event.php | 1 + lib/Service/Tax/SettingsService.php | 39 +++++++++++++++++++++++++++ lib/Service/Tax/TaxServiceFactory.php | 2 ++ lib/Tax/CalculationLineItem.php | 2 +- lib/Tax/Settings.php | 28 +++++++++++++++++++ lib/Tax/TransactionLineItem.php | 1 + lib/Util/ObjectTypes.php | 1 + 10 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 lib/Service/Tax/SettingsService.php create mode 100644 lib/Tax/Settings.php diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 103b9dcfb..bfd5e01b8 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v406 \ No newline at end of file +v417 \ No newline at end of file diff --git a/init.php b/init.php index 1245ac502..d29224803 100644 --- a/init.php +++ b/init.php @@ -214,6 +214,7 @@ require __DIR__ . '/lib/Service/SubscriptionScheduleService.php'; require __DIR__ . '/lib/Service/SubscriptionService.php'; require __DIR__ . '/lib/Service/Tax/CalculationService.php'; +require __DIR__ . '/lib/Service/Tax/SettingsService.php'; require __DIR__ . '/lib/Service/Tax/TaxServiceFactory.php'; require __DIR__ . '/lib/Service/Tax/TransactionService.php'; require __DIR__ . '/lib/Service/TaxCodeService.php'; @@ -263,6 +264,7 @@ require __DIR__ . '/lib/SubscriptionSchedule.php'; require __DIR__ . '/lib/Tax/Calculation.php'; require __DIR__ . '/lib/Tax/CalculationLineItem.php'; +require __DIR__ . '/lib/Tax/Settings.php'; require __DIR__ . '/lib/Tax/Transaction.php'; require __DIR__ . '/lib/Tax/TransactionLineItem.php'; require __DIR__ . '/lib/TaxCode.php'; diff --git a/lib/ErrorObject.php b/lib/ErrorObject.php index b15a86a8a..c5a8cfa68 100644 --- a/lib/ErrorObject.php +++ b/lib/ErrorObject.php @@ -107,6 +107,7 @@ class ErrorObject extends StripeObject const CODE_INVALID_EXPIRY_YEAR = 'invalid_expiry_year'; const CODE_INVALID_NUMBER = 'invalid_number'; const CODE_INVALID_SOURCE_USAGE = 'invalid_source_usage'; + const CODE_INVALID_TAX_LOCATION = 'invalid_tax_location'; const CODE_INVOICE_NO_CUSTOMER_LINE_ITEMS = 'invoice_no_customer_line_items'; const CODE_INVOICE_NO_PAYMENT_METHOD_TYPES = 'invoice_no_payment_method_types'; const CODE_INVOICE_NO_SUBSCRIPTION_LINE_ITEMS = 'invoice_no_subscription_line_items'; diff --git a/lib/Event.php b/lib/Event.php index 296290375..cae3e9f62 100644 --- a/lib/Event.php +++ b/lib/Event.php @@ -233,6 +233,7 @@ class Event extends ApiResource const SUBSCRIPTION_SCHEDULE_EXPIRING = 'subscription_schedule.expiring'; const SUBSCRIPTION_SCHEDULE_RELEASED = 'subscription_schedule.released'; const SUBSCRIPTION_SCHEDULE_UPDATED = 'subscription_schedule.updated'; + const TAX_SETTINGS_UPDATED = 'tax.settings.updated'; const TAX_RATE_CREATED = 'tax_rate.created'; const TAX_RATE_UPDATED = 'tax_rate.updated'; const TERMINAL_READER_ACTION_FAILED = 'terminal.reader.action_failed'; diff --git a/lib/Service/Tax/SettingsService.php b/lib/Service/Tax/SettingsService.php new file mode 100644 index 000000000..90eebbfef --- /dev/null +++ b/lib/Service/Tax/SettingsService.php @@ -0,0 +1,39 @@ +Settings for a merchant. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Tax\Settings + */ + public function retrieve($params = null, $opts = null) + { + return $this->request('get', '/v1/tax/settings', $params, $opts); + } + + /** + * Updates Tax Settings parameters used in tax calculations. All + * parameters are editable but none can be removed once set. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Tax\Settings + */ + public function update($params = null, $opts = null) + { + return $this->request('post', '/v1/tax/settings', $params, $opts); + } +} diff --git a/lib/Service/Tax/TaxServiceFactory.php b/lib/Service/Tax/TaxServiceFactory.php index 6f645a17d..9429c016d 100644 --- a/lib/Service/Tax/TaxServiceFactory.php +++ b/lib/Service/Tax/TaxServiceFactory.php @@ -8,6 +8,7 @@ * Service factory class for API resources in the Tax namespace. * * @property CalculationService $calculations + * @property SettingsService $settings * @property TransactionService $transactions */ class TaxServiceFactory extends \Stripe\Service\AbstractServiceFactory @@ -17,6 +18,7 @@ class TaxServiceFactory extends \Stripe\Service\AbstractServiceFactory */ private static $classMap = [ 'calculations' => CalculationService::class, + 'settings' => SettingsService::class, 'transactions' => TransactionService::class, ]; diff --git a/lib/Tax/CalculationLineItem.php b/lib/Tax/CalculationLineItem.php index 38280aa5b..8e25c5ec4 100644 --- a/lib/Tax/CalculationLineItem.php +++ b/lib/Tax/CalculationLineItem.php @@ -10,7 +10,7 @@ * @property int $amount The line item amount in integer cents. If tax_behavior=inclusive, then this amount includes taxes. Otherwise, taxes were calculated on top of this amount. * @property int $amount_tax The amount of tax calculated for this line item, in integer cents. * @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 $product A Product ID. + * @property null|string $product The ID of an existing Product. * @property int $quantity The number of units of the item being purchased. For reversals, this is the quantity reversed. * @property null|string $reference A custom identifier for this line item. * @property string $tax_behavior Specifies whether the amount includes taxes. If tax_behavior=inclusive, then the amount includes taxes. diff --git a/lib/Tax/Settings.php b/lib/Tax/Settings.php new file mode 100644 index 000000000..6a1e1d756 --- /dev/null +++ b/lib/Tax/Settings.php @@ -0,0 +1,28 @@ +Settings to manage configurations used by Stripe Tax calculations. + * + * Related guide: Using the Settings API + * + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property \Stripe\StripeObject $defaults + * @property null|\Stripe\StripeObject $head_office The place where your business is located. + * @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 string $status The active status indicates you have all required settings to calculate tax. A status can transition out of active when new required settings are introduced. + * @property \Stripe\StripeObject $status_details + */ +class Settings extends \Stripe\SingletonApiResource +{ + const OBJECT_NAME = 'tax.settings'; + + use \Stripe\ApiOperations\SingletonRetrieve; + use \Stripe\ApiOperations\Update; + + const STATUS_ACTIVE = 'active'; + const STATUS_PENDING = 'pending'; +} diff --git a/lib/Tax/TransactionLineItem.php b/lib/Tax/TransactionLineItem.php index f5db49205..546518a59 100644 --- a/lib/Tax/TransactionLineItem.php +++ b/lib/Tax/TransactionLineItem.php @@ -11,6 +11,7 @@ * @property int $amount_tax The amount of tax calculated for this line item, in integer cents. * @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|\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 $product The ID of an existing Product. * @property int $quantity The number of units of the item being purchased. For reversals, this is the quantity reversed. * @property string $reference A custom identifier for this line item in the transaction. * @property null|\Stripe\StripeObject $reversal If type=reversal, contains information about what was reversed. diff --git a/lib/Util/ObjectTypes.php b/lib/Util/ObjectTypes.php index e7459991c..60538f08c 100644 --- a/lib/Util/ObjectTypes.php +++ b/lib/Util/ObjectTypes.php @@ -90,6 +90,7 @@ class ObjectTypes \Stripe\SubscriptionSchedule::OBJECT_NAME => \Stripe\SubscriptionSchedule::class, \Stripe\Tax\Calculation::OBJECT_NAME => \Stripe\Tax\Calculation::class, \Stripe\Tax\CalculationLineItem::OBJECT_NAME => \Stripe\Tax\CalculationLineItem::class, + \Stripe\Tax\Settings::OBJECT_NAME => \Stripe\Tax\Settings::class, \Stripe\Tax\Transaction::OBJECT_NAME => \Stripe\Tax\Transaction::class, \Stripe\Tax\TransactionLineItem::OBJECT_NAME => \Stripe\Tax\TransactionLineItem::class, \Stripe\TaxCode::OBJECT_NAME => \Stripe\TaxCode::class, From 73383b44de153f4d602b90dad3ef075259bcecef Mon Sep 17 00:00:00 2001 From: Annie Li Date: Thu, 13 Jul 2023 15:12:18 -0700 Subject: [PATCH 2/2] Bump version to 10.17.0 --- CHANGELOG.md | 10 ++++++++++ VERSION | 2 +- lib/Stripe.php | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8e8eac5c..127b2bac8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## 10.17.0 - 2023-07-13 +* [#1525](https://github.com/stripe/stripe-php/pull/1525) Update generated code + * Add support for new resource `Tax.Settings` + * Add support for `retrieve` and `update` methods on resource `Settings` + * Add support for new value `invalid_tax_location` on enum `StripeError.code` + * Add support for `product` on `Tax.TransactionLineItem` + * Add constant for `tax.settings.updated` webhook event +* [#1520](https://github.com/stripe/stripe-php/pull/1520) Update generated code + * Release specs are identical. + ## 10.16.0 - 2023-06-29 * [#1517](https://github.com/stripe/stripe-php/pull/1517) Update generated code * Add support for new value `application_fees_not_allowed` on enum `StripeError.code` diff --git a/VERSION b/VERSION index 5007551bf..73bffb039 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -10.16.0 +10.17.0 diff --git a/lib/Stripe.php b/lib/Stripe.php index a525303eb..8c335bfc9 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.16.0'; + const VERSION = '10.17.0'; /** * @return string the API key used for requests