moovio_sdk 0.11.5__py3-none-any.whl → 0.12.0__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 (63) hide show
  1. moovio_sdk/_version.py +3 -3
  2. moovio_sdk/capabilities.py +4 -4
  3. moovio_sdk/models/components/__init__.py +205 -0
  4. moovio_sdk/models/components/businesspresence.py +13 -0
  5. moovio_sdk/models/components/capability.py +2 -2
  6. moovio_sdk/models/components/capabilityid.py +11 -1
  7. moovio_sdk/models/components/cardacceptancemethods.py +37 -0
  8. moovio_sdk/models/components/cardacceptancemethodserror.py +27 -0
  9. moovio_sdk/models/components/collectfunds.py +25 -0
  10. moovio_sdk/models/components/collectfundsach.py +18 -0
  11. moovio_sdk/models/components/collectfundsacherror.py +21 -0
  12. moovio_sdk/models/components/collectfundscardpayments.py +41 -0
  13. moovio_sdk/models/components/collectfundscardpaymentserror.py +43 -0
  14. moovio_sdk/models/components/collectfundserror.py +25 -0
  15. moovio_sdk/models/components/createdtransfer.py +5 -0
  16. moovio_sdk/models/components/createtransfer.py +5 -0
  17. moovio_sdk/models/components/estimatedactivity.py +30 -0
  18. moovio_sdk/models/components/estimatedactivityerror.py +27 -0
  19. moovio_sdk/models/components/fulfillment.py +19 -0
  20. moovio_sdk/models/components/fulfillmenterror.py +17 -0
  21. moovio_sdk/models/components/fulfillmentmethod.py +16 -0
  22. moovio_sdk/models/components/fulfillmenttimeframe.py +15 -0
  23. moovio_sdk/models/components/geographicreach.py +10 -0
  24. moovio_sdk/models/components/moneytransfer.py +30 -0
  25. moovio_sdk/models/components/moneytransfererror.py +30 -0
  26. moovio_sdk/models/components/moneytransferpullfromcard.py +18 -0
  27. moovio_sdk/models/components/moneytransferpullfromcarderror.py +21 -0
  28. moovio_sdk/models/components/moneytransferpushtocard.py +18 -0
  29. moovio_sdk/models/components/moneytransferpushtocarderror.py +21 -0
  30. moovio_sdk/models/components/monthlyvolumerange.py +17 -0
  31. moovio_sdk/models/components/pendinglitigation.py +17 -0
  32. moovio_sdk/models/components/refundpolicy.py +16 -0
  33. moovio_sdk/models/components/sendfunds.py +26 -0
  34. moovio_sdk/models/components/sendfundsach.py +18 -0
  35. moovio_sdk/models/components/sendfundsacherror.py +21 -0
  36. moovio_sdk/models/components/sendfundserror.py +29 -0
  37. moovio_sdk/models/components/sendfundspushtocard.py +18 -0
  38. moovio_sdk/models/components/sendfundspushtocarderror.py +21 -0
  39. moovio_sdk/models/components/sendfundsrtp.py +18 -0
  40. moovio_sdk/models/components/sendfundsrtperror.py +21 -0
  41. moovio_sdk/models/components/transfer.py +5 -0
  42. moovio_sdk/models/components/underwriting.py +67 -20
  43. moovio_sdk/models/components/upsertunderwriting.py +56 -0
  44. moovio_sdk/models/components/volumesharebycustomertype.py +20 -0
  45. moovio_sdk/models/components/volumesharebycustomertypeerror.py +20 -0
  46. moovio_sdk/models/components/webhookdata.py +10 -10
  47. moovio_sdk/models/components/webhookdatacapabilityrequested.py +2 -2
  48. moovio_sdk/models/components/webhookdatacapabilityupdated.py +2 -2
  49. moovio_sdk/models/components/webhookdatatransfercreated.py +5 -1
  50. moovio_sdk/models/components/webhookdatatransferupdated.py +5 -1
  51. moovio_sdk/models/errors/__init__.py +8 -0
  52. moovio_sdk/models/errors/transfer.py +3 -0
  53. moovio_sdk/models/errors/upsertunderwritingerror.py +89 -0
  54. moovio_sdk/models/operations/__init__.py +20 -0
  55. moovio_sdk/models/operations/disablecapability.py +2 -2
  56. moovio_sdk/models/operations/getcapability.py +2 -2
  57. moovio_sdk/models/operations/listtransfers.py +9 -0
  58. moovio_sdk/models/operations/saveunderwriting.py +78 -0
  59. moovio_sdk/transfers.py +12 -0
  60. moovio_sdk/underwriting.py +368 -0
  61. {moovio_sdk-0.11.5.dist-info → moovio_sdk-0.12.0.dist-info}/METADATA +7 -1
  62. {moovio_sdk-0.11.5.dist-info → moovio_sdk-0.12.0.dist-info}/RECORD +63 -25
  63. {moovio_sdk-0.11.5.dist-info → moovio_sdk-0.12.0.dist-info}/WHEEL +0 -0
