moovio_sdk 0.3.8__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 (586) hide show
  1. moovio_sdk/__init__.py +17 -0
  2. moovio_sdk/_hooks/__init__.py +5 -0
  3. moovio_sdk/_hooks/registration.py +13 -0
  4. moovio_sdk/_hooks/sdkhooks.py +76 -0
  5. moovio_sdk/_hooks/types.py +106 -0
  6. moovio_sdk/_version.py +15 -0
  7. moovio_sdk/accounts.py +2461 -0
  8. moovio_sdk/adjustments.py +463 -0
  9. moovio_sdk/apple_pay.py +1417 -0
  10. moovio_sdk/authentication.py +531 -0
  11. moovio_sdk/avatars.py +231 -0
  12. moovio_sdk/bank_accounts.py +2445 -0
  13. moovio_sdk/basesdk.py +363 -0
  14. moovio_sdk/branding.py +1089 -0
  15. moovio_sdk/capabilities.py +1001 -0
  16. moovio_sdk/card_issuing.py +1351 -0
  17. moovio_sdk/cards.py +1469 -0
  18. moovio_sdk/disputes.py +2985 -0
  19. moovio_sdk/end_to_end_encryption.py +453 -0
  20. moovio_sdk/enriched_address.py +307 -0
  21. moovio_sdk/enriched_profile.py +235 -0
  22. moovio_sdk/fee_plans.py +1759 -0
  23. moovio_sdk/files.py +775 -0
  24. moovio_sdk/httpclient.py +136 -0
  25. moovio_sdk/industries.py +239 -0
  26. moovio_sdk/institutions.py +261 -0
  27. moovio_sdk/issuing_transactions.py +1228 -0
  28. moovio_sdk/models/__init__.py +4 -0
  29. moovio_sdk/models/components/__init__.py +1411 -0
  30. moovio_sdk/models/components/account.py +96 -0
  31. moovio_sdk/models/components/accountcapability.py +20 -0
  32. moovio_sdk/models/components/accountcountries.py +18 -0
  33. moovio_sdk/models/components/accountnameverification.py +28 -0
  34. moovio_sdk/models/components/accounttype.py +11 -0
  35. moovio_sdk/models/components/accountverificationstatus.py +19 -0
  36. moovio_sdk/models/components/achcreditsamedaypaymentmethod.py +38 -0
  37. moovio_sdk/models/components/achcreditstandardpaymentmethod.py +38 -0
  38. moovio_sdk/models/components/achdebitcollectpaymentmethod.py +38 -0
  39. moovio_sdk/models/components/achdebitfundpaymentmethod.py +38 -0
  40. moovio_sdk/models/components/achexception.py +20 -0
  41. moovio_sdk/models/components/achlocation.py +26 -0
  42. moovio_sdk/models/components/achparticipant.py +93 -0
  43. moovio_sdk/models/components/achpaymentdetails.py +30 -0
  44. moovio_sdk/models/components/achpaymentdetailserror.py +22 -0
  45. moovio_sdk/models/components/achpaymentsettings.py +16 -0
  46. moovio_sdk/models/components/achreturncode.py +51 -0
  47. moovio_sdk/models/components/achtransactiondetails.py +94 -0
  48. moovio_sdk/models/components/achtransactionstatus.py +15 -0
  49. moovio_sdk/models/components/addcapabilities.py +15 -0
  50. moovio_sdk/models/components/address.py +30 -0
  51. moovio_sdk/models/components/addresserror.py +32 -0
  52. moovio_sdk/models/components/addresssuggestion.py +34 -0
  53. moovio_sdk/models/components/addressupdate.py +32 -0
  54. moovio_sdk/models/components/adjustment.py +29 -0
  55. moovio_sdk/models/components/amount.py +26 -0
  56. moovio_sdk/models/components/amountdecimal.py +27 -0
  57. moovio_sdk/models/components/amountupdate.py +27 -0
  58. moovio_sdk/models/components/amountvalidationerror.py +17 -0
  59. moovio_sdk/models/components/applebillingcontact.py +53 -0
  60. moovio_sdk/models/components/applepayheader.py +41 -0
  61. moovio_sdk/models/components/applepaymerchantdomains.py +32 -0
  62. moovio_sdk/models/components/applepaypaymentmethod.py +33 -0
  63. moovio_sdk/models/components/applepayresponse.py +70 -0
  64. moovio_sdk/models/components/applicationscope.py +41 -0
  65. moovio_sdk/models/components/asynccreatedrefund.py +26 -0
  66. moovio_sdk/models/components/asynctransfer.py +18 -0
  67. moovio_sdk/models/components/authorizeduser.py +21 -0
  68. moovio_sdk/models/components/authtoken.py +36 -0
  69. moovio_sdk/models/components/authtokenrequest.py +46 -0
  70. moovio_sdk/models/components/bankaccount.py +98 -0
  71. moovio_sdk/models/components/bankaccountexception.py +96 -0
  72. moovio_sdk/models/components/bankaccountholdertype.py +11 -0
  73. moovio_sdk/models/components/bankaccountintegration.py +34 -0
  74. moovio_sdk/models/components/bankaccountpayload.py +21 -0
  75. moovio_sdk/models/components/bankaccountstatus.py +12 -0
  76. moovio_sdk/models/components/bankaccountstatusreason.py +23 -0
  77. moovio_sdk/models/components/bankaccounttype.py +13 -0
  78. moovio_sdk/models/components/bankaccountverification.py +30 -0
  79. moovio_sdk/models/components/bankaccountverificationcreated.py +21 -0
  80. moovio_sdk/models/components/bankaccountverificationmethod.py +9 -0
  81. moovio_sdk/models/components/bankaccountverificationstatus.py +13 -0
  82. moovio_sdk/models/components/bankaccountwaitfor.py +9 -0
  83. moovio_sdk/models/components/basicpaymentmethod.py +24 -0
  84. moovio_sdk/models/components/billablefee.py +54 -0
  85. moovio_sdk/models/components/birthdate.py +19 -0
  86. moovio_sdk/models/components/birthdateerror.py +20 -0
  87. moovio_sdk/models/components/birthdateupdate.py +20 -0
  88. moovio_sdk/models/components/birthdatevalidationerror.py +20 -0
  89. moovio_sdk/models/components/brandcolor.py +15 -0
  90. moovio_sdk/models/components/brandcolors.py +21 -0
  91. moovio_sdk/models/components/brandcolorvalidationerror.py +14 -0
  92. moovio_sdk/models/components/brandproperties.py +16 -0
  93. moovio_sdk/models/components/businessprofile.py +81 -0
  94. moovio_sdk/models/components/businesstype.py +19 -0
  95. moovio_sdk/models/components/calltoaction.py +19 -0
  96. moovio_sdk/models/components/cancellation.py +22 -0
  97. moovio_sdk/models/components/cancellationstatus.py +10 -0
  98. moovio_sdk/models/components/capabilitieserror.py +14 -0
  99. moovio_sdk/models/components/capability.py +56 -0
  100. moovio_sdk/models/components/capabilityid.py +18 -0
  101. moovio_sdk/models/components/capabilityrequirement.py +26 -0
  102. moovio_sdk/models/components/capabilitystatus.py +13 -0
  103. moovio_sdk/models/components/card.py +164 -0
  104. moovio_sdk/models/components/cardaccountupdater.py +28 -0
  105. moovio_sdk/models/components/cardacquiringdispute.py +26 -0
  106. moovio_sdk/models/components/cardacquiringmodel.py +11 -0
  107. moovio_sdk/models/components/cardacquiringrefund.py +42 -0
  108. moovio_sdk/models/components/cardaddress.py +32 -0
  109. moovio_sdk/models/components/cardbrand.py +14 -0
  110. moovio_sdk/models/components/cardexpiration.py +20 -0
  111. moovio_sdk/models/components/cardexpirationerror.py +17 -0
  112. moovio_sdk/models/components/cardissuingnetwork.py +12 -0
  113. moovio_sdk/models/components/cardpaymentdetails.py +23 -0
  114. moovio_sdk/models/components/cardpaymentdetailserror.py +17 -0
  115. moovio_sdk/models/components/cardpaymentpaymentmethod.py +33 -0
  116. moovio_sdk/models/components/cardpaymentsettings.py +23 -0
  117. moovio_sdk/models/components/cardtransactiondetails.py +94 -0
  118. moovio_sdk/models/components/cardtransactionfailurecode.py +32 -0
  119. moovio_sdk/models/components/cardtransactionstatus.py +15 -0
  120. moovio_sdk/models/components/cardtype.py +13 -0
  121. moovio_sdk/models/components/cardupdatereason.py +16 -0
  122. moovio_sdk/models/components/cardverification.py +38 -0
  123. moovio_sdk/models/components/cardverificationresult.py +12 -0
  124. moovio_sdk/models/components/cardvolumedistribution.py +29 -0
  125. moovio_sdk/models/components/cardvolumedistributionerror.py +32 -0
  126. moovio_sdk/models/components/collectionpaymentmethodtype.py +12 -0
  127. moovio_sdk/models/components/colorsvalidationerror.py +21 -0
  128. moovio_sdk/models/components/completebankaccountverification.py +15 -0
  129. moovio_sdk/models/components/completedmicrodeposits.py +14 -0
  130. moovio_sdk/models/components/completemicrodeposits.py +20 -0
  131. moovio_sdk/models/components/countrieserrors.py +14 -0
  132. moovio_sdk/models/components/createaccount.py +78 -0
  133. moovio_sdk/models/components/createaccounterror.py +44 -0
  134. moovio_sdk/models/components/createaccountsettings.py +40 -0
  135. moovio_sdk/models/components/createapplepaysession.py +21 -0
  136. moovio_sdk/models/components/createauthorizeduser.py +26 -0
  137. moovio_sdk/models/components/createauthorizedusererror.py +24 -0
  138. moovio_sdk/models/components/createauthorizeduserupdate.py +28 -0
  139. moovio_sdk/models/components/createbusinesserror.py +88 -0
  140. moovio_sdk/models/components/createbusinessprofile.py +69 -0
  141. moovio_sdk/models/components/createevidencefilemultipart.py +63 -0
  142. moovio_sdk/models/components/createevidencetext.py +20 -0
  143. moovio_sdk/models/components/createfeeplanagreement.py +14 -0
  144. moovio_sdk/models/components/createindividualerror.py +72 -0
  145. moovio_sdk/models/components/createindividualprofile.py +37 -0
  146. moovio_sdk/models/components/createpaymentlink.py +95 -0
  147. moovio_sdk/models/components/createprofile.py +22 -0
  148. moovio_sdk/models/components/createprofileerror.py +19 -0
  149. moovio_sdk/models/components/createrefund.py +26 -0
  150. moovio_sdk/models/components/createrefundresponse.py +18 -0
  151. moovio_sdk/models/components/createrepresentative.py +50 -0
  152. moovio_sdk/models/components/createreversal.py +15 -0
  153. moovio_sdk/models/components/createsweepconfig.py +41 -0
  154. moovio_sdk/models/components/createterminalapplication.py +42 -0
  155. moovio_sdk/models/components/createtransfer.py +49 -0
  156. moovio_sdk/models/components/createtransferdestination.py +37 -0
  157. moovio_sdk/models/components/createtransferdestinationach.py +26 -0
  158. moovio_sdk/models/components/createtransferdestinationcard.py +19 -0
  159. moovio_sdk/models/components/createtransferoptions.py +24 -0
  160. moovio_sdk/models/components/createtransfersource.py +48 -0
  161. moovio_sdk/models/components/createtransfersourceach.py +40 -0
  162. moovio_sdk/models/components/createtransfersourcecard.py +35 -0
  163. moovio_sdk/models/components/customersupport.py +33 -0
  164. moovio_sdk/models/components/customersupporterror.py +25 -0
  165. moovio_sdk/models/components/debitholdperiod.py +12 -0
  166. moovio_sdk/models/components/disbursementpaymentmethodtype.py +13 -0
  167. moovio_sdk/models/components/displayoptionserror.py +23 -0
  168. moovio_sdk/models/components/dispute.py +76 -0
  169. moovio_sdk/models/components/disputeevidenceresponse.py +49 -0
  170. moovio_sdk/models/components/disputephase.py +13 -0
  171. moovio_sdk/models/components/disputestatus.py +20 -0
  172. moovio_sdk/models/components/disputetransferdetails.py +16 -0
  173. moovio_sdk/models/components/document.py +37 -0
  174. moovio_sdk/models/components/documenttype.py +13 -0
  175. moovio_sdk/models/components/domesticpullfromcard.py +12 -0
  176. moovio_sdk/models/components/domesticpushtocard.py +13 -0
  177. moovio_sdk/models/components/e2eetoken.py +25 -0
  178. moovio_sdk/models/components/e2eetokenupdate.py +26 -0
  179. moovio_sdk/models/components/end2endencryptionerror.py +14 -0
  180. moovio_sdk/models/components/enrichedaddressresponse.py +15 -0
  181. moovio_sdk/models/components/enrichedbusinessprofile.py +37 -0
  182. moovio_sdk/models/components/enrichedbusinessresponse.py +18 -0
  183. moovio_sdk/models/components/enrichedindustries.py +15 -0
  184. moovio_sdk/models/components/enrichedindustry.py +32 -0
  185. moovio_sdk/models/components/enrichedindustrycodes.py +17 -0
  186. moovio_sdk/models/components/evidencetextresponse.py +28 -0
  187. moovio_sdk/models/components/evidencetype.py +15 -0
  188. moovio_sdk/models/components/evidenceuploadresponse.py +50 -0
  189. moovio_sdk/models/components/facilitatorfee.py +48 -0
  190. moovio_sdk/models/components/feecategory.py +16 -0
  191. moovio_sdk/models/components/feemodel.py +12 -0
  192. moovio_sdk/models/components/feeplan.py +43 -0
  193. moovio_sdk/models/components/feeplanagreement.py +51 -0
  194. moovio_sdk/models/components/feeplanagreementstatus.py +9 -0
  195. moovio_sdk/models/components/feeproperties.py +49 -0
  196. moovio_sdk/models/components/filedetails.py +55 -0
  197. moovio_sdk/models/components/filepurpose.py +15 -0
  198. moovio_sdk/models/components/filestatus.py +12 -0
  199. moovio_sdk/models/components/fileuploadrequestmultipart.py +69 -0
  200. moovio_sdk/models/components/financialinstitutions.py +18 -0
  201. moovio_sdk/models/components/fulfillmentdetails.py +24 -0
  202. moovio_sdk/models/components/fulfillmentdetailserror.py +20 -0
  203. moovio_sdk/models/components/fullissuedcard.py +92 -0
  204. moovio_sdk/models/components/generatedby.py +39 -0
  205. moovio_sdk/models/components/generatedbyaccountid.py +15 -0
  206. moovio_sdk/models/components/generatedbybankaccountid.py +17 -0
  207. moovio_sdk/models/components/generatedbycardid.py +15 -0
  208. moovio_sdk/models/components/generatedbydisputeid.py +15 -0
  209. moovio_sdk/models/components/generatedbytransferid.py +15 -0
  210. moovio_sdk/models/components/governmentid.py +40 -0
  211. moovio_sdk/models/components/governmentiderror.py +40 -0
  212. moovio_sdk/models/components/granttype.py +15 -0
  213. moovio_sdk/models/components/incurredfee.py +44 -0
  214. moovio_sdk/models/components/individualname.py +32 -0
  215. moovio_sdk/models/components/individualnameerror.py +24 -0
  216. moovio_sdk/models/components/individualnameupdate.py +32 -0
  217. moovio_sdk/models/components/individualprofile.py +45 -0
  218. moovio_sdk/models/components/industrycodes.py +20 -0
  219. moovio_sdk/models/components/issuedcard.py +78 -0
  220. moovio_sdk/models/components/issuedcardauthorization.py +53 -0
  221. moovio_sdk/models/components/issuedcardauthorizationevent.py +37 -0
  222. moovio_sdk/models/components/issuedcardauthorizationeventresult.py +12 -0
  223. moovio_sdk/models/components/issuedcardeventtype.py +15 -0
  224. moovio_sdk/models/components/issuedcardformfactor.py +10 -0
  225. moovio_sdk/models/components/issuedcardstate.py +19 -0
  226. moovio_sdk/models/components/issuedcardtransaction.py +42 -0
  227. moovio_sdk/models/components/issuingauthorizationstatus.py +14 -0
  228. moovio_sdk/models/components/issuingcontrols.py +25 -0
  229. moovio_sdk/models/components/issuingcontrolserror.py +22 -0
  230. moovio_sdk/models/components/issuingintervallimit.py +10 -0
  231. moovio_sdk/models/components/issuingmerchantdata.py +47 -0
  232. moovio_sdk/models/components/issuingvelocitylimit.py +21 -0
  233. moovio_sdk/models/components/issuingvelocitylimiterror.py +17 -0
  234. moovio_sdk/models/components/jsonwebkey.py +103 -0
  235. moovio_sdk/models/components/linkapplepay.py +54 -0
  236. moovio_sdk/models/components/linkapplepaymentdata.py +51 -0
  237. moovio_sdk/models/components/linkapplepaymentmethod.py +38 -0
  238. moovio_sdk/models/components/linkapplepaytoken.py +63 -0
  239. moovio_sdk/models/components/linkbankaccount.py +26 -0
  240. moovio_sdk/models/components/linkcard.py +54 -0
  241. moovio_sdk/models/components/linkcardwaitfor.py +8 -0
  242. moovio_sdk/models/components/linkedapplepaypaymentmethod.py +30 -0
  243. moovio_sdk/models/components/listfeesfetchrequest.py +19 -0
  244. moovio_sdk/models/components/manualtermsofservice.py +34 -0
  245. moovio_sdk/models/components/manualtermsofserviceupdate.py +41 -0
  246. moovio_sdk/models/components/microdepositstatus.py +8 -0
  247. moovio_sdk/models/components/mode.py +11 -0
  248. moovio_sdk/models/components/moovfeedetails.py +36 -0
  249. moovio_sdk/models/components/moovwalletpaymentmethod.py +31 -0
  250. moovio_sdk/models/components/mxauthorizationcode.py +26 -0
  251. moovio_sdk/models/components/mxpayload.py +46 -0
  252. moovio_sdk/models/components/occurrence.py +44 -0
  253. moovio_sdk/models/components/occurrencesresponse.py +80 -0
  254. moovio_sdk/models/components/occurrencestatus.py +12 -0
  255. moovio_sdk/models/components/onboardinginvite.py +91 -0
  256. moovio_sdk/models/components/onboardinginviterequest.py +57 -0
  257. moovio_sdk/models/components/onboardingpartneraccount.py +31 -0
  258. moovio_sdk/models/components/partnerpricing.py +46 -0
  259. moovio_sdk/models/components/partnerpricingagreement.py +56 -0
  260. moovio_sdk/models/components/patchaccount.py +138 -0
  261. moovio_sdk/models/components/patchaccounterror.py +38 -0
  262. moovio_sdk/models/components/patchbusiness.py +72 -0
  263. moovio_sdk/models/components/patchindividual.py +43 -0
  264. moovio_sdk/models/components/patchprofile.py +29 -0
  265. moovio_sdk/models/components/patchsweepconfig.py +147 -0
  266. moovio_sdk/models/components/patchtransfer.py +51 -0
  267. moovio_sdk/models/components/paymentdetailserror.py +35 -0
  268. moovio_sdk/models/components/paymentlink.py +125 -0
  269. moovio_sdk/models/components/paymentlinkcustomeroptions.py +31 -0
  270. moovio_sdk/models/components/paymentlinkdisplayoptions.py +39 -0
  271. moovio_sdk/models/components/paymentlinkdisplayoptionsupdate.py +42 -0
  272. moovio_sdk/models/components/paymentlinkpaymentdetails.py +40 -0
  273. moovio_sdk/models/components/paymentlinkpaymentdetailsupdate.py +41 -0
  274. moovio_sdk/models/components/paymentlinkpayoutdetails.py +32 -0
  275. moovio_sdk/models/components/paymentlinkpayoutdetailsupdate.py +33 -0
  276. moovio_sdk/models/components/paymentlinkstatus.py +11 -0
  277. moovio_sdk/models/components/paymentmethod.py +82 -0
  278. moovio_sdk/models/components/paymentmethodsbankaccount.py +65 -0
  279. moovio_sdk/models/components/paymentmethodscard.py +121 -0
  280. moovio_sdk/models/components/paymentmethodswallet.py +14 -0
  281. moovio_sdk/models/components/paymentmethodtype.py +19 -0
  282. moovio_sdk/models/components/payoutdetailserror.py +21 -0
  283. moovio_sdk/models/components/payoutrecipient.py +23 -0
  284. moovio_sdk/models/components/payoutrecipienterror.py +14 -0
  285. moovio_sdk/models/components/payoutrecipientupdate.py +24 -0
  286. moovio_sdk/models/components/phonenumber.py +18 -0
  287. moovio_sdk/models/components/phonenumbererror.py +18 -0
  288. moovio_sdk/models/components/plaidintegration.py +39 -0
  289. moovio_sdk/models/components/plaidlinkintegration.py +36 -0
  290. moovio_sdk/models/components/plaidlinkpayload.py +45 -0
  291. moovio_sdk/models/components/plaidpayload.py +42 -0
  292. moovio_sdk/models/components/primaryregulator.py +13 -0
  293. moovio_sdk/models/components/profile.py +27 -0
  294. moovio_sdk/models/components/pullfromcardpaymentmethod.py +33 -0
  295. moovio_sdk/models/components/pushtocardpaymentmethod.py +33 -0
  296. moovio_sdk/models/components/qrcode.py +16 -0
  297. moovio_sdk/models/components/receiptkind.py +10 -0
  298. moovio_sdk/models/components/receiptrequest.py +75 -0
  299. moovio_sdk/models/components/receiptresponse.py +95 -0
  300. moovio_sdk/models/components/recur.py +40 -0
  301. moovio_sdk/models/components/refundcarddetails.py +44 -0
  302. moovio_sdk/models/components/refundcardstatus.py +12 -0
  303. moovio_sdk/models/components/refundstatus.py +11 -0
  304. moovio_sdk/models/components/registerapplepaymerchantdomains.py +22 -0
  305. moovio_sdk/models/components/representative.py +71 -0
  306. moovio_sdk/models/components/representativeresponsibilities.py +42 -0
  307. moovio_sdk/models/components/representativeresponsibilitieserror.py +26 -0
  308. moovio_sdk/models/components/requestcard.py +44 -0
  309. moovio_sdk/models/components/requirementerror.py +24 -0
  310. moovio_sdk/models/components/requirementerrorcode.py +25 -0
  311. moovio_sdk/models/components/requirementid.py +71 -0
  312. moovio_sdk/models/components/returnpolicytype.py +11 -0
  313. moovio_sdk/models/components/reversal.py +23 -0
  314. moovio_sdk/models/components/reversedwithcancellation.py +14 -0
  315. moovio_sdk/models/components/reversedwithrefund.py +16 -0
  316. moovio_sdk/models/components/revoketokenrequest.py +40 -0
  317. moovio_sdk/models/components/rtpcreditpaymentmethod.py +38 -0
  318. moovio_sdk/models/components/rtpfailurecode.py +19 -0
  319. moovio_sdk/models/components/rtprejectioncode.py +25 -0
  320. moovio_sdk/models/components/rtptransactiondetails.py +56 -0
  321. moovio_sdk/models/components/rtptransactionstatus.py +13 -0
  322. moovio_sdk/models/components/runtransfer.py +34 -0
  323. moovio_sdk/models/components/schedulepaymentmethod.py +56 -0
  324. moovio_sdk/models/components/scheduleresponse.py +60 -0
  325. moovio_sdk/models/components/seccode.py +13 -0
  326. moovio_sdk/models/components/security.py +32 -0
  327. moovio_sdk/models/components/sentreceipt.py +27 -0
  328. moovio_sdk/models/components/settings.py +30 -0
  329. moovio_sdk/models/components/sourcedestinationoptions.py +20 -0
  330. moovio_sdk/models/components/sweep.py +80 -0
  331. moovio_sdk/models/components/sweepconfig.py +81 -0
  332. moovio_sdk/models/components/sweepconfigpaymentmethod.py +31 -0
  333. moovio_sdk/models/components/sweepconfigstatus.py +9 -0
  334. moovio_sdk/models/components/sweepstatus.py +13 -0
  335. moovio_sdk/models/components/taxid.py +25 -0
  336. moovio_sdk/models/components/taxidupdate.py +26 -0
  337. moovio_sdk/models/components/terminalapplication.py +55 -0
  338. moovio_sdk/models/components/terminalapplicationplatform.py +12 -0
  339. moovio_sdk/models/components/terminalapplicationstatus.py +13 -0
  340. moovio_sdk/models/components/termsofservice.py +26 -0
  341. moovio_sdk/models/components/termsofserviceerror.py +39 -0
  342. moovio_sdk/models/components/termsofservicetoken.py +17 -0
  343. moovio_sdk/models/components/termsofservicetokenupdate.py +18 -0
  344. moovio_sdk/models/components/tokentype.py +10 -0
  345. moovio_sdk/models/components/transactionsource.py +16 -0
  346. moovio_sdk/models/components/transfer.py +126 -0
  347. moovio_sdk/models/components/transferaccount.py +20 -0
  348. moovio_sdk/models/components/transferdestination.py +83 -0
  349. moovio_sdk/models/components/transferfailurereason.py +14 -0
  350. moovio_sdk/models/components/transferoptions.py +23 -0
  351. moovio_sdk/models/components/transferresponse.py +15 -0
  352. moovio_sdk/models/components/transfersource.py +80 -0
  353. moovio_sdk/models/components/transferstatus.py +16 -0
  354. moovio_sdk/models/components/transferwaitfor.py +8 -0
  355. moovio_sdk/models/components/underwriting.py +56 -0
  356. moovio_sdk/models/components/underwritingstatus.py +16 -0
  357. moovio_sdk/models/components/updateapplepaymerchantdomains.py +26 -0
  358. moovio_sdk/models/components/updatebrand.py +15 -0
  359. moovio_sdk/models/components/updatecard.py +51 -0
  360. moovio_sdk/models/components/updatecardaddress.py +32 -0
  361. moovio_sdk/models/components/updatecardexpiration.py +17 -0
  362. moovio_sdk/models/components/updatecolor.py +14 -0
  363. moovio_sdk/models/components/updatecolors.py +18 -0
  364. moovio_sdk/models/components/updateevidence.py +23 -0
  365. moovio_sdk/models/components/updateissuedcard.py +44 -0
  366. moovio_sdk/models/components/updatepaymentlink.py +98 -0
  367. moovio_sdk/models/components/updaterepresentative.py +224 -0
  368. moovio_sdk/models/components/updateunderwriting.py +43 -0
  369. moovio_sdk/models/components/upsertschedule.py +26 -0
  370. moovio_sdk/models/components/verification.py +54 -0
  371. moovio_sdk/models/components/verificationstatus.py +17 -0
  372. moovio_sdk/models/components/verificationstatusdetail.py +23 -0
  373. moovio_sdk/models/components/volumebycustomertype.py +21 -0
  374. moovio_sdk/models/components/volumebycustomertypeerror.py +22 -0
  375. moovio_sdk/models/components/wallet.py +27 -0
  376. moovio_sdk/models/components/walletavailablebalance.py +30 -0
  377. moovio_sdk/models/components/wallettransaction.py +114 -0
  378. moovio_sdk/models/components/wallettransactionsourcetype.py +13 -0
  379. moovio_sdk/models/components/wallettransactionstatus.py +11 -0
  380. moovio_sdk/models/components/wallettransactiontype.py +32 -0
  381. moovio_sdk/models/errors/__init__.py +155 -0
  382. moovio_sdk/models/errors/addcapabilitieserror.py +23 -0
  383. moovio_sdk/models/errors/apierror.py +22 -0
  384. moovio_sdk/models/errors/assigncountrieserror.py +20 -0
  385. moovio_sdk/models/errors/authtokenrequesterror.py +22 -0
  386. moovio_sdk/models/errors/bankaccountvalidationerror.py +30 -0
  387. moovio_sdk/models/errors/brandvalidationerror.py +23 -0
  388. moovio_sdk/models/errors/cardacquiringrefund.py +44 -0
  389. moovio_sdk/models/errors/createaccount.py +24 -0
  390. moovio_sdk/models/errors/createpaymentlinkerror.py +46 -0
  391. moovio_sdk/models/errors/createsweepconfigerror.py +40 -0
  392. moovio_sdk/models/errors/feeplanagreementerror.py +22 -0
  393. moovio_sdk/models/errors/fileuploadvalidationerror.py +35 -0
  394. moovio_sdk/models/errors/filevalidationerror.py +28 -0
  395. moovio_sdk/models/errors/genericerror.py +19 -0
  396. moovio_sdk/models/errors/linkapplepayerror.py +36 -0
  397. moovio_sdk/models/errors/linkcarderror.py +47 -0
  398. moovio_sdk/models/errors/microdepositvalidationerror.py +20 -0
  399. moovio_sdk/models/errors/onboardinginviteerror.py +34 -0
  400. moovio_sdk/models/errors/patchsweepconfigerror.py +38 -0
  401. moovio_sdk/models/errors/receiptvalidationerror.py +40 -0
  402. moovio_sdk/models/errors/refundvalidationerror.py +23 -0
  403. moovio_sdk/models/errors/representativevalidationerror.py +68 -0
  404. moovio_sdk/models/errors/requestcarderror.py +42 -0
  405. moovio_sdk/models/errors/reversalvalidationerror.py +20 -0
  406. moovio_sdk/models/errors/revoketokenrequesterror.py +22 -0
  407. moovio_sdk/models/errors/schedulevalidationerror.py +24 -0
  408. moovio_sdk/models/errors/terminalapplicationerror.py +30 -0
  409. moovio_sdk/models/errors/transfer.py +108 -0
  410. moovio_sdk/models/errors/transferoptionsvalidationerror.py +24 -0
  411. moovio_sdk/models/errors/transfervalidationerror.py +49 -0
  412. moovio_sdk/models/errors/updateaccount.py +24 -0
  413. moovio_sdk/models/errors/updatecarderror.py +43 -0
  414. moovio_sdk/models/errors/updateissuedcarderror.py +32 -0
  415. moovio_sdk/models/errors/updatepaymentlinkerror.py +36 -0
  416. moovio_sdk/models/errors/updateunderwritingerror.py +70 -0
  417. moovio_sdk/models/internal/__init__.py +6 -0
  418. moovio_sdk/models/internal/globals.py +40 -0
  419. moovio_sdk/models/operations/__init__.py +1824 -0
  420. moovio_sdk/models/operations/acceptdispute.py +71 -0
  421. moovio_sdk/models/operations/assignaccountcountries.py +75 -0
  422. moovio_sdk/models/operations/cancelschedule.py +67 -0
  423. moovio_sdk/models/operations/completebankaccountverification.py +85 -0
  424. moovio_sdk/models/operations/completemicrodeposits.py +87 -0
  425. moovio_sdk/models/operations/createaccesstoken.py +52 -0
  426. moovio_sdk/models/operations/createaccount.py +52 -0
  427. moovio_sdk/models/operations/createapplepaysession.py +81 -0
  428. moovio_sdk/models/operations/createbrand.py +75 -0
  429. moovio_sdk/models/operations/createcancellation.py +75 -0
  430. moovio_sdk/models/operations/createfeeplanagreements.py +80 -0
  431. moovio_sdk/models/operations/createonboardinginvite.py +52 -0
  432. moovio_sdk/models/operations/createpaymentlink.py +78 -0
  433. moovio_sdk/models/operations/createreceipts.py +52 -0
  434. moovio_sdk/models/operations/createrepresentative.py +80 -0
  435. moovio_sdk/models/operations/createreversal.py +98 -0
  436. moovio_sdk/models/operations/createschedule.py +78 -0
  437. moovio_sdk/models/operations/createsweepconfig.py +78 -0
  438. moovio_sdk/models/operations/createterminalapplication.py +54 -0
  439. moovio_sdk/models/operations/createtransfer.py +125 -0
  440. moovio_sdk/models/operations/createtransferoptions.py +52 -0
  441. moovio_sdk/models/operations/deletedisputeevidencefile.py +74 -0
  442. moovio_sdk/models/operations/deleterepresentative.py +71 -0
  443. moovio_sdk/models/operations/deleteterminalapplication.py +60 -0
  444. moovio_sdk/models/operations/disablebankaccount.py +67 -0
  445. moovio_sdk/models/operations/disablecapability.py +76 -0
  446. moovio_sdk/models/operations/disablecard.py +67 -0
  447. moovio_sdk/models/operations/disablepaymentlink.py +67 -0
  448. moovio_sdk/models/operations/disconnectaccount.py +60 -0
  449. moovio_sdk/models/operations/generateendtoendkey.py +60 -0
  450. moovio_sdk/models/operations/getaccount.py +64 -0
  451. moovio_sdk/models/operations/getaccountcountries.py +64 -0
  452. moovio_sdk/models/operations/getadjustment.py +71 -0
  453. moovio_sdk/models/operations/getapplepaymerchantdomains.py +68 -0
  454. moovio_sdk/models/operations/getavatar.py +66 -0
  455. moovio_sdk/models/operations/getbankaccount.py +71 -0
  456. moovio_sdk/models/operations/getbankaccountverification.py +73 -0
  457. moovio_sdk/models/operations/getbrand.py +64 -0
  458. moovio_sdk/models/operations/getcancellation.py +84 -0
  459. moovio_sdk/models/operations/getcapability.py +82 -0
  460. moovio_sdk/models/operations/getcard.py +71 -0
  461. moovio_sdk/models/operations/getdispute.py +71 -0
  462. moovio_sdk/models/operations/getdisputeevidence.py +80 -0
  463. moovio_sdk/models/operations/getdisputeevidencedata.py +90 -0
  464. moovio_sdk/models/operations/getenrichmentaddress.py +178 -0
  465. moovio_sdk/models/operations/getenrichmentprofile.py +64 -0
  466. moovio_sdk/models/operations/getfiledetails.py +71 -0
  467. moovio_sdk/models/operations/getfullissuedcard.py +73 -0
  468. moovio_sdk/models/operations/getissuedcard.py +73 -0
  469. moovio_sdk/models/operations/getissuedcardauthorization.py +75 -0
  470. moovio_sdk/models/operations/getissuedcardtransaction.py +75 -0
  471. moovio_sdk/models/operations/getmerchantprocessingagreement.py +64 -0
  472. moovio_sdk/models/operations/getonboardinginvite.py +62 -0
  473. moovio_sdk/models/operations/getpaymentlink.py +71 -0
  474. moovio_sdk/models/operations/getpaymentlinkqrcode.py +84 -0
  475. moovio_sdk/models/operations/getpaymentmethod.py +71 -0
  476. moovio_sdk/models/operations/getrefund.py +84 -0
  477. moovio_sdk/models/operations/getrepresentative.py +75 -0
  478. moovio_sdk/models/operations/getscheduledoccurrence.py +92 -0
  479. moovio_sdk/models/operations/getschedules.py +71 -0
  480. moovio_sdk/models/operations/getsweep.py +78 -0
  481. moovio_sdk/models/operations/getsweepconfig.py +71 -0
  482. moovio_sdk/models/operations/getterminalapplication.py +66 -0
  483. moovio_sdk/models/operations/gettermsofservicetoken.py +75 -0
  484. moovio_sdk/models/operations/gettransfer.py +73 -0
  485. moovio_sdk/models/operations/getunderwriting.py +64 -0
  486. moovio_sdk/models/operations/getwallet.py +71 -0
  487. moovio_sdk/models/operations/getwallettransaction.py +80 -0
  488. moovio_sdk/models/operations/initiatebankaccountverification.py +89 -0
  489. moovio_sdk/models/operations/initiatemicrodeposits.py +67 -0
  490. moovio_sdk/models/operations/initiaterefund.py +131 -0
  491. moovio_sdk/models/operations/linkapplepaytoken.py +80 -0
  492. moovio_sdk/models/operations/linkbankaccount.py +96 -0
  493. moovio_sdk/models/operations/linkcard.py +96 -0
  494. moovio_sdk/models/operations/listaccounts.py +171 -0
  495. moovio_sdk/models/operations/listadjustments.py +78 -0
  496. moovio_sdk/models/operations/listbankaccounts.py +64 -0
  497. moovio_sdk/models/operations/listcapabilities.py +64 -0
  498. moovio_sdk/models/operations/listcards.py +64 -0
  499. moovio_sdk/models/operations/listdisputeevidence.py +73 -0
  500. moovio_sdk/models/operations/listdisputes.py +172 -0
  501. moovio_sdk/models/operations/listfeeplanagreements.py +101 -0
  502. moovio_sdk/models/operations/listfeeplans.py +78 -0
  503. moovio_sdk/models/operations/listfeesfetch.py +80 -0
  504. moovio_sdk/models/operations/listfiles.py +64 -0
  505. moovio_sdk/models/operations/listindustries.py +62 -0
  506. moovio_sdk/models/operations/listinstitutions.py +92 -0
  507. moovio_sdk/models/operations/listissuedcardauthorizationevents.py +94 -0
  508. moovio_sdk/models/operations/listissuedcardauthorizations.py +126 -0
  509. moovio_sdk/models/operations/listissuedcards.py +94 -0
  510. moovio_sdk/models/operations/listissuedcardtransactions.py +113 -0
  511. moovio_sdk/models/operations/listonboardinginvites.py +60 -0
  512. moovio_sdk/models/operations/listpartnerpricing.py +78 -0
  513. moovio_sdk/models/operations/listpartnerpricingagreements.py +101 -0
  514. moovio_sdk/models/operations/listpaymentlinks.py +64 -0
  515. moovio_sdk/models/operations/listpaymentmethods.py +98 -0
  516. moovio_sdk/models/operations/listreceipts.py +65 -0
  517. moovio_sdk/models/operations/listrefunds.py +75 -0
  518. moovio_sdk/models/operations/listrepresentatives.py +66 -0
  519. moovio_sdk/models/operations/listschedules.py +81 -0
  520. moovio_sdk/models/operations/listsweepconfigs.py +64 -0
  521. moovio_sdk/models/operations/listsweeps.py +108 -0
  522. moovio_sdk/models/operations/listterminalapplications.py +62 -0
  523. moovio_sdk/models/operations/listtransfers.py +145 -0
  524. moovio_sdk/models/operations/listwallets.py +64 -0
  525. moovio_sdk/models/operations/listwallettransactions.py +189 -0
  526. moovio_sdk/models/operations/ping.py +56 -0
  527. moovio_sdk/models/operations/registerapplepaymerchantdomains.py +80 -0
  528. moovio_sdk/models/operations/requestcapabilities.py +78 -0
  529. moovio_sdk/models/operations/requestcard.py +80 -0
  530. moovio_sdk/models/operations/retrievefees.py +117 -0
  531. moovio_sdk/models/operations/revokeaccesstoken.py +48 -0
  532. moovio_sdk/models/operations/revokeonboardinginvite.py +58 -0
  533. moovio_sdk/models/operations/submitdisputeevidence.py +71 -0
  534. moovio_sdk/models/operations/testendtoendtoken.py +56 -0
  535. moovio_sdk/models/operations/updateaccount.py +78 -0
  536. moovio_sdk/models/operations/updateapplepaymerchantdomains.py +78 -0
  537. moovio_sdk/models/operations/updatebrand.py +78 -0
  538. moovio_sdk/models/operations/updatecard.py +85 -0
  539. moovio_sdk/models/operations/updatedisputeevidence.py +92 -0
  540. moovio_sdk/models/operations/updateissuedcard.py +81 -0
  541. moovio_sdk/models/operations/updatepaymentlink.py +85 -0
  542. moovio_sdk/models/operations/updaterepresentative.py +89 -0
  543. moovio_sdk/models/operations/updateschedule.py +85 -0
  544. moovio_sdk/models/operations/updatesweepconfig.py +85 -0
  545. moovio_sdk/models/operations/updatetransfer.py +87 -0
  546. moovio_sdk/models/operations/uploaddisputeevidencefile.py +87 -0
  547. moovio_sdk/models/operations/uploaddisputeevidencetext.py +85 -0
  548. moovio_sdk/models/operations/uploadfile.py +80 -0
  549. moovio_sdk/models/operations/upsertbrand.py +75 -0
  550. moovio_sdk/models/operations/upsertunderwriting.py +78 -0
  551. moovio_sdk/onboarding.py +965 -0
  552. moovio_sdk/payment_links.py +1694 -0
  553. moovio_sdk/payment_methods.py +475 -0
  554. moovio_sdk/ping.py +233 -0
  555. moovio_sdk/py.typed +1 -0
  556. moovio_sdk/receipts.py +507 -0
  557. moovio_sdk/representatives.py +1513 -0
  558. moovio_sdk/scheduling.py +1565 -0
  559. moovio_sdk/sdk.py +242 -0
  560. moovio_sdk/sdkconfiguration.py +59 -0
  561. moovio_sdk/sweeps.py +1617 -0
  562. moovio_sdk/terminal_applications.py +1013 -0
  563. moovio_sdk/transfers.py +3040 -0
  564. moovio_sdk/types/__init__.py +21 -0
  565. moovio_sdk/types/basemodel.py +39 -0
  566. moovio_sdk/underwriting.py +581 -0
  567. moovio_sdk/utils/__init__.py +101 -0
  568. moovio_sdk/utils/annotations.py +55 -0
  569. moovio_sdk/utils/enums.py +34 -0
  570. moovio_sdk/utils/eventstreaming.py +238 -0
  571. moovio_sdk/utils/forms.py +202 -0
  572. moovio_sdk/utils/headers.py +136 -0
  573. moovio_sdk/utils/logger.py +27 -0
  574. moovio_sdk/utils/metadata.py +118 -0
  575. moovio_sdk/utils/queryparams.py +205 -0
  576. moovio_sdk/utils/requestbodies.py +66 -0
  577. moovio_sdk/utils/retries.py +217 -0
  578. moovio_sdk/utils/security.py +195 -0
  579. moovio_sdk/utils/serializers.py +215 -0
  580. moovio_sdk/utils/url.py +155 -0
  581. moovio_sdk/utils/values.py +137 -0
  582. moovio_sdk/wallet_transactions.py +558 -0
  583. moovio_sdk/wallets.py +465 -0
  584. moovio_sdk-0.3.8.dist-info/METADATA +1920 -0
  585. moovio_sdk-0.3.8.dist-info/RECORD +586 -0
  586. moovio_sdk-0.3.8.dist-info/WHEEL +4 -0
