Skip to content

Commit

Permalink
Update generated code for v1334
Browse files Browse the repository at this point in the history
  • Loading branch information
stripe-openapi[bot] committed Nov 7, 2024
1 parent db9a7b0 commit b0ba178
Show file tree
Hide file tree
Showing 3 changed files with 206 additions and 1 deletion.
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1333
v1334
151 changes: 151 additions & 0 deletions stripe/issuing/_authorization.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,24 @@ class Tax(StripeObject):
"reported_breakdown": ReportedBreakdown,
}

class FraudChallenge(StripeObject):
channel: Literal["sms"]
"""
The method by which the fraud challenge was delivered to the cardholder.
"""
status: Literal[
"expired", "pending", "rejected", "undeliverable", "verified"
]
"""
The status of the fraud challenge.
"""
undeliverable_reason: Optional[
Literal["no_phone_number", "unsupported_phone_number"]
]
"""
If the challenge is not deliverable, the reason why.
"""

class Fuel(StripeObject):
industry_product_code: Optional[str]
"""
Expand Down Expand Up @@ -1550,6 +1568,16 @@ class ModifyParams(RequestOptions):
Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
"""

class RespondParams(RequestOptions):
confirmed: bool
"""
Whether to simulate the user confirming that the transaction was legitimate (true) or telling Stripe that it was fraudulent (false).
"""
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""

class RetrieveParams(RequestOptions):
expand: NotRequired[List[str]]
"""
Expand Down Expand Up @@ -1608,6 +1636,10 @@ class ReverseParams(RequestOptions):
"""
Fleet-specific information for authorizations using Fleet cards.
"""
fraud_challenges: Optional[List[FraudChallenge]]
"""
Fraud challenges sent to the cardholder, if this authorization was declined for fraud risk reasons.
"""
fuel: Optional[Fuel]
"""
Information about fuel that was purchased with this transaction. Typically this information is received from the merchant after the authorization has been approved and the fuel dispensed.
Expand Down Expand Up @@ -1666,6 +1698,10 @@ class ReverseParams(RequestOptions):
[Treasury](https://stripe.com/docs/api/treasury) details related to this authorization if it was created on a [FinancialAccount](https://stripe.com/docs/api/treasury/financial_accounts).
"""
verification_data: VerificationData
verified_by_fraud_challenge: Optional[bool]
"""
Whether the authorization bypassed fraud risk checks because the cardholder has previously completed a fraud challenge on a similar high-risk authorization from the same merchant.
"""
wallet: Optional[str]
"""
The digital wallet used for this transaction. One of `apple_pay`, `google_pay`, or `samsung_pay`. Will populate as `null` when no digital wallet was utilized.
Expand Down Expand Up @@ -2506,6 +2542,120 @@ async def increment_async( # pyright: ignore[reportGeneralTypeIssues]
),
)

@classmethod
def _cls_respond(
cls,
authorization: str,
**params: Unpack["Authorization.RespondParams"],
) -> "Authorization":
"""
Respond to a fraud challenge on a testmode Issuing authorization, simulating either a confirmation of fraud or a correction of legitimacy.
"""
return cast(
"Authorization",
cls._static_request(
"post",
"/v1/test_helpers/issuing/authorizations/{authorization}/fraud_challenges/respond".format(
authorization=sanitize_id(authorization)
),
params=params,
),
)

@overload
@staticmethod
def respond(
authorization: str, **params: Unpack["Authorization.RespondParams"]
) -> "Authorization":
"""
Respond to a fraud challenge on a testmode Issuing authorization, simulating either a confirmation of fraud or a correction of legitimacy.
"""
...

@overload
def respond(
self, **params: Unpack["Authorization.RespondParams"]
) -> "Authorization":
"""
Respond to a fraud challenge on a testmode Issuing authorization, simulating either a confirmation of fraud or a correction of legitimacy.
"""
...

@class_method_variant("_cls_respond")
def respond( # pyright: ignore[reportGeneralTypeIssues]
self, **params: Unpack["Authorization.RespondParams"]
) -> "Authorization":
"""
Respond to a fraud challenge on a testmode Issuing authorization, simulating either a confirmation of fraud or a correction of legitimacy.
"""
return cast(
"Authorization",
self.resource._request(
"post",
"/v1/test_helpers/issuing/authorizations/{authorization}/fraud_challenges/respond".format(
authorization=sanitize_id(self.resource.get("id"))
),
params=params,
),
)

