gr4vy 1.10.12__py3-none-any.whl → 1.10.14__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 (292) hide show
  1. gr4vy/_version.py +3 -3
  2. gr4vy/basesdk.py +20 -6
  3. gr4vy/models/__init__.py +132 -0
  4. gr4vy/models/accountsreceivablesreportspec.py +18 -1
  5. gr4vy/models/accountupdaterinquirysummary.py +18 -1
  6. gr4vy/models/accountupdaterjob.py +18 -1
  7. gr4vy/models/accountupdateroptions.py +30 -31
  8. gr4vy/models/add_buyer_shipping_detailsop.py +34 -1
  9. gr4vy/models/add_buyerop.py +34 -1
  10. gr4vy/models/add_payment_linkop.py +34 -1
  11. gr4vy/models/add_reportop.py +34 -1
  12. gr4vy/models/address.py +38 -39
  13. gr4vy/models/adyencardoptions.py +32 -33
  14. gr4vy/models/adyenoptions.py +14 -19
  15. gr4vy/models/adyensepaoptions.py +30 -31
  16. gr4vy/models/adyensplitsoptions.py +14 -19
  17. gr4vy/models/affirmitineraryoptions.py +34 -35
  18. gr4vy/models/affirmoptions.py +14 -19
  19. gr4vy/models/airline.py +58 -59
  20. gr4vy/models/airlineleg.py +66 -67
  21. gr4vy/models/airlinepassenger.py +42 -43
  22. gr4vy/models/applepaypaymentmethodcreate.py +34 -35
  23. gr4vy/models/auditlogentries.py +14 -19
  24. gr4vy/models/auditlogentry.py +14 -19
  25. gr4vy/models/auditlogentryuser.py +14 -19
  26. gr4vy/models/billingdetails.py +32 -33
  27. gr4vy/models/braintreedynamicdatafieldsoptions.py +26 -27
  28. gr4vy/models/braintreeoptions.py +18 -19
  29. gr4vy/models/browserinfo.py +14 -19
  30. gr4vy/models/buyer.py +31 -32
  31. gr4vy/models/buyercreate.py +18 -29
  32. gr4vy/models/buyers.py +14 -19
  33. gr4vy/models/buyerupdate.py +18 -29
  34. gr4vy/models/cancel_transactionop.py +34 -1
  35. gr4vy/models/capture_transactionop.py +30 -19
  36. gr4vy/models/cardpaymentmethodcreate.py +31 -32
  37. gr4vy/models/cardschemedefinition.py +18 -1
  38. gr4vy/models/cardwithurlpaymentmethodcreate.py +33 -34
  39. gr4vy/models/cartitem.py +52 -53
  40. gr4vy/models/chaseoptions.py +14 -19
  41. gr4vy/models/checkoutsession.py +37 -38
  42. gr4vy/models/checkoutsessioncreate.py +35 -36
  43. gr4vy/models/checkoutsessionpaymentmethod.py +16 -27
  44. gr4vy/models/checkoutsessionpaymentmethodcreate.py +18 -28
  45. gr4vy/models/checkoutsessionpaymentmethoddetails.py +14 -19
  46. gr4vy/models/checkoutsessionwithurlpaymentmethodcreate.py +29 -30
  47. gr4vy/models/clicktopayfpanpaymentmethodcreate.py +32 -33
  48. gr4vy/models/clicktopaypaymentmethodcreate.py +28 -29
  49. gr4vy/models/configure_digital_walletop.py +34 -1
  50. gr4vy/models/create_account_updater_jobop.py +34 -1
  51. gr4vy/models/create_apple_pay_digital_wallet_sessionop.py +34 -1
  52. gr4vy/models/create_checkout_sessionop.py +34 -1
  53. gr4vy/models/create_full_transaction_refundop.py +30 -19
  54. gr4vy/models/create_gift_cardop.py +34 -1
  55. gr4vy/models/create_google_pay_digital_wallet_sessionop.py +34 -1
  56. gr4vy/models/create_payment_method_network_token_cryptogramop.py +34 -1
  57. gr4vy/models/create_payment_method_network_tokenop.py +34 -1
  58. gr4vy/models/create_payment_method_payment_service_tokenop.py +34 -1
  59. gr4vy/models/create_payment_methodop.py +34 -1
  60. gr4vy/models/create_payment_service_sessionop.py +34 -1
  61. gr4vy/models/create_payment_serviceop.py +34 -1
  62. gr4vy/models/create_payoutop.py +34 -1
  63. gr4vy/models/create_report_execution_urlop.py +34 -1
  64. gr4vy/models/create_three_ds_scenarioop.py +79 -0
  65. gr4vy/models/create_transaction_refundop.py +34 -1
  66. gr4vy/models/create_transactionop.py +32 -19
  67. gr4vy/models/createsession.py +14 -19
  68. gr4vy/models/cryptogram.py +18 -1
  69. gr4vy/models/cybersourceantifraudoptions.py +18 -27
  70. gr4vy/models/cybersourceoptions.py +27 -28
  71. gr4vy/models/delete_buyer_shipping_detailsop.py +34 -1
  72. gr4vy/models/delete_buyerop.py +34 -1
  73. gr4vy/models/delete_checkout_sessionop.py +34 -1
  74. gr4vy/models/delete_digital_walletop.py +34 -1
  75. gr4vy/models/delete_gift_cardop.py +34 -1
  76. gr4vy/models/delete_payment_method_network_tokenop.py +34 -1
  77. gr4vy/models/delete_payment_method_payment_service_tokenop.py +34 -1
  78. gr4vy/models/delete_payment_methodop.py +34 -1
  79. gr4vy/models/delete_payment_serviceop.py +34 -1
  80. gr4vy/models/delete_three_ds_scenarioop.py +76 -0
  81. gr4vy/models/detailedsettlementreportspec.py +18 -1
  82. gr4vy/models/digitalwallet.py +27 -33
  83. gr4vy/models/digitalwalletcreate.py +23 -28
  84. gr4vy/models/digitalwalletupdate.py +30 -31
  85. gr4vy/models/dlocaloptions.py +14 -19
  86. gr4vy/models/dlocalupioptions.py +14 -19
  87. gr4vy/models/dlocalupiwalletoptions.py +18 -33
  88. gr4vy/models/dlocalwalletoptions.py +14 -19
  89. gr4vy/models/expire_payment_linkop.py +34 -1
  90. gr4vy/models/fiservinstallmentoptions.py +27 -28
  91. gr4vy/models/fiservoptions.py +14 -19
  92. gr4vy/models/forterantifraudoptions.py +30 -31
  93. gr4vy/models/forterantifraudoptionscartitem.py +13 -18
  94. gr4vy/models/forterantifraudoptionscartitembasicitemdata.py +14 -19
  95. gr4vy/models/forterantifraudoptionscartitembeneficiary.py +13 -18
  96. gr4vy/models/forterantifraudoptionscartitembeneficiaryaddress.py +18 -19
  97. gr4vy/models/forterantifraudoptionscartitembeneficiarycomments.py +18 -27
  98. gr4vy/models/forterantifraudoptionscartitembeneficiarypersonaldetails.py +14 -19
  99. gr4vy/models/forterantifraudoptionscartitemdeliverydetails.py +13 -18
  100. gr4vy/models/forterantifraudoptionsdiscount.py +13 -18
  101. gr4vy/models/forterantifraudoptionsdiscountcoupondiscountamount.py +14 -19
  102. gr4vy/models/get_buyer_shipping_detailsop.py +34 -1
  103. gr4vy/models/get_buyerop.py +34 -1
  104. gr4vy/models/get_checkout_sessionop.py +34 -1
  105. gr4vy/models/get_digital_walletop.py +34 -1
  106. gr4vy/models/get_gift_cardop.py +34 -1
  107. gr4vy/models/get_payment_linkop.py +34 -1
  108. gr4vy/models/get_payment_methodop.py +34 -1
  109. gr4vy/models/get_payment_serviceop.py +34 -1
  110. gr4vy/models/get_payoutop.py +34 -1
  111. gr4vy/models/get_refundop.py +34 -1
  112. gr4vy/models/get_report_executionop.py +34 -1
  113. gr4vy/models/get_reportop.py +34 -1
  114. gr4vy/models/get_three_ds_scenarioop.py +105 -0
  115. gr4vy/models/get_transaction_refundop.py +34 -1
  116. gr4vy/models/get_transaction_settlementop.py +34 -1
  117. gr4vy/models/get_transactionop.py +34 -1
  118. gr4vy/models/giftcard.py +14 -19
  119. gr4vy/models/giftcardcreate.py +14 -19
  120. gr4vy/models/giftcardredemption.py +29 -30
  121. gr4vy/models/giftcards.py +14 -19
  122. gr4vy/models/giftcardservice.py +18 -1
  123. gr4vy/models/giftcardsummary.py +35 -36
  124. gr4vy/models/givingblockoptions.py +14 -19
  125. gr4vy/models/googlepayassurancedetails.py +14 -19
  126. gr4vy/models/googlepayfpanpaymentmethodcreate.py +32 -33
  127. gr4vy/models/googlepaypaymentmethodcreate.py +36 -37
  128. gr4vy/models/guestbuyer.py +30 -31
  129. gr4vy/models/internal/globals.py +18 -1
  130. gr4vy/models/latitudeoptions.py +14 -19
  131. gr4vy/models/list_all_report_executionsop.py +50 -35
  132. gr4vy/models/list_audit_logsop.py +39 -26
  133. gr4vy/models/list_buyer_gift_cardsop.py +32 -23
  134. gr4vy/models/list_buyer_payment_methodsop.py +42 -33
  135. gr4vy/models/list_buyer_shipping_detailsop.py +34 -1
  136. gr4vy/models/list_buyersop.py +32 -25
  137. gr4vy/models/list_card_scheme_definitionsop.py +34 -1
  138. gr4vy/models/list_digital_walletsop.py +34 -1
  139. gr4vy/models/list_gift_card_balancesop.py +34 -1
  140. gr4vy/models/list_gift_cardsop.py +38 -25
  141. gr4vy/models/list_merchant_accountsop.py +14 -19
  142. gr4vy/models/list_payment_linksop.py +32 -19
  143. gr4vy/models/list_payment_method_network_tokensop.py +34 -1
  144. gr4vy/models/list_payment_method_payment_service_tokensop.py +30 -19
  145. gr4vy/models/list_payment_methodsop.py +48 -33
  146. gr4vy/models/list_payment_optionsop.py +34 -1
  147. gr4vy/models/list_payment_service_definitionsop.py +14 -19
  148. gr4vy/models/list_payment_servicesop.py +32 -25
  149. gr4vy/models/list_payoutsop.py +30 -19
  150. gr4vy/models/list_report_executionsop.py +30 -19
  151. gr4vy/models/list_reportsop.py +39 -26
  152. gr4vy/models/list_transaction_actionsop.py +34 -1
  153. gr4vy/models/list_transaction_eventsop.py +30 -19
  154. gr4vy/models/list_transaction_refundsop.py +34 -1
  155. gr4vy/models/list_transaction_settlementsop.py +34 -1
  156. gr4vy/models/list_transactionsop.py +124 -109
  157. gr4vy/models/mattildatapioptions.py +14 -19
  158. gr4vy/models/merchantaccount.py +52 -53
  159. gr4vy/models/merchantaccountcreate.py +52 -53
  160. gr4vy/models/merchantaccounts.py +14 -19
  161. gr4vy/models/merchantaccountupdate.py +54 -55
  162. gr4vy/models/mockcardmerchantadvicecodeoptions.py +14 -19
  163. gr4vy/models/mockcardoptions.py +14 -19
  164. gr4vy/models/networktoken.py +18 -1
  165. gr4vy/models/networktokencreate.py +14 -19
  166. gr4vy/models/networktokenpaymentmethodcreate.py +34 -35
  167. gr4vy/models/nuveiairlinedataoptions.py +14 -19
  168. gr4vy/models/nuveiidealoptions.py +14 -19
  169. gr4vy/models/nuveioptions.py +14 -19
  170. gr4vy/models/nuveipseoptions.py +13 -18
  171. gr4vy/models/oxxooptions.py +14 -19
  172. gr4vy/models/paymentlink.py +59 -60
  173. gr4vy/models/paymentlinkcreate.py +59 -60
  174. gr4vy/models/paymentlinks.py +14 -19
  175. gr4vy/models/paymentmethod.py +51 -52
  176. gr4vy/models/paymentmethodcard.py +14 -19
  177. gr4vy/models/paymentmethoddetailscard.py +14 -19
  178. gr4vy/models/paymentmethods.py +14 -19
  179. gr4vy/models/paymentmethodstoredcard.py +18 -1
  180. gr4vy/models/paymentmethodsummary.py +47 -48
  181. gr4vy/models/paymentoption.py +14 -19
  182. gr4vy/models/paymentoptioncontext.py +14 -19
  183. gr4vy/models/paymentoptioncontextapprovalui.py +14 -19
  184. gr4vy/models/paymentoptionrequest.py +18 -26
  185. gr4vy/models/paymentservice.py +35 -36
  186. gr4vy/models/paymentservicecreate.py +36 -37
  187. gr4vy/models/paymentservicedefinition.py +14 -19
  188. gr4vy/models/paymentservicedefinitions.py +14 -19
  189. gr4vy/models/paymentservices.py +14 -19
  190. gr4vy/models/paymentservicetoken.py +14 -19
  191. gr4vy/models/paymentservicetokencreate.py +14 -19
  192. gr4vy/models/paymentserviceupdate.py +45 -46
  193. gr4vy/models/payoutconnectionoptions.py +14 -19
  194. gr4vy/models/payoutcreate.py +34 -35
  195. gr4vy/models/payoutmerchant.py +14 -19
  196. gr4vy/models/payoutmerchantsummary.py +14 -19
  197. gr4vy/models/payoutpaymentservice.py +14 -19
  198. gr4vy/models/payoutsummaries.py +14 -19
  199. gr4vy/models/payoutsummary.py +35 -36
  200. gr4vy/models/paypaloptions.py +14 -19
  201. gr4vy/models/paypalshippingoptions.py +14 -19
  202. gr4vy/models/paypalshippingoptionsitem.py +14 -19
  203. gr4vy/models/plaidpaymentmethodcreate.py +31 -32
  204. gr4vy/models/powertranzoptions.py +14 -19
  205. gr4vy/models/recipient.py +14 -19
  206. gr4vy/models/redirectpaymentmethodcreate.py +18 -27
  207. gr4vy/models/refund.py +39 -40
  208. gr4vy/models/refunds.py +14 -19
  209. gr4vy/models/register_digital_wallet_domainop.py +34 -1
  210. gr4vy/models/report.py +33 -34
  211. gr4vy/models/reportcreate.py +14 -19
  212. gr4vy/models/reportexecution.py +18 -1
  213. gr4vy/models/reportexecutions.py +14 -19
  214. gr4vy/models/reportexecutionsummary.py +18 -1
  215. gr4vy/models/reportexecutionurlgenerate.py +18 -1
  216. gr4vy/models/reports.py +14 -19
  217. gr4vy/models/reportsummary.py +16 -19
  218. gr4vy/models/reportupdate.py +14 -19
  219. gr4vy/models/requiredcheckoutfields.py +14 -19
  220. gr4vy/models/resume_payment_method_network_tokenop.py +34 -1
  221. gr4vy/models/security.py +18 -1
  222. gr4vy/models/settlement.py +16 -25
  223. gr4vy/models/shippingdetails.py +35 -36
  224. gr4vy/models/shippingdetailscreate.py +18 -31
  225. gr4vy/models/shippingdetailsupdate.py +18 -31
  226. gr4vy/models/statementdescriptor.py +34 -35
  227. gr4vy/models/stripeconnectoptions.py +30 -31
  228. gr4vy/models/stripeoptions.py +14 -19
  229. gr4vy/models/suspend_payment_method_network_tokenop.py +34 -1
  230. gr4vy/models/sync_transactionop.py +34 -1
  231. gr4vy/models/threedsecure.py +14 -19
  232. gr4vy/models/threedsecuredatav1.py +14 -19
  233. gr4vy/models/threedsecuredatav2.py +14 -19
  234. gr4vy/models/threedsecureerror.py +14 -19
  235. gr4vy/models/threedsecurescenario.py +77 -0
  236. gr4vy/models/threedsecurescenarioconditions.py +84 -0
  237. gr4vy/models/threedsecurescenariocreate.py +24 -0
  238. gr4vy/models/threedsecurescenariooutcome.py +57 -0
  239. gr4vy/models/threedsecurescenariooutcomeauthentication.py +31 -0
  240. gr4vy/models/threedsecurescenariooutcomeresult.py +27 -0
  241. gr4vy/models/threedsecurescenarios.py +58 -0
  242. gr4vy/models/threedsecurescenarioupdate.py +54 -0
  243. gr4vy/models/threedsecurev2.py +34 -35
  244. gr4vy/models/tokenpaymentmethodcreate.py +14 -19
  245. gr4vy/models/transaction.py +111 -112
  246. gr4vy/models/transactionaction.py +18 -1
  247. gr4vy/models/transactionbuyer.py +31 -32
  248. gr4vy/models/transactioncancel.py +14 -19
  249. gr4vy/models/transactioncapture.py +14 -19
  250. gr4vy/models/transactioncapturecreate.py +14 -19
  251. gr4vy/models/transactionconnectionoptions.py +104 -105
  252. gr4vy/models/transactioncreate.py +88 -89
  253. gr4vy/models/transactionevent.py +18 -1
  254. gr4vy/models/transactionevents.py +14 -19
  255. gr4vy/models/transactiongiftcard.py +14 -19
  256. gr4vy/models/transactionpaymentmethod.py +49 -50
  257. gr4vy/models/transactionpaymentservice.py +18 -1
  258. gr4vy/models/transactionrefundallcreate.py +14 -19
  259. gr4vy/models/transactionrefundcreate.py +16 -25
  260. gr4vy/models/transactionretriesreportspec.py +18 -1
  261. gr4vy/models/transactionsreportspec.py +18 -1
  262. gr4vy/models/transactionsummaries.py +14 -19
  263. gr4vy/models/transactionsummary.py +50 -51
  264. gr4vy/models/transactionthreedsecuresummary.py +18 -33
  265. gr4vy/models/transactionupdate.py +14 -19
  266. gr4vy/models/transactionvoid.py +14 -19
  267. gr4vy/models/travelhubcustomdata.py +14 -19
  268. gr4vy/models/travelhuboptions.py +14 -19
  269. gr4vy/models/trustlyoptions.py +14 -19
  270. gr4vy/models/unregister_digital_wallet_domainop.py +34 -1
  271. gr4vy/models/update_buyer_shipping_detailsop.py +34 -1
  272. gr4vy/models/update_buyerop.py +34 -1
  273. gr4vy/models/update_checkout_sessionop.py +34 -1
  274. gr4vy/models/update_digital_walletop.py +34 -1
  275. gr4vy/models/update_payment_serviceop.py +34 -1
  276. gr4vy/models/update_reportop.py +34 -1
  277. gr4vy/models/update_three_ds_scenarioop.py +91 -0
  278. gr4vy/models/update_transactionop.py +34 -1
  279. gr4vy/models/verify_payment_service_credentialsop.py +34 -1
  280. gr4vy/models/verifycredentials.py +14 -19
  281. gr4vy/models/void_transactionop.py +30 -19
  282. gr4vy/models/wpayeverdaypayoptions.py +30 -31
  283. gr4vy/models/wpaypaytooptions.py +14 -19
  284. gr4vy/models/wpaypaytoresourceoptions.py +14 -19
  285. gr4vy/models/wpaypaytosimulationoptions.py +14 -19
  286. gr4vy/sdk.py +3 -0
  287. gr4vy/three_ds_scenarios.py +1322 -0
  288. gr4vy/utils/__init__.py +13 -1
  289. {gr4vy-1.10.12.dist-info → gr4vy-1.10.14.dist-info}/METADATA +8 -1
  290. gr4vy-1.10.14.dist-info/RECORD +464 -0
  291. gr4vy-1.10.12.dist-info/RECORD +0 -451
  292. {gr4vy-1.10.12.dist-info → gr4vy-1.10.14.dist-info}/WHEEL +0 -0