@@ -70,6 +70,8 @@ class ListTransfersRequestTypedDict(TypedDict):
70
70
  r"""Optional parameter to only return refunded transfers."""
71
71
  disputed: NotRequired[bool]
72
72
  r"""Optional parameter to only return disputed transfers."""
73
+ foreign_id: NotRequired[str]
74
+ r"""Optional alias from a foreign/external system which can be used to reference this resource."""
73
75
  skip: NotRequired[int]
74
76
  count: NotRequired[int]
75
77
 
@@ -141,6 +143,13 @@ class ListTransfersRequest(BaseModel):
141
143
  ] = None
142
144
  r"""Optional parameter to only return disputed transfers."""
143
145
 
146
+ foreign_id: Annotated[
147
+ Optional[str],
148
+ pydantic.Field(alias="foreignID"),
149
+ FieldMetadata(query=QueryParamMetadata(style="form", explode=False)),
150
+ ] = None
151
+ r"""Optional alias from a foreign/external system which can be used to reference this resource."""
152
+
144
153
  skip: Annotated[
145
154
  Optional[int],
146
155
  FieldMetadata(query=QueryParamMetadata(style="form", explode=False)),
@@ -0,0 +1,78 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from moovio_sdk.models.components import (
5
+ underwriting as components_underwriting,
6
+ upsertunderwriting as components_upsertunderwriting,
7
+ )
8
+ from moovio_sdk.types import BaseModel
9
+ from moovio_sdk.utils import (
10
+ FieldMetadata,
11
+ HeaderMetadata,
12
+ PathParamMetadata,
13
+ RequestMetadata,
14
+ )
15
+ import pydantic
16
+ from typing import Dict, List, Optional
17
+ from typing_extensions import Annotated, NotRequired, TypedDict
18
+
19
+
20
+ class SaveUnderwritingGlobalsTypedDict(TypedDict):
21
+ x_moov_version: NotRequired[str]
22
+ r"""Specify an API version.
23
+
24
+ API versioning follows the format `vYYYY.QQ.BB`, where
25
+ - `YYYY` is the year
26
+ - `QQ` is the two-digit month for the first month of the quarter (e.g., 01, 04, 07, 10)
27
+ - `BB` is the build number, starting at `.01`, for subsequent builds in the same quarter.
28
+ - For example, `v2024.01.00` is the initial release of the first quarter of 2024.
29
+
30
+ The `latest` version represents the most recent development state. It may include breaking changes and should be treated as a beta release.
31
+ """
32
+
33
+
34
+ class SaveUnderwritingGlobals(BaseModel):
35
+ x_moov_version: Annotated[
36
+ Optional[str],
37
+ pydantic.Field(alias="x-moov-version"),
38
+ FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
39
+ ] = "v2024.01.00"
40
+ r"""Specify an API version.
41
+
42
+ API versioning follows the format `vYYYY.QQ.BB`, where
43
+ - `YYYY` is the year
44
+ - `QQ` is the two-digit month for the first month of the quarter (e.g., 01, 04, 07, 10)
45
+ - `BB` is the build number, starting at `.01`, for subsequent builds in the same quarter.
46
+ - For example, `v2024.01.00` is the initial release of the first quarter of 2024.
47
+
48
+ The `latest` version represents the most recent development state. It may include breaking changes and should be treated as a beta release.
49
+ """
50
+
51
+
52
+ class SaveUnderwritingRequestTypedDict(TypedDict):
53
+ account_id: str
54
+ upsert_underwriting: components_upsertunderwriting.UpsertUnderwritingTypedDict
55
+
56
+
57
+ class SaveUnderwritingRequest(BaseModel):
58
+ account_id: Annotated[
59
+ str,
60
+ pydantic.Field(alias="accountID"),
61
+ FieldMetadata(path=PathParamMetadata(style="simple", explode=False)),
62
+ ]
63
+
64
+ upsert_underwriting: Annotated[
65
+ components_upsertunderwriting.UpsertUnderwriting,
66
+ FieldMetadata(request=RequestMetadata(media_type="application/json")),
67
+ ]
68
+
69
+
70
+ class SaveUnderwritingResponseTypedDict(TypedDict):
71
+ headers: Dict[str, List[str]]
72
+ result: components_underwriting.UnderwritingTypedDict
73
+
74
+
75
+ class SaveUnderwritingResponse(BaseModel):
76
+ headers: Dict[str, List[str]]
77
+
78
+ result: components_underwriting.Underwriting
moovio_sdk/transfers.py CHANGED
@@ -359,6 +359,7 @@ class Transfers(BaseSDK):
359
359
  sales_tax_amount: Optional[
360
360
  Union[components.Amount, components.AmountTypedDict]
361
361
  ] = None,
362
+ foreign_id: Optional[str] = None,
362
363
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
363
364
  server_url: Optional[str] = None,
364
365
  timeout_ms: Optional[int] = None,
@@ -381,6 +382,7 @@ class Transfers(BaseSDK):
381
382
  :param description: An optional description of the transfer that is used on receipts and for your own internal use.
382
383
  :param metadata: Free-form key-value pair list. Useful for storing information that is not captured elsewhere.
383
384
  :param sales_tax_amount: Optional sales tax amount. `transfer.amount.value` should be inclusive of any sales tax and represents the total amount charged.
385
+ :param foreign_id: Optional alias from a foreign/external system which can be used to reference this resource.
384
386
  :param retries: Override the default retry configuration for this method
385
387
  :param server_url: Override the default server URL for this method
386
388
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -416,6 +418,7 @@ class Transfers(BaseSDK):
416
418
  sales_tax_amount=utils.get_pydantic_model(
417
419
  sales_tax_amount, Optional[components.Amount]
418
420
  ),
421
+ foreign_id=foreign_id,
419
422
  ),
