moovio_sdk 0.12.0__py3-none-any.whl → 0.13.1__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 (99) hide show
  1. moovio_sdk/_version.py +3 -3
  2. moovio_sdk/account_terminal_applications.py +70 -186
  3. moovio_sdk/accounts.py +168 -408
  4. moovio_sdk/adjustments.py +28 -84
  5. moovio_sdk/apple_pay.py +102 -236
  6. moovio_sdk/authentication.py +50 -102
  7. moovio_sdk/avatars.py +10 -38
  8. moovio_sdk/bank_accounts.py +174 -420
  9. moovio_sdk/basesdk.py +4 -4
  10. moovio_sdk/branding.py +106 -198
  11. moovio_sdk/capabilities.py +76 -180
  12. moovio_sdk/card_issuing.py +94 -228
  13. moovio_sdk/cards.py +94 -232
  14. moovio_sdk/disputes.py +204 -500
  15. moovio_sdk/end_to_end_encryption.py +28 -80
  16. moovio_sdk/enriched_address.py +14 -44
  17. moovio_sdk/enriched_profile.py +14 -44
  18. moovio_sdk/fee_plans.py +116 -314
  19. moovio_sdk/files.py +52 -138
  20. moovio_sdk/industries.py +14 -44
  21. moovio_sdk/institutions.py +36 -92
  22. moovio_sdk/issuing_transactions.py +70 -220
  23. moovio_sdk/models/components/__init__.py +39 -0
  24. moovio_sdk/models/components/createticket.py +24 -0
  25. moovio_sdk/models/components/createticketcontacterror.py +17 -0
  26. moovio_sdk/models/components/ticket.py +44 -0
  27. moovio_sdk/models/components/ticketcontact.py +17 -0
  28. moovio_sdk/models/components/ticketmessage.py +21 -0
  29. moovio_sdk/models/components/ticketstatus.py +11 -0
  30. moovio_sdk/models/components/updateticket.py +19 -0
  31. moovio_sdk/models/components/updateticketstatus.py +8 -0
  32. moovio_sdk/models/errors/__init__.py +19 -0
  33. moovio_sdk/models/errors/accountterminalapplicationerror.py +11 -6
  34. moovio_sdk/models/errors/addcapabilitieserror.py +11 -6
  35. moovio_sdk/models/errors/apierror.py +30 -14
  36. moovio_sdk/models/errors/assigncountrieserror.py +12 -6
  37. moovio_sdk/models/errors/authtokenrequesterror.py +11 -6
  38. moovio_sdk/models/errors/bankaccountvalidationerror.py +11 -6
  39. moovio_sdk/models/errors/brandvalidationerror.py +11 -6
  40. moovio_sdk/models/errors/cardacquiringrefund.py +11 -6
  41. moovio_sdk/models/errors/createaccount.py +12 -6
  42. moovio_sdk/models/errors/createpaymentlinkerror.py +11 -6
  43. moovio_sdk/models/errors/createsweepconfigerror.py +11 -6
  44. moovio_sdk/models/errors/createticketerror.py +34 -0
  45. moovio_sdk/models/errors/feeplanagreementerror.py +11 -6
  46. moovio_sdk/models/errors/fileuploadvalidationerror.py +11 -6
  47. moovio_sdk/models/errors/filevalidationerror.py +11 -6
  48. moovio_sdk/models/errors/genericerror.py +12 -6
  49. moovio_sdk/models/errors/linkapplepayerror.py +11 -6
  50. moovio_sdk/models/errors/linkcarderror.py +11 -6
  51. moovio_sdk/models/errors/microdepositvalidationerror.py +11 -6
  52. moovio_sdk/models/errors/mooverror.py +26 -0
  53. moovio_sdk/models/errors/no_response_error.py +13 -0
  54. moovio_sdk/models/errors/onboardinginviteerror.py +11 -6
  55. moovio_sdk/models/errors/patchsweepconfigerror.py +11 -6
  56. moovio_sdk/models/errors/refundvalidationerror.py +11 -6
  57. moovio_sdk/models/errors/representativevalidationerror.py +11 -6
  58. moovio_sdk/models/errors/requestcarderror.py +11 -6
  59. moovio_sdk/models/errors/responsevalidationerror.py +25 -0
  60. moovio_sdk/models/errors/reversalvalidationerror.py +11 -6
  61. moovio_sdk/models/errors/revoketokenrequesterror.py +11 -6
  62. moovio_sdk/models/errors/schedulevalidationerror.py +11 -6
  63. moovio_sdk/models/errors/terminalapplicationerror.py +11 -6
  64. moovio_sdk/models/errors/transfer.py +11 -6
  65. moovio_sdk/models/errors/transferoptionsvalidationerror.py +11 -6
  66. moovio_sdk/models/errors/transfervalidationerror.py +11 -6
  67. moovio_sdk/models/errors/updateaccount.py +12 -6
  68. moovio_sdk/models/errors/updatecarderror.py +11 -6
  69. moovio_sdk/models/errors/updateissuedcarderror.py +11 -6
  70. moovio_sdk/models/errors/updatepaymentlinkerror.py +11 -6
  71. moovio_sdk/models/errors/updateticketerror.py +25 -0
  72. moovio_sdk/models/errors/updateunderwritingerror.py +11 -6
  73. moovio_sdk/models/errors/upsertunderwritingerror.py +11 -6
  74. moovio_sdk/models/operations/__init__.py +100 -0
  75. moovio_sdk/models/operations/createticket.py +78 -0
  76. moovio_sdk/models/operations/getticket.py +71 -0
  77. moovio_sdk/models/operations/listticketmessages.py +88 -0
  78. moovio_sdk/models/operations/listtickets.py +81 -0
  79. moovio_sdk/models/operations/updateticket.py +85 -0
  80. moovio_sdk/onboarding.py +66 -166
  81. moovio_sdk/payment_links.py +106 -272
  82. moovio_sdk/payment_methods.py +30 -86
  83. moovio_sdk/ping.py +10 -40
  84. moovio_sdk/receipts.py +36 -92
  85. moovio_sdk/representatives.py +102 -228
  86. moovio_sdk/scheduling.py +122 -278
  87. moovio_sdk/sdk.py +3 -0
  88. moovio_sdk/support.py +1153 -0
  89. moovio_sdk/sweeps.py +102 -274
  90. moovio_sdk/terminal_applications.py +74 -186
  91. moovio_sdk/transfers.py +266 -582
  92. moovio_sdk/underwriting.py +64 -146
  93. moovio_sdk/utils/__init__.py +3 -0
  94. moovio_sdk/utils/serializers.py +21 -3
  95. moovio_sdk/wallet_transactions.py +28 -88
  96. moovio_sdk/wallets.py +24 -84
  97. {moovio_sdk-0.12.0.dist-info → moovio_sdk-0.13.1.dist-info}/METADATA +103 -28
  98. {moovio_sdk-0.12.0.dist-info → moovio_sdk-0.13.1.dist-info}/RECORD +99 -80
  99. {moovio_sdk-0.12.0.dist-info → moovio_sdk-0.13.1.dist-info}/WHEEL +0 -0