@@ -181,71 +181,70 @@ class PaymentLink(BaseModel):
181
181
 
182
182
  @model_serializer(mode="wrap")
183
183
  def serialize_model(self, handler):
184
- optional_fields = [
185
- "type",
186
- "expires_at",
187
- "external_identifier",
188
- "statement_descriptor",
189
- "locale",
190
- "merchant_name",
191
- "merchant_url",
192
- "merchant_banner_url",
193
- "merchant_color",
194
- "merchant_message",
195
- "merchant_terms_and_conditions_url",
196
- "merchant_favicon_url",
197
- "return_url",
198
- "metadata",
199
- "buyer",
200
- "shipping_details",
201
- "connection_options",
202
- "store",
203
- "buyer_id",
204
- "installment_count",
205
- ]
206
- nullable_fields = [
207
- "expires_at",
208
- "external_identifier",
209
- "statement_descriptor",
210
- "locale",
211
- "merchant_name",
212
- "merchant_url",
213
- "merchant_banner_url",
214
- "merchant_color",
215
- "merchant_message",
216
- "merchant_terms_and_conditions_url",
217
- "merchant_favicon_url",
218
- "return_url",
219
- "cart_items",
220
- "metadata",
221
- "buyer",
222
- "shipping_details",
223
- "connection_options",
224
- "buyer_id",
225
- "installment_count",
226
- ]
227
- null_default_fields = []
228
-
184
+ optional_fields = set(
185
+ [
186
+ "type",
187
+ "expires_at",
188
+ "external_identifier",
189
+ "statement_descriptor",
190
+ "locale",
191
+ "merchant_name",
192
+ "merchant_url",
193
+ "merchant_banner_url",
194
+ "merchant_color",
195
+ "merchant_message",
196
+ "merchant_terms_and_conditions_url",
197
+ "merchant_favicon_url",
198
+ "return_url",
199
+ "metadata",
200
+ "buyer",
201
+ "shipping_details",
202
+ "connection_options",
203
+ "store",
204
+ "buyer_id",
205
+ "installment_count",
206
+ ]
207
+ )
208
+ nullable_fields = set(
209
+ [
210
+ "expires_at",
211
+ "external_identifier",
212
+ "statement_descriptor",
213
+ "locale",
214
+ "merchant_name",
215
+ "merchant_url",
216
+ "merchant_banner_url",
217
+ "merchant_color",
218
+ "merchant_message",
219
+ "merchant_terms_and_conditions_url",
220
+ "merchant_favicon_url",
221
+ "return_url",
222
+ "cart_items",
223
+ "metadata",
224
+ "buyer",
225
+ "shipping_details",
226
+ "connection_options",
227
+ "buyer_id",
228
+ "installment_count",
229
+ ]
230
+ )
229
231
  serialized = handler(self)
