gr4vy 1.5.2__py3-none-any.whl → 1.10.9__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.
Files changed (169) hide show
  1. gr4vy/_version.py +3 -3
  2. gr4vy/actions.py +307 -0
  3. gr4vy/all.py +4 -2
  4. gr4vy/audit_logs.py +4 -2
  5. gr4vy/balances.py +4 -2
  6. gr4vy/basesdk.py +6 -0
  7. gr4vy/buyers_gift_cards.py +4 -2
  8. gr4vy/buyers_payment_methods.py +4 -2
  9. gr4vy/buyers_sdk.py +28 -18
  10. gr4vy/buyers_shipping_details.py +20 -10
  11. gr4vy/card_scheme_definitions_sdk.py +4 -2
  12. gr4vy/checkout_sessions.py +40 -14
  13. gr4vy/digital_wallets_sdk.py +20 -10
  14. gr4vy/domains.py +8 -4
  15. gr4vy/errors/apierror.py +1 -1
  16. gr4vy/errors/error400.py +1 -5
  17. gr4vy/errors/error401.py +1 -5
  18. gr4vy/errors/error403.py +1 -5
  19. gr4vy/errors/error404.py +1 -5
  20. gr4vy/errors/error405.py +1 -5
  21. gr4vy/errors/error409.py +1 -5
  22. gr4vy/errors/error425.py +1 -5
  23. gr4vy/errors/error429.py +1 -5
  24. gr4vy/errors/error500.py +1 -5
  25. gr4vy/errors/error502.py +1 -5
  26. gr4vy/errors/error504.py +1 -5
  27. gr4vy/errors/gr4vyerror.py +1 -1
  28. gr4vy/errors/httpvalidationerror.py +1 -1
  29. gr4vy/errors/no_response_error.py +1 -1
  30. gr4vy/errors/responsevalidationerror.py +1 -1
  31. gr4vy/events.py +54 -7
  32. gr4vy/executions.py +12 -6
  33. gr4vy/gift_cards_sdk.py +16 -8
  34. gr4vy/jobs.py +4 -2
  35. gr4vy/merchant_accounts_sdk.py +16 -8
  36. gr4vy/models/__init__.py +103 -29
  37. gr4vy/models/adyencardoptions.py +1 -6
  38. gr4vy/models/adyensepaoptions.py +1 -6
  39. gr4vy/models/airline.py +2 -7
  40. gr4vy/models/airlineleg.py +2 -6
  41. gr4vy/models/airlinepassenger.py +2 -6
  42. gr4vy/models/auditlogentry.py +3 -3
  43. gr4vy/models/auditlogentryuser.py +3 -3
  44. gr4vy/models/{billingdetails_input.py → billingdetails.py} +2 -2
  45. gr4vy/models/braintreedynamicdatafieldsoptions.py +2 -7
  46. gr4vy/models/browserinfo.py +2 -4
  47. gr4vy/models/buyer.py +3 -3
  48. gr4vy/models/buyercreate.py +3 -3
  49. gr4vy/models/buyerupdate.py +3 -3
  50. gr4vy/models/cartitem.py +9 -6
  51. gr4vy/models/chaseoptions.py +46 -0
  52. gr4vy/models/checkoutsession.py +24 -3
  53. gr4vy/models/checkoutsessioncreate.py +39 -5
  54. gr4vy/models/checkoutsessionpaymentmethod.py +3 -5
  55. gr4vy/models/checkoutsessionpaymentmethoddetails.py +2 -6
  56. gr4vy/models/create_payment_methodop.py +6 -0
  57. gr4vy/models/createsession.py +3 -3
  58. gr4vy/models/cybersourceoptions.py +7 -0
  59. gr4vy/models/definitionfield.py +1 -6
  60. gr4vy/models/digitalwallet.py +3 -5
  61. gr4vy/models/digitalwalletcreate.py +2 -6
  62. gr4vy/models/dlocalupirecurringinfooptions.py +13 -15
  63. gr4vy/models/errordetail.py +2 -4
  64. gr4vy/models/flow.py +16 -0
  65. gr4vy/models/flowaction.py +16 -0
  66. gr4vy/models/forterantifraudoptions.py +2 -7
  67. gr4vy/models/forterantifraudoptionscartitembasicitemdata.py +4 -8
  68. gr4vy/models/forterantifraudoptionscartitemdeliverydetails.py +3 -6
  69. gr4vy/models/giftcardredemption.py +4 -8
  70. gr4vy/models/giftcardservice.py +3 -5
  71. gr4vy/models/giftcardsummary.py +3 -5
  72. gr4vy/models/{guestbuyer_input.py → guestbuyer.py} +5 -5
  73. gr4vy/models/instrumenttype.py +1 -0
  74. gr4vy/models/integrationclient.py +16 -0
  75. gr4vy/models/list_all_report_executionsop.py +2 -14
  76. gr4vy/models/list_audit_logsop.py +2 -10
  77. gr4vy/models/list_buyer_payment_methodsop.py +2 -3
  78. gr4vy/models/list_payment_methodsop.py +2 -14
  79. gr4vy/models/list_payment_servicesop.py +2 -8
  80. gr4vy/models/list_reportsop.py +2 -10
  81. gr4vy/models/list_transaction_actionsop.py +43 -0
  82. gr4vy/models/list_transaction_eventsop.py +12 -1
  83. gr4vy/models/list_transactionsop.py +4 -22
  84. gr4vy/models/merchantaccount.py +3 -5
  85. gr4vy/models/merchantaccountcreate.py +2 -6
  86. gr4vy/models/merchantaccountupdate.py +2 -6
  87. gr4vy/models/method.py +3 -0
  88. gr4vy/models/mockcardoptions.py +7 -2
  89. gr4vy/models/mode.py +1 -0
  90. gr4vy/models/monatospeioptions.py +15 -0
  91. gr4vy/models/networktoken.py +3 -3
  92. gr4vy/models/networktokenpaymentmethodcreate.py +4 -8
  93. gr4vy/models/nuveiidealoptions.py +49 -0
  94. gr4vy/models/paymentlink.py +18 -7
  95. gr4vy/models/paymentlinkcreate.py +23 -37
  96. gr4vy/models/paymentmethod.py +7 -13
  97. gr4vy/models/paymentmethodcard.py +3 -5
  98. gr4vy/models/paymentmethoddetailscard.py +2 -6
  99. gr4vy/models/paymentmethodsummary.py +6 -12
  100. gr4vy/models/paymentoption.py +3 -3
  101. gr4vy/models/paymentservice.py +4 -6
  102. gr4vy/models/paymentserviceconfiguration.py +2 -6
  103. gr4vy/models/paymentservicedefinition.py +11 -5
  104. gr4vy/models/paymentservicetoken.py +3 -3
  105. gr4vy/models/payoutcreate.py +5 -9
  106. gr4vy/models/payoutsummary.py +4 -6
  107. gr4vy/models/paypaloptions.py +8 -2
  108. gr4vy/models/paypalshippingoptions.py +51 -0
  109. gr4vy/models/paypalshippingoptionsitem.py +89 -0
  110. gr4vy/models/paypalshippingoptionsitemamount.py +20 -0
  111. gr4vy/models/plaidpaymentmethodcreate.py +106 -0
  112. gr4vy/models/redirectpaymentmethodcreate.py +3 -6
  113. gr4vy/models/refund.py +4 -4
  114. gr4vy/models/report.py +4 -6
  115. gr4vy/models/reportcreate.py +2 -3
  116. gr4vy/models/reportexecution.py +3 -3
  117. gr4vy/models/reportexecutionsummary.py +3 -3
  118. gr4vy/models/reportspec.py +2 -4
  119. gr4vy/models/reportsummary.py +3 -5
  120. gr4vy/models/taxid.py +2 -4
  121. gr4vy/models/taxidkind.py +6 -0
  122. gr4vy/models/threedsecuredatav1.py +2 -6
  123. gr4vy/models/threedsecuredatav2.py +2 -6
  124. gr4vy/models/transaction.py +74 -25
  125. gr4vy/models/transactionaction.py +48 -0
  126. gr4vy/models/transactionactions.py +17 -0
  127. gr4vy/models/transactionbuyer.py +3 -3
  128. gr4vy/models/transactioncancel.py +3 -3
  129. gr4vy/models/transactioncapture.py +3 -3
  130. gr4vy/models/transactionconnectionoptions.py +30 -0
  131. gr4vy/models/transactioncreate.py +27 -12
  132. gr4vy/models/transactionevent.py +5 -3
  133. gr4vy/models/transactionpaymentmethod.py +6 -12
  134. gr4vy/models/transactionpaymentservice.py +3 -3
  135. gr4vy/models/transactionrefundcreate.py +2 -6
  136. gr4vy/models/transactionsummary.py +6 -10
  137. gr4vy/models/transactionthreedsecuresummary.py +3 -9
  138. gr4vy/models/transactionvoid.py +3 -3
  139. gr4vy/models/trustlyoptions.py +2 -9
  140. gr4vy/network_tokens_cryptogram.py +4 -2
  141. gr4vy/payment_links_sdk.py +34 -14
  142. gr4vy/payment_methods_network_tokens.py +20 -10
  143. gr4vy/payment_methods_payment_service_tokens.py +12 -6
  144. gr4vy/payment_methods_sdk.py +16 -8
  145. gr4vy/payment_options_sdk.py +4 -2
  146. gr4vy/payment_service_definitions_sdk.py +12 -6
  147. gr4vy/payment_services_sdk.py +28 -14
  148. gr4vy/payouts.py +16 -10
  149. gr4vy/refunds_sdk.py +4 -2
  150. gr4vy/report_executions_sdk.py +4 -2
  151. gr4vy/reports_sdk.py +16 -8
  152. gr4vy/sessions.py +12 -6
  153. gr4vy/transactions.py +99 -28
  154. gr4vy/transactions_refunds.py +12 -6
  155. gr4vy/transactions_settlements.py +8 -4
  156. gr4vy/types/basemodel.py +41 -3
  157. gr4vy/utils/__init__.py +0 -3
  158. gr4vy/utils/enums.py +60 -0
  159. gr4vy/utils/forms.py +21 -10
  160. gr4vy/utils/queryparams.py +14 -2
  161. gr4vy/utils/requestbodies.py +1 -1
  162. gr4vy/utils/retries.py +69 -5
  163. gr4vy/utils/serializers.py +0 -20
  164. gr4vy/utils/unmarshal_json_response.py +15 -1
  165. {gr4vy-1.5.2.dist-info → gr4vy-1.10.9.dist-info}/METADATA +39 -39
  166. {gr4vy-1.5.2.dist-info → gr4vy-1.10.9.dist-info}/RECORD +167 -155
  167. gr4vy/models/billingdetails_output.py +0 -87
  168. gr4vy/models/guestbuyer_output.py +0 -80
  169. {gr4vy-1.5.2.dist-info → gr4vy-1.10.9.dist-info}/WHEEL +0 -0
