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
@@ -170,46 +170,33 @@ class PaymentLinks(BaseSDK):
170
170
  response_data: Any = None
171
171
  if utils.match_response(http_res, "200", "application/json"):
172
172
  return operations.CreatePaymentLinkResponse(
173
- result=utils.unmarshal_json(http_res.text, components.PaymentLink),
173
+ result=utils.unmarshal_json_response(components.PaymentLink, http_res),
174
174
  headers=utils.get_response_headers(http_res.headers),
175
175
  )
176
176
  if utils.match_response(http_res, ["400", "409"], "application/json"):
177
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
178
- raise errors.GenericError(data=response_data)
177
+ response_data = utils.unmarshal_json_response(
178
+ errors.GenericErrorData, http_res
179
+ )
180
+ raise errors.GenericError(response_data, http_res)
179
181
  if utils.match_response(http_res, "422", "application/json"):
180
- response_data = utils.unmarshal_json(
181
- http_res.text, errors.CreatePaymentLinkErrorData
182
+ response_data = utils.unmarshal_json_response(
183
+ errors.CreatePaymentLinkErrorData, http_res
182
184
  )
183
- raise errors.CreatePaymentLinkError(data=response_data)
185
+ raise errors.CreatePaymentLinkError(response_data, http_res)
184
186
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
185
187
  http_res_text = utils.stream_to_text(http_res)
186
- raise errors.APIError(
187
- "API error occurred", http_res.status_code, http_res_text, http_res
188
- )
188
+ raise errors.APIError("API error occurred", http_res, http_res_text)
189
189
  if utils.match_response(http_res, ["500", "504"], "*"):
190
190
  http_res_text = utils.stream_to_text(http_res)
191
- raise errors.APIError(
192
- "API error occurred", http_res.status_code, http_res_text, http_res
193
- )
191
+ raise errors.APIError("API error occurred", http_res, http_res_text)
194
192
  if utils.match_response(http_res, "4XX", "*"):
195
193
  http_res_text = utils.stream_to_text(http_res)
196
- raise errors.APIError(
197
- "API error occurred", http_res.status_code, http_res_text, http_res
198
- )
194
+ raise errors.APIError("API error occurred", http_res, http_res_text)
199
195
  if utils.match_response(http_res, "5XX", "*"):
200
196
  http_res_text = utils.stream_to_text(http_res)
201
- raise errors.APIError(
202
- "API error occurred", http_res.status_code, http_res_text, http_res
203
- )
197
+ raise errors.APIError("API error occurred", http_res, http_res_text)
204
198
 
205
- content_type = http_res.headers.get("Content-Type")
206
- http_res_text = utils.stream_to_text(http_res)
207
- raise errors.APIError(
208
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
209
- http_res.status_code,
210
- http_res_text,
211
- http_res,
212
- )
199
+ raise errors.APIError("Unexpected response received", http_res)
213
200
 
214
201
  async def create_async(
215
202
  self,
@@ -364,46 +351,33 @@ class PaymentLinks(BaseSDK):
364
351
  response_data: Any = None
365
352
  if utils.match_response(http_res, "200", "application/json"):
366
353
  return operations.CreatePaymentLinkResponse(
367
- result=utils.unmarshal_json(http_res.text, components.PaymentLink),
354
+ result=utils.unmarshal_json_response(components.PaymentLink, http_res),
368
355
  headers=utils.get_response_headers(http_res.headers),
369
356
  )
370
357
  if utils.match_response(http_res, ["400", "409"], "application/json"):
371
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
372
- raise errors.GenericError(data=response_data)
358
+ response_data = utils.unmarshal_json_response(
359
+ errors.GenericErrorData, http_res
360
+ )
361
+ raise errors.GenericError(response_data, http_res)
373
362
  if utils.match_response(http_res, "422", "application/json"):
374
- response_data = utils.unmarshal_json(
375
- http_res.text, errors.CreatePaymentLinkErrorData
363
+ response_data = utils.unmarshal_json_response(
364
+ errors.CreatePaymentLinkErrorData, http_res
376
365
  )
377
- raise errors.CreatePaymentLinkError(data=response_data)
366
+ raise errors.CreatePaymentLinkError(response_data, http_res)
378
367
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
379
368
  http_res_text = await utils.stream_to_text_async(http_res)
380
- raise errors.APIError(
381
- "API error occurred", http_res.status_code, http_res_text, http_res
382
- )
369
+ raise errors.APIError("API error occurred", http_res, http_res_text)
383
370
  if utils.match_response(http_res, ["500", "504"], "*"):
384
371
  http_res_text = await utils.stream_to_text_async(http_res)
385
- raise errors.APIError(
386
- "API error occurred", http_res.status_code, http_res_text, http_res
387
- )
372
+ raise errors.APIError("API error occurred", http_res, http_res_text)
388
373
  if utils.match_response(http_res, "4XX", "*"):
389
374
  http_res_text = await utils.stream_to_text_async(http_res)
390
- raise errors.APIError(
391
- "API error occurred", http_res.status_code, http_res_text, http_res
392
- )
375
+ raise errors.APIError("API error occurred", http_res, http_res_text)
393
376
  if utils.match_response(http_res, "5XX", "*"):
394
377
  http_res_text = await utils.stream_to_text_async(http_res)
395
- raise errors.APIError(
396
- "API error occurred", http_res.status_code, http_res_text, http_res
397
- )
378
+ raise errors.APIError("API error occurred", http_res, http_res_text)
398
379
 
399
- content_type = http_res.headers.get("Content-Type")
400
- http_res_text = await utils.stream_to_text_async(http_res)
401
- raise errors.APIError(
402
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
403
- http_res.status_code,
404
- http_res_text,
405
- http_res,
406
- )
380
+ raise errors.APIError("Unexpected response received", http_res)
407
381
 
408
382
  def list(
409
383
  self,
@@ -483,40 +457,25 @@ class PaymentLinks(BaseSDK):
483
457
 
484
458
  if utils.match_response(http_res, "200", "application/json"):
485
459
  return operations.ListPaymentLinksResponse(
486
- result=utils.unmarshal_json(
487
- http_res.text, List[components.PaymentLink]
460
+ result=utils.unmarshal_json_response(
461
+ List[components.PaymentLink], http_res
488
462
  ),
489
463
  headers=utils.get_response_headers(http_res.headers),
490
464
  )
491
465
  if utils.match_response(http_res, ["401", "403", "429"], "*"):
492
466
  http_res_text = utils.stream_to_text(http_res)
493
- raise errors.APIError(
494
- "API error occurred", http_res.status_code, http_res_text, http_res
495
- )
467
+ raise errors.APIError("API error occurred", http_res, http_res_text)
496
468
  if utils.match_response(http_res, ["500", "504"], "*"):
497
469
  http_res_text = utils.stream_to_text(http_res)
498
- raise errors.APIError(
499
- "API error occurred", http_res.status_code, http_res_text, http_res
500
- )
470
+ raise errors.APIError("API error occurred", http_res, http_res_text)
501
471
  if utils.match_response(http_res, "4XX", "*"):
502
472
  http_res_text = utils.stream_to_text(http_res)
503
- raise errors.APIError(
504
- "API error occurred", http_res.status_code, http_res_text, http_res
505
- )
473
+ raise errors.APIError("API error occurred", http_res, http_res_text)
506
474
  if utils.match_response(http_res, "5XX", "*"):
507
475
  http_res_text = utils.stream_to_text(http_res)
508
- raise errors.APIError(
509
- "API error occurred", http_res.status_code, http_res_text, http_res
510
- )
476
+ raise errors.APIError("API error occurred", http_res, http_res_text)
511
477
 
512
- content_type = http_res.headers.get("Content-Type")
513
- http_res_text = utils.stream_to_text(http_res)
514
- raise errors.APIError(
515
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
516
- http_res.status_code,
517
- http_res_text,
518
- http_res,
519
- )
478
+ raise errors.APIError("Unexpected response received", http_res)
520
479
 
521
480
  async def list_async(
522
481
  self,
@@ -596,40 +555,25 @@ class PaymentLinks(BaseSDK):
596
555
 
597
556
  if utils.match_response(http_res, "200", "application/json"):
598
557
  return operations.ListPaymentLinksResponse(
599
- result=utils.unmarshal_json(
600
- http_res.text, List[components.PaymentLink]
558
+ result=utils.unmarshal_json_response(
559
+ List[components.PaymentLink], http_res
601
560
  ),
602
561
  headers=utils.get_response_headers(http_res.headers),
603
562
  )
604
563
  if utils.match_response(http_res, ["401", "403", "429"], "*"):
605
564
  http_res_text = await utils.stream_to_text_async(http_res)
606
- raise errors.APIError(
607
- "API error occurred", http_res.status_code, http_res_text, http_res
608
- )
565
+ raise errors.APIError("API error occurred", http_res, http_res_text)
609
566
  if utils.match_response(http_res, ["500", "504"], "*"):
610
567
  http_res_text = await utils.stream_to_text_async(http_res)
611
- raise errors.APIError(
612
- "API error occurred", http_res.status_code, http_res_text, http_res
613
- )
568
+ raise errors.APIError("API error occurred", http_res, http_res_text)
614
569
  if utils.match_response(http_res, "4XX", "*"):
615
570
  http_res_text = await utils.stream_to_text_async(http_res)
616
- raise errors.APIError(
617
- "API error occurred", http_res.status_code, http_res_text, http_res
618
- )
571
+ raise errors.APIError("API error occurred", http_res, http_res_text)
619
572
  if utils.match_response(http_res, "5XX", "*"):
620
573
  http_res_text = await utils.stream_to_text_async(http_res)
621
- raise errors.APIError(
622
- "API error occurred", http_res.status_code, http_res_text, http_res
623
- )
574
+ raise errors.APIError("API error occurred", http_res, http_res_text)
624
575
 
625
- content_type = http_res.headers.get("Content-Type")
626
- http_res_text = await utils.stream_to_text_async(http_res)
627
- raise errors.APIError(
628
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
629
- http_res.status_code,
630
- http_res_text,
631
- http_res,
632
- )
576
+ raise errors.APIError("Unexpected response received", http_res)
633
577
 
634
578
  def get(
635
579
  self,
@@ -712,38 +656,23 @@ class PaymentLinks(BaseSDK):
712
656
 
713
657
  if utils.match_response(http_res, "200", "application/json"):
714
658
  return operations.GetPaymentLinkResponse(
715
- result=utils.unmarshal_json(http_res.text, components.PaymentLink),
659
+ result=utils.unmarshal_json_response(components.PaymentLink, http_res),
716
660
  headers=utils.get_response_headers(http_res.headers),
717
661
  )
718
662
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
719
663
  http_res_text = utils.stream_to_text(http_res)
720
- raise errors.APIError(
721
- "API error occurred", http_res.status_code, http_res_text, http_res
722
- )
664
+ raise errors.APIError("API error occurred", http_res, http_res_text)
723
665
  if utils.match_response(http_res, ["500", "504"], "*"):
724
666
  http_res_text = utils.stream_to_text(http_res)
725
- raise errors.APIError(
726
- "API error occurred", http_res.status_code, http_res_text, http_res
727
- )
667
+ raise errors.APIError("API error occurred", http_res, http_res_text)
728
668
  if utils.match_response(http_res, "4XX", "*"):
729
669
  http_res_text = utils.stream_to_text(http_res)
730
- raise errors.APIError(
731
- "API error occurred", http_res.status_code, http_res_text, http_res
732
- )
670
+ raise errors.APIError("API error occurred", http_res, http_res_text)
733
671
  if utils.match_response(http_res, "5XX", "*"):
734
672
  http_res_text = utils.stream_to_text(http_res)
735
- raise errors.APIError(
736
- "API error occurred", http_res.status_code, http_res_text, http_res
737
- )
673
+ raise errors.APIError("API error occurred", http_res, http_res_text)
738
674
 
739
- content_type = http_res.headers.get("Content-Type")
740
- http_res_text = utils.stream_to_text(http_res)
741
- raise errors.APIError(
742
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
743
- http_res.status_code,
744
- http_res_text,
745
- http_res,
746
- )
675
+ raise errors.APIError("Unexpected response received", http_res)
747
676
 
748
677
  async def get_async(
749
678
  self,
@@ -826,38 +755,23 @@ class PaymentLinks(BaseSDK):
826
755
 
827
756
  if utils.match_response(http_res, "200", "application/json"):
828
757
  return operations.GetPaymentLinkResponse(
829
- result=utils.unmarshal_json(http_res.text, components.PaymentLink),
758
+ result=utils.unmarshal_json_response(components.PaymentLink, http_res),
830
759
  headers=utils.get_response_headers(http_res.headers),
831
760
  )
832
761
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
833
762
  http_res_text = await utils.stream_to_text_async(http_res)
834
- raise errors.APIError(
835
- "API error occurred", http_res.status_code, http_res_text, http_res
836
- )
763
+ raise errors.APIError("API error occurred", http_res, http_res_text)
837
764
  if utils.match_response(http_res, ["500", "504"], "*"):
838
765
  http_res_text = await utils.stream_to_text_async(http_res)
839
- raise errors.APIError(
840
- "API error occurred", http_res.status_code, http_res_text, http_res
841
- )
766
+ raise errors.APIError("API error occurred", http_res, http_res_text)
842
767
  if utils.match_response(http_res, "4XX", "*"):
843
768
  http_res_text = await utils.stream_to_text_async(http_res)
844
- raise errors.APIError(
845
- "API error occurred", http_res.status_code, http_res_text, http_res
846
- )
769
+ raise errors.APIError("API error occurred", http_res, http_res_text)
847
770
  if utils.match_response(http_res, "5XX", "*"):
848
771
  http_res_text = await utils.stream_to_text_async(http_res)
849
- raise errors.APIError(
850
- "API error occurred", http_res.status_code, http_res_text, http_res
851
- )
772
+ raise errors.APIError("API error occurred", http_res, http_res_text)
852
773
 
853
- content_type = http_res.headers.get("Content-Type")
854
- http_res_text = await utils.stream_to_text_async(http_res)
855
- raise errors.APIError(
856
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
857
- http_res.status_code,
858
- http_res_text,
859
- http_res,
860
- )
774
+ raise errors.APIError("Unexpected response received", http_res)
861
775
 
862
776
  def update(
863
777
  self,
@@ -1012,46 +926,33 @@ class PaymentLinks(BaseSDK):
1012
926
  response_data: Any = None
1013
927
  if utils.match_response(http_res, "200", "application/json"):
1014
928
  return operations.UpdatePaymentLinkResponse(
1015
- result=utils.unmarshal_json(http_res.text, components.PaymentLink),
929
+ result=utils.unmarshal_json_response(components.PaymentLink, http_res),
1016
930
  headers=utils.get_response_headers(http_res.headers),
1017
931
  )
1018
932
  if utils.match_response(http_res, ["400", "409"], "application/json"):
1019
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
1020
- raise errors.GenericError(data=response_data)
933
+ response_data = utils.unmarshal_json_response(
934
+ errors.GenericErrorData, http_res
935
+ )
936
+ raise errors.GenericError(response_data, http_res)
1021
937
  if utils.match_response(http_res, "422", "application/json"):
1022
- response_data = utils.unmarshal_json(
1023
- http_res.text, errors.UpdatePaymentLinkErrorData
938
+ response_data = utils.unmarshal_json_response(
939
+ errors.UpdatePaymentLinkErrorData, http_res
1024
940
  )
1025
- raise errors.UpdatePaymentLinkError(data=response_data)
941
+ raise errors.UpdatePaymentLinkError(response_data, http_res)
1026
942
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1027
943
  http_res_text = utils.stream_to_text(http_res)
1028
- raise errors.APIError(
1029
- "API error occurred", http_res.status_code, http_res_text, http_res
1030
- )
944
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1031
945
  if utils.match_response(http_res, ["500", "504"], "*"):
1032
946
  http_res_text = utils.stream_to_text(http_res)
1033
- raise errors.APIError(
1034
- "API error occurred", http_res.status_code, http_res_text, http_res
1035
- )
947
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1036
948
  if utils.match_response(http_res, "4XX", "*"):
1037
949
  http_res_text = utils.stream_to_text(http_res)
1038
- raise errors.APIError(
1039
- "API error occurred", http_res.status_code, http_res_text, http_res
1040
- )
950
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1041
951
  if utils.match_response(http_res, "5XX", "*"):
1042
952
  http_res_text = utils.stream_to_text(http_res)
1043
- raise errors.APIError(
1044
- "API error occurred", http_res.status_code, http_res_text, http_res
1045
- )
953
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1046
954
 
1047
- content_type = http_res.headers.get("Content-Type")
1048
- http_res_text = utils.stream_to_text(http_res)
1049
- raise errors.APIError(
1050
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1051
- http_res.status_code,
1052
- http_res_text,
1053
- http_res,
1054
- )
955
+ raise errors.APIError("Unexpected response received", http_res)
1055
956
 
1056
957
  async def update_async(
1057
958
  self,
@@ -1206,46 +1107,33 @@ class PaymentLinks(BaseSDK):
1206
1107
  response_data: Any = None
1207
1108
  if utils.match_response(http_res, "200", "application/json"):
1208
1109
  return operations.UpdatePaymentLinkResponse(
1209
- result=utils.unmarshal_json(http_res.text, components.PaymentLink),
1110
+ result=utils.unmarshal_json_response(components.PaymentLink, http_res),
1210
1111
  headers=utils.get_response_headers(http_res.headers),
1211
1112
  )
1212
1113
  if utils.match_response(http_res, ["400", "409"], "application/json"):
1213
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
1214
- raise errors.GenericError(data=response_data)
1114
+ response_data = utils.unmarshal_json_response(
1115
+ errors.GenericErrorData, http_res
1116
+ )
1117
+ raise errors.GenericError(response_data, http_res)
1215
1118
  if utils.match_response(http_res, "422", "application/json"):
1216
- response_data = utils.unmarshal_json(
1217
- http_res.text, errors.UpdatePaymentLinkErrorData
1119
+ response_data = utils.unmarshal_json_response(
1120
+ errors.UpdatePaymentLinkErrorData, http_res
1218
1121
  )
1219
- raise errors.UpdatePaymentLinkError(data=response_data)
1122
+ raise errors.UpdatePaymentLinkError(response_data, http_res)
1220
1123
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1221
1124
  http_res_text = await utils.stream_to_text_async(http_res)
1222
- raise errors.APIError(
1223
- "API error occurred", http_res.status_code, http_res_text, http_res
1224
- )
1125
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1225
1126
  if utils.match_response(http_res, ["500", "504"], "*"):
1226
1127
  http_res_text = await utils.stream_to_text_async(http_res)
1227
- raise errors.APIError(
1228
- "API error occurred", http_res.status_code, http_res_text, http_res
1229
- )
1128
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1230
1129
  if utils.match_response(http_res, "4XX", "*"):
1231
1130
  http_res_text = await utils.stream_to_text_async(http_res)
1232
- raise errors.APIError(
1233
- "API error occurred", http_res.status_code, http_res_text, http_res
1234
- )
1131
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1235
1132
  if utils.match_response(http_res, "5XX", "*"):
1236
1133
  http_res_text = await utils.stream_to_text_async(http_res)
1237
- raise errors.APIError(
1238
- "API error occurred", http_res.status_code, http_res_text, http_res
1239
- )
1134
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1240
1135
 
1241
- content_type = http_res.headers.get("Content-Type")
1242
- http_res_text = await utils.stream_to_text_async(http_res)
1243
- raise errors.APIError(
1244
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1245
- http_res.status_code,
1246
- http_res_text,
1247
- http_res,
1248
- )
1136
+ raise errors.APIError("Unexpected response received", http_res)
1249
1137
 
1250
1138
  def disable(
1251
1139
  self,
@@ -1332,33 +1220,18 @@ class PaymentLinks(BaseSDK):
1332
1220
  )
1333
1221
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1334
1222
  http_res_text = utils.stream_to_text(http_res)
1335
- raise errors.APIError(
1336
- "API error occurred", http_res.status_code, http_res_text, http_res
1337
- )
1223
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1338
1224
  if utils.match_response(http_res, ["500", "504"], "*"):
1339
1225
  http_res_text = utils.stream_to_text(http_res)
1340
- raise errors.APIError(
1341
- "API error occurred", http_res.status_code, http_res_text, http_res
1342
- )
1226
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1343
1227
  if utils.match_response(http_res, "4XX", "*"):
1344
1228
  http_res_text = utils.stream_to_text(http_res)
1345
- raise errors.APIError(
1346
- "API error occurred", http_res.status_code, http_res_text, http_res
1347
- )
1229
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1348
1230
  if utils.match_response(http_res, "5XX", "*"):
1349
1231
  http_res_text = utils.stream_to_text(http_res)
1350
- raise errors.APIError(
1351
- "API error occurred", http_res.status_code, http_res_text, http_res
1352
- )
1232
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1353
1233
 
1354
- content_type = http_res.headers.get("Content-Type")
1355
- http_res_text = utils.stream_to_text(http_res)
1356
- raise errors.APIError(
1357
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1358
- http_res.status_code,
1359
- http_res_text,
1360
- http_res,
1361
- )
1234
+ raise errors.APIError("Unexpected response received", http_res)
1362
1235
 
1363
1236
  async def disable_async(
1364
1237
  self,
@@ -1445,33 +1318,18 @@ class PaymentLinks(BaseSDK):
1445
1318
  )
1446
1319
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1447
1320
  http_res_text = await utils.stream_to_text_async(http_res)
1448
- raise errors.APIError(
1449
- "API error occurred", http_res.status_code, http_res_text, http_res
1450
- )
1321
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1451
1322
  if utils.match_response(http_res, ["500", "504"], "*"):
1452
1323
  http_res_text = await utils.stream_to_text_async(http_res)
1453
- raise errors.APIError(
1454
- "API error occurred", http_res.status_code, http_res_text, http_res
1455
- )
1324
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1456
1325
  if utils.match_response(http_res, "4XX", "*"):
1457
1326
  http_res_text = await utils.stream_to_text_async(http_res)
1458
- raise errors.APIError(
1459
- "API error occurred", http_res.status_code, http_res_text, http_res
1460
- )
1327
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1461
1328
  if utils.match_response(http_res, "5XX", "*"):
1462
1329
  http_res_text = await utils.stream_to_text_async(http_res)
1463
- raise errors.APIError(
1464
- "API error occurred", http_res.status_code, http_res_text, http_res
1465
- )
1330
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1466
1331
 
1467
- content_type = http_res.headers.get("Content-Type")
1468
- http_res_text = await utils.stream_to_text_async(http_res)
1469
- raise errors.APIError(
1470
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1471
- http_res.status_code,
1472
- http_res_text,
1473
- http_res,
1474
- )
1332
+ raise errors.APIError("Unexpected response received", http_res)
1475
1333
 
1476
1334
  def get_qr_code(
1477
1335
  self,
@@ -1560,9 +1418,11 @@ class PaymentLinks(BaseSDK):
1560
1418
  )
1561
1419
 
1562
1420
  if utils.match_response(http_res, "200", "application/json"):
1563
- http_response_text = utils.stream_to_text(http_res)
1421
+ http_res_text = utils.stream_to_text(http_res)
1564
1422
  return operations.GetPaymentLinkQRCodeResponse(
1565
- result=utils.unmarshal_json(http_response_text, components.QRCode),
1423
+ result=utils.unmarshal_json_response(
1424
+ components.QRCode, http_res, http_res_text
1425
+ ),
1566
1426
  headers=utils.get_response_headers(http_res.headers),
1567
1427
  )
1568
1428
  if utils.match_response(http_res, "200", "image/png"):
@@ -1571,33 +1431,19 @@ class PaymentLinks(BaseSDK):
1571
1431
  )
1572
1432
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1573
1433
  http_res_text = utils.stream_to_text(http_res)
1574
- raise errors.APIError(
1575
- "API error occurred", http_res.status_code, http_res_text, http_res
1576
- )
1434
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1577
1435
  if utils.match_response(http_res, ["500", "504"], "*"):
1578
1436
  http_res_text = utils.stream_to_text(http_res)
1579
- raise errors.APIError(
1580
- "API error occurred", http_res.status_code, http_res_text, http_res
1581
- )
1437
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1582
1438
  if utils.match_response(http_res, "4XX", "*"):
1583
1439
  http_res_text = utils.stream_to_text(http_res)
1584
- raise errors.APIError(
1585
- "API error occurred", http_res.status_code, http_res_text, http_res
1586
- )
1440
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1587
1441
  if utils.match_response(http_res, "5XX", "*"):
1588
1442
  http_res_text = utils.stream_to_text(http_res)
1589
- raise errors.APIError(
1590
- "API error occurred", http_res.status_code, http_res_text, http_res
1591
- )
1443
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1592
1444
 
1593
- content_type = http_res.headers.get("Content-Type")
1594
1445
  http_res_text = utils.stream_to_text(http_res)
1595
- raise errors.APIError(
1596
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1597
- http_res.status_code,
1598
- http_res_text,
1599
- http_res,
1600
- )
1446
+ raise errors.APIError("Unexpected response received", http_res, http_res_text)
1601
1447
 
1602
1448
  async def get_qr_code_async(
1603
1449
  self,
@@ -1686,9 +1532,11 @@ class PaymentLinks(BaseSDK):
1686
1532
  )
1687
1533
 
1688
1534
  if utils.match_response(http_res, "200", "application/json"):
1689
- http_response_text = await utils.stream_to_text_async(http_res)
1535
+ http_res_text = await utils.stream_to_text_async(http_res)
1690
1536
  return operations.GetPaymentLinkQRCodeResponse(
1691
- result=utils.unmarshal_json(http_response_text, components.QRCode),
1537
+ result=utils.unmarshal_json_response(
1538
+ components.QRCode, http_res, http_res_text
1539
+ ),
1692
1540
  headers=utils.get_response_headers(http_res.headers),
1693
1541
  )
1694
1542
  if utils.match_response(http_res, "200", "image/png"):
@@ -1697,30 +1545,16 @@ class PaymentLinks(BaseSDK):
1697
1545
  )
1698
1546
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1699
1547
  http_res_text = await utils.stream_to_text_async(http_res)
1700
- raise errors.APIError(
1701
- "API error occurred", http_res.status_code, http_res_text, http_res
1702
- )
1548
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1703
1549
  if utils.match_response(http_res, ["500", "504"], "*"):
1704
1550
  http_res_text = await utils.stream_to_text_async(http_res)
1705
- raise errors.APIError(
1706
- "API error occurred", http_res.status_code, http_res_text, http_res
1707
- )
1551
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1708
1552
  if utils.match_response(http_res, "4XX", "*"):
1709
1553
  http_res_text = await utils.stream_to_text_async(http_res)
1710
- raise errors.APIError(
1711
- "API error occurred", http_res.status_code, http_res_text, http_res
1712
- )
1554
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1713
1555
  if utils.match_response(http_res, "5XX", "*"):
1714
1556
  http_res_text = await utils.stream_to_text_async(http_res)
1715
- raise errors.APIError(
1716
- "API error occurred", http_res.status_code, http_res_text, http_res
1717
- )
1557
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1718
1558
 
1719
- content_type = http_res.headers.get("Content-Type")
1720
1559
  http_res_text = await utils.stream_to_text_async(http_res)
1721
- raise errors.APIError(
1722
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1723
- http_res.status_code,
1724
- http_res_text,
1725
- http_res,
1726
- )
1560
+ raise errors.APIError("Unexpected response received", http_res, http_res_text)