# 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.accountid import Accountid
from ...types.bill_data import BillData
from ...types.entrypointfield import Entrypointfield
from ...types.ip_address import IpAddress
from ...types.order_id import OrderId
from ...types.orderdescription import Orderdescription
from ...types.payment_detail import PaymentDetail
from ...types.payment_method import PaymentMethod
from ...types.payor_data_request import PayorDataRequest
from ...types.source import Source
from ...types.subdomain import Subdomain
from ...types.subscriptionid import Subscriptionid


class TransRequestBody(UniversalBaseModel):
    """
    Examples
    --------
    from payabli import PaymentDetail, PayMethodCredit, PayorDataRequest
    from payabli.money_in import TransRequestBody

    TransRequestBody(
        customer_data=PayorDataRequest(
            customer_id=4440,
        ),
        entry_point="f743aed24a",
        ipaddress="255.255.255.255",
        payment_details=PaymentDetail(
            service_fee=0.0,
            total_amount=100.0,
        ),
        payment_method=PayMethodCredit(
            cardcvv="999",
            cardexp="02/27",
            card_holder="John Cassian",
            cardnumber="4111111111111111",
            cardzip="12345",
            initiator="payor",
        ),
    )
    """

    account_id: typing_extensions.Annotated[typing.Optional[Accountid], FieldMetadata(alias="accountId")] = None
    customer_data: typing_extensions.Annotated[
        typing.Optional[PayorDataRequest], FieldMetadata(alias="customerData")
    ] = pydantic.Field(default=None)
    """
    Object describing the Customer/Payor. Which fields are required depends on the paypoint's custom identifier settings. 
    """

    entry_point: typing_extensions.Annotated[typing.Optional[Entrypointfield], FieldMetadata(alias="entryPoint")] = None
    invoice_data: typing_extensions.Annotated[typing.Optional[BillData], FieldMetadata(alias="invoiceData")] = (
        pydantic.Field(default=None)
    )
    """
    Object describing an Invoice linked to the transaction.
    """

    ipaddress: typing.Optional[IpAddress] = None
    order_description: typing_extensions.Annotated[
        typing.Optional[Orderdescription], FieldMetadata(alias="orderDescription")
    ] = None
    order_id: typing_extensions.Annotated[typing.Optional[OrderId], FieldMetadata(alias="orderId")] = None
    payment_details: typing_extensions.Annotated[PaymentDetail, FieldMetadata(alias="paymentDetails")] = (
        pydantic.Field()
    )
    """
    Object describing details of the payment. Required.
    """

    payment_method: typing_extensions.Annotated[PaymentMethod, FieldMetadata(alias="paymentMethod")] = pydantic.Field()
    """
    Information about the payment method for the transaction. Required and recommended fields for each payment method type are described in each schema below.
    """

    source: typing.Optional[Source] = None
    subdomain: typing.Optional[Subdomain] = None
    subscription_id: typing_extensions.Annotated[
        typing.Optional[Subscriptionid], FieldMetadata(alias="subscriptionId")
    ] = None

    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