230
-
231
232
  m = {}
232
233
 
233
234
  for n, f in type(self).model_fields.items():
234
235
  k = f.alias or n
235
236
  val = serialized.get(k)
236
- serialized.pop(k, None)
237
-
238
- optional_nullable = k in optional_fields and k in nullable_fields
239
- is_set = (
240
- self.__pydantic_fields_set__.intersection({n})
241
- or k in null_default_fields
242
- ) # pylint: disable=no-member
243
-
244
- if val is not None and val != UNSET_SENTINEL:
245
- m[k] = val
246
- elif val != UNSET_SENTINEL and (
247
- not k in optional_fields or (optional_nullable and is_set)
248
- ):
249
- m[k] = val
237
+ is_nullable_and_explicitly_set = (
238
+ k in nullable_fields
239
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
240
+ )
241
+
242
+ if val != UNSET_SENTINEL:
243
+ if (
244
+ val is not None
245
+ or k not in optional_fields
246
+ or is_nullable_and_explicitly_set
247
+ ):
248
+ m[k] = val
250
249
 
251
250
  return m
@@ -141,71 +141,70 @@ class PaymentLinkCreate(BaseModel):
141
141
 
142
142
  @model_serializer(mode="wrap")
143
143
  def serialize_model(self, handler):
144
- optional_fields = [
145
- "buyer",
146
- "expires_at",
147
- "connection_options",
148
- "external_identifier",
149
- "statement_descriptor",
150
- "locale",
151
- "merchant_name",
152
- "merchant_url",
153
- "merchant_banner_url",
154
- "merchant_color",
155
- "merchant_message",
156
- "merchant_terms_and_conditions_url",
157
- "merchant_favicon_url",
158
- "intent",
159
- "return_url",
160
- "cart_items",
161
- "metadata",
162
- "payment_source",
163
- "store",
164
- "buyer_id",
165
- "installment_count",
166
- ]
167
- nullable_fields = [
168
- "buyer",
169
- "expires_at",
170
- "connection_options",
171
- "external_identifier",
172
- "statement_descriptor",
173
- "locale",
174
- "merchant_name",
175
- "merchant_url",
176
- "merchant_banner_url",
177
- "merchant_color",
178
- "merchant_message",
179
- "merchant_terms_and_conditions_url",
180
- "merchant_favicon_url",
181
- "return_url",
182
- "cart_items",
183
- "metadata",
184
- "buyer_id",
185
- "installment_count",
186
- ]
187
- null_default_fields = []
188
-
144
+ optional_fields = set(
145
+ [
146
+ "buyer",
147
+ "expires_at",
148
+ "connection_options",
149
+ "external_identifier",
150
+ "statement_descriptor",
151
+ "locale",
152
+ "merchant_name",
153
+ "merchant_url",
154
+ "merchant_banner_url",
155
+ "merchant_color",
156
+ "merchant_message",
157
+ "merchant_terms_and_conditions_url",
158
+ "merchant_favicon_url",
159
+ "intent",
160
+ "return_url",
161
+ "cart_items",
162
+ "metadata",
163
+ "payment_source",
164
+ "store",
165
+ "buyer_id",
166
+ "installment_count",
167
+ ]
168
+ )
169
+ nullable_fields = set(
170
+ [
171
+ "buyer",
172
+ "expires_at",
173
+ "connection_options",
174
+ "external_identifier",
175
+ "statement_descriptor",
176
+ "locale",
177
+ "merchant_name",
178
+ "merchant_url",
179
+ "merchant_banner_url",
180
+ "merchant_color",
181
+ "merchant_message",
182
+ "merchant_terms_and_conditions_url",
183
+ "merchant_favicon_url",
184
+ "return_url",
185
+ "cart_items",
186
+ "metadata",
187
+ "buyer_id",
188
+ "installment_count",
189
+ ]
190
+ )
189
191
  serialized = handler(self)
