# 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 .payment_categories import PaymentCategories
from .split_funding import SplitFunding


class PaymentDetail(UniversalBaseModel):
    """
    Details about the payment.
    """

    categories: typing.Optional[typing.List[PaymentCategories]] = pydantic.Field(default=None)
    """
    Array of payment categories/line items describing the amount to be paid.
    **Note**: These categories are for information only and aren't validated against the total amount provided.
    """

    check_image: typing_extensions.Annotated[
        typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]], FieldMetadata(alias="checkImage")
    ] = pydantic.Field(default=None)
    """
    Object containing image of paper check.
    """

    check_number: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="checkNumber")] = (
        pydantic.Field(default=None)
    )
    """
    A check number to be used in the ach transaction. **Required** for payment method = 'check'.
    """

    currency: typing.Optional[str] = pydantic.Field(default=None)
    """
    The currency for the transaction, `USD` or `CAD`. If your paypoint is configured for CAD, you must send the `CAD` value in this field, otherwise it defaults to USD, which will cause the transaction to fail.
    """

    service_fee: typing_extensions.Annotated[typing.Optional[float], FieldMetadata(alias="serviceFee")] = (
        pydantic.Field(default=None)
    )
    """
    Service fee to be deducted from the total amount. This amount must be a number, percentages aren't accepted. If you are using a percentage-based fee schedule, you must calculate the value manually.
    """

    split_funding: typing_extensions.Annotated[typing.Optional[SplitFunding], FieldMetadata(alias="splitFunding")] = (
        pydantic.Field(default=None)
    )
    """
    Split funding instructions for the transaction. See [Split a Transaction](/developers/developer-guides/money-in-split-funding) for more.
    """

    total_amount: typing_extensions.Annotated[float, FieldMetadata(alias="totalAmount")] = pydantic.Field()
    """
    Total amount to be charged. If a service fee is sent, then this amount should include the service fee."
    """

    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
