# This file was auto-generated by Fern from our API Definition.

import typing

import pydantic
import typing_extensions
from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ...core.serialization import FieldMetadata
from ...types.ach_holder import AchHolder
from ...types.ach_sec_code import AchSecCode
from ...types.achaccount import Achaccount
from ...types.achaccounttype import Achaccounttype
from ...types.achrouting import Achrouting


class RequestCreditPaymentMethod(UniversalBaseModel):
    """
    Object describing the ACH payment method to use for transaction.
    """

    ach_account: typing_extensions.Annotated[typing.Optional[Achaccount], FieldMetadata(alias="achAccount")] = None
    ach_account_type: typing_extensions.Annotated[
        typing.Optional[Achaccounttype], FieldMetadata(alias="achAccountType")
    ] = None
    ach_code: typing_extensions.Annotated[typing.Optional[AchSecCode], FieldMetadata(alias="achCode")] = None
    ach_holder: typing_extensions.Annotated[typing.Optional[AchHolder], FieldMetadata(alias="achHolder")] = (
        pydantic.Field(default=None)
    )
    """
    Bank account holder.
    """

    ach_routing: typing_extensions.Annotated[typing.Optional[Achrouting], FieldMetadata(alias="achRouting")] = None
    method: typing.Literal["ach"] = pydantic.Field(default="ach")
    """
    Method to use for the transaction. Must be ACH.
    """

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