@@ -12,10 +12,10 @@ from .transactionpaymentmethod import (
12
12
  )
13
13
  from datetime import datetime
14
14
  from gr4vy.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
15
- from gr4vy.utils import validate_const, validate_open_enum
15
+ from gr4vy.utils import validate_const
16
16
  import pydantic
17
17
  from pydantic import model_serializer
18
- from pydantic.functional_validators import AfterValidator, PlainValidator
18
+ from pydantic.functional_validators import AfterValidator
19
19
  from typing import Literal, Optional
20
20
  from typing_extensions import Annotated, NotRequired, TypedDict
21
21
 
@@ -74,7 +74,7 @@ class PayoutSummary(BaseModel):
74
74
 
75
75
  payment_service: PayoutPaymentService
76
76
 
77
- status: Annotated[PayoutStatus, PlainValidator(validate_open_enum(False))]
77
+ status: PayoutStatus
78
78
 
79
79
  updated_at: datetime
80
80
  r"""The date this payout was last updated at."""
@@ -93,9 +93,7 @@ class PayoutSummary(BaseModel):
93
93
  buyer: OptionalNullable[TransactionBuyer] = UNSET
94
94
  r"""The buyer used for this payout."""
95
95
 
96
- category: Annotated[
97
- OptionalNullable[PayoutCategory], PlainValidator(validate_open_enum(False))
98
- ] = UNSET
96
+ category: OptionalNullable[PayoutCategory] = UNSET
99
97
  r"""The type of payout to process."""