190
-
191
192
  m = {}
192
193
 
193
194
  for n, f in type(self).model_fields.items():
194
195
  k = f.alias or n
195
196
  val = serialized.get(k)
196
- serialized.pop(k, None)
197
-
198
- optional_nullable = k in optional_fields and k in nullable_fields
199
- is_set = (
200
- self.__pydantic_fields_set__.intersection({n})
201
- or k in null_default_fields
202
- ) # pylint: disable=no-member
203
-
204
- if val is not None and val != UNSET_SENTINEL:
205
- m[k] = val
206
- elif val != UNSET_SENTINEL and (
207
- not k in optional_fields or (optional_nullable and is_set)
208
- ):
209
- m[k] = val
197
+ is_nullable_and_explicitly_set = (
198
+ k in nullable_fields
199
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
200
+ )
201
+
202
+ if val != UNSET_SENTINEL:
203
+ if (
204
+ val is not None
205
+ or k not in optional_fields
206
+ or is_nullable_and_explicitly_set
207
+ ):
208
+ m[k] = val
210
209
 
211
210
  return m
@@ -34,30 +34,25 @@ class PaymentLinks(BaseModel):
34
34
 
35
35
  @model_serializer(mode="wrap")
36
36
  def serialize_model(self, handler):
37
- optional_fields = ["limit", "next_cursor", "previous_cursor"]
38
- nullable_fields = ["next_cursor", "previous_cursor"]
39
- null_default_fields = []
40
-
37
+ optional_fields = set(["limit", "next_cursor", "previous_cursor"])
38
+ nullable_fields = set(["next_cursor", "previous_cursor"])
41
39
  serialized = handler(self)
