mt-sdk 0.0.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.
- moderntreasury/__init__.py +12 -0
- moderntreasury/api_helper.py +19 -0
- moderntreasury/configuration.py +289 -0
- moderntreasury/controllers/__init__.py +40 -0
- moderntreasury/controllers/account_collection_flow_controller.py +228 -0
- moderntreasury/controllers/account_detail_controller.py +239 -0
- moderntreasury/controllers/balance_report_controller.py +140 -0
- moderntreasury/controllers/base_controller.py +67 -0
- moderntreasury/controllers/connection_controller.py +83 -0
- moderntreasury/controllers/counterparty_controller.py +325 -0
- moderntreasury/controllers/document_controller.py +441 -0
- moderntreasury/controllers/event_controller.py +135 -0
- moderntreasury/controllers/expected_payment_controller.py +279 -0
- moderntreasury/controllers/external_account_controller.py +340 -0
- moderntreasury/controllers/incoming_payment_detail_controller.py +253 -0
- moderntreasury/controllers/internal_account_controller.py +226 -0
- moderntreasury/controllers/invoice_controller.py +186 -0
- moderntreasury/controllers/invoice_line_item_controller.py +257 -0
- moderntreasury/controllers/ledger_account_category_controller.py +437 -0
- moderntreasury/controllers/ledger_account_controller.py +316 -0
- moderntreasury/controllers/ledger_account_payout_controller.py +219 -0
- moderntreasury/controllers/ledger_account_statement_controller.py +119 -0
- moderntreasury/controllers/ledger_controller.py +257 -0
- moderntreasury/controllers/ledger_entry_controller.py +235 -0
- moderntreasury/controllers/ledger_event_handler_controller.py +218 -0
- moderntreasury/controllers/ledger_transaction_controller.py +498 -0
- moderntreasury/controllers/ledgerable_event_controller.py +119 -0
- moderntreasury/controllers/line_item_controller.py +196 -0
- moderntreasury/controllers/paper_item_controller.py +131 -0
- moderntreasury/controllers/payment_flow_controller.py +236 -0
- moderntreasury/controllers/payment_order_controller.py +558 -0
- moderntreasury/controllers/payment_reference_controller.py +124 -0
- moderntreasury/controllers/ping_controller.py +70 -0
- moderntreasury/controllers/return_controller.py +182 -0
- moderntreasury/controllers/reversal_controller.py +177 -0
- moderntreasury/controllers/routing_detail_controller.py +239 -0
- moderntreasury/controllers/transaction_controller.py +225 -0
- moderntreasury/controllers/transaction_line_item_controller.py +82 -0
- moderntreasury/controllers/validation_controller.py +85 -0
- moderntreasury/controllers/virtual_account_controller.py +248 -0
- moderntreasury/exceptions/__init__.py +6 -0
- moderntreasury/exceptions/api_exception.py +36 -0
- moderntreasury/exceptions/error_message_exception.py +54 -0
- moderntreasury/http/__init__.py +11 -0
- moderntreasury/http/auth/__init__.py +5 -0
- moderntreasury/http/auth/basic_auth.py +125 -0
- moderntreasury/http/http_call_back.py +20 -0
- moderntreasury/http/http_client_provider.py +23 -0
- moderntreasury/http/http_method_enum.py +25 -0
- moderntreasury/http/http_request.py +55 -0
- moderntreasury/http/http_response.py +45 -0
- moderntreasury/http/proxy_settings.py +50 -0
- moderntreasury/models/__init__.py +236 -0
- moderntreasury/models/account.py +526 -0
- moderntreasury/models/account_1.py +381 -0
- moderntreasury/models/account_collection_flow.py +287 -0
- moderntreasury/models/account_collection_flow_create_request.py +82 -0
- moderntreasury/models/account_collection_flow_update_request.py +66 -0
- moderntreasury/models/account_detail.py +332 -0
- moderntreasury/models/account_detail_1.py +99 -0
- moderntreasury/models/account_detail_create_request.py +100 -0
- moderntreasury/models/account_number_type_2_enum.py +66 -0
- moderntreasury/models/account_number_type_enum.py +69 -0
- moderntreasury/models/account_type_5_enum.py +75 -0
- moderntreasury/models/account_type_enum.py +75 -0
- moderntreasury/models/accounting.py +139 -0
- moderntreasury/models/accounting_1.py +86 -0
- moderntreasury/models/accounts_type_1_enum.py +40 -0
- moderntreasury/models/accounts_type_enum.py +43 -0
- moderntreasury/models/address.py +401 -0
- moderntreasury/models/address_request.py +209 -0
- moderntreasury/models/async_response.py +82 -0
- moderntreasury/models/balance.py +203 -0
- moderntreasury/models/balance_report.py +207 -0
- moderntreasury/models/balance_report_type_1_enum.py +49 -0
- moderntreasury/models/balance_report_type_enum.py +52 -0
- moderntreasury/models/balance_type_enum.py +65 -0
- moderntreasury/models/balances.py +87 -0
- moderntreasury/models/balances_1.py +111 -0
- moderntreasury/models/balances_2.py +161 -0
- moderntreasury/models/balances_3.py +184 -0
- moderntreasury/models/charge_bearer_enum.py +64 -0
- moderntreasury/models/code_1_enum.py +186 -0
- moderntreasury/models/code_enum.py +67 -0
- moderntreasury/models/connection.py +338 -0
- moderntreasury/models/contact_detail.py +305 -0
- moderntreasury/models/contact_detail_create_request.py +109 -0
- moderntreasury/models/contact_identifier_type_enum.py +60 -0
- moderntreasury/models/content_type_enum.py +43 -0
- moderntreasury/models/counterparty.py +234 -0
- moderntreasury/models/counterparty_billing_address.py +152 -0
- moderntreasury/models/counterparty_collect_account_request.py +158 -0
- moderntreasury/models/counterparty_collect_account_response.py +100 -0
- moderntreasury/models/counterparty_create_request.py +279 -0
- moderntreasury/models/counterparty_shipping_address.py +152 -0
- moderntreasury/models/counterparty_update_request.py +180 -0
- moderntreasury/models/created_at_enum.py +43 -0
- moderntreasury/models/currency_1_enum.py +45 -0
- moderntreasury/models/currency_enum.py +637 -0
- moderntreasury/models/direction_10_enum.py +46 -0
- moderntreasury/models/direction_14_enum.py +45 -0
- moderntreasury/models/direction_15_enum.py +43 -0
- moderntreasury/models/direction_1_enum.py +46 -0
- moderntreasury/models/direction_4_enum.py +45 -0
- moderntreasury/models/direction_5_enum.py +62 -0
- moderntreasury/models/direction_9_enum.py +46 -0
- moderntreasury/models/direction_enum.py +47 -0
- moderntreasury/models/document.py +238 -0
- moderntreasury/models/document_create_request.py +125 -0
- moderntreasury/models/document_detail.py +174 -0
- moderntreasury/models/documentable_type_1_enum.py +70 -0
- moderntreasury/models/documentable_type_2_enum.py +70 -0
- moderntreasury/models/documentable_type_enum.py +74 -0
- moderntreasury/models/effective_at_enum.py +43 -0
- moderntreasury/models/errors.py +131 -0
- moderntreasury/models/event.py +196 -0
- moderntreasury/models/expected_payment.py +430 -0
- moderntreasury/models/expected_payment_create_request.py +437 -0
- moderntreasury/models/expected_payment_update_request.py +446 -0
- moderntreasury/models/external_account.py +333 -0
- moderntreasury/models/external_account_complete_verification_request.py +85 -0
- moderntreasury/models/external_account_create_request.py +395 -0
- moderntreasury/models/external_account_update_request.py +236 -0
- moderntreasury/models/external_account_verify_request.py +113 -0
- moderntreasury/models/fallback_type_enum.py +44 -0
- moderntreasury/models/field_enum.py +100 -0
- moderntreasury/models/file.py +131 -0
- moderntreasury/models/foreign_exchange_indicator_enum.py +61 -0
- moderntreasury/models/incoming_payment_detail.py +433 -0
- moderntreasury/models/incoming_payment_detail_create_request.py +259 -0
- moderntreasury/models/incoming_payment_detail_update_request.py +86 -0
- moderntreasury/models/internal_account.py +589 -0
- moderntreasury/models/internal_account_create_request.py +214 -0
- moderntreasury/models/internal_account_update_request.py +155 -0
- moderntreasury/models/invoice.py +422 -0
- moderntreasury/models/invoice_create_request.py +381 -0
- moderntreasury/models/invoice_line_item.py +213 -0
- moderntreasury/models/invoice_line_item_create_request.py +162 -0
- moderntreasury/models/invoice_line_item_update_request.py +411 -0
- moderntreasury/models/invoice_update_request.py +436 -0
- moderntreasury/models/invoicer_address.py +152 -0
- moderntreasury/models/itemizable_type_1_enum.py +43 -0
- moderntreasury/models/itemizable_type_enum.py +45 -0
- moderntreasury/models/ledger.py +189 -0
- moderntreasury/models/ledger_account.py +276 -0
- moderntreasury/models/ledger_account_category.py +233 -0
- moderntreasury/models/ledger_account_category_create_request.py +191 -0
- moderntreasury/models/ledger_account_category_update_request.py +136 -0
- moderntreasury/models/ledger_account_create_request.py +238 -0
- moderntreasury/models/ledger_account_normal_balance_enum.py +45 -0
- moderntreasury/models/ledger_account_payout.py +291 -0
- moderntreasury/models/ledger_account_payout_create_request.py +226 -0
- moderntreasury/models/ledger_account_payout_update_request.py +137 -0
- moderntreasury/models/ledger_account_statement.py +279 -0
- moderntreasury/models/ledger_account_statement_create_request.py +161 -0
- moderntreasury/models/ledger_account_update_request.py +136 -0
- moderntreasury/models/ledger_balance.py +121 -0
- moderntreasury/models/ledger_balances.py +100 -0
- moderntreasury/models/ledger_balances_with_effective_at.py +138 -0
- moderntreasury/models/ledger_create_request.py +126 -0
- moderntreasury/models/ledger_entry.py +296 -0
- moderntreasury/models/ledger_entry_create_request.py +269 -0
- moderntreasury/models/ledger_entry_of_transaction_version.py +265 -0
- moderntreasury/models/ledger_event_handler.py +224 -0
- moderntreasury/models/ledger_event_handler_conditions.py +96 -0
- moderntreasury/models/ledger_event_handler_create_request.py +195 -0
- moderntreasury/models/ledger_event_handler_ledger_entries.py +97 -0
- moderntreasury/models/ledger_event_handler_ledger_transaction_template.py +125 -0
- moderntreasury/models/ledger_transaction.py +312 -0
- moderntreasury/models/ledger_transaction_create_request.py +278 -0
- moderntreasury/models/ledger_transaction_reversal_create_request.py +240 -0
- moderntreasury/models/ledger_transaction_update_request.py +192 -0
- moderntreasury/models/ledger_transaction_version.py +312 -0
- moderntreasury/models/ledger_type_enum.py +46 -0
- moderntreasury/models/ledger_update_request.py +136 -0
- moderntreasury/models/ledgerable_event.py +258 -0
- moderntreasury/models/ledgerable_event_create_request.py +237 -0
- moderntreasury/models/ledgerable_type_2_enum.py +71 -0
- moderntreasury/models/ledgerable_type_5_enum.py +70 -0
- moderntreasury/models/ledgerable_type_6_enum.py +67 -0
- moderntreasury/models/ledgerable_type_enum.py +47 -0
- moderntreasury/models/legacy_document_create_request.py +98 -0
- moderntreasury/models/line_item.py +250 -0
- moderntreasury/models/line_item_request.py +153 -0
- moderntreasury/models/line_item_update_request.py +86 -0
- moderntreasury/models/mreturn.py +735 -0
- moderntreasury/models/normal_balance_2_enum.py +45 -0
- moderntreasury/models/normal_balance_enum.py +45 -0
- moderntreasury/models/order_by.py +108 -0
- moderntreasury/models/originating_account_number_type_enum.py +68 -0
- moderntreasury/models/originating_routing_number_type_enum.py +84 -0
- moderntreasury/models/paper_item.py +313 -0
- moderntreasury/models/party_address.py +152 -0
- moderntreasury/models/party_type_5_enum.py +59 -0
- moderntreasury/models/party_type_enum.py +59 -0
- moderntreasury/models/payment_direction_enum.py +43 -0
- moderntreasury/models/payment_flow.py +406 -0
- moderntreasury/models/payment_flow_create_request.py +127 -0
- moderntreasury/models/payment_flow_update_request.py +66 -0
- moderntreasury/models/payment_method_1_enum.py +53 -0
- moderntreasury/models/payment_method_enum.py +49 -0
- moderntreasury/models/payment_order.py +1414 -0
- moderntreasury/models/payment_order_async_create_request.py +894 -0
- moderntreasury/models/payment_order_create_request.py +926 -0
- moderntreasury/models/payment_order_update_request.py +941 -0
- moderntreasury/models/payment_reference.py +270 -0
- moderntreasury/models/payment_reference_object.py +185 -0
- moderntreasury/models/payment_type_13_enum.py +104 -0
- moderntreasury/models/payment_type_1_enum.py +107 -0
- moderntreasury/models/payment_type_2_enum.py +104 -0
- moderntreasury/models/payment_type_4_enum.py +106 -0
- moderntreasury/models/payment_type_5_enum.py +45 -0
- moderntreasury/models/payment_type_6_enum.py +107 -0
- moderntreasury/models/payment_type_enum.py +45 -0
- moderntreasury/models/ping_response.py +69 -0
- moderntreasury/models/priority_4_enum.py +43 -0
- moderntreasury/models/priority_enum.py +61 -0
- moderntreasury/models/reason_1_enum.py +56 -0
- moderntreasury/models/reason_enum.py +54 -0
- moderntreasury/models/receiving_account.py +526 -0
- moderntreasury/models/receiving_account_1.py +385 -0
- moderntreasury/models/receiving_account_type_enum.py +57 -0
- moderntreasury/models/reconciliation_method_enum.py +47 -0
- moderntreasury/models/reference_number_type_1_enum.py +204 -0
- moderntreasury/models/reference_number_type_enum.py +238 -0
- moderntreasury/models/referenceable_type_1_enum.py +46 -0
- moderntreasury/models/referenceable_type_enum.py +49 -0
- moderntreasury/models/return_create_request.py +192 -0
- moderntreasury/models/returnable_type_1_enum.py +52 -0
- moderntreasury/models/returnable_type_enum.py +69 -0
- moderntreasury/models/reversal.py +186 -0
- moderntreasury/models/reversal_create_request.py +129 -0
- moderntreasury/models/role_enum.py +59 -0
- moderntreasury/models/routing_detail.py +387 -0
- moderntreasury/models/routing_detail_1.py +112 -0
- moderntreasury/models/routing_detail_create_request.py +117 -0
- moderntreasury/models/routing_number_lookup_request.py +213 -0
- moderntreasury/models/routing_number_type_1_enum.py +82 -0
- moderntreasury/models/routing_number_type_7_enum.py +60 -0
- moderntreasury/models/routing_number_type_8_enum.py +82 -0
- moderntreasury/models/routing_number_type_enum.py +84 -0
- moderntreasury/models/status_11_enum.py +48 -0
- moderntreasury/models/status_12_enum.py +48 -0
- moderntreasury/models/status_15_enum.py +49 -0
- moderntreasury/models/status_16_enum.py +49 -0
- moderntreasury/models/status_17_enum.py +52 -0
- moderntreasury/models/status_18_enum.py +74 -0
- moderntreasury/models/status_19_enum.py +57 -0
- moderntreasury/models/status_1_enum.py +48 -0
- moderntreasury/models/status_20_enum.py +46 -0
- moderntreasury/models/status_21_enum.py +46 -0
- moderntreasury/models/status_22_enum.py +46 -0
- moderntreasury/models/status_24_enum.py +70 -0
- moderntreasury/models/status_2_enum.py +49 -0
- moderntreasury/models/status_3_enum.py +87 -0
- moderntreasury/models/status_4_enum.py +72 -0
- moderntreasury/models/status_5_enum.py +54 -0
- moderntreasury/models/status_6_enum.py +55 -0
- moderntreasury/models/status_7_enum.py +46 -0
- moderntreasury/models/status_8_enum.py +46 -0
- moderntreasury/models/status_9_enum.py +49 -0
- moderntreasury/models/status_enum.py +52 -0
- moderntreasury/models/subtype_enum.py +87 -0
- moderntreasury/models/supported_payment_type_enum.py +104 -0
- moderntreasury/models/transactable_type_enum.py +58 -0
- moderntreasury/models/transaction.py +389 -0
- moderntreasury/models/transaction_line_item.py +254 -0
- moderntreasury/models/type_10_enum.py +66 -0
- moderntreasury/models/type_11_enum.py +107 -0
- moderntreasury/models/type_12_enum.py +46 -0
- moderntreasury/models/type_13_enum.py +104 -0
- moderntreasury/models/type_14_enum.py +64 -0
- moderntreasury/models/type_16_enum.py +43 -0
- moderntreasury/models/type_1_enum.py +107 -0
- moderntreasury/models/type_4_enum.py +67 -0
- moderntreasury/models/type_5_enum.py +107 -0
- moderntreasury/models/type_6_enum.py +91 -0
- moderntreasury/models/type_enum.py +46 -0
- moderntreasury/models/vendor_code_type_1_enum.py +102 -0
- moderntreasury/models/vendor_code_type_enum.py +99 -0
- moderntreasury/models/verification_status_1_enum.py +51 -0
- moderntreasury/models/verification_status_enum.py +60 -0
- moderntreasury/models/virtual_account.py +287 -0
- moderntreasury/models/virtual_account_create_request.py +272 -0
- moderntreasury/models/virtual_account_update_request.py +135 -0
- moderntreasury/moderntreasury_client.py +349 -0
- moderntreasury/utilities/__init__.py +6 -0
- moderntreasury/utilities/file_wrapper.py +45 -0
- moderntreasury/utilities/union_type_lookup.py +76 -0
- mt_sdk-0.0.1.dist-info/METADATA +170 -0
- mt_sdk-0.0.1.dist-info/RECORD +294 -0
- mt_sdk-0.0.1.dist-info/WHEEL +5 -0
- mt_sdk-0.0.1.dist-info/licenses/LICENSE +28 -0
- mt_sdk-0.0.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# ruff: noqa: D104 | Missing docstring in public package
|
|
2
|
+
# ruff: noqa: RUF022 | `__all__` is not sorted
|
|
3
|
+
__all__ = [
|
|
4
|
+
"api_helper",
|
|
5
|
+
"configuration",
|
|
6
|
+
"controllers",
|
|
7
|
+
"exceptions",
|
|
8
|
+
"http",
|
|
9
|
+
"models",
|
|
10
|
+
"moderntreasury_client",
|
|
11
|
+
"utilities",
|
|
12
|
+
]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""
|
|
2
|
+
moderntreasury
|
|
3
|
+
|
|
4
|
+
This file was automatically generated by APIMATIC v3.0 (
|
|
5
|
+
https://www.apimatic.io ).
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from apimatic_core.utilities.api_helper import ApiHelper as CoreApiHelper
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class APIHelper(CoreApiHelper):
|
|
12
|
+
"""
|
|
13
|
+
A Helper Class for various functions associated with API Calls.
|
|
14
|
+
|
|
15
|
+
This class contains static methods for operations that need to be
|
|
16
|
+
performed during API requests. All of the methods inside this class are
|
|
17
|
+
static methods, there is no need to ever initialise an instance of this
|
|
18
|
+
class.
|
|
19
|
+
"""
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
"""moderntreasury.
|
|
2
|
+
|
|
3
|
+
This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
# ruff: noqa: E501
|
|
7
|
+
import os
|
|
8
|
+
import warnings
|
|
9
|
+
from enum import Enum
|
|
10
|
+
|
|
11
|
+
from apimatic_core.http.configurations.http_client_configuration import (
|
|
12
|
+
HttpClientConfiguration,
|
|
13
|
+
)
|
|
14
|
+
from apimatic_requests_client_adapter.requests_client import (
|
|
15
|
+
RequestsClient,
|
|
16
|
+
)
|
|
17
|
+
from dotenv import load_dotenv
|
|
18
|
+
|
|
19
|
+
from moderntreasury.http.proxy_settings import (
|
|
20
|
+
ProxySettings,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class Environment(Enum):
|
|
25
|
+
"""An enum for SDK environments."""
|
|
26
|
+
|
|
27
|
+
PRODUCTION = 0
|
|
28
|
+
ENVIRONMENT2 = 1
|
|
29
|
+
|
|
30
|
+
@classmethod
|
|
31
|
+
def from_value(cls, value, default=None):
|
|
32
|
+
"""Convert a value (string or int) to an Environment enum member.
|
|
33
|
+
|
|
34
|
+
Args:
|
|
35
|
+
value (Union[str, int]): The value to convert.
|
|
36
|
+
default (Environment): The fallback enum member if conversion fails.
|
|
37
|
+
|
|
38
|
+
Returns:
|
|
39
|
+
Environment: Matching enum member or fallback if invalid.
|
|
40
|
+
|
|
41
|
+
"""
|
|
42
|
+
if value is None:
|
|
43
|
+
return default
|
|
44
|
+
|
|
45
|
+
# Try to match directly by enum member
|
|
46
|
+
if isinstance(value, cls):
|
|
47
|
+
return value
|
|
48
|
+
|
|
49
|
+
# Handle integer or string conversion
|
|
50
|
+
for member in cls:
|
|
51
|
+
if (str(member.value).lower() == str(value).lower()
|
|
52
|
+
or member.name.lower() == str(value).lower()):
|
|
53
|
+
return member
|
|
54
|
+
|
|
55
|
+
# Fallback to provided default
|
|
56
|
+
return default
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class Server(Enum):
|
|
60
|
+
"""An enum for API servers."""
|
|
61
|
+
|
|
62
|
+
DEFAULT = 0
|
|
63
|
+
|
|
64
|
+
@classmethod
|
|
65
|
+
def from_value(cls, value, default=None):
|
|
66
|
+
"""Convert a value (string or int) to a Server enum member.
|
|
67
|
+
|
|
68
|
+
Args:
|
|
69
|
+
value (Union[str, int]): The value to convert.
|
|
70
|
+
default (Server): The fallback enum member if conversion fails.
|
|
71
|
+
|
|
72
|
+
Returns:
|
|
73
|
+
Server: Matching enum member or fallback if invalid.
|
|
74
|
+
|
|
75
|
+
"""
|
|
76
|
+
if value is None:
|
|
77
|
+
return default
|
|
78
|
+
|
|
79
|
+
# Try to match directly by enum member
|
|
80
|
+
if isinstance(value, cls):
|
|
81
|
+
return value
|
|
82
|
+
|
|
83
|
+
# Handle integer or string conversion
|
|
84
|
+
for member in cls:
|
|
85
|
+
if (str(member.value).lower() == str(value).lower()
|
|
86
|
+
or member.name.lower() == str(value).lower()):
|
|
87
|
+
return member
|
|
88
|
+
|
|
89
|
+
# Fallback to provided default
|
|
90
|
+
return default
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
class Configuration(HttpClientConfiguration):
|
|
94
|
+
"""A class used for configuring the SDK by a user."""
|
|
95
|
+
|
|
96
|
+
@property
|
|
97
|
+
def environment(self):
|
|
98
|
+
"""Return current environment."""
|
|
99
|
+
return self._environment
|
|
100
|
+
|
|
101
|
+
@property
|
|
102
|
+
def basic_auth_user_name(self):
|
|
103
|
+
"""Return Username from BasicAuthCredentials."""
|
|
104
|
+
return self._basic_auth_credentials.username
|
|
105
|
+
|
|
106
|
+
@property
|
|
107
|
+
def basic_auth_password(self):
|
|
108
|
+
"""Return Password from BasicAuthCredentials."""
|
|
109
|
+
return self._basic_auth_credentials.password
|
|
110
|
+
|
|
111
|
+
@property
|
|
112
|
+
def basic_auth_credentials(self):
|
|
113
|
+
"""Return BasicAuthCredentials."""
|
|
114
|
+
return self._basic_auth_credentials
|
|
115
|
+
|
|
116
|
+
def __init__(self, http_client_instance=None,
|
|
117
|
+
override_http_client_configuration=False, http_call_back=None,
|
|
118
|
+
timeout=60, max_retries=0, backoff_factor=2, retry_statuses=None,
|
|
119
|
+
retry_methods=None, proxy_settings=None,
|
|
120
|
+
environment=Environment.PRODUCTION, basic_auth_user_name=None,
|
|
121
|
+
basic_auth_password=None, basic_auth_credentials=None):
|
|
122
|
+
"""Initialize Configuration object."""
|
|
123
|
+
if retry_methods is None:
|
|
124
|
+
retry_methods = ["GET", "PUT"]
|
|
125
|
+
|
|
126
|
+
if retry_statuses is None:
|
|
127
|
+
retry_statuses = [408, 413, 429, 500, 502, 503, 504, 521,
|
|
128
|
+
522, 524]
|
|
129
|
+
|
|
130
|
+
super().__init__(
|
|
131
|
+
http_client_instance=http_client_instance,
|
|
132
|
+
override_http_client_configuration=override_http_client_configuration,
|
|
133
|
+
http_call_back=http_call_back, timeout=timeout,
|
|
134
|
+
max_retries=max_retries, backoff_factor=backoff_factor,
|
|
135
|
+
retry_statuses=retry_statuses, retry_methods=retry_methods,
|
|
136
|
+
proxy_settings=proxy_settings,
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
# Current API environment
|
|
140
|
+
self._environment = environment
|
|
141
|
+
|
|
142
|
+
self._basic_auth_credentials =\
|
|
143
|
+
self.create_auth_credentials_object(basic_auth_user_name,
|
|
144
|
+
basic_auth_password,
|
|
145
|
+
basic_auth_credentials)
|
|
146
|
+
|
|
147
|
+
# The Http Client to use for making requests.
|
|
148
|
+
self.set_http_client(self.create_http_client())
|
|
149
|
+
|
|
150
|
+
def clone_with(self, http_client_instance=None,
|
|
151
|
+
override_http_client_configuration=None, http_call_back=None,
|
|
152
|
+
timeout=None, max_retries=None, backoff_factor=None,
|
|
153
|
+
retry_statuses=None, retry_methods=None, proxy_settings=None,
|
|
154
|
+
environment=None, basic_auth_user_name=None,
|
|
155
|
+
basic_auth_password=None, basic_auth_credentials=None):
|
|
156
|
+
"""Clone configuration with overrides."""
|
|
157
|
+
http_client_instance = http_client_instance or self.http_client_instance
|
|
158
|
+
override_http_client_configuration =\
|
|
159
|
+
(override_http_client_configuration
|
|
160
|
+
or self.override_http_client_configuration)
|
|
161
|
+
http_call_back = http_call_back or self.http_callback
|
|
162
|
+
timeout = timeout or self.timeout
|
|
163
|
+
max_retries = max_retries or self.max_retries
|
|
164
|
+
backoff_factor = backoff_factor or self.backoff_factor
|
|
165
|
+
retry_statuses = retry_statuses or self.retry_statuses
|
|
166
|
+
retry_methods = retry_methods or self.retry_methods
|
|
167
|
+
proxy_settings = proxy_settings or self.proxy_settings
|
|
168
|
+
environment = environment or self.environment
|
|
169
|
+
basic_auth_credentials = self.create_auth_credentials_object(
|
|
170
|
+
basic_auth_user_name, basic_auth_password,
|
|
171
|
+
basic_auth_credentials
|
|
172
|
+
or self.basic_auth_credentials,
|
|
173
|
+
stack_level=3)
|
|
174
|
+
return Configuration(
|
|
175
|
+
http_client_instance=http_client_instance,
|
|
176
|
+
override_http_client_configuration=override_http_client_configuration,
|
|
177
|
+
http_call_back=http_call_back, timeout=timeout, max_retries=max_retries,
|
|
178
|
+
backoff_factor=backoff_factor, retry_statuses=retry_statuses,
|
|
179
|
+
retry_methods=retry_methods, proxy_settings=proxy_settings,
|
|
180
|
+
environment=environment, basic_auth_credentials=basic_auth_credentials,
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
def create_http_client(self):
|
|
184
|
+
"""Create the HTTP client instance."""
|
|
185
|
+
return RequestsClient(
|
|
186
|
+
timeout=self.timeout, max_retries=self.max_retries,
|
|
187
|
+
backoff_factor=self.backoff_factor, retry_statuses=self.retry_statuses,
|
|
188
|
+
retry_methods=self.retry_methods,
|
|
189
|
+
http_client_instance=self.http_client_instance,
|
|
190
|
+
override_http_client_configuration=self.override_http_client_configuration,
|
|
191
|
+
response_factory=self.http_response_factory,
|
|
192
|
+
proxies=self.proxy_settings.to_proxies() if self.proxy_settings else None,
|
|
193
|
+
)
|
|
194
|
+
|
|
195
|
+
# All the environments the SDK can run in
|
|
196
|
+
environments = {
|
|
197
|
+
Environment.PRODUCTION: {
|
|
198
|
+
Server.DEFAULT: "http://localhost:3000",
|
|
199
|
+
},
|
|
200
|
+
Environment.ENVIRONMENT2: {
|
|
201
|
+
Server.DEFAULT: "https://app.moderntreasury.com",
|
|
202
|
+
},
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
def get_base_uri(self, server=Server.DEFAULT):
|
|
206
|
+
"""Generate the appropriate base URI for the environment and the server.
|
|
207
|
+
|
|
208
|
+
Args:
|
|
209
|
+
server (Configuration.Server): The server enum for which the base
|
|
210
|
+
URI is required.
|
|
211
|
+
|
|
212
|
+
Returns:
|
|
213
|
+
String: The base URI.
|
|
214
|
+
|
|
215
|
+
"""
|
|
216
|
+
return self.environments[self.environment][server]
|
|
217
|
+
|
|
218
|
+
@staticmethod
|
|
219
|
+
def create_auth_credentials_object(basic_auth_user_name,
|
|
220
|
+
basic_auth_password,
|
|
221
|
+
basic_auth_credentials, stack_level=4):
|
|
222
|
+
"""Create auth credentials object."""
|
|
223
|
+
if basic_auth_user_name is None \
|
|
224
|
+
and basic_auth_password is None:
|
|
225
|
+
return basic_auth_credentials
|
|
226
|
+
|
|
227
|
+
warnings.warn(message=("The 'basic_auth_user_name', 'basic_auth_password' par"
|
|
228
|
+
"ams are deprecated. Use 'basic_auth_credentials' para"
|
|
229
|
+
"m instead."),
|
|
230
|
+
category=DeprecationWarning,
|
|
231
|
+
stacklevel=stack_level)
|
|
232
|
+
|
|
233
|
+
if basic_auth_credentials is not None:
|
|
234
|
+
return basic_auth_credentials.clone_with(basic_auth_user_name,
|
|
235
|
+
basic_auth_password)
|
|
236
|
+
|
|
237
|
+
from moderntreasury.http.auth.basic_auth import (
|
|
238
|
+
BasicAuthCredentials,
|
|
239
|
+
)
|
|
240
|
+
return BasicAuthCredentials(basic_auth_user_name, basic_auth_password)
|
|
241
|
+
|
|
242
|
+
@classmethod
|
|
243
|
+
def from_environment(cls, dotenv_path=None, **overrides):
|
|
244
|
+
"""Create Configuration object from .env and environment variables.
|
|
245
|
+
|
|
246
|
+
Args:
|
|
247
|
+
dotenv_path (str, optional): Path to the .env file to load.
|
|
248
|
+
If None, the default .env file is used.
|
|
249
|
+
**overrides: Optional values overriding setting from environment variables.
|
|
250
|
+
|
|
251
|
+
Returns:
|
|
252
|
+
Configuration: A configuration object populated with the resolved values.
|
|
253
|
+
|
|
254
|
+
"""
|
|
255
|
+
# load .env automatically
|
|
256
|
+
load_dotenv(dotenv_path or None, override=True)
|
|
257
|
+
|
|
258
|
+
override_http_client_configuration = os.getenv(
|
|
259
|
+
"OVERRIDE_HTTP_CLIENT_CONFIGURATION", "false").lower() == "true"
|
|
260
|
+
timeout = int(os.getenv("TIMEOUT", "60"))
|
|
261
|
+
max_retries = int(os.getenv("MAX_RETRIES", "0"))
|
|
262
|
+
backoff_factor = float(os.getenv("BACKOFF_FACTOR", "2"))
|
|
263
|
+
statuses = os.getenv("RETRY_STATUSES", None)
|
|
264
|
+
retry_statuses = [int(v.strip()) for v in statuses.split(",")
|
|
265
|
+
if v.strip().isdigit()] if statuses else None
|
|
266
|
+
methods = os.getenv("RETRY_METHODS", None)
|
|
267
|
+
retry_methods = [v.strip() for v in methods.split(",") if v.strip()]\
|
|
268
|
+
if methods else None
|
|
269
|
+
environment = Environment.from_value(
|
|
270
|
+
os.getenv("ENVIRONMENT"), Environment.PRODUCTION)
|
|
271
|
+
|
|
272
|
+
from moderntreasury.http.auth.basic_auth import (
|
|
273
|
+
BasicAuthCredentials,
|
|
274
|
+
)
|
|
275
|
+
|
|
276
|
+
# Preparing default configuration
|
|
277
|
+
default_config = cls(
|
|
278
|
+
override_http_client_configuration=override_http_client_configuration,
|
|
279
|
+
timeout=timeout,
|
|
280
|
+
max_retries=max_retries,
|
|
281
|
+
backoff_factor=backoff_factor,
|
|
282
|
+
retry_statuses=retry_statuses,
|
|
283
|
+
retry_methods=retry_methods,
|
|
284
|
+
environment=environment,
|
|
285
|
+
proxy_settings=ProxySettings.from_environment(),
|
|
286
|
+
basic_auth_credentials=BasicAuthCredentials.from_environment(),
|
|
287
|
+
)
|
|
288
|
+
|
|
289
|
+
return default_config.clone_with(**overrides)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# ruff: noqa: D104 | Missing docstring in public package
|
|
2
|
+
# ruff: noqa: RUF022 | `__all__` is not sorted
|
|
3
|
+
__all__ = [
|
|
4
|
+
"account_collection_flow_controller",
|
|
5
|
+
"account_detail_controller",
|
|
6
|
+
"balance_report_controller",
|
|
7
|
+
"base_controller",
|
|
8
|
+
"connection_controller",
|
|
9
|
+
"counterparty_controller",
|
|
10
|
+
"document_controller",
|
|
11
|
+
"event_controller",
|
|
12
|
+
"expected_payment_controller",
|
|
13
|
+
"external_account_controller",
|
|
14
|
+
"incoming_payment_detail_controller",
|
|
15
|
+
"internal_account_controller",
|
|
16
|
+
"invoice_controller",
|
|
17
|
+
"invoice_line_item_controller",
|
|
18
|
+
"ledger_account_category_controller",
|
|
19
|
+
"ledger_account_controller",
|
|
20
|
+
"ledger_account_payout_controller",
|
|
21
|
+
"ledger_account_statement_controller",
|
|
22
|
+
"ledger_controller",
|
|
23
|
+
"ledger_entry_controller",
|
|
24
|
+
"ledger_event_handler_controller",
|
|
25
|
+
"ledger_transaction_controller",
|
|
26
|
+
"ledgerable_event_controller",
|
|
27
|
+
"line_item_controller",
|
|
28
|
+
"paper_item_controller",
|
|
29
|
+
"payment_flow_controller",
|
|
30
|
+
"payment_order_controller",
|
|
31
|
+
"payment_reference_controller",
|
|
32
|
+
"ping_controller",
|
|
33
|
+
"return_controller",
|
|
34
|
+
"reversal_controller",
|
|
35
|
+
"routing_detail_controller",
|
|
36
|
+
"transaction_controller",
|
|
37
|
+
"transaction_line_item_controller",
|
|
38
|
+
"validation_controller",
|
|
39
|
+
"virtual_account_controller",
|
|
40
|
+
]
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
"""moderntreasury.
|
|
2
|
+
|
|
3
|
+
This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
# ruff: noqa: D410, E501, E101, D206
|
|
7
|
+
from apimatic_core.authentication.multiple.single_auth import (
|
|
8
|
+
Single,
|
|
9
|
+
)
|
|
10
|
+
from apimatic_core.request_builder import RequestBuilder
|
|
11
|
+
from apimatic_core.response_handler import ResponseHandler
|
|
12
|
+
from apimatic_core.types.parameter import Parameter
|
|
13
|
+
|
|
14
|
+
from moderntreasury.api_helper import APIHelper
|
|
15
|
+
from moderntreasury.configuration import Server
|
|
16
|
+
from moderntreasury.controllers.base_controller import (
|
|
17
|
+
BaseController,
|
|
18
|
+
)
|
|
19
|
+
from moderntreasury.exceptions.error_message_exception import (
|
|
20
|
+
ErrorMessageException,
|
|
21
|
+
)
|
|
22
|
+
from moderntreasury.http.http_method_enum import (
|
|
23
|
+
HttpMethodEnum,
|
|
24
|
+
)
|
|
25
|
+
from moderntreasury.models.account_collection_flow import (
|
|
26
|
+
AccountCollectionFlow,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class AccountCollectionFlowController(BaseController):
|
|
31
|
+
"""A Controller to access Endpoints in the moderntreasury API."""
|
|
32
|
+
|
|
33
|
+
def __init__(self, config):
|
|
34
|
+
"""Initialize AccountCollectionFlowController object."""
|
|
35
|
+
super(AccountCollectionFlowController, self).__init__(config)
|
|
36
|
+
|
|
37
|
+
def list_account_collection_flows(self,
|
|
38
|
+
after_cursor=None,
|
|
39
|
+
per_page=None,
|
|
40
|
+
client_token=None,
|
|
41
|
+
status=None,
|
|
42
|
+
counterparty_id=None,
|
|
43
|
+
external_account_id=None):
|
|
44
|
+
"""Perform a GET request to /api/account_collection_flows.
|
|
45
|
+
|
|
46
|
+
Args:
|
|
47
|
+
after_cursor (str, optional): The request query parameter.
|
|
48
|
+
per_page (int, optional): The request query parameter.
|
|
49
|
+
client_token (str, optional): The request query parameter.
|
|
50
|
+
status (str, optional): The request query parameter.
|
|
51
|
+
counterparty_id (str, optional): The request query parameter.
|
|
52
|
+
external_account_id (str, optional): The request query parameter.
|
|
53
|
+
|
|
54
|
+
Returns:
|
|
55
|
+
List[AccountCollectionFlow]: Response from the API. successful
|
|
56
|
+
|
|
57
|
+
Raises:
|
|
58
|
+
APIException: When an error occurs while fetching the data from the
|
|
59
|
+
remote API. This exception includes the HTTP Response code, an error
|
|
60
|
+
message, and the HTTP body that was received in the request.
|
|
61
|
+
|
|
62
|
+
"""
|
|
63
|
+
return super().new_api_call_builder.request(
|
|
64
|
+
RequestBuilder().server(Server.DEFAULT)
|
|
65
|
+
.path("/api/account_collection_flows")
|
|
66
|
+
.http_method(HttpMethodEnum.GET)
|
|
67
|
+
.query_param(Parameter()
|
|
68
|
+
.key("after_cursor")
|
|
69
|
+
.value(after_cursor))
|
|
70
|
+
.query_param(Parameter()
|
|
71
|
+
.key("per_page")
|
|
72
|
+
.value(per_page))
|
|
73
|
+
.query_param(Parameter()
|
|
74
|
+
.key("client_token")
|
|
75
|
+
.value(client_token))
|
|
76
|
+
.query_param(Parameter()
|
|
77
|
+
.key("status")
|
|
78
|
+
.value(status))
|
|
79
|
+
.query_param(Parameter()
|
|
80
|
+
.key("counterparty_id")
|
|
81
|
+
.value(counterparty_id))
|
|
82
|
+
.query_param(Parameter()
|
|
83
|
+
.key("external_account_id")
|
|
84
|
+
.value(external_account_id))
|
|
85
|
+
.header_param(Parameter()
|
|
86
|
+
.key("accept")
|
|
87
|
+
.value("application/json"))
|
|
88
|
+
.auth(Single("basic_auth")),
|
|
89
|
+
).response(
|
|
90
|
+
ResponseHandler()
|
|
91
|
+
.deserializer(APIHelper.json_deserialize)
|
|
92
|
+
.deserialize_into(AccountCollectionFlow.from_dictionary),
|
|
93
|
+
).execute()
|
|
94
|
+
|
|
95
|
+
def create_account_collection_flow(self,
|
|
96
|
+
idempotency_key=None,
|
|
97
|
+
body=None):
|
|
98
|
+
"""Perform a POST request to /api/account_collection_flows.
|
|
99
|
+
|
|
100
|
+
Args:
|
|
101
|
+
idempotency_key (str, optional): This key should be something unique,
|
|
102
|
+
preferably something like an UUID.
|
|
103
|
+
body (AccountCollectionFlowCreateRequest, optional): The request body
|
|
104
|
+
parameter.
|
|
105
|
+
|
|
106
|
+
Returns:
|
|
107
|
+
AccountCollectionFlow: Response from the API. successful
|
|
108
|
+
|
|
109
|
+
Raises:
|
|
110
|
+
APIException: When an error occurs while fetching the data from the
|
|
111
|
+
remote API. This exception includes the HTTP Response code, an error
|
|
112
|
+
message, and the HTTP body that was received in the request.
|
|
113
|
+
|
|
114
|
+
"""
|
|
115
|
+
return super().new_api_call_builder.request(
|
|
116
|
+
RequestBuilder().server(Server.DEFAULT)
|
|
117
|
+
.path("/api/account_collection_flows")
|
|
118
|
+
.http_method(HttpMethodEnum.POST)
|
|
119
|
+
.header_param(Parameter()
|
|
120
|
+
.key("Content-Type")
|
|
121
|
+
.value("application/json"))
|
|
122
|
+
.header_param(Parameter()
|
|
123
|
+
.key("Idempotency-Key")
|
|
124
|
+
.value(idempotency_key))
|
|
125
|
+
.body_param(Parameter()
|
|
126
|
+
.value(body))
|
|
127
|
+
.header_param(Parameter()
|
|
128
|
+
.key("accept")
|
|
129
|
+
.value("application/json"))
|
|
130
|
+
.body_serializer(APIHelper.json_serialize)
|
|
131
|
+
.auth(Single("basic_auth")),
|
|
132
|
+
).response(
|
|
133
|
+
ResponseHandler()
|
|
134
|
+
.deserializer(APIHelper.json_deserialize)
|
|
135
|
+
.deserialize_into(AccountCollectionFlow.from_dictionary)
|
|
136
|
+
.local_error("422", "unsuccessful", ErrorMessageException),
|
|
137
|
+
).execute()
|
|
138
|
+
|
|
139
|
+
def get_account_collection_flow(self,
|
|
140
|
+
id,
|
|
141
|
+
idempotency_key=None):
|
|
142
|
+
"""Perform a GET request to /api/account_collection_flows/{id}.
|
|
143
|
+
|
|
144
|
+
Args:
|
|
145
|
+
id (str): id
|
|
146
|
+
idempotency_key (str, optional): This key should be something unique,
|
|
147
|
+
preferably something like an UUID.
|
|
148
|
+
|
|
149
|
+
Returns:
|
|
150
|
+
AccountCollectionFlow: Response from the API. successful
|
|
151
|
+
|
|
152
|
+
Raises:
|
|
153
|
+
APIException: When an error occurs while fetching the data from the
|
|
154
|
+
remote API. This exception includes the HTTP Response code, an error
|
|
155
|
+
message, and the HTTP body that was received in the request.
|
|
156
|
+
|
|
157
|
+
"""
|
|
158
|
+
return super().new_api_call_builder.request(
|
|
159
|
+
RequestBuilder().server(Server.DEFAULT)
|
|
160
|
+
.path("/api/account_collection_flows/{id}")
|
|
161
|
+
.http_method(HttpMethodEnum.GET)
|
|
162
|
+
.template_param(Parameter()
|
|
163
|
+
.key("id")
|
|
164
|
+
.value(id)
|
|
165
|
+
.should_encode(True))
|
|
166
|
+
.header_param(Parameter()
|
|
167
|
+
.key("Idempotency-Key")
|
|
168
|
+
.value(idempotency_key))
|
|
169
|
+
.header_param(Parameter()
|
|
170
|
+
.key("accept")
|
|
171
|
+
.value("application/json"))
|
|
172
|
+
.auth(Single("basic_auth")),
|
|
173
|
+
).response(
|
|
174
|
+
ResponseHandler()
|
|
175
|
+
.deserializer(APIHelper.json_deserialize)
|
|
176
|
+
.deserialize_into(AccountCollectionFlow.from_dictionary),
|
|
177
|
+
).execute()
|
|
178
|
+
|
|
179
|
+
def update_account_collection_flow(self,
|
|
180
|
+
id,
|
|
181
|
+
idempotency_key=None,
|
|
182
|
+
body=None):
|
|
183
|
+
"""Perform a PATCH request to /api/account_collection_flows/{id}.
|
|
184
|
+
|
|
185
|
+
Args:
|
|
186
|
+
id (str): id
|
|
187
|
+
idempotency_key (str, optional): This key should be something unique,
|
|
188
|
+
preferably something like an UUID.
|
|
189
|
+
body (AccountCollectionFlowUpdateRequest, optional): The request body
|
|
190
|
+
parameter.
|
|
191
|
+
|
|
192
|
+
Returns:
|
|
193
|
+
AccountCollectionFlow: Response from the API. successful
|
|
194
|
+
|
|
195
|
+
Raises:
|
|
196
|
+
APIException: When an error occurs while fetching the data from the
|
|
197
|
+
remote API. This exception includes the HTTP Response code, an error
|
|
198
|
+
message, and the HTTP body that was received in the request.
|
|
199
|
+
|
|
200
|
+
"""
|
|
201
|
+
return super().new_api_call_builder.request(
|
|
202
|
+
RequestBuilder().server(Server.DEFAULT)
|
|
203
|
+
.path("/api/account_collection_flows/{id}")
|
|
204
|
+
.http_method(HttpMethodEnum.PATCH)
|
|
205
|
+
.template_param(Parameter()
|
|
206
|
+
.key("id")
|
|
207
|
+
.value(id)
|
|
208
|
+
.should_encode(True))
|
|
209
|
+
.header_param(Parameter()
|
|
210
|
+
.key("Content-Type")
|
|
211
|
+
.value("application/json"))
|
|
212
|
+
.header_param(Parameter()
|
|
213
|
+
.key("Idempotency-Key")
|
|
214
|
+
.value(idempotency_key))
|
|
215
|
+
.body_param(Parameter()
|
|
216
|
+
.value(body))
|
|
217
|
+
.header_param(Parameter()
|
|
218
|
+
.key("accept")
|
|
219
|
+
.value("application/json"))
|
|
220
|
+
.body_serializer(APIHelper.json_serialize)
|
|
221
|
+
.auth(Single("basic_auth")),
|
|
222
|
+
).response(
|
|
223
|
+
ResponseHandler()
|
|
224
|
+
.deserializer(APIHelper.json_deserialize)
|
|
225
|
+
.deserialize_into(AccountCollectionFlow.from_dictionary)
|
|
226
|
+
.local_error("404", "not found", ErrorMessageException)
|
|
227
|
+
.local_error("422", "unsuccessful", ErrorMessageException),
|
|
228
|
+
).execute()
|