Debian Codegraph @

stripe/issuing/_authorization.py

raw
1 # -*- coding: utf-8 -*-
2 # File generated from our OpenAPI spec
3 from stripe._expandable_field import ExpandableField
4 from stripe._list_object import ListObject
5 from stripe._listable_api_resource import ListableAPIResource
6 from stripe._stripe_object import StripeObject
7 from stripe._test_helpers import APIResourceTestHelpers
8 from stripe._updateable_api_resource import UpdateableAPIResource
9 from stripe._util import class_method_variant, sanitize_id
10 from typing import ClassVar, Dict, List, Optional, cast, overload
11 from typing_extensions import Literal, Type, Unpack, TYPE_CHECKING
12
13 if TYPE_CHECKING:
14 from stripe._balance_transaction import BalanceTransaction
15 from stripe.issuing._card import Card
16 from stripe.issuing._cardholder import Cardholder
17 from stripe.issuing._token import Token
18 from stripe.issuing._transaction import Transaction
19 from stripe.params.issuing._authorization_approve_params import (
20 AuthorizationApproveParams,
21 )
22 from stripe.params.issuing._authorization_capture_params import (
23 AuthorizationCaptureParams,
24 )
25 from stripe.params.issuing._authorization_create_params import (
26 AuthorizationCreateParams,
27 )
28 from stripe.params.issuing._authorization_decline_params import (
29 AuthorizationDeclineParams,
30 )
31 from stripe.params.issuing._authorization_expire_params import (
32 AuthorizationExpireParams,
33 )
34 from stripe.params.issuing._authorization_finalize_amount_params import (
35 AuthorizationFinalizeAmountParams,
36 )
37 from stripe.params.issuing._authorization_increment_params import (
38 AuthorizationIncrementParams,
39 )
40 from stripe.params.issuing._authorization_list_params import (
41 AuthorizationListParams,
42 )
43 from stripe.params.issuing._authorization_modify_params import (
44 AuthorizationModifyParams,
45 )
46 from stripe.params.issuing._authorization_respond_params import (
47 AuthorizationRespondParams,
48 )
49 from stripe.params.issuing._authorization_retrieve_params import (
50 AuthorizationRetrieveParams,
51 )
52 from stripe.params.issuing._authorization_reverse_params import (
53 AuthorizationReverseParams,
54 )
55
56
57 class Authorization(
58 ListableAPIResource["Authorization"],
59 UpdateableAPIResource["Authorization"],
60 ):
61 """
62 When an [issued card](https://docs.stripe.com/issuing) is used to make a purchase, an Issuing `Authorization`
63 object is created. [Authorizations](https://docs.stripe.com/issuing/purchases/authorizations) must be approved for the
64 purchase to be completed successfully.
65
66 Related guide: [Issued card authorizations](https://docs.stripe.com/issuing/purchases/authorizations)
67 """
68
69 OBJECT_NAME: ClassVar[Literal["issuing.authorization"]] = (
70 "issuing.authorization"
71 )
72
73 class AmountDetails(StripeObject):
74 atm_fee: Optional[int]
75 """
76 The fee charged by the ATM for the cash withdrawal.
77 """
78 cashback_amount: Optional[int]
79 """
80 The amount of cash requested by the cardholder.
81 """
82
83 class Fleet(StripeObject):
84 class CardholderPromptData(StripeObject):
85 alphanumeric_id: Optional[str]
86 """
87 [Deprecated] An alphanumeric ID, though typical point of sales only support numeric entry. The card program can be configured to prompt for a vehicle ID, driver ID, or generic ID.
88 """
89 driver_id: Optional[str]
90 """
91 Driver ID.
92 """
93 odometer: Optional[int]
94 """
95 Odometer reading.
96 """
97 unspecified_id: Optional[str]
98 """
99 An alphanumeric ID. This field is used when a vehicle ID, driver ID, or generic ID is entered by the cardholder, but the merchant or card network did not specify the prompt type.
100 """
101 user_id: Optional[str]
102 """
103 User ID.
104 """
105 vehicle_number: Optional[str]
106 """
107 Vehicle number.
108 """
109
110 class ReportedBreakdown(StripeObject):
111 class Fuel(StripeObject):
112 gross_amount_decimal: Optional[str]
113 """
114 Gross fuel amount that should equal Fuel Quantity multiplied by Fuel Unit Cost, inclusive of taxes.
115 """
116
117 class NonFuel(StripeObject):
118 gross_amount_decimal: Optional[str]
119 """
120 Gross non-fuel amount that should equal the sum of the line items, inclusive of taxes.
121 """
122
123 class Tax(StripeObject):
124 local_amount_decimal: Optional[str]
125 """
126 Amount of state or provincial Sales Tax included in the transaction amount. `null` if not reported by merchant or not subject to tax.
127 """
128 national_amount_decimal: Optional[str]
129 """
130 Amount of national Sales Tax or VAT included in the transaction amount. `null` if not reported by merchant or not subject to tax.
131 """
132
133 fuel: Optional[Fuel]
134 """
135 Breakdown of fuel portion of the purchase.
136 """
137 non_fuel: Optional[NonFuel]
138 """
139 Breakdown of non-fuel portion of the purchase.
140 """
141 tax: Optional[Tax]
142 """
143 Information about tax included in this transaction.
144 """
145 _inner_class_types = {
146 "fuel": Fuel,
147 "non_fuel": NonFuel,
148 "tax": Tax,
149 }
150
151 cardholder_prompt_data: Optional[CardholderPromptData]
152 """
153 Answers to prompts presented to the cardholder at the point of sale. Prompted fields vary depending on the configuration of your physical fleet cards. Typical points of sale support only numeric entry.
154 """
155 purchase_type: Optional[
156 Literal[
157 "fuel_and_non_fuel_purchase",
158 "fuel_purchase",
159 "non_fuel_purchase",
160 ]
161 ]
162 """
163 The type of purchase.
164 """
165 reported_breakdown: Optional[ReportedBreakdown]
166 """
167 More information about the total amount. Typically this information is received from the merchant after the authorization has been approved and the fuel dispensed. This information is not guaranteed to be accurate as some merchants may provide unreliable data.
168 """
169 service_type: Optional[
170 Literal["full_service", "non_fuel_transaction", "self_service"]
171 ]
172 """
173 The type of fuel service.
174 """
175 _inner_class_types = {
176 "cardholder_prompt_data": CardholderPromptData,
177 "reported_breakdown": ReportedBreakdown,
178 }
179
180 class FraudChallenge(StripeObject):
181 channel: Literal["sms"]
182 """
183 The method by which the fraud challenge was delivered to the cardholder.
184 """
185 status: Literal[
186 "expired", "pending", "rejected", "undeliverable", "verified"
187 ]
188 """
189 The status of the fraud challenge.
190 """
191 undeliverable_reason: Optional[
192 Literal["no_phone_number", "unsupported_phone_number"]
193 ]
194 """
195 If the challenge is not deliverable, the reason why.
196 """
197
198 class Fuel(StripeObject):
199 industry_product_code: Optional[str]
200 """
201 [Conexxus Payment System Product Code](https://www.conexxus.org/conexxus-payment-system-product-codes) identifying the primary fuel product purchased.
202 """
203 quantity_decimal: Optional[str]
204 """
205 The quantity of `unit`s of fuel that was dispensed, represented as a decimal string with at most 12 decimal places.
206 """
207 type: Optional[
208 Literal[
209 "diesel",
210 "other",
211 "unleaded_plus",
212 "unleaded_regular",
213 "unleaded_super",
214 ]
215 ]
216 """
217 The type of fuel that was purchased.
218 """
219 unit: Optional[
220 Literal[
221 "charging_minute",
222 "imperial_gallon",
223 "kilogram",
224 "kilowatt_hour",
225 "liter",
226 "other",
227 "pound",
228 "us_gallon",
229 ]
230 ]
231 """
232 The units for `quantity_decimal`.
233 """
234 unit_cost_decimal: Optional[str]
235 """
236 The cost in cents per each unit of fuel, represented as a decimal string with at most 12 decimal places.
237 """
238
239 class MerchantData(StripeObject):
240 category: str
241 """
242 A categorization of the seller's type of business. See our [merchant categories guide](https://docs.stripe.com/issuing/merchant-categories) for a list of possible values.
243 """
244 category_code: str
245 """
246 The merchant category code for the seller's business
247 """
248 city: Optional[str]
249 """
250 City where the seller is located
251 """
252 country: Optional[str]
253 """
254 Country where the seller is located
255 """
256 name: Optional[str]
257 """
258 Name of the seller
259 """
260 network_id: str
261 """
262 Identifier assigned to the seller by the card network. Different card networks may assign different network_id fields to the same merchant.
263 """
264 postal_code: Optional[str]
265 """
266 Postal code where the seller is located
267 """
268 state: Optional[str]
269 """
270 State where the seller is located
271 """
272 tax_id: Optional[str]
273 """
274 The seller's tax identification number. Currently populated for French merchants only.
275 """
276 terminal_id: Optional[str]
277 """
278 An ID assigned by the seller to the location of the sale.
279 """
280 url: Optional[str]
281 """
282 URL provided by the merchant on a 3DS request
283 """
284
285 class NetworkData(StripeObject):
286 acquiring_institution_id: Optional[str]
287 """
288 Identifier assigned to the acquirer by the card network. Sometimes this value is not provided by the network; in this case, the value will be `null`.
289 """
290 system_trace_audit_number: Optional[str]
291 """
292 The System Trace Audit Number (STAN) is a 6-digit identifier assigned by the acquirer. Prefer `network_data.transaction_id` if present, unless you have special requirements.
293 """
294 transaction_id: Optional[str]
295 """
296 Unique identifier for the authorization assigned by the card network used to match subsequent messages, disputes, and transactions.
297 """
298
299 class PendingRequest(StripeObject):
300 class AmountDetails(StripeObject):
301 atm_fee: Optional[int]
302 """
303 The fee charged by the ATM for the cash withdrawal.
304 """
305 cashback_amount: Optional[int]
306 """
307 The amount of cash requested by the cardholder.
308 """
309
310 amount: int
311 """
312 The additional amount Stripe will hold if the authorization is approved, in the card's [currency](https://docs.stripe.com/api#issuing_authorization_object-pending-request-currency) and in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal).
313 """
314 amount_details: Optional[AmountDetails]
315 """
316 Detailed breakdown of amount components. These amounts are denominated in `currency` and in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal).
317 """
318 currency: str
319 """
320 Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
321 """
322 is_amount_controllable: bool
323 """
324 If set `true`, you may provide [amount](https://docs.stripe.com/api/issuing/authorizations/approve#approve_issuing_authorization-amount) to control how much to hold for the authorization.
325 """
326 merchant_amount: int
327 """
328 The amount the merchant is requesting to be authorized in the `merchant_currency`. The amount is in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal).
329 """
330 merchant_currency: str
331 """
332 The local currency the merchant is requesting to authorize.
333 """
334 network_risk_score: Optional[int]
335 """
336 The card network's estimate of the likelihood that an authorization is fraudulent. Takes on values between 1 and 99.
337 """
338 _inner_class_types = {"amount_details": AmountDetails}
339
340 class RequestHistory(StripeObject):
341 class AmountDetails(StripeObject):
342 atm_fee: Optional[int]
343 """
344 The fee charged by the ATM for the cash withdrawal.
345 """
346 cashback_amount: Optional[int]
347 """
348 The amount of cash requested by the cardholder.
349 """
350
351 amount: int
352 """
353 The `pending_request.amount` at the time of the request, presented in your card's currency and in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal). Stripe held this amount from your account to fund the authorization if the request was approved.
354 """
355 amount_details: Optional[AmountDetails]
356 """
357 Detailed breakdown of amount components. These amounts are denominated in `currency` and in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal).
358 """
359 approved: bool
360 """
361 Whether this request was approved.
362 """
363 authorization_code: Optional[str]
364 """
365 A code created by Stripe which is shared with the merchant to validate the authorization. This field will be populated if the authorization message was approved. The code typically starts with the letter "S", followed by a six-digit number. For example, "S498162". Please note that the code is not guaranteed to be unique across authorizations.
366 """
367 created: int
368 """
369 Time at which the object was created. Measured in seconds since the Unix epoch.
370 """
371 currency: str
372 """
373 Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
374 """
375 merchant_amount: int
376 """
377 The `pending_request.merchant_amount` at the time of the request, presented in the `merchant_currency` and in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal).
378 """
379 merchant_currency: str
380 """
381 The currency that was collected by the merchant and presented to the cardholder for the authorization. Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
382 """
383 network_risk_score: Optional[int]
384 """
385 The card network's estimate of the likelihood that an authorization is fraudulent. Takes on values between 1 and 99.
386 """
387 reason: Literal[
388 "account_disabled",
389 "card_active",
390 "card_canceled",
391 "card_expired",
392 "card_inactive",
393 "cardholder_blocked",
394 "cardholder_inactive",
395 "cardholder_verification_required",
396 "insecure_authorization_method",
397 "insufficient_funds",
398 "network_fallback",
399 "not_allowed",
400 "pin_blocked",
401 "spending_controls",
402 "suspected_fraud",
403 "verification_failed",
404 "webhook_approved",
405 "webhook_declined",
406 "webhook_error",
407 "webhook_timeout",
408 ]
409 """
410 When an authorization is approved or declined by you or by Stripe, this field provides additional detail on the reason for the outcome.
411 """
412 reason_message: Optional[str]
413 """
414 If the `request_history.reason` is `webhook_error` because the direct webhook response is invalid (for example, parsing errors or missing parameters), we surface a more detailed error message via this field.
415 """
416 requested_at: Optional[int]
417 """
418 Time when the card network received an authorization request from the acquirer in UTC. Referred to by networks as transmission time.
419 """
420 _inner_class_types = {"amount_details": AmountDetails}
421
422 class Treasury(StripeObject):
423 received_credits: List[str]
424 """
425 The array of [ReceivedCredits](https://docs.stripe.com/api/treasury/received_credits) associated with this authorization
426 """
427 received_debits: List[str]
428 """
429 The array of [ReceivedDebits](https://docs.stripe.com/api/treasury/received_debits) associated with this authorization
430 """
431 transaction: Optional[str]
432 """
433 The Treasury [Transaction](https://docs.stripe.com/api/treasury/transactions) associated with this authorization
434 """
435
436 class VerificationData(StripeObject):
437 class AuthenticationExemption(StripeObject):
438 claimed_by: Literal["acquirer", "issuer"]
439 """
440 The entity that requested the exemption, either the acquiring merchant or the Issuing user.
441 """
442 type: Literal[
443 "low_value_transaction", "transaction_risk_analysis", "unknown"
444 ]
445 """
446 The specific exemption claimed for this authorization.
447 """
448
449 class ThreeDSecure(StripeObject):
450 result: Literal[
451 "attempt_acknowledged", "authenticated", "failed", "required"
452 ]
453 """
454 The outcome of the 3D Secure authentication request.
455 """
456
457 address_line1_check: Literal["match", "mismatch", "not_provided"]
458 """
459 Whether the cardholder provided an address first line and if it matched the cardholder's `billing.address.line1`.
460 """
461 address_postal_code_check: Literal["match", "mismatch", "not_provided"]
462 """
463 Whether the cardholder provided a postal code and if it matched the cardholder's `billing.address.postal_code`.
464 """
465 authentication_exemption: Optional[AuthenticationExemption]
466 """
467 The exemption applied to this authorization.
468 """
469 cvc_check: Literal["match", "mismatch", "not_provided"]
470 """
471 Whether the cardholder provided a CVC and if it matched Stripe's record.
472 """
473 expiry_check: Literal["match", "mismatch", "not_provided"]
474 """
475 Whether the cardholder provided an expiry date and if it matched Stripe's record.
476 """
477 postal_code: Optional[str]
478 """
479 The postal code submitted as part of the authorization used for postal code verification.
480 """
481 three_d_secure: Optional[ThreeDSecure]
482 """
483 3D Secure details.
484 """
485 _inner_class_types = {
486 "authentication_exemption": AuthenticationExemption,
487 "three_d_secure": ThreeDSecure,
488 }
489
490 amount: int
491 """
492 The total amount that was authorized or rejected. This amount is in `currency` and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). `amount` should be the same as `merchant_amount`, unless `currency` and `merchant_currency` are different.
493 """
494 amount_details: Optional[AmountDetails]
495 """
496 Detailed breakdown of amount components. These amounts are denominated in `currency` and in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal).
497 """
498 approved: bool
499 """
500 Whether the authorization has been approved.
501 """
502 authorization_method: Literal[
503 "chip", "contactless", "keyed_in", "online", "swipe"
504 ]
505 """
506 How the card details were provided.
507 """
508 balance_transactions: List["BalanceTransaction"]
509 """
510 List of balance transactions associated with this authorization.
511 """
512 card: "Card"
513 """
514 You can [create physical or virtual cards](https://docs.stripe.com/issuing) that are issued to cardholders.
515 """
516 cardholder: Optional[ExpandableField["Cardholder"]]
517 """
518 The cardholder to whom this authorization belongs.
519 """
520 created: int
521 """
522 Time at which the object was created. Measured in seconds since the Unix epoch.
523 """
524 currency: str
525 """
526 The currency of the cardholder. This currency can be different from the currency presented at authorization and the `merchant_currency` field on this authorization. Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
527 """
528 fleet: Optional[Fleet]
529 """
530 Fleet-specific information for authorizations using Fleet cards.
531 """
532 fraud_challenges: Optional[List[FraudChallenge]]
533 """
534 Fraud challenges sent to the cardholder, if this authorization was declined for fraud risk reasons.
535 """
536 fuel: Optional[Fuel]
537 """
538 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.
539 """
540 id: str
541 """
542 Unique identifier for the object.
543 """
544 livemode: bool
545 """
546 Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
547 """
548 merchant_amount: int
549 """
550 The total amount that was authorized or rejected. This amount is in the `merchant_currency` and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). `merchant_amount` should be the same as `amount`, unless `merchant_currency` and `currency` are different.
551 """
552 merchant_currency: str
553 """
554 The local currency that was presented to the cardholder for the authorization. This currency can be different from the cardholder currency and the `currency` field on this authorization. Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
555 """
556 merchant_data: MerchantData
557 metadata: Dict[str, str]
558 """
559 Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
560 """
561 network_data: Optional[NetworkData]
562 """
563 Details about the authorization, such as identifiers, set by the card network.
564 """
565 object: Literal["issuing.authorization"]
566 """
567 String representing the object's type. Objects of the same type share the same value.
568 """
569 pending_request: Optional[PendingRequest]
570 """
571 The pending authorization request. This field will only be non-null during an `issuing_authorization.request` webhook.
572 """
573 request_history: List[RequestHistory]
574 """
575 History of every time a `pending_request` authorization was approved/declined, either by you directly or by Stripe (e.g. based on your spending_controls). If the merchant changes the authorization by performing an incremental authorization, you can look at this field to see the previous requests for the authorization. This field can be helpful in determining why a given authorization was approved/declined.
576 """
577 status: Literal["closed", "expired", "pending", "reversed"]
578 """
579 The current status of the authorization in its lifecycle.
580 """
581 token: Optional[ExpandableField["Token"]]
582 """
583 [Token](https://docs.stripe.com/api/issuing/tokens/object) object used for this authorization. If a network token was not used for this authorization, this field will be null.
584 """
585 transactions: List["Transaction"]
586 """
587 List of [transactions](https://docs.stripe.com/api/issuing/transactions) associated with this authorization.
588 """
589 treasury: Optional[Treasury]
590 """
591 [Treasury](https://docs.stripe.com/api/treasury) details related to this authorization if it was created on a [FinancialAccount](https://docs.stripe.com/api/treasury/financial_accounts).
592 """
593 verification_data: VerificationData
594 verified_by_fraud_challenge: Optional[bool]
595 """
596 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.
597 """
598 wallet: Optional[str]
599 """
600 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.
601 """
602
603 @classmethod
604 def _cls_approve(
605 cls, authorization: str, **params: Unpack["AuthorizationApproveParams"]
606 ) -> "Authorization":
607 """
608 [Deprecated] Approves a pending Issuing Authorization object. This request should be made within the timeout window of the [real-time authorization](https://docs.stripe.com/docs/issuing/controls/real-time-authorizations) flow.
609 This method is deprecated. Instead, [respond directly to the webhook request to approve an authorization](https://docs.stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
610 """
611 return cast(
612 "Authorization",
613 cls._static_request(
614 "post",
615 "/v1/issuing/authorizations/{authorization}/approve".format(
616 authorization=sanitize_id(authorization)
617 ),
618 params=params,
619 ),
620 )
621
622 @overload
623 @staticmethod
624 def approve(
625 authorization: str, **params: Unpack["AuthorizationApproveParams"]
626 ) -> "Authorization":
627 """
628 [Deprecated] Approves a pending Issuing Authorization object. This request should be made within the timeout window of the [real-time authorization](https://docs.stripe.com/docs/issuing/controls/real-time-authorizations) flow.
629 This method is deprecated. Instead, [respond directly to the webhook request to approve an authorization](https://docs.stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
630 """
631 ...
632
633 @overload
634 def approve(
635 self, **params: Unpack["AuthorizationApproveParams"]
636 ) -> "Authorization":
637 """
638 [Deprecated] Approves a pending Issuing Authorization object. This request should be made within the timeout window of the [real-time authorization](https://docs.stripe.com/docs/issuing/controls/real-time-authorizations) flow.
639 This method is deprecated. Instead, [respond directly to the webhook request to approve an authorization](https://docs.stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
640 """
641 ...
642
643 @class_method_variant("_cls_approve")
644 def approve( # pyright: ignore[reportGeneralTypeIssues]
645 self, **params: Unpack["AuthorizationApproveParams"]
646 ) -> "Authorization":
647 """
648 [Deprecated] Approves a pending Issuing Authorization object. This request should be made within the timeout window of the [real-time authorization](https://docs.stripe.com/docs/issuing/controls/real-time-authorizations) flow.
649 This method is deprecated. Instead, [respond directly to the webhook request to approve an authorization](https://docs.stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
650 """
651 return cast(
652 "Authorization",
653 self._request(
654 "post",
655 "/v1/issuing/authorizations/{authorization}/approve".format(
656 authorization=sanitize_id(self.get("id"))
657 ),
658 params=params,
659 ),
660 )
661
662 @classmethod
663 async def _cls_approve_async(
664 cls, authorization: str, **params: Unpack["AuthorizationApproveParams"]
665 ) -> "Authorization":
666 """
667 [Deprecated] Approves a pending Issuing Authorization object. This request should be made within the timeout window of the [real-time authorization](https://docs.stripe.com/docs/issuing/controls/real-time-authorizations) flow.
668 This method is deprecated. Instead, [respond directly to the webhook request to approve an authorization](https://docs.stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
669 """
670 return cast(
671 "Authorization",
672 await cls._static_request_async(
673 "post",
674 "/v1/issuing/authorizations/{authorization}/approve".format(
675 authorization=sanitize_id(authorization)
676 ),
677 params=params,
678 ),
679 )
680
681 @overload
682 @staticmethod
683 async def approve_async(
684 authorization: str, **params: Unpack["AuthorizationApproveParams"]
685 ) -> "Authorization":
686 """
687 [Deprecated] Approves a pending Issuing Authorization object. This request should be made within the timeout window of the [real-time authorization](https://docs.stripe.com/docs/issuing/controls/real-time-authorizations) flow.
688 This method is deprecated. Instead, [respond directly to the webhook request to approve an authorization](https://docs.stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
689 """
690 ...
691
692 @overload
693 async def approve_async(
694 self, **params: Unpack["AuthorizationApproveParams"]
695 ) -> "Authorization":
696 """
697 [Deprecated] Approves a pending Issuing Authorization object. This request should be made within the timeout window of the [real-time authorization](https://docs.stripe.com/docs/issuing/controls/real-time-authorizations) flow.
698 This method is deprecated. Instead, [respond directly to the webhook request to approve an authorization](https://docs.stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
699 """
700 ...
701
702 @class_method_variant("_cls_approve_async")
703 async def approve_async( # pyright: ignore[reportGeneralTypeIssues]
704 self, **params: Unpack["AuthorizationApproveParams"]
705 ) -> "Authorization":
706 """
707 [Deprecated] Approves a pending Issuing Authorization object. This request should be made within the timeout window of the [real-time authorization](https://docs.stripe.com/docs/issuing/controls/real-time-authorizations) flow.
708 This method is deprecated. Instead, [respond directly to the webhook request to approve an authorization](https://docs.stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
709 """
710 return cast(
711 "Authorization",
712 await self._request_async(
713 "post",
714 "/v1/issuing/authorizations/{authorization}/approve".format(
715 authorization=sanitize_id(self.get("id"))
716 ),
717 params=params,
718 ),
719 )
720
721 @classmethod
722 def _cls_decline(
723 cls, authorization: str, **params: Unpack["AuthorizationDeclineParams"]
724 ) -> "Authorization":
725 """
726 [Deprecated] Declines a pending Issuing Authorization object. This request should be made within the timeout window of the [real time authorization](https://docs.stripe.com/docs/issuing/controls/real-time-authorizations) flow.
727 This method is deprecated. Instead, [respond directly to the webhook request to decline an authorization](https://docs.stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
728 """
729 return cast(
730 "Authorization",
731 cls._static_request(
732 "post",
733 "/v1/issuing/authorizations/{authorization}/decline".format(
734 authorization=sanitize_id(authorization)
735 ),
736 params=params,
737 ),
738 )
739
740 @overload
741 @staticmethod
742 def decline(
743 authorization: str, **params: Unpack["AuthorizationDeclineParams"]
744 ) -> "Authorization":
745 """
746 [Deprecated] Declines a pending Issuing Authorization object. This request should be made within the timeout window of the [real time authorization](https://docs.stripe.com/docs/issuing/controls/real-time-authorizations) flow.
747 This method is deprecated. Instead, [respond directly to the webhook request to decline an authorization](https://docs.stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
748 """
749 ...
750
751 @overload
752 def decline(
753 self, **params: Unpack["AuthorizationDeclineParams"]
754 ) -> "Authorization":
755 """
756 [Deprecated] Declines a pending Issuing Authorization object. This request should be made within the timeout window of the [real time authorization](https://docs.stripe.com/docs/issuing/controls/real-time-authorizations) flow.
757 This method is deprecated. Instead, [respond directly to the webhook request to decline an authorization](https://docs.stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
758 """
759 ...
760
761 @class_method_variant("_cls_decline")
762 def decline( # pyright: ignore[reportGeneralTypeIssues]
763 self, **params: Unpack["AuthorizationDeclineParams"]
764 ) -> "Authorization":
765 """
766 [Deprecated] Declines a pending Issuing Authorization object. This request should be made within the timeout window of the [real time authorization](https://docs.stripe.com/docs/issuing/controls/real-time-authorizations) flow.
767 This method is deprecated. Instead, [respond directly to the webhook request to decline an authorization](https://docs.stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
768 """
769 return cast(
770 "Authorization",
771 self._request(
772 "post",
773 "/v1/issuing/authorizations/{authorization}/decline".format(
774 authorization=sanitize_id(self.get("id"))
775 ),
776 params=params,
777 ),
778 )
779
780 @classmethod
781 async def _cls_decline_async(
782 cls, authorization: str, **params: Unpack["AuthorizationDeclineParams"]
783 ) -> "Authorization":
784 """
785 [Deprecated] Declines a pending Issuing Authorization object. This request should be made within the timeout window of the [real time authorization](https://docs.stripe.com/docs/issuing/controls/real-time-authorizations) flow.
786 This method is deprecated. Instead, [respond directly to the webhook request to decline an authorization](https://docs.stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
787 """
788 return cast(
789 "Authorization",
790 await cls._static_request_async(
791 "post",
792 "/v1/issuing/authorizations/{authorization}/decline".format(
793 authorization=sanitize_id(authorization)
794 ),
795 params=params,
796 ),
797 )
798
799 @overload
800 @staticmethod
801 async def decline_async(
802 authorization: str, **params: Unpack["AuthorizationDeclineParams"]
803 ) -> "Authorization":
804 """
805 [Deprecated] Declines a pending Issuing Authorization object. This request should be made within the timeout window of the [real time authorization](https://docs.stripe.com/docs/issuing/controls/real-time-authorizations) flow.
806 This method is deprecated. Instead, [respond directly to the webhook request to decline an authorization](https://docs.stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
807 """
808 ...
809
810 @overload
811 async def decline_async(
812 self, **params: Unpack["AuthorizationDeclineParams"]
813 ) -> "Authorization":
814 """
815 [Deprecated] Declines a pending Issuing Authorization object. This request should be made within the timeout window of the [real time authorization](https://docs.stripe.com/docs/issuing/controls/real-time-authorizations) flow.
816 This method is deprecated. Instead, [respond directly to the webhook request to decline an authorization](https://docs.stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
817 """
818 ...
819
820 @class_method_variant("_cls_decline_async")
821 async def decline_async( # pyright: ignore[reportGeneralTypeIssues]
822 self, **params: Unpack["AuthorizationDeclineParams"]
823 ) -> "Authorization":
824 """
825 [Deprecated] Declines a pending Issuing Authorization object. This request should be made within the timeout window of the [real time authorization](https://docs.stripe.com/docs/issuing/controls/real-time-authorizations) flow.
826 This method is deprecated. Instead, [respond directly to the webhook request to decline an authorization](https://docs.stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
827 """
828 return cast(
829 "Authorization",
830 await self._request_async(
831 "post",
832 "/v1/issuing/authorizations/{authorization}/decline".format(
833 authorization=sanitize_id(self.get("id"))
834 ),
835 params=params,
836 ),
837 )
838
839 @classmethod
840 def list(
841 cls, **params: Unpack["AuthorizationListParams"]
842 ) -> ListObject["Authorization"]:
843 """
844 Returns a list of Issuing Authorization objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first.
845 """
846 result = cls._static_request(
847 "get",
848 cls.class_url(),
849 params=params,
850 )
851 if not isinstance(result, ListObject):
852 raise TypeError(
853 "Expected list object from API, got %s"
854 % (type(result).__name__)
855 )
856
857 return result
858
859 @classmethod
860 async def list_async(
861 cls, **params: Unpack["AuthorizationListParams"]
862 ) -> ListObject["Authorization"]:
863 """
864 Returns a list of Issuing Authorization objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first.
865 """
866 result = await cls._static_request_async(
867 "get",
868 cls.class_url(),
869 params=params,
870 )
871 if not isinstance(result, ListObject):
872 raise TypeError(
873 "Expected list object from API, got %s"
874 % (type(result).__name__)
875 )
876
877 return result
878
879 @classmethod
880 def modify(
881 cls, id: str, **params: Unpack["AuthorizationModifyParams"]
882 ) -> "Authorization":
883 """
884 Updates the specified Issuing Authorization object by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
885 """
886 url = "%s/%s" % (cls.class_url(), sanitize_id(id))
887 return cast(
888 "Authorization",
889 cls._static_request(
890 "post",
891 url,
892 params=params,
893 ),
894 )
895
896 @classmethod
897 async def modify_async(
898 cls, id: str, **params: Unpack["AuthorizationModifyParams"]
899 ) -> "Authorization":
900 """
901 Updates the specified Issuing Authorization object by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
902 """
903 url = "%s/%s" % (cls.class_url(), sanitize_id(id))
904 return cast(
905 "Authorization",
906 await cls._static_request_async(
907 "post",
908 url,
909 params=params,
910 ),
911 )
912
913 @classmethod
914 def retrieve(
915 cls, id: str, **params: Unpack["AuthorizationRetrieveParams"]
916 ) -> "Authorization":
917 """
918 Retrieves an Issuing Authorization object.
919 """
920 instance = cls(id, **params)
921 instance.refresh()
922 return instance
923
924 @classmethod
925 async def retrieve_async(
926 cls, id: str, **params: Unpack["AuthorizationRetrieveParams"]
927 ) -> "Authorization":
928 """
929 Retrieves an Issuing Authorization object.
930 """
931 instance = cls(id, **params)
932 await instance.refresh_async()
933 return instance
934
935 class TestHelpers(APIResourceTestHelpers["Authorization"]):
936 _resource_cls: Type["Authorization"]
937
938 @classmethod
939 def _cls_capture(
940 cls,
941 authorization: str,
942 **params: Unpack["AuthorizationCaptureParams"],
943 ) -> "Authorization":
944 """
945 Capture a test-mode authorization.
946 """
947 return cast(
948 "Authorization",
949 cls._static_request(
950 "post",
951 "/v1/test_helpers/issuing/authorizations/{authorization}/capture".format(
952 authorization=sanitize_id(authorization)
953 ),
954 params=params,
955 ),
956 )
957
958 @overload
959 @staticmethod
960 def capture(
961 authorization: str, **params: Unpack["AuthorizationCaptureParams"]
962 ) -> "Authorization":
963 """
964 Capture a test-mode authorization.
965 """
966 ...
967
968 @overload
969 def capture(
970 self, **params: Unpack["AuthorizationCaptureParams"]
971 ) -> "Authorization":
972 """
973 Capture a test-mode authorization.
974 """
975 ...
976
977 @class_method_variant("_cls_capture")
978 def capture( # pyright: ignore[reportGeneralTypeIssues]
979 self, **params: Unpack["AuthorizationCaptureParams"]
980 ) -> "Authorization":
981 """
982 Capture a test-mode authorization.
983 """
984 return cast(
985 "Authorization",
986 self.resource._request(
987 "post",
988 "/v1/test_helpers/issuing/authorizations/{authorization}/capture".format(
989 authorization=sanitize_id(self.resource.get("id"))
990 ),
991 params=params,
992 ),
993 )
994
995 @classmethod
996 async def _cls_capture_async(
997 cls,
998 authorization: str,
999 **params: Unpack["AuthorizationCaptureParams"],
1000 ) -> "Authorization":
1001 """
1002 Capture a test-mode authorization.
1003 """
1004 return cast(
1005 "Authorization",
1006 await cls._static_request_async(
1007 "post",
1008 "/v1/test_helpers/issuing/authorizations/{authorization}/capture".format(
1009 authorization=sanitize_id(authorization)
1010 ),
1011 params=params,
1012 ),
1013 )
1014
1015 @overload
1016 @staticmethod
1017 async def capture_async(
1018 authorization: str, **params: Unpack["AuthorizationCaptureParams"]
1019 ) -> "Authorization":
1020 """
1021 Capture a test-mode authorization.
1022 """
1023 ...
1024
1025 @overload
1026 async def capture_async(
1027 self, **params: Unpack["AuthorizationCaptureParams"]
1028 ) -> "Authorization":
1029 """
1030 Capture a test-mode authorization.
1031 """
1032 ...
1033
1034 @class_method_variant("_cls_capture_async")
1035 async def capture_async( # pyright: ignore[reportGeneralTypeIssues]
1036 self, **params: Unpack["AuthorizationCaptureParams"]
1037 ) -> "Authorization":
1038 """
1039 Capture a test-mode authorization.
1040 """
1041 return cast(
1042 "Authorization",
1043 await self.resource._request_async(
1044 "post",
1045 "/v1/test_helpers/issuing/authorizations/{authorization}/capture".format(
1046 authorization=sanitize_id(self.resource.get("id"))
1047 ),
1048 params=params,
1049 ),
1050 )
1051
1052 @classmethod
1053 def create(
1054 cls, **params: Unpack["AuthorizationCreateParams"]
1055 ) -> "Authorization":
1056 """
1057 Create a test-mode authorization.
1058 """
1059 return cast(
1060 "Authorization",
1061 cls._static_request(
1062 "post",
1063 "/v1/test_helpers/issuing/authorizations",
1064 params=params,
1065 ),
1066 )
1067
1068 @classmethod
1069 async def create_async(
1070 cls, **params: Unpack["AuthorizationCreateParams"]
1071 ) -> "Authorization":
1072 """
1073 Create a test-mode authorization.
1074 """
1075 return cast(
1076 "Authorization",
1077 await cls._static_request_async(
1078 "post",
1079 "/v1/test_helpers/issuing/authorizations",
1080 params=params,
1081 ),
1082 )
1083
1084 @classmethod
1085 def _cls_expire(
1086 cls,
1087 authorization: str,
1088 **params: Unpack["AuthorizationExpireParams"],
1089 ) -> "Authorization":
1090 """
1091 Expire a test-mode Authorization.
1092 """
1093 return cast(
1094 "Authorization",
1095 cls._static_request(
1096 "post",
1097 "/v1/test_helpers/issuing/authorizations/{authorization}/expire".format(
1098 authorization=sanitize_id(authorization)
1099 ),
1100 params=params,
1101 ),
1102 )
1103
1104 @overload
1105 @staticmethod
1106 def expire(
1107 authorization: str, **params: Unpack["AuthorizationExpireParams"]
1108 ) -> "Authorization":
1109 """
1110 Expire a test-mode Authorization.
1111 """
1112 ...
1113
1114 @overload
1115 def expire(
1116 self, **params: Unpack["AuthorizationExpireParams"]
1117 ) -> "Authorization":
1118 """
1119 Expire a test-mode Authorization.
1120 """
1121 ...
1122
1123 @class_method_variant("_cls_expire")
1124 def expire( # pyright: ignore[reportGeneralTypeIssues]
1125 self, **params: Unpack["AuthorizationExpireParams"]
1126 ) -> "Authorization":
1127 """
1128 Expire a test-mode Authorization.
1129 """
1130 return cast(
1131 "Authorization",
1132 self.resource._request(
1133 "post",
1134 "/v1/test_helpers/issuing/authorizations/{authorization}/expire".format(
1135 authorization=sanitize_id(self.resource.get("id"))
1136 ),
1137 params=params,
1138 ),
1139 )
1140
1141 @classmethod
1142 async def _cls_expire_async(
1143 cls,
1144 authorization: str,
1145 **params: Unpack["AuthorizationExpireParams"],
1146 ) -> "Authorization":
1147 """
1148 Expire a test-mode Authorization.
1149 """
1150 return cast(
1151 "Authorization",
1152 await cls._static_request_async(
1153 "post",
1154 "/v1/test_helpers/issuing/authorizations/{authorization}/expire".format(
1155 authorization=sanitize_id(authorization)
1156 ),
1157 params=params,
1158 ),
1159 )
1160
1161 @overload
1162 @staticmethod
1163 async def expire_async(
1164 authorization: str, **params: Unpack["AuthorizationExpireParams"]
1165 ) -> "Authorization":
1166 """
1167 Expire a test-mode Authorization.
1168 """
1169 ...
1170
1171 @overload
1172 async def expire_async(
1173 self, **params: Unpack["AuthorizationExpireParams"]
1174 ) -> "Authorization":
1175 """
1176 Expire a test-mode Authorization.
1177 """
1178 ...
1179
1180 @class_method_variant("_cls_expire_async")
1181 async def expire_async( # pyright: ignore[reportGeneralTypeIssues]
1182 self, **params: Unpack["AuthorizationExpireParams"]
1183 ) -> "Authorization":
1184 """
1185 Expire a test-mode Authorization.
1186 """
1187 return cast(
1188 "Authorization",
1189 await self.resource._request_async(
1190 "post",
1191 "/v1/test_helpers/issuing/authorizations/{authorization}/expire".format(
1192 authorization=sanitize_id(self.resource.get("id"))
1193 ),
1194 params=params,
1195 ),
1196 )
1197
1198 @classmethod
1199 def _cls_finalize_amount(
1200 cls,
1201 authorization: str,
1202 **params: Unpack["AuthorizationFinalizeAmountParams"],
1203 ) -> "Authorization":
1204 """
1205 Finalize the amount on an Authorization prior to capture, when the initial authorization was for an estimated amount.
1206 """
1207 return cast(
1208 "Authorization",
1209 cls._static_request(
1210 "post",
1211 "/v1/test_helpers/issuing/authorizations/{authorization}/finalize_amount".format(
1212 authorization=sanitize_id(authorization)
1213 ),
1214 params=params,
1215 ),
1216 )
1217
1218 @overload
1219 @staticmethod
1220 def finalize_amount(
1221 authorization: str,
1222 **params: Unpack["AuthorizationFinalizeAmountParams"],
1223 ) -> "Authorization":
1224 """
1225 Finalize the amount on an Authorization prior to capture, when the initial authorization was for an estimated amount.
1226 """
1227 ...
1228
1229 @overload
1230 def finalize_amount(
1231 self, **params: Unpack["AuthorizationFinalizeAmountParams"]
1232 ) -> "Authorization":
1233 """
1234 Finalize the amount on an Authorization prior to capture, when the initial authorization was for an estimated amount.
1235 """
1236 ...
1237
1238 @class_method_variant("_cls_finalize_amount")
1239 def finalize_amount( # pyright: ignore[reportGeneralTypeIssues]
1240 self, **params: Unpack["AuthorizationFinalizeAmountParams"]
1241 ) -> "Authorization":
1242 """
1243 Finalize the amount on an Authorization prior to capture, when the initial authorization was for an estimated amount.
1244 """
1245 return cast(
1246 "Authorization",
1247 self.resource._request(
1248 "post",
1249 "/v1/test_helpers/issuing/authorizations/{authorization}/finalize_amount".format(
1250 authorization=sanitize_id(self.resource.get("id"))
1251 ),
1252 params=params,
1253 ),
1254 )
1255
1256 @classmethod
1257 async def _cls_finalize_amount_async(
1258 cls,
1259 authorization: str,
1260 **params: Unpack["AuthorizationFinalizeAmountParams"],
1261 ) -> "Authorization":
1262 """
1263 Finalize the amount on an Authorization prior to capture, when the initial authorization was for an estimated amount.
1264 """
1265 return cast(
1266 "Authorization",
1267 await cls._static_request_async(
1268 "post",
1269 "/v1/test_helpers/issuing/authorizations/{authorization}/finalize_amount".format(
1270 authorization=sanitize_id(authorization)
1271 ),
1272 params=params,
1273 ),
1274 )
1275
1276 @overload
1277 @staticmethod
1278 async def finalize_amount_async(
1279 authorization: str,
1280 **params: Unpack["AuthorizationFinalizeAmountParams"],
1281 ) -> "Authorization":
1282 """
1283 Finalize the amount on an Authorization prior to capture, when the initial authorization was for an estimated amount.
1284 """
1285 ...
1286
1287 @overload
1288 async def finalize_amount_async(
1289 self, **params: Unpack["AuthorizationFinalizeAmountParams"]
1290 ) -> "Authorization":
1291 """
1292 Finalize the amount on an Authorization prior to capture, when the initial authorization was for an estimated amount.
1293 """
1294 ...
1295
1296 @class_method_variant("_cls_finalize_amount_async")
1297 async def finalize_amount_async( # pyright: ignore[reportGeneralTypeIssues]
1298 self, **params: Unpack["AuthorizationFinalizeAmountParams"]
1299 ) -> "Authorization":
1300 """
1301 Finalize the amount on an Authorization prior to capture, when the initial authorization was for an estimated amount.
1302 """
1303 return cast(
1304 "Authorization",
1305 await self.resource._request_async(
1306 "post",
1307 "/v1/test_helpers/issuing/authorizations/{authorization}/finalize_amount".format(
1308 authorization=sanitize_id(self.resource.get("id"))
1309 ),
1310 params=params,
1311 ),
1312 )
1313
1314 @classmethod
1315 def _cls_increment(
1316 cls,
1317 authorization: str,
1318 **params: Unpack["AuthorizationIncrementParams"],
1319 ) -> "Authorization":
1320 """
1321 Increment a test-mode Authorization.
1322 """
1323 return cast(
1324 "Authorization",
1325 cls._static_request(
1326 "post",
1327 "/v1/test_helpers/issuing/authorizations/{authorization}/increment".format(
1328 authorization=sanitize_id(authorization)
1329 ),
1330 params=params,
1331 ),
1332 )
1333
1334 @overload
1335 @staticmethod
1336 def increment(
1337 authorization: str,
1338 **params: Unpack["AuthorizationIncrementParams"],
1339 ) -> "Authorization":
1340 """
1341 Increment a test-mode Authorization.
1342 """
1343 ...
1344
1345 @overload
1346 def increment(
1347 self, **params: Unpack["AuthorizationIncrementParams"]
1348 ) -> "Authorization":
1349 """
1350 Increment a test-mode Authorization.
1351 """
1352 ...
1353
1354 @class_method_variant("_cls_increment")
1355 def increment( # pyright: ignore[reportGeneralTypeIssues]
1356 self, **params: Unpack["AuthorizationIncrementParams"]
1357 ) -> "Authorization":
1358 """
1359 Increment a test-mode Authorization.
1360 """
1361 return cast(
1362 "Authorization",
1363 self.resource._request(
1364 "post",
1365 "/v1/test_helpers/issuing/authorizations/{authorization}/increment".format(
1366 authorization=sanitize_id(self.resource.get("id"))
1367 ),
1368 params=params,
1369 ),
1370 )
1371
1372 @classmethod
1373 async def _cls_increment_async(
1374 cls,
1375 authorization: str,
1376 **params: Unpack["AuthorizationIncrementParams"],
1377 ) -> "Authorization":
1378 """
1379 Increment a test-mode Authorization.
1380 """
1381 return cast(
1382 "Authorization",
1383 await cls._static_request_async(
1384 "post",
1385 "/v1/test_helpers/issuing/authorizations/{authorization}/increment".format(
1386 authorization=sanitize_id(authorization)
1387 ),
1388 params=params,
1389 ),
1390 )
1391
1392 @overload
1393 @staticmethod
1394 async def increment_async(
1395 authorization: str,
1396 **params: Unpack["AuthorizationIncrementParams"],
1397 ) -> "Authorization":
1398 """
1399 Increment a test-mode Authorization.
1400 """
1401 ...
1402
1403 @overload
1404 async def increment_async(
1405 self, **params: Unpack["AuthorizationIncrementParams"]
1406 ) -> "Authorization":
1407 """
1408 Increment a test-mode Authorization.
1409 """
1410 ...
1411
1412 @class_method_variant("_cls_increment_async")
1413 async def increment_async( # pyright: ignore[reportGeneralTypeIssues]
1414 self, **params: Unpack["AuthorizationIncrementParams"]
1415 ) -> "Authorization":
1416 """
1417 Increment a test-mode Authorization.
1418 """
1419 return cast(
1420 "Authorization",
1421 await self.resource._request_async(
1422 "post",
1423 "/v1/test_helpers/issuing/authorizations/{authorization}/increment".format(
1424 authorization=sanitize_id(self.resource.get("id"))
1425 ),
1426 params=params,
1427 ),
1428 )
1429
1430 @classmethod
1431 def _cls_respond(
1432 cls,
1433 authorization: str,
1434 **params: Unpack["AuthorizationRespondParams"],
1435 ) -> "Authorization":
1436 """
1437 Respond to a fraud challenge on a testmode Issuing authorization, simulating either a confirmation of fraud or a correction of legitimacy.
1438 """
1439 return cast(
1440 "Authorization",
1441 cls._static_request(
1442 "post",
1443 "/v1/test_helpers/issuing/authorizations/{authorization}/fraud_challenges/respond".format(
1444 authorization=sanitize_id(authorization)
1445 ),
1446 params=params,
1447 ),
1448 )
1449
1450 @overload
1451 @staticmethod
1452 def respond(
1453 authorization: str, **params: Unpack["AuthorizationRespondParams"]
1454 ) -> "Authorization":
1455 """
1456 Respond to a fraud challenge on a testmode Issuing authorization, simulating either a confirmation of fraud or a correction of legitimacy.
1457 """
1458 ...
1459
1460 @overload
1461 def respond(
1462 self, **params: Unpack["AuthorizationRespondParams"]
1463 ) -> "Authorization":
1464 """
1465 Respond to a fraud challenge on a testmode Issuing authorization, simulating either a confirmation of fraud or a correction of legitimacy.
1466 """
1467 ...
1468
1469 @class_method_variant("_cls_respond")
1470 def respond( # pyright: ignore[reportGeneralTypeIssues]
1471 self, **params: Unpack["AuthorizationRespondParams"]
1472 ) -> "Authorization":
1473 """
1474 Respond to a fraud challenge on a testmode Issuing authorization, simulating either a confirmation of fraud or a correction of legitimacy.
1475 """
1476 return cast(
1477 "Authorization",
1478 self.resource._request(
1479 "post",
1480 "/v1/test_helpers/issuing/authorizations/{authorization}/fraud_challenges/respond".format(
1481 authorization=sanitize_id(self.resource.get("id"))
1482 ),
1483 params=params,
1484 ),
1485 )
1486
1487 @classmethod
1488 async def _cls_respond_async(
1489 cls,
1490 authorization: str,
1491 **params: Unpack["AuthorizationRespondParams"],
1492 ) -> "Authorization":
1493 """
1494 Respond to a fraud challenge on a testmode Issuing authorization, simulating either a confirmation of fraud or a correction of legitimacy.
1495 """
1496 return cast(
1497 "Authorization",
1498 await cls._static_request_async(
1499 "post",
1500 "/v1/test_helpers/issuing/authorizations/{authorization}/fraud_challenges/respond".format(
1501 authorization=sanitize_id(authorization)
1502 ),
1503 params=params,
1504 ),
1505 )
1506
1507 @overload
1508 @staticmethod
1509 async def respond_async(
1510 authorization: str, **params: Unpack["AuthorizationRespondParams"]
1511 ) -> "Authorization":
1512 """
1513 Respond to a fraud challenge on a testmode Issuing authorization, simulating either a confirmation of fraud or a correction of legitimacy.
1514 """
1515 ...
1516
1517 @overload
1518 async def respond_async(
1519 self, **params: Unpack["AuthorizationRespondParams"]
1520 ) -> "Authorization":
1521 """
1522 Respond to a fraud challenge on a testmode Issuing authorization, simulating either a confirmation of fraud or a correction of legitimacy.
1523 """
1524 ...
1525
1526 @class_method_variant("_cls_respond_async")
1527 async def respond_async( # pyright: ignore[reportGeneralTypeIssues]
1528 self, **params: Unpack["AuthorizationRespondParams"]
1529 ) -> "Authorization":
1530 """
1531 Respond to a fraud challenge on a testmode Issuing authorization, simulating either a confirmation of fraud or a correction of legitimacy.
1532 """
1533 return cast(
1534 "Authorization",
1535 await self.resource._request_async(
1536 "post",
1537 "/v1/test_helpers/issuing/authorizations/{authorization}/fraud_challenges/respond".format(
1538 authorization=sanitize_id(self.resource.get("id"))
1539 ),
1540 params=params,
1541 ),
1542 )
1543
1544 @classmethod
1545 def _cls_reverse(
1546 cls,
1547 authorization: str,
1548 **params: Unpack["AuthorizationReverseParams"],
1549 ) -> "Authorization":
1550 """
1551 Reverse a test-mode Authorization.
1552 """
1553 return cast(
1554 "Authorization",
1555 cls._static_request(
1556 "post",
1557 "/v1/test_helpers/issuing/authorizations/{authorization}/reverse".format(
1558 authorization=sanitize_id(authorization)
1559 ),
1560 params=params,
1561 ),
1562 )
1563
1564 @overload
1565 @staticmethod
1566 def reverse(
1567 authorization: str, **params: Unpack["AuthorizationReverseParams"]
1568 ) -> "Authorization":
1569 """
1570 Reverse a test-mode Authorization.
1571 """
1572 ...
1573
1574 @overload
1575 def reverse(
1576 self, **params: Unpack["AuthorizationReverseParams"]
1577 ) -> "Authorization":
1578 """
1579 Reverse a test-mode Authorization.
1580 """
1581 ...
1582
1583 @class_method_variant("_cls_reverse")
1584 def reverse( # pyright: ignore[reportGeneralTypeIssues]
1585 self, **params: Unpack["AuthorizationReverseParams"]
1586 ) -> "Authorization":
1587 """
1588 Reverse a test-mode Authorization.
1589 """
1590 return cast(
1591 "Authorization",
1592 self.resource._request(
1593 "post",
1594 "/v1/test_helpers/issuing/authorizations/{authorization}/reverse".format(
1595 authorization=sanitize_id(self.resource.get("id"))
1596 ),
1597 params=params,
1598 ),
1599 )
1600
1601 @classmethod
1602 async def _cls_reverse_async(
1603 cls,
1604 authorization: str,
1605 **params: Unpack["AuthorizationReverseParams"],
1606 ) -> "Authorization":
1607 """
1608 Reverse a test-mode Authorization.
1609 """
1610 return cast(
1611 "Authorization",
1612 await cls._static_request_async(
1613 "post",
1614 "/v1/test_helpers/issuing/authorizations/{authorization}/reverse".format(
1615 authorization=sanitize_id(authorization)
1616 ),
1617 params=params,
1618 ),
1619 )
1620
1621 @overload
1622 @staticmethod
1623 async def reverse_async(
1624 authorization: str, **params: Unpack["AuthorizationReverseParams"]
1625 ) -> "Authorization":
1626 """
1627 Reverse a test-mode Authorization.
1628 """
1629 ...
1630
1631 @overload
1632 async def reverse_async(
1633 self, **params: Unpack["AuthorizationReverseParams"]
1634 ) -> "Authorization":
1635 """
1636 Reverse a test-mode Authorization.
1637 """
1638 ...
1639
1640 @class_method_variant("_cls_reverse_async")
1641 async def reverse_async( # pyright: ignore[reportGeneralTypeIssues]
1642 self, **params: Unpack["AuthorizationReverseParams"]
1643 ) -> "Authorization":
1644 """
1645 Reverse a test-mode Authorization.
1646 """
1647 return cast(
1648 "Authorization",
1649 await self.resource._request_async(
1650 "post",
1651 "/v1/test_helpers/issuing/authorizations/{authorization}/reverse".format(
1652 authorization=sanitize_id(self.resource.get("id"))
1653 ),
1654 params=params,
1655 ),
1656 )
1657
1658 @property
1659 def test_helpers(self):
1660 return self.TestHelpers(self)
1661
1662 _inner_class_types = {
1663 "amount_details": AmountDetails,
1664 "fleet": Fleet,
1665 "fraud_challenges": FraudChallenge,
1666 "fuel": Fuel,
1667 "merchant_data": MerchantData,
1668 "network_data": NetworkData,
1669 "pending_request": PendingRequest,
1670 "request_history": RequestHistory,
1671 "treasury": Treasury,
1672 "verification_data": VerificationData,
1673 }
1674
1675
1676 Authorization.TestHelpers._resource_cls = Authorization