Debian Codegraph @

stripe/tax/_association.py

raw
1 # -*- coding: utf-8 -*-
2 # File generated from our OpenAPI spec
3 from stripe._api_resource import APIResource
4 from stripe._stripe_object import StripeObject
5 from typing import ClassVar, List, Optional, cast
6 from typing_extensions import Literal, Unpack, TYPE_CHECKING
7
8 if TYPE_CHECKING:
9 from stripe.params.tax._association_find_params import (
10 AssociationFindParams,
11 )
12
13
14 class Association(APIResource["Association"]):
15 """
16 A Tax Association exposes the Tax Transactions that Stripe attempted to create on your behalf based on the PaymentIntent input
17 """
18
19 OBJECT_NAME: ClassVar[Literal["tax.association"]] = "tax.association"
20
21 class TaxTransactionAttempt(StripeObject):
22 class Committed(StripeObject):
23 transaction: str
24 """
25 The [Tax Transaction](https://docs.stripe.com/api/tax/transaction/object)
26 """
27
28 class Errored(StripeObject):
29 reason: Literal[
30 "another_payment_associated_with_calculation",
31 "calculation_expired",
32 "currency_mismatch",
33 "original_transaction_voided",
34 "unique_reference_violation",
35 ]
36 """
37 Details on why we couldn't commit the tax transaction.
38 """
39
40 committed: Optional[Committed]
41 errored: Optional[Errored]
42 source: str
43 """
44 The source of the tax transaction attempt. This is either a refund or a payment intent.
45 """
46 status: str
47 """
48 The status of the transaction attempt. This can be `errored` or `committed`.
49 """
50 _inner_class_types = {"committed": Committed, "errored": Errored}
51
52 calculation: str
53 """
54 The [Tax Calculation](https://docs.stripe.com/api/tax/calculations/object) that was included in PaymentIntent.
55 """
56 id: str
57 """
58 Unique identifier for the object.
59 """
60 object: Literal["tax.association"]
61 """
62 String representing the object's type. Objects of the same type share the same value.
63 """
64 payment_intent: str
65 """
66 The [PaymentIntent](https://docs.stripe.com/api/payment_intents/object) that this Tax Association is tracking.
67 """
68 tax_transaction_attempts: Optional[List[TaxTransactionAttempt]]
69 """
70 Information about the tax transactions linked to this payment intent
71 """
72
73 @classmethod
74 def find(cls, **params: Unpack["AssociationFindParams"]) -> "Association":
75 """
76 Finds a tax association object by PaymentIntent id.
77 """
78 return cast(
79 "Association",
80 cls._static_request(
81 "get",
82 "/v1/tax/associations/find",
83 params=params,
84 ),
85 )
86
87 @classmethod
88 async def find_async(
89 cls, **params: Unpack["AssociationFindParams"]
90 ) -> "Association":
91 """
92 Finds a tax association object by PaymentIntent id.
93 """
94 return cast(
95 "Association",
96 await cls._static_request_async(
97 "get",
98 "/v1/tax/associations/find",
99 params=params,
100 ),
101 )
102
103 _inner_class_types = {"tax_transaction_attempts": TaxTransactionAttempt}