@@ -123,46 +123,33 @@ class BankAccounts(BaseSDK):
123
123
  response_data: Any = None
124
124
  if utils.match_response(http_res, "200", "application/json"):
125
125
  return operations.LinkBankAccountResponse(
126
- result=utils.unmarshal_json(http_res.text, components.BankAccount),
126
+ result=utils.unmarshal_json_response(components.BankAccount, http_res),
127
127
  headers=utils.get_response_headers(http_res.headers),
128
128
  )
129
129
  if utils.match_response(http_res, ["400", "409"], "application/json"):
130
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
131
- raise errors.GenericError(data=response_data)
130
+ response_data = utils.unmarshal_json_response(
131
+ errors.GenericErrorData, http_res
132
+ )
133
+ raise errors.GenericError(response_data, http_res)
132
134
  if utils.match_response(http_res, "422", "application/json"):
133
- response_data = utils.unmarshal_json(
134
- http_res.text, errors.BankAccountValidationErrorData
135
+ response_data = utils.unmarshal_json_response(
136
+ errors.BankAccountValidationErrorData, http_res
135
137
  )
136
- raise errors.BankAccountValidationError(data=response_data)
138
+ raise errors.BankAccountValidationError(response_data, http_res)
137
139
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
138
140
  http_res_text = utils.stream_to_text(http_res)
139
- raise errors.APIError(
140
- "API error occurred", http_res.status_code, http_res_text, http_res
141
- )
141
+ raise errors.APIError("API error occurred", http_res, http_res_text)
142
142
  if utils.match_response(http_res, ["500", "504"], "*"):
143
143
  http_res_text = utils.stream_to_text(http_res)
144
- raise errors.APIError(
145
- "API error occurred", http_res.status_code, http_res_text, http_res
146
- )
144
+ raise errors.APIError("API error occurred", http_res, http_res_text)
147
145
  if utils.match_response(http_res, "4XX", "*"):
148
146
  http_res_text = utils.stream_to_text(http_res)
149
- raise errors.APIError(
150
- "API error occurred", http_res.status_code, http_res_text, http_res
151
- )
147
+ raise errors.APIError("API error occurred", http_res, http_res_text)
152
148
  if utils.match_response(http_res, "5XX", "*"):
153
149
  http_res_text = utils.stream_to_text(http_res)
154
- raise errors.APIError(
155
- "API error occurred", http_res.status_code, http_res_text, http_res
156
- )
150
+ raise errors.APIError("API error occurred", http_res, http_res_text)
157
151
 
158
- content_type = http_res.headers.get("Content-Type")
159
- http_res_text = utils.stream_to_text(http_res)
160
- raise errors.APIError(
161
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
162
- http_res.status_code,
163
- http_res_text,
164
- http_res,
165
- )
152
+ raise errors.APIError("Unexpected response received", http_res)
166
153
 
167
154
  async def link_async(
168
155
  self,
@@ -277,46 +264,33 @@ class BankAccounts(BaseSDK):
277
264
  response_data: Any = None
278
265
  if utils.match_response(http_res, "200", "application/json"):
279
266
  return operations.LinkBankAccountResponse(
280
- result=utils.unmarshal_json(http_res.text, components.BankAccount),
267
+ result=utils.unmarshal_json_response(components.BankAccount, http_res),
281
268
  headers=utils.get_response_headers(http_res.headers),
282
269
  )
283
270
  if utils.match_response(http_res, ["400", "409"], "application/json"):
284
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
285
- raise errors.GenericError(data=response_data)
271
+ response_data = utils.unmarshal_json_response(
272
+ errors.GenericErrorData, http_res
273
+ )
274
+ raise errors.GenericError(response_data, http_res)
286
275
  if utils.match_response(http_res, "422", "application/json"):
287
- response_data = utils.unmarshal_json(
288
- http_res.text, errors.BankAccountValidationErrorData
276
+ response_data = utils.unmarshal_json_response(
277
+ errors.BankAccountValidationErrorData, http_res
289
278
  )
290
- raise errors.BankAccountValidationError(data=response_data)
279
+ raise errors.BankAccountValidationError(response_data, http_res)
291
280
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
292
281
  http_res_text = await utils.stream_to_text_async(http_res)
293
- raise errors.APIError(
294
- "API error occurred", http_res.status_code, http_res_text, http_res
295
- )
282
+ raise errors.APIError("API error occurred", http_res, http_res_text)
296
283
  if utils.match_response(http_res, ["500", "504"], "*"):
297
284
  http_res_text = await utils.stream_to_text_async(http_res)
298
- raise errors.APIError(
299
- "API error occurred", http_res.status_code, http_res_text, http_res
300
- )
285
+ raise errors.APIError("API error occurred", http_res, http_res_text)
301
286
  if utils.match_response(http_res, "4XX", "*"):
302
287
  http_res_text = await utils.stream_to_text_async(http_res)
303
- raise errors.APIError(
304
- "API error occurred", http_res.status_code, http_res_text, http_res
305
- )
288
+ raise errors.APIError("API error occurred", http_res, http_res_text)
306
289
  if utils.match_response(http_res, "5XX", "*"):
307
290
  http_res_text = await utils.stream_to_text_async(http_res)
308
- raise errors.APIError(
309
- "API error occurred", http_res.status_code, http_res_text, http_res
310
- )
291
+ raise errors.APIError("API error occurred", http_res, http_res_text)
311
292
 
312
- content_type = http_res.headers.get("Content-Type")
313
- http_res_text = await utils.stream_to_text_async(http_res)
314
- raise errors.APIError(
315
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
316
- http_res.status_code,
317
- http_res_text,
318
- http_res,
319
- )
293
+ raise errors.APIError("Unexpected response received", http_res)
320
294
 
321
295
  def list(
322
296
  self,
@@ -398,40 +372,25 @@ class BankAccounts(BaseSDK):
398
372
 
399
373
  if utils.match_response(http_res, "200", "application/json"):
400
374
  return operations.ListBankAccountsResponse(
401
- result=utils.unmarshal_json(
402
- http_res.text, List[components.BankAccount]
375
+ result=utils.unmarshal_json_response(
376
+ List[components.BankAccount], http_res
403
377
  ),
404
378
  headers=utils.get_response_headers(http_res.headers),
405
379
  )
406
380
  if utils.match_response(http_res, ["401", "403", "429"], "*"):
407
381
  http_res_text = utils.stream_to_text(http_res)
408
- raise errors.APIError(
409
- "API error occurred", http_res.status_code, http_res_text, http_res
410
- )
382
+ raise errors.APIError("API error occurred", http_res, http_res_text)
411
383
  if utils.match_response(http_res, ["500", "504"], "*"):
412
384
  http_res_text = utils.stream_to_text(http_res)
413
- raise errors.APIError(
414
- "API error occurred", http_res.status_code, http_res_text, http_res
415
- )
385
+ raise errors.APIError("API error occurred", http_res, http_res_text)
416
386
  if utils.match_response(http_res, "4XX", "*"):
417
387
  http_res_text = utils.stream_to_text(http_res)
418
- raise errors.APIError(
419
- "API error occurred", http_res.status_code, http_res_text, http_res
420
- )
388
+ raise errors.APIError("API error occurred", http_res, http_res_text)
421
389
  if utils.match_response(http_res, "5XX", "*"):
422
390
  http_res_text = utils.stream_to_text(http_res)
423
- raise errors.APIError(
424
- "API error occurred", http_res.status_code, http_res_text, http_res
425
- )
391
+ raise errors.APIError("API error occurred", http_res, http_res_text)
426
392
 
427
- content_type = http_res.headers.get("Content-Type")
428
- http_res_text = utils.stream_to_text(http_res)
429
- raise errors.APIError(
430
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
431
- http_res.status_code,
432
- http_res_text,
433
- http_res,
434
- )
393
+ raise errors.APIError("Unexpected response received", http_res)
435
394
 
436
395
  async def list_async(
437
396
  self,
@@ -513,40 +472,25 @@ class BankAccounts(BaseSDK):
513
472
 
514
473
  if utils.match_response(http_res, "200", "application/json"):
515
474
  return operations.ListBankAccountsResponse(
516
- result=utils.unmarshal_json(
517
- http_res.text, List[components.BankAccount]
475
+ result=utils.unmarshal_json_response(
476
+ List[components.BankAccount], http_res
518
477
  ),
519
478
  headers=utils.get_response_headers(http_res.headers),
520
479
  )
521
480
  if utils.match_response(http_res, ["401", "403", "429"], "*"):
522
481
  http_res_text = await utils.stream_to_text_async(http_res)
523
- raise errors.APIError(
524
- "API error occurred", http_res.status_code, http_res_text, http_res
525
- )
482
+ raise errors.APIError("API error occurred", http_res, http_res_text)
526
483
  if utils.match_response(http_res, ["500", "504"], "*"):
527
484
  http_res_text = await utils.stream_to_text_async(http_res)
528
- raise errors.APIError(
529
- "API error occurred", http_res.status_code, http_res_text, http_res
530
- )
485
+ raise errors.APIError("API error occurred", http_res, http_res_text)
531
486
  if utils.match_response(http_res, "4XX", "*"):
532
487
  http_res_text = await utils.stream_to_text_async(http_res)
533
- raise errors.APIError(
534
- "API error occurred", http_res.status_code, http_res_text, http_res
535
- )
488
+ raise errors.APIError("API error occurred", http_res, http_res_text)
536
489
  if utils.match_response(http_res, "5XX", "*"):
537
490
  http_res_text = await utils.stream_to_text_async(http_res)
538
- raise errors.APIError(
539
- "API error occurred", http_res.status_code, http_res_text, http_res
540
- )
491
+ raise errors.APIError("API error occurred", http_res, http_res_text)
541
492
 
542
- content_type = http_res.headers.get("Content-Type")
543
- http_res_text = await utils.stream_to_text_async(http_res)
544
- raise errors.APIError(
545
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
546
- http_res.status_code,
547
- http_res_text,
548
- http_res,
549
- )
493
+ raise errors.APIError("Unexpected response received", http_res)
550
494
 
551
495
  def get(
552
496
  self,
@@ -631,38 +575,23 @@ class BankAccounts(BaseSDK):
631
575
 
632
576
  if utils.match_response(http_res, "200", "application/json"):
633
577
  return operations.GetBankAccountResponse(
634
- result=utils.unmarshal_json(http_res.text, components.BankAccount),
578
+ result=utils.unmarshal_json_response(components.BankAccount, http_res),
635
579
  headers=utils.get_response_headers(http_res.headers),
636
580
  )
637
581
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
638
582
  http_res_text = utils.stream_to_text(http_res)
639
- raise errors.APIError(
640
- "API error occurred", http_res.status_code, http_res_text, http_res
641
- )
583
+ raise errors.APIError("API error occurred", http_res, http_res_text)
642
584
  if utils.match_response(http_res, ["500", "504"], "*"):
643
585
  http_res_text = utils.stream_to_text(http_res)
644
- raise errors.APIError(
645
- "API error occurred", http_res.status_code, http_res_text, http_res
646
- )
586
+ raise errors.APIError("API error occurred", http_res, http_res_text)
647
587
  if utils.match_response(http_res, "4XX", "*"):
648
588
  http_res_text = utils.stream_to_text(http_res)
649
- raise errors.APIError(
650
- "API error occurred", http_res.status_code, http_res_text, http_res
651
- )
589
+ raise errors.APIError("API error occurred", http_res, http_res_text)
652
590
  if utils.match_response(http_res, "5XX", "*"):
653
591
  http_res_text = utils.stream_to_text(http_res)
654
- raise errors.APIError(
655
- "API error occurred", http_res.status_code, http_res_text, http_res
656
- )
592
+ raise errors.APIError("API error occurred", http_res, http_res_text)
657
593
 
658
- content_type = http_res.headers.get("Content-Type")
659
- http_res_text = utils.stream_to_text(http_res)
660
- raise errors.APIError(
661
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
662
- http_res.status_code,
663
- http_res_text,
664
- http_res,
665
- )
594
+ raise errors.APIError("Unexpected response received", http_res)
666
595
 
667
596
  async def get_async(
668
597
  self,
@@ -747,38 +676,23 @@ class BankAccounts(BaseSDK):
747
676
 
748
677
  if utils.match_response(http_res, "200", "application/json"):
749
678
  return operations.GetBankAccountResponse(
750
- result=utils.unmarshal_json(http_res.text, components.BankAccount),
679
+ result=utils.unmarshal_json_response(components.BankAccount, http_res),
751
680
  headers=utils.get_response_headers(http_res.headers),
752
681
  )
753
682
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
754
683
  http_res_text = await utils.stream_to_text_async(http_res)
755
- raise errors.APIError(
756
- "API error occurred", http_res.status_code, http_res_text, http_res
757
- )
684
+ raise errors.APIError("API error occurred", http_res, http_res_text)
758
685
  if utils.match_response(http_res, ["500", "504"], "*"):
759
686
  http_res_text = await utils.stream_to_text_async(http_res)
760
- raise errors.APIError(
761
- "API error occurred", http_res.status_code, http_res_text, http_res
762
- )
687
+ raise errors.APIError("API error occurred", http_res, http_res_text)
763
688
  if utils.match_response(http_res, "4XX", "*"):
764
689
  http_res_text = await utils.stream_to_text_async(http_res)
765
- raise errors.APIError(
766
- "API error occurred", http_res.status_code, http_res_text, http_res
767
- )
690
+ raise errors.APIError("API error occurred", http_res, http_res_text)
768
691
  if utils.match_response(http_res, "5XX", "*"):
769
692
  http_res_text = await utils.stream_to_text_async(http_res)
770
- raise errors.APIError(
771
- "API error occurred", http_res.status_code, http_res_text, http_res
772
- )
693
+ raise errors.APIError("API error occurred", http_res, http_res_text)
773
694
 
774
- content_type = http_res.headers.get("Content-Type")
775
- http_res_text = await utils.stream_to_text_async(http_res)
776
- raise errors.APIError(
777
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
778
- http_res.status_code,
779
- http_res_text,
780
- http_res,
781
- )
695
+ raise errors.APIError("Unexpected response received", http_res)
782
696
 
783
697
  def disable(
784
698
  self,
@@ -876,37 +790,24 @@ class BankAccounts(BaseSDK):
876
790
  headers=utils.get_response_headers(http_res.headers)
877
791
  )
878
792
  if utils.match_response(http_res, ["400", "409"], "application/json"):
879
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
880
- raise errors.GenericError(data=response_data)
793
+ response_data = utils.unmarshal_json_response(
794
+ errors.GenericErrorData, http_res
795
+ )
796
+ raise errors.GenericError(response_data, http_res)
881
797
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
882
798
  http_res_text = utils.stream_to_text(http_res)
883
- raise errors.APIError(
884
- "API error occurred", http_res.status_code, http_res_text, http_res
885
- )
799
+ raise errors.APIError("API error occurred", http_res, http_res_text)
886
800
  if utils.match_response(http_res, ["500", "504"], "*"):
887
801
  http_res_text = utils.stream_to_text(http_res)
888
- raise errors.APIError(
889
- "API error occurred", http_res.status_code, http_res_text, http_res
890
- )
802
+ raise errors.APIError("API error occurred", http_res, http_res_text)
891
803
  if utils.match_response(http_res, "4XX", "*"):
892
804
  http_res_text = utils.stream_to_text(http_res)
893
- raise errors.APIError(
894
- "API error occurred", http_res.status_code, http_res_text, http_res
895
- )
805
+ raise errors.APIError("API error occurred", http_res, http_res_text)
896
806
  if utils.match_response(http_res, "5XX", "*"):
897
807
  http_res_text = utils.stream_to_text(http_res)
898
- raise errors.APIError(
899
- "API error occurred", http_res.status_code, http_res_text, http_res
900
- )
808
+ raise errors.APIError("API error occurred", http_res, http_res_text)
901
809
 
902
- content_type = http_res.headers.get("Content-Type")
903
- http_res_text = utils.stream_to_text(http_res)
904
- raise errors.APIError(
905
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
906
- http_res.status_code,
907
- http_res_text,
908
- http_res,
909
- )
810
+ raise errors.APIError("Unexpected response received", http_res)
910
811
 
911
812
  async def disable_async(
912
813
  self,
@@ -1004,37 +905,24 @@ class BankAccounts(BaseSDK):
1004
905
  headers=utils.get_response_headers(http_res.headers)
1005
906
  )
1006
907
  if utils.match_response(http_res, ["400", "409"], "application/json"):
1007
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
1008
- raise errors.GenericError(data=response_data)
908
+ response_data = utils.unmarshal_json_response(
909
+ errors.GenericErrorData, http_res
910
+ )
911
+ raise errors.GenericError(response_data, http_res)
1009
912
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1010
913
  http_res_text = await utils.stream_to_text_async(http_res)
1011
- raise errors.APIError(
1012
- "API error occurred", http_res.status_code, http_res_text, http_res
1013
- )
914
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1014
915
  if utils.match_response(http_res, ["500", "504"], "*"):
1015
916
  http_res_text = await utils.stream_to_text_async(http_res)
1016
- raise errors.APIError(
1017
- "API error occurred", http_res.status_code, http_res_text, http_res
1018
- )
917
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1019
918
  if utils.match_response(http_res, "4XX", "*"):
1020
919
  http_res_text = await utils.stream_to_text_async(http_res)
1021
- raise errors.APIError(
1022
- "API error occurred", http_res.status_code, http_res_text, http_res
1023
- )
920
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1024
921
  if utils.match_response(http_res, "5XX", "*"):
1025
922
  http_res_text = await utils.stream_to_text_async(http_res)
1026
- raise errors.APIError(
1027
- "API error occurred", http_res.status_code, http_res_text, http_res
1028
- )
923
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1029
924
 
1030
- content_type = http_res.headers.get("Content-Type")
1031
- http_res_text = await utils.stream_to_text_async(http_res)
1032
- raise errors.APIError(
1033
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1034
- http_res.status_code,
1035
- http_res_text,
1036
- http_res,
1037
- )
925
+ raise errors.APIError("Unexpected response received", http_res)
1038
926
 
1039
927
  def initiate_micro_deposits(
1040
928
  self,
@@ -1143,37 +1031,24 @@ class BankAccounts(BaseSDK):
1143
1031
  headers=utils.get_response_headers(http_res.headers)
1144
1032
  )
1145
1033
  if utils.match_response(http_res, ["400", "409"], "application/json"):
1146
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
1147
- raise errors.GenericError(data=response_data)
1034
+ response_data = utils.unmarshal_json_response(
1035
+ errors.GenericErrorData, http_res
1036
+ )
1037
+ raise errors.GenericError(response_data, http_res)
1148
1038
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1149
1039
  http_res_text = utils.stream_to_text(http_res)
1150
- raise errors.APIError(
1151
- "API error occurred", http_res.status_code, http_res_text, http_res
1152
- )
1040
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1153
1041
  if utils.match_response(http_res, ["500", "504"], "*"):
1154
1042
  http_res_text = utils.stream_to_text(http_res)
1155
- raise errors.APIError(
1156
- "API error occurred", http_res.status_code, http_res_text, http_res
1157
- )
1043
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1158
1044
  if utils.match_response(http_res, "4XX", "*"):
1159
1045
  http_res_text = utils.stream_to_text(http_res)
1160
- raise errors.APIError(
1161
- "API error occurred", http_res.status_code, http_res_text, http_res
1162
- )
1046
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1163
1047
  if utils.match_response(http_res, "5XX", "*"):
1164
1048
  http_res_text = utils.stream_to_text(http_res)
1165
- raise errors.APIError(
1166
- "API error occurred", http_res.status_code, http_res_text, http_res
1167
- )
1049
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1168
1050
 
1169
- content_type = http_res.headers.get("Content-Type")
1170
- http_res_text = utils.stream_to_text(http_res)
1171
- raise errors.APIError(
1172
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1173
- http_res.status_code,
1174
- http_res_text,
1175
- http_res,
1176
- )
1051
+ raise errors.APIError("Unexpected response received", http_res)
1177
1052
 
1178
1053
  async def initiate_micro_deposits_async(
1179
1054
  self,
@@ -1282,37 +1157,24 @@ class BankAccounts(BaseSDK):
1282
1157
  headers=utils.get_response_headers(http_res.headers)
1283
1158
  )
1284
1159
  if utils.match_response(http_res, ["400", "409"], "application/json"):
1285
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
1286
- raise errors.GenericError(data=response_data)
1160
+ response_data = utils.unmarshal_json_response(
1161
+ errors.GenericErrorData, http_res
1162
+ )
1163
+ raise errors.GenericError(response_data, http_res)
1287
1164
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1288
1165
  http_res_text = await utils.stream_to_text_async(http_res)
1289
- raise errors.APIError(
1290
- "API error occurred", http_res.status_code, http_res_text, http_res
1291
- )
1166
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1292
1167
  if utils.match_response(http_res, ["500", "504"], "*"):
1293
1168
  http_res_text = await utils.stream_to_text_async(http_res)
1294
- raise errors.APIError(
1295
- "API error occurred", http_res.status_code, http_res_text, http_res
1296
- )
1169
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1297
1170
  if utils.match_response(http_res, "4XX", "*"):
1298
1171
  http_res_text = await utils.stream_to_text_async(http_res)
1299
- raise errors.APIError(
1300
- "API error occurred", http_res.status_code, http_res_text, http_res
1301
- )
1172
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1302
1173
  if utils.match_response(http_res, "5XX", "*"):
1303
1174
  http_res_text = await utils.stream_to_text_async(http_res)
1304
- raise errors.APIError(
1305
- "API error occurred", http_res.status_code, http_res_text, http_res
1306
- )
1175
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1307
1176
 
1308
- content_type = http_res.headers.get("Content-Type")
1309
- http_res_text = await utils.stream_to_text_async(http_res)
1310
- raise errors.APIError(
1311
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1312
- http_res.status_code,
1313
- http_res_text,
1314
- http_res,
1315
- )
1177
+ raise errors.APIError("Unexpected response received", http_res)
1316
1178
 
1317
1179
  def complete_micro_deposits(
1318
1180
  self,
@@ -1420,48 +1282,35 @@ class BankAccounts(BaseSDK):
1420
1282
  response_data: Any = None
1421
1283
  if utils.match_response(http_res, "200", "application/json"):
1422
1284
  return operations.CompleteMicroDepositsResponse(
1423
- result=utils.unmarshal_json(
1424
- http_res.text, components.CompletedMicroDeposits
1285
+ result=utils.unmarshal_json_response(
1286
+ components.CompletedMicroDeposits, http_res
1425
1287
  ),
1426
1288
  headers=utils.get_response_headers(http_res.headers),
1427
1289
  )
1428
1290
  if utils.match_response(http_res, ["400", "409"], "application/json"):
1429
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
1430
- raise errors.GenericError(data=response_data)
1291
+ response_data = utils.unmarshal_json_response(
1292
+ errors.GenericErrorData, http_res
1293
+ )
1294
+ raise errors.GenericError(response_data, http_res)
1431
1295
  if utils.match_response(http_res, "422", "application/json"):
1432
- response_data = utils.unmarshal_json(
1433
- http_res.text, errors.MicroDepositValidationErrorData
1296
+ response_data = utils.unmarshal_json_response(
1297
+ errors.MicroDepositValidationErrorData, http_res
1434
1298
  )
1435
- raise errors.MicroDepositValidationError(data=response_data)
1299
+ raise errors.MicroDepositValidationError(response_data, http_res)
1436
1300
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1437
1301
  http_res_text = utils.stream_to_text(http_res)
1438
- raise errors.APIError(
1439
- "API error occurred", http_res.status_code, http_res_text, http_res
1440
- )
1302
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1441
1303
  if utils.match_response(http_res, ["500", "504"], "*"):
1442
1304
  http_res_text = utils.stream_to_text(http_res)
1443
- raise errors.APIError(
1444
- "API error occurred", http_res.status_code, http_res_text, http_res
1445
- )
1305
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1446
1306
  if utils.match_response(http_res, "4XX", "*"):
1447
1307
  http_res_text = utils.stream_to_text(http_res)
1448
- raise errors.APIError(
1449
- "API error occurred", http_res.status_code, http_res_text, http_res
1450
- )
1308
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1451
1309
  if utils.match_response(http_res, "5XX", "*"):
1452
1310
  http_res_text = utils.stream_to_text(http_res)
1453
- raise errors.APIError(
1454
- "API error occurred", http_res.status_code, http_res_text, http_res
1455
- )
1311
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1456
1312
 
1457
- content_type = http_res.headers.get("Content-Type")
1458
- http_res_text = utils.stream_to_text(http_res)
1459
- raise errors.APIError(
1460
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1461
- http_res.status_code,
1462
- http_res_text,
1463
- http_res,
1464
- )
1313
+ raise errors.APIError("Unexpected response received", http_res)
1465
1314
 
1466
1315
  async def complete_micro_deposits_async(
1467
1316
  self,
@@ -1569,48 +1418,35 @@ class BankAccounts(BaseSDK):
1569
1418
  response_data: Any = None
1570
1419
  if utils.match_response(http_res, "200", "application/json"):
1571
1420
  return operations.CompleteMicroDepositsResponse(
1572
- result=utils.unmarshal_json(
1573
- http_res.text, components.CompletedMicroDeposits
1421
+ result=utils.unmarshal_json_response(
1422
+ components.CompletedMicroDeposits, http_res
1574
1423
  ),
1575
1424
  headers=utils.get_response_headers(http_res.headers),
1576
1425
  )
1577
1426
  if utils.match_response(http_res, ["400", "409"], "application/json"):
1578
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
1579
- raise errors.GenericError(data=response_data)
1427
+ response_data = utils.unmarshal_json_response(
1428
+ errors.GenericErrorData, http_res
1429
+ )
1430
+ raise errors.GenericError(response_data, http_res)
1580
1431
  if utils.match_response(http_res, "422", "application/json"):
1581
- response_data = utils.unmarshal_json(
1582
- http_res.text, errors.MicroDepositValidationErrorData
1432
+ response_data = utils.unmarshal_json_response(
1433
+ errors.MicroDepositValidationErrorData, http_res
1583
1434
  )
1584
- raise errors.MicroDepositValidationError(data=response_data)
1435
+ raise errors.MicroDepositValidationError(response_data, http_res)
1585
1436
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1586
1437
  http_res_text = await utils.stream_to_text_async(http_res)
1587
- raise errors.APIError(
1588
- "API error occurred", http_res.status_code, http_res_text, http_res
1589
- )
1438
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1590
1439
  if utils.match_response(http_res, ["500", "504"], "*"):
1591
1440
  http_res_text = await utils.stream_to_text_async(http_res)
1592
- raise errors.APIError(
1593
- "API error occurred", http_res.status_code, http_res_text, http_res
1594
- )
1441
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1595
1442
  if utils.match_response(http_res, "4XX", "*"):
1596
1443
  http_res_text = await utils.stream_to_text_async(http_res)
1597
- raise errors.APIError(
1598
- "API error occurred", http_res.status_code, http_res_text, http_res
1599
- )
1444
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1600
1445
  if utils.match_response(http_res, "5XX", "*"):
1601
1446
  http_res_text = await utils.stream_to_text_async(http_res)
1602
- raise errors.APIError(
1603
- "API error occurred", http_res.status_code, http_res_text, http_res
1604
- )
1447
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1605
1448
 
1606
- content_type = http_res.headers.get("Content-Type")
1607
- http_res_text = await utils.stream_to_text_async(http_res)
1608
- raise errors.APIError(
1609
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1610
- http_res.status_code,
1611
- http_res_text,
1612
- http_res,
1613
- )
1449
+ raise errors.APIError("Unexpected response received", http_res)
1614
1450
 
1615
1451
  def get_verification(
1616
1452
  self,
@@ -1702,40 +1538,25 @@ class BankAccounts(BaseSDK):
1702
1538
 
1703
1539
  if utils.match_response(http_res, "200", "application/json"):
1704
1540
  return operations.GetBankAccountVerificationResponse(
1705
- result=utils.unmarshal_json(
1706
- http_res.text, components.BankAccountVerification
1541
+ result=utils.unmarshal_json_response(
1542
+ components.BankAccountVerification, http_res
1707
1543
  ),
1708
1544
  headers=utils.get_response_headers(http_res.headers),
1709
1545
  )
1710
1546
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1711
1547
  http_res_text = utils.stream_to_text(http_res)
1712
- raise errors.APIError(
1713
- "API error occurred", http_res.status_code, http_res_text, http_res
1714
- )
1548
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1715
1549
  if utils.match_response(http_res, ["500", "504"], "*"):
1716
1550
  http_res_text = utils.stream_to_text(http_res)
1717
- raise errors.APIError(
1718
- "API error occurred", http_res.status_code, http_res_text, http_res
1719
- )
1551
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1720
1552
  if utils.match_response(http_res, "4XX", "*"):
1721
1553
  http_res_text = utils.stream_to_text(http_res)
1722
- raise errors.APIError(
1723
- "API error occurred", http_res.status_code, http_res_text, http_res
1724
- )
1554
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1725
1555
  if utils.match_response(http_res, "5XX", "*"):
1726
1556
  http_res_text = utils.stream_to_text(http_res)
1727
- raise errors.APIError(
1728
- "API error occurred", http_res.status_code, http_res_text, http_res
1729
- )
1557
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1730
1558
 
1731
- content_type = http_res.headers.get("Content-Type")
1732
- http_res_text = utils.stream_to_text(http_res)
1733
- raise errors.APIError(
1734
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1735
- http_res.status_code,
1736
- http_res_text,
1737
- http_res,
1738
- )
1559
+ raise errors.APIError("Unexpected response received", http_res)
1739
1560
 
1740
1561
  async def get_verification_async(
1741
1562
  self,
@@ -1827,40 +1648,25 @@ class BankAccounts(BaseSDK):
1827
1648
 
1828
1649
  if utils.match_response(http_res, "200", "application/json"):
1829
1650
  return operations.GetBankAccountVerificationResponse(
1830
- result=utils.unmarshal_json(
1831
- http_res.text, components.BankAccountVerification
1651
+ result=utils.unmarshal_json_response(
1652
+ components.BankAccountVerification, http_res
1832
1653
  ),
1833
1654
  headers=utils.get_response_headers(http_res.headers),
1834
1655
  )
1835
1656
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1836
1657
  http_res_text = await utils.stream_to_text_async(http_res)
1837
- raise errors.APIError(
1838
- "API error occurred", http_res.status_code, http_res_text, http_res
1839
- )
1658
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1840
1659
  if utils.match_response(http_res, ["500", "504"], "*"):
1841
1660
  http_res_text = await utils.stream_to_text_async(http_res)
1842
- raise errors.APIError(
1843
- "API error occurred", http_res.status_code, http_res_text, http_res
1844
- )
1661
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1845
1662
  if utils.match_response(http_res, "4XX", "*"):
1846
1663
  http_res_text = await utils.stream_to_text_async(http_res)
1847
- raise errors.APIError(
1848
- "API error occurred", http_res.status_code, http_res_text, http_res
1849
- )
1664
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1850
1665
  if utils.match_response(http_res, "5XX", "*"):
1851
1666
  http_res_text = await utils.stream_to_text_async(http_res)
1852
- raise errors.APIError(
1853
- "API error occurred", http_res.status_code, http_res_text, http_res
1854
- )
1667
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1855
1668
 
1856
- content_type = http_res.headers.get("Content-Type")
1857
- http_res_text = await utils.stream_to_text_async(http_res)
1858
- raise errors.APIError(
1859
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1860
- http_res.status_code,
1861
- http_res_text,
1862
- http_res,
1863
- )
1669
+ raise errors.APIError("Unexpected response received", http_res)
1864
1670
 
1865
1671
  def initiate_verification(
1866
1672
  self,
@@ -1973,43 +1779,30 @@ class BankAccounts(BaseSDK):
1973
1779
  response_data: Any = None
1974
1780
  if utils.match_response(http_res, "200", "application/json"):
1975
1781
  return operations.InitiateBankAccountVerificationResponse(
1976
- result=utils.unmarshal_json(
1977
- http_res.text, components.BankAccountVerificationCreated
1782
+ result=utils.unmarshal_json_response(
1783
+ components.BankAccountVerificationCreated, http_res
1978
1784
  ),
1979
1785
  headers=utils.get_response_headers(http_res.headers),
1980
1786
  )
1981
1787
  if utils.match_response(http_res, ["400", "409"], "application/json"):
1982
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
1983
- raise errors.GenericError(data=response_data)
1788
+ response_data = utils.unmarshal_json_response(
1789
+ errors.GenericErrorData, http_res
1790
+ )
1791
+ raise errors.GenericError(response_data, http_res)
1984
1792
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1985
1793
  http_res_text = utils.stream_to_text(http_res)
1986
- raise errors.APIError(
1987
- "API error occurred", http_res.status_code, http_res_text, http_res
1988
- )
1794
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1989
1795
  if utils.match_response(http_res, ["500", "504"], "*"):
1990
1796
  http_res_text = utils.stream_to_text(http_res)
1991
- raise errors.APIError(
1992
- "API error occurred", http_res.status_code, http_res_text, http_res
1993
- )
1797
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1994
1798
  if utils.match_response(http_res, "4XX", "*"):
1995
1799
  http_res_text = utils.stream_to_text(http_res)
1996
- raise errors.APIError(
1997
- "API error occurred", http_res.status_code, http_res_text, http_res
1998
- )
1800
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1999
1801
  if utils.match_response(http_res, "5XX", "*"):
2000
1802
  http_res_text = utils.stream_to_text(http_res)
2001
- raise errors.APIError(
2002
- "API error occurred", http_res.status_code, http_res_text, http_res
2003
- )
1803
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2004
1804
 
2005
- content_type = http_res.headers.get("Content-Type")
2006
- http_res_text = utils.stream_to_text(http_res)
2007
- raise errors.APIError(
2008
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2009
- http_res.status_code,
2010
- http_res_text,
2011
- http_res,
2012
- )
1805
+ raise errors.APIError("Unexpected response received", http_res)
2013
1806
 
2014
1807
  async def initiate_verification_async(
2015
1808
  self,
@@ -2122,43 +1915,30 @@ class BankAccounts(BaseSDK):
2122
1915
  response_data: Any = None
2123
1916
  if utils.match_response(http_res, "200", "application/json"):
2124
1917
  return operations.InitiateBankAccountVerificationResponse(
2125
- result=utils.unmarshal_json(
2126
- http_res.text, components.BankAccountVerificationCreated
1918
+ result=utils.unmarshal_json_response(
1919
+ components.BankAccountVerificationCreated, http_res
2127
1920
  ),
2128
1921
  headers=utils.get_response_headers(http_res.headers),
2129
1922
  )
2130
1923
  if utils.match_response(http_res, ["400", "409"], "application/json"):
2131
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
2132
- raise errors.GenericError(data=response_data)
1924
+ response_data = utils.unmarshal_json_response(
1925
+ errors.GenericErrorData, http_res
1926
+ )
1927
+ raise errors.GenericError(response_data, http_res)
2133
1928
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
2134
1929
  http_res_text = await utils.stream_to_text_async(http_res)
2135
- raise errors.APIError(
2136
- "API error occurred", http_res.status_code, http_res_text, http_res
2137
- )
1930
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2138
1931
  if utils.match_response(http_res, ["500", "504"], "*"):
2139
1932
  http_res_text = await utils.stream_to_text_async(http_res)
2140
- raise errors.APIError(
2141
- "API error occurred", http_res.status_code, http_res_text, http_res
2142
- )
1933
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2143
1934
  if utils.match_response(http_res, "4XX", "*"):
2144
1935
  http_res_text = await utils.stream_to_text_async(http_res)
2145
- raise errors.APIError(
2146
- "API error occurred", http_res.status_code, http_res_text, http_res
2147
- )
1936
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2148
1937
  if utils.match_response(http_res, "5XX", "*"):
2149
1938
  http_res_text = await utils.stream_to_text_async(http_res)
2150
- raise errors.APIError(
2151
- "API error occurred", http_res.status_code, http_res_text, http_res
2152
- )
1939
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2153
1940
 
2154
- content_type = http_res.headers.get("Content-Type")
2155
- http_res_text = await utils.stream_to_text_async(http_res)
2156
- raise errors.APIError(
2157
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2158
- http_res.status_code,
2159
- http_res_text,
2160
- http_res,
2161
- )
1941
+ raise errors.APIError("Unexpected response received", http_res)
2162
1942
 
2163
1943
  def complete_verification(
2164
1944
  self,
@@ -2273,43 +2053,30 @@ class BankAccounts(BaseSDK):
2273
2053
  response_data: Any = None
2274
2054
  if utils.match_response(http_res, "200", "application/json"):
2275
2055
  return operations.CompleteBankAccountVerificationResponse(
2276
- result=utils.unmarshal_json(
2277
- http_res.text, components.BankAccountVerification
2056
+ result=utils.unmarshal_json_response(
2057
+ components.BankAccountVerification, http_res
2278
2058
  ),
2279
2059
  headers=utils.get_response_headers(http_res.headers),
2280
2060
  )
2281
2061
  if utils.match_response(http_res, ["400", "409", "422"], "application/json"):
2282
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
2283
- raise errors.GenericError(data=response_data)
2062
+ response_data = utils.unmarshal_json_response(
2063
+ errors.GenericErrorData, http_res
2064
+ )
2065
+ raise errors.GenericError(response_data, http_res)
2284
2066
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
2285
2067
  http_res_text = utils.stream_to_text(http_res)
2286
- raise errors.APIError(
2287
- "API error occurred", http_res.status_code, http_res_text, http_res
2288
- )
2068
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2289
2069
  if utils.match_response(http_res, ["500", "504"], "*"):
2290
2070
  http_res_text = utils.stream_to_text(http_res)
2291
- raise errors.APIError(
2292
- "API error occurred", http_res.status_code, http_res_text, http_res
2293
- )
2071
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2294
2072
  if utils.match_response(http_res, "4XX", "*"):
2295
2073
  http_res_text = utils.stream_to_text(http_res)
2296
- raise errors.APIError(
2297
- "API error occurred", http_res.status_code, http_res_text, http_res
2298
- )
2074
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2299
2075
  if utils.match_response(http_res, "5XX", "*"):
2300
2076
  http_res_text = utils.stream_to_text(http_res)
2301
- raise errors.APIError(
2302
- "API error occurred", http_res.status_code, http_res_text, http_res
2303
- )
2077
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2304
2078
 
2305
- content_type = http_res.headers.get("Content-Type")
2306
- http_res_text = utils.stream_to_text(http_res)
2307
- raise errors.APIError(
2308
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2309
- http_res.status_code,
2310
- http_res_text,
2311
- http_res,
2312
- )
2079
+ raise errors.APIError("Unexpected response received", http_res)
2313
2080
 
2314
2081
  async def complete_verification_async(
2315
2082
  self,
@@ -2424,40 +2191,27 @@ class BankAccounts(BaseSDK):
2424
2191
  response_data: Any = None
2425
2192
  if utils.match_response(http_res, "200", "application/json"):
2426
2193
  return operations.CompleteBankAccountVerificationResponse(
2427
- result=utils.unmarshal_json(
2428
- http_res.text, components.BankAccountVerification
2194
+ result=utils.unmarshal_json_response(
2195
+ components.BankAccountVerification, http_res
2429
2196
  ),
2430
2197
  headers=utils.get_response_headers(http_res.headers),
2431
2198
  )
2432
2199
  if utils.match_response(http_res, ["400", "409", "422"], "application/json"):
2433
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
2434
- raise errors.GenericError(data=response_data)
2200
+ response_data = utils.unmarshal_json_response(
2201
+ errors.GenericErrorData, http_res
2202
+ )
2203
+ raise errors.GenericError(response_data, http_res)
2435
2204
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
2436
2205
  http_res_text = await utils.stream_to_text_async(http_res)
2437
- raise errors.APIError(
2438
- "API error occurred", http_res.status_code, http_res_text, http_res
2439
- )
2206
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2440
2207
  if utils.match_response(http_res, ["500", "504"], "*"):
2441
2208
  http_res_text = await utils.stream_to_text_async(http_res)
2442
- raise errors.APIError(
2443
- "API error occurred", http_res.status_code, http_res_text, http_res
2444
- )
2209
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2445
2210
  if utils.match_response(http_res, "4XX", "*"):
2446
2211
  http_res_text = await utils.stream_to_text_async(http_res)
2447
- raise errors.APIError(
2448
- "API error occurred", http_res.status_code, http_res_text, http_res
2449
- )
2212
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2450
2213
  if utils.match_response(http_res, "5XX", "*"):
2451
2214
  http_res_text = await utils.stream_to_text_async(http_res)
2452
- raise errors.APIError(
2453
- "API error occurred", http_res.status_code, http_res_text, http_res
2454
- )
2215
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2455
2216
 
2456
- content_type = http_res.headers.get("Content-Type")
2457
- http_res_text = await utils.stream_to_text_async(http_res)
2458
- raise errors.APIError(
2459
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2460
- http_res.status_code,
2461
- http_res_text,
2462
- http_res,
2463
- )
2217
+ raise errors.APIError("Unexpected response received", http_res)