gr4vy 1.10.8__py3-none-any.whl → 1.10.10__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gr4vy/_version.py +3 -3
- gr4vy/models/adyencardoptions.py +1 -6
- gr4vy/models/adyensepaoptions.py +1 -6
- gr4vy/models/airline.py +2 -7
- gr4vy/models/airlineleg.py +2 -6
- gr4vy/models/airlinepassenger.py +2 -6
- gr4vy/models/auditlogentry.py +3 -3
- gr4vy/models/auditlogentryuser.py +3 -3
- gr4vy/models/braintreedynamicdatafieldsoptions.py +2 -7
- gr4vy/models/browserinfo.py +2 -4
- gr4vy/models/capture_transactionop.py +4 -20
- gr4vy/models/cartitem.py +2 -6
- gr4vy/models/checkoutsessionpaymentmethod.py +3 -5
- gr4vy/models/checkoutsessionpaymentmethoddetails.py +2 -6
- gr4vy/models/createsession.py +3 -3
- gr4vy/models/definitionfield.py +1 -6
- gr4vy/models/digitalwallet.py +3 -5
- gr4vy/models/digitalwalletcreate.py +2 -6
- gr4vy/models/dlocalupirecurringinfooptions.py +2 -6
- gr4vy/models/errordetail.py +2 -4
- gr4vy/models/forterantifraudoptions.py +2 -7
- gr4vy/models/forterantifraudoptionscartitembasicitemdata.py +2 -7
- gr4vy/models/forterantifraudoptionscartitemdeliverydetails.py +3 -6
- gr4vy/models/giftcardredemption.py +4 -8
- gr4vy/models/giftcardservice.py +3 -5
- gr4vy/models/giftcardsummary.py +3 -5
- gr4vy/models/list_all_report_executionsop.py +2 -14
- gr4vy/models/list_audit_logsop.py +2 -10
- gr4vy/models/list_buyer_payment_methodsop.py +2 -3
- gr4vy/models/list_payment_methodsop.py +2 -14
- gr4vy/models/list_payment_servicesop.py +2 -8
- gr4vy/models/list_reportsop.py +2 -10
- gr4vy/models/list_transactionsop.py +4 -22
- gr4vy/models/merchantaccount.py +3 -5
- gr4vy/models/merchantaccountcreate.py +2 -6
- gr4vy/models/merchantaccountupdate.py +2 -6
- gr4vy/models/networktoken.py +3 -3
- gr4vy/models/networktokenpaymentmethodcreate.py +4 -8
- gr4vy/models/paymentlink.py +12 -7
- gr4vy/models/paymentlinkcreate.py +10 -9
- gr4vy/models/paymentmethod.py +7 -13
- gr4vy/models/paymentmethodcard.py +3 -5
- gr4vy/models/paymentmethoddetailscard.py +2 -6
- gr4vy/models/paymentmethodsummary.py +6 -12
- gr4vy/models/paymentoption.py +3 -3
- gr4vy/models/paymentservice.py +4 -6
- gr4vy/models/paymentserviceconfiguration.py +2 -6
- gr4vy/models/paymentservicedefinition.py +5 -7
- gr4vy/models/paymentservicetoken.py +3 -3
- gr4vy/models/payoutcreate.py +2 -6
- gr4vy/models/payoutsummary.py +4 -6
- gr4vy/models/paypalshippingoptionsitem.py +2 -7
- gr4vy/models/redirectpaymentmethodcreate.py +2 -6
- gr4vy/models/refund.py +4 -4
- gr4vy/models/report.py +4 -6
- gr4vy/models/reportcreate.py +2 -3
- gr4vy/models/reportexecution.py +3 -3
- gr4vy/models/reportexecutionsummary.py +3 -3
- gr4vy/models/reportspec.py +2 -4
- gr4vy/models/reportsummary.py +3 -5
- gr4vy/models/taxid.py +2 -4
- gr4vy/models/threedsecuredatav1.py +2 -6
- gr4vy/models/threedsecuredatav2.py +2 -6
- gr4vy/models/transaction.py +11 -25
- gr4vy/models/transactionaction.py +4 -4
- gr4vy/models/transactioncancel.py +3 -3
- gr4vy/models/transactioncapture.py +3 -3
- gr4vy/models/transactioncreate.py +4 -12
- gr4vy/models/transactionevent.py +4 -3
- gr4vy/models/transactionpaymentmethod.py +6 -12
- gr4vy/models/transactionpaymentservice.py +3 -3
- gr4vy/models/transactionrefundcreate.py +2 -6
- gr4vy/models/transactionsummary.py +6 -10
- gr4vy/models/transactionthreedsecuresummary.py +3 -9
- gr4vy/models/transactionvoid.py +3 -3
- gr4vy/models/void_transactionop.py +5 -25
- gr4vy/payment_links_sdk.py +6 -0
- gr4vy/utils/__init__.py +0 -3
- gr4vy/utils/enums.py +60 -0
- gr4vy/utils/requestbodies.py +3 -3
- gr4vy/utils/serializers.py +0 -20
- {gr4vy-1.10.8.dist-info → gr4vy-1.10.10.dist-info}/METADATA +1 -1
- {gr4vy-1.10.8.dist-info → gr4vy-1.10.10.dist-info}/RECORD +84 -84
- {gr4vy-1.10.8.dist-info → gr4vy-1.10.10.dist-info}/WHEEL +0 -0
|
@@ -69,11 +69,9 @@ from .transactionconnectionoptions import (
|
|
|
69
69
|
from .transactionintent import TransactionIntent
|
|
70
70
|
from .transactionpaymentsource import TransactionPaymentSource
|
|
71
71
|
from gr4vy.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
72
|
-
from gr4vy.utils import validate_open_enum
|
|
73
72
|
from pydantic import model_serializer
|
|
74
|
-
from pydantic.functional_validators import PlainValidator
|
|
75
73
|
from typing import Dict, List, Optional, Union
|
|
76
|
-
from typing_extensions import
|
|
74
|
+
from typing_extensions import NotRequired, TypeAliasType, TypedDict
|
|
77
75
|
|
|
78
76
|
|
|
79
77
|
TransactionCreatePaymentMethodTypedDict = TypeAliasType(
|
|
@@ -267,9 +265,7 @@ class TransactionCreate(BaseModel):
|
|
|
267
265
|
external_identifier: OptionalNullable[str] = UNSET
|
|
268
266
|
r"""An external identifier that can be used to match the transaction against your own records."""
|
|
269
267
|
|
|
270
|
-
intent:
|
|
271
|
-
Optional[TransactionIntent], PlainValidator(validate_open_enum(False))
|
|
272
|
-
] = None
|
|
268
|
+
intent: Optional[TransactionIntent] = None
|
|
273
269
|
|
|
274
270
|
store: Optional[bool] = False
|
|
275
271
|
r"""Whether or not to also try and store the payment method with us so that it can be used again for future use. This is only supported for payment methods that support this feature. There are also a few restrictions on how the flag may be set:
|
|
@@ -301,9 +297,7 @@ class TransactionCreate(BaseModel):
|
|
|
301
297
|
merchant_initiated: Optional[bool] = False
|
|
302
298
|
r"""Indicates whether the transaction was initiated by the merchant (true) or customer (false)."""
|
|
303
299
|
|
|
304
|
-
payment_source:
|
|
305
|
-
Optional[TransactionPaymentSource], PlainValidator(validate_open_enum(False))
|
|
306
|
-
] = None
|
|
300
|
+
payment_source: Optional[TransactionPaymentSource] = None
|
|
307
301
|
r"""The way payment method information made it to this transaction."""
|
|
308
302
|
|
|
309
303
|
airline: OptionalNullable[Airline] = UNSET
|
|
@@ -378,9 +372,7 @@ class TransactionCreate(BaseModel):
|
|
|
378
372
|
shipping_amount: OptionalNullable[int] = UNSET
|
|
379
373
|
r"""Total shipping amount."""
|
|
380
374
|
|
|
381
|
-
integration_client:
|
|
382
|
-
OptionalNullable[IntegrationClient], PlainValidator(validate_open_enum(False))
|
|
383
|
-
] = UNSET
|
|
375
|
+
integration_client: OptionalNullable[IntegrationClient] = UNSET
|
|
384
376
|
r"""Defines the client where the session for this transaction is going to be used. Please refer to the connections documentation for more guidance."""
|
|
385
377
|
|
|
386
378
|
@model_serializer(mode="wrap")
|
gr4vy/models/transactionevent.py
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from datetime import datetime
|
|
5
5
|
from gr4vy.types import BaseModel, UnrecognizedStr
|
|
6
|
-
from gr4vy.utils import validate_const
|
|
6
|
+
from gr4vy.utils import validate_const
|
|
7
7
|
import pydantic
|
|
8
|
-
from pydantic.functional_validators import AfterValidator
|
|
8
|
+
from pydantic.functional_validators import AfterValidator
|
|
9
9
|
from typing import Any, Dict, Literal, Optional, Union
|
|
10
10
|
from typing_extensions import Annotated, TypedDict
|
|
11
11
|
|
|
@@ -53,6 +53,7 @@ Name = Union[
|
|
|
53
53
|
"payment-connector-report-transaction-settled",
|
|
54
54
|
"payment-connector-report-chargeback-posted",
|
|
55
55
|
"payment-connector-report-chargeback-reversal-posted",
|
|
56
|
+
"payment-connector-transaction-webhook-processed",
|
|
56
57
|
"digital-wallet-apple-pay-token-decrypted",
|
|
57
58
|
"digital-wallet-google-pay-token-decrypted",
|
|
58
59
|
"digital-wallet-click-to-pay-token-decrypted",
|
|
@@ -85,7 +86,7 @@ class TransactionEvent(BaseModel):
|
|
|
85
86
|
id: str
|
|
86
87
|
r"""The ID for the event."""
|
|
87
88
|
|
|
88
|
-
name:
|
|
89
|
+
name: Name
|
|
89
90
|
r"""The specific event name."""
|
|
90
91
|
|
|
91
92
|
created_at: datetime
|
|
@@ -11,10 +11,10 @@ from .paymentmethoddetailscard import (
|
|
|
11
11
|
)
|
|
12
12
|
from datetime import datetime
|
|
13
13
|
from gr4vy.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
14
|
-
from gr4vy.utils import validate_const
|
|
14
|
+
from gr4vy.utils import validate_const
|
|
15
15
|
import pydantic
|
|
16
16
|
from pydantic import model_serializer
|
|
17
|
-
from pydantic.functional_validators import AfterValidator
|
|
17
|
+
from pydantic.functional_validators import AfterValidator
|
|
18
18
|
from typing import Literal, Optional
|
|
19
19
|
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
20
20
|
|
|
@@ -54,7 +54,7 @@ class TransactionPaymentMethodTypedDict(TypedDict):
|
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
class TransactionPaymentMethod(BaseModel):
|
|
57
|
-
method:
|
|
57
|
+
method: Method
|
|
58
58
|
|
|
59
59
|
TYPE: Annotated[
|
|
60
60
|
Annotated[
|
|
@@ -89,22 +89,16 @@ class TransactionPaymentMethod(BaseModel):
|
|
|
89
89
|
last_replaced_at: OptionalNullable[datetime] = UNSET
|
|
90
90
|
r"""The date and time when this card was last replaced by the account updater."""
|
|
91
91
|
|
|
92
|
-
mode:
|
|
93
|
-
OptionalNullable[Mode], PlainValidator(validate_open_enum(False))
|
|
94
|
-
] = UNSET
|
|
92
|
+
mode: OptionalNullable[Mode] = UNSET
|
|
95
93
|
r"""The mode to use with this payment method."""
|
|
96
94
|
|
|
97
|
-
scheme:
|
|
98
|
-
OptionalNullable[CardScheme], PlainValidator(validate_open_enum(False))
|
|
99
|
-
] = UNSET
|
|
95
|
+
scheme: OptionalNullable[CardScheme] = UNSET
|
|
100
96
|
r"""The scheme of the card. Only applies to card payments."""
|
|
101
97
|
|
|
102
98
|
id: OptionalNullable[str] = UNSET
|
|
103
99
|
r"""The ID of the payment method."""
|
|
104
100
|
|
|
105
|
-
approval_target:
|
|
106
|
-
OptionalNullable[ApprovalTarget], PlainValidator(validate_open_enum(False))
|
|
107
|
-
] = UNSET
|
|
101
|
+
approval_target: OptionalNullable[ApprovalTarget] = UNSET
|
|
108
102
|
r"""The browser target that an approval URL must be opened in. If any or null, then there is no specific requirement."""
|
|
109
103
|
|
|
110
104
|
external_identifier: OptionalNullable[str] = UNSET
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from .method import Method
|
|
5
5
|
from gr4vy.types import BaseModel
|
|
6
|
-
from gr4vy.utils import validate_const
|
|
6
|
+
from gr4vy.utils import validate_const
|
|
7
7
|
import pydantic
|
|
8
|
-
from pydantic.functional_validators import AfterValidator
|
|
8
|
+
from pydantic.functional_validators import AfterValidator
|
|
9
9
|
from typing import Literal, Optional
|
|
10
10
|
from typing_extensions import Annotated, TypedDict
|
|
11
11
|
|
|
@@ -29,7 +29,7 @@ class TransactionPaymentService(BaseModel):
|
|
|
29
29
|
payment_service_definition_id: str
|
|
30
30
|
r"""The definition ID of the service used to process this payment."""
|
|
31
31
|
|
|
32
|
-
method:
|
|
32
|
+
method: Method
|
|
33
33
|
|
|
34
34
|
display_name: str
|
|
35
35
|
r"""The display name for the payment service."""
|
|
@@ -3,11 +3,9 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from .refundtargettype import RefundTargetType
|
|
5
5
|
from gr4vy.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
6
|
-
from gr4vy.utils import validate_open_enum
|
|
7
6
|
from pydantic import model_serializer
|
|
8
|
-
from pydantic.functional_validators import PlainValidator
|
|
9
7
|
from typing import Optional
|
|
10
|
-
from typing_extensions import
|
|
8
|
+
from typing_extensions import NotRequired, TypedDict
|
|
11
9
|
|
|
12
10
|
|
|
13
11
|
class TransactionRefundCreateTypedDict(TypedDict):
|
|
@@ -26,9 +24,7 @@ class TransactionRefundCreate(BaseModel):
|
|
|
26
24
|
amount: OptionalNullable[int] = UNSET
|
|
27
25
|
r"""The amount to refund, in the smallest currency unit (e.g., cents). If omitted, a full refund will be requested."""
|
|
28
26
|
|
|
29
|
-
target_type:
|
|
30
|
-
Optional[RefundTargetType], PlainValidator(validate_open_enum(False))
|
|
31
|
-
] = None
|
|
27
|
+
target_type: Optional[RefundTargetType] = None
|
|
32
28
|
|
|
33
29
|
target_id: OptionalNullable[str] = UNSET
|
|
34
30
|
r"""The optional ID of the instrument to refund for. This is only required when the `target_type` is set to `gift-card-redemption`."""
|
|
@@ -19,10 +19,10 @@ from .transactionpaymentservice import (
|
|
|
19
19
|
from .transactionstatus import TransactionStatus
|
|
20
20
|
from datetime import datetime
|
|
21
21
|
from gr4vy.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
22
|
-
from gr4vy.utils import validate_const
|
|
22
|
+
from gr4vy.utils import validate_const
|
|
23
23
|
import pydantic
|
|
24
24
|
from pydantic import model_serializer
|
|
25
|
-
from pydantic.functional_validators import AfterValidator
|
|
25
|
+
from pydantic.functional_validators import AfterValidator
|
|
26
26
|
from typing import List, Literal, Optional
|
|
27
27
|
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
28
28
|
|
|
@@ -112,7 +112,7 @@ class TransactionSummary(BaseModel):
|
|
|
112
112
|
amount: int
|
|
113
113
|
r"""The total amount for this transaction across all funding sources including gift cards."""
|
|
114
114
|
|
|
115
|
-
status:
|
|
115
|
+
status: TransactionStatus
|
|
116
116
|
|
|
117
117
|
authorized_amount: int
|
|
118
118
|
r"""The amount for this transaction that has been authorized for the `payment_method`. This can be less than the `amount` if gift cards were used."""
|
|
@@ -129,7 +129,7 @@ class TransactionSummary(BaseModel):
|
|
|
129
129
|
settled: bool
|
|
130
130
|
r"""Indicates whether this transaction has been settled."""
|
|
131
131
|
|
|
132
|
-
intent:
|
|
132
|
+
intent: TransactionIntent
|
|
133
133
|
|
|
134
134
|
gift_card_redemptions: List[GiftCardRedemption]
|
|
135
135
|
r"""The gift cards redeemed for this transaction."""
|
|
@@ -164,14 +164,10 @@ class TransactionSummary(BaseModel):
|
|
|
164
164
|
payment_method: OptionalNullable[TransactionPaymentMethod] = UNSET
|
|
165
165
|
r"""The payment method used for this transaction."""
|
|
166
166
|
|
|
167
|
-
method:
|
|
168
|
-
OptionalNullable[Method], PlainValidator(validate_open_enum(False))
|
|
169
|
-
] = UNSET
|
|
167
|
+
method: OptionalNullable[Method] = UNSET
|
|
170
168
|
r"""The method used for the transaction."""
|
|
171
169
|
|
|
172
|
-
instrument_type:
|
|
173
|
-
OptionalNullable[InstrumentType], PlainValidator(validate_open_enum(False))
|
|
174
|
-
] = UNSET
|
|
170
|
+
instrument_type: OptionalNullable[InstrumentType] = UNSET
|
|
175
171
|
r"""The name of the instrument used to process the transaction."""
|
|
176
172
|
|
|
177
173
|
error_code: OptionalNullable[str] = UNSET
|
|
@@ -7,11 +7,9 @@ from .threedsecuremethod import ThreeDSecureMethod
|
|
|
7
7
|
from .threedsecurestatus import ThreeDSecureStatus
|
|
8
8
|
from .threedsecurev2 import ThreeDSecureV2, ThreeDSecureV2TypedDict
|
|
9
9
|
from gr4vy.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
10
|
-
from gr4vy.utils import validate_open_enum
|
|
11
10
|
from pydantic import model_serializer
|
|
12
|
-
from pydantic.functional_validators import PlainValidator
|
|
13
11
|
from typing import Union
|
|
14
|
-
from typing_extensions import
|
|
12
|
+
from typing_extensions import NotRequired, TypeAliasType, TypedDict
|
|
15
13
|
|
|
16
14
|
|
|
17
15
|
ResponseDataTypedDict = TypeAliasType(
|
|
@@ -41,14 +39,10 @@ class TransactionThreeDSecureSummary(BaseModel):
|
|
|
41
39
|
version: OptionalNullable[str] = UNSET
|
|
42
40
|
r"""The version of 3DS used for this transaction."""
|
|
43
41
|
|
|
44
|
-
status:
|
|
45
|
-
OptionalNullable[ThreeDSecureStatus], PlainValidator(validate_open_enum(False))
|
|
46
|
-
] = UNSET
|
|
42
|
+
status: OptionalNullable[ThreeDSecureStatus] = UNSET
|
|
47
43
|
r"""The status of the 3DS challenge for this transaction."""
|
|
48
44
|
|
|
49
|
-
method:
|
|
50
|
-
OptionalNullable[ThreeDSecureMethod], PlainValidator(validate_open_enum(False))
|
|
51
|
-
] = UNSET
|
|
45
|
+
method: OptionalNullable[ThreeDSecureMethod] = UNSET
|
|
52
46
|
r"""The method used for 3DS authentication for this transaction."""
|
|
53
47
|
|
|
54
48
|
response_data: OptionalNullable[ResponseData] = UNSET
|
gr4vy/models/transactionvoid.py
CHANGED
|
@@ -4,10 +4,10 @@ from __future__ import annotations
|
|
|
4
4
|
from .transaction import Transaction, TransactionTypedDict
|
|
5
5
|
from .voidstatus import VoidStatus
|
|
6
6
|
from gr4vy.types import BaseModel, Nullable, UNSET_SENTINEL
|
|
7
|
-
from gr4vy.utils import validate_const
|
|
7
|
+
from gr4vy.utils import validate_const
|
|
8
8
|
import pydantic
|
|
9
9
|
from pydantic import model_serializer
|
|
10
|
-
from pydantic.functional_validators import AfterValidator
|
|
10
|
+
from pydantic.functional_validators import AfterValidator
|
|
11
11
|
from typing import Literal, Optional
|
|
12
12
|
from typing_extensions import Annotated, TypedDict
|
|
13
13
|
|
|
@@ -27,7 +27,7 @@ class TransactionVoidTypedDict(TypedDict):
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
class TransactionVoid(BaseModel):
|
|
30
|
-
status:
|
|
30
|
+
status: VoidStatus
|
|
31
31
|
|
|
32
32
|
code: Nullable[str]
|
|
33
33
|
r"""The standardized error code set by Gr4vy."""
|
|
@@ -4,14 +4,9 @@ from __future__ import annotations
|
|
|
4
4
|
from .transaction import Transaction, TransactionTypedDict
|
|
5
5
|
from .transactionvoid import TransactionVoid, TransactionVoidTypedDict
|
|
6
6
|
from gr4vy.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
7
|
-
from gr4vy.utils import
|
|
8
|
-
FieldMetadata,
|
|
9
|
-
HeaderMetadata,
|
|
10
|
-
PathParamMetadata,
|
|
11
|
-
get_discriminator,
|
|
12
|
-
)
|
|
7
|
+
from gr4vy.utils import FieldMetadata, HeaderMetadata, PathParamMetadata
|
|
13
8
|
import pydantic
|
|
14
|
-
from pydantic import
|
|
9
|
+
from pydantic import model_serializer
|
|
15
10
|
from typing import List, Optional, Union
|
|
16
11
|
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
|
17
12
|
|
|
@@ -96,22 +91,7 @@ ResponseVoidTransactionTypedDict = TypeAliasType(
|
|
|
96
91
|
r"""Successful Response"""
|
|
97
92
|
|
|
98
93
|
|
|
99
|
-
ResponseVoidTransaction =
|
|
100
|
-
Union[
|
|
101
|
-
|
|
102
|
-
Annotated[Transaction, Tag("authorization_succeeded")],
|
|
103
|
-
Annotated[Transaction, Tag("authorization_declined")],
|
|
104
|
-
Annotated[Transaction, Tag("authorization_failed")],
|
|
105
|
-
Annotated[Transaction, Tag("authorization_voided")],
|
|
106
|
-
Annotated[Transaction, Tag("authorization_void_pending")],
|
|
107
|
-
Annotated[Transaction, Tag("capture_succeeded")],
|
|
108
|
-
Annotated[Transaction, Tag("capture_pending")],
|
|
109
|
-
Annotated[Transaction, Tag("buyer_approval_pending")],
|
|
110
|
-
Annotated[TransactionVoid, Tag("succeeded")],
|
|
111
|
-
Annotated[TransactionVoid, Tag("pending")],
|
|
112
|
-
Annotated[TransactionVoid, Tag("declined")],
|
|
113
|
-
Annotated[TransactionVoid, Tag("failed")],
|
|
114
|
-
],
|
|
115
|
-
Discriminator(lambda m: get_discriminator(m, "status", "status")),
|
|
116
|
-
]
|
|
94
|
+
ResponseVoidTransaction = TypeAliasType(
|
|
95
|
+
"ResponseVoidTransaction", Union[TransactionVoid, Transaction]
|
|
96
|
+
)
|
|
117
97
|
r"""Successful Response"""
|
gr4vy/payment_links_sdk.py
CHANGED
|
@@ -50,6 +50,7 @@ class PaymentLinksSDK(BaseSDK):
|
|
|
50
50
|
payment_source: Optional[models.TransactionPaymentSource] = None,
|
|
51
51
|
store: Optional[bool] = False,
|
|
52
52
|
buyer_id: OptionalNullable[str] = UNSET,
|
|
53
|
+
installment_count: OptionalNullable[int] = UNSET,
|
|
53
54
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
54
55
|
server_url: Optional[str] = None,
|
|
55
56
|
timeout_ms: Optional[int] = None,
|
|
@@ -83,6 +84,7 @@ class PaymentLinksSDK(BaseSDK):
|
|
|
83
84
|
:param payment_source: The way payment method information made it to this transaction.
|
|
84
85
|
:param store: Whether to store the payment method for future use.
|
|
85
86
|
:param buyer_id: The ID of the buyer to associate the payment method with. Note: When `buyer_id` is provided, the payment link should be treated as a secret as it will allow the user to manage payment methods for the associated buyer.
|
|
87
|
+
:param installment_count: The number of installments a buyer is required to make.
|
|
86
88
|
:param retries: Override the default retry configuration for this method
|
|
87
89
|
:param server_url: Override the default server URL for this method
|
|
88
90
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -133,6 +135,7 @@ class PaymentLinksSDK(BaseSDK):
|
|
|
133
135
|
payment_source=payment_source,
|
|
134
136
|
store=store,
|
|
135
137
|
buyer_id=buyer_id,
|
|
138
|
+
installment_count=installment_count,
|
|
136
139
|
),
|
|
137
140
|
)
|
|
138
141
|
|
|
@@ -289,6 +292,7 @@ class PaymentLinksSDK(BaseSDK):
|
|
|
289
292
|
payment_source: Optional[models.TransactionPaymentSource] = None,
|
|
290
293
|
store: Optional[bool] = False,
|
|
291
294
|
buyer_id: OptionalNullable[str] = UNSET,
|
|
295
|
+
installment_count: OptionalNullable[int] = UNSET,
|
|
292
296
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
293
297
|
server_url: Optional[str] = None,
|
|
294
298
|
timeout_ms: Optional[int] = None,
|
|
@@ -322,6 +326,7 @@ class PaymentLinksSDK(BaseSDK):
|
|
|
322
326
|
:param payment_source: The way payment method information made it to this transaction.
|
|
323
327
|
:param store: Whether to store the payment method for future use.
|
|
324
328
|
:param buyer_id: The ID of the buyer to associate the payment method with. Note: When `buyer_id` is provided, the payment link should be treated as a secret as it will allow the user to manage payment methods for the associated buyer.
|
|
329
|
+
:param installment_count: The number of installments a buyer is required to make.
|
|
325
330
|
:param retries: Override the default retry configuration for this method
|
|
326
331
|
:param server_url: Override the default server URL for this method
|
|
327
332
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -372,6 +377,7 @@ class PaymentLinksSDK(BaseSDK):
|
|
|
372
377
|
payment_source=payment_source,
|
|
373
378
|
store=store,
|
|
374
379
|
buyer_id=buyer_id,
|
|
380
|
+
installment_count=installment_count,
|
|
375
381
|
),
|
|
376
382
|
)
|
|
377
383
|
|
gr4vy/utils/__init__.py
CHANGED
|
@@ -42,7 +42,6 @@ if TYPE_CHECKING:
|
|
|
42
42
|
validate_decimal,
|
|
43
43
|
validate_float,
|
|
44
44
|
validate_int,
|
|
45
|
-
validate_open_enum,
|
|
46
45
|
)
|
|
47
46
|
from .url import generate_url, template_url, remove_suffix
|
|
48
47
|
from .values import (
|
|
@@ -104,7 +103,6 @@ __all__ = [
|
|
|
104
103
|
"validate_const",
|
|
105
104
|
"validate_float",
|
|
106
105
|
"validate_int",
|
|
107
|
-
"validate_open_enum",
|
|
108
106
|
"cast_partial",
|
|
109
107
|
]
|
|
110
108
|
|
|
@@ -158,7 +156,6 @@ _dynamic_imports: dict[str, str] = {
|
|
|
158
156
|
"validate_const": ".serializers",
|
|
159
157
|
"validate_float": ".serializers",
|
|
160
158
|
"validate_int": ".serializers",
|
|
161
|
-
"validate_open_enum": ".serializers",
|
|
162
159
|
"cast_partial": ".values",
|
|
163
160
|
}
|
|
164
161
|
|
gr4vy/utils/enums.py
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import enum
|
|
4
4
|
import sys
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
from pydantic_core import core_schema
|
|
8
|
+
|
|
5
9
|
|
|
6
10
|
class OpenEnumMeta(enum.EnumMeta):
|
|
7
11
|
# The __call__ method `boundary` kwarg was added in 3.11 and must be present
|
|
@@ -72,3 +76,59 @@ class OpenEnumMeta(enum.EnumMeta):
|
|
|
72
76
|
)
|
|
73
77
|
except ValueError:
|
|
74
78
|
return value
|
|
79
|
+
|
|
80
|
+
def __new__(mcs, name, bases, namespace, **kwargs):
|
|
81
|
+
cls = super().__new__(mcs, name, bases, namespace, **kwargs)
|
|
82
|
+
|
|
83
|
+
# Add __get_pydantic_core_schema__ to make open enums work correctly
|
|
84
|
+
# in union discrimination. In strict mode (used by Pydantic for unions),
|
|
85
|
+
# only known enum values match. In lax mode, unknown values are accepted.
|
|
86
|
+
def __get_pydantic_core_schema__(
|
|
87
|
+
cls_inner: Any, _source_type: Any, _handler: Any
|
|
88
|
+
) -> core_schema.CoreSchema:
|
|
89
|
+
# Create a validator that only accepts known enum values (for strict mode)
|
|
90
|
+
def validate_strict(v: Any) -> Any:
|
|
91
|
+
if isinstance(v, cls_inner):
|
|
92
|
+
return v
|
|
93
|
+
# Use the parent EnumMeta's __call__ which raises ValueError for unknown values
|
|
94
|
+
return enum.EnumMeta.__call__(cls_inner, v)
|
|
95
|
+
|
|
96
|
+
# Create a lax validator that accepts unknown values
|
|
97
|
+
def validate_lax(v: Any) -> Any:
|
|
98
|
+
if isinstance(v, cls_inner):
|
|
99
|
+
return v
|
|
100
|
+
try:
|
|
101
|
+
return enum.EnumMeta.__call__(cls_inner, v)
|
|
102
|
+
except ValueError:
|
|
103
|
+
# Return the raw value for unknown enum values
|
|
104
|
+
return v
|
|
105
|
+
|
|
106
|
+
# Determine the base type schema (str or int)
|
|
107
|
+
is_int_enum = False
|
|
108
|
+
for base in cls_inner.__mro__:
|
|
109
|
+
if base is int:
|
|
110
|
+
is_int_enum = True
|
|
111
|
+
break
|
|
112
|
+
if base is str:
|
|
113
|
+
break
|
|
114
|
+
|
|
115
|
+
base_schema = (
|
|
116
|
+
core_schema.int_schema()
|
|
117
|
+
if is_int_enum
|
|
118
|
+
else core_schema.str_schema()
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
# Use lax_or_strict_schema:
|
|
122
|
+
# - strict mode: only known enum values match (raises ValueError for unknown)
|
|
123
|
+
# - lax mode: accept any value, return enum member or raw value
|
|
124
|
+
return core_schema.lax_or_strict_schema(
|
|
125
|
+
lax_schema=core_schema.chain_schema(
|
|
126
|
+
[base_schema, core_schema.no_info_plain_validator_function(validate_lax)]
|
|
127
|
+
),
|
|
128
|
+
strict_schema=core_schema.chain_schema(
|
|
129
|
+
[base_schema, core_schema.no_info_plain_validator_function(validate_strict)]
|
|
130
|
+
),
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
setattr(cls, "__get_pydantic_core_schema__", classmethod(__get_pydantic_core_schema__))
|
|
134
|
+
return cls
|
gr4vy/utils/requestbodies.py
CHANGED
|
@@ -44,15 +44,15 @@ def serialize_request_body(
|
|
|
44
44
|
|
|
45
45
|
serialized_request_body = SerializedRequestBody(media_type)
|
|
46
46
|
|
|
47
|
-
if re.match(r"(application|text)
|
|
47
|
+
if re.match(r"^(application|text)\/([^+]+\+)*json.*", media_type) is not None:
|
|
48
48
|
serialized_request_body.content = marshal_json(request_body, request_body_type)
|
|
49
|
-
elif re.match(r"multipart\/.*", media_type) is not None:
|
|
49
|
+
elif re.match(r"^multipart\/.*", media_type) is not None:
|
|
50
50
|
(
|
|
51
51
|
serialized_request_body.media_type,
|
|
52
52
|
serialized_request_body.data,
|
|
53
53
|
serialized_request_body.files,
|
|
54
54
|
) = serialize_multipart_form(media_type, request_body)
|
|
55
|
-
elif re.match(r"application\/x-www-form-urlencoded.*", media_type) is not None:
|
|
55
|
+
elif re.match(r"^application\/x-www-form-urlencoded.*", media_type) is not None:
|
|
56
56
|
serialized_request_body.data = serialize_form_data(request_body)
|
|
57
57
|
elif isinstance(request_body, (bytes, bytearray, io.BytesIO, io.BufferedReader)):
|
|
58
58
|
serialized_request_body.content = request_body
|
gr4vy/utils/serializers.py
CHANGED
|
@@ -102,26 +102,6 @@ def validate_int(b):
|
|
|
102
102
|
return int(b)
|
|
103
103
|
|
|
104
104
|
|
|
105
|
-
def validate_open_enum(is_int: bool):
|
|
106
|
-
def validate(e):
|
|
107
|
-
if e is None:
|
|
108
|
-
return None
|
|
109
|
-
|
|
110
|
-
if isinstance(e, Unset):
|
|
111
|
-
return e
|
|
112
|
-
|
|
113
|
-
if is_int:
|
|
114
|
-
if not isinstance(e, int):
|
|
115
|
-
raise ValueError("Expected int")
|
|
116
|
-
else:
|
|
117
|
-
if not isinstance(e, str):
|
|
118
|
-
raise ValueError("Expected string")
|
|
119
|
-
|
|
120
|
-
return e
|
|
121
|
-
|
|
122
|
-
return validate
|
|
123
|
-
|
|
124
|
-
|
|
125
105
|
def validate_const(v):
|
|
126
106
|
def validate(c):
|
|
127
107
|
# Optional[T] is a Union[T, None]
|