42
-
43
40
  m = {}
44
41
 
45
42
  for n, f in type(self).model_fields.items():
46
43
  k = f.alias or n
47
44
  val = serialized.get(k)
48
- serialized.pop(k, None)
49
-
50
- optional_nullable = k in optional_fields and k in nullable_fields
51
- is_set = (
52
- self.__pydantic_fields_set__.intersection({n})
53
- or k in null_default_fields
54
- ) # pylint: disable=no-member
55
-
56
- if val is not None and val != UNSET_SENTINEL:
57
- m[k] = val
58
- elif val != UNSET_SENTINEL and (
59
- not k in optional_fields or (optional_nullable and is_set)
60
- ):
61
- m[k] = val
45
+ is_nullable_and_explicitly_set = (
46
+ k in nullable_fields
47
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
48
+ )
49
+
50
+ if val != UNSET_SENTINEL:
51
+ if (
52
+ val is not None
53
+ or k not in optional_fields
54
+ or is_nullable_and_explicitly_set
55
+ ):
56
+ m[k] = val
62
57
 
63
58
  return m
@@ -163,63 +163,62 @@ class PaymentMethod(BaseModel):
163
163
 
164
164
  @model_serializer(mode="wrap")
165
165
  def serialize_model(self, handler):
166
- optional_fields = [
167
- "type",
168
- "approval_url",
169
- "country",
170
- "currency",
171
- "details",
172
- "expiration_date",
173
- "fingerprint",
174
- "label",
175
- "last_replaced_at",
176
- "mode",
177
- "scheme",
178
- "additional_schemes",
179
- "cit_last_used_at",
180
- "last_used_at",
181
- "buyer",
182
- "external_identifier",
183
- ]
184
- nullable_fields = [
185
- "approval_url",
186
- "country",
187
- "currency",
188
- "details",
189
- "expiration_date",
190
- "fingerprint",
191
- "label",
192
- "last_replaced_at",
193
- "mode",
194
- "scheme",
195
- "additional_schemes",
196
- "cit_last_used_at",
197
- "last_used_at",
198
- "buyer",
199
- "external_identifier",
200
- ]
201
- null_default_fields = []
202
-
166
+ optional_fields = set(
167
+ [
168
+ "type",
169
+ "approval_url",
170
+ "country",
171
+ "currency",
172
+ "details",
173
+ "expiration_date",
174
+ "fingerprint",
175
+ "label",
176
+ "last_replaced_at",
177
+ "mode",
178
+ "scheme",
179
+ "additional_schemes",
180
+ "cit_last_used_at",
181
+ "last_used_at",
182
+ "buyer",
183
+ "external_identifier",
184
+ ]
185
+ )
186
+ nullable_fields = set(
187
+ [
188
+ "approval_url",
189
+ "country",
190
+ "currency",
191
+ "details",
192
+ "expiration_date",
193
+ "fingerprint",
194
+ "label",
195
+ "last_replaced_at",
196
+ "mode",
197
+ "scheme",
198
+ "additional_schemes",
199
+ "cit_last_used_at",
200
+ "last_used_at",
201
+ "buyer",
202
+ "external_identifier",
203
+ ]
204
+ )
203
205
  serialized = handler(self)
