moovio_sdk 0.13.1__py3-none-any.whl → 0.13.2__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.
- moovio_sdk/_version.py +3 -3
- moovio_sdk/account_terminal_applications.py +13 -16
- moovio_sdk/accounts.py +29 -56
- moovio_sdk/adjustments.py +5 -8
- moovio_sdk/apple_pay.py +19 -34
- moovio_sdk/authentication.py +11 -18
- moovio_sdk/bank_accounts.py +31 -58
- moovio_sdk/branding.py +21 -48
- moovio_sdk/capabilities.py +13 -28
- moovio_sdk/card_issuing.py +17 -32
- moovio_sdk/cards.py +19 -34
- moovio_sdk/disputes.py +35 -66
- moovio_sdk/end_to_end_encryption.py +5 -8
- moovio_sdk/enriched_address.py +3 -2
- moovio_sdk/enriched_profile.py +3 -2
- moovio_sdk/fee_plans.py +19 -38
- moovio_sdk/files.py +11 -18
- moovio_sdk/industries.py +3 -6
- moovio_sdk/institutions.py +7 -10
- moovio_sdk/issuing_transactions.py +11 -10
- moovio_sdk/models/components/patchtransfer.py +9 -3
- moovio_sdk/onboarding.py +11 -22
- moovio_sdk/payment_links.py +19 -30
- moovio_sdk/payment_methods.py +5 -8
- moovio_sdk/receipts.py +7 -10
- moovio_sdk/representatives.py +17 -40
- moovio_sdk/scheduling.py +21 -44
- moovio_sdk/support.py +19 -26
- moovio_sdk/sweeps.py +21 -32
- moovio_sdk/terminal_applications.py +13 -20
- moovio_sdk/transfers.py +63 -100
- moovio_sdk/underwriting.py +15 -22
- moovio_sdk/utils/__init__.py +0 -3
- moovio_sdk/utils/serializers.py +1 -18
- moovio_sdk/utils/unmarshal_json_response.py +24 -0
- moovio_sdk/wallet_transactions.py +5 -8
- moovio_sdk/wallets.py +5 -4
- {moovio_sdk-0.13.1.dist-info → moovio_sdk-0.13.2.dist-info}/METADATA +1 -1
- {moovio_sdk-0.13.1.dist-info → moovio_sdk-0.13.2.dist-info}/RECORD +40 -39
- {moovio_sdk-0.13.1.dist-info → moovio_sdk-0.13.2.dist-info}/WHEEL +0 -0
moovio_sdk/transfers.py
CHANGED
@@ -7,6 +7,7 @@ from moovio_sdk._hooks import HookContext
|
|
7
7
|
from moovio_sdk.models import components, errors, operations
|
8
8
|
from moovio_sdk.types import OptionalNullable, UNSET
|
9
9
|
from moovio_sdk.utils import get_security_from_env
|
10
|
+
from moovio_sdk.utils.unmarshal_json_response import unmarshal_json_response
|
10
11
|
from typing import Any, Dict, List, Mapping, Optional, Union
|
11
12
|
|
12
13
|
|
@@ -133,18 +134,14 @@ class Transfers(BaseSDK):
|
|
133
134
|
response_data: Any = None
|
134
135
|
if utils.match_response(http_res, "200", "application/json"):
|
135
136
|
return operations.CreateTransferOptionsForAccountResponse(
|
136
|
-
result=
|
137
|
-
components.TransferOptions, http_res
|
138
|
-
),
|
137
|
+
result=unmarshal_json_response(components.TransferOptions, http_res),
|
139
138
|
headers=utils.get_response_headers(http_res.headers),
|
140
139
|
)
|
141
140
|
if utils.match_response(http_res, "400", "application/json"):
|
142
|
-
response_data =
|
143
|
-
errors.GenericErrorData, http_res
|
144
|
-
)
|
141
|
+
response_data = unmarshal_json_response(errors.GenericErrorData, http_res)
|
145
142
|
raise errors.GenericError(response_data, http_res)
|
146
143
|
if utils.match_response(http_res, "422", "application/json"):
|
147
|
-
response_data =
|
144
|
+
response_data = unmarshal_json_response(
|
148
145
|
errors.TransferOptionsValidationErrorData, http_res
|
149
146
|
)
|
150
147
|
raise errors.TransferOptionsValidationError(response_data, http_res)
|
@@ -285,18 +282,14 @@ class Transfers(BaseSDK):
|
|
285
282
|
response_data: Any = None
|
286
283
|
if utils.match_response(http_res, "200", "application/json"):
|
287
284
|
return operations.CreateTransferOptionsForAccountResponse(
|
288
|
-
result=
|
289
|
-
components.TransferOptions, http_res
|
290
|
-
),
|
285
|
+
result=unmarshal_json_response(components.TransferOptions, http_res),
|
291
286
|
headers=utils.get_response_headers(http_res.headers),
|
292
287
|
)
|
293
288
|
if utils.match_response(http_res, "400", "application/json"):
|
294
|
-
response_data =
|
295
|
-
errors.GenericErrorData, http_res
|
296
|
-
)
|
289
|
+
response_data = unmarshal_json_response(errors.GenericErrorData, http_res)
|
297
290
|
raise errors.GenericError(response_data, http_res)
|
298
291
|
if utils.match_response(http_res, "422", "application/json"):
|
299
|
-
response_data =
|
292
|
+
response_data = unmarshal_json_response(
|
300
293
|
errors.TransferOptionsValidationErrorData, http_res
|
301
294
|
)
|
302
295
|
raise errors.TransferOptionsValidationError(response_data, http_res)
|
@@ -458,33 +451,27 @@ class Transfers(BaseSDK):
|
|
458
451
|
response_data: Any = None
|
459
452
|
if utils.match_response(http_res, "200", "application/json"):
|
460
453
|
return operations.CreateTransferResponse(
|
461
|
-
result=
|
462
|
-
components.CreatedTransfer, http_res
|
463
|
-
),
|
454
|
+
result=unmarshal_json_response(components.CreatedTransfer, http_res),
|
464
455
|
headers=utils.get_response_headers(http_res.headers),
|
465
456
|
)
|
466
457
|
if utils.match_response(http_res, "201", "application/json"):
|
467
458
|
return operations.CreateTransferResponse(
|
468
|
-
result=
|
469
|
-
components.AsyncTransfer, http_res
|
470
|
-
),
|
459
|
+
result=unmarshal_json_response(components.AsyncTransfer, http_res),
|
471
460
|
headers=utils.get_response_headers(http_res.headers),
|
472
461
|
)
|
473
462
|
if utils.match_response(http_res, "202", "application/json"):
|
474
463
|
return operations.CreateTransferResponse(
|
475
|
-
result=
|
464
|
+
result=unmarshal_json_response(components.Transfer, http_res),
|
476
465
|
headers=utils.get_response_headers(http_res.headers),
|
477
466
|
)
|
478
467
|
if utils.match_response(http_res, "400", "application/json"):
|
479
|
-
response_data =
|
480
|
-
errors.GenericErrorData, http_res
|
481
|
-
)
|
468
|
+
response_data = unmarshal_json_response(errors.GenericErrorData, http_res)
|
482
469
|
raise errors.GenericError(response_data, http_res)
|
483
470
|
if utils.match_response(http_res, "409", "application/json"):
|
484
|
-
response_data =
|
471
|
+
response_data = unmarshal_json_response(errors.TransferData, http_res)
|
485
472
|
raise errors.Transfer(response_data, http_res)
|
486
473
|
if utils.match_response(http_res, "422", "application/json"):
|
487
|
-
response_data =
|
474
|
+
response_data = unmarshal_json_response(
|
488
475
|
errors.TransferValidationErrorData, http_res
|
489
476
|
)
|
490
477
|
raise errors.TransferValidationError(response_data, http_res)
|
@@ -646,33 +633,27 @@ class Transfers(BaseSDK):
|
|
646
633
|
response_data: Any = None
|
647
634
|
if utils.match_response(http_res, "200", "application/json"):
|
648
635
|
return operations.CreateTransferResponse(
|
649
|
-
result=
|
650
|
-
components.CreatedTransfer, http_res
|
651
|
-
),
|
636
|
+
result=unmarshal_json_response(components.CreatedTransfer, http_res),
|
652
637
|
headers=utils.get_response_headers(http_res.headers),
|
653
638
|
)
|
654
639
|
if utils.match_response(http_res, "201", "application/json"):
|
655
640
|
return operations.CreateTransferResponse(
|
656
|
-
result=
|
657
|
-
components.AsyncTransfer, http_res
|
658
|
-
),
|
641
|
+
result=unmarshal_json_response(components.AsyncTransfer, http_res),
|
659
642
|
headers=utils.get_response_headers(http_res.headers),
|
660
643
|
)
|
661
644
|
if utils.match_response(http_res, "202", "application/json"):
|
662
645
|
return operations.CreateTransferResponse(
|
663
|
-
result=
|
646
|
+
result=unmarshal_json_response(components.Transfer, http_res),
|
664
647
|
headers=utils.get_response_headers(http_res.headers),
|
665
648
|
)
|
666
649
|
if utils.match_response(http_res, "400", "application/json"):
|
667
|
-
response_data =
|
668
|
-
errors.GenericErrorData, http_res
|
669
|
-
)
|
650
|
+
response_data = unmarshal_json_response(errors.GenericErrorData, http_res)
|
670
651
|
raise errors.GenericError(response_data, http_res)
|
671
652
|
if utils.match_response(http_res, "409", "application/json"):
|
672
|
-
response_data =
|
653
|
+
response_data = unmarshal_json_response(errors.TransferData, http_res)
|
673
654
|
raise errors.Transfer(response_data, http_res)
|
674
655
|
if utils.match_response(http_res, "422", "application/json"):
|
675
|
-
response_data =
|
656
|
+
response_data = unmarshal_json_response(
|
676
657
|
errors.TransferValidationErrorData, http_res
|
677
658
|
)
|
678
659
|
raise errors.TransferValidationError(response_data, http_res)
|
@@ -812,9 +793,7 @@ class Transfers(BaseSDK):
|
|
812
793
|
|
813
794
|
if utils.match_response(http_res, "200", "application/json"):
|
814
795
|
return operations.ListTransfersResponse(
|
815
|
-
result=
|
816
|
-
List[components.Transfer], http_res
|
817
|
-
),
|
796
|
+
result=unmarshal_json_response(List[components.Transfer], http_res),
|
818
797
|
headers=utils.get_response_headers(http_res.headers),
|
819
798
|
)
|
820
799
|
if utils.match_response(http_res, ["401", "403", "429"], "*"):
|
@@ -953,9 +932,7 @@ class Transfers(BaseSDK):
|
|
953
932
|
|
954
933
|
if utils.match_response(http_res, "200", "application/json"):
|
955
934
|
return operations.ListTransfersResponse(
|
956
|
-
result=
|
957
|
-
List[components.Transfer], http_res
|
958
|
-
),
|
935
|
+
result=unmarshal_json_response(List[components.Transfer], http_res),
|
959
936
|
headers=utils.get_response_headers(http_res.headers),
|
960
937
|
)
|
961
938
|
if utils.match_response(http_res, ["401", "403", "429"], "*"):
|
@@ -1057,7 +1034,7 @@ class Transfers(BaseSDK):
|
|
1057
1034
|
|
1058
1035
|
if utils.match_response(http_res, "200", "application/json"):
|
1059
1036
|
return operations.GetTransferResponse(
|
1060
|
-
result=
|
1037
|
+
result=unmarshal_json_response(components.Transfer, http_res),
|
1061
1038
|
headers=utils.get_response_headers(http_res.headers),
|
1062
1039
|
)
|
1063
1040
|
if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
|
@@ -1159,7 +1136,7 @@ class Transfers(BaseSDK):
|
|
1159
1136
|
|
1160
1137
|
if utils.match_response(http_res, "200", "application/json"):
|
1161
1138
|
return operations.GetTransferResponse(
|
1162
|
-
result=
|
1139
|
+
result=unmarshal_json_response(components.Transfer, http_res),
|
1163
1140
|
headers=utils.get_response_headers(http_res.headers),
|
1164
1141
|
)
|
1165
1142
|
if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
|
@@ -1183,6 +1160,7 @@ class Transfers(BaseSDK):
|
|
1183
1160
|
transfer_id: str,
|
1184
1161
|
account_id: str,
|
1185
1162
|
metadata: OptionalNullable[Dict[str, str]] = UNSET,
|
1163
|
+
foreign_id: Optional[str] = None,
|
1186
1164
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
1187
1165
|
server_url: Optional[str] = None,
|
1188
1166
|
timeout_ms: Optional[int] = None,
|
@@ -1198,6 +1176,7 @@ class Transfers(BaseSDK):
|
|
1198
1176
|
:param transfer_id: Identifier for the transfer.
|
1199
1177
|
:param account_id:
|
1200
1178
|
:param metadata:
|
1179
|
+
:param foreign_id: Optional alias from a foreign/external system which can be used to reference this resource.
|
1201
1180
|
:param retries: Override the default retry configuration for this method
|
1202
1181
|
:param server_url: Override the default server URL for this method
|
1203
1182
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
@@ -1218,6 +1197,7 @@ class Transfers(BaseSDK):
|
|
1218
1197
|
account_id=account_id,
|
1219
1198
|
patch_transfer=components.PatchTransfer(
|
1220
1199
|
metadata=metadata,
|
1200
|
+
foreign_id=foreign_id,
|
1221
1201
|
),
|
1222
1202
|
)
|
1223
1203
|
|
@@ -1268,7 +1248,7 @@ class Transfers(BaseSDK):
|
|
1268
1248
|
|
1269
1249
|
if utils.match_response(http_res, "200", "application/json"):
|
1270
1250
|
return operations.UpdateTransferResponse(
|
1271
|
-
result=
|
1251
|
+
result=unmarshal_json_response(components.Transfer, http_res),
|
1272
1252
|
headers=utils.get_response_headers(http_res.headers),
|
1273
1253
|
)
|
1274
1254
|
if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
|
@@ -1292,6 +1272,7 @@ class Transfers(BaseSDK):
|
|
1292
1272
|
transfer_id: str,
|
1293
1273
|
account_id: str,
|
1294
1274
|
metadata: OptionalNullable[Dict[str, str]] = UNSET,
|
1275
|
+
foreign_id: Optional[str] = None,
|
1295
1276
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
1296
1277
|
server_url: Optional[str] = None,
|
1297
1278
|
timeout_ms: Optional[int] = None,
|
@@ -1307,6 +1288,7 @@ class Transfers(BaseSDK):
|
|
1307
1288
|
:param transfer_id: Identifier for the transfer.
|
1308
1289
|
:param account_id:
|
1309
1290
|
:param metadata:
|
1291
|
+
:param foreign_id: Optional alias from a foreign/external system which can be used to reference this resource.
|
1310
1292
|
:param retries: Override the default retry configuration for this method
|
1311
1293
|
:param server_url: Override the default server URL for this method
|
1312
1294
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
@@ -1327,6 +1309,7 @@ class Transfers(BaseSDK):
|
|
1327
1309
|
account_id=account_id,
|
1328
1310
|
patch_transfer=components.PatchTransfer(
|
1329
1311
|
metadata=metadata,
|
1312
|
+
foreign_id=foreign_id,
|
1330
1313
|
),
|
1331
1314
|
)
|
1332
1315
|
|
@@ -1377,7 +1360,7 @@ class Transfers(BaseSDK):
|
|
1377
1360
|
|
1378
1361
|
if utils.match_response(http_res, "200", "application/json"):
|
1379
1362
|
return operations.UpdateTransferResponse(
|
1380
|
-
result=
|
1363
|
+
result=unmarshal_json_response(components.Transfer, http_res),
|
1381
1364
|
headers=utils.get_response_headers(http_res.headers),
|
1382
1365
|
)
|
1383
1366
|
if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
|
@@ -1487,13 +1470,11 @@ class Transfers(BaseSDK):
|
|
1487
1470
|
response_data: Any = None
|
1488
1471
|
if utils.match_response(http_res, ["200", "202"], "application/json"):
|
1489
1472
|
return operations.CreateCancellationResponse(
|
1490
|
-
result=
|
1473
|
+
result=unmarshal_json_response(components.Cancellation, http_res),
|
1491
1474
|
headers=utils.get_response_headers(http_res.headers),
|
1492
1475
|
)
|
1493
1476
|
if utils.match_response(http_res, "400", "application/json"):
|
1494
|
-
response_data =
|
1495
|
-
errors.GenericErrorData, http_res
|
1496
|
-
)
|
1477
|
+
response_data = unmarshal_json_response(errors.GenericErrorData, http_res)
|
1497
1478
|
raise errors.GenericError(response_data, http_res)
|
1498
1479
|
if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
|
1499
1480
|
http_res_text = utils.stream_to_text(http_res)
|
@@ -1602,13 +1583,11 @@ class Transfers(BaseSDK):
|
|
1602
1583
|
response_data: Any = None
|
1603
1584
|
if utils.match_response(http_res, ["200", "202"], "application/json"):
|
1604
1585
|
return operations.CreateCancellationResponse(
|
1605
|
-
result=
|
1586
|
+
result=unmarshal_json_response(components.Cancellation, http_res),
|
1606
1587
|
headers=utils.get_response_headers(http_res.headers),
|
1607
1588
|
)
|
1608
1589
|
if utils.match_response(http_res, "400", "application/json"):
|
1609
|
-
response_data =
|
1610
|
-
errors.GenericErrorData, http_res
|
1611
|
-
)
|
1590
|
+
response_data = unmarshal_json_response(errors.GenericErrorData, http_res)
|
1612
1591
|
raise errors.GenericError(response_data, http_res)
|
1613
1592
|
if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
|
1614
1593
|
http_res_text = await utils.stream_to_text_async(http_res)
|
@@ -1709,7 +1688,7 @@ class Transfers(BaseSDK):
|
|
1709
1688
|
|
1710
1689
|
if utils.match_response(http_res, "200", "application/json"):
|
1711
1690
|
return operations.GetCancellationResponse(
|
1712
|
-
result=
|
1691
|
+
result=unmarshal_json_response(components.Cancellation, http_res),
|
1713
1692
|
headers=utils.get_response_headers(http_res.headers),
|
1714
1693
|
)
|
1715
1694
|
if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
|
@@ -1811,7 +1790,7 @@ class Transfers(BaseSDK):
|
|
1811
1790
|
|
1812
1791
|
if utils.match_response(http_res, "200", "application/json"):
|
1813
1792
|
return operations.GetCancellationResponse(
|
1814
|
-
result=
|
1793
|
+
result=unmarshal_json_response(components.Cancellation, http_res),
|
1815
1794
|
headers=utils.get_response_headers(http_res.headers),
|
1816
1795
|
)
|
1817
1796
|
if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
|
@@ -1942,30 +1921,28 @@ class Transfers(BaseSDK):
|
|
1942
1921
|
response_data: Any = None
|
1943
1922
|
if utils.match_response(http_res, "200", "application/json"):
|
1944
1923
|
return operations.InitiateRefundResponse(
|
1945
|
-
result=
|
1924
|
+
result=unmarshal_json_response(
|
1946
1925
|
components.CreateRefundResponse, http_res
|
1947
1926
|
),
|
1948
1927
|
headers=utils.get_response_headers(http_res.headers),
|
1949
1928
|
)
|
1950
1929
|
if utils.match_response(http_res, "202", "application/json"):
|
1951
1930
|
return operations.InitiateRefundResponse(
|
1952
|
-
result=
|
1931
|
+
result=unmarshal_json_response(
|
1953
1932
|
components.CardAcquiringRefund, http_res
|
1954
1933
|
),
|
1955
1934
|
headers=utils.get_response_headers(http_res.headers),
|
1956
1935
|
)
|
1957
1936
|
if utils.match_response(http_res, "400", "application/json"):
|
1958
|
-
response_data =
|
1959
|
-
errors.GenericErrorData, http_res
|
1960
|
-
)
|
1937
|
+
response_data = unmarshal_json_response(errors.GenericErrorData, http_res)
|
1961
1938
|
raise errors.GenericError(response_data, http_res)
|
1962
1939
|
if utils.match_response(http_res, "409", "application/json"):
|
1963
|
-
response_data =
|
1940
|
+
response_data = unmarshal_json_response(
|
1964
1941
|
errors.CardAcquiringRefundData, http_res
|
1965
1942
|
)
|
1966
1943
|
raise errors.CardAcquiringRefund(response_data, http_res)
|
1967
1944
|
if utils.match_response(http_res, "422", "application/json"):
|
1968
|
-
response_data =
|
1945
|
+
response_data = unmarshal_json_response(
|
1969
1946
|
errors.RefundValidationErrorData, http_res
|
1970
1947
|
)
|
1971
1948
|
raise errors.RefundValidationError(response_data, http_res)
|
@@ -2097,30 +2074,28 @@ class Transfers(BaseSDK):
|
|
2097
2074
|
response_data: Any = None
|
2098
2075
|
if utils.match_response(http_res, "200", "application/json"):
|
2099
2076
|
return operations.InitiateRefundResponse(
|
2100
|
-
result=
|
2077
|
+
result=unmarshal_json_response(
|
2101
2078
|
components.CreateRefundResponse, http_res
|
2102
2079
|
),
|
2103
2080
|
headers=utils.get_response_headers(http_res.headers),
|
2104
2081
|
)
|
2105
2082
|
if utils.match_response(http_res, "202", "application/json"):
|
2106
2083
|
return operations.InitiateRefundResponse(
|
2107
|
-
result=
|
2084
|
+
result=unmarshal_json_response(
|
2108
2085
|
components.CardAcquiringRefund, http_res
|
2109
2086
|
),
|
2110
2087
|
headers=utils.get_response_headers(http_res.headers),
|
2111
2088
|
)
|
2112
2089
|
if utils.match_response(http_res, "400", "application/json"):
|
2113
|
-
response_data =
|
2114
|
-
errors.GenericErrorData, http_res
|
2115
|
-
)
|
2090
|
+
response_data = unmarshal_json_response(errors.GenericErrorData, http_res)
|
2116
2091
|
raise errors.GenericError(response_data, http_res)
|
2117
2092
|
if utils.match_response(http_res, "409", "application/json"):
|
2118
|
-
response_data =
|
2093
|
+
response_data = unmarshal_json_response(
|
2119
2094
|
errors.CardAcquiringRefundData, http_res
|
2120
2095
|
)
|
2121
2096
|
raise errors.CardAcquiringRefund(response_data, http_res)
|
2122
2097
|
if utils.match_response(http_res, "422", "application/json"):
|
2123
|
-
response_data =
|
2098
|
+
response_data = unmarshal_json_response(
|
2124
2099
|
errors.RefundValidationErrorData, http_res
|
2125
2100
|
)
|
2126
2101
|
raise errors.RefundValidationError(response_data, http_res)
|
@@ -2220,7 +2195,7 @@ class Transfers(BaseSDK):
|
|
2220
2195
|
|
2221
2196
|
if utils.match_response(http_res, "200", "application/json"):
|
2222
2197
|
return operations.ListRefundsResponse(
|
2223
|
-
result=
|
2198
|
+
result=unmarshal_json_response(
|
2224
2199
|
List[components.CardAcquiringRefund], http_res
|
2225
2200
|
),
|
2226
2201
|
headers=utils.get_response_headers(http_res.headers),
|
@@ -2321,7 +2296,7 @@ class Transfers(BaseSDK):
|
|
2321
2296
|
|
2322
2297
|
if utils.match_response(http_res, "200", "application/json"):
|
2323
2298
|
return operations.ListRefundsResponse(
|
2324
|
-
result=
|
2299
|
+
result=unmarshal_json_response(
|
2325
2300
|
List[components.CardAcquiringRefund], http_res
|
2326
2301
|
),
|
2327
2302
|
headers=utils.get_response_headers(http_res.headers),
|
@@ -2425,7 +2400,7 @@ class Transfers(BaseSDK):
|
|
2425
2400
|
|
2426
2401
|
if utils.match_response(http_res, "200", "application/json"):
|
2427
2402
|
return operations.GetRefundResponse(
|
2428
|
-
result=
|
2403
|
+
result=unmarshal_json_response(
|
2429
2404
|
components.CardAcquiringRefund, http_res
|
2430
2405
|
),
|
2431
2406
|
headers=utils.get_response_headers(http_res.headers),
|
@@ -2529,7 +2504,7 @@ class Transfers(BaseSDK):
|
|
2529
2504
|
|
2530
2505
|
if utils.match_response(http_res, "200", "application/json"):
|
2531
2506
|
return operations.GetRefundResponse(
|
2532
|
-
result=
|
2507
|
+
result=unmarshal_json_response(
|
2533
2508
|
components.CardAcquiringRefund, http_res
|
2534
2509
|
),
|
2535
2510
|
headers=utils.get_response_headers(http_res.headers),
|
@@ -2660,16 +2635,14 @@ class Transfers(BaseSDK):
|
|
2660
2635
|
response_data: Any = None
|
2661
2636
|
if utils.match_response(http_res, ["200", "202"], "application/json"):
|
2662
2637
|
return operations.CreateReversalResponse(
|
2663
|
-
result=
|
2638
|
+
result=unmarshal_json_response(components.Reversal, http_res),
|
2664
2639
|
headers=utils.get_response_headers(http_res.headers),
|
2665
2640
|
)
|
2666
2641
|
if utils.match_response(http_res, ["400", "409"], "application/json"):
|
2667
|
-
response_data =
|
2668
|
-
errors.GenericErrorData, http_res
|
2669
|
-
)
|
2642
|
+
response_data = unmarshal_json_response(errors.GenericErrorData, http_res)
|
2670
2643
|
raise errors.GenericError(response_data, http_res)
|
2671
2644
|
if utils.match_response(http_res, "422", "application/json"):
|
2672
|
-
response_data =
|
2645
|
+
response_data = unmarshal_json_response(
|
2673
2646
|
errors.ReversalValidationErrorData, http_res
|
2674
2647
|
)
|
2675
2648
|
raise errors.ReversalValidationError(response_data, http_res)
|
@@ -2799,16 +2772,14 @@ class Transfers(BaseSDK):
|
|
2799
2772
|
response_data: Any = None
|
2800
2773
|
if utils.match_response(http_res, ["200", "202"], "application/json"):
|
2801
2774
|
return operations.CreateReversalResponse(
|
2802
|
-
result=
|
2775
|
+
result=unmarshal_json_response(components.Reversal, http_res),
|
2803
2776
|
headers=utils.get_response_headers(http_res.headers),
|
2804
2777
|
)
|
2805
2778
|
if utils.match_response(http_res, ["400", "409"], "application/json"):
|
2806
|
-
response_data =
|
2807
|
-
errors.GenericErrorData, http_res
|
2808
|
-
)
|
2779
|
+
response_data = unmarshal_json_response(errors.GenericErrorData, http_res)
|
2809
2780
|
raise errors.GenericError(response_data, http_res)
|
2810
2781
|
if utils.match_response(http_res, "422", "application/json"):
|
2811
|
-
response_data =
|
2782
|
+
response_data = unmarshal_json_response(
|
2812
2783
|
errors.ReversalValidationErrorData, http_res
|
2813
2784
|
)
|
2814
2785
|
raise errors.ReversalValidationError(response_data, http_res)
|
@@ -2938,18 +2909,14 @@ class Transfers(BaseSDK):
|
|
2938
2909
|
response_data: Any = None
|
2939
2910
|
if utils.match_response(http_res, "200", "application/json"):
|
2940
2911
|
return operations.CreateTransferOptionsResponse(
|
2941
|
-
result=
|
2942
|
-
components.TransferOptions, http_res
|
2943
|
-
),
|
2912
|
+
result=unmarshal_json_response(components.TransferOptions, http_res),
|
2944
2913
|
headers=utils.get_response_headers(http_res.headers),
|
2945
2914
|
)
|
2946
2915
|
if utils.match_response(http_res, "400", "application/json"):
|
2947
|
-
response_data =
|
2948
|
-
errors.GenericErrorData, http_res
|
2949
|
-
)
|
2916
|
+
response_data = unmarshal_json_response(errors.GenericErrorData, http_res)
|
2950
2917
|
raise errors.GenericError(response_data, http_res)
|
2951
2918
|
if utils.match_response(http_res, "422", "application/json"):
|
2952
|
-
response_data =
|
2919
|
+
response_data = unmarshal_json_response(
|
2953
2920
|
errors.TransferOptionsValidationErrorData, http_res
|
2954
2921
|
)
|
2955
2922
|
raise errors.TransferOptionsValidationError(response_data, http_res)
|
@@ -3079,18 +3046,14 @@ class Transfers(BaseSDK):
|
|
3079
3046
|
response_data: Any = None
|
3080
3047
|
if utils.match_response(http_res, "200", "application/json"):
|
3081
3048
|
return operations.CreateTransferOptionsResponse(
|
3082
|
-
result=
|
3083
|
-
components.TransferOptions, http_res
|
3084
|
-
),
|
3049
|
+
result=unmarshal_json_response(components.TransferOptions, http_res),
|
3085
3050
|
headers=utils.get_response_headers(http_res.headers),
|
3086
3051
|
)
|
3087
3052
|
if utils.match_response(http_res, "400", "application/json"):
|
3088
|
-
response_data =
|
3089
|
-
errors.GenericErrorData, http_res
|
3090
|
-
)
|
3053
|
+
response_data = unmarshal_json_response(errors.GenericErrorData, http_res)
|
3091
3054
|
raise errors.GenericError(response_data, http_res)
|
3092
3055
|
if utils.match_response(http_res, "422", "application/json"):
|
3093
|
-
response_data =
|
3056
|
+
response_data = unmarshal_json_response(
|
3094
3057
|
errors.TransferOptionsValidationErrorData, http_res
|
3095
3058
|
)
|
3096
3059
|
raise errors.TransferOptionsValidationError(response_data, http_res)
|
moovio_sdk/underwriting.py
CHANGED
@@ -6,6 +6,7 @@ from moovio_sdk._hooks import HookContext
|
|
6
6
|
from moovio_sdk.models import components, errors, operations
|
7
7
|
from moovio_sdk.types import OptionalNullable, UNSET
|
8
8
|
from moovio_sdk.utils import get_security_from_env
|
9
|
+
from moovio_sdk.utils.unmarshal_json_response import unmarshal_json_response
|
9
10
|
from typing import Any, Mapping, Optional, Union
|
10
11
|
|
11
12
|
|
@@ -90,7 +91,7 @@ class Underwriting(BaseSDK):
|
|
90
91
|
|
91
92
|
if utils.match_response(http_res, "200", "application/json"):
|
92
93
|
return operations.GetUnderwritingResponse(
|
93
|
-
result=
|
94
|
+
result=unmarshal_json_response(components.Underwriting, http_res),
|
94
95
|
headers=utils.get_response_headers(http_res.headers),
|
95
96
|
)
|
96
97
|
if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
|
@@ -188,7 +189,7 @@ class Underwriting(BaseSDK):
|
|
188
189
|
|
189
190
|
if utils.match_response(http_res, "200", "application/json"):
|
190
191
|
return operations.GetUnderwritingResponse(
|
191
|
-
result=
|
192
|
+
result=unmarshal_json_response(components.Underwriting, http_res),
|
192
193
|
headers=utils.get_response_headers(http_res.headers),
|
193
194
|
)
|
194
195
|
if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
|
@@ -349,16 +350,14 @@ class Underwriting(BaseSDK):
|
|
349
350
|
response_data: Any = None
|
350
351
|
if utils.match_response(http_res, "200", "application/json"):
|
351
352
|
return operations.SaveUnderwritingResponse(
|
352
|
-
result=
|
353
|
+
result=unmarshal_json_response(components.Underwriting, http_res),
|
353
354
|
headers=utils.get_response_headers(http_res.headers),
|
354
355
|
)
|
355
356
|
if utils.match_response(http_res, ["400", "409"], "application/json"):
|
356
|
-
response_data =
|
357
|
-
errors.GenericErrorData, http_res
|
358
|
-
)
|
357
|
+
response_data = unmarshal_json_response(errors.GenericErrorData, http_res)
|
359
358
|
raise errors.GenericError(response_data, http_res)
|
360
359
|
if utils.match_response(http_res, "422", "application/json"):
|
361
|
-
response_data =
|
360
|
+
response_data = unmarshal_json_response(
|
362
361
|
errors.UpsertUnderwritingErrorData, http_res
|
363
362
|
)
|
364
363
|
raise errors.UpsertUnderwritingError(response_data, http_res)
|
@@ -520,16 +519,14 @@ class Underwriting(BaseSDK):
|
|
520
519
|
response_data: Any = None
|
521
520
|
if utils.match_response(http_res, "200", "application/json"):
|
522
521
|
return operations.SaveUnderwritingResponse(
|
523
|
-
result=
|
522
|
+
result=unmarshal_json_response(components.Underwriting, http_res),
|
524
523
|
headers=utils.get_response_headers(http_res.headers),
|
525
524
|
)
|
526
525
|
if utils.match_response(http_res, ["400", "409"], "application/json"):
|
527
|
-
response_data =
|
528
|
-
errors.GenericErrorData, http_res
|
529
|
-
)
|
526
|
+
response_data = unmarshal_json_response(errors.GenericErrorData, http_res)
|
530
527
|
raise errors.GenericError(response_data, http_res)
|
531
528
|
if utils.match_response(http_res, "422", "application/json"):
|
532
|
-
response_data =
|
529
|
+
response_data = unmarshal_json_response(
|
533
530
|
errors.UpsertUnderwritingErrorData, http_res
|
534
531
|
)
|
535
532
|
raise errors.UpsertUnderwritingError(response_data, http_res)
|
@@ -681,16 +678,14 @@ class Underwriting(BaseSDK):
|
|
681
678
|
response_data: Any = None
|
682
679
|
if utils.match_response(http_res, "200", "application/json"):
|
683
680
|
return operations.UpsertUnderwritingResponse(
|
684
|
-
result=
|
681
|
+
result=unmarshal_json_response(components.Underwriting, http_res),
|
685
682
|
headers=utils.get_response_headers(http_res.headers),
|
686
683
|
)
|
687
684
|
if utils.match_response(http_res, ["400", "409"], "application/json"):
|
688
|
-
response_data =
|
689
|
-
errors.GenericErrorData, http_res
|
690
|
-
)
|
685
|
+
response_data = unmarshal_json_response(errors.GenericErrorData, http_res)
|
691
686
|
raise errors.GenericError(response_data, http_res)
|
692
687
|
if utils.match_response(http_res, "422", "application/json"):
|
693
|
-
response_data =
|
688
|
+
response_data = unmarshal_json_response(
|
694
689
|
errors.UpdateUnderwritingErrorData, http_res
|
695
690
|
)
|
696
691
|
raise errors.UpdateUnderwritingError(response_data, http_res)
|
@@ -842,16 +837,14 @@ class Underwriting(BaseSDK):
|
|
842
837
|
response_data: Any = None
|
843
838
|
if utils.match_response(http_res, "200", "application/json"):
|
844
839
|
return operations.UpsertUnderwritingResponse(
|
845
|
-
result=
|
840
|
+
result=unmarshal_json_response(components.Underwriting, http_res),
|
846
841
|
headers=utils.get_response_headers(http_res.headers),
|
847
842
|
)
|
848
843
|
if utils.match_response(http_res, ["400", "409"], "application/json"):
|
849
|
-
response_data =
|
850
|
-
errors.GenericErrorData, http_res
|
851
|
-
)
|
844
|
+
response_data = unmarshal_json_response(errors.GenericErrorData, http_res)
|
852
845
|
raise errors.GenericError(response_data, http_res)
|
853
846
|
if utils.match_response(http_res, "422", "application/json"):
|
854
|
-
response_data =
|
847
|
+
response_data = unmarshal_json_response(
|
855
848
|
errors.UpdateUnderwritingErrorData, http_res
|
856
849
|
)
|
857
850
|
raise errors.UpdateUnderwritingError(response_data, http_res)
|
moovio_sdk/utils/__init__.py
CHANGED
@@ -29,7 +29,6 @@ if TYPE_CHECKING:
|
|
29
29
|
marshal_json,
|
30
30
|
unmarshal,
|
31
31
|
unmarshal_json,
|
32
|
-
unmarshal_json_response,
|
33
32
|
serialize_decimal,
|
34
33
|
serialize_float,
|
35
34
|
serialize_int,
|
@@ -99,7 +98,6 @@ __all__ = [
|
|
99
98
|
"template_url",
|
100
99
|
"unmarshal",
|
101
100
|
"unmarshal_json",
|
102
|
-
"unmarshal_json_response",
|
103
101
|
"validate_decimal",
|
104
102
|
"validate_const",
|
105
103
|
"validate_float",
|
@@ -154,7 +152,6 @@ _dynamic_imports: dict[str, str] = {
|
|
154
152
|
"template_url": ".url",
|
155
153
|
"unmarshal": ".serializers",
|
156
154
|
"unmarshal_json": ".serializers",
|
157
|
-
"unmarshal_json_response": ".serializers",
|
158
155
|
"validate_decimal": ".serializers",
|
159
156
|
"validate_const": ".serializers",
|
160
157
|
"validate_float": ".serializers",
|
moovio_sdk/utils/serializers.py
CHANGED
@@ -4,7 +4,7 @@ from decimal import Decimal
|
|
4
4
|
import functools
|
5
5
|
import json
|
6
6
|
import typing
|
7
|
-
from typing import Any, Dict, List,
|
7
|
+
from typing import Any, Dict, List, Tuple, Union, get_args
|
8
8
|
import typing_extensions
|
9
9
|
from typing_extensions import get_origin
|
10
10
|
|
@@ -13,7 +13,6 @@ from pydantic import ConfigDict, create_model
|
|
13
13
|
from pydantic_core import from_json
|
14
14
|
|
15
15
|
from ..types.basemodel import BaseModel, Nullable, OptionalNullable, Unset
|
16
|
-
from moovio_sdk.models import errors
|
17
16
|
|
18
17
|
|
19
18
|
def serialize_decimal(as_str: bool):
|
@@ -141,22 +140,6 @@ def unmarshal_json(raw, typ: Any) -> Any:
|
|
141
140
|
return unmarshal(from_json(raw), typ)
|
142
141
|
|
143
142
|
|
144
|
-
def unmarshal_json_response(
|
145
|
-
typ: Any, http_res: httpx.Response, body: Optional[str] = None
|
146
|
-
) -> Any:
|
147
|
-
if body is None:
|
148
|
-
body = http_res.text
|
149
|
-
try:
|
150
|
-
return unmarshal_json(body, typ)
|
151
|
-
except Exception as e:
|
152
|
-
raise errors.ResponseValidationError(
|
153
|
-
"Response validation failed",
|
154
|
-
http_res,
|
155
|
-
e,
|
156
|
-
body,
|
157
|
-
) from e
|
158
|
-
|
159
|
-
|
160
143
|
def unmarshal(val, typ: Any) -> Any:
|
161
144
|
unmarshaller = create_model(
|
162
145
|
"Unmarshaller",
|