420
423
  )
421
424
 
@@ -553,6 +556,7 @@ class Transfers(BaseSDK):
553
556
  sales_tax_amount: Optional[
554
557
  Union[components.Amount, components.AmountTypedDict]
555
558
  ] = None,
559
+ foreign_id: Optional[str] = None,
556
560
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
557
561
  server_url: Optional[str] = None,
558
562
  timeout_ms: Optional[int] = None,
@@ -575,6 +579,7 @@ class Transfers(BaseSDK):
575
579
  :param description: An optional description of the transfer that is used on receipts and for your own internal use.
576
580
  :param metadata: Free-form key-value pair list. Useful for storing information that is not captured elsewhere.
577
581
  :param sales_tax_amount: Optional sales tax amount. `transfer.amount.value` should be inclusive of any sales tax and represents the total amount charged.
582
+ :param foreign_id: Optional alias from a foreign/external system which can be used to reference this resource.
578
583
  :param retries: Override the default retry configuration for this method
579
584
  :param server_url: Override the default server URL for this method
580
585
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -610,6 +615,7 @@ class Transfers(BaseSDK):
610
615
  sales_tax_amount=utils.get_pydantic_model(
611
616
  sales_tax_amount, Optional[components.Amount]
612
617
  ),
618
+ foreign_id=foreign_id,
613
619
  ),
614
620
  )
615
621
 
@@ -738,6 +744,7 @@ class Transfers(BaseSDK):
738
744
  payment_link_code: Optional[str] = None,
739
745
  refunded: Optional[bool] = None,
740
746
  disputed: Optional[bool] = None,
747
+ foreign_id: Optional[str] = None,
741
748
  skip: Optional[int] = None,
742
749
  count: Optional[int] = None,
743
750
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
@@ -767,6 +774,7 @@ class Transfers(BaseSDK):
767
774
  :param payment_link_code: Optional code to filter for transfers associated with the payment link.
768
775
  :param refunded: Optional parameter to only return refunded transfers.
769
776
  :param disputed: Optional parameter to only return disputed transfers.