@classmethod
async def _cls_respond_async(
cls,
authorization: str,
**params: Unpack["Authorization.RespondParams"],
) -> "Authorization":
"""
Respond to a fraud challenge on a testmode Issuing authorization, simulating either a confirmation of fraud or a correction of legitimacy.
"""
return cast(
"Authorization",
await cls._static_request_async(
"post",
"/v1/test_helpers/issuing/authorizations/{authorization}/fraud_challenges/respond".format(
authorization=sanitize_id(authorization)
),
params=params,
),
)

@overload
@staticmethod
async def respond_async(
authorization: str, **params: Unpack["Authorization.RespondParams"]
) -> "Authorization":
"""
Respond to a fraud challenge on a testmode Issuing authorization, simulating either a confirmation of fraud or a correction of legitimacy.
"""
...

@overload
async def respond_async(
self, **params: Unpack["Authorization.RespondParams"]
) -> "Authorization":
"""
Respond to a fraud challenge on a testmode Issuing authorization, simulating either a confirmation of fraud or a correction of legitimacy.
"""
...

@class_method_variant("_cls_respond_async")
async def respond_async( # pyright: ignore[reportGeneralTypeIssues]
self, **params: Unpack["Authorization.RespondParams"]
) -> "Authorization":
"""
Respond to a fraud challenge on a testmode Issuing authorization, simulating either a confirmation of fraud or a correction of legitimacy.
"""
return cast(
"Authorization",
await self.resource._request_async(
"post",
"/v1/test_helpers/issuing/authorizations/{authorization}/fraud_challenges/respond".format(
authorization=sanitize_id(self.resource.get("id"))
),
params=params,
),
)

@classmethod
def _cls_reverse(
cls,
Expand Down Expand Up @@ -2627,6 +2777,7 @@ def test_helpers(self):
_inner_class_types = {
"amount_details": AmountDetails,
"fleet": Fleet,
"fraud_challenges": FraudChallenge,
"fuel": Fuel,
"merchant_data": MerchantData,
"network_data": NetworkData,
Expand Down
54 changes: 54 additions & 0 deletions stripe/test_helpers/issuing/_authorization_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,16 @@ class IncrementParams(TypedDict):
If set `true`, you may provide [amount](https://stripe.com/docs/api/issuing/authorizations/approve#approve_issuing_authorization-amount) to control how much to hold for the authorization.
"""

class RespondParams(TypedDict):
confirmed: bool
"""
Whether to simulate the user confirming that the transaction was legitimate (true) or telling Stripe that it was fraudulent (false).
"""
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""

class ReverseParams(TypedDict):
expand: NotRequired[List[str]]
"""
Expand Down Expand Up @@ -1233,6 +1243,50 @@ async def finalize_amount_async(
),
)

def respond(
self,
authorization: str,
params: "AuthorizationService.RespondParams",
options: RequestOptions = {},
) -> Authorization:
"""
Respond to a fraud challenge on a testmode Issuing authorization, simulating either a confirmation of fraud or a correction of legitimacy.
"""
return cast(
Authorization,
self._request(
"post",
"/v1/test_helpers/issuing/authorizations/{authorization}/fraud_challenges/respond".format(
authorization=sanitize_id(authorization),
),
base_address="api",
params=params,
options=options,
),
)

async def respond_async(
self,
authorization: str,
params: "AuthorizationService.RespondParams",
options: RequestOptions = {},
) -> Authorization:
"""
Respond to a fraud challenge on a testmode Issuing authorization, simulating either a confirmation of fraud or a correction of legitimacy.
"""
return cast(
Authorization,
await self._request_async(
"post",
"/v1/test_helpers/issuing/authorizations/{authorization}/fraud_challenges/respond".format(
authorization=sanitize_id(authorization),
),
base_address="api",
params=params,
options=options,
),
)

def increment(
self,
authorization: str,
Expand Down

0 comments on commit b0ba178

Please sign in to comment.