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

import typing_extensions
import typing_extensions
import typing
from .money import MoneyParams
from ..types.tender_type import TenderType
from .tender_card_details import TenderCardDetailsParams
from .tender_cash_details import TenderCashDetailsParams
from .tender_bank_account_details import TenderBankAccountDetailsParams
from .tender_buy_now_pay_later_details import TenderBuyNowPayLaterDetailsParams
from .tender_square_account_details import TenderSquareAccountDetailsParams
from .additional_recipient import AdditionalRecipientParams


class TenderParams(typing_extensions.TypedDict):
    """
    Represents a tender (i.e., a method of payment) used in a Square transaction.
    """

    id: typing_extensions.NotRequired[str]
    """
    The tender's unique ID. It is the associated payment ID.
    """

    location_id: typing_extensions.NotRequired[typing.Optional[str]]
    """
    The ID of the transaction's associated location.
    """

    transaction_id: typing_extensions.NotRequired[typing.Optional[str]]
    """
    The ID of the tender's associated transaction.
    """

    created_at: typing_extensions.NotRequired[str]
    """
    The timestamp for when the tender was created, in RFC 3339 format.
    """

    note: typing_extensions.NotRequired[typing.Optional[str]]
    """
    An optional note associated with the tender at the time of payment.
    """

    amount_money: typing_extensions.NotRequired[MoneyParams]
    """
    The total amount of the tender, including `tip_money`. If the tender has a `payment_id`,
    the `total_money` of the corresponding [Payment](entity:Payment) will be equal to the
    `amount_money` of the tender.
    """

    tip_money: typing_extensions.NotRequired[MoneyParams]
    """
    The tip's amount of the tender.
    """

    processing_fee_money: typing_extensions.NotRequired[MoneyParams]
    """
    The amount of any Square processing fees applied to the tender.
    
    This field is not immediately populated when a new transaction is created.
    It is usually available after about ten seconds.
    """

    customer_id: typing_extensions.NotRequired[typing.Optional[str]]
    """
    If the tender is associated with a customer or represents a customer's card on file,
    this is the ID of the associated customer.
    """

    type: TenderType
    """
    The type of tender, such as `CARD` or `CASH`.
    See [TenderType](#type-tendertype) for possible values
    """

    card_details: typing_extensions.NotRequired[TenderCardDetailsParams]
    """
    The details of the card tender.
    
    This value is present only if the value of `type` is `CARD`.
    """

    cash_details: typing_extensions.NotRequired[TenderCashDetailsParams]
    """
    The details of the cash tender.
    
    This value is present only if the value of `type` is `CASH`.
    """

    bank_account_details: typing_extensions.NotRequired[TenderBankAccountDetailsParams]
    """
    The details of the bank account tender.
    
    This value is present only if the value of `type` is `BANK_ACCOUNT`.
    """

    buy_now_pay_later_details: typing_extensions.NotRequired[TenderBuyNowPayLaterDetailsParams]
    """
    The details of a Buy Now Pay Later tender.
    
    This value is present only if the value of `type` is `BUY_NOW_PAY_LATER`.
    """

    square_account_details: typing_extensions.NotRequired[TenderSquareAccountDetailsParams]
    """
    The details of a Square Account tender.
    
    This value is present only if the value of `type` is `SQUARE_ACCOUNT`.
    """

    additional_recipients: typing_extensions.NotRequired[typing.Optional[typing.Sequence[AdditionalRecipientParams]]]
    """
    Additional recipients (other than the merchant) receiving a portion of this tender.
    For example, fees assessed on the purchase by a third party integration.
    """

    payment_id: typing_extensions.NotRequired[typing.Optional[str]]
    """
    The ID of the [Payment](entity:Payment) that corresponds to this tender.
    This value is only present for payments created with the v2 Payments API.
    """
