diff --git a/pyproject.toml b/pyproject.toml index ae6bc19..6ae9c09 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "mercoa" -version = "0.4.2" +version = "0.4.3" description = "" readme = "README.md" authors = [] diff --git a/src/mercoa/__init__.py b/src/mercoa/__init__.py index ad00cbf..eaf9797 100644 --- a/src/mercoa/__init__.py +++ b/src/mercoa/__init__.py @@ -207,8 +207,10 @@ CheckRequest, CheckResponse, CurrencyCode, + CustomPaymentMethodFeeType, CustomPaymentMethodRequest, CustomPaymentMethodResponse, + CustomPaymentMethodSchemaFee, CustomPaymentMethodSchemaField, CustomPaymentMethodSchemaFieldType, CustomPaymentMethodSchemaId, @@ -307,8 +309,10 @@ "CounterpartyResponse", "CounterpartyWebhook", "CurrencyCode", + "CustomPaymentMethodFeeType", "CustomPaymentMethodRequest", "CustomPaymentMethodResponse", + "CustomPaymentMethodSchemaFee", "CustomPaymentMethodSchemaField", "CustomPaymentMethodSchemaFieldType", "CustomPaymentMethodSchemaId", diff --git a/src/mercoa/core/client_wrapper.py b/src/mercoa/core/client_wrapper.py index ecf3587..bd70019 100644 --- a/src/mercoa/core/client_wrapper.py +++ b/src/mercoa/core/client_wrapper.py @@ -23,7 +23,7 @@ def get_headers(self) -> typing.Dict[str, str]: headers: typing.Dict[str, str] = { "X-Fern-Language": "Python", "X-Fern-SDK-Name": "mercoa", - "X-Fern-SDK-Version": "0.4.2", + "X-Fern-SDK-Version": "0.4.3", } headers["Authorization"] = f"Bearer {self._get_token()}" return headers diff --git a/src/mercoa/custom_payment_method_schema/client.py b/src/mercoa/custom_payment_method_schema/client.py index c86f99e..5d25c70 100644 --- a/src/mercoa/custom_payment_method_schema/client.py +++ b/src/mercoa/custom_payment_method_schema/client.py @@ -16,6 +16,7 @@ from ..core.pydantic_utilities import pydantic_v1 from ..core.request_options import RequestOptions from ..payment_method_types.types.currency_code import CurrencyCode +from ..payment_method_types.types.custom_payment_method_schema_fee import CustomPaymentMethodSchemaFee from ..payment_method_types.types.custom_payment_method_schema_field import CustomPaymentMethodSchemaField from ..payment_method_types.types.custom_payment_method_schema_id import CustomPaymentMethodSchemaId from ..payment_method_types.types.custom_payment_method_schema_response import CustomPaymentMethodSchemaResponse @@ -85,8 +86,9 @@ def create( is_source: bool, is_destination: bool, fields: typing.Sequence[CustomPaymentMethodSchemaField], - estimated_processing_time: typing.Optional[int] = OMIT, supported_currencies: typing.Optional[typing.Sequence[CurrencyCode]] = OMIT, + estimated_processing_time: typing.Optional[int] = OMIT, + fees: typing.Optional[CustomPaymentMethodSchemaFee] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> CustomPaymentMethodSchemaResponse: """ @@ -104,11 +106,13 @@ def create( fields : typing.Sequence[CustomPaymentMethodSchemaField] + supported_currencies : typing.Optional[typing.Sequence[CurrencyCode]] + List of currencies that this payment method supports. If not provided, the payment method will support only USD. + estimated_processing_time : typing.Optional[int] Estimated time in days for this payment method to process a payments. Set as 0 for same-day payment methods, -1 for unknown processing time. - supported_currencies : typing.Optional[typing.Sequence[CurrencyCode]] - List of currencies that this payment method supports. If not provided, the payment method will support only USD. + fees : typing.Optional[CustomPaymentMethodSchemaFee] request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -146,14 +150,14 @@ def create( CustomPaymentMethodSchemaField( name="accountNumber", display_name="Account Number", - type="number", + type="usBankAccountNumber", optional=False, use_as_account_number=True, ), CustomPaymentMethodSchemaField( name="routingNumber", display_name="Routing Number", - type="number", + type="usBankRoutingNumber", optional=False, ), ], @@ -167,9 +171,10 @@ def create( "name": name, "isSource": is_source, "isDestination": is_destination, - "estimatedProcessingTime": estimated_processing_time, "supportedCurrencies": supported_currencies, "fields": fields, + "estimatedProcessingTime": estimated_processing_time, + "fees": fees, }, request_options=request_options, omit=OMIT, @@ -205,8 +210,9 @@ def update( is_source: bool, is_destination: bool, fields: typing.Sequence[CustomPaymentMethodSchemaField], - estimated_processing_time: typing.Optional[int] = OMIT, supported_currencies: typing.Optional[typing.Sequence[CurrencyCode]] = OMIT, + estimated_processing_time: typing.Optional[int] = OMIT, + fees: typing.Optional[CustomPaymentMethodSchemaFee] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> CustomPaymentMethodSchemaResponse: """ @@ -226,11 +232,13 @@ def update( fields : typing.Sequence[CustomPaymentMethodSchemaField] + supported_currencies : typing.Optional[typing.Sequence[CurrencyCode]] + List of currencies that this payment method supports. If not provided, the payment method will support only USD. + estimated_processing_time : typing.Optional[int] Estimated time in days for this payment method to process a payments. Set as 0 for same-day payment methods, -1 for unknown processing time. - supported_currencies : typing.Optional[typing.Sequence[CurrencyCode]] - List of currencies that this payment method supports. If not provided, the payment method will support only USD. + fees : typing.Optional[CustomPaymentMethodSchemaFee] request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -263,14 +271,14 @@ def update( CustomPaymentMethodSchemaField( name="accountNumber", display_name="Account Number", - type="number", + type="usBankAccountNumber", optional=False, use_as_account_number=True, ), CustomPaymentMethodSchemaField( name="routingNumber", display_name="Routing Number", - type="number", + type="usBankRoutingNumber", optional=False, ), CustomPaymentMethodSchemaField( @@ -290,9 +298,10 @@ def update( "name": name, "isSource": is_source, "isDestination": is_destination, - "estimatedProcessingTime": estimated_processing_time, "supportedCurrencies": supported_currencies, "fields": fields, + "estimatedProcessingTime": estimated_processing_time, + "fees": fees, }, request_options=request_options, omit=OMIT, @@ -490,8 +499,9 @@ async def create( is_source: bool, is_destination: bool, fields: typing.Sequence[CustomPaymentMethodSchemaField], - estimated_processing_time: typing.Optional[int] = OMIT, supported_currencies: typing.Optional[typing.Sequence[CurrencyCode]] = OMIT, + estimated_processing_time: typing.Optional[int] = OMIT, + fees: typing.Optional[CustomPaymentMethodSchemaFee] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> CustomPaymentMethodSchemaResponse: """ @@ -509,11 +519,13 @@ async def create( fields : typing.Sequence[CustomPaymentMethodSchemaField] + supported_currencies : typing.Optional[typing.Sequence[CurrencyCode]] + List of currencies that this payment method supports. If not provided, the payment method will support only USD. + estimated_processing_time : typing.Optional[int] Estimated time in days for this payment method to process a payments. Set as 0 for same-day payment methods, -1 for unknown processing time. - supported_currencies : typing.Optional[typing.Sequence[CurrencyCode]] - List of currencies that this payment method supports. If not provided, the payment method will support only USD. + fees : typing.Optional[CustomPaymentMethodSchemaFee] request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -551,14 +563,14 @@ async def create( CustomPaymentMethodSchemaField( name="accountNumber", display_name="Account Number", - type="number", + type="usBankAccountNumber", optional=False, use_as_account_number=True, ), CustomPaymentMethodSchemaField( name="routingNumber", display_name="Routing Number", - type="number", + type="usBankRoutingNumber", optional=False, ), ], @@ -572,9 +584,10 @@ async def create( "name": name, "isSource": is_source, "isDestination": is_destination, - "estimatedProcessingTime": estimated_processing_time, "supportedCurrencies": supported_currencies, "fields": fields, + "estimatedProcessingTime": estimated_processing_time, + "fees": fees, }, request_options=request_options, omit=OMIT, @@ -610,8 +623,9 @@ async def update( is_source: bool, is_destination: bool, fields: typing.Sequence[CustomPaymentMethodSchemaField], - estimated_processing_time: typing.Optional[int] = OMIT, supported_currencies: typing.Optional[typing.Sequence[CurrencyCode]] = OMIT, + estimated_processing_time: typing.Optional[int] = OMIT, + fees: typing.Optional[CustomPaymentMethodSchemaFee] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> CustomPaymentMethodSchemaResponse: """ @@ -631,11 +645,13 @@ async def update( fields : typing.Sequence[CustomPaymentMethodSchemaField] + supported_currencies : typing.Optional[typing.Sequence[CurrencyCode]] + List of currencies that this payment method supports. If not provided, the payment method will support only USD. + estimated_processing_time : typing.Optional[int] Estimated time in days for this payment method to process a payments. Set as 0 for same-day payment methods, -1 for unknown processing time. - supported_currencies : typing.Optional[typing.Sequence[CurrencyCode]] - List of currencies that this payment method supports. If not provided, the payment method will support only USD. + fees : typing.Optional[CustomPaymentMethodSchemaFee] request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -668,14 +684,14 @@ async def update( CustomPaymentMethodSchemaField( name="accountNumber", display_name="Account Number", - type="number", + type="usBankAccountNumber", optional=False, use_as_account_number=True, ), CustomPaymentMethodSchemaField( name="routingNumber", display_name="Routing Number", - type="number", + type="usBankRoutingNumber", optional=False, ), CustomPaymentMethodSchemaField( @@ -695,9 +711,10 @@ async def update( "name": name, "isSource": is_source, "isDestination": is_destination, - "estimatedProcessingTime": estimated_processing_time, "supportedCurrencies": supported_currencies, "fields": fields, + "estimatedProcessingTime": estimated_processing_time, + "fees": fees, }, request_options=request_options, omit=OMIT, diff --git a/src/mercoa/entity/payment_method/client.py b/src/mercoa/entity/payment_method/client.py index e32ef87..772ca2d 100644 --- a/src/mercoa/entity/payment_method/client.py +++ b/src/mercoa/entity/payment_method/client.py @@ -499,7 +499,7 @@ def get_balance( request_options: typing.Optional[RequestOptions] = None, ) -> PaymentMethodBalanceResponse: """ - Get the available balance of a payment method. Only bank accounts added with Plaid are supported. This endpoint will return a cached value and will refresh the balance when called. + Deprecated. Get the available balance of a payment method. Only bank accounts added with Plaid are supported. This endpoint will return a cached value and will refresh the balance when called. Parameters ---------- @@ -1027,7 +1027,7 @@ async def get_balance( request_options: typing.Optional[RequestOptions] = None, ) -> PaymentMethodBalanceResponse: """ - Get the available balance of a payment method. Only bank accounts added with Plaid are supported. This endpoint will return a cached value and will refresh the balance when called. + Deprecated. Get the available balance of a payment method. Only bank accounts added with Plaid are supported. This endpoint will return a cached value and will refresh the balance when called. Parameters ---------- diff --git a/src/mercoa/invoice/client.py b/src/mercoa/invoice/client.py index 134ab58..857d59b 100644 --- a/src/mercoa/invoice/client.py +++ b/src/mercoa/invoice/client.py @@ -23,6 +23,7 @@ from ..invoice_types.types.approval_slot_assignment import ApprovalSlotAssignment from ..invoice_types.types.approver_action import ApproverAction from ..invoice_types.types.find_invoice_response import FindInvoiceResponse +from ..invoice_types.types.invoice_failure_type import InvoiceFailureType from ..invoice_types.types.invoice_id import InvoiceId from ..invoice_types.types.invoice_line_item_request import InvoiceLineItemRequest from ..invoice_types.types.invoice_metadata_filter import InvoiceMetadataFilter @@ -214,6 +215,7 @@ def create( document: typing.Optional[str] = OMIT, uploaded_image: typing.Optional[str] = OMIT, creator_user_id: typing.Optional[EntityUserId] = OMIT, + failure_type: typing.Optional[InvoiceFailureType] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> InvoiceResponse: """ @@ -234,7 +236,7 @@ def create( Date the invoice was issued. deduction_date : typing.Optional[dt.datetime] - Date when funds will be deducted from payer's account. + Date when funds are scheduled to be deducted from payer's account. settlement_date : typing.Optional[dt.datetime] Date of funds settlement. @@ -284,6 +286,9 @@ def create( creator_user_id : typing.Optional[EntityUserId] ID of entity user who created this invoice. + failure_type : typing.Optional[InvoiceFailureType] + If the invoice failed to be paid, indicate the failure reason. Only applicable for invoices with custom payment methods. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -370,6 +375,7 @@ def create( "document": document, "uploadedImage": uploaded_image, "creatorUserId": creator_user_id, + "failureType": failure_type, }, request_options=request_options, omit=OMIT, @@ -487,6 +493,7 @@ def update( document: typing.Optional[str] = OMIT, uploaded_image: typing.Optional[str] = OMIT, creator_user_id: typing.Optional[EntityUserId] = OMIT, + failure_type: typing.Optional[InvoiceFailureType] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> InvoiceResponse: """ @@ -509,7 +516,7 @@ def update( Date the invoice was issued. deduction_date : typing.Optional[dt.datetime] - Date when funds will be deducted from payer's account. + Date when funds are scheduled to be deducted from payer's account. settlement_date : typing.Optional[dt.datetime] Date of funds settlement. @@ -559,6 +566,9 @@ def update( creator_user_id : typing.Optional[EntityUserId] ID of entity user who created this invoice. + failure_type : typing.Optional[InvoiceFailureType] + If the invoice failed to be paid, indicate the failure reason. Only applicable for invoices with custom payment methods. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -646,6 +656,7 @@ def update( "document": document, "uploadedImage": uploaded_image, "creatorUserId": creator_user_id, + "failureType": failure_type, }, request_options=request_options, omit=OMIT, @@ -899,6 +910,7 @@ async def create( document: typing.Optional[str] = OMIT, uploaded_image: typing.Optional[str] = OMIT, creator_user_id: typing.Optional[EntityUserId] = OMIT, + failure_type: typing.Optional[InvoiceFailureType] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> InvoiceResponse: """ @@ -919,7 +931,7 @@ async def create( Date the invoice was issued. deduction_date : typing.Optional[dt.datetime] - Date when funds will be deducted from payer's account. + Date when funds are scheduled to be deducted from payer's account. settlement_date : typing.Optional[dt.datetime] Date of funds settlement. @@ -969,6 +981,9 @@ async def create( creator_user_id : typing.Optional[EntityUserId] ID of entity user who created this invoice. + failure_type : typing.Optional[InvoiceFailureType] + If the invoice failed to be paid, indicate the failure reason. Only applicable for invoices with custom payment methods. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -1055,6 +1070,7 @@ async def create( "document": document, "uploadedImage": uploaded_image, "creatorUserId": creator_user_id, + "failureType": failure_type, }, request_options=request_options, omit=OMIT, @@ -1172,6 +1188,7 @@ async def update( document: typing.Optional[str] = OMIT, uploaded_image: typing.Optional[str] = OMIT, creator_user_id: typing.Optional[EntityUserId] = OMIT, + failure_type: typing.Optional[InvoiceFailureType] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> InvoiceResponse: """ @@ -1194,7 +1211,7 @@ async def update( Date the invoice was issued. deduction_date : typing.Optional[dt.datetime] - Date when funds will be deducted from payer's account. + Date when funds are scheduled to be deducted from payer's account. settlement_date : typing.Optional[dt.datetime] Date of funds settlement. @@ -1244,6 +1261,9 @@ async def update( creator_user_id : typing.Optional[EntityUserId] ID of entity user who created this invoice. + failure_type : typing.Optional[InvoiceFailureType] + If the invoice failed to be paid, indicate the failure reason. Only applicable for invoices with custom payment methods. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -1331,6 +1351,7 @@ async def update( "document": document, "uploadedImage": uploaded_image, "creatorUserId": creator_user_id, + "failureType": failure_type, }, request_options=request_options, omit=OMIT, diff --git a/src/mercoa/invoice_types/types/invoice_request_base.py b/src/mercoa/invoice_types/types/invoice_request_base.py index 9a754e8..7c0651c 100644 --- a/src/mercoa/invoice_types/types/invoice_request_base.py +++ b/src/mercoa/invoice_types/types/invoice_request_base.py @@ -10,6 +10,7 @@ from ...payment_method_types.types.currency_code import CurrencyCode from ...payment_method_types.types.payment_method_id import PaymentMethodId from .approval_slot_assignment import ApprovalSlotAssignment +from .invoice_failure_type import InvoiceFailureType from .invoice_line_item_request import InvoiceLineItemRequest from .invoice_status import InvoiceStatus from .payment_destination_options import PaymentDestinationOptions @@ -34,7 +35,7 @@ class InvoiceRequestBase(pydantic_v1.BaseModel): deduction_date: typing.Optional[dt.datetime] = pydantic_v1.Field(alias="deductionDate", default=None) """ - Date when funds will be deducted from payer's account. + Date when funds are scheduled to be deducted from payer's account. """ settlement_date: typing.Optional[dt.datetime] = pydantic_v1.Field(alias="settlementDate", default=None) @@ -109,6 +110,11 @@ class InvoiceRequestBase(pydantic_v1.BaseModel): ID of entity user who created this invoice. """ + failure_type: typing.Optional[InvoiceFailureType] = pydantic_v1.Field(alias="failureType", default=None) + """ + If the invoice failed to be paid, indicate the failure reason. Only applicable for invoices with custom payment methods. + """ + def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} return super().json(**kwargs_with_defaults) diff --git a/src/mercoa/invoice_types/types/invoice_response.py b/src/mercoa/invoice_types/types/invoice_response.py index 42f7a78..40952c1 100644 --- a/src/mercoa/invoice_types/types/invoice_response.py +++ b/src/mercoa/invoice_types/types/invoice_response.py @@ -370,7 +370,12 @@ class InvoiceResponse(pydantic_v1.BaseModel): deduction_date: typing.Optional[dt.datetime] = pydantic_v1.Field(alias="deductionDate", default=None) """ - Date when funds will be deducted from payer's account. + Date when funds are scheduled to be deducted from payer's account. The actual deduction date may differ from this date, and will be reflected in the processedAt field. + """ + + processed_at: typing.Optional[dt.datetime] = pydantic_v1.Field(alias="processedAt", default=None) + """ + Date when the invoice payment was processed. """ settlement_date: typing.Optional[dt.datetime] = pydantic_v1.Field(alias="settlementDate", default=None) @@ -443,7 +448,6 @@ class InvoiceResponse(pydantic_v1.BaseModel): If the invoice failed to be paid, this field will be populated with the type of failure. """ - processed_at: typing.Optional[dt.datetime] = pydantic_v1.Field(alias="processedAt", default=None) created_at: dt.datetime = pydantic_v1.Field(alias="createdAt") updated_at: dt.datetime = pydantic_v1.Field(alias="updatedAt") fees: typing.Optional[InvoiceFeesResponse] = pydantic_v1.Field(default=None) diff --git a/src/mercoa/payment_method_types/__init__.py b/src/mercoa/payment_method_types/__init__.py index f42b23a..f1985c5 100644 --- a/src/mercoa/payment_method_types/__init__.py +++ b/src/mercoa/payment_method_types/__init__.py @@ -14,8 +14,10 @@ CheckRequest, CheckResponse, CurrencyCode, + CustomPaymentMethodFeeType, CustomPaymentMethodRequest, CustomPaymentMethodResponse, + CustomPaymentMethodSchemaFee, CustomPaymentMethodSchemaField, CustomPaymentMethodSchemaFieldType, CustomPaymentMethodSchemaId, @@ -63,8 +65,10 @@ "CheckRequest", "CheckResponse", "CurrencyCode", + "CustomPaymentMethodFeeType", "CustomPaymentMethodRequest", "CustomPaymentMethodResponse", + "CustomPaymentMethodSchemaFee", "CustomPaymentMethodSchemaField", "CustomPaymentMethodSchemaFieldType", "CustomPaymentMethodSchemaId", diff --git a/src/mercoa/payment_method_types/types/__init__.py b/src/mercoa/payment_method_types/types/__init__.py index 470c5d4..c7007fc 100644 --- a/src/mercoa/payment_method_types/types/__init__.py +++ b/src/mercoa/payment_method_types/types/__init__.py @@ -13,8 +13,10 @@ from .check_request import CheckRequest from .check_response import CheckResponse from .currency_code import CurrencyCode +from .custom_payment_method_fee_type import CustomPaymentMethodFeeType from .custom_payment_method_request import CustomPaymentMethodRequest from .custom_payment_method_response import CustomPaymentMethodResponse +from .custom_payment_method_schema_fee import CustomPaymentMethodSchemaFee from .custom_payment_method_schema_field import CustomPaymentMethodSchemaField from .custom_payment_method_schema_field_type import CustomPaymentMethodSchemaFieldType from .custom_payment_method_schema_id import CustomPaymentMethodSchemaId @@ -67,8 +69,10 @@ "CheckRequest", "CheckResponse", "CurrencyCode", + "CustomPaymentMethodFeeType", "CustomPaymentMethodRequest", "CustomPaymentMethodResponse", + "CustomPaymentMethodSchemaFee", "CustomPaymentMethodSchemaField", "CustomPaymentMethodSchemaFieldType", "CustomPaymentMethodSchemaId", diff --git a/src/mercoa/payment_method_types/types/custom_payment_method_fee_type.py b/src/mercoa/payment_method_types/types/custom_payment_method_fee_type.py new file mode 100644 index 0000000..a51c5eb --- /dev/null +++ b/src/mercoa/payment_method_types/types/custom_payment_method_fee_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CustomPaymentMethodFeeType = typing.Union[typing.Literal["none", "flat", "percentage"], typing.Any] diff --git a/src/mercoa/payment_method_types/types/custom_payment_method_request.py b/src/mercoa/payment_method_types/types/custom_payment_method_request.py index 9968cbe..e3a9c7e 100644 --- a/src/mercoa/payment_method_types/types/custom_payment_method_request.py +++ b/src/mercoa/payment_method_types/types/custom_payment_method_request.py @@ -36,6 +36,11 @@ class CustomPaymentMethodRequest(PaymentMethodBaseRequest): account_name: typing.Optional[str] = pydantic_v1.Field(alias="accountName", default=None) account_number: typing.Optional[str] = pydantic_v1.Field(alias="accountNumber", default=None) + available_balance: typing.Optional[float] = pydantic_v1.Field(alias="availableBalance", default=None) + """ + The available balance for this payment method. + """ + schema_id: CustomPaymentMethodSchemaId = pydantic_v1.Field(alias="schemaId") """ Payment method schema used for this payment method. Defines the fields that this payment method contains. diff --git a/src/mercoa/payment_method_types/types/custom_payment_method_response.py b/src/mercoa/payment_method_types/types/custom_payment_method_response.py index 8aee4e6..5c7335d 100644 --- a/src/mercoa/payment_method_types/types/custom_payment_method_response.py +++ b/src/mercoa/payment_method_types/types/custom_payment_method_response.py @@ -18,6 +18,11 @@ class CustomPaymentMethodResponse(PaymentMethodBaseResponse): account_name: typing.Optional[str] = pydantic_v1.Field(alias="accountName", default=None) account_number: typing.Optional[str] = pydantic_v1.Field(alias="accountNumber", default=None) + available_balance: typing.Optional[float] = pydantic_v1.Field(alias="availableBalance", default=None) + """ + The available balance for this payment method. + """ + schema_id: CustomPaymentMethodSchemaId = pydantic_v1.Field(alias="schemaId") """ Payment method schema used for this payment method. Defines the fields that this payment method contains. diff --git a/src/mercoa/payment_method_types/types/custom_payment_method_schema_fee.py b/src/mercoa/payment_method_types/types/custom_payment_method_schema_fee.py new file mode 100644 index 0000000..6b2c493 --- /dev/null +++ b/src/mercoa/payment_method_types/types/custom_payment_method_schema_fee.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ...core.datetime_utils import serialize_datetime +from ...core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 +from .custom_payment_method_fee_type import CustomPaymentMethodFeeType + + +class CustomPaymentMethodSchemaFee(pydantic_v1.BaseModel): + type: CustomPaymentMethodFeeType + amount: typing.Optional[float] = pydantic_v1.Field(default=None) + """ + If type is 'flat', this is the flat amount that will be charged as a fee. For example, if the fee is $2.50, set this to 2.50. If type is 'percentage', this is the percentage of the payment amount that will be charged as a fee. For example, if the fee is 2.5%, set this to 2.5. + """ + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} + + return deep_union_pydantic_dicts( + super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) + ) + + class Config: + frozen = True + smart_union = True + extra = pydantic_v1.Extra.allow + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/mercoa/payment_method_types/types/custom_payment_method_schema_field_type.py b/src/mercoa/payment_method_types/types/custom_payment_method_schema_field_type.py index 49edeb9..51e41b0 100644 --- a/src/mercoa/payment_method_types/types/custom_payment_method_schema_field_type.py +++ b/src/mercoa/payment_method_types/types/custom_payment_method_schema_field_type.py @@ -3,5 +3,17 @@ import typing CustomPaymentMethodSchemaFieldType = typing.Union[ - typing.Literal["text", "number", "select", "date", "phone", "email", "url", "address"], typing.Any + typing.Literal[ + "text", + "number", + "select", + "date", + "phone", + "email", + "url", + "address", + "usBankRoutingNumber", + "usBankAccountNumber", + ], + typing.Any, ] diff --git a/src/mercoa/payment_method_types/types/custom_payment_method_schema_request.py b/src/mercoa/payment_method_types/types/custom_payment_method_schema_request.py index d980383..a7e9cf7 100644 --- a/src/mercoa/payment_method_types/types/custom_payment_method_schema_request.py +++ b/src/mercoa/payment_method_types/types/custom_payment_method_schema_request.py @@ -6,6 +6,7 @@ from ...core.datetime_utils import serialize_datetime from ...core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 from .currency_code import CurrencyCode +from .custom_payment_method_schema_fee import CustomPaymentMethodSchemaFee from .custom_payment_method_schema_field import CustomPaymentMethodSchemaField @@ -39,14 +40,14 @@ class CustomPaymentMethodSchemaRequest(pydantic_v1.BaseModel): CustomPaymentMethodSchemaField( name="accountNumber", display_name="Account Number", - type="number", + type="usBankAccountNumber", optional=False, use_as_account_number=True, ), CustomPaymentMethodSchemaField( name="routingNumber", display_name="Routing Number", - type="number", + type="usBankRoutingNumber", optional=False, ), ], @@ -65,11 +66,6 @@ class CustomPaymentMethodSchemaRequest(pydantic_v1.BaseModel): This payment method can be used as a payment destination for an invoice """ - estimated_processing_time: typing.Optional[int] = pydantic_v1.Field(alias="estimatedProcessingTime", default=None) - """ - Estimated time in days for this payment method to process a payments. Set as 0 for same-day payment methods, -1 for unknown processing time. - """ - supported_currencies: typing.Optional[typing.List[CurrencyCode]] = pydantic_v1.Field( alias="supportedCurrencies", default=None ) @@ -78,6 +74,12 @@ class CustomPaymentMethodSchemaRequest(pydantic_v1.BaseModel): """ fields: typing.List[CustomPaymentMethodSchemaField] + estimated_processing_time: typing.Optional[int] = pydantic_v1.Field(alias="estimatedProcessingTime", default=None) + """ + Estimated time in days for this payment method to process a payments. Set as 0 for same-day payment methods, -1 for unknown processing time. + """ + + fees: typing.Optional[CustomPaymentMethodSchemaFee] = None def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} diff --git a/src/mercoa/payment_method_types/types/custom_payment_method_schema_response.py b/src/mercoa/payment_method_types/types/custom_payment_method_schema_response.py index d9373f5..d9599a6 100644 --- a/src/mercoa/payment_method_types/types/custom_payment_method_schema_response.py +++ b/src/mercoa/payment_method_types/types/custom_payment_method_schema_response.py @@ -6,6 +6,7 @@ from ...core.datetime_utils import serialize_datetime from ...core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 from .currency_code import CurrencyCode +from .custom_payment_method_schema_fee import CustomPaymentMethodSchemaFee from .custom_payment_method_schema_field import CustomPaymentMethodSchemaField from .custom_payment_method_schema_id import CustomPaymentMethodSchemaId @@ -43,14 +44,14 @@ class CustomPaymentMethodSchemaResponse(pydantic_v1.BaseModel): CustomPaymentMethodSchemaField( name="accountNumber", display_name="Account Number", - type="number", + type="usBankAccountNumber", optional=False, use_as_account_number=True, ), CustomPaymentMethodSchemaField( name="routingNumber", display_name="Routing Number", - type="number", + type="usBankRoutingNumber", optional=False, ), ], @@ -87,6 +88,7 @@ class CustomPaymentMethodSchemaResponse(pydantic_v1.BaseModel): Estimated time in days for this payment method to process a payments. 0 is an same-day payment methods, -1 is unknown processing time. """ + fees: typing.Optional[CustomPaymentMethodSchemaFee] = None created_at: dt.datetime = pydantic_v1.Field(alias="createdAt") updated_at: dt.datetime = pydantic_v1.Field(alias="updatedAt") diff --git a/src/mercoa/payment_method_types/types/custom_payment_method_update_request.py b/src/mercoa/payment_method_types/types/custom_payment_method_update_request.py index a028188..173f12b 100644 --- a/src/mercoa/payment_method_types/types/custom_payment_method_update_request.py +++ b/src/mercoa/payment_method_types/types/custom_payment_method_update_request.py @@ -17,6 +17,11 @@ class CustomPaymentMethodUpdateRequest(PaymentMethodBaseRequest): account_name: typing.Optional[str] = pydantic_v1.Field(alias="accountName", default=None) account_number: typing.Optional[str] = pydantic_v1.Field(alias="accountNumber", default=None) + available_balance: typing.Optional[float] = pydantic_v1.Field(alias="availableBalance", default=None) + """ + The available balance for this payment method. + """ + schema_id: typing.Optional[CustomPaymentMethodSchemaId] = pydantic_v1.Field(alias="schemaId", default=None) """ Payment method schema used for this payment method. Defines the fields that this payment method contains. diff --git a/src/mercoa/payment_method_types/types/payment_method_request.py b/src/mercoa/payment_method_types/types/payment_method_request.py index b706103..b81e75e 100644 --- a/src/mercoa/payment_method_types/types/payment_method_request.py +++ b/src/mercoa/payment_method_types/types/payment_method_request.py @@ -174,6 +174,7 @@ class PaymentMethodRequest_Custom(pydantic_v1.BaseModel): foreign_id: str = pydantic_v1.Field(alias="foreignId") account_name: typing.Optional[str] = pydantic_v1.Field(alias="accountName", default=None) account_number: typing.Optional[str] = pydantic_v1.Field(alias="accountNumber", default=None) + available_balance: typing.Optional[float] = pydantic_v1.Field(alias="availableBalance", default=None) schema_id: CustomPaymentMethodSchemaId = pydantic_v1.Field(alias="schemaId") data: typing.Dict[str, str] default_source: typing.Optional[bool] = pydantic_v1.Field(alias="defaultSource", default=None) diff --git a/src/mercoa/payment_method_types/types/payment_method_response.py b/src/mercoa/payment_method_types/types/payment_method_response.py index f825aa4..2824408 100644 --- a/src/mercoa/payment_method_types/types/payment_method_response.py +++ b/src/mercoa/payment_method_types/types/payment_method_response.py @@ -248,6 +248,7 @@ class PaymentMethodResponse_Custom(pydantic_v1.BaseModel): foreign_id: str = pydantic_v1.Field(alias="foreignId") account_name: typing.Optional[str] = pydantic_v1.Field(alias="accountName", default=None) account_number: typing.Optional[str] = pydantic_v1.Field(alias="accountNumber", default=None) + available_balance: typing.Optional[float] = pydantic_v1.Field(alias="availableBalance", default=None) schema_id: CustomPaymentMethodSchemaId = pydantic_v1.Field(alias="schemaId") schema_: CustomPaymentMethodSchemaResponse = pydantic_v1.Field(alias="schema") data: typing.Dict[str, str] diff --git a/src/mercoa/payment_method_types/types/payment_method_update_request.py b/src/mercoa/payment_method_types/types/payment_method_update_request.py index 639dadd..2dabe76 100644 --- a/src/mercoa/payment_method_types/types/payment_method_update_request.py +++ b/src/mercoa/payment_method_types/types/payment_method_update_request.py @@ -29,6 +29,7 @@ class PaymentMethodUpdateRequest_Custom(pydantic_v1.BaseModel): foreign_id: typing.Optional[str] = pydantic_v1.Field(alias="foreignId", default=None) account_name: typing.Optional[str] = pydantic_v1.Field(alias="accountName", default=None) account_number: typing.Optional[str] = pydantic_v1.Field(alias="accountNumber", default=None) + available_balance: typing.Optional[float] = pydantic_v1.Field(alias="availableBalance", default=None) schema_id: typing.Optional[CustomPaymentMethodSchemaId] = pydantic_v1.Field(alias="schemaId", default=None) data: typing.Optional[typing.Dict[str, str]] = None default_source: typing.Optional[bool] = pydantic_v1.Field(alias="defaultSource", default=None) diff --git a/src/mercoa/webhooks/types/payment_method_webhook.py b/src/mercoa/webhooks/types/payment_method_webhook.py index 5476e8b..e83ffe5 100644 --- a/src/mercoa/webhooks/types/payment_method_webhook.py +++ b/src/mercoa/webhooks/types/payment_method_webhook.py @@ -6,6 +6,7 @@ from ...core.datetime_utils import serialize_datetime from ...core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 from ...entity_types.types.entity_id import EntityId +from ...entity_types.types.entity_response import EntityResponse from ...payment_method_types.types.payment_method_response import PaymentMethodResponse @@ -15,7 +16,15 @@ class PaymentMethodWebhook(pydantic_v1.BaseModel): -------- import datetime - from mercoa import PaymentMethodResponse_BankAccount, PaymentMethodWebhook + from mercoa import ( + Address, + BusinessProfileResponse, + EntityResponse, + PaymentMethodResponse_BankAccount, + PaymentMethodWebhook, + PhoneNumber, + ProfileResponse, + ) PaymentMethodWebhook( event_type="paymentMethod.created", @@ -38,12 +47,54 @@ class PaymentMethodWebhook(pydantic_v1.BaseModel): "2021-01-01 00:00:00+00:00", ), ), + entity=EntityResponse( + id="ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", + foreign_id="MY-DB-ID-12345", + name="Acme Inc.", + email="customer@acme.com", + accepted_tos=True, + status="verified", + is_customer=True, + is_payor=True, + is_payee=False, + is_network_payor=False, + is_network_payee=False, + account_type="business", + updated_at=datetime.datetime.fromisoformat( + "2024-01-02 00:00:00+00:00", + ), + created_at=datetime.datetime.fromisoformat( + "2024-01-01 00:00:00+00:00", + ), + profile=ProfileResponse( + business=BusinessProfileResponse( + email="customer@acme.com", + legal_business_name="Acme Inc.", + business_type="llc", + phone=PhoneNumber( + country_code="1", + number="4155551234", + ), + address=Address( + address_line_1="123 Main St", + address_line_2="Unit 1", + city="San Francisco", + state_or_province="CA", + postal_code="94105", + country="US", + ), + tax_id_provided=True, + owners_provided=True, + ), + ), + ), ) """ event_type: str = pydantic_v1.Field(alias="eventType") entity_id: EntityId = pydantic_v1.Field(alias="entityId") payment_method: PaymentMethodResponse = pydantic_v1.Field(alias="paymentMethod") + entity: EntityResponse def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}