diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 811498793..ca2b1285d 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v510 \ No newline at end of file +v525 \ No newline at end of file diff --git a/stripe/api_resources/issuing/authorization.py b/stripe/api_resources/issuing/authorization.py index dd8cc6ca8..0817fe8e2 100644 --- a/stripe/api_resources/issuing/authorization.py +++ b/stripe/api_resources/issuing/authorization.py @@ -4,6 +4,7 @@ from stripe import util from stripe.api_resources.abstract import ( + APIResourceTestHelpers, ListableAPIResource, UpdateableAPIResource, ) @@ -11,7 +12,7 @@ from stripe.api_resources.list_object import ListObject from stripe.stripe_object import StripeObject from typing import Dict, List, Optional, cast -from typing_extensions import Literal +from typing_extensions import Literal, Type from urllib.parse import quote_plus from typing_extensions import TYPE_CHECKING @@ -159,3 +160,154 @@ def retrieve(cls, id, api_key=None, **params) -> "Authorization": instance = cls(id, api_key, **params) instance.refresh() return instance + + class TestHelpers(APIResourceTestHelpers["Authorization"]): + _resource_cls: Type["Authorization"] + + @classmethod + def _cls_capture( + cls, + authorization, + api_key=None, + stripe_version=None, + stripe_account=None, + **params + ): + return cls._static_request( + "post", + "/v1/test_helpers/issuing/authorizations/{authorization}/capture".format( + authorization=util.sanitize_id(authorization) + ), + api_key=api_key, + stripe_version=stripe_version, + stripe_account=stripe_account, + params=params, + ) + + @util.class_method_variant("_cls_capture") + def capture(self, idempotency_key=None, **params): + return self.resource._request( + "post", + "/v1/test_helpers/issuing/authorizations/{authorization}/capture".format( + authorization=util.sanitize_id(self.resource.get("id")) + ), + idempotency_key=idempotency_key, + params=params, + ) + + @classmethod + def create( + cls, + api_key=None, + stripe_version=None, + stripe_account=None, + **params + ): + return cls._static_request( + "post", + "/v1/test_helpers/issuing/authorizations", + api_key=api_key, + stripe_version=stripe_version, + stripe_account=stripe_account, + params=params, + ) + + @classmethod + def _cls_expire( + cls, + authorization, + api_key=None, + stripe_version=None, + stripe_account=None, + **params + ): + return cls._static_request( + "post", + "/v1/test_helpers/issuing/authorizations/{authorization}/expire".format( + authorization=util.sanitize_id(authorization) + ), + api_key=api_key, + stripe_version=stripe_version, + stripe_account=stripe_account, + params=params, + ) + + @util.class_method_variant("_cls_expire") + def expire(self, idempotency_key=None, **params): + return self.resource._request( + "post", + "/v1/test_helpers/issuing/authorizations/{authorization}/expire".format( + authorization=util.sanitize_id(self.resource.get("id")) + ), + idempotency_key=idempotency_key, + params=params, + ) + + @classmethod + def _cls_increment( + cls, + authorization, + api_key=None, + stripe_version=None, + stripe_account=None, + **params + ): + return cls._static_request( + "post", + "/v1/test_helpers/issuing/authorizations/{authorization}/increment".format( + authorization=util.sanitize_id(authorization) + ), + api_key=api_key, + stripe_version=stripe_version, + stripe_account=stripe_account, + params=params, + ) + + @util.class_method_variant("_cls_increment") + def increment(self, idempotency_key=None, **params): + return self.resource._request( + "post", + "/v1/test_helpers/issuing/authorizations/{authorization}/increment".format( + authorization=util.sanitize_id(self.resource.get("id")) + ), + idempotency_key=idempotency_key, + params=params, + ) + + @classmethod + def _cls_reverse( + cls, + authorization, + api_key=None, + stripe_version=None, + stripe_account=None, + **params + ): + return cls._static_request( + "post", + "/v1/test_helpers/issuing/authorizations/{authorization}/reverse".format( + authorization=util.sanitize_id(authorization) + ), + api_key=api_key, + stripe_version=stripe_version, + stripe_account=stripe_account, + params=params, + ) + + @util.class_method_variant("_cls_reverse") + def reverse(self, idempotency_key=None, **params): + return self.resource._request( + "post", + "/v1/test_helpers/issuing/authorizations/{authorization}/reverse".format( + authorization=util.sanitize_id(self.resource.get("id")) + ), + idempotency_key=idempotency_key, + params=params, + ) + + @property + def test_helpers(self): + return self.TestHelpers(self) + + +Authorization.TestHelpers._resource_cls = Authorization diff --git a/stripe/api_resources/issuing/transaction.py b/stripe/api_resources/issuing/transaction.py index 1f2b83931..ed5baf6ad 100644 --- a/stripe/api_resources/issuing/transaction.py +++ b/stripe/api_resources/issuing/transaction.py @@ -2,7 +2,9 @@ # File generated from our OpenAPI spec from __future__ import absolute_import, division, print_function +from stripe import util from stripe.api_resources.abstract import ( + APIResourceTestHelpers, ListableAPIResource, UpdateableAPIResource, ) @@ -10,7 +12,7 @@ from stripe.api_resources.list_object import ListObject from stripe.stripe_object import StripeObject from typing import Dict, Optional, cast -from typing_extensions import Literal +from typing_extensions import Literal, Type from urllib.parse import quote_plus from typing_extensions import TYPE_CHECKING @@ -91,3 +93,78 @@ def retrieve(cls, id, api_key=None, **params) -> "Transaction": instance = cls(id, api_key, **params) instance.refresh() return instance + + class TestHelpers(APIResourceTestHelpers["Transaction"]): + _resource_cls: Type["Transaction"] + + @classmethod + def create_force_capture( + cls, + api_key=None, + stripe_version=None, + stripe_account=None, + **params + ): + return cls._static_request( + "post", + "/v1/test_helpers/issuing/transactions/create_force_capture", + api_key=api_key, + stripe_version=stripe_version, + stripe_account=stripe_account, + params=params, + ) + + @classmethod + def create_unlinked_refund( + cls, + api_key=None, + stripe_version=None, + stripe_account=None, + **params + ): + return cls._static_request( + "post", + "/v1/test_helpers/issuing/transactions/create_unlinked_refund", + api_key=api_key, + stripe_version=stripe_version, + stripe_account=stripe_account, + params=params, + ) + + @classmethod + def _cls_refund( + cls, + transaction, + api_key=None, + stripe_version=None, + stripe_account=None, + **params + ): + return cls._static_request( + "post", + "/v1/test_helpers/issuing/transactions/{transaction}/refund".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_refund") + def refund(self, idempotency_key=None, **params): + return self.resource._request( + "post", + "/v1/test_helpers/issuing/transactions/{transaction}/refund".format( + transaction=util.sanitize_id(self.resource.get("id")) + ), + idempotency_key=idempotency_key, + params=params, + ) + + @property + def test_helpers(self): + return self.TestHelpers(self) + + +Transaction.TestHelpers._resource_cls = Transaction