100
98
 
101
99
  external_identifier: OptionalNullable[str] = UNSET
@@ -1,6 +1,7 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from __future__ import annotations
4
+ from .paypalshippingoptions import PaypalShippingOptions, PaypalShippingOptionsTypedDict
4
5
  from gr4vy.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
5
6
  from pydantic import model_serializer
6
7
  from typing import Dict, List
@@ -10,16 +11,21 @@ from typing_extensions import NotRequired, TypedDict
10
11
  class PaypalOptionsTypedDict(TypedDict):
11
12
  additional_data: NotRequired[Nullable[List[Dict[str, str]]]]
12
13
  r"""Additional Set Transaction Context Values (STC) to be sent to PayPal as part of the transaction."""
14
+ shipping: NotRequired[Nullable[PaypalShippingOptionsTypedDict]]
15
+ r"""Shipping information to be passed to the PayPal API."""
13
16
 
14
17
 
15
18
  class PaypalOptions(BaseModel):
16
19
  additional_data: OptionalNullable[List[Dict[str, str]]] = UNSET
17
20
  r"""Additional Set Transaction Context Values (STC) to be sent to PayPal as part of the transaction."""
18
21
 
22
+ shipping: OptionalNullable[PaypalShippingOptions] = UNSET
23
+ r"""Shipping information to be passed to the PayPal API."""
24
+
19
25
  @model_serializer(mode="wrap")
20
26
  def serialize_model(self, handler):
21
- optional_fields = ["additional_data"]
22
- nullable_fields = ["additional_data"]
27
+ optional_fields = ["additional_data", "shipping"]
28
+ nullable_fields = ["additional_data", "shipping"]
23
29
  null_default_fields = []