@@ -0,0 +1,3040 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from .basesdk import BaseSDK
4
+ from datetime import datetime
5
+ from moovio_sdk import utils
6
+ from moovio_sdk._hooks import HookContext
7
+ from moovio_sdk.models import components, errors, operations
8
+ from moovio_sdk.types import OptionalNullable, UNSET
9
+ from moovio_sdk.utils import get_security_from_env
10
+ from typing import Any, Dict, List, Mapping, Optional, Union
11
+
12
+
13
+ class Transfers(BaseSDK):
14
+ def create(
15
+ self,
16
+ *,
17
+ x_idempotency_key: str,
18
+ account_id: str,
19
+ source: Union[
20
+ components.CreateTransferSource, components.CreateTransferSourceTypedDict
21
+ ],
22
+ destination: Union[
23
+ components.CreateTransferDestination,
24
+ components.CreateTransferDestinationTypedDict,
25
+ ],
26
+ amount: Union[components.Amount, components.AmountTypedDict],
27
+ x_wait_for: Optional[components.TransferWaitFor] = None,
28
+ facilitator_fee: Optional[
29
+ Union[components.FacilitatorFee, components.FacilitatorFeeTypedDict]
30
+ ] = None,
31
+ description: Optional[str] = None,
32
+ metadata: Optional[Dict[str, str]] = None,
33
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
34
+ server_url: Optional[str] = None,
35
+ timeout_ms: Optional[int] = None,
36
+ http_headers: Optional[Mapping[str, str]] = None,
37
+ ) -> operations.CreateTransferResponse:
38
+ r"""Move money by providing the source, destination, and amount in the request body.
39
+
40
+ Read our [transfers overview guide](https://docs.moov.io/guides/money-movement/overview/) to learn more.
41
+
42
+ To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
43
+ you'll need to specify the `/accounts/{accountID}/transfers.write` scope.
44
+
45
+ :param x_idempotency_key: Prevents duplicate transfers from being created.
46
+ :param account_id: The merchant's Moov account ID.
47
+ :param source: Where funds for a transfer originate. For the source, you must include either a `paymentMethodID` or a `transferID`.
48
+ :param destination: The final stage of a transfer and the ultimate recipient of the funds.
49
+ :param amount:
50
+ :param x_wait_for: Optional header that indicates whether to return a synchronous response that includes full transfer and rail-specific details or an asynchronous response indicating the transfer was created (this is the default response if the header is omitted).
51
+ :param facilitator_fee: Total or markup fee.
52
+ :param description: An optional description of the transfer for your own internal use.
53
+ :param metadata: Free-form key-value pair list. Useful for storing information that is not captured elsewhere.
54
+ :param retries: Override the default retry configuration for this method
55
+ :param server_url: Override the default server URL for this method
56
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
57
+ :param http_headers: Additional headers to set or replace on requests.
58
+ """
59
+ base_url = None
60
+ url_variables = None
61
+ if timeout_ms is None:
62
+ timeout_ms = self.sdk_configuration.timeout_ms
63
+
64
+ if server_url is not None:
65
+ base_url = server_url
66
+ else:
67
+ base_url = self._get_url(base_url, url_variables)
68
+
69
+ request = operations.CreateTransferRequest(
70
+ x_idempotency_key=x_idempotency_key,
71
+ x_wait_for=x_wait_for,
72
+ account_id=account_id,
73
+ create_transfer=components.CreateTransfer(
74
+ source=utils.get_pydantic_model(
75
+ source, components.CreateTransferSource
76
+ ),
77
+ destination=utils.get_pydantic_model(
78
+ destination, components.CreateTransferDestination
79
+ ),
80
+ amount=utils.get_pydantic_model(amount, components.Amount),
81
+ facilitator_fee=utils.get_pydantic_model(
82
+ facilitator_fee, Optional[components.FacilitatorFee]
83
+ ),
84
+ description=description,
85
+ metadata=metadata,
86
+ ),
87
+ )
88
+
89
+ req = self._build_request(
90
+ method="POST",
91
+ path="/accounts/{accountID}/transfers",
92
+ base_url=base_url,
93
+ url_variables=url_variables,
94
+ request=request,
95
+ request_body_required=True,
96
+ request_has_path_params=True,
97
+ request_has_query_params=True,
98
+ user_agent_header="user-agent",
99
+ accept_header_value="application/json",
100
+ http_headers=http_headers,
101
+ _globals=operations.CreateTransferGlobals(
102
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
103
+ ),
104
+ security=self.sdk_configuration.security,
105
+ get_serialized_body=lambda: utils.serialize_request_body(
106
+ request.create_transfer, False, False, "json", components.CreateTransfer
107
+ ),
108
+ timeout_ms=timeout_ms,
109
+ )
110
+
111
+ if retries == UNSET:
112
+ if self.sdk_configuration.retry_config is not UNSET:
113
+ retries = self.sdk_configuration.retry_config
114
+
115
+ retry_config = None
116
+ if isinstance(retries, utils.RetryConfig):
117
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
118
+
119
+ http_res = self.do_request(
120
+ hook_ctx=HookContext(
121
+ base_url=base_url or "",
122
+ operation_id="createTransfer",
123
+ oauth2_scopes=[],
124
+ security_source=get_security_from_env(
125
+ self.sdk_configuration.security, components.Security
126
+ ),
127
+ ),
128
+ request=req,
129
+ error_status_codes=[
130
+ "400",
131
+ "404",
132
+ "409",
133
+ "422",
134
+ "429",
135
+ "4XX",
136
+ "500",
137
+ "504",
138
+ "5XX",
139
+ ],
140
+ retry_config=retry_config,
141
+ )
142
+
143
+ response_data: Any = None
144
+ if utils.match_response(http_res, "200", "application/json"):
145
+ return operations.CreateTransferResponse(
146
+ result=utils.unmarshal_json(http_res.text, components.TransferResponse),
147
+ headers=utils.get_response_headers(http_res.headers),
148
+ )
149
+ if utils.match_response(http_res, "201", "application/json"):
150
+ return operations.CreateTransferResponse(
151
+ result=utils.unmarshal_json(http_res.text, components.AsyncTransfer),
152
+ headers=utils.get_response_headers(http_res.headers),
153
+ )
154
+ if utils.match_response(http_res, "202", "application/json"):
155
+ return operations.CreateTransferResponse(
156
+ result=utils.unmarshal_json(http_res.text, components.Transfer),
157
+ headers=utils.get_response_headers(http_res.headers),
158
+ )
159
+ if utils.match_response(http_res, "400", "application/json"):
160
+ response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
161
+ raise errors.GenericError(data=response_data)
162
+ if utils.match_response(http_res, "409", "application/json"):
163
+ response_data = utils.unmarshal_json(http_res.text, errors.TransferData)
164
+ raise errors.Transfer(data=response_data)
165
+ if utils.match_response(http_res, "422", "application/json"):
166
+ response_data = utils.unmarshal_json(
167
+ http_res.text, errors.TransferValidationErrorData
168
+ )
169
+ raise errors.TransferValidationError(data=response_data)
170
+ if utils.match_response(http_res, ["404", "429"], "*"):
171
+ http_res_text = utils.stream_to_text(http_res)
172
+ raise errors.APIError(
173
+ "API error occurred", http_res.status_code, http_res_text, http_res
174
+ )
175
+ if utils.match_response(http_res, ["500", "504"], "*"):
176
+ http_res_text = utils.stream_to_text(http_res)
177
+ raise errors.APIError(
178
+ "API error occurred", http_res.status_code, http_res_text, http_res
179
+ )
180
+ if utils.match_response(http_res, "4XX", "*"):
181
+ http_res_text = utils.stream_to_text(http_res)
182
+ raise errors.APIError(
183
+ "API error occurred", http_res.status_code, http_res_text, http_res
184
+ )
185
+ if utils.match_response(http_res, "5XX", "*"):
186
+ http_res_text = utils.stream_to_text(http_res)
187
+ raise errors.APIError(
188
+ "API error occurred", http_res.status_code, http_res_text, http_res
189
+ )
190
+
191
+ content_type = http_res.headers.get("Content-Type")
192
+ http_res_text = utils.stream_to_text(http_res)
193
+ raise errors.APIError(
194
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
195
+ http_res.status_code,
196
+ http_res_text,
197
+ http_res,
198
+ )
199
+
200
+ async def create_async(
201
+ self,
202
+ *,
203
+ x_idempotency_key: str,
204
+ account_id: str,
205
+ source: Union[
206
+ components.CreateTransferSource, components.CreateTransferSourceTypedDict
207
+ ],
208
+ destination: Union[
209
+ components.CreateTransferDestination,
210
+ components.CreateTransferDestinationTypedDict,
211
+ ],
212
+ amount: Union[components.Amount, components.AmountTypedDict],
213
+ x_wait_for: Optional[components.TransferWaitFor] = None,
214
+ facilitator_fee: Optional[
215
+ Union[components.FacilitatorFee, components.FacilitatorFeeTypedDict]
216
+ ] = None,
217
+ description: Optional[str] = None,
218
+ metadata: Optional[Dict[str, str]] = None,
219
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
220
+ server_url: Optional[str] = None,
221
+ timeout_ms: Optional[int] = None,
222
+ http_headers: Optional[Mapping[str, str]] = None,
223
+ ) -> operations.CreateTransferResponse:
224
+ r"""Move money by providing the source, destination, and amount in the request body.
225
+
226
+ Read our [transfers overview guide](https://docs.moov.io/guides/money-movement/overview/) to learn more.
227
+
228
+ To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
229
+ you'll need to specify the `/accounts/{accountID}/transfers.write` scope.
230
+
231
+ :param x_idempotency_key: Prevents duplicate transfers from being created.
232
+ :param account_id: The merchant's Moov account ID.
233
+ :param source: Where funds for a transfer originate. For the source, you must include either a `paymentMethodID` or a `transferID`.
234
+ :param destination: The final stage of a transfer and the ultimate recipient of the funds.
235
+ :param amount:
236
+ :param x_wait_for: Optional header that indicates whether to return a synchronous response that includes full transfer and rail-specific details or an asynchronous response indicating the transfer was created (this is the default response if the header is omitted).
237
+ :param facilitator_fee: Total or markup fee.
238
+ :param description: An optional description of the transfer for your own internal use.
239
+ :param metadata: Free-form key-value pair list. Useful for storing information that is not captured elsewhere.
240
+ :param retries: Override the default retry configuration for this method
241
+ :param server_url: Override the default server URL for this method
242
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
243
+ :param http_headers: Additional headers to set or replace on requests.
244
+ """
245
+ base_url = None
246
+ url_variables = None
247
+ if timeout_ms is None:
248
+ timeout_ms = self.sdk_configuration.timeout_ms
249
+
250
+ if server_url is not None:
251
+ base_url = server_url
252
+ else:
253
+ base_url = self._get_url(base_url, url_variables)
254
+
255
+ request = operations.CreateTransferRequest(
256
+ x_idempotency_key=x_idempotency_key,
257
+ x_wait_for=x_wait_for,
258
+ account_id=account_id,
259
+ create_transfer=components.CreateTransfer(
260
+ source=utils.get_pydantic_model(
261
+ source, components.CreateTransferSource
262
+ ),
263
+ destination=utils.get_pydantic_model(
264
+ destination, components.CreateTransferDestination
265
+ ),
266
+ amount=utils.get_pydantic_model(amount, components.Amount),
267
+ facilitator_fee=utils.get_pydantic_model(
268
+ facilitator_fee, Optional[components.FacilitatorFee]
269
+ ),
270
+ description=description,
271
+ metadata=metadata,
272
+ ),
273
+ )
274
+
275
+ req = self._build_request_async(
276
+ method="POST",
277
+ path="/accounts/{accountID}/transfers",
278
+ base_url=base_url,
279
+ url_variables=url_variables,
280
+ request=request,
281
+ request_body_required=True,
282
+ request_has_path_params=True,
283
+ request_has_query_params=True,
284
+ user_agent_header="user-agent",
285
+ accept_header_value="application/json",
286
+ http_headers=http_headers,
287
+ _globals=operations.CreateTransferGlobals(
288
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
289
+ ),
290
+ security=self.sdk_configuration.security,
291
+ get_serialized_body=lambda: utils.serialize_request_body(
292
+ request.create_transfer, False, False, "json", components.CreateTransfer
293
+ ),
294
+ timeout_ms=timeout_ms,
295
+ )
296
+
297
+ if retries == UNSET:
298
+ if self.sdk_configuration.retry_config is not UNSET:
299
+ retries = self.sdk_configuration.retry_config
300
+
301
+ retry_config = None
302
+ if isinstance(retries, utils.RetryConfig):
303
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
304
+
305
+ http_res = await self.do_request_async(
306
+ hook_ctx=HookContext(
307
+ base_url=base_url or "",
308
+ operation_id="createTransfer",
309
+ oauth2_scopes=[],
310
+ security_source=get_security_from_env(
311
+ self.sdk_configuration.security, components.Security
312
+ ),
313
+ ),
314
+ request=req,
315
+ error_status_codes=[
316
+ "400",
317
+ "404",
318
+ "409",
319
+ "422",
320
+ "429",
321
+ "4XX",
322
+ "500",
323
+ "504",
324
+ "5XX",
325
+ ],
326
+ retry_config=retry_config,
327
+ )
328
+
329
+ response_data: Any = None
330
+ if utils.match_response(http_res, "200", "application/json"):
331
+ return operations.CreateTransferResponse(
332
+ result=utils.unmarshal_json(http_res.text, components.TransferResponse),
333
+ headers=utils.get_response_headers(http_res.headers),
334
+ )
335
+ if utils.match_response(http_res, "201", "application/json"):
336
+ return operations.CreateTransferResponse(
337
+ result=utils.unmarshal_json(http_res.text, components.AsyncTransfer),
338
+ headers=utils.get_response_headers(http_res.headers),
339
+ )
340
+ if utils.match_response(http_res, "202", "application/json"):
341
+ return operations.CreateTransferResponse(
342
+ result=utils.unmarshal_json(http_res.text, components.Transfer),
343
+ headers=utils.get_response_headers(http_res.headers),
344
+ )
345
+ if utils.match_response(http_res, "400", "application/json"):
346
+ response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
347
+ raise errors.GenericError(data=response_data)
348
+ if utils.match_response(http_res, "409", "application/json"):
349
+ response_data = utils.unmarshal_json(http_res.text, errors.TransferData)
350
+ raise errors.Transfer(data=response_data)
351
+ if utils.match_response(http_res, "422", "application/json"):
352
+ response_data = utils.unmarshal_json(
353
+ http_res.text, errors.TransferValidationErrorData
354
+ )
355
+ raise errors.TransferValidationError(data=response_data)
356
+ if utils.match_response(http_res, ["404", "429"], "*"):
357
+ http_res_text = await utils.stream_to_text_async(http_res)
358
+ raise errors.APIError(
359
+ "API error occurred", http_res.status_code, http_res_text, http_res
360
+ )
361
+ if utils.match_response(http_res, ["500", "504"], "*"):
362
+ http_res_text = await utils.stream_to_text_async(http_res)
363
+ raise errors.APIError(
364
+ "API error occurred", http_res.status_code, http_res_text, http_res
365
+ )
366
+ if utils.match_response(http_res, "4XX", "*"):
367
+ http_res_text = await utils.stream_to_text_async(http_res)
368
+ raise errors.APIError(
369
+ "API error occurred", http_res.status_code, http_res_text, http_res
370
+ )
371
+ if utils.match_response(http_res, "5XX", "*"):
372
+ http_res_text = await utils.stream_to_text_async(http_res)
373
+ raise errors.APIError(
374
+ "API error occurred", http_res.status_code, http_res_text, http_res
375
+ )
376
+
377
+ content_type = http_res.headers.get("Content-Type")
378
+ http_res_text = await utils.stream_to_text_async(http_res)
379
+ raise errors.APIError(
380
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
381
+ http_res.status_code,
382
+ http_res_text,
383
+ http_res,
384
+ )
385
+
386
+ def list(
387
+ self,
388
+ *,
389
+ account_id: str,
390
+ account_i_ds: Optional[List[str]] = None,
391
+ status: Optional[components.TransferStatus] = None,
392
+ start_date_time: Optional[datetime] = None,
393
+ end_date_time: Optional[datetime] = None,
394
+ group_id: Optional[str] = None,
395
+ refunded: Optional[bool] = None,
396
+ disputed: Optional[bool] = None,
397
+ skip: Optional[int] = None,
398
+ count: Optional[int] = None,
399
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
400
+ server_url: Optional[str] = None,
401
+ timeout_ms: Optional[int] = None,
402
+ http_headers: Optional[Mapping[str, str]] = None,
403
+ ) -> operations.ListTransfersResponse:
404
+ r"""List all the transfers associated with a particular Moov account.
405
+
406
+ Read our [transfers overview guide](https://docs.moov.io/guides/money-movement/overview/) to learn more.
407
+
408
+ When you run this request, you retrieve 200 transfers at a time. You can advance past a results set of 200 transfers by using the `skip` parameter (for example,
409
+ if you set `skip`= 10, you will see a results set of 200 transfers after the first 10). If you are searching a high volume of transfers, the request will likely
410
+ process very slowly. To achieve faster performance, restrict the data as much as you can by using the `StartDateTime` and `EndDateTime` parameters for a limited
411
+ period of time. You can run multiple requests in smaller time window increments until you've retrieved all the transfers you need.
412
+
413
+ To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
414
+ you'll need to specify the `/accounts/{accountID}/transfers.read` scope.
415
+
416
+ :param account_id:
417
+ :param account_i_ds: Optional, comma-separated account IDs by which the response is filtered based on whether the account ID is the source or destination.
418
+ :param status: Optional parameter for filtering transfers by status.
419
+ :param start_date_time: Optional date-time which inclusively filters all transfers created after this date-time.
420
+ :param end_date_time: Optional date-time which exclusively filters all transfers created before this date-time.
421
+ :param group_id: Optional ID to filter for transfers in the same group.
422
+ :param refunded: Optional parameter to only return refunded transfers.
423
+ :param disputed: Optional parameter to only return disputed transfers.
424
+ :param skip:
425
+ :param count:
426
+ :param retries: Override the default retry configuration for this method
427
+ :param server_url: Override the default server URL for this method
428
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
429
+ :param http_headers: Additional headers to set or replace on requests.
430
+ """
431
+ base_url = None
432
+ url_variables = None
433
+ if timeout_ms is None:
434
+ timeout_ms = self.sdk_configuration.timeout_ms
435
+
436
+ if server_url is not None:
437
+ base_url = server_url
438
+ else:
439
+ base_url = self._get_url(base_url, url_variables)
440
+
441
+ request = operations.ListTransfersRequest(
442
+ account_i_ds=account_i_ds,
443
+ status=status,
444
+ start_date_time=start_date_time,
445
+ end_date_time=end_date_time,
446
+ group_id=group_id,
447
+ refunded=refunded,
448
+ disputed=disputed,
449
+ skip=skip,
450
+ count=count,
451
+ account_id=account_id,
452
+ )
453
+
454
+ req = self._build_request(
455
+ method="GET",
456
+ path="/accounts/{accountID}/transfers",
457
+ base_url=base_url,
458
+ url_variables=url_variables,
459
+ request=request,
460
+ request_body_required=False,
461
+ request_has_path_params=True,
462
+ request_has_query_params=True,
463
+ user_agent_header="user-agent",
464
+ accept_header_value="application/json",
465
+ http_headers=http_headers,
466
+ _globals=operations.ListTransfersGlobals(
467
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
468
+ ),
469
+ security=self.sdk_configuration.security,
470
+ timeout_ms=timeout_ms,
471
+ )
472
+
473
+ if retries == UNSET:
474
+ if self.sdk_configuration.retry_config is not UNSET:
475
+ retries = self.sdk_configuration.retry_config
476
+
477
+ retry_config = None
478
+ if isinstance(retries, utils.RetryConfig):
479
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
480
+
481
+ http_res = self.do_request(
482
+ hook_ctx=HookContext(
483
+ base_url=base_url or "",
484
+ operation_id="listTransfers",
485
+ oauth2_scopes=[],
486
+ security_source=get_security_from_env(
487
+ self.sdk_configuration.security, components.Security
488
+ ),
489
+ ),
490
+ request=req,
491
+ error_status_codes=["401", "403", "429", "4XX", "500", "504", "5XX"],
492
+ retry_config=retry_config,
493
+ )
494
+
495
+ if utils.match_response(http_res, "200", "application/json"):
496
+ return operations.ListTransfersResponse(
497
+ result=utils.unmarshal_json(http_res.text, List[components.Transfer]),
498
+ headers=utils.get_response_headers(http_res.headers),
499
+ )
500
+ if utils.match_response(http_res, ["401", "403", "429"], "*"):
501
+ http_res_text = utils.stream_to_text(http_res)
502
+ raise errors.APIError(
503
+ "API error occurred", http_res.status_code, http_res_text, http_res
504
+ )
505
+ if utils.match_response(http_res, ["500", "504"], "*"):
506
+ http_res_text = utils.stream_to_text(http_res)
507
+ raise errors.APIError(
508
+ "API error occurred", http_res.status_code, http_res_text, http_res
509
+ )
510
+ if utils.match_response(http_res, "4XX", "*"):
511
+ http_res_text = utils.stream_to_text(http_res)
512
+ raise errors.APIError(
513
+ "API error occurred", http_res.status_code, http_res_text, http_res
514
+ )
515
+ if utils.match_response(http_res, "5XX", "*"):
516
+ http_res_text = utils.stream_to_text(http_res)
517
+ raise errors.APIError(
518
+ "API error occurred", http_res.status_code, http_res_text, http_res
519
+ )
520
+
521
+ content_type = http_res.headers.get("Content-Type")
522
+ http_res_text = utils.stream_to_text(http_res)
523
+ raise errors.APIError(
524
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
525
+ http_res.status_code,
526
+ http_res_text,
527
+ http_res,
528
+ )
529
+
530
+ async def list_async(
531
+ self,
532
+ *,
533
+ account_id: str,
534
+ account_i_ds: Optional[List[str]] = None,
535
+ status: Optional[components.TransferStatus] = None,
536
+ start_date_time: Optional[datetime] = None,
537
+ end_date_time: Optional[datetime] = None,
538
+ group_id: Optional[str] = None,
539
+ refunded: Optional[bool] = None,
540
+ disputed: Optional[bool] = None,
541
+ skip: Optional[int] = None,
542
+ count: Optional[int] = None,
543
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
544
+ server_url: Optional[str] = None,
545
+ timeout_ms: Optional[int] = None,
546
+ http_headers: Optional[Mapping[str, str]] = None,
547
+ ) -> operations.ListTransfersResponse:
548
+ r"""List all the transfers associated with a particular Moov account.
549
+
550
+ Read our [transfers overview guide](https://docs.moov.io/guides/money-movement/overview/) to learn more.
551
+
552
+ When you run this request, you retrieve 200 transfers at a time. You can advance past a results set of 200 transfers by using the `skip` parameter (for example,
553
+ if you set `skip`= 10, you will see a results set of 200 transfers after the first 10). If you are searching a high volume of transfers, the request will likely
554
+ process very slowly. To achieve faster performance, restrict the data as much as you can by using the `StartDateTime` and `EndDateTime` parameters for a limited
555
+ period of time. You can run multiple requests in smaller time window increments until you've retrieved all the transfers you need.
556
+
557
+ To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
558
+ you'll need to specify the `/accounts/{accountID}/transfers.read` scope.
559
+
560
+ :param account_id:
561
+ :param account_i_ds: Optional, comma-separated account IDs by which the response is filtered based on whether the account ID is the source or destination.
562
+ :param status: Optional parameter for filtering transfers by status.
563
+ :param start_date_time: Optional date-time which inclusively filters all transfers created after this date-time.
564
+ :param end_date_time: Optional date-time which exclusively filters all transfers created before this date-time.
565
+ :param group_id: Optional ID to filter for transfers in the same group.
566
+ :param refunded: Optional parameter to only return refunded transfers.
567
+ :param disputed: Optional parameter to only return disputed transfers.
568
+ :param skip:
569
+ :param count:
570
+ :param retries: Override the default retry configuration for this method
571
+ :param server_url: Override the default server URL for this method
572
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
573
+ :param http_headers: Additional headers to set or replace on requests.
574
+ """
575
+ base_url = None
576
+ url_variables = None
577
+ if timeout_ms is None:
578
+ timeout_ms = self.sdk_configuration.timeout_ms
579
+
580
+ if server_url is not None:
581
+ base_url = server_url
582
+ else:
583
+ base_url = self._get_url(base_url, url_variables)
584
+
585
+ request = operations.ListTransfersRequest(
586
+ account_i_ds=account_i_ds,
587
+ status=status,
588
+ start_date_time=start_date_time,
589
+ end_date_time=end_date_time,
590
+ group_id=group_id,
591
+ refunded=refunded,
592
+ disputed=disputed,
593
+ skip=skip,
594
+ count=count,
595
+ account_id=account_id,
596
+ )
597
+
598
+ req = self._build_request_async(
599
+ method="GET",
600
+ path="/accounts/{accountID}/transfers",
601
+ base_url=base_url,
602
+ url_variables=url_variables,
603
+ request=request,
604
+ request_body_required=False,
605
+ request_has_path_params=True,
606
+ request_has_query_params=True,
607
+ user_agent_header="user-agent",
608
+ accept_header_value="application/json",
609
+ http_headers=http_headers,
610
+ _globals=operations.ListTransfersGlobals(
611
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
612
+ ),
613
+ security=self.sdk_configuration.security,
614
+ timeout_ms=timeout_ms,
615
+ )
616
+
617
+ if retries == UNSET:
618
+ if self.sdk_configuration.retry_config is not UNSET:
619
+ retries = self.sdk_configuration.retry_config
620
+
621
+ retry_config = None
622
+ if isinstance(retries, utils.RetryConfig):
623
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
624
+
625
+ http_res = await self.do_request_async(
626
+ hook_ctx=HookContext(
627
+ base_url=base_url or "",
628
+ operation_id="listTransfers",
629
+ oauth2_scopes=[],
630
+ security_source=get_security_from_env(
631
+ self.sdk_configuration.security, components.Security
632
+ ),
633
+ ),
634
+ request=req,
635
+ error_status_codes=["401", "403", "429", "4XX", "500", "504", "5XX"],
636
+ retry_config=retry_config,
637
+ )
638
+
639
+ if utils.match_response(http_res, "200", "application/json"):
640
+ return operations.ListTransfersResponse(
641
+ result=utils.unmarshal_json(http_res.text, List[components.Transfer]),
642
+ headers=utils.get_response_headers(http_res.headers),
643
+ )
644
+ if utils.match_response(http_res, ["401", "403", "429"], "*"):
645
+ http_res_text = await utils.stream_to_text_async(http_res)
646
+ raise errors.APIError(
647
+ "API error occurred", http_res.status_code, http_res_text, http_res
648
+ )
649
+ if utils.match_response(http_res, ["500", "504"], "*"):
650
+ http_res_text = await utils.stream_to_text_async(http_res)
651
+ raise errors.APIError(
652
+ "API error occurred", http_res.status_code, http_res_text, http_res
653
+ )
654
+ if utils.match_response(http_res, "4XX", "*"):
655
+ http_res_text = await utils.stream_to_text_async(http_res)
656
+ raise errors.APIError(
657
+ "API error occurred", http_res.status_code, http_res_text, http_res
658
+ )
659
+ if utils.match_response(http_res, "5XX", "*"):
660
+ http_res_text = await utils.stream_to_text_async(http_res)
661
+ raise errors.APIError(
662
+ "API error occurred", http_res.status_code, http_res_text, http_res
663
+ )
664
+
665
+ content_type = http_res.headers.get("Content-Type")
666
+ http_res_text = await utils.stream_to_text_async(http_res)
667
+ raise errors.APIError(
668
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
669
+ http_res.status_code,
670
+ http_res_text,
671
+ http_res,
672
+ )
673
+
674
+ def get(
675
+ self,
676
+ *,
677
+ transfer_id: str,
678
+ account_id: str,
679
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
680
+ server_url: Optional[str] = None,
681
+ timeout_ms: Optional[int] = None,
682
+ http_headers: Optional[Mapping[str, str]] = None,
683
+ ) -> operations.GetTransferResponse:
684
+ r"""Retrieve full transfer details for an individual transfer of a particular Moov account.
685
+
686
+ Payment rail-specific details are included in the source and destination. Read our [transfers overview guide](https://docs.moov.io/guides/money-movement/overview/)
687
+ to learn more.
688
+
689
+ To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
690
+ you'll need to specify the `/accounts/{accountID}/transfers.read` scope.
691
+
692
+ :param transfer_id: Identifier for the transfer.
693
+ :param account_id:
694
+ :param retries: Override the default retry configuration for this method
695
+ :param server_url: Override the default server URL for this method
696
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
697
+ :param http_headers: Additional headers to set or replace on requests.
698
+ """
699
+ base_url = None
700
+ url_variables = None
701
+ if timeout_ms is None:
702
+ timeout_ms = self.sdk_configuration.timeout_ms
703
+
704
+ if server_url is not None:
705
+ base_url = server_url
706
+ else:
707
+ base_url = self._get_url(base_url, url_variables)
708
+
709
+ request = operations.GetTransferRequest(
710
+ transfer_id=transfer_id,
711
+ account_id=account_id,
712
+ )
713
+
714
+ req = self._build_request(
715
+ method="GET",
716
+ path="/accounts/{accountID}/transfers/{transferID}",
717
+ base_url=base_url,
718
+ url_variables=url_variables,
719
+ request=request,
720
+ request_body_required=False,
721
+ request_has_path_params=True,
722
+ request_has_query_params=True,
723
+ user_agent_header="user-agent",
724
+ accept_header_value="application/json",
725
+ http_headers=http_headers,
726
+ _globals=operations.GetTransferGlobals(
727
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
728
+ ),
729
+ security=self.sdk_configuration.security,
730
+ timeout_ms=timeout_ms,
731
+ )
732
+
733
+ if retries == UNSET:
734
+ if self.sdk_configuration.retry_config is not UNSET:
735
+ retries = self.sdk_configuration.retry_config
736
+
737
+ retry_config = None
738
+ if isinstance(retries, utils.RetryConfig):
739
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
740
+
741
+ http_res = self.do_request(
742
+ hook_ctx=HookContext(
743
+ base_url=base_url or "",
744
+ operation_id="getTransfer",
745
+ oauth2_scopes=[],
746
+ security_source=get_security_from_env(
747
+ self.sdk_configuration.security, components.Security
748
+ ),
749
+ ),
750
+ request=req,
751
+ error_status_codes=["401", "403", "404", "429", "4XX", "500", "504", "5XX"],
752
+ retry_config=retry_config,
753
+ )
754
+
755
+ if utils.match_response(http_res, "200", "application/json"):
756
+ return operations.GetTransferResponse(
757
+ result=utils.unmarshal_json(http_res.text, components.Transfer),
758
+ headers=utils.get_response_headers(http_res.headers),
759
+ )
760
+ if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
761
+ http_res_text = utils.stream_to_text(http_res)
762
+ raise errors.APIError(
763
+ "API error occurred", http_res.status_code, http_res_text, http_res
764
+ )
765
+ if utils.match_response(http_res, ["500", "504"], "*"):
766
+ http_res_text = utils.stream_to_text(http_res)
767
+ raise errors.APIError(
768
+ "API error occurred", http_res.status_code, http_res_text, http_res
769
+ )
770
+ if utils.match_response(http_res, "4XX", "*"):
771
+ http_res_text = utils.stream_to_text(http_res)
772
+ raise errors.APIError(
773
+ "API error occurred", http_res.status_code, http_res_text, http_res
774
+ )
775
+ if utils.match_response(http_res, "5XX", "*"):
776
+ http_res_text = utils.stream_to_text(http_res)
777
+ raise errors.APIError(
778
+ "API error occurred", http_res.status_code, http_res_text, http_res
779
+ )
780
+
781
+ content_type = http_res.headers.get("Content-Type")
782
+ http_res_text = utils.stream_to_text(http_res)
783
+ raise errors.APIError(
784
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
785
+ http_res.status_code,
786
+ http_res_text,
787
+ http_res,
788
+ )
789
+
790
+ async def get_async(
791
+ self,
792
+ *,
793
+ transfer_id: str,
794
+ account_id: str,
795
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
796
+ server_url: Optional[str] = None,
797
+ timeout_ms: Optional[int] = None,
798
+ http_headers: Optional[Mapping[str, str]] = None,
799
+ ) -> operations.GetTransferResponse:
800
+ r"""Retrieve full transfer details for an individual transfer of a particular Moov account.
801
+
802
+ Payment rail-specific details are included in the source and destination. Read our [transfers overview guide](https://docs.moov.io/guides/money-movement/overview/)
803
+ to learn more.
804
+
805
+ To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
806
+ you'll need to specify the `/accounts/{accountID}/transfers.read` scope.
807
+
808
+ :param transfer_id: Identifier for the transfer.
809
+ :param account_id:
810
+ :param retries: Override the default retry configuration for this method
811
+ :param server_url: Override the default server URL for this method
812
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
813
+ :param http_headers: Additional headers to set or replace on requests.
814
+ """
815
+ base_url = None
816
+ url_variables = None
817
+ if timeout_ms is None:
818
+ timeout_ms = self.sdk_configuration.timeout_ms
819
+
820
+ if server_url is not None:
821
+ base_url = server_url
822
+ else:
823
+ base_url = self._get_url(base_url, url_variables)
824
+
825
+ request = operations.GetTransferRequest(
826
+ transfer_id=transfer_id,
827
+ account_id=account_id,
828
+ )
829
+
830
+ req = self._build_request_async(
831
+ method="GET",
832
+ path="/accounts/{accountID}/transfers/{transferID}",
833
+ base_url=base_url,
834
+ url_variables=url_variables,
835
+ request=request,
836
+ request_body_required=False,
837
+ request_has_path_params=True,
838
+ request_has_query_params=True,
839
+ user_agent_header="user-agent",
840
+ accept_header_value="application/json",
841
+ http_headers=http_headers,
842
+ _globals=operations.GetTransferGlobals(
843
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
844
+ ),
845
+ security=self.sdk_configuration.security,
846
+ timeout_ms=timeout_ms,
847
+ )
848
+
849
+ if retries == UNSET:
850
+ if self.sdk_configuration.retry_config is not UNSET:
851
+ retries = self.sdk_configuration.retry_config
852
+
853
+ retry_config = None
854
+ if isinstance(retries, utils.RetryConfig):
855
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
856
+
857
+ http_res = await self.do_request_async(
858
+ hook_ctx=HookContext(
859
+ base_url=base_url or "",
860
+ operation_id="getTransfer",
861
+ oauth2_scopes=[],
862
+ security_source=get_security_from_env(
863
+ self.sdk_configuration.security, components.Security
864
+ ),
865
+ ),
866
+ request=req,
867
+ error_status_codes=["401", "403", "404", "429", "4XX", "500", "504", "5XX"],
868
+ retry_config=retry_config,
869
+ )
870
+
871
+ if utils.match_response(http_res, "200", "application/json"):
872
+ return operations.GetTransferResponse(
873
+ result=utils.unmarshal_json(http_res.text, components.Transfer),
874
+ headers=utils.get_response_headers(http_res.headers),
875
+ )
876
+ if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
877
+ http_res_text = await utils.stream_to_text_async(http_res)
878
+ raise errors.APIError(
879
+ "API error occurred", http_res.status_code, http_res_text, http_res
880
+ )
881
+ if utils.match_response(http_res, ["500", "504"], "*"):
882
+ http_res_text = await utils.stream_to_text_async(http_res)
883
+ raise errors.APIError(
884
+ "API error occurred", http_res.status_code, http_res_text, http_res
885
+ )
886
+ if utils.match_response(http_res, "4XX", "*"):
887
+ http_res_text = await utils.stream_to_text_async(http_res)
888
+ raise errors.APIError(
889
+ "API error occurred", http_res.status_code, http_res_text, http_res
890
+ )
891
+ if utils.match_response(http_res, "5XX", "*"):
892
+ http_res_text = await utils.stream_to_text_async(http_res)
893
+ raise errors.APIError(
894
+ "API error occurred", http_res.status_code, http_res_text, http_res
895
+ )
896
+
897
+ content_type = http_res.headers.get("Content-Type")
898
+ http_res_text = await utils.stream_to_text_async(http_res)
899
+ raise errors.APIError(
900
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
901
+ http_res.status_code,
902
+ http_res_text,
903
+ http_res,
904
+ )
905
+
906
+ def update(
907
+ self,
908
+ *,
909
+ transfer_id: str,
910
+ account_id: str,
911
+ metadata: OptionalNullable[Dict[str, str]] = UNSET,
912
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
913
+ server_url: Optional[str] = None,
914
+ timeout_ms: Optional[int] = None,
915
+ http_headers: Optional[Mapping[str, str]] = None,
916
+ ) -> operations.UpdateTransferResponse:
917
+ r"""Update the metadata contained on a transfer.
918
+
919
+ Read our [transfers overview guide](https://docs.moov.io/guides/money-movement/overview/) to learn more.
920
+
921
+ To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
922
+ you'll need to specify the `/accounts/{accountID}/transfers.write` scope.
923
+
924
+ :param transfer_id: Identifier for the transfer.
925
+ :param account_id:
926
+ :param metadata:
927
+ :param retries: Override the default retry configuration for this method
928
+ :param server_url: Override the default server URL for this method
929
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
930
+ :param http_headers: Additional headers to set or replace on requests.
931
+ """
932
+ base_url = None
933
+ url_variables = None
934
+ if timeout_ms is None:
935
+ timeout_ms = self.sdk_configuration.timeout_ms
936
+
937
+ if server_url is not None:
938
+ base_url = server_url
939
+ else:
940
+ base_url = self._get_url(base_url, url_variables)
941
+
942
+ request = operations.UpdateTransferRequest(
943
+ transfer_id=transfer_id,
944
+ account_id=account_id,
945
+ patch_transfer=components.PatchTransfer(
946
+ metadata=metadata,
947
+ ),
948
+ )
949
+
950
+ req = self._build_request(
951
+ method="PATCH",
952
+ path="/accounts/{accountID}/transfers/{transferID}",
953
+ base_url=base_url,
954
+ url_variables=url_variables,
955
+ request=request,
956
+ request_body_required=True,
957
+ request_has_path_params=True,
958
+ request_has_query_params=True,
959
+ user_agent_header="user-agent",
960
+ accept_header_value="application/json",
961
+ http_headers=http_headers,
962
+ _globals=operations.UpdateTransferGlobals(
963
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
964
+ ),
965
+ security=self.sdk_configuration.security,
966
+ get_serialized_body=lambda: utils.serialize_request_body(
967
+ request.patch_transfer, False, False, "json", components.PatchTransfer
968
+ ),
969
+ timeout_ms=timeout_ms,
970
+ )
971
+
972
+ if retries == UNSET:
973
+ if self.sdk_configuration.retry_config is not UNSET:
974
+ retries = self.sdk_configuration.retry_config
975
+
976
+ retry_config = None
977
+ if isinstance(retries, utils.RetryConfig):
978
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
979
+
980
+ http_res = self.do_request(
981
+ hook_ctx=HookContext(
982
+ base_url=base_url or "",
983
+ operation_id="updateTransfer",
984
+ oauth2_scopes=[],
985
+ security_source=get_security_from_env(
986
+ self.sdk_configuration.security, components.Security
987
+ ),
988
+ ),
989
+ request=req,
990
+ error_status_codes=["401", "403", "404", "429", "4XX", "500", "504", "5XX"],
991
+ retry_config=retry_config,
992
+ )
993
+
994
+ if utils.match_response(http_res, "200", "application/json"):
995
+ return operations.UpdateTransferResponse(
996
+ result=utils.unmarshal_json(http_res.text, components.Transfer),
997
+ headers=utils.get_response_headers(http_res.headers),
998
+ )
999
+ if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1000
+ http_res_text = utils.stream_to_text(http_res)
1001
+ raise errors.APIError(
1002
+ "API error occurred", http_res.status_code, http_res_text, http_res
1003
+ )
1004
+ if utils.match_response(http_res, ["500", "504"], "*"):
1005
+ http_res_text = utils.stream_to_text(http_res)
1006
+ raise errors.APIError(
1007
+ "API error occurred", http_res.status_code, http_res_text, http_res
1008
+ )
1009
+ if utils.match_response(http_res, "4XX", "*"):
1010
+ http_res_text = utils.stream_to_text(http_res)
1011
+ raise errors.APIError(
1012
+ "API error occurred", http_res.status_code, http_res_text, http_res
1013
+ )
1014
+ if utils.match_response(http_res, "5XX", "*"):
1015
+ http_res_text = utils.stream_to_text(http_res)
1016
+ raise errors.APIError(
1017
+ "API error occurred", http_res.status_code, http_res_text, http_res
1018
+ )
1019
+
1020
+ content_type = http_res.headers.get("Content-Type")
1021
+ http_res_text = utils.stream_to_text(http_res)
1022
+ raise errors.APIError(
1023
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1024
+ http_res.status_code,
1025
+ http_res_text,
1026
+ http_res,
1027
+ )
1028
+
1029
+ async def update_async(
1030
+ self,
1031
+ *,
1032
+ transfer_id: str,
1033
+ account_id: str,
1034
+ metadata: OptionalNullable[Dict[str, str]] = UNSET,
1035
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1036
+ server_url: Optional[str] = None,
1037
+ timeout_ms: Optional[int] = None,
1038
+ http_headers: Optional[Mapping[str, str]] = None,
1039
+ ) -> operations.UpdateTransferResponse:
1040
+ r"""Update the metadata contained on a transfer.
1041
+
1042
+ Read our [transfers overview guide](https://docs.moov.io/guides/money-movement/overview/) to learn more.
1043
+
1044
+ To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
1045
+ you'll need to specify the `/accounts/{accountID}/transfers.write` scope.
1046
+
1047
+ :param transfer_id: Identifier for the transfer.
1048
+ :param account_id:
1049
+ :param metadata:
1050
+ :param retries: Override the default retry configuration for this method
1051
+ :param server_url: Override the default server URL for this method
1052
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1053
+ :param http_headers: Additional headers to set or replace on requests.
1054
+ """
1055
+ base_url = None
1056
+ url_variables = None
1057
+ if timeout_ms is None:
1058
+ timeout_ms = self.sdk_configuration.timeout_ms
1059
+
1060
+ if server_url is not None:
1061
+ base_url = server_url
1062
+ else:
1063
+ base_url = self._get_url(base_url, url_variables)
1064
+
1065
+ request = operations.UpdateTransferRequest(
1066
+ transfer_id=transfer_id,
1067
+ account_id=account_id,
1068
+ patch_transfer=components.PatchTransfer(
1069
+ metadata=metadata,
1070
+ ),
1071
+ )
1072
+
1073
+ req = self._build_request_async(
1074
+ method="PATCH",
1075
+ path="/accounts/{accountID}/transfers/{transferID}",
1076
+ base_url=base_url,
1077
+ url_variables=url_variables,
1078
+ request=request,
1079
+ request_body_required=True,
1080
+ request_has_path_params=True,
1081
+ request_has_query_params=True,
1082
+ user_agent_header="user-agent",
1083
+ accept_header_value="application/json",
1084
+ http_headers=http_headers,
1085
+ _globals=operations.UpdateTransferGlobals(
1086
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
1087
+ ),
1088
+ security=self.sdk_configuration.security,
1089
+ get_serialized_body=lambda: utils.serialize_request_body(
1090
+ request.patch_transfer, False, False, "json", components.PatchTransfer
1091
+ ),
1092
+ timeout_ms=timeout_ms,
1093
+ )
1094
+
1095
+ if retries == UNSET:
1096
+ if self.sdk_configuration.retry_config is not UNSET:
1097
+ retries = self.sdk_configuration.retry_config
1098
+
1099
+ retry_config = None
1100
+ if isinstance(retries, utils.RetryConfig):
1101
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1102
+
1103
+ http_res = await self.do_request_async(
1104
+ hook_ctx=HookContext(
1105
+ base_url=base_url or "",
1106
+ operation_id="updateTransfer",
1107
+ oauth2_scopes=[],
1108
+ security_source=get_security_from_env(
1109
+ self.sdk_configuration.security, components.Security
1110
+ ),
1111
+ ),
1112
+ request=req,
1113
+ error_status_codes=["401", "403", "404", "429", "4XX", "500", "504", "5XX"],
1114
+ retry_config=retry_config,
1115
+ )
1116
+
1117
+ if utils.match_response(http_res, "200", "application/json"):
1118
+ return operations.UpdateTransferResponse(
1119
+ result=utils.unmarshal_json(http_res.text, components.Transfer),
1120
+ headers=utils.get_response_headers(http_res.headers),
1121
+ )
1122
+ if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1123
+ http_res_text = await utils.stream_to_text_async(http_res)
1124
+ raise errors.APIError(
1125
+ "API error occurred", http_res.status_code, http_res_text, http_res
1126
+ )
1127
+ if utils.match_response(http_res, ["500", "504"], "*"):
1128
+ http_res_text = await utils.stream_to_text_async(http_res)
1129
+ raise errors.APIError(
1130
+ "API error occurred", http_res.status_code, http_res_text, http_res
1131
+ )
1132
+ if utils.match_response(http_res, "4XX", "*"):
1133
+ http_res_text = await utils.stream_to_text_async(http_res)
1134
+ raise errors.APIError(
1135
+ "API error occurred", http_res.status_code, http_res_text, http_res
1136
+ )
1137
+ if utils.match_response(http_res, "5XX", "*"):
1138
+ http_res_text = await utils.stream_to_text_async(http_res)
1139
+ raise errors.APIError(
1140
+ "API error occurred", http_res.status_code, http_res_text, http_res
1141
+ )
1142
+
1143
+ content_type = http_res.headers.get("Content-Type")
1144
+ http_res_text = await utils.stream_to_text_async(http_res)
1145
+ raise errors.APIError(
1146
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1147
+ http_res.status_code,
1148
+ http_res_text,
1149
+ http_res,
1150
+ )
1151
+
1152
+ def create_cancellation(
1153
+ self,
1154
+ *,
1155
+ account_id: str,
1156
+ transfer_id: str,
1157
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1158
+ server_url: Optional[str] = None,
1159
+ timeout_ms: Optional[int] = None,
1160
+ http_headers: Optional[Mapping[str, str]] = None,
1161
+ ) -> operations.CreateCancellationResponse:
1162
+ r"""Initiate a cancellation for a card, ACH, or queued transfer.
1163
+
1164
+ To access this endpoint using a [token](https://docs.moov.io/api/authentication/access-tokens/) you'll need
1165
+ to specify the `/accounts/{accountID}/transfers.write` scope.
1166
+
1167
+ :param account_id: The partner's Moov account ID.
1168
+ :param transfer_id: The transfer ID to cancel.
1169
+ :param retries: Override the default retry configuration for this method
1170
+ :param server_url: Override the default server URL for this method
1171
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1172
+ :param http_headers: Additional headers to set or replace on requests.
1173
+ """
1174
+ base_url = None
1175
+ url_variables = None
1176
+ if timeout_ms is None:
1177
+ timeout_ms = self.sdk_configuration.timeout_ms
1178
+
1179
+ if server_url is not None:
1180
+ base_url = server_url
1181
+ else:
1182
+ base_url = self._get_url(base_url, url_variables)
1183
+
1184
+ request = operations.CreateCancellationRequest(
1185
+ account_id=account_id,
1186
+ transfer_id=transfer_id,
1187
+ )
1188
+
1189
+ req = self._build_request(
1190
+ method="POST",
1191
+ path="/accounts/{accountID}/transfers/{transferID}/cancellations",
1192
+ base_url=base_url,
1193
+ url_variables=url_variables,
1194
+ request=request,
1195
+ request_body_required=False,
1196
+ request_has_path_params=True,
1197
+ request_has_query_params=True,
1198
+ user_agent_header="user-agent",
1199
+ accept_header_value="application/json",
1200
+ http_headers=http_headers,
1201
+ _globals=operations.CreateCancellationGlobals(
1202
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
1203
+ ),
1204
+ security=self.sdk_configuration.security,
1205
+ timeout_ms=timeout_ms,
1206
+ )
1207
+
1208
+ if retries == UNSET:
1209
+ if self.sdk_configuration.retry_config is not UNSET:
1210
+ retries = self.sdk_configuration.retry_config
1211
+
1212
+ retry_config = None
1213
+ if isinstance(retries, utils.RetryConfig):
1214
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1215
+
1216
+ http_res = self.do_request(
1217
+ hook_ctx=HookContext(
1218
+ base_url=base_url or "",
1219
+ operation_id="createCancellation",
1220
+ oauth2_scopes=[],
1221
+ security_source=get_security_from_env(
1222
+ self.sdk_configuration.security, components.Security
1223
+ ),
1224
+ ),
1225
+ request=req,
1226
+ error_status_codes=[
1227
+ "400",
1228
+ "401",
1229
+ "403",
1230
+ "404",
1231
+ "429",
1232
+ "4XX",
1233
+ "500",
1234
+ "504",
1235
+ "5XX",
1236
+ ],
1237
+ retry_config=retry_config,
1238
+ )
1239
+
1240
+ response_data: Any = None
1241
+ if utils.match_response(http_res, ["200", "202"], "application/json"):
1242
+ return operations.CreateCancellationResponse(
1243
+ result=utils.unmarshal_json(http_res.text, components.Cancellation),
1244
+ headers=utils.get_response_headers(http_res.headers),
1245
+ )
1246
+ if utils.match_response(http_res, "400", "application/json"):
1247
+ response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
1248
+ raise errors.GenericError(data=response_data)
1249
+ if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1250
+ http_res_text = utils.stream_to_text(http_res)
1251
+ raise errors.APIError(
1252
+ "API error occurred", http_res.status_code, http_res_text, http_res
1253
+ )
1254
+ if utils.match_response(http_res, ["500", "504"], "*"):
1255
+ http_res_text = utils.stream_to_text(http_res)
1256
+ raise errors.APIError(
1257
+ "API error occurred", http_res.status_code, http_res_text, http_res
1258
+ )
1259
+ if utils.match_response(http_res, "4XX", "*"):
1260
+ http_res_text = utils.stream_to_text(http_res)
1261
+ raise errors.APIError(
1262
+ "API error occurred", http_res.status_code, http_res_text, http_res
1263
+ )
1264
+ if utils.match_response(http_res, "5XX", "*"):
1265
+ http_res_text = utils.stream_to_text(http_res)
1266
+ raise errors.APIError(
1267
+ "API error occurred", http_res.status_code, http_res_text, http_res
1268
+ )
1269
+
1270
+ content_type = http_res.headers.get("Content-Type")
1271
+ http_res_text = utils.stream_to_text(http_res)
1272
+ raise errors.APIError(
1273
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1274
+ http_res.status_code,
1275
+ http_res_text,
1276
+ http_res,
1277
+ )
1278
+
1279
+ async def create_cancellation_async(
1280
+ self,
1281
+ *,
1282
+ account_id: str,
1283
+ transfer_id: str,
1284
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1285
+ server_url: Optional[str] = None,
1286
+ timeout_ms: Optional[int] = None,
1287
+ http_headers: Optional[Mapping[str, str]] = None,
1288
+ ) -> operations.CreateCancellationResponse:
1289
+ r"""Initiate a cancellation for a card, ACH, or queued transfer.
1290
+
1291
+ To access this endpoint using a [token](https://docs.moov.io/api/authentication/access-tokens/) you'll need
1292
+ to specify the `/accounts/{accountID}/transfers.write` scope.
1293
+
1294
+ :param account_id: The partner's Moov account ID.
1295
+ :param transfer_id: The transfer ID to cancel.
1296
+ :param retries: Override the default retry configuration for this method
1297
+ :param server_url: Override the default server URL for this method
1298
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1299
+ :param http_headers: Additional headers to set or replace on requests.
1300
+ """
1301
+ base_url = None
1302
+ url_variables = None
1303
+ if timeout_ms is None:
1304
+ timeout_ms = self.sdk_configuration.timeout_ms
1305
+
1306
+ if server_url is not None:
1307
+ base_url = server_url
1308
+ else:
1309
+ base_url = self._get_url(base_url, url_variables)
1310
+
1311
+ request = operations.CreateCancellationRequest(
1312
+ account_id=account_id,
1313
+ transfer_id=transfer_id,
1314
+ )
1315
+
1316
+ req = self._build_request_async(
1317
+ method="POST",
1318
+ path="/accounts/{accountID}/transfers/{transferID}/cancellations",
1319
+ base_url=base_url,
1320
+ url_variables=url_variables,
1321
+ request=request,
1322
+ request_body_required=False,
1323
+ request_has_path_params=True,
1324
+ request_has_query_params=True,
1325
+ user_agent_header="user-agent",
1326
+ accept_header_value="application/json",
1327
+ http_headers=http_headers,
1328
+ _globals=operations.CreateCancellationGlobals(
1329
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
1330
+ ),
1331
+ security=self.sdk_configuration.security,
1332
+ timeout_ms=timeout_ms,
1333
+ )
1334
+
1335
+ if retries == UNSET:
1336
+ if self.sdk_configuration.retry_config is not UNSET:
1337
+ retries = self.sdk_configuration.retry_config
1338
+
1339
+ retry_config = None
1340
+ if isinstance(retries, utils.RetryConfig):
1341
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1342
+
1343
+ http_res = await self.do_request_async(
1344
+ hook_ctx=HookContext(
1345
+ base_url=base_url or "",
1346
+ operation_id="createCancellation",
1347
+ oauth2_scopes=[],
1348
+ security_source=get_security_from_env(
1349
+ self.sdk_configuration.security, components.Security
1350
+ ),
1351
+ ),
1352
+ request=req,
1353
+ error_status_codes=[
1354
+ "400",
1355
+ "401",
1356
+ "403",
1357
+ "404",
1358
+ "429",
1359
+ "4XX",
1360
+ "500",
1361
+ "504",
1362
+ "5XX",
1363
+ ],
1364
+ retry_config=retry_config,
1365
+ )
1366
+
1367
+ response_data: Any = None
1368
+ if utils.match_response(http_res, ["200", "202"], "application/json"):
1369
+ return operations.CreateCancellationResponse(
1370
+ result=utils.unmarshal_json(http_res.text, components.Cancellation),
1371
+ headers=utils.get_response_headers(http_res.headers),
1372
+ )
1373
+ if utils.match_response(http_res, "400", "application/json"):
1374
+ response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
1375
+ raise errors.GenericError(data=response_data)
1376
+ if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1377
+ http_res_text = await utils.stream_to_text_async(http_res)
1378
+ raise errors.APIError(
1379
+ "API error occurred", http_res.status_code, http_res_text, http_res
1380
+ )
1381
+ if utils.match_response(http_res, ["500", "504"], "*"):
1382
+ http_res_text = await utils.stream_to_text_async(http_res)
1383
+ raise errors.APIError(
1384
+ "API error occurred", http_res.status_code, http_res_text, http_res
1385
+ )
1386
+ if utils.match_response(http_res, "4XX", "*"):
1387
+ http_res_text = await utils.stream_to_text_async(http_res)
1388
+ raise errors.APIError(
1389
+ "API error occurred", http_res.status_code, http_res_text, http_res
1390
+ )
1391
+ if utils.match_response(http_res, "5XX", "*"):
1392
+ http_res_text = await utils.stream_to_text_async(http_res)
1393
+ raise errors.APIError(
1394
+ "API error occurred", http_res.status_code, http_res_text, http_res
1395
+ )
1396
+
1397
+ content_type = http_res.headers.get("Content-Type")
1398
+ http_res_text = await utils.stream_to_text_async(http_res)
1399
+ raise errors.APIError(
1400
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1401
+ http_res.status_code,
1402
+ http_res_text,
1403
+ http_res,
1404
+ )
1405
+
1406
+ def get_cancellation(
1407
+ self,
1408
+ *,
1409
+ account_id: str,
1410
+ transfer_id: str,
1411
+ cancellation_id: str,
1412
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1413
+ server_url: Optional[str] = None,
1414
+ timeout_ms: Optional[int] = None,
1415
+ http_headers: Optional[Mapping[str, str]] = None,
1416
+ ) -> operations.GetCancellationResponse:
1417
+ r"""Get details of a cancellation for a transfer.
1418
+
1419
+ To access this endpoint using a [token](https://docs.moov.io/api/authentication/access-tokens/) you'll need
1420
+ to specify the `/accounts/{accountID}/transfers.read` scope.
1421
+
1422
+ :param account_id: Moov account ID of the partner or transfer's source or destination.
1423
+ :param transfer_id: Identifier for the transfer.
1424
+ :param cancellation_id: Identifier for the cancellation.
1425
+ :param retries: Override the default retry configuration for this method
1426
+ :param server_url: Override the default server URL for this method
1427
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1428
+ :param http_headers: Additional headers to set or replace on requests.
1429
+ """
1430
+ base_url = None
1431
+ url_variables = None
1432
+ if timeout_ms is None:
1433
+ timeout_ms = self.sdk_configuration.timeout_ms
1434
+
1435
+ if server_url is not None:
1436
+ base_url = server_url
1437
+ else:
1438
+ base_url = self._get_url(base_url, url_variables)
1439
+
1440
+ request = operations.GetCancellationRequest(
1441
+ account_id=account_id,
1442
+ transfer_id=transfer_id,
1443
+ cancellation_id=cancellation_id,
1444
+ )
1445
+
1446
+ req = self._build_request(
1447
+ method="GET",
1448
+ path="/accounts/{accountID}/transfers/{transferID}/cancellations/{cancellationID}",
1449
+ base_url=base_url,
1450
+ url_variables=url_variables,
1451
+ request=request,
1452
+ request_body_required=False,
1453
+ request_has_path_params=True,
1454
+ request_has_query_params=True,
1455
+ user_agent_header="user-agent",
1456
+ accept_header_value="application/json",
1457
+ http_headers=http_headers,
1458
+ _globals=operations.GetCancellationGlobals(
1459
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
1460
+ ),
1461
+ security=self.sdk_configuration.security,
1462
+ timeout_ms=timeout_ms,
1463
+ )
1464
+
1465
+ if retries == UNSET:
1466
+ if self.sdk_configuration.retry_config is not UNSET:
1467
+ retries = self.sdk_configuration.retry_config
1468
+
1469
+ retry_config = None
1470
+ if isinstance(retries, utils.RetryConfig):
1471
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1472
+
1473
+ http_res = self.do_request(
1474
+ hook_ctx=HookContext(
1475
+ base_url=base_url or "",
1476
+ operation_id="getCancellation",
1477
+ oauth2_scopes=[],
1478
+ security_source=get_security_from_env(
1479
+ self.sdk_configuration.security, components.Security
1480
+ ),
1481
+ ),
1482
+ request=req,
1483
+ error_status_codes=["401", "403", "404", "429", "4XX", "500", "504", "5XX"],
1484
+ retry_config=retry_config,
1485
+ )
1486
+
1487
+ if utils.match_response(http_res, "200", "application/json"):
1488
+ return operations.GetCancellationResponse(
1489
+ result=utils.unmarshal_json(http_res.text, components.Cancellation),
1490
+ headers=utils.get_response_headers(http_res.headers),
1491
+ )
1492
+ if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1493
+ http_res_text = utils.stream_to_text(http_res)
1494
+ raise errors.APIError(
1495
+ "API error occurred", http_res.status_code, http_res_text, http_res
1496
+ )
1497
+ if utils.match_response(http_res, ["500", "504"], "*"):
1498
+ http_res_text = utils.stream_to_text(http_res)
1499
+ raise errors.APIError(
1500
+ "API error occurred", http_res.status_code, http_res_text, http_res
1501
+ )
1502
+ if utils.match_response(http_res, "4XX", "*"):
1503
+ http_res_text = utils.stream_to_text(http_res)
1504
+ raise errors.APIError(
1505
+ "API error occurred", http_res.status_code, http_res_text, http_res
1506
+ )
1507
+ if utils.match_response(http_res, "5XX", "*"):
1508
+ http_res_text = utils.stream_to_text(http_res)
1509
+ raise errors.APIError(
1510
+ "API error occurred", http_res.status_code, http_res_text, http_res
1511
+ )
1512
+
1513
+ content_type = http_res.headers.get("Content-Type")
1514
+ http_res_text = utils.stream_to_text(http_res)
1515
+ raise errors.APIError(
1516
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1517
+ http_res.status_code,
1518
+ http_res_text,
1519
+ http_res,
1520
+ )
1521
+
1522
+ async def get_cancellation_async(
1523
+ self,
1524
+ *,
1525
+ account_id: str,
1526
+ transfer_id: str,
1527
+ cancellation_id: str,
1528
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1529
+ server_url: Optional[str] = None,
1530
+ timeout_ms: Optional[int] = None,
1531
+ http_headers: Optional[Mapping[str, str]] = None,
1532
+ ) -> operations.GetCancellationResponse:
1533
+ r"""Get details of a cancellation for a transfer.
1534
+
1535
+ To access this endpoint using a [token](https://docs.moov.io/api/authentication/access-tokens/) you'll need
1536
+ to specify the `/accounts/{accountID}/transfers.read` scope.
1537
+
1538
+ :param account_id: Moov account ID of the partner or transfer's source or destination.
1539
+ :param transfer_id: Identifier for the transfer.
1540
+ :param cancellation_id: Identifier for the cancellation.
1541
+ :param retries: Override the default retry configuration for this method
1542
+ :param server_url: Override the default server URL for this method
1543
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1544
+ :param http_headers: Additional headers to set or replace on requests.
1545
+ """
1546
+ base_url = None
1547
+ url_variables = None
1548
+ if timeout_ms is None:
1549
+ timeout_ms = self.sdk_configuration.timeout_ms
1550
+
1551
+ if server_url is not None:
1552
+ base_url = server_url
1553
+ else:
1554
+ base_url = self._get_url(base_url, url_variables)
1555
+
1556
+ request = operations.GetCancellationRequest(
1557
+ account_id=account_id,
1558
+ transfer_id=transfer_id,
1559
+ cancellation_id=cancellation_id,
1560
+ )
1561
+
1562
+ req = self._build_request_async(
1563
+ method="GET",
1564
+ path="/accounts/{accountID}/transfers/{transferID}/cancellations/{cancellationID}",
1565
+ base_url=base_url,
1566
+ url_variables=url_variables,
1567
+ request=request,
1568
+ request_body_required=False,
1569
+ request_has_path_params=True,
1570
+ request_has_query_params=True,
1571
+ user_agent_header="user-agent",
1572
+ accept_header_value="application/json",
1573
+ http_headers=http_headers,
1574
+ _globals=operations.GetCancellationGlobals(
1575
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
1576
+ ),
1577
+ security=self.sdk_configuration.security,
1578
+ timeout_ms=timeout_ms,
1579
+ )
1580
+
1581
+ if retries == UNSET:
1582
+ if self.sdk_configuration.retry_config is not UNSET:
1583
+ retries = self.sdk_configuration.retry_config
1584
+
1585
+ retry_config = None
1586
+ if isinstance(retries, utils.RetryConfig):
1587
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1588
+
1589
+ http_res = await self.do_request_async(
1590
+ hook_ctx=HookContext(
1591
+ base_url=base_url or "",
1592
+ operation_id="getCancellation",
1593
+ oauth2_scopes=[],
1594
+ security_source=get_security_from_env(
1595
+ self.sdk_configuration.security, components.Security
1596
+ ),
1597
+ ),
1598
+ request=req,
1599
+ error_status_codes=["401", "403", "404", "429", "4XX", "500", "504", "5XX"],
1600
+ retry_config=retry_config,
1601
+ )
1602
+
1603
+ if utils.match_response(http_res, "200", "application/json"):
1604
+ return operations.GetCancellationResponse(
1605
+ result=utils.unmarshal_json(http_res.text, components.Cancellation),
1606
+ headers=utils.get_response_headers(http_res.headers),
1607
+ )
1608
+ if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1609
+ http_res_text = await utils.stream_to_text_async(http_res)
1610
+ raise errors.APIError(
1611
+ "API error occurred", http_res.status_code, http_res_text, http_res
1612
+ )
1613
+ if utils.match_response(http_res, ["500", "504"], "*"):
1614
+ http_res_text = await utils.stream_to_text_async(http_res)
1615
+ raise errors.APIError(
1616
+ "API error occurred", http_res.status_code, http_res_text, http_res
1617
+ )
1618
+ if utils.match_response(http_res, "4XX", "*"):
1619
+ http_res_text = await utils.stream_to_text_async(http_res)
1620
+ raise errors.APIError(
1621
+ "API error occurred", http_res.status_code, http_res_text, http_res
1622
+ )
1623
+ if utils.match_response(http_res, "5XX", "*"):
1624
+ http_res_text = await utils.stream_to_text_async(http_res)
1625
+ raise errors.APIError(
1626
+ "API error occurred", http_res.status_code, http_res_text, http_res
1627
+ )
1628
+
1629
+ content_type = http_res.headers.get("Content-Type")
1630
+ http_res_text = await utils.stream_to_text_async(http_res)
1631
+ raise errors.APIError(
1632
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1633
+ http_res.status_code,
1634
+ http_res_text,
1635
+ http_res,
1636
+ )
1637
+
1638
+ def initiate_refund(
1639
+ self,
1640
+ *,
1641
+ x_idempotency_key: str,
1642
+ account_id: str,
1643
+ transfer_id: str,
1644
+ x_wait_for: Optional[components.TransferWaitFor] = None,
1645
+ amount: Optional[int] = None,
1646
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1647
+ server_url: Optional[str] = None,
1648
+ timeout_ms: Optional[int] = None,
1649
+ http_headers: Optional[Mapping[str, str]] = None,
1650
+ ) -> operations.InitiateRefundResponse:
1651
+ r"""Initiate a refund for a card transfer.
1652
+
1653
+ **Use the [Cancel or refund a card transfer](https://docs.moov.io/api/money-movement/refunds/cancel/) endpoint for more comprehensive cancel and refund options.**
1654
+ See the [reversals](https://docs.moov.io/guides/money-movement/accept-payments/card-acceptance/reversals/) guide for more information.
1655
+
1656
+ To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
1657
+ you'll need to specify the `/accounts/{accountID}/transfers.write` scope.
1658
+
1659
+ :param x_idempotency_key: Prevents duplicate refunds from being created.
1660
+ :param account_id: The merchant's Moov account ID.
1661
+ :param transfer_id: Identifier for the transfer.
1662
+ :param x_wait_for: Optional header that indicates whether to return a synchronous response that includes full transfer and rail-specific details or an asynchronous response indicating the transfer was created (this is the default response if the header is omitted).
1663
+ :param amount: Amount to refund in cents. If null, the original transfer's full amount will be refunded.
1664
+ :param retries: Override the default retry configuration for this method
1665
+ :param server_url: Override the default server URL for this method
1666
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1667
+ :param http_headers: Additional headers to set or replace on requests.
1668
+ """
1669
+ base_url = None
1670
+ url_variables = None
1671
+ if timeout_ms is None:
1672
+ timeout_ms = self.sdk_configuration.timeout_ms
1673
+
1674
+ if server_url is not None:
1675
+ base_url = server_url
1676
+ else:
1677
+ base_url = self._get_url(base_url, url_variables)
1678
+
1679
+ request = operations.InitiateRefundRequest(
1680
+ x_idempotency_key=x_idempotency_key,
1681
+ x_wait_for=x_wait_for,
1682
+ account_id=account_id,
1683
+ transfer_id=transfer_id,
1684
+ create_refund=components.CreateRefund(
1685
+ amount=amount,
1686
+ ),
1687
+ )
1688
+
1689
+ req = self._build_request(
1690
+ method="POST",
1691
+ path="/accounts/{accountID}/transfers/{transferID}/refunds",
1692
+ base_url=base_url,
1693
+ url_variables=url_variables,
1694
+ request=request,
1695
+ request_body_required=False,
1696
+ request_has_path_params=True,
1697
+ request_has_query_params=True,
1698
+ user_agent_header="user-agent",
1699
+ accept_header_value="application/json",
1700
+ http_headers=http_headers,
1701
+ _globals=operations.InitiateRefundGlobals(
1702
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
1703
+ ),
1704
+ security=self.sdk_configuration.security,
1705
+ get_serialized_body=lambda: utils.serialize_request_body(
1706
+ request.create_refund,
1707
+ False,
1708
+ True,
1709
+ "json",
1710
+ Optional[components.CreateRefund],
1711
+ ),
1712
+ timeout_ms=timeout_ms,
1713
+ )
1714
+
1715
+ if retries == UNSET:
1716
+ if self.sdk_configuration.retry_config is not UNSET:
1717
+ retries = self.sdk_configuration.retry_config
1718
+
1719
+ retry_config = None
1720
+ if isinstance(retries, utils.RetryConfig):
1721
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1722
+
1723
+ http_res = self.do_request(
1724
+ hook_ctx=HookContext(
1725
+ base_url=base_url or "",
1726
+ operation_id="initiateRefund",
1727
+ oauth2_scopes=[],
1728
+ security_source=get_security_from_env(
1729
+ self.sdk_configuration.security, components.Security
1730
+ ),
1731
+ ),
1732
+ request=req,
1733
+ error_status_codes=[
1734
+ "400",
1735
+ "404",
1736
+ "409",
1737
+ "422",
1738
+ "429",
1739
+ "4XX",
1740
+ "500",
1741
+ "504",
1742
+ "5XX",
1743
+ ],
1744
+ retry_config=retry_config,
1745
+ )
1746
+
1747
+ response_data: Any = None
1748
+ if utils.match_response(http_res, "200", "application/json"):
1749
+ return operations.InitiateRefundResponse(
1750
+ result=utils.unmarshal_json(
1751
+ http_res.text, components.CreateRefundResponse
1752
+ ),
1753
+ headers=utils.get_response_headers(http_res.headers),
1754
+ )
1755
+ if utils.match_response(http_res, "202", "application/json"):
1756
+ return operations.InitiateRefundResponse(
1757
+ result=utils.unmarshal_json(
1758
+ http_res.text, components.CardAcquiringRefund
1759
+ ),
1760
+ headers=utils.get_response_headers(http_res.headers),
1761
+ )
1762
+ if utils.match_response(http_res, "400", "application/json"):
1763
+ response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
1764
+ raise errors.GenericError(data=response_data)
1765
+ if utils.match_response(http_res, "409", "application/json"):
1766
+ response_data = utils.unmarshal_json(
1767
+ http_res.text, errors.CardAcquiringRefundData
1768
+ )
1769
+ raise errors.CardAcquiringRefund(data=response_data)
1770
+ if utils.match_response(http_res, "422", "application/json"):
1771
+ response_data = utils.unmarshal_json(
1772
+ http_res.text, errors.RefundValidationErrorData
1773
+ )
1774
+ raise errors.RefundValidationError(data=response_data)
1775
+ if utils.match_response(http_res, ["404", "429"], "*"):
1776
+ http_res_text = utils.stream_to_text(http_res)
1777
+ raise errors.APIError(
1778
+ "API error occurred", http_res.status_code, http_res_text, http_res
1779
+ )
1780
+ if utils.match_response(http_res, ["500", "504"], "*"):
1781
+ http_res_text = utils.stream_to_text(http_res)
1782
+ raise errors.APIError(
1783
+ "API error occurred", http_res.status_code, http_res_text, http_res
1784
+ )
1785
+ if utils.match_response(http_res, "4XX", "*"):
1786
+ http_res_text = utils.stream_to_text(http_res)
1787
+ raise errors.APIError(
1788
+ "API error occurred", http_res.status_code, http_res_text, http_res
1789
+ )
1790
+ if utils.match_response(http_res, "5XX", "*"):
1791
+ http_res_text = utils.stream_to_text(http_res)
1792
+ raise errors.APIError(
1793
+ "API error occurred", http_res.status_code, http_res_text, http_res
1794
+ )
1795
+
1796
+ content_type = http_res.headers.get("Content-Type")
1797
+ http_res_text = utils.stream_to_text(http_res)
1798
+ raise errors.APIError(
1799
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1800
+ http_res.status_code,
1801
+ http_res_text,
1802
+ http_res,
1803
+ )
1804
+
1805
+ async def initiate_refund_async(
1806
+ self,
1807
+ *,
1808
+ x_idempotency_key: str,
1809
+ account_id: str,
1810
+ transfer_id: str,
1811
+ x_wait_for: Optional[components.TransferWaitFor] = None,
1812
+ amount: Optional[int] = None,
1813
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1814
+ server_url: Optional[str] = None,
1815
+ timeout_ms: Optional[int] = None,
1816
+ http_headers: Optional[Mapping[str, str]] = None,
1817
+ ) -> operations.InitiateRefundResponse:
1818
+ r"""Initiate a refund for a card transfer.
1819
+
1820
+ **Use the [Cancel or refund a card transfer](https://docs.moov.io/api/money-movement/refunds/cancel/) endpoint for more comprehensive cancel and refund options.**
1821
+ See the [reversals](https://docs.moov.io/guides/money-movement/accept-payments/card-acceptance/reversals/) guide for more information.
1822
+
1823
+ To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
1824
+ you'll need to specify the `/accounts/{accountID}/transfers.write` scope.
1825
+
1826
+ :param x_idempotency_key: Prevents duplicate refunds from being created.
1827
+ :param account_id: The merchant's Moov account ID.
1828
+ :param transfer_id: Identifier for the transfer.
1829
+ :param x_wait_for: Optional header that indicates whether to return a synchronous response that includes full transfer and rail-specific details or an asynchronous response indicating the transfer was created (this is the default response if the header is omitted).
1830
+ :param amount: Amount to refund in cents. If null, the original transfer's full amount will be refunded.
1831
+ :param retries: Override the default retry configuration for this method
1832
+ :param server_url: Override the default server URL for this method
1833
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1834
+ :param http_headers: Additional headers to set or replace on requests.
1835
+ """
1836
+ base_url = None
1837
+ url_variables = None
1838
+ if timeout_ms is None:
1839
+ timeout_ms = self.sdk_configuration.timeout_ms
1840
+
1841
+ if server_url is not None:
1842
+ base_url = server_url
1843
+ else:
1844
+ base_url = self._get_url(base_url, url_variables)
1845
+
1846
+ request = operations.InitiateRefundRequest(
1847
+ x_idempotency_key=x_idempotency_key,
1848
+ x_wait_for=x_wait_for,
1849
+ account_id=account_id,
1850
+ transfer_id=transfer_id,
1851
+ create_refund=components.CreateRefund(
1852
+ amount=amount,
1853
+ ),
1854
+ )
1855
+
1856
+ req = self._build_request_async(
1857
+ method="POST",
1858
+ path="/accounts/{accountID}/transfers/{transferID}/refunds",
1859
+ base_url=base_url,
1860
+ url_variables=url_variables,
1861
+ request=request,
1862
+ request_body_required=False,
1863
+ request_has_path_params=True,
1864
+ request_has_query_params=True,
1865
+ user_agent_header="user-agent",
1866
+ accept_header_value="application/json",
1867
+ http_headers=http_headers,
1868
+ _globals=operations.InitiateRefundGlobals(
1869
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
1870
+ ),
1871
+ security=self.sdk_configuration.security,
1872
+ get_serialized_body=lambda: utils.serialize_request_body(
1873
+ request.create_refund,
1874
+ False,
1875
+ True,
1876
+ "json",
1877
+ Optional[components.CreateRefund],
1878
+ ),
1879
+ timeout_ms=timeout_ms,
1880
+ )
1881
+
1882
+ if retries == UNSET:
1883
+ if self.sdk_configuration.retry_config is not UNSET:
1884
+ retries = self.sdk_configuration.retry_config
1885
+
1886
+ retry_config = None
1887
+ if isinstance(retries, utils.RetryConfig):
1888
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1889
+
1890
+ http_res = await self.do_request_async(
1891
+ hook_ctx=HookContext(
1892
+ base_url=base_url or "",
1893
+ operation_id="initiateRefund",
1894
+ oauth2_scopes=[],
1895
+ security_source=get_security_from_env(
1896
+ self.sdk_configuration.security, components.Security
1897
+ ),
1898
+ ),
1899
+ request=req,
1900
+ error_status_codes=[
1901
+ "400",
1902
+ "404",
1903
+ "409",
1904
+ "422",
1905
+ "429",
1906
+ "4XX",
1907
+ "500",
1908
+ "504",
1909
+ "5XX",
1910
+ ],
1911
+ retry_config=retry_config,
1912
+ )
1913
+
1914
+ response_data: Any = None
1915
+ if utils.match_response(http_res, "200", "application/json"):
1916
+ return operations.InitiateRefundResponse(
1917
+ result=utils.unmarshal_json(
1918
+ http_res.text, components.CreateRefundResponse
1919
+ ),
1920
+ headers=utils.get_response_headers(http_res.headers),
1921
+ )
1922
+ if utils.match_response(http_res, "202", "application/json"):
1923
+ return operations.InitiateRefundResponse(
1924
+ result=utils.unmarshal_json(
1925
+ http_res.text, components.CardAcquiringRefund
1926
+ ),
1927
+ headers=utils.get_response_headers(http_res.headers),
1928
+ )
1929
+ if utils.match_response(http_res, "400", "application/json"):
1930
+ response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
1931
+ raise errors.GenericError(data=response_data)
1932
+ if utils.match_response(http_res, "409", "application/json"):
1933
+ response_data = utils.unmarshal_json(
1934
+ http_res.text, errors.CardAcquiringRefundData
1935
+ )
1936
+ raise errors.CardAcquiringRefund(data=response_data)
1937
+ if utils.match_response(http_res, "422", "application/json"):
1938
+ response_data = utils.unmarshal_json(
1939
+ http_res.text, errors.RefundValidationErrorData
1940
+ )
1941
+ raise errors.RefundValidationError(data=response_data)
1942
+ if utils.match_response(http_res, ["404", "429"], "*"):
1943
+ http_res_text = await utils.stream_to_text_async(http_res)
1944
+ raise errors.APIError(
1945
+ "API error occurred", http_res.status_code, http_res_text, http_res
1946
+ )
1947
+ if utils.match_response(http_res, ["500", "504"], "*"):
1948
+ http_res_text = await utils.stream_to_text_async(http_res)
1949
+ raise errors.APIError(
1950
+ "API error occurred", http_res.status_code, http_res_text, http_res
1951
+ )
1952
+ if utils.match_response(http_res, "4XX", "*"):
1953
+ http_res_text = await utils.stream_to_text_async(http_res)
1954
+ raise errors.APIError(
1955
+ "API error occurred", http_res.status_code, http_res_text, http_res
1956
+ )
1957
+ if utils.match_response(http_res, "5XX", "*"):
1958
+ http_res_text = await utils.stream_to_text_async(http_res)
1959
+ raise errors.APIError(
1960
+ "API error occurred", http_res.status_code, http_res_text, http_res
1961
+ )
1962
+
1963
+ content_type = http_res.headers.get("Content-Type")
1964
+ http_res_text = await utils.stream_to_text_async(http_res)
1965
+ raise errors.APIError(
1966
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1967
+ http_res.status_code,
1968
+ http_res_text,
1969
+ http_res,
1970
+ )
1971
+
1972
+ def list_refunds(
1973
+ self,
1974
+ *,
1975
+ account_id: str,
1976
+ transfer_id: str,
1977
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1978
+ server_url: Optional[str] = None,
1979
+ timeout_ms: Optional[int] = None,
1980
+ http_headers: Optional[Mapping[str, str]] = None,
1981
+ ) -> operations.ListRefundsResponse:
1982
+ r"""Get a list of refunds for a card transfer.
1983
+
1984
+ To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
1985
+ you'll need to specify the `/accounts/{accountID}/transfers.read` scope.
1986
+
1987
+ :param account_id:
1988
+ :param transfer_id: Identifier for the transfer.
1989
+ :param retries: Override the default retry configuration for this method
1990
+ :param server_url: Override the default server URL for this method
1991
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1992
+ :param http_headers: Additional headers to set or replace on requests.
1993
+ """
1994
+ base_url = None
1995
+ url_variables = None
1996
+ if timeout_ms is None:
1997
+ timeout_ms = self.sdk_configuration.timeout_ms
1998
+
1999
+ if server_url is not None:
2000
+ base_url = server_url
2001
+ else:
2002
+ base_url = self._get_url(base_url, url_variables)
2003
+
2004
+ request = operations.ListRefundsRequest(
2005
+ account_id=account_id,
2006
+ transfer_id=transfer_id,
2007
+ )
2008
+
2009
+ req = self._build_request(
2010
+ method="GET",
2011
+ path="/accounts/{accountID}/transfers/{transferID}/refunds",
2012
+ base_url=base_url,
2013
+ url_variables=url_variables,
2014
+ request=request,
2015
+ request_body_required=False,
2016
+ request_has_path_params=True,
2017
+ request_has_query_params=True,
2018
+ user_agent_header="user-agent",
2019
+ accept_header_value="application/json",
2020
+ http_headers=http_headers,
2021
+ _globals=operations.ListRefundsGlobals(
2022
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
2023
+ ),
2024
+ security=self.sdk_configuration.security,
2025
+ timeout_ms=timeout_ms,
2026
+ )
2027
+
2028
+ if retries == UNSET:
2029
+ if self.sdk_configuration.retry_config is not UNSET:
2030
+ retries = self.sdk_configuration.retry_config
2031
+
2032
+ retry_config = None
2033
+ if isinstance(retries, utils.RetryConfig):
2034
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
2035
+
2036
+ http_res = self.do_request(
2037
+ hook_ctx=HookContext(
2038
+ base_url=base_url or "",
2039
+ operation_id="listRefunds",
2040
+ oauth2_scopes=[],
2041
+ security_source=get_security_from_env(
2042
+ self.sdk_configuration.security, components.Security
2043
+ ),
2044
+ ),
2045
+ request=req,
2046
+ error_status_codes=["401", "403", "429", "4XX", "500", "504", "5XX"],
2047
+ retry_config=retry_config,
2048
+ )
2049
+
2050
+ if utils.match_response(http_res, "200", "application/json"):
2051
+ return operations.ListRefundsResponse(
2052
+ result=utils.unmarshal_json(
2053
+ http_res.text, List[components.CardAcquiringRefund]
2054
+ ),
2055
+ headers=utils.get_response_headers(http_res.headers),
2056
+ )
2057
+ if utils.match_response(http_res, ["401", "403", "429"], "*"):
2058
+ http_res_text = utils.stream_to_text(http_res)
2059
+ raise errors.APIError(
2060
+ "API error occurred", http_res.status_code, http_res_text, http_res
2061
+ )
2062
+ if utils.match_response(http_res, ["500", "504"], "*"):
2063
+ http_res_text = utils.stream_to_text(http_res)
2064
+ raise errors.APIError(
2065
+ "API error occurred", http_res.status_code, http_res_text, http_res
2066
+ )
2067
+ if utils.match_response(http_res, "4XX", "*"):
2068
+ http_res_text = utils.stream_to_text(http_res)
2069
+ raise errors.APIError(
2070
+ "API error occurred", http_res.status_code, http_res_text, http_res
2071
+ )
2072
+ if utils.match_response(http_res, "5XX", "*"):
2073
+ http_res_text = utils.stream_to_text(http_res)
2074
+ raise errors.APIError(
2075
+ "API error occurred", http_res.status_code, http_res_text, http_res
2076
+ )
2077
+
2078
+ content_type = http_res.headers.get("Content-Type")
2079
+ http_res_text = utils.stream_to_text(http_res)
2080
+ raise errors.APIError(
2081
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2082
+ http_res.status_code,
2083
+ http_res_text,
2084
+ http_res,
2085
+ )
2086
+
2087
+ async def list_refunds_async(
2088
+ self,
2089
+ *,
2090
+ account_id: str,
2091
+ transfer_id: str,
2092
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
2093
+ server_url: Optional[str] = None,
2094
+ timeout_ms: Optional[int] = None,
2095
+ http_headers: Optional[Mapping[str, str]] = None,
2096
+ ) -> operations.ListRefundsResponse:
2097
+ r"""Get a list of refunds for a card transfer.
2098
+
2099
+ To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
2100
+ you'll need to specify the `/accounts/{accountID}/transfers.read` scope.
2101
+
2102
+ :param account_id:
2103
+ :param transfer_id: Identifier for the transfer.
2104
+ :param retries: Override the default retry configuration for this method
2105
+ :param server_url: Override the default server URL for this method
2106
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
2107
+ :param http_headers: Additional headers to set or replace on requests.
2108
+ """
2109
+ base_url = None
2110
+ url_variables = None
2111
+ if timeout_ms is None:
2112
+ timeout_ms = self.sdk_configuration.timeout_ms
2113
+
2114
+ if server_url is not None:
2115
+ base_url = server_url
2116
+ else:
2117
+ base_url = self._get_url(base_url, url_variables)
2118
+
2119
+ request = operations.ListRefundsRequest(
2120
+ account_id=account_id,
2121
+ transfer_id=transfer_id,
2122
+ )
2123
+
2124
+ req = self._build_request_async(
2125
+ method="GET",
2126
+ path="/accounts/{accountID}/transfers/{transferID}/refunds",
2127
+ base_url=base_url,
2128
+ url_variables=url_variables,
2129
+ request=request,
2130
+ request_body_required=False,
2131
+ request_has_path_params=True,
2132
+ request_has_query_params=True,
2133
+ user_agent_header="user-agent",
2134
+ accept_header_value="application/json",
2135
+ http_headers=http_headers,
2136
+ _globals=operations.ListRefundsGlobals(
2137
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
2138
+ ),
2139
+ security=self.sdk_configuration.security,
2140
+ timeout_ms=timeout_ms,
2141
+ )
2142
+
2143
+ if retries == UNSET:
2144
+ if self.sdk_configuration.retry_config is not UNSET:
2145
+ retries = self.sdk_configuration.retry_config
2146
+
2147
+ retry_config = None
2148
+ if isinstance(retries, utils.RetryConfig):
2149
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
2150
+
2151
+ http_res = await self.do_request_async(
2152
+ hook_ctx=HookContext(
2153
+ base_url=base_url or "",
2154
+ operation_id="listRefunds",
2155
+ oauth2_scopes=[],
2156
+ security_source=get_security_from_env(
2157
+ self.sdk_configuration.security, components.Security
2158
+ ),
2159
+ ),
2160
+ request=req,
2161
+ error_status_codes=["401", "403", "429", "4XX", "500", "504", "5XX"],
2162
+ retry_config=retry_config,
2163
+ )
2164
+
2165
+ if utils.match_response(http_res, "200", "application/json"):
2166
+ return operations.ListRefundsResponse(
2167
+ result=utils.unmarshal_json(
2168
+ http_res.text, List[components.CardAcquiringRefund]
2169
+ ),
2170
+ headers=utils.get_response_headers(http_res.headers),
2171
+ )
2172
+ if utils.match_response(http_res, ["401", "403", "429"], "*"):
2173
+ http_res_text = await utils.stream_to_text_async(http_res)
2174
+ raise errors.APIError(
2175
+ "API error occurred", http_res.status_code, http_res_text, http_res
2176
+ )
2177
+ if utils.match_response(http_res, ["500", "504"], "*"):
2178
+ http_res_text = await utils.stream_to_text_async(http_res)
2179
+ raise errors.APIError(
2180
+ "API error occurred", http_res.status_code, http_res_text, http_res
2181
+ )
2182
+ if utils.match_response(http_res, "4XX", "*"):
2183
+ http_res_text = await utils.stream_to_text_async(http_res)
2184
+ raise errors.APIError(
2185
+ "API error occurred", http_res.status_code, http_res_text, http_res
2186
+ )
2187
+ if utils.match_response(http_res, "5XX", "*"):
2188
+ http_res_text = await utils.stream_to_text_async(http_res)
2189
+ raise errors.APIError(
2190
+ "API error occurred", http_res.status_code, http_res_text, http_res
2191
+ )
2192
+
2193
+ content_type = http_res.headers.get("Content-Type")
2194
+ http_res_text = await utils.stream_to_text_async(http_res)
2195
+ raise errors.APIError(
2196
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2197
+ http_res.status_code,
2198
+ http_res_text,
2199
+ http_res,
2200
+ )
2201
+
2202
+ def get_refund(
2203
+ self,
2204
+ *,
2205
+ transfer_id: str,
2206
+ account_id: str,
2207
+ refund_id: str,
2208
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
2209
+ server_url: Optional[str] = None,
2210
+ timeout_ms: Optional[int] = None,
2211
+ http_headers: Optional[Mapping[str, str]] = None,
2212
+ ) -> operations.GetRefundResponse:
2213
+ r"""Get details of a refund for a card transfer.
2214
+
2215
+ To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
2216
+ you'll need to specify the `/accounts/{accountID}/transfers.read` scope.
2217
+
2218
+ :param transfer_id: Identifier for the transfer.
2219
+ :param account_id:
2220
+ :param refund_id: Identifier for the refund.
2221
+ :param retries: Override the default retry configuration for this method
2222
+ :param server_url: Override the default server URL for this method
2223
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
2224
+ :param http_headers: Additional headers to set or replace on requests.
2225
+ """
2226
+ base_url = None
2227
+ url_variables = None
2228
+ if timeout_ms is None:
2229
+ timeout_ms = self.sdk_configuration.timeout_ms
2230
+
2231
+ if server_url is not None:
2232
+ base_url = server_url
2233
+ else:
2234
+ base_url = self._get_url(base_url, url_variables)
2235
+
2236
+ request = operations.GetRefundRequest(
2237
+ transfer_id=transfer_id,
2238
+ account_id=account_id,
2239
+ refund_id=refund_id,
2240
+ )
2241
+
2242
+ req = self._build_request(
2243
+ method="GET",
2244
+ path="/accounts/{accountID}/transfers/{transferID}/refunds/{refundID}",
2245
+ base_url=base_url,
2246
+ url_variables=url_variables,
2247
+ request=request,
2248
+ request_body_required=False,
2249
+ request_has_path_params=True,
2250
+ request_has_query_params=True,
2251
+ user_agent_header="user-agent",
2252
+ accept_header_value="application/json",
2253
+ http_headers=http_headers,
2254
+ _globals=operations.GetRefundGlobals(
2255
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
2256
+ ),
2257
+ security=self.sdk_configuration.security,
2258
+ timeout_ms=timeout_ms,
2259
+ )
2260
+
2261
+ if retries == UNSET:
2262
+ if self.sdk_configuration.retry_config is not UNSET:
2263
+ retries = self.sdk_configuration.retry_config
2264
+
2265
+ retry_config = None
2266
+ if isinstance(retries, utils.RetryConfig):
2267
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
2268
+
2269
+ http_res = self.do_request(
2270
+ hook_ctx=HookContext(
2271
+ base_url=base_url or "",
2272
+ operation_id="getRefund",
2273
+ oauth2_scopes=[],
2274
+ security_source=get_security_from_env(
2275
+ self.sdk_configuration.security, components.Security
2276
+ ),
2277
+ ),
2278
+ request=req,
2279
+ error_status_codes=["401", "403", "404", "429", "4XX", "500", "504", "5XX"],
2280
+ retry_config=retry_config,
2281
+ )
2282
+
2283
+ if utils.match_response(http_res, "200", "application/json"):
2284
+ return operations.GetRefundResponse(
2285
+ result=utils.unmarshal_json(
2286
+ http_res.text, components.CardAcquiringRefund
2287
+ ),
2288
+ headers=utils.get_response_headers(http_res.headers),
2289
+ )
2290
+ if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
2291
+ http_res_text = utils.stream_to_text(http_res)
2292
+ raise errors.APIError(
2293
+ "API error occurred", http_res.status_code, http_res_text, http_res
2294
+ )
2295
+ if utils.match_response(http_res, ["500", "504"], "*"):
2296
+ http_res_text = utils.stream_to_text(http_res)
2297
+ raise errors.APIError(
2298
+ "API error occurred", http_res.status_code, http_res_text, http_res
2299
+ )
2300
+ if utils.match_response(http_res, "4XX", "*"):
2301
+ http_res_text = utils.stream_to_text(http_res)
2302
+ raise errors.APIError(
2303
+ "API error occurred", http_res.status_code, http_res_text, http_res
2304
+ )
2305
+ if utils.match_response(http_res, "5XX", "*"):
2306
+ http_res_text = utils.stream_to_text(http_res)
2307
+ raise errors.APIError(
2308
+ "API error occurred", http_res.status_code, http_res_text, http_res
2309
+ )
2310
+
2311
+ content_type = http_res.headers.get("Content-Type")
2312
+ http_res_text = utils.stream_to_text(http_res)
2313
+ raise errors.APIError(
2314
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2315
+ http_res.status_code,
2316
+ http_res_text,
2317
+ http_res,
2318
+ )
2319
+
2320
+ async def get_refund_async(
2321
+ self,
2322
+ *,
2323
+ transfer_id: str,
2324
+ account_id: str,
2325
+ refund_id: str,
2326
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
2327
+ server_url: Optional[str] = None,
2328
+ timeout_ms: Optional[int] = None,
2329
+ http_headers: Optional[Mapping[str, str]] = None,
2330
+ ) -> operations.GetRefundResponse:
2331
+ r"""Get details of a refund for a card transfer.
2332
+
2333
+ To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
2334
+ you'll need to specify the `/accounts/{accountID}/transfers.read` scope.
2335
+
2336
+ :param transfer_id: Identifier for the transfer.
2337
+ :param account_id:
2338
+ :param refund_id: Identifier for the refund.
2339
+ :param retries: Override the default retry configuration for this method
2340
+ :param server_url: Override the default server URL for this method
2341
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
2342
+ :param http_headers: Additional headers to set or replace on requests.
2343
+ """
2344
+ base_url = None
2345
+ url_variables = None
2346
+ if timeout_ms is None:
2347
+ timeout_ms = self.sdk_configuration.timeout_ms
2348
+
2349
+ if server_url is not None:
2350
+ base_url = server_url
2351
+ else:
2352
+ base_url = self._get_url(base_url, url_variables)
2353
+
2354
+ request = operations.GetRefundRequest(
2355
+ transfer_id=transfer_id,
2356
+ account_id=account_id,
2357
+ refund_id=refund_id,
2358
+ )
2359
+
2360
+ req = self._build_request_async(
2361
+ method="GET",
2362
+ path="/accounts/{accountID}/transfers/{transferID}/refunds/{refundID}",
2363
+ base_url=base_url,
2364
+ url_variables=url_variables,
2365
+ request=request,
2366
+ request_body_required=False,
2367
+ request_has_path_params=True,
2368
+ request_has_query_params=True,
2369
+ user_agent_header="user-agent",
2370
+ accept_header_value="application/json",
2371
+ http_headers=http_headers,
2372
+ _globals=operations.GetRefundGlobals(
2373
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
2374
+ ),
2375
+ security=self.sdk_configuration.security,
2376
+ timeout_ms=timeout_ms,
2377
+ )
2378
+
2379
+ if retries == UNSET:
2380
+ if self.sdk_configuration.retry_config is not UNSET:
2381
+ retries = self.sdk_configuration.retry_config
2382
+
2383
+ retry_config = None
2384
+ if isinstance(retries, utils.RetryConfig):
2385
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
2386
+
2387
+ http_res = await self.do_request_async(
2388
+ hook_ctx=HookContext(
2389
+ base_url=base_url or "",
2390
+ operation_id="getRefund",
2391
+ oauth2_scopes=[],
2392
+ security_source=get_security_from_env(
2393
+ self.sdk_configuration.security, components.Security
2394
+ ),
2395
+ ),
2396
+ request=req,
2397
+ error_status_codes=["401", "403", "404", "429", "4XX", "500", "504", "5XX"],
2398
+ retry_config=retry_config,
2399
+ )
2400
+
2401
+ if utils.match_response(http_res, "200", "application/json"):
2402
+ return operations.GetRefundResponse(
2403
+ result=utils.unmarshal_json(
2404
+ http_res.text, components.CardAcquiringRefund
2405
+ ),
2406
+ headers=utils.get_response_headers(http_res.headers),
2407
+ )
2408
+ if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
2409
+ http_res_text = await utils.stream_to_text_async(http_res)
2410
+ raise errors.APIError(
2411
+ "API error occurred", http_res.status_code, http_res_text, http_res
2412
+ )
2413
+ if utils.match_response(http_res, ["500", "504"], "*"):
2414
+ http_res_text = await utils.stream_to_text_async(http_res)
2415
+ raise errors.APIError(
2416
+ "API error occurred", http_res.status_code, http_res_text, http_res
2417
+ )
2418
+ if utils.match_response(http_res, "4XX", "*"):
2419
+ http_res_text = await utils.stream_to_text_async(http_res)
2420
+ raise errors.APIError(
2421
+ "API error occurred", http_res.status_code, http_res_text, http_res
2422
+ )
2423
+ if utils.match_response(http_res, "5XX", "*"):
2424
+ http_res_text = await utils.stream_to_text_async(http_res)
2425
+ raise errors.APIError(
2426
+ "API error occurred", http_res.status_code, http_res_text, http_res
2427
+ )
2428
+
2429
+ content_type = http_res.headers.get("Content-Type")
2430
+ http_res_text = await utils.stream_to_text_async(http_res)
2431
+ raise errors.APIError(
2432
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2433
+ http_res.status_code,
2434
+ http_res_text,
2435
+ http_res,
2436
+ )
2437
+
2438
+ def create_reversal(
2439
+ self,
2440
+ *,
2441
+ x_idempotency_key: str,
2442
+ account_id: str,
2443
+ transfer_id: str,
2444
+ amount: int,
2445
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
2446
+ server_url: Optional[str] = None,
2447
+ timeout_ms: Optional[int] = None,
2448
+ http_headers: Optional[Mapping[str, str]] = None,
2449
+ ) -> operations.CreateReversalResponse:
2450
+ r"""Reverses a card transfer by initiating a cancellation or refund depending on the transaction status.
2451
+ Read our [reversals guide](https://docs.moov.io/guides/money-movement/accept-payments/card-acceptance/reversals/)
2452
+ to learn more.
2453
+
2454
+ To access this endpoint using a [token](https://docs.moov.io/api/authentication/access-tokens/) you'll need
2455
+ to specify the `/accounts/{accountID}/transfers.write` scope.
2456
+
2457
+ :param x_idempotency_key: Prevents duplicate reversals from being created.
2458
+ :param account_id: The Moov account ID.
2459
+ :param transfer_id: The transfer ID to reverse.
2460
+ :param amount: Amount to reverse in cents. Partial amounts will automatically trigger a refund instead of a cancellation.
2461
+ :param retries: Override the default retry configuration for this method
2462
+ :param server_url: Override the default server URL for this method
2463
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
2464
+ :param http_headers: Additional headers to set or replace on requests.
2465
+ """
2466
+ base_url = None
2467
+ url_variables = None
2468
+ if timeout_ms is None:
2469
+ timeout_ms = self.sdk_configuration.timeout_ms
2470
+
2471
+ if server_url is not None:
2472
+ base_url = server_url
2473
+ else:
2474
+ base_url = self._get_url(base_url, url_variables)
2475
+
2476
+ request = operations.CreateReversalRequest(
2477
+ x_idempotency_key=x_idempotency_key,
2478
+ account_id=account_id,
2479
+ transfer_id=transfer_id,
2480
+ create_reversal=components.CreateReversal(
2481
+ amount=amount,
2482
+ ),
2483
+ )
2484
+
2485
+ req = self._build_request(
2486
+ method="POST",
2487
+ path="/accounts/{accountID}/transfers/{transferID}/reversals",
2488
+ base_url=base_url,
2489
+ url_variables=url_variables,
2490
+ request=request,
2491
+ request_body_required=False,
2492
+ request_has_path_params=True,
2493
+ request_has_query_params=True,
2494
+ user_agent_header="user-agent",
2495
+ accept_header_value="application/json",
2496
+ http_headers=http_headers,
2497
+ _globals=operations.CreateReversalGlobals(
2498
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
2499
+ ),
2500
+ security=self.sdk_configuration.security,
2501
+ get_serialized_body=lambda: utils.serialize_request_body(
2502
+ request.create_reversal,
2503
+ False,
2504
+ True,
2505
+ "json",
2506
+ Optional[components.CreateReversal],
2507
+ ),
2508
+ timeout_ms=timeout_ms,
2509
+ )
2510
+
2511
+ if retries == UNSET:
2512
+ if self.sdk_configuration.retry_config is not UNSET:
2513
+ retries = self.sdk_configuration.retry_config
2514
+
2515
+ retry_config = None
2516
+ if isinstance(retries, utils.RetryConfig):
2517
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
2518
+
2519
+ http_res = self.do_request(
2520
+ hook_ctx=HookContext(
2521
+ base_url=base_url or "",
2522
+ operation_id="createReversal",
2523
+ oauth2_scopes=[],
2524
+ security_source=get_security_from_env(
2525
+ self.sdk_configuration.security, components.Security
2526
+ ),
2527
+ ),
2528
+ request=req,
2529
+ error_status_codes=[
2530
+ "400",
2531
+ "401",
2532
+ "403",
2533
+ "404",
2534
+ "409",
2535
+ "422",
2536
+ "429",
2537
+ "4XX",
2538
+ "500",
2539
+ "504",
2540
+ "5XX",
2541
+ ],
2542
+ retry_config=retry_config,
2543
+ )
2544
+
2545
+ response_data: Any = None
2546
+ if utils.match_response(http_res, ["200", "202"], "application/json"):
2547
+ return operations.CreateReversalResponse(
2548
+ result=utils.unmarshal_json(http_res.text, components.Reversal),
2549
+ headers=utils.get_response_headers(http_res.headers),
2550
+ )
2551
+ if utils.match_response(http_res, ["400", "409"], "application/json"):
2552
+ response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
2553
+ raise errors.GenericError(data=response_data)
2554
+ if utils.match_response(http_res, "422", "application/json"):
2555
+ response_data = utils.unmarshal_json(
2556
+ http_res.text, errors.ReversalValidationErrorData
2557
+ )
2558
+ raise errors.ReversalValidationError(data=response_data)
2559
+ if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
2560
+ http_res_text = utils.stream_to_text(http_res)
2561
+ raise errors.APIError(
2562
+ "API error occurred", http_res.status_code, http_res_text, http_res
2563
+ )
2564
+ if utils.match_response(http_res, ["500", "504"], "*"):
2565
+ http_res_text = utils.stream_to_text(http_res)
2566
+ raise errors.APIError(
2567
+ "API error occurred", http_res.status_code, http_res_text, http_res
2568
+ )
2569
+ if utils.match_response(http_res, "4XX", "*"):
2570
+ http_res_text = utils.stream_to_text(http_res)
2571
+ raise errors.APIError(
2572
+ "API error occurred", http_res.status_code, http_res_text, http_res
2573
+ )
2574
+ if utils.match_response(http_res, "5XX", "*"):
2575
+ http_res_text = utils.stream_to_text(http_res)
2576
+ raise errors.APIError(
2577
+ "API error occurred", http_res.status_code, http_res_text, http_res
2578
+ )
2579
+
2580
+ content_type = http_res.headers.get("Content-Type")
2581
+ http_res_text = utils.stream_to_text(http_res)
2582
+ raise errors.APIError(
2583
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2584
+ http_res.status_code,
2585
+ http_res_text,
2586
+ http_res,
2587
+ )
2588
+
2589
+ async def create_reversal_async(
2590
+ self,
2591
+ *,
2592
+ x_idempotency_key: str,
2593
+ account_id: str,
2594
+ transfer_id: str,
2595
+ amount: int,
2596
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
2597
+ server_url: Optional[str] = None,
2598
+ timeout_ms: Optional[int] = None,
2599
+ http_headers: Optional[Mapping[str, str]] = None,
2600
+ ) -> operations.CreateReversalResponse:
2601
+ r"""Reverses a card transfer by initiating a cancellation or refund depending on the transaction status.
2602
+ Read our [reversals guide](https://docs.moov.io/guides/money-movement/accept-payments/card-acceptance/reversals/)
2603
+ to learn more.
2604
+
2605
+ To access this endpoint using a [token](https://docs.moov.io/api/authentication/access-tokens/) you'll need
2606
+ to specify the `/accounts/{accountID}/transfers.write` scope.
2607
+
2608
+ :param x_idempotency_key: Prevents duplicate reversals from being created.
2609
+ :param account_id: The Moov account ID.
2610
+ :param transfer_id: The transfer ID to reverse.
2611
+ :param amount: Amount to reverse in cents. Partial amounts will automatically trigger a refund instead of a cancellation.
2612
+ :param retries: Override the default retry configuration for this method
2613
+ :param server_url: Override the default server URL for this method
2614
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
2615
+ :param http_headers: Additional headers to set or replace on requests.
2616
+ """
2617
+ base_url = None
2618
+ url_variables = None
2619
+ if timeout_ms is None:
2620
+ timeout_ms = self.sdk_configuration.timeout_ms
2621
+
2622
+ if server_url is not None:
2623
+ base_url = server_url
2624
+ else:
2625
+ base_url = self._get_url(base_url, url_variables)
2626
+
2627
+ request = operations.CreateReversalRequest(
2628
+ x_idempotency_key=x_idempotency_key,
2629
+ account_id=account_id,
2630
+ transfer_id=transfer_id,
2631
+ create_reversal=components.CreateReversal(
2632
+ amount=amount,
2633
+ ),
2634
+ )
2635
+
2636
+ req = self._build_request_async(
2637
+ method="POST",
2638
+ path="/accounts/{accountID}/transfers/{transferID}/reversals",
2639
+ base_url=base_url,
2640
+ url_variables=url_variables,
2641
+ request=request,
2642
+ request_body_required=False,
2643
+ request_has_path_params=True,
2644
+ request_has_query_params=True,
2645
+ user_agent_header="user-agent",
2646
+ accept_header_value="application/json",
2647
+ http_headers=http_headers,
2648
+ _globals=operations.CreateReversalGlobals(
2649
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
2650
+ ),
2651
+ security=self.sdk_configuration.security,
2652
+ get_serialized_body=lambda: utils.serialize_request_body(
2653
+ request.create_reversal,
2654
+ False,
2655
+ True,
2656
+ "json",
2657
+ Optional[components.CreateReversal],
2658
+ ),
2659
+ timeout_ms=timeout_ms,
2660
+ )
2661
+
2662
+ if retries == UNSET:
2663
+ if self.sdk_configuration.retry_config is not UNSET:
2664
+ retries = self.sdk_configuration.retry_config
2665
+
2666
+ retry_config = None
2667
+ if isinstance(retries, utils.RetryConfig):
2668
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
2669
+
2670
+ http_res = await self.do_request_async(
2671
+ hook_ctx=HookContext(
2672
+ base_url=base_url or "",
2673
+ operation_id="createReversal",
2674
+ oauth2_scopes=[],
2675
+ security_source=get_security_from_env(
2676
+ self.sdk_configuration.security, components.Security
2677
+ ),
2678
+ ),
2679
+ request=req,
2680
+ error_status_codes=[
2681
+ "400",
2682
+ "401",
2683
+ "403",
2684
+ "404",
2685
+ "409",
2686
+ "422",
2687
+ "429",
2688
+ "4XX",
2689
+ "500",
2690
+ "504",
2691
+ "5XX",
2692
+ ],
2693
+ retry_config=retry_config,
2694
+ )
2695
+
2696
+ response_data: Any = None
2697
+ if utils.match_response(http_res, ["200", "202"], "application/json"):
2698
+ return operations.CreateReversalResponse(
2699
+ result=utils.unmarshal_json(http_res.text, components.Reversal),
2700
+ headers=utils.get_response_headers(http_res.headers),
2701
+ )
2702
+ if utils.match_response(http_res, ["400", "409"], "application/json"):
2703
+ response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
2704
+ raise errors.GenericError(data=response_data)
2705
+ if utils.match_response(http_res, "422", "application/json"):
2706
+ response_data = utils.unmarshal_json(
2707
+ http_res.text, errors.ReversalValidationErrorData
2708
+ )
2709
+ raise errors.ReversalValidationError(data=response_data)
2710
+ if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
2711
+ http_res_text = await utils.stream_to_text_async(http_res)
2712
+ raise errors.APIError(
2713
+ "API error occurred", http_res.status_code, http_res_text, http_res
2714
+ )
2715
+ if utils.match_response(http_res, ["500", "504"], "*"):
2716
+ http_res_text = await utils.stream_to_text_async(http_res)
2717
+ raise errors.APIError(
2718
+ "API error occurred", http_res.status_code, http_res_text, http_res
2719
+ )
2720
+ if utils.match_response(http_res, "4XX", "*"):
2721
+ http_res_text = await utils.stream_to_text_async(http_res)
2722
+ raise errors.APIError(
2723
+ "API error occurred", http_res.status_code, http_res_text, http_res
2724
+ )
2725
+ if utils.match_response(http_res, "5XX", "*"):
2726
+ http_res_text = await utils.stream_to_text_async(http_res)
2727
+ raise errors.APIError(
2728
+ "API error occurred", http_res.status_code, http_res_text, http_res
2729
+ )
2730
+
2731
+ content_type = http_res.headers.get("Content-Type")
2732
+ http_res_text = await utils.stream_to_text_async(http_res)
2733
+ raise errors.APIError(
2734
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2735
+ http_res.status_code,
2736
+ http_res_text,
2737
+ http_res,
2738
+ )
2739
+
2740
+ def generate_options(
2741
+ self,
2742
+ *,
2743
+ source: Union[
2744
+ components.SourceDestinationOptions,
2745
+ components.SourceDestinationOptionsTypedDict,
2746
+ ],
2747
+ destination: Union[
2748
+ components.SourceDestinationOptions,
2749
+ components.SourceDestinationOptionsTypedDict,
2750
+ ],
2751
+ amount: Union[components.Amount, components.AmountTypedDict],
2752
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
2753
+ server_url: Optional[str] = None,
2754
+ timeout_ms: Optional[int] = None,
2755
+ http_headers: Optional[Mapping[str, str]] = None,
2756
+ ) -> operations.CreateTransferOptionsResponse:
2757
+ r"""Generate available payment method options for one or multiple transfer participants depending on the accountID or paymentMethodID you
2758
+ supply in the request.
2759
+
2760
+ Read our [transfers overview guide](https://docs.moov.io/guides/money-movement/overview/) to learn more.
2761
+
2762
+ To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
2763
+ you'll need to specify the `/accounts/{accountID}/transfers.read` scope.
2764
+
2765
+ :param source:
2766
+ :param destination:
2767
+ :param amount:
2768
+ :param retries: Override the default retry configuration for this method
2769
+ :param server_url: Override the default server URL for this method
2770
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
2771
+ :param http_headers: Additional headers to set or replace on requests.
2772
+ """
2773
+ base_url = None
2774
+ url_variables = None
2775
+ if timeout_ms is None:
2776
+ timeout_ms = self.sdk_configuration.timeout_ms
2777
+
2778
+ if server_url is not None:
2779
+ base_url = server_url
2780
+ else:
2781
+ base_url = self._get_url(base_url, url_variables)
2782
+
2783
+ request = components.CreateTransferOptions(
2784
+ source=utils.get_pydantic_model(
2785
+ source, components.SourceDestinationOptions
2786
+ ),
2787
+ destination=utils.get_pydantic_model(
2788
+ destination, components.SourceDestinationOptions
2789
+ ),
2790
+ amount=utils.get_pydantic_model(amount, components.Amount),
2791
+ )
2792
+
2793
+ req = self._build_request(
2794
+ method="POST",
2795
+ path="/transfer-options",
2796
+ base_url=base_url,
2797
+ url_variables=url_variables,
2798
+ request=request,
2799
+ request_body_required=True,
2800
+ request_has_path_params=False,
2801
+ request_has_query_params=True,
2802
+ user_agent_header="user-agent",
2803
+ accept_header_value="application/json",
2804
+ http_headers=http_headers,
2805
+ _globals=operations.CreateTransferOptionsGlobals(
2806
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
2807
+ ),
2808
+ security=self.sdk_configuration.security,
2809
+ get_serialized_body=lambda: utils.serialize_request_body(
2810
+ request, False, False, "json", components.CreateTransferOptions
2811
+ ),
2812
+ timeout_ms=timeout_ms,
2813
+ )
2814
+
2815
+ if retries == UNSET:
2816
+ if self.sdk_configuration.retry_config is not UNSET:
2817
+ retries = self.sdk_configuration.retry_config
2818
+
2819
+ retry_config = None
2820
+ if isinstance(retries, utils.RetryConfig):
2821
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
2822
+
2823
+ http_res = self.do_request(
2824
+ hook_ctx=HookContext(
2825
+ base_url=base_url or "",
2826
+ operation_id="createTransferOptions",
2827
+ oauth2_scopes=[],
2828
+ security_source=get_security_from_env(
2829
+ self.sdk_configuration.security, components.Security
2830
+ ),
2831
+ ),
2832
+ request=req,
2833
+ error_status_codes=[
2834
+ "400",
2835
+ "401",
2836
+ "403",
2837
+ "422",
2838
+ "429",
2839
+ "4XX",
2840
+ "500",
2841
+ "504",
2842
+ "5XX",
2843
+ ],
2844
+ retry_config=retry_config,
2845
+ )
2846
+
2847
+ response_data: Any = None
2848
+ if utils.match_response(http_res, "200", "application/json"):
2849
+ return operations.CreateTransferOptionsResponse(
2850
+ result=utils.unmarshal_json(http_res.text, components.TransferOptions),
2851
+ headers=utils.get_response_headers(http_res.headers),
2852
+ )
2853
+ if utils.match_response(http_res, "400", "application/json"):
2854
+ response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
2855
+ raise errors.GenericError(data=response_data)
2856
+ if utils.match_response(http_res, "422", "application/json"):
2857
+ response_data = utils.unmarshal_json(
2858
+ http_res.text, errors.TransferOptionsValidationErrorData
2859
+ )
2860
+ raise errors.TransferOptionsValidationError(data=response_data)
2861
+ if utils.match_response(http_res, ["401", "403", "429"], "*"):
2862
+ http_res_text = utils.stream_to_text(http_res)
2863
+ raise errors.APIError(
2864
+ "API error occurred", http_res.status_code, http_res_text, http_res
2865
+ )
2866
+ if utils.match_response(http_res, ["500", "504"], "*"):
2867
+ http_res_text = utils.stream_to_text(http_res)
2868
+ raise errors.APIError(
2869
+ "API error occurred", http_res.status_code, http_res_text, http_res
2870
+ )
2871
+ if utils.match_response(http_res, "4XX", "*"):
2872
+ http_res_text = utils.stream_to_text(http_res)
2873
+ raise errors.APIError(
2874
+ "API error occurred", http_res.status_code, http_res_text, http_res
2875
+ )
2876
+ if utils.match_response(http_res, "5XX", "*"):
2877
+ http_res_text = utils.stream_to_text(http_res)
2878
+ raise errors.APIError(
2879
+ "API error occurred", http_res.status_code, http_res_text, http_res
2880
+ )
2881
+
2882
+ content_type = http_res.headers.get("Content-Type")
2883
+ http_res_text = utils.stream_to_text(http_res)
2884
+ raise errors.APIError(
2885
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2886
+ http_res.status_code,
2887
+ http_res_text,
2888
+ http_res,
2889
+ )
2890
+
2891
+ async def generate_options_async(
2892
+ self,
2893
+ *,
2894
+ source: Union[
2895
+ components.SourceDestinationOptions,
2896
+ components.SourceDestinationOptionsTypedDict,
2897
+ ],
2898
+ destination: Union[
2899
+ components.SourceDestinationOptions,
2900
+ components.SourceDestinationOptionsTypedDict,
2901
+ ],
2902
+ amount: Union[components.Amount, components.AmountTypedDict],
2903
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
2904
+ server_url: Optional[str] = None,
2905
+ timeout_ms: Optional[int] = None,
2906
+ http_headers: Optional[Mapping[str, str]] = None,
2907
+ ) -> operations.CreateTransferOptionsResponse:
2908
+ r"""Generate available payment method options for one or multiple transfer participants depending on the accountID or paymentMethodID you
2909
+ supply in the request.
2910
+
2911
+ Read our [transfers overview guide](https://docs.moov.io/guides/money-movement/overview/) to learn more.
2912
+
2913
+ To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
2914
+ you'll need to specify the `/accounts/{accountID}/transfers.read` scope.
2915
+
2916
+ :param source:
2917
+ :param destination:
2918
+ :param amount:
2919
+ :param retries: Override the default retry configuration for this method
2920
+ :param server_url: Override the default server URL for this method
2921
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
2922
+ :param http_headers: Additional headers to set or replace on requests.
2923
+ """
2924
+ base_url = None
2925
+ url_variables = None
2926
+ if timeout_ms is None:
2927
+ timeout_ms = self.sdk_configuration.timeout_ms
2928
+
2929
+ if server_url is not None:
2930
+ base_url = server_url
2931
+ else:
2932
+ base_url = self._get_url(base_url, url_variables)
2933
+
2934
+ request = components.CreateTransferOptions(
2935
+ source=utils.get_pydantic_model(
2936
+ source, components.SourceDestinationOptions
2937
+ ),
2938
+ destination=utils.get_pydantic_model(
2939
+ destination, components.SourceDestinationOptions
2940
+ ),
2941
+ amount=utils.get_pydantic_model(amount, components.Amount),
2942
+ )
2943
+
2944
+ req = self._build_request_async(
2945
+ method="POST",
2946
+ path="/transfer-options",
2947
+ base_url=base_url,
2948
+ url_variables=url_variables,
2949
+ request=request,
2950
+ request_body_required=True,
2951
+ request_has_path_params=False,
2952
+ request_has_query_params=True,
2953
+ user_agent_header="user-agent",
2954
+ accept_header_value="application/json",
2955
+ http_headers=http_headers,
2956
+ _globals=operations.CreateTransferOptionsGlobals(
2957
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
2958
+ ),
2959
+ security=self.sdk_configuration.security,
2960
+ get_serialized_body=lambda: utils.serialize_request_body(
2961
+ request, False, False, "json", components.CreateTransferOptions
2962
+ ),
2963
+ timeout_ms=timeout_ms,
2964
+ )
2965
+
2966
+ if retries == UNSET:
2967
+ if self.sdk_configuration.retry_config is not UNSET:
2968
+ retries = self.sdk_configuration.retry_config
2969
+
2970
+ retry_config = None
2971
+ if isinstance(retries, utils.RetryConfig):
2972
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
2973
+
2974
+ http_res = await self.do_request_async(
2975
+ hook_ctx=HookContext(
2976
+ base_url=base_url or "",
2977
+ operation_id="createTransferOptions",
2978
+ oauth2_scopes=[],
2979
+ security_source=get_security_from_env(
2980
+ self.sdk_configuration.security, components.Security
2981
+ ),
2982
+ ),
2983
+ request=req,
2984
+ error_status_codes=[
2985
+ "400",
2986
+ "401",
2987
+ "403",
2988
+ "422",
2989
+ "429",
2990
+ "4XX",
2991
+ "500",
2992
+ "504",
2993
+ "5XX",
2994
+ ],
2995
+ retry_config=retry_config,
2996
+ )
2997
+
2998
+ response_data: Any = None
2999
+ if utils.match_response(http_res, "200", "application/json"):
3000
+ return operations.CreateTransferOptionsResponse(
3001
+ result=utils.unmarshal_json(http_res.text, components.TransferOptions),
3002
+ headers=utils.get_response_headers(http_res.headers),
3003
+ )
3004
+ if utils.match_response(http_res, "400", "application/json"):
3005
+ response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
3006
+ raise errors.GenericError(data=response_data)
3007
+ if utils.match_response(http_res, "422", "application/json"):
3008
+ response_data = utils.unmarshal_json(
3009
+ http_res.text, errors.TransferOptionsValidationErrorData
3010
+ )
3011
+ raise errors.TransferOptionsValidationError(data=response_data)
3012
+ if utils.match_response(http_res, ["401", "403", "429"], "*"):
3013
+ http_res_text = await utils.stream_to_text_async(http_res)
3014
+ raise errors.APIError(
3015
+ "API error occurred", http_res.status_code, http_res_text, http_res
3016
+ )
3017
+ if utils.match_response(http_res, ["500", "504"], "*"):
3018
+ http_res_text = await utils.stream_to_text_async(http_res)
3019
+ raise errors.APIError(
3020
+ "API error occurred", http_res.status_code, http_res_text, http_res
3021
+ )
3022
+ if utils.match_response(http_res, "4XX", "*"):
3023
+ http_res_text = await utils.stream_to_text_async(http_res)
3024
+ raise errors.APIError(
3025
+ "API error occurred", http_res.status_code, http_res_text, http_res
3026
+ )
3027
+ if utils.match_response(http_res, "5XX", "*"):
3028
+ http_res_text = await utils.stream_to_text_async(http_res)
3029
+ raise errors.APIError(
3030
+ "API error occurred", http_res.status_code, http_res_text, http_res
3031
+ )
3032
+
3033
+ content_type = http_res.headers.get("Content-Type")
3034
+ http_res_text = await utils.stream_to_text_async(http_res)
3035
+ raise errors.APIError(
3036
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
3037
+ http_res.status_code,
3038
+ http_res_text,
3039
+ http_res,
3040
+ )