777
+ :param foreign_id: Optional alias from a foreign/external system which can be used to reference this resource.
770
778
  :param skip:
771
779
  :param count:
772
780
  :param retries: Override the default retry configuration for this method
@@ -794,6 +802,7 @@ class Transfers(BaseSDK):
794
802
  payment_link_code=payment_link_code,
795
803
  refunded=refunded,
796
804
  disputed=disputed,
805
+ foreign_id=foreign_id,
797
806
  skip=skip,
798
807
  count=count,
799
808
  account_id=account_id,
@@ -889,6 +898,7 @@ class Transfers(BaseSDK):
889
898
  payment_link_code: Optional[str] = None,
890
899
  refunded: Optional[bool] = None,
891
900
  disputed: Optional[bool] = None,
901
+ foreign_id: Optional[str] = None,
892
902
  skip: Optional[int] = None,
893
903
  count: Optional[int] = None,
894
904
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
@@ -918,6 +928,7 @@ class Transfers(BaseSDK):
918
928
  :param payment_link_code: Optional code to filter for transfers associated with the payment link.
919
929
  :param refunded: Optional parameter to only return refunded transfers.
920
930
  :param disputed: Optional parameter to only return disputed transfers.
931
+ :param foreign_id: Optional alias from a foreign/external system which can be used to reference this resource.
921
932
  :param skip:
922
933
  :param count:
923
934
  :param retries: Override the default retry configuration for this method
@@ -945,6 +956,7 @@ class Transfers(BaseSDK):
945
956
  payment_link_code=payment_link_code,
946
957
  refunded=refunded,
947
958
  disputed=disputed,
959
+ foreign_id=foreign_id,
948
960
  skip=skip,
949
961
  count=count,
950
962
  account_id=account_id,
@@ -236,6 +236,374 @@ class Underwriting(BaseSDK):
236
236
  http_res,
237
237
  )
238
238
 