24
30
 
25
31
  serialized = handler(self)
@@ -0,0 +1,51 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .paypalshippingoptionsitem import (
5
+ PaypalShippingOptionsItem,
6
+ PaypalShippingOptionsItemTypedDict,
7
+ )
8
+ from gr4vy.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
9
+ from pydantic import model_serializer
10
+ from typing import List
11
+ from typing_extensions import NotRequired, TypedDict
12
+
13
+
14
+ class PaypalShippingOptionsTypedDict(TypedDict):
15
+ options: NotRequired[Nullable[List[PaypalShippingOptionsItemTypedDict]]]
16
+ r"""Shipping options that the payee or merchant offers to the payer to ship or pick up their items."""
17
+
18
+
19
+ class PaypalShippingOptions(BaseModel):
20
+ options: OptionalNullable[List[PaypalShippingOptionsItem]] = UNSET
21
+ r"""Shipping options that the payee or merchant offers to the payer to ship or pick up their items."""
22
+
23
+ @model_serializer(mode="wrap")
24
+ def serialize_model(self, handler):
25
+ optional_fields = ["options"]
26
+ nullable_fields = ["options"]
27
+ null_default_fields = []
28
+
29
+ serialized = handler(self)
30
+
31
+ m = {}
32
+
33
+ for n, f in type(self).model_fields.items():
34
+ k = f.alias or n
35
+ val = serialized.get(k)
36
+ serialized.pop(k, None)
37
+
38
+ optional_nullable = k in optional_fields and k in nullable_fields
39
+ is_set = (
40
+ self.__pydantic_fields_set__.intersection({n})
41
+ or k in null_default_fields
42
+ ) # pylint: disable=no-member
43
+
44
+ if val is not None and val != UNSET_SENTINEL:
45
+ m[k] = val
46
+ elif val != UNSET_SENTINEL and (
47
+ not k in optional_fields or (optional_nullable and is_set)
48
+ ):
49
+ m[k] = val
50
+
51
+ return m
@@ -0,0 +1,89 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .paypalshippingoptionsitemamount import (
5
+ PaypalShippingOptionsItemAmount,
6
+ PaypalShippingOptionsItemAmountTypedDict,
7
+ )
8
+ from gr4vy.types import (
9
+ BaseModel,
10
+ Nullable,
11
+ OptionalNullable,
12
+ UNSET,
13
+ UNSET_SENTINEL,
14
+ UnrecognizedStr,
15
+ )
16
+ from pydantic import model_serializer
17
+ from typing import Literal, Union
18
+ from typing_extensions import NotRequired, TypedDict
19
+
20
+
21
+ PaypalShippingOptionsItemType = Union[
22
+ Literal[
23
+ "SHIPPING",
24
+ "PICKUP",
25
+ "PICKUP_IN_STORE",
26
+ "PICKUP_FROM_PERSON",
27
+ ],
28
+ UnrecognizedStr,
29
+ ]
30
+
31
+
32
+ class PaypalShippingOptionsItemTypedDict(TypedDict):
33
+ id: str
34
+ r"""A unique ID that identifies a payer-selected shipping option."""
35
+ label: str
36
+ r"""A description that the payer sees, which helps them choose an appropriate shipping option."""
37
+ selected: bool
38
+ r"""If the API request sets selected = true, it represents the shipping option that the payee or merchant expects to be pre-selected for the payer when they first view the shipping.options in the PayPal Checkout experience. Only one shipping.option can be set to selected=true."""
39
+ type: NotRequired[Nullable[PaypalShippingOptionsItemType]]
40
+ r"""A classification for the method of purchase fulfillment."""
41
+ amount: NotRequired[Nullable[PaypalShippingOptionsItemAmountTypedDict]]
42
+ r"""The shipping cost for the selected option."""
43
+
44
+
45
+ class PaypalShippingOptionsItem(BaseModel):
46
+ id: str
47
+ r"""A unique ID that identifies a payer-selected shipping option."""
48
+
49
+ label: str
50
+ r"""A description that the payer sees, which helps them choose an appropriate shipping option."""
51
+
52
+ selected: bool
53
+ r"""If the API request sets selected = true, it represents the shipping option that the payee or merchant expects to be pre-selected for the payer when they first view the shipping.options in the PayPal Checkout experience. Only one shipping.option can be set to selected=true."""
54
+
55
+ type: OptionalNullable[PaypalShippingOptionsItemType] = UNSET
56
+ r"""A classification for the method of purchase fulfillment."""
57
+
58
+ amount: OptionalNullable[PaypalShippingOptionsItemAmount] = UNSET
59
+ r"""The shipping cost for the selected option."""
60
+
61
+ @model_serializer(mode="wrap")
62
+ def serialize_model(self, handler):
63
+ optional_fields = ["type", "amount"]
64
+ nullable_fields = ["type", "amount"]
65
+ null_default_fields = []
66
+
67
+ serialized = handler(self)
68
+
69
+ m = {}
70
+
71
+ for n, f in type(self).model_fields.items():
72
+ k = f.alias or n
73
+ val = serialized.get(k)
74
+ serialized.pop(k, None)
75
+
76
+ optional_nullable = k in optional_fields and k in nullable_fields
77
+ is_set = (
78
+ self.__pydantic_fields_set__.intersection({n})
79
+ or k in null_default_fields
80
+ ) # pylint: disable=no-member
81
+
82
+ if val is not None and val != UNSET_SENTINEL:
83
+ m[k] = val
84
+ elif val != UNSET_SENTINEL and (
85
+ not k in optional_fields or (optional_nullable and is_set)
86
+ ):
87
+ m[k] = val
88
+
89
+ return m
@@ -0,0 +1,20 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from gr4vy.types import BaseModel
5
+ from typing_extensions import TypedDict
6
+
7
+
8
+ class PaypalShippingOptionsItemAmountTypedDict(TypedDict):
9
+ currency_code: str
10
+ r"""The three-character ISO currency code."""
11
+ value: str
12
+ r"""The amount value, which might include a decimal portion."""
13
+
14
+
15
+ class PaypalShippingOptionsItemAmount(BaseModel):
16
+ currency_code: str
17
+ r"""The three-character ISO currency code."""
18
+
19
+ value: str
20
+ r"""The amount value, which might include a decimal portion."""
@@ -0,0 +1,106 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from gr4vy.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
5
+ from gr4vy.utils import validate_const
6
+ import pydantic
7
+ from pydantic import model_serializer
8
+ from pydantic.functional_validators import AfterValidator
9
+ from typing import Literal, Optional
10
+ from typing_extensions import Annotated, NotRequired, TypedDict
11
+
12
+
13
+ class PlaidPaymentMethodCreateTypedDict(TypedDict):
14
+ r"""Plaid Payment Method
15
+
16
+ Plaid Payment Method to use in a transaction.
17
+ """
18
+
19
+ token: str
20
+ r"""The public token obtained after using Plaid Link."""
21
+ method: Literal["plaid"]
22
+ r"""Always `plaid`."""
23
+ account_id: NotRequired[Nullable[str]]
24
+ r"""The Plaid account ID corresponding to the end-user account. If not provided will be fetched from Plaid API expecting to only have one."""
25
+ payment_service_id: NotRequired[Nullable[str]]
26
+ r"""The ID of the Plaid payment service related to the provided public token. If not provided will be fetched from the currently active expecting to have a single one."""
27
+ buyer_id: NotRequired[Nullable[str]]
28
+ r"""The ID of the buyer to attach the method to."""
29
+ buyer_external_identifier: NotRequired[Nullable[str]]
30
+ r"""The merchant reference for this payment method."""
31
+ external_identifier: NotRequired[Nullable[str]]
32
+ r"""The merchant identifier for this payment method."""
33
+
34
+
35
+ class PlaidPaymentMethodCreate(BaseModel):
36
+ r"""Plaid Payment Method
37
+
38
+ Plaid Payment Method to use in a transaction.
39
+ """
40
+
41
+ token: str
42
+ r"""The public token obtained after using Plaid Link."""
43
+
44
+ METHOD: Annotated[
45
+ Annotated[Optional[Literal["plaid"]], AfterValidator(validate_const("plaid"))],
46
+ pydantic.Field(alias="method"),
47
+ ] = "plaid"
48
+ r"""Always `plaid`."""
49
+
50
+ account_id: OptionalNullable[str] = UNSET
51
+ r"""The Plaid account ID corresponding to the end-user account. If not provided will be fetched from Plaid API expecting to only have one."""
52
+
53
+ payment_service_id: OptionalNullable[str] = UNSET
54
+ r"""The ID of the Plaid payment service related to the provided public token. If not provided will be fetched from the currently active expecting to have a single one."""
55
+
56
+ buyer_id: OptionalNullable[str] = UNSET
57
+ r"""The ID of the buyer to attach the method to."""
58
+
59
+ buyer_external_identifier: OptionalNullable[str] = UNSET
60
+ r"""The merchant reference for this payment method."""
61
+
62
+ external_identifier: OptionalNullable[str] = UNSET
63
+ r"""The merchant identifier for this payment method."""
64
+
65
+ @model_serializer(mode="wrap")
66
+ def serialize_model(self, handler):
67
+ optional_fields = [
68
+ "method",
69
+ "account_id",
70
+ "payment_service_id",
71
+ "buyer_id",
72
+ "buyer_external_identifier",
73
+ "external_identifier",
74
+ ]
75
+ nullable_fields = [
76
+ "account_id",
77
+ "payment_service_id",
78
+ "buyer_id",
79
+ "buyer_external_identifier",
80
+ "external_identifier",
81
+ ]
82
+ null_default_fields = []
83
+
84
+ serialized = handler(self)
85
+
86
+ m = {}
87
+
88
+ for n, f in type(self).model_fields.items():
89
+ k = f.alias or n
90
+ val = serialized.get(k)
91
+ serialized.pop(k, None)
92
+
93
+ optional_nullable = k in optional_fields and k in nullable_fields
94
+ is_set = (
95
+ self.__pydantic_fields_set__.intersection({n})
96
+ or k in null_default_fields
97
+ ) # pylint: disable=no-member
98
+
99
+ if val is not None and val != UNSET_SENTINEL:
100
+ m[k] = val
101
+ elif val != UNSET_SENTINEL and (
102
+ not k in optional_fields or (optional_nullable and is_set)
103
+ ):
104
+ m[k] = val
105
+
106
+ return m
@@ -9,11 +9,9 @@ from gr4vy.types import (
9
9
  UNSET_SENTINEL,
10
10
  UnrecognizedStr,
11
11
  )
