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

from ..core.unchecked_base_model import UncheckedBaseModel
from .money import Money
import pydantic
import typing
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class CashPaymentDetails(UncheckedBaseModel):
    """
    Stores details about a cash payment. Contains only non-confidential information. For more information, see
    [Take Cash Payments](https://developer.squareup.com/docs/payments-api/take-payments/cash-payments).
    """

    buyer_supplied_money: Money = pydantic.Field()
    """
    The amount and currency of the money supplied by the buyer.
    """

    change_back_money: typing.Optional[Money] = pydantic.Field(default=None)
    """
    The amount of change due back to the buyer. 
    This read-only field is calculated
    from the `amount_money` and `buyer_supplied_money` fields.
    """

    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
