Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update generated code #1047

Merged
merged 2 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v510
v525
154 changes: 153 additions & 1 deletion stripe/api_resources/issuing/authorization.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@

from stripe import util
from stripe.api_resources.abstract import (
APIResourceTestHelpers,
ListableAPIResource,
UpdateableAPIResource,
)
from stripe.api_resources.expandable_field import ExpandableField
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
Expand Down Expand Up @@ -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
79 changes: 78 additions & 1 deletion stripe/api_resources/issuing/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@
# 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,
)
from stripe.api_resources.expandable_field import ExpandableField
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
Expand Down Expand Up @@ -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