204
-
205
206
  m = {}
206
207
 
207
208
  for n, f in type(self).model_fields.items():
208
209
  k = f.alias or n
209
210
  val = serialized.get(k)
210
- serialized.pop(k, None)
211
-
212
- optional_nullable = k in optional_fields and k in nullable_fields
213
- is_set = (
214
- self.__pydantic_fields_set__.intersection({n})
215
- or k in null_default_fields
216
- ) # pylint: disable=no-member
217
-
218
- if val is not None and val != UNSET_SENTINEL:
219
- m[k] = val
220
- elif val != UNSET_SENTINEL and (
221
- not k in optional_fields or (optional_nullable and is_set)
222
- ):
223
- m[k] = val
211
+ is_nullable_and_explicitly_set = (
212
+ k in nullable_fields
213
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
214
+ )
215
+
216
+ if val != UNSET_SENTINEL:
217
+ if (
218
+ val is not None
219
+ or k not in optional_fields
220
+ or is_nullable_and_explicitly_set
221
+ ):
222
+ m[k] = val
224
223
 
225
224
  return m
@@ -45,30 +45,25 @@ class PaymentMethodCard(BaseModel):
45
45
 
46
46
  @model_serializer(mode="wrap")
47
47
  def serialize_model(self, handler):
48
- optional_fields = ["method", "card_scheme", "external_identifier"]
49
- nullable_fields = ["card_scheme", "external_identifier"]
50
- null_default_fields = []
51
-
48
+ optional_fields = set(["method", "card_scheme", "external_identifier"])
49
+ nullable_fields = set(["card_scheme", "external_identifier"])
52
50
  serialized = handler(self)
