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

import typing_extensions
import typing_extensions
from .money import MoneyParams
import typing
from ..types.action_cancel_reason import ActionCancelReason


class TerminalRefundParams(typing_extensions.TypedDict):
    """
    Represents a payment refund processed by the Square Terminal. Only supports Interac (Canadian debit network) payment refunds.
    """

    id: typing_extensions.NotRequired[str]
    """
    A unique ID for this `TerminalRefund`.
    """

    refund_id: typing_extensions.NotRequired[str]
    """
    The reference to the payment refund created by completing this `TerminalRefund`.
    """

    payment_id: str
    """
    The unique ID of the payment being refunded.
    """

    order_id: typing_extensions.NotRequired[str]
    """
    The reference to the Square order ID for the payment identified by the `payment_id`.
    """

    amount_money: MoneyParams
    """
    The amount of money, inclusive of `tax_money`, that the `TerminalRefund` should return.
    This value is limited to the amount taken in the original payment minus any completed or
    pending refunds.
    """

    reason: str
    """
    A description of the reason for the refund.
    """

    device_id: str
    """
    The unique ID of the device intended for this `TerminalRefund`.
    The Id can be retrieved from /v2/devices api.
    """

    deadline_duration: typing_extensions.NotRequired[typing.Optional[str]]
    """
    The RFC 3339 duration, after which the refund is automatically canceled.
    A `TerminalRefund` that is `PENDING` is automatically `CANCELED` and has a cancellation reason
    of `TIMED_OUT`.
    
    Default: 5 minutes from creation.
    
    Maximum: 5 minutes
    """

    status: typing_extensions.NotRequired[str]
    """
    The status of the `TerminalRefund`.
    Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, or `COMPLETED`.
    """

    cancel_reason: typing_extensions.NotRequired[ActionCancelReason]
    """
    Present if the status is `CANCELED`.
    See [ActionCancelReason](#type-actioncancelreason) for possible values
    """

    created_at: typing_extensions.NotRequired[str]
    """
    The time when the `TerminalRefund` was created, as an RFC 3339 timestamp.
    """

    updated_at: typing_extensions.NotRequired[str]
    """
    The time when the `TerminalRefund` was last updated, as an RFC 3339 timestamp.
    """

    app_id: typing_extensions.NotRequired[str]
    """
    The ID of the application that created the refund.
    """

    location_id: typing_extensions.NotRequired[str]
    """
    The location of the device where the `TerminalRefund` was directed.
    """