12
- from gr4vy.utils import validate_open_enum
13
12
  from pydantic import model_serializer
14
- from pydantic.functional_validators import PlainValidator
15
13
  from typing import Literal, Union
16
- from typing_extensions import Annotated, NotRequired, TypedDict
14
+ from typing_extensions import NotRequired, TypedDict
17
15
 
18
16
 
19
17
  RedirectPaymentMethodCreateMethod = Union[
@@ -113,6 +111,7 @@ RedirectPaymentMethodCreateMethod = Union[
113
111
  "waave",
114
112
  "webpay",
115
113
  "wechat",
114
+ "wero",
116
115
  "yape",
117
116
  "zippay",
118
117
  ],
@@ -143,9 +142,7 @@ class RedirectPaymentMethodCreateTypedDict(TypedDict):
143
142
  class RedirectPaymentMethodCreate(BaseModel):
144
143
  r"""Create a transaction for an APM/LPM that requires a redirect."""
145
144
 
146
- method: Annotated[
147
- RedirectPaymentMethodCreateMethod, PlainValidator(validate_open_enum(False))
148
- ]
145
+ method: RedirectPaymentMethodCreateMethod
149
146
  r"""The method to use, this can be any of the methods that support redirect requests."""
150
147
 
151
148
  country: str
gr4vy/models/refund.py CHANGED
@@ -6,10 +6,10 @@ from .refundstatus import RefundStatus
6
6
  from .refundtargettype import RefundTargetType
7
7
  from datetime import datetime
8
8
  from gr4vy.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
9
- from gr4vy.utils import validate_const, validate_open_enum
9
+ from gr4vy.utils import validate_const
10
10
  import pydantic
11
11
  from pydantic import model_serializer
12
- from pydantic.functional_validators import AfterValidator, PlainValidator
12
+ from pydantic.functional_validators import AfterValidator
13
13
  from typing import Literal, Optional
14
14
  from typing_extensions import Annotated, NotRequired, TypedDict
15
15
 
@@ -62,7 +62,7 @@ class Refund(BaseModel):
62
62
  transaction_id: str
63
63
  r"""The ID of the transaction associated with this refund."""
64
64
 
65
- status: Annotated[RefundStatus, PlainValidator(validate_open_enum(False))]
65
+ status: RefundStatus
66
66
 
67
67
  currency: str
68
68
  r"""The ISO 4217 currency code for this refund. Will always match that of the associated transaction."""
@@ -70,7 +70,7 @@ class Refund(BaseModel):
70
70
  amount: int
71
71
  r"""The amount of this refund, in the smallest currency unit (for example, cents or pence)."""
72
72
 
73
- target_type: Annotated[RefundTargetType, PlainValidator(validate_open_enum(False))]
73
+ target_type: RefundTargetType
74
74
 
75
75
  reconciliation_id: str
76
76
  r"""The base62 encoded refund ID. This represents a shorter version of this refund's `id` which is sent to payment services, anti-fraud services, and other connectors. You can use this ID to reconcile a payment service's refund against our system."""
gr4vy/models/report.py CHANGED
@@ -10,10 +10,10 @@ from .reportschedule import ReportSchedule
10
10
  from .reportspec import ReportSpec, ReportSpecTypedDict
11
11
  from datetime import datetime
12
12
  from gr4vy.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
13
- from gr4vy.utils import validate_const, validate_open_enum
13
+ from gr4vy.utils import validate_const
14
14
  import pydantic
15
15
  from pydantic import model_serializer
16
- from pydantic.functional_validators import AfterValidator, PlainValidator
16
+ from pydantic.functional_validators import AfterValidator
17
17
  from typing import Literal, Optional
18
18
  from typing_extensions import Annotated, NotRequired, TypedDict
19
19
 
@@ -67,7 +67,7 @@ class Report(BaseModel):
67
67
  updated_at: datetime
68
68
  r"""The date this report was last updated."""
69
69
 
70
- schedule: Annotated[ReportSchedule, PlainValidator(validate_open_enum(False))]
70
+ schedule: ReportSchedule
71
71
 
72
72
  schedule_enabled: bool
73
73
  r"""Whether the report schedule is enabled."""
@@ -91,9 +91,7 @@ class Report(BaseModel):
91
91
  creator_display_name: OptionalNullable[str] = UNSET
92
92
  r"""The display name of the report creator."""
93
93
 
94
- creator_type: Annotated[
95
- OptionalNullable[ReportCreatorType], PlainValidator(validate_open_enum(False))
96
- ] = UNSET
94
+ creator_type: OptionalNullable[ReportCreatorType] = UNSET
97
95
  r"""The type of the report creator."""
98
96
 
99
97
  next_execution_at: OptionalNullable[datetime] = UNSET
@@ -19,9 +19,8 @@ from .transactionsreportspec import (
19
19
  TransactionsReportSpecTypedDict,
20
20
  )
21
21
  from gr4vy.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
22
- from gr4vy.utils import get_discriminator, validate_open_enum
22
+ from gr4vy.utils import get_discriminator
23
23
  from pydantic import Discriminator, Tag, model_serializer
24
- from pydantic.functional_validators import PlainValidator
25
24
  from typing import Optional, Union
26
25
  from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
27
26
 
@@ -68,7 +67,7 @@ class ReportCreate(BaseModel):
68
67
  name: str
69
68
  r"""The name of the report."""
70
69
 
71
- schedule: Annotated[ReportSchedule, PlainValidator(validate_open_enum(False))]
70
+ schedule: ReportSchedule
72
71
 
73
72
  schedule_enabled: bool
74
73
  r"""Whether the report schedule is enabled."""
@@ -9,9 +9,9 @@ from .reportexecutionstatus import ReportExecutionStatus
9
9
  from .reportsummary import ReportSummary, ReportSummaryTypedDict
10
10
  from datetime import datetime
11
11
  from gr4vy.types import BaseModel
12
- from gr4vy.utils import validate_const, validate_open_enum
12
+ from gr4vy.utils import validate_const
13
13
  import pydantic
14
- from pydantic.functional_validators import AfterValidator, PlainValidator
14
+ from pydantic.functional_validators import AfterValidator
15
15
  from typing import Literal, Optional
16
16
  from typing_extensions import Annotated, TypedDict
17
17
 
@@ -40,7 +40,7 @@ class ReportExecution(BaseModel):
40
40
  updated_at: datetime
41
41
  r"""The date this report execution was last updated."""
42
42
 
43
- status: Annotated[ReportExecutionStatus, PlainValidator(validate_open_enum(False))]
43
+ status: ReportExecutionStatus
44
44
 
45
45
  context: ReportExecutionContext
46
46
 
@@ -8,9 +8,9 @@ from .reportexecutioncontext import (
8
8
  from .reportexecutionstatus import ReportExecutionStatus
9
9
  from datetime import datetime
10
10
  from gr4vy.types import BaseModel
11
- from gr4vy.utils import validate_const, validate_open_enum
11
+ from gr4vy.utils import validate_const
12
12
  import pydantic
13
- from pydantic.functional_validators import AfterValidator, PlainValidator
13
+ from pydantic.functional_validators import AfterValidator
14
14
  from typing import Literal, Optional
15
15
  from typing_extensions import Annotated, TypedDict
16
16
 
@@ -38,7 +38,7 @@ class ReportExecutionSummary(BaseModel):
38
38
  updated_at: datetime
39
39
  r"""The date this report execution was last updated."""
40
40
 
41
- status: Annotated[ReportExecutionStatus, PlainValidator(validate_open_enum(False))]
41
+ status: ReportExecutionStatus
42
42
 
43
43
  context: ReportExecutionContext
44
44
 
@@ -3,10 +3,8 @@
3
3
  from __future__ import annotations
4
4
  from .reportspecmodel import ReportSpecModel
5
5
  from gr4vy.types import BaseModel
6
- from gr4vy.utils import validate_open_enum
7
- from pydantic.functional_validators import PlainValidator
8
6
  from typing import Any, Dict
9
- from typing_extensions import Annotated, TypedDict
7
+ from typing_extensions import TypedDict
10
8
 
11
9
 
12
10
  class ReportSpecTypedDict(TypedDict):
@@ -16,7 +14,7 @@ class ReportSpecTypedDict(TypedDict):
16
14
 
17
15
 
18
16
  class ReportSpec(BaseModel):
19
- model: Annotated[ReportSpecModel, PlainValidator(validate_open_enum(False))]
17
+ model: ReportSpecModel
20
18
 
21
19
  params: Dict[str, Any]
22
20
  r"""The parameters for the report model."""
@@ -3,10 +3,10 @@
3
3
  from __future__ import annotations
4
4
  from .reportcreatortype import ReportCreatorType
5
5
  from gr4vy.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
6
- from gr4vy.utils import validate_const, validate_open_enum
6
+ from gr4vy.utils import validate_const
7
7
  import pydantic
8
8
  from pydantic import model_serializer
9
- from pydantic.functional_validators import AfterValidator, PlainValidator
9
+ from pydantic.functional_validators import AfterValidator
10
10
  from typing import Literal, Optional
11
11
  from typing_extensions import Annotated, NotRequired, TypedDict
12
12
 
@@ -52,9 +52,7 @@ class ReportSummary(BaseModel):
52
52
  creator_display_name: OptionalNullable[str] = UNSET
53
53
  r"""The display name of the report creator."""
54
54
 
55
- creator_type: Annotated[
56
- OptionalNullable[ReportCreatorType], PlainValidator(validate_open_enum(False))
57
- ] = UNSET
55
+ creator_type: OptionalNullable[ReportCreatorType] = UNSET
58
56
  r"""The type of the report creator."""
59
57
 
60
58
  @model_serializer(mode="wrap")
gr4vy/models/taxid.py CHANGED
@@ -3,9 +3,7 @@
3
3
  from __future__ import annotations
4
4
  from .taxidkind import TaxIDKind
5
5
  from gr4vy.types import BaseModel
6
- from gr4vy.utils import validate_open_enum
7
- from pydantic.functional_validators import PlainValidator
8
- from typing_extensions import Annotated, TypedDict
6
+ from typing_extensions import TypedDict
9
7
 
10
8
 
11
9
  class TaxIDTypedDict(TypedDict):
@@ -18,4 +16,4 @@ class TaxID(BaseModel):
18
16
  value: str
19
17
  r"""The tax ID for the buyer."""
20
18
 
21
- kind: Annotated[TaxIDKind, PlainValidator(validate_open_enum(False))]
19
+ kind: TaxIDKind
gr4vy/models/taxidkind.py CHANGED
@@ -24,6 +24,12 @@ TaxIDKind = Union[
24
24
  "cl.tin",
25
25
  "co.itin",
26
26
  "co.nit",
27
+ "co.cc",
28
+ "co.ce",
29
+ "co.de",
30
+ "co.rc",
31
+ "co.ti",
32
+ "co.passport",
27
33
  "es.cif",
28
34
  "eu.vat",
29
35
  "gb.vat",
@@ -3,10 +3,8 @@
3
3
  from __future__ import annotations
4
4
  from .cardscheme import CardScheme
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
- from typing_extensions import Annotated, NotRequired, TypedDict
7
+ from typing_extensions import NotRequired, TypedDict
10
8
 
11
9
 
12
10
  class ThreeDSecureDataV1TypedDict(TypedDict):
@@ -50,9 +48,7 @@ class ThreeDSecureDataV1(BaseModel):
50
48
  xid: str
51
49
  r"""The transaction identifier."""
52
50
 
53
- scheme: Annotated[
54
- OptionalNullable[CardScheme], PlainValidator(validate_open_enum(False))
55
- ] = UNSET
51
+ scheme: OptionalNullable[CardScheme] = UNSET
56
52
  r"""The scheme/brand of the card that is used for 3-D Secure."""
57
53
 
58
54
  @model_serializer(mode="wrap")
@@ -3,10 +3,8 @@
3
3
  from __future__ import annotations
4
4
  from .cardscheme import CardScheme
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
- from typing_extensions import Annotated, NotRequired, TypedDict
7
+ from typing_extensions import NotRequired, TypedDict
10
8
 
11
9
 
12
10
  class ThreeDSecureDataV2TypedDict(TypedDict):
@@ -42,9 +40,7 @@ class ThreeDSecureDataV2(BaseModel):
42
40
  directory_transaction_id: str
43
41
  r"""The transaction identifier."""
44
42
 
45
- scheme: Annotated[
46
- OptionalNullable[CardScheme], PlainValidator(validate_open_enum(False))
47
- ] = UNSET
43
+ scheme: OptionalNullable[CardScheme] = UNSET
48
44
  r"""The scheme/brand of the card that is used for 3-D Secure."""
49
45
 
50
46
  authentication_response: OptionalNullable[str] = UNSET