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
moovio_sdk/apple_pay.py CHANGED
@@ -118,43 +118,30 @@ class ApplePay(BaseSDK):
118
118
  response_data: Any = None
119
119
  if utils.match_response(http_res, "200", "application/json"):
120
120
  return operations.RegisterApplePayMerchantDomainsResponse(
121
- result=utils.unmarshal_json(
122
- http_res.text, components.ApplePayMerchantDomains
121
+ result=utils.unmarshal_json_response(
122
+ components.ApplePayMerchantDomains, http_res
123
123
  ),
124
124
  headers=utils.get_response_headers(http_res.headers),
125
125
  )
126
126
  if utils.match_response(http_res, "400", "application/json"):
127
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
128
- raise errors.GenericError(data=response_data)
127
+ response_data = utils.unmarshal_json_response(
128
+ errors.GenericErrorData, http_res
129
+ )
130
+ raise errors.GenericError(response_data, http_res)
129
131
  if utils.match_response(http_res, ["401", "403", "409", "417", "429"], "*"):
130
132
  http_res_text = utils.stream_to_text(http_res)
131
- raise errors.APIError(
132
- "API error occurred", http_res.status_code, http_res_text, http_res
133
- )
133
+ raise errors.APIError("API error occurred", http_res, http_res_text)
134
134
  if utils.match_response(http_res, ["500", "504"], "*"):
135
135
  http_res_text = utils.stream_to_text(http_res)
136
- raise errors.APIError(
137
- "API error occurred", http_res.status_code, http_res_text, http_res
138
- )
136
+ raise errors.APIError("API error occurred", http_res, http_res_text)
139
137
  if utils.match_response(http_res, "4XX", "*"):
140
138
  http_res_text = utils.stream_to_text(http_res)
141
- raise errors.APIError(
142
- "API error occurred", http_res.status_code, http_res_text, http_res
143
- )
139
+ raise errors.APIError("API error occurred", http_res, http_res_text)
144
140
  if utils.match_response(http_res, "5XX", "*"):
145
141
  http_res_text = utils.stream_to_text(http_res)
146
- raise errors.APIError(
147
- "API error occurred", http_res.status_code, http_res_text, http_res
148
- )
142
+ raise errors.APIError("API error occurred", http_res, http_res_text)
149
143
 
150
- content_type = http_res.headers.get("Content-Type")
151
- http_res_text = utils.stream_to_text(http_res)
152
- raise errors.APIError(
153
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
154
- http_res.status_code,
155
- http_res_text,
156
- http_res,
157
- )
144
+ raise errors.APIError("Unexpected response received", http_res)
158
145
 
159
146
  async def register_merchant_domains_async(
160
147
  self,
@@ -264,43 +251,30 @@ class ApplePay(BaseSDK):
264
251
  response_data: Any = None
265
252
  if utils.match_response(http_res, "200", "application/json"):
266
253
  return operations.RegisterApplePayMerchantDomainsResponse(
267
- result=utils.unmarshal_json(
268
- http_res.text, components.ApplePayMerchantDomains
254
+ result=utils.unmarshal_json_response(
255
+ components.ApplePayMerchantDomains, http_res
269
256
  ),
270
257
  headers=utils.get_response_headers(http_res.headers),
271
258
  )
272
259
  if utils.match_response(http_res, "400", "application/json"):
273
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
274
- raise errors.GenericError(data=response_data)
260
+ response_data = utils.unmarshal_json_response(
261
+ errors.GenericErrorData, http_res
262
+ )
263
+ raise errors.GenericError(response_data, http_res)
275
264
  if utils.match_response(http_res, ["401", "403", "409", "417", "429"], "*"):
276
265
  http_res_text = await utils.stream_to_text_async(http_res)
277
- raise errors.APIError(
278
- "API error occurred", http_res.status_code, http_res_text, http_res
279
- )
266
+ raise errors.APIError("API error occurred", http_res, http_res_text)
280
267
  if utils.match_response(http_res, ["500", "504"], "*"):
281
268
  http_res_text = await utils.stream_to_text_async(http_res)
282
- raise errors.APIError(
283
- "API error occurred", http_res.status_code, http_res_text, http_res
284
- )
269
+ raise errors.APIError("API error occurred", http_res, http_res_text)
285
270
  if utils.match_response(http_res, "4XX", "*"):
286
271
  http_res_text = await utils.stream_to_text_async(http_res)
287
- raise errors.APIError(
288
- "API error occurred", http_res.status_code, http_res_text, http_res
289
- )
272
+ raise errors.APIError("API error occurred", http_res, http_res_text)
290
273
  if utils.match_response(http_res, "5XX", "*"):
291
274
  http_res_text = await utils.stream_to_text_async(http_res)
292
- raise errors.APIError(
293
- "API error occurred", http_res.status_code, http_res_text, http_res
294
- )
275
+ raise errors.APIError("API error occurred", http_res, http_res_text)
295
276
 
296
- content_type = http_res.headers.get("Content-Type")
297
- http_res_text = await utils.stream_to_text_async(http_res)
298
- raise errors.APIError(
299
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
300
- http_res.status_code,
301
- http_res_text,
302
- http_res,
303
- )
277
+ raise errors.APIError("Unexpected response received", http_res)
304
278
 
305
279
  def update_merchant_domains(
306
280
  self,
@@ -414,39 +388,26 @@ class ApplePay(BaseSDK):
414
388
  headers=utils.get_response_headers(http_res.headers)
415
389
  )
416
390
  if utils.match_response(http_res, "400", "application/json"):
417
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
418
- raise errors.GenericError(data=response_data)
391
+ response_data = utils.unmarshal_json_response(
392
+ errors.GenericErrorData, http_res
393
+ )
394
+ raise errors.GenericError(response_data, http_res)
419
395
  if utils.match_response(
420
396
  http_res, ["401", "403", "404", "409", "417", "429"], "*"
421
397
  ):
422
398
  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
- )
399
+ raise errors.APIError("API error occurred", http_res, http_res_text)
426
400
  if utils.match_response(http_res, ["500", "504"], "*"):
427
401
  http_res_text = utils.stream_to_text(http_res)
428
- raise errors.APIError(
429
- "API error occurred", http_res.status_code, http_res_text, http_res
430
- )
402
+ raise errors.APIError("API error occurred", http_res, http_res_text)
431
403
  if utils.match_response(http_res, "4XX", "*"):
432
404
  http_res_text = utils.stream_to_text(http_res)
433
- raise errors.APIError(
434
- "API error occurred", http_res.status_code, http_res_text, http_res
435
- )
405
+ raise errors.APIError("API error occurred", http_res, http_res_text)
436
406
  if utils.match_response(http_res, "5XX", "*"):
437
407
  http_res_text = utils.stream_to_text(http_res)
438
- raise errors.APIError(
439
- "API error occurred", http_res.status_code, http_res_text, http_res
440
- )
408
+ raise errors.APIError("API error occurred", http_res, http_res_text)
441
409
 
442
- content_type = http_res.headers.get("Content-Type")
443
- http_res_text = utils.stream_to_text(http_res)
444
- raise errors.APIError(
445
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
446
- http_res.status_code,
447
- http_res_text,
448
- http_res,
449
- )
410
+ raise errors.APIError("Unexpected response received", http_res)
450
411
 
451
412
  async def update_merchant_domains_async(
452
413
  self,
@@ -560,39 +521,26 @@ class ApplePay(BaseSDK):
560
521
  headers=utils.get_response_headers(http_res.headers)
561
522
  )
562
523
  if utils.match_response(http_res, "400", "application/json"):
563
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
564
- raise errors.GenericError(data=response_data)
524
+ response_data = utils.unmarshal_json_response(
525
+ errors.GenericErrorData, http_res
526
+ )
527
+ raise errors.GenericError(response_data, http_res)
565
528
  if utils.match_response(
566
529
  http_res, ["401", "403", "404", "409", "417", "429"], "*"
567
530
  ):
568
531
  http_res_text = await utils.stream_to_text_async(http_res)
569
- raise errors.APIError(
570
- "API error occurred", http_res.status_code, http_res_text, http_res
571
- )
532
+ raise errors.APIError("API error occurred", http_res, http_res_text)
572
533
  if utils.match_response(http_res, ["500", "504"], "*"):
573
534
  http_res_text = await utils.stream_to_text_async(http_res)
574
- raise errors.APIError(
575
- "API error occurred", http_res.status_code, http_res_text, http_res
576
- )
535
+ raise errors.APIError("API error occurred", http_res, http_res_text)
577
536
  if utils.match_response(http_res, "4XX", "*"):
578
537
  http_res_text = await utils.stream_to_text_async(http_res)
579
- raise errors.APIError(
580
- "API error occurred", http_res.status_code, http_res_text, http_res
581
- )
538
+ raise errors.APIError("API error occurred", http_res, http_res_text)
582
539
  if utils.match_response(http_res, "5XX", "*"):
583
540
  http_res_text = await utils.stream_to_text_async(http_res)
584
- raise errors.APIError(
585
- "API error occurred", http_res.status_code, http_res_text, http_res
586
- )
541
+ raise errors.APIError("API error occurred", http_res, http_res_text)
587
542
 
588
- content_type = http_res.headers.get("Content-Type")
589
- http_res_text = await utils.stream_to_text_async(http_res)
590
- raise errors.APIError(
591
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
592
- http_res.status_code,
593
- http_res_text,
594
- http_res,
595
- )
543
+ raise errors.APIError("Unexpected response received", http_res)
596
544
 
597
545
  def get_merchant_domains(
598
546
  self,
@@ -674,40 +622,25 @@ class ApplePay(BaseSDK):
674
622
 
675
623
  if utils.match_response(http_res, "200", "application/json"):
676
624
  return operations.GetApplePayMerchantDomainsResponse(
677
- result=utils.unmarshal_json(
678
- http_res.text, components.ApplePayMerchantDomains
625
+ result=utils.unmarshal_json_response(
626
+ components.ApplePayMerchantDomains, http_res
679
627
  ),
680
628
  headers=utils.get_response_headers(http_res.headers),
681
629
  )
682
630
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
683
631
  http_res_text = utils.stream_to_text(http_res)
684
- raise errors.APIError(
685
- "API error occurred", http_res.status_code, http_res_text, http_res
686
- )
632
+ raise errors.APIError("API error occurred", http_res, http_res_text)
687
633
  if utils.match_response(http_res, ["500", "504"], "*"):
688
634
  http_res_text = utils.stream_to_text(http_res)
689
- raise errors.APIError(
690
- "API error occurred", http_res.status_code, http_res_text, http_res
691
- )
635
+ raise errors.APIError("API error occurred", http_res, http_res_text)
692
636
  if utils.match_response(http_res, "4XX", "*"):
693
637
  http_res_text = utils.stream_to_text(http_res)
694
- raise errors.APIError(
695
- "API error occurred", http_res.status_code, http_res_text, http_res
696
- )
638
+ raise errors.APIError("API error occurred", http_res, http_res_text)
697
639
  if utils.match_response(http_res, "5XX", "*"):
698
640
  http_res_text = utils.stream_to_text(http_res)
699
- raise errors.APIError(
700
- "API error occurred", http_res.status_code, http_res_text, http_res
701
- )
641
+ raise errors.APIError("API error occurred", http_res, http_res_text)
702
642
 
703
- content_type = http_res.headers.get("Content-Type")
704
- http_res_text = utils.stream_to_text(http_res)
705
- raise errors.APIError(
706
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
707
- http_res.status_code,
708
- http_res_text,
709
- http_res,
710
- )
643
+ raise errors.APIError("Unexpected response received", http_res)
711
644
 
712
645
  async def get_merchant_domains_async(
713
646
  self,
@@ -789,40 +722,25 @@ class ApplePay(BaseSDK):
789
722
 
790
723
  if utils.match_response(http_res, "200", "application/json"):
791
724
  return operations.GetApplePayMerchantDomainsResponse(
792
- result=utils.unmarshal_json(
793
- http_res.text, components.ApplePayMerchantDomains
725
+ result=utils.unmarshal_json_response(
726
+ components.ApplePayMerchantDomains, http_res
794
727
  ),
795
728
  headers=utils.get_response_headers(http_res.headers),
796
729
  )
797
730
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
798
731
  http_res_text = await utils.stream_to_text_async(http_res)
799
- raise errors.APIError(
800
- "API error occurred", http_res.status_code, http_res_text, http_res
801
- )
732
+ raise errors.APIError("API error occurred", http_res, http_res_text)
802
733
  if utils.match_response(http_res, ["500", "504"], "*"):
803
734
  http_res_text = await utils.stream_to_text_async(http_res)
804
- raise errors.APIError(
805
- "API error occurred", http_res.status_code, http_res_text, http_res
806
- )
735
+ raise errors.APIError("API error occurred", http_res, http_res_text)
807
736
  if utils.match_response(http_res, "4XX", "*"):
808
737
  http_res_text = await utils.stream_to_text_async(http_res)
809
- raise errors.APIError(
810
- "API error occurred", http_res.status_code, http_res_text, http_res
811
- )
738
+ raise errors.APIError("API error occurred", http_res, http_res_text)
812
739
  if utils.match_response(http_res, "5XX", "*"):
813
740
  http_res_text = await utils.stream_to_text_async(http_res)
814
- raise errors.APIError(
815
- "API error occurred", http_res.status_code, http_res_text, http_res
816
- )
741
+ raise errors.APIError("API error occurred", http_res, http_res_text)
817
742
 
818
- content_type = http_res.headers.get("Content-Type")
819
- http_res_text = await utils.stream_to_text_async(http_res)
820
- raise errors.APIError(
821
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
822
- http_res.status_code,
823
- http_res_text,
824
- http_res,
825
- )
743
+ raise errors.APIError("Unexpected response received", http_res)
826
744
 
827
745
  def create_session(
828
746
  self,
@@ -933,41 +851,28 @@ class ApplePay(BaseSDK):
933
851
  response_data: Any = None
934
852
  if utils.match_response(http_res, "200", "application/json"):
935
853
  return operations.CreateApplePaySessionResponse(
936
- result=utils.unmarshal_json(http_res.text, str),
854
+ result=utils.unmarshal_json_response(str, http_res),
937
855
  headers=utils.get_response_headers(http_res.headers),
938
856
  )
939
857
  if utils.match_response(http_res, ["400", "409", "422"], "application/json"):
940
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
941
- raise errors.GenericError(data=response_data)
858
+ response_data = utils.unmarshal_json_response(
859
+ errors.GenericErrorData, http_res
860
+ )
861
+ raise errors.GenericError(response_data, http_res)
942
862
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
943
863
  http_res_text = utils.stream_to_text(http_res)
944
- raise errors.APIError(
945
- "API error occurred", http_res.status_code, http_res_text, http_res
946
- )
864
+ raise errors.APIError("API error occurred", http_res, http_res_text)
947
865
  if utils.match_response(http_res, ["500", "504"], "*"):
948
866
  http_res_text = utils.stream_to_text(http_res)
949
- raise errors.APIError(
950
- "API error occurred", http_res.status_code, http_res_text, http_res
951
- )
867
+ raise errors.APIError("API error occurred", http_res, http_res_text)
952
868
  if utils.match_response(http_res, "4XX", "*"):
953
869
  http_res_text = utils.stream_to_text(http_res)
954
- raise errors.APIError(
955
- "API error occurred", http_res.status_code, http_res_text, http_res
956
- )
870
+ raise errors.APIError("API error occurred", http_res, http_res_text)
957
871
  if utils.match_response(http_res, "5XX", "*"):
958
872
  http_res_text = utils.stream_to_text(http_res)
959
- raise errors.APIError(
960
- "API error occurred", http_res.status_code, http_res_text, http_res
961
- )
873
+ raise errors.APIError("API error occurred", http_res, http_res_text)
962
874
 
963
- content_type = http_res.headers.get("Content-Type")
964
- http_res_text = utils.stream_to_text(http_res)
965
- raise errors.APIError(
966
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
967
- http_res.status_code,
968
- http_res_text,
969
- http_res,
970
- )
875
+ raise errors.APIError("Unexpected response received", http_res)
971
876
 
972
877
  async def create_session_async(
973
878
  self,
@@ -1078,41 +983,28 @@ class ApplePay(BaseSDK):
1078
983
  response_data: Any = None
1079
984
  if utils.match_response(http_res, "200", "application/json"):
1080
985
  return operations.CreateApplePaySessionResponse(
1081
- result=utils.unmarshal_json(http_res.text, str),
986
+ result=utils.unmarshal_json_response(str, http_res),
1082
987
  headers=utils.get_response_headers(http_res.headers),
1083
988
  )
1084
989
  if utils.match_response(http_res, ["400", "409", "422"], "application/json"):
1085
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
1086
- raise errors.GenericError(data=response_data)
990
+ response_data = utils.unmarshal_json_response(
991
+ errors.GenericErrorData, http_res
992
+ )
993
+ raise errors.GenericError(response_data, http_res)
1087
994
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1088
995
  http_res_text = await utils.stream_to_text_async(http_res)
1089
- raise errors.APIError(
1090
- "API error occurred", http_res.status_code, http_res_text, http_res
1091
- )
996
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1092
997
  if utils.match_response(http_res, ["500", "504"], "*"):
1093
998
  http_res_text = await utils.stream_to_text_async(http_res)
1094
- raise errors.APIError(
1095
- "API error occurred", http_res.status_code, http_res_text, http_res
1096
- )
999
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1097
1000
  if utils.match_response(http_res, "4XX", "*"):
1098
1001
  http_res_text = await utils.stream_to_text_async(http_res)
1099
- raise errors.APIError(
1100
- "API error occurred", http_res.status_code, http_res_text, http_res
1101
- )
1002
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1102
1003
  if utils.match_response(http_res, "5XX", "*"):
1103
1004
  http_res_text = await utils.stream_to_text_async(http_res)
1104
- raise errors.APIError(
1105
- "API error occurred", http_res.status_code, http_res_text, http_res
1106
- )
1005
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1107
1006
 
1108
- content_type = http_res.headers.get("Content-Type")
1109
- http_res_text = await utils.stream_to_text_async(http_res)
1110
- raise errors.APIError(
1111
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1112
- http_res.status_code,
1113
- http_res_text,
1114
- http_res,
1115
- )
1007
+ raise errors.APIError("Unexpected response received", http_res)
1116
1008
 
1117
1009
  def link_token(
1118
1010
  self,
@@ -1227,48 +1119,35 @@ class ApplePay(BaseSDK):
1227
1119
  response_data: Any = None
1228
1120
  if utils.match_response(http_res, "200", "application/json"):
1229
1121
  return operations.LinkApplePayTokenResponse(
1230
- result=utils.unmarshal_json(
1231
- http_res.text, components.LinkedApplePayPaymentMethod
1122
+ result=utils.unmarshal_json_response(
1123
+ components.LinkedApplePayPaymentMethod, http_res
1232
1124
  ),
1233
1125
  headers=utils.get_response_headers(http_res.headers),
1234
1126
  )
1235
1127
  if utils.match_response(http_res, ["400", "409"], "application/json"):
1236
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
1237
- raise errors.GenericError(data=response_data)
1128
+ response_data = utils.unmarshal_json_response(
1129
+ errors.GenericErrorData, http_res
1130
+ )
1131
+ raise errors.GenericError(response_data, http_res)
1238
1132
  if utils.match_response(http_res, "422", "application/json"):
1239
- response_data = utils.unmarshal_json(
1240
- http_res.text, errors.LinkApplePayErrorData
1133
+ response_data = utils.unmarshal_json_response(
1134
+ errors.LinkApplePayErrorData, http_res
1241
1135
  )
1242
- raise errors.LinkApplePayError(data=response_data)
1136
+ raise errors.LinkApplePayError(response_data, http_res)
1243
1137
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1244
1138
  http_res_text = utils.stream_to_text(http_res)
1245
- raise errors.APIError(
1246
- "API error occurred", http_res.status_code, http_res_text, http_res
1247
- )
1139
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1248
1140
  if utils.match_response(http_res, ["500", "504"], "*"):
1249
1141
  http_res_text = utils.stream_to_text(http_res)
1250
- raise errors.APIError(
1251
- "API error occurred", http_res.status_code, http_res_text, http_res
1252
- )
1142
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1253
1143
  if utils.match_response(http_res, "4XX", "*"):
1254
1144
  http_res_text = utils.stream_to_text(http_res)
1255
- raise errors.APIError(
1256
- "API error occurred", http_res.status_code, http_res_text, http_res
1257
- )
1145
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1258
1146
  if utils.match_response(http_res, "5XX", "*"):
1259
1147
  http_res_text = utils.stream_to_text(http_res)
1260
- raise errors.APIError(
1261
- "API error occurred", http_res.status_code, http_res_text, http_res
1262
- )
1148
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1263
1149
 
1264
- content_type = http_res.headers.get("Content-Type")
1265
- http_res_text = utils.stream_to_text(http_res)
1266
- raise errors.APIError(
1267
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1268
- http_res.status_code,
1269
- http_res_text,
1270
- http_res,
1271
- )
1150
+ raise errors.APIError("Unexpected response received", http_res)
1272
1151
 
1273
1152
  async def link_token_async(
1274
1153
  self,
@@ -1383,45 +1262,32 @@ class ApplePay(BaseSDK):
1383
1262
  response_data: Any = None
1384
1263
  if utils.match_response(http_res, "200", "application/json"):
1385
1264
  return operations.LinkApplePayTokenResponse(
1386
- result=utils.unmarshal_json(
1387
- http_res.text, components.LinkedApplePayPaymentMethod
1265
+ result=utils.unmarshal_json_response(
1266
+ components.LinkedApplePayPaymentMethod, http_res
1388
1267
  ),
1389
1268
  headers=utils.get_response_headers(http_res.headers),
1390
1269
  )
1391
1270
  if utils.match_response(http_res, ["400", "409"], "application/json"):
1392
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
1393
- raise errors.GenericError(data=response_data)
1271
+ response_data = utils.unmarshal_json_response(
1272
+ errors.GenericErrorData, http_res
1273
+ )
1274
+ raise errors.GenericError(response_data, http_res)
1394
1275
  if utils.match_response(http_res, "422", "application/json"):
1395
- response_data = utils.unmarshal_json(
1396
- http_res.text, errors.LinkApplePayErrorData
1276
+ response_data = utils.unmarshal_json_response(
1277
+ errors.LinkApplePayErrorData, http_res
1397
1278
  )
1398
- raise errors.LinkApplePayError(data=response_data)
1279
+ raise errors.LinkApplePayError(response_data, http_res)
1399
1280
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1400
1281
  http_res_text = await utils.stream_to_text_async(http_res)
1401
- raise errors.APIError(
1402
- "API error occurred", http_res.status_code, http_res_text, http_res
1403
- )
1282
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1404
1283
  if utils.match_response(http_res, ["500", "504"], "*"):
1405
1284
  http_res_text = await utils.stream_to_text_async(http_res)
1406
- raise errors.APIError(
1407
- "API error occurred", http_res.status_code, http_res_text, http_res
1408
- )
1285
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1409
1286
  if utils.match_response(http_res, "4XX", "*"):
1410
1287
  http_res_text = await utils.stream_to_text_async(http_res)
1411
- raise errors.APIError(
1412
- "API error occurred", http_res.status_code, http_res_text, http_res
1413
- )
1288
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1414
1289
  if utils.match_response(http_res, "5XX", "*"):
1415
1290
  http_res_text = await utils.stream_to_text_async(http_res)
1416
- raise errors.APIError(
1417
- "API error occurred", http_res.status_code, http_res_text, http_res
1418
- )
1291
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1419
1292
 
1420
- content_type = http_res.headers.get("Content-Type")
1421
- http_res_text = await utils.stream_to_text_async(http_res)
1422
- raise errors.APIError(
1423
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1424
- http_res.status_code,
1425
- http_res_text,
1426
- http_res,
1427
- )
1293
+ raise errors.APIError("Unexpected response received", http_res)