239
+ def save(
240
+ self,
241
+ *,
242
+ account_id: str,
243
+ geographic_reach: Optional[components.GeographicReach] = None,
244
+ business_presence: Optional[components.BusinessPresence] = None,
245
+ pending_litigation: Optional[components.PendingLitigation] = None,
246
+ volume_share_by_customer_type: Optional[
247
+ Union[
248
+ components.VolumeShareByCustomerType,
249
+ components.VolumeShareByCustomerTypeTypedDict,
250
+ ]
251
+ ] = None,
252
+ collect_funds: Optional[
253
+ Union[components.CollectFunds, components.CollectFundsTypedDict]
254
+ ] = None,
255
+ money_transfer: Optional[
256
+ Union[components.MoneyTransfer, components.MoneyTransferTypedDict]
257
+ ] = None,
258
+ send_funds: Optional[
259
+ Union[components.SendFunds, components.SendFundsTypedDict]
260
+ ] = None,
261
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
262
+ server_url: Optional[str] = None,
263
+ timeout_ms: Optional[int] = None,
264
+ http_headers: Optional[Mapping[str, str]] = None,
265
+ ) -> operations.SaveUnderwritingResponse:
266
+ r"""Create or update the account's underwriting.
267
+
268
+ Read our [underwriting guide](https://docs.moov.io/guides/accounts/requirements/underwriting/) to learn more.
269
+
270
+ To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
271
+ you'll need to specify the `/accounts/{accountID}/profile.write` scope.
272
+
273
+ :param account_id:
274
+ :param geographic_reach:
275
+ :param business_presence:
276
+ :param pending_litigation:
277
+ :param volume_share_by_customer_type:
278
+ :param collect_funds:
279
+ :param money_transfer:
280
+ :param send_funds:
281
+ :param retries: Override the default retry configuration for this method
282
+ :param server_url: Override the default server URL for this method
283
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
284
+ :param http_headers: Additional headers to set or replace on requests.
285
+ """
286
+ base_url = None
287
+ url_variables = None
288
+ if timeout_ms is None:
289
+ timeout_ms = self.sdk_configuration.timeout_ms
290
+
291
+ if server_url is not None:
292
+ base_url = server_url
293
+ else:
294
+ base_url = self._get_url(base_url, url_variables)
295
+
296
+ request = operations.SaveUnderwritingRequest(
297
+ account_id=account_id,
298
+ upsert_underwriting=components.UpsertUnderwriting(
299
+ geographic_reach=geographic_reach,
300
+ business_presence=business_presence,
301
+ pending_litigation=pending_litigation,
302
+ volume_share_by_customer_type=utils.get_pydantic_model(
303
+ volume_share_by_customer_type,
304
+ Optional[components.VolumeShareByCustomerType],
305
+ ),
306
+ collect_funds=utils.get_pydantic_model(
307
+ collect_funds, Optional[components.CollectFunds]
308
+ ),
309
+ money_transfer=utils.get_pydantic_model(
310
+ money_transfer, Optional[components.MoneyTransfer]
311
+ ),
312
+ send_funds=utils.get_pydantic_model(
313
+ send_funds, Optional[components.SendFunds]
314
+ ),
315
+ ),
316
+ )
317
+
318
+ req = self._build_request(
319
+ method="POST",
320
+ path="/accounts/{accountID}/underwriting",
321
+ base_url=base_url,
322
+ url_variables=url_variables,
323
+ request=request,
324
+ request_body_required=True,
325
+ request_has_path_params=True,
326
+ request_has_query_params=True,
327
+ user_agent_header="user-agent",
328
+ accept_header_value="application/json",
329
+ http_headers=http_headers,
330
+ _globals=operations.SaveUnderwritingGlobals(
331
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
332
+ ),
333
+ security=self.sdk_configuration.security,
334
+ get_serialized_body=lambda: utils.serialize_request_body(
335
+ request.upsert_underwriting,
336
+ False,
337
+ False,
338
+ "json",
339
+ components.UpsertUnderwriting,
340
+ ),
341
+ timeout_ms=timeout_ms,
342
+ )
343
+
344
+ if retries == UNSET:
345
+ if self.sdk_configuration.retry_config is not UNSET:
346
+ retries = self.sdk_configuration.retry_config
347
+
348
+ retry_config = None
349
+ if isinstance(retries, utils.RetryConfig):
350
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
351
+
352
+ http_res = self.do_request(
353
+ hook_ctx=HookContext(
354
+ config=self.sdk_configuration,
355
+ base_url=base_url or "",
356
+ operation_id="saveUnderwriting",
357
+ oauth2_scopes=[],
358
+ security_source=get_security_from_env(
359
+ self.sdk_configuration.security, components.Security
360
+ ),
361
+ ),
362
+ request=req,
363
+ error_status_codes=[
364
+ "400",
365
+ "401",
366
+ "403",
367
+ "404",
368
+ "409",
369
+ "422",
370
+ "429",
371
+ "4XX",
372
+ "500",
373
+ "504",
374
+ "5XX",
375
+ ],
376
+ retry_config=retry_config,
377
+ )
378
+
379
+ response_data: Any = None
380
+ if utils.match_response(http_res, "200", "application/json"):
381
+ return operations.SaveUnderwritingResponse(
382
+ result=utils.unmarshal_json(http_res.text, components.Underwriting),
383
+ headers=utils.get_response_headers(http_res.headers),
384
+ )
385
+ if utils.match_response(http_res, ["400", "409"], "application/json"):
386
+ response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
387
+ raise errors.GenericError(data=response_data)
388
+ if utils.match_response(http_res, "422", "application/json"):
389
+ response_data = utils.unmarshal_json(
390
+ http_res.text, errors.UpsertUnderwritingErrorData
391
+ )
392
+ raise errors.UpsertUnderwritingError(data=response_data)
393
+ if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
394
+ http_res_text = utils.stream_to_text(http_res)
395
+ raise errors.APIError(
396
+ "API error occurred", http_res.status_code, http_res_text, http_res
397
+ )
398
+ if utils.match_response(http_res, ["500", "504"], "*"):
399
+ http_res_text = utils.stream_to_text(http_res)
400
+ raise errors.APIError(
401
+ "API error occurred", http_res.status_code, http_res_text, http_res
402
+ )
403
+ if utils.match_response(http_res, "4XX", "*"):
404
+ http_res_text = utils.stream_to_text(http_res)
405
+ raise errors.APIError(
406
+ "API error occurred", http_res.status_code, http_res_text, http_res
407
+ )
408
+ if utils.match_response(http_res, "5XX", "*"):
409
+ http_res_text = utils.stream_to_text(http_res)
410
+ raise errors.APIError(
411
+ "API error occurred", http_res.status_code, http_res_text, http_res
412
+ )
413
+
414
+ content_type = http_res.headers.get("Content-Type")
415
+ http_res_text = utils.stream_to_text(http_res)
416
+ raise errors.APIError(
417
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
418
+ http_res.status_code,
419
+ http_res_text,
420
+ http_res,
421
+ )
422
+
423
+ async def save_async(
424
+ self,
425
+ *,
426
+ account_id: str,
427
+ geographic_reach: Optional[components.GeographicReach] = None,
428
+ business_presence: Optional[components.BusinessPresence] = None,
429
+ pending_litigation: Optional[components.PendingLitigation] = None,
430
+ volume_share_by_customer_type: Optional[
431
+ Union[
432
+ components.VolumeShareByCustomerType,
433
+ components.VolumeShareByCustomerTypeTypedDict,
434
+ ]
435
+ ] = None,
436
+ collect_funds: Optional[
437
+ Union[components.CollectFunds, components.CollectFundsTypedDict]
438
+ ] = None,
439
+ money_transfer: Optional[
440
+ Union[components.MoneyTransfer, components.MoneyTransferTypedDict]
441
+ ] = None,
442
+ send_funds: Optional[
443
+ Union[components.SendFunds, components.SendFundsTypedDict]
444
+ ] = None,
445
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
446
+ server_url: Optional[str] = None,
447
+ timeout_ms: Optional[int] = None,
448
+ http_headers: Optional[Mapping[str, str]] = None,
449
+ ) -> operations.SaveUnderwritingResponse:
450
+ r"""Create or update the account's underwriting.
451
+
452
+ Read our [underwriting guide](https://docs.moov.io/guides/accounts/requirements/underwriting/) to learn more.
453
+
454
+ To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
455
+ you'll need to specify the `/accounts/{accountID}/profile.write` scope.
456
+
457
+ :param account_id:
458
+ :param geographic_reach:
459
+ :param business_presence:
460
+ :param pending_litigation:
461
+ :param volume_share_by_customer_type:
462
+ :param collect_funds:
463
+ :param money_transfer:
464
+ :param send_funds:
465
+ :param retries: Override the default retry configuration for this method
466
+ :param server_url: Override the default server URL for this method
467
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
468
+ :param http_headers: Additional headers to set or replace on requests.
469
+ """
470
+ base_url = None
471
+ url_variables = None
472
+ if timeout_ms is None:
473
+ timeout_ms = self.sdk_configuration.timeout_ms
474
+
475
+ if server_url is not None:
476
+ base_url = server_url
477
+ else:
478
+ base_url = self._get_url(base_url, url_variables)
479
+
480
+ request = operations.SaveUnderwritingRequest(
481
+ account_id=account_id,
482
+ upsert_underwriting=components.UpsertUnderwriting(
483
+ geographic_reach=geographic_reach,
484
+ business_presence=business_presence,
485
+ pending_litigation=pending_litigation,
486
+ volume_share_by_customer_type=utils.get_pydantic_model(
487
+ volume_share_by_customer_type,
488
+ Optional[components.VolumeShareByCustomerType],
489
+ ),
490
+ collect_funds=utils.get_pydantic_model(
491
+ collect_funds, Optional[components.CollectFunds]
492
+ ),
493
+ money_transfer=utils.get_pydantic_model(
494
+ money_transfer, Optional[components.MoneyTransfer]
495
+ ),
496
+ send_funds=utils.get_pydantic_model(
497
+ send_funds, Optional[components.SendFunds]
498
+ ),
499
+ ),
500
+ )
501
+
502
+ req = self._build_request_async(
503
+ method="POST",
504
+ path="/accounts/{accountID}/underwriting",
505
+ base_url=base_url,
506
+ url_variables=url_variables,
507
+ request=request,
508
+ request_body_required=True,
509
+ request_has_path_params=True,
510
+ request_has_query_params=True,
511
+ user_agent_header="user-agent",
512
+ accept_header_value="application/json",
513
+ http_headers=http_headers,
514
+ _globals=operations.SaveUnderwritingGlobals(
515
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
516
+ ),
517
+ security=self.sdk_configuration.security,
518
+ get_serialized_body=lambda: utils.serialize_request_body(
519
+ request.upsert_underwriting,
520
+ False,
521
+ False,
522
+ "json",
523
+ components.UpsertUnderwriting,
524
+ ),
525
+ timeout_ms=timeout_ms,
526
+ )
527
+
528
+ if retries == UNSET:
529
+ if self.sdk_configuration.retry_config is not UNSET:
530
+ retries = self.sdk_configuration.retry_config
531
+
532
+ retry_config = None
533
+ if isinstance(retries, utils.RetryConfig):
534
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
535
+
536
+ http_res = await self.do_request_async(
537
+ hook_ctx=HookContext(
538
+ config=self.sdk_configuration,
539
+ base_url=base_url or "",
540
+ operation_id="saveUnderwriting",
541
+ oauth2_scopes=[],
542
+ security_source=get_security_from_env(
543
+ self.sdk_configuration.security, components.Security
544
+ ),
545
+ ),
546
+ request=req,
547
+ error_status_codes=[
548
+ "400",
549
+ "401",
550
+ "403",
551
+ "404",
552
+ "409",
553
+ "422",
554
+ "429",
555
+ "4XX",
556
+ "500",
557
+ "504",
558
+ "5XX",
559
+ ],
560
+ retry_config=retry_config,
561
+ )
562
+
563
+ response_data: Any = None
564
+ if utils.match_response(http_res, "200", "application/json"):
565
+ return operations.SaveUnderwritingResponse(
566
+ result=utils.unmarshal_json(http_res.text, components.Underwriting),
567
+ headers=utils.get_response_headers(http_res.headers),
568
+ )
569
+ if utils.match_response(http_res, ["400", "409"], "application/json"):
570
+ response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
571
+ raise errors.GenericError(data=response_data)
572
+ if utils.match_response(http_res, "422", "application/json"):
573
+ response_data = utils.unmarshal_json(
574
+ http_res.text, errors.UpsertUnderwritingErrorData
575
+ )
576
+ raise errors.UpsertUnderwritingError(data=response_data)
577
+ if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
578
+ 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
+ )
582
+ if utils.match_response(http_res, ["500", "504"], "*"):
583
+ 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
+ )
587
+ if utils.match_response(http_res, "4XX", "*"):
588
+ http_res_text = await utils.stream_to_text_async(http_res)
589
+ raise errors.APIError(
590
+ "API error occurred", http_res.status_code, http_res_text, http_res
591
+ )
592
+ if utils.match_response(http_res, "5XX", "*"):
593
+ http_res_text = await utils.stream_to_text_async(http_res)
594
+ raise errors.APIError(
595
+ "API error occurred", http_res.status_code, http_res_text, http_res
596
+ )
597
+
598
+ content_type = http_res.headers.get("Content-Type")
599
+ http_res_text = await utils.stream_to_text_async(http_res)
600
+ raise errors.APIError(
601
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
602
+ http_res.status_code,
603
+ http_res_text,
604
+ http_res,
605
+ )
606
+
239
607
  def upsert(
240
608
  self,
241
609
  *,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: moovio_sdk
3
- Version: 0.11.5
3
+ Version: 0.12.0
4
4
  Summary: Python Client SDK Generated by Speakeasy.
5
5
  Author: Speakeasy
6
6
  Requires-Python: >=3.9.2
@@ -1139,6 +1139,12 @@ Read our [underwriting guide](https://docs.moov.io/guides/accounts/requirements/
1139
1139
 
1140
1140
  To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
1141
1141
  you'll need to specify the `/accounts/{accountID}/profile.read` scope.
1142
+ * [save](https://github.com/moovfinancial/moov-python/blob/master/docs/sdks/underwriting/README.md#save) - Create or update the account's underwriting.
1143
+
1144
+ Read our [underwriting guide](https://docs.moov.io/guides/accounts/requirements/underwriting/) to learn more.
1145
+
1146
+ To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
1147
+ you'll need to specify the `/accounts/{accountID}/profile.write` scope.
1142
1148
  * [upsert](https://github.com/moovfinancial/moov-python/blob/master/docs/sdks/underwriting/README.md#upsert) - Create or update the account's underwriting.
1143
1149
 
1144
1150
  Read our [underwriting guide](https://docs.moov.io/guides/accounts/requirements/underwriting/) to learn more.