53
-
54
51
  m = {}
55
52
 
56
53
  for n, f in type(self).model_fields.items():
57
54
  k = f.alias or n
58
55
  val = serialized.get(k)
59
- serialized.pop(k, None)
60
-
61
- optional_nullable = k in optional_fields and k in nullable_fields
62
- is_set = (
63
- self.__pydantic_fields_set__.intersection({n})
64
- or k in null_default_fields
65
- ) # pylint: disable=no-member
66
-
67
- if val is not None and val != UNSET_SENTINEL:
68
- m[k] = val
69
- elif val != UNSET_SENTINEL and (
70
- not k in optional_fields or (optional_nullable and is_set)
71
- ):
72
- m[k] = val
56
+ is_nullable_and_explicitly_set = (
57
+ k in nullable_fields
58
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
59
+ )
60
+
61
+ if val != UNSET_SENTINEL:
62
+ if (
63
+ val is not None
64
+ or k not in optional_fields
65
+ or is_nullable_and_explicitly_set
66
+ ):
67
+ m[k] = val
73
68
 
74
69
  return m
@@ -22,30 +22,25 @@ class PaymentMethodDetailsCard(BaseModel):
22
22
 
23
23
  @model_serializer(mode="wrap")
24
24
  def serialize_model(self, handler):
