From b3b477ab7d9b284b6866d6874eb131d3169fe3d8 Mon Sep 17 00:00:00 2001 From: anniel-stripe <97691964+anniel-stripe@users.noreply.github.com> Date: Fri, 17 Mar 2023 15:51:08 -0700 Subject: [PATCH 1/7] Add ci-test to phony target (#944) --- Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index db5c2e28d..5efca3bf3 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,10 @@ test: venv test-nomock: venv @${VENV_NAME}/bin/tox -p auto -- --nomock $(TOX_ARGS) +ci-test: venv + ${VENV_NAME}/bin/python -m pip install -U tox-gh-actions + @${VENV_NAME}/bin/tox -p auto $(TOX_ARGS) + coveralls: venv ${VENV_NAME}/bin/python -m pip install -U coveralls @${VENV_NAME}/bin/tox -e coveralls @@ -39,8 +43,4 @@ update-version: codegen-format: fmt -.PHONY: clean codegen-format coveralls fmt fmtcheck lint test test-nomock test-travis update-version venv - -ci-test: venv - ${VENV_NAME}/bin/python -m pip install -U tox-gh-actions - @${VENV_NAME}/bin/tox -p auto $(TOX_ARGS) +.PHONY: ci-test clean codegen-format coveralls fmt fmtcheck lint test test-nomock test-travis update-version venv From 0b99abec7d4accfa650d90d7e54796b137b31f67 Mon Sep 17 00:00:00 2001 From: "stripe-openapi[bot]" <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Thu, 23 Mar 2023 13:17:25 -0700 Subject: [PATCH 2/7] Update generated code (new) (#947) * Update generated code for v275 * Update generated code for v276 --------- Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> --- OPENAPI_VERSION | 2 +- stripe/api_resources/__init__.py | 1 + stripe/api_resources/tax/__init__.py | 8 +++ stripe/api_resources/tax/calculation.py | 45 ++++++++++++++++ stripe/api_resources/tax/transaction.py | 71 +++++++++++++++++++++++++ stripe/object_classes.py | 2 + 6 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 stripe/api_resources/tax/__init__.py create mode 100644 stripe/api_resources/tax/calculation.py create mode 100644 stripe/api_resources/tax/transaction.py diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index eb6678972..bf758c50a 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v237 \ No newline at end of file +v276 \ No newline at end of file diff --git a/stripe/api_resources/__init__.py b/stripe/api_resources/__init__.py index 36129c6f8..2860ac3af 100644 --- a/stripe/api_resources/__init__.py +++ b/stripe/api_resources/__init__.py @@ -17,6 +17,7 @@ from stripe.api_resources import radar from stripe.api_resources import reporting from stripe.api_resources import sigma +from stripe.api_resources import tax from stripe.api_resources import terminal from stripe.api_resources import test_helpers from stripe.api_resources import treasury diff --git a/stripe/api_resources/tax/__init__.py b/stripe/api_resources/tax/__init__.py new file mode 100644 index 000000000..6d642cbe7 --- /dev/null +++ b/stripe/api_resources/tax/__init__.py @@ -0,0 +1,8 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from __future__ import absolute_import, division, print_function + +# flake8: noqa + +from stripe.api_resources.tax.calculation import Calculation +from stripe.api_resources.tax.transaction import Transaction diff --git a/stripe/api_resources/tax/calculation.py b/stripe/api_resources/tax/calculation.py new file mode 100644 index 000000000..a5f2a9241 --- /dev/null +++ b/stripe/api_resources/tax/calculation.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from __future__ import absolute_import, division, print_function + +from stripe import util +from stripe.api_resources.abstract import CreateableAPIResource + + +class Calculation(CreateableAPIResource): + """ + A Tax `Calculation` allows you to calculate the tax to collect from your customer. + """ + + OBJECT_NAME = "tax.calculation" + + @classmethod + def _cls_list_line_items( + cls, + calculation, + api_key=None, + stripe_version=None, + stripe_account=None, + **params + ): + return cls._static_request( + "get", + "/v1/tax/calculations/{calculation}/line_items".format( + calculation=util.sanitize_id(calculation) + ), + api_key=api_key, + stripe_version=stripe_version, + stripe_account=stripe_account, + params=params, + ) + + @util.class_method_variant("_cls_list_line_items") + def list_line_items(self, idempotency_key=None, **params): + return self._request( + "get", + "/v1/tax/calculations/{calculation}/line_items".format( + calculation=util.sanitize_id(self.get("id")) + ), + idempotency_key=idempotency_key, + params=params, + ) diff --git a/stripe/api_resources/tax/transaction.py b/stripe/api_resources/tax/transaction.py new file mode 100644 index 000000000..e435d6d3c --- /dev/null +++ b/stripe/api_resources/tax/transaction.py @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from __future__ import absolute_import, division, print_function + +from stripe import util +from stripe.api_resources.abstract import CreateableAPIResource + + +class Transaction(CreateableAPIResource): + """ + A Tax transaction records the tax collected from or refunded to your customer. + """ + + OBJECT_NAME = "tax.transaction" + + @classmethod + def create_from_calculation( + cls, api_key=None, stripe_version=None, stripe_account=None, **params + ): + return cls._static_request( + "post", + "/v1/tax/transactions/create_from_calculation", + api_key=api_key, + stripe_version=stripe_version, + stripe_account=stripe_account, + params=params, + ) + + @classmethod + def create_reversal( + cls, api_key=None, stripe_version=None, stripe_account=None, **params + ): + return cls._static_request( + "post", + "/v1/tax/transactions/create_reversal", + api_key=api_key, + stripe_version=stripe_version, + stripe_account=stripe_account, + params=params, + ) + + @classmethod + def _cls_list_line_items( + cls, + transaction, + api_key=None, + stripe_version=None, + stripe_account=None, + **params + ): + return cls._static_request( + "get", + "/v1/tax/transactions/{transaction}/line_items".format( + transaction=util.sanitize_id(transaction) + ), + api_key=api_key, + stripe_version=stripe_version, + stripe_account=stripe_account, + params=params, + ) + + @util.class_method_variant("_cls_list_line_items") + def list_line_items(self, idempotency_key=None, **params): + return self._request( + "get", + "/v1/tax/transactions/{transaction}/line_items".format( + transaction=util.sanitize_id(self.get("id")) + ), + idempotency_key=idempotency_key, + params=params, + ) diff --git a/stripe/object_classes.py b/stripe/object_classes.py index 865a7107a..22d1381dc 100644 --- a/stripe/object_classes.py +++ b/stripe/object_classes.py @@ -85,6 +85,8 @@ api_resources.Subscription.OBJECT_NAME: api_resources.Subscription, api_resources.SubscriptionItem.OBJECT_NAME: api_resources.SubscriptionItem, api_resources.SubscriptionSchedule.OBJECT_NAME: api_resources.SubscriptionSchedule, + api_resources.tax.Calculation.OBJECT_NAME: api_resources.tax.Calculation, + api_resources.tax.Transaction.OBJECT_NAME: api_resources.tax.Transaction, api_resources.TaxCode.OBJECT_NAME: api_resources.TaxCode, api_resources.TaxId.OBJECT_NAME: api_resources.TaxId, api_resources.TaxRate.OBJECT_NAME: api_resources.TaxRate, From 01ba1f75888a5d02d818168a0ecfbcd9602fbd31 Mon Sep 17 00:00:00 2001 From: "stripe-openapi[bot]" <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Thu, 23 Mar 2023 13:27:47 -0700 Subject: [PATCH 3/7] Update generated code for v277 (#948) Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> --- OPENAPI_VERSION | 2 +- tests/test_generated_examples.py | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index bf758c50a..ccddf6542 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v276 \ No newline at end of file +v277 \ No newline at end of file diff --git a/tests/test_generated_examples.py b/tests/test_generated_examples.py index e825c7cfe..b8eb73a34 100644 --- a/tests/test_generated_examples.py +++ b/tests/test_generated_examples.py @@ -2521,3 +2521,19 @@ def test_webhookendpoint_update(self, request_mock): "post", "/v1/webhook_endpoints/we_xxxxxxxxxxxxx", ) + + def test_tax_transaction_create_from_calculation(self, request_mock): + stripe.tax.Transaction.create_from_calculation( + calculation="xxx", + reference="yyy", + ) + request_mock.assert_requested( + "post", + "/v1/tax/transactions/create_from_calculation", + ) + + def test_tax_calculation_list_line_items(self, request_mock): + stripe.tax.Calculation.list_line_items("xxx") + request_mock.assert_requested( + "get", "/v1/tax/calculations/xxx/line_items" + ) From 3f3150ec624495703391176db6c88e6e53d25dec Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Thu, 23 Mar 2023 14:42:16 -0700 Subject: [PATCH 4/7] Bump version to 5.3.0 --- CHANGELOG.md | 6 ++++++ VERSION | 2 +- stripe/version.py | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 41ce6d2b9..6f5d4bff2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 5.3.0 - 2023-03-23 +* [#947](https://github.com/stripe/stripe-python/pull/947) Update generated code + * Add support for new resources `Tax.CalculationLineItem`, `Tax.Calculation`, `Tax.TransactionLineItem`, and `Tax.Transaction` + * Add support for `create` and `list_line_items` methods on resource `Calculation` + * Add support for `create_from_calculation`, `create_reversal`, `create`, `list_line_items`, and `retrieve` methods on resource `Transaction` + ## 5.2.0 - 2023-02-16 * [#924](https://github.com/stripe/stripe-python/pull/924) API Updates * Add support for `refund_payment` method on resource `Terminal.Reader` diff --git a/VERSION b/VERSION index 91ff57278..03f488b07 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5.2.0 +5.3.0 diff --git a/stripe/version.py b/stripe/version.py index 221603aa8..01997c309 100644 --- a/stripe/version.py +++ b/stripe/version.py @@ -1 +1 @@ -VERSION = "5.2.0" +VERSION = "5.3.0" From da0fa44353e3d7293fbc96338a46a196a5c0f67a Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Thu, 30 Mar 2023 06:58:55 +0000 Subject: [PATCH 5/7] Update generated code for v285 --- OPENAPI_VERSION | 2 +- stripe/api_resources/tax/transaction.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 4042959d6..91bb63fb5 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v283 \ No newline at end of file +v285 \ No newline at end of file diff --git a/stripe/api_resources/tax/transaction.py b/stripe/api_resources/tax/transaction.py index e435d6d3c..abe91a2aa 100644 --- a/stripe/api_resources/tax/transaction.py +++ b/stripe/api_resources/tax/transaction.py @@ -3,10 +3,10 @@ from __future__ import absolute_import, division, print_function from stripe import util -from stripe.api_resources.abstract import CreateableAPIResource +from stripe.api_resources.abstract import APIResource -class Transaction(CreateableAPIResource): +class Transaction(APIResource): """ A Tax transaction records the tax collected from or refunded to your customer. """ From 2412406e15b227b7219d9978c1e2718cd40b8be8 Mon Sep 17 00:00:00 2001 From: "stripe-openapi[bot]" <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Thu, 30 Mar 2023 13:16:19 -0700 Subject: [PATCH 6/7] Update generated code for v285 (#951) Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> --- OPENAPI_VERSION | 2 +- stripe/api_resources/tax/transaction.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index ccddf6542..91bb63fb5 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v277 \ No newline at end of file +v285 \ No newline at end of file diff --git a/stripe/api_resources/tax/transaction.py b/stripe/api_resources/tax/transaction.py index e435d6d3c..abe91a2aa 100644 --- a/stripe/api_resources/tax/transaction.py +++ b/stripe/api_resources/tax/transaction.py @@ -3,10 +3,10 @@ from __future__ import absolute_import, division, print_function from stripe import util -from stripe.api_resources.abstract import CreateableAPIResource +from stripe.api_resources.abstract import APIResource -class Transaction(CreateableAPIResource): +class Transaction(APIResource): """ A Tax transaction records the tax collected from or refunded to your customer. """ From 07b5cdd384ae340a93a41352321790d88223da77 Mon Sep 17 00:00:00 2001 From: Annie Li Date: Thu, 30 Mar 2023 13:27:54 -0700 Subject: [PATCH 7/7] Bump version to 5.4.0 --- CHANGELOG.md | 5 +++++ VERSION | 2 +- stripe/version.py | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f5d4bff2..196058675 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 5.4.0 - 2023-03-30 +* [#951](https://github.com/stripe/stripe-python/pull/951) Update generated code + * Remove support for `create` method on resource `Tax.Transaction` + * This is not a breaking change, as this method was deprecated before the Tax Transactions API was released in favor of the `create_from_calculation` method. + ## 5.3.0 - 2023-03-23 * [#947](https://github.com/stripe/stripe-python/pull/947) Update generated code * Add support for new resources `Tax.CalculationLineItem`, `Tax.Calculation`, `Tax.TransactionLineItem`, and `Tax.Transaction` diff --git a/VERSION b/VERSION index 03f488b07..8a30e8f94 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5.3.0 +5.4.0 diff --git a/stripe/version.py b/stripe/version.py index 01997c309..f255dff04 100644 --- a/stripe/version.py +++ b/stripe/version.py @@ -1 +1 @@ -VERSION = "5.3.0" +VERSION = "5.4.0"