25
- optional_fields = ["bin", "card_type", "card_issuer_name"]
26
- nullable_fields = ["bin", "card_type", "card_issuer_name"]
27
- null_default_fields = []
28
-
25
+ optional_fields = set(["bin", "card_type", "card_issuer_name"])
26
+ nullable_fields = set(["bin", "card_type", "card_issuer_name"])
29
27
  serialized = handler(self)
30
-
31
28
  m = {}
32
29
 
33
30
  for n, f in type(self).model_fields.items():
34
31
  k = f.alias or n
35
32
  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
33
+ is_nullable_and_explicitly_set = (
34
+ k in nullable_fields
35
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
36
+ )
37
+
38
+ if val != UNSET_SENTINEL:
39
+ if (
40
+ val is not None
41
+ or k not in optional_fields
42
+ or is_nullable_and_explicitly_set
43
+ ):
44
+ m[k] = val
50
45
 
51
46
  return m
@@ -34,30 +34,25 @@ class PaymentMethods(BaseModel):
34
34
 
35
35
  @model_serializer(mode="wrap")
36
36
  def serialize_model(self, handler):
37
- optional_fields = ["limit", "next_cursor", "previous_cursor"]
38
- nullable_fields = ["next_cursor", "previous_cursor"]
39
- null_default_fields = []
40
-
37
+ optional_fields = set(["limit", "next_cursor", "previous_cursor"])
38
+ nullable_fields = set(["next_cursor", "previous_cursor"])
41
39
  serialized = handler(self)
42
-
43
40
  m = {}
44
41
 
45
42
  for n, f in type(self).model_fields.items():
46
43
  k = f.alias or n
47
44
  val = serialized.get(k)
48
- serialized.pop(k, None)
49
-
50
- optional_nullable = k in optional_fields and k in nullable_fields
51
- is_set = (
52
- self.__pydantic_fields_set__.intersection({n})
53
- or k in null_default_fields
54
- ) # pylint: disable=no-member
55
-
56
- if val is not None and val != UNSET_SENTINEL:
57
- m[k] = val
58
- elif val != UNSET_SENTINEL and (
59
- not k in optional_fields or (optional_nullable and is_set)
60
- ):
61
- m[k] = val
45
+ is_nullable_and_explicitly_set = (
46
+ k in nullable_fields
47
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
48
+ )
49
+
50
+ if val != UNSET_SENTINEL:
51
+ if (
52
+ val is not None
53
+ or k not in optional_fields
54
+ or is_nullable_and_explicitly_set
55
+ ):
56
+ m[k] = val
62
57
 
63
58
  return m
@@ -1,9 +1,10 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from __future__ import annotations
4
- from gr4vy.types import BaseModel
4
+ from gr4vy.types import BaseModel, UNSET_SENTINEL
5
5
  from gr4vy.utils import validate_const
6
6
  import pydantic
7
+ from pydantic import model_serializer
7
8
  from pydantic.functional_validators import AfterValidator
8
9
  from typing import Literal, Optional
9
10
  from typing_extensions import Annotated, TypedDict
@@ -25,3 +26,19 @@ class PaymentMethodStoredCard(BaseModel):
25
26
  pydantic.Field(alias="method"),
26
27
  ] = "id"
27
28
  r"""Set to `id` to use a stored card."""
29
+
30
+ @model_serializer(mode="wrap")
31
+ def serialize_model(self, handler):
32
+ optional_fields = set(["method"])
33
+ serialized = handler(self)
34
+ m = {}
35
+
36
+ for n, f in type(self).model_fields.items():
37
+ k = f.alias or n
38
+ val = serialized.get(k)
39
+
40
+ if val != UNSET_SENTINEL:
41
+ if val is not None or k not in optional_fields:
42
+ m[k] = val
43
+
44
+ return m