
    ynhC                         d Z ddlZddlmZ ddlmZmZ ddlm	Z	 ddl
mZmZmZ ddlmZmZ ddlmZ d	d
lmZ erddlmZ  G d de	      Z G d de	      Zy)zAThis module contains the classes for Telegram Stars transactions.    N)Sequence)TYPE_CHECKINGOptional)TelegramObject)de_json_optionalde_list_optionalparse_sequence_arg)extract_tzinfo_from_defaultsfrom_timestamp)JSONDict   )TransactionPartner)Botc                        e Zd ZdZdZ	 	 	 ddddededej                  de	e
   d	e	e
   d
e	e   de	e   ddf fdZeddede	d   dd f fd       Z xZS )StarTransactiona  Describes a Telegram Star transaction.
    Note that if the buyer initiates a chargeback with the payment provider from whom they
    acquired Stars (e.g., Apple, Google) following this transaction, the refunded Stars will be
    deducted from the bot's balance. This is outside of Telegram's control.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal, if their :attr:`id`, :attr:`source`, and :attr:`receiver` are equal.

    .. versionadded:: 21.4

    Args:
        id (:obj:`str`): Unique identifier of the transaction. Coincides with the identifer
            of the original transaction for refund transactions.
            Coincides with :attr:`SuccessfulPayment.telegram_payment_charge_id` for
            successful incoming payments from users.
        amount (:obj:`int`): Integer amount of Telegram Stars transferred by the transaction.
        nanostar_amount (:obj:`int`, optional): The number of
            :tg-const:`~telegram.constants.Nanostar.VALUE` shares of Telegram
            Stars transferred by the transaction; from 0 to
            :tg-const:`~telegram.constants.NanostarLimit.MAX_AMOUNT`

            .. versionadded:: 21.9
        date (:obj:`datetime.datetime`): Date the transaction was created as a datetime object.
        source (:class:`telegram.TransactionPartner`, optional): Source of an incoming transaction
            (e.g., a user purchasing goods or services, Fragment refunding a failed withdrawal).
            Only for incoming transactions.
        receiver (:class:`telegram.TransactionPartner`, optional): Receiver of an outgoing
            transaction (e.g., a user for a purchase refund, Fragment for a withdrawal). Only for
            outgoing transactions.

    Attributes:
        id (:obj:`str`): Unique identifier of the transaction. Coincides with the identifer
            of the original transaction for refund transactions.
            Coincides with :attr:`SuccessfulPayment.telegram_payment_charge_id` for
            successful incoming payments from users.
        amount (:obj:`int`): Integer amount of Telegram Stars transferred by the transaction.
        nanostar_amount (:obj:`int`): Optional. The number of
            :tg-const:`~telegram.constants.Nanostar.VALUE` shares of Telegram
            Stars transferred by the transaction; from 0 to
            :tg-const:`~telegram.constants.NanostarLimit.MAX_AMOUNT`

            .. versionadded:: 21.9
        date (:obj:`datetime.datetime`): Date the transaction was created as a datetime object.
        source (:class:`telegram.TransactionPartner`): Optional. Source of an incoming transaction
            (e.g., a user purchasing goods or services, Fragment refunding a failed withdrawal).
            Only for incoming transactions.
        receiver (:class:`telegram.TransactionPartner`): Optional. Receiver of an outgoing
            transaction (e.g., a user for a purchase refund, Fragment for a withdrawal). Only for
            outgoing transactions.
    )amountdateidnanostar_amountreceiversourceN
api_kwargsr   r   r   r   r   r   r   returnc                    t         |   |       || _        || _        || _        || _        || _        || _        | j                  | j
                  | j                  f| _        | j                          y Nr   )
super__init__r   r   r   r   r   r   	_id_attrs_freeze)	selfr   r   r   r   r   r   r   	__class__s	           i/var/www/html/profi_bot/bot/venv/lib/python3.12/site-packages/telegram/_payment/stars/startransactions.pyr   zStarTransaction.__init__[   sk     	J/!"&	4:6>.= GGKKMM

 	    databotr   c                 *   | j                  |      }t        |      }t        |j                  dd      |      |d<   t	        |j                  d      t
        |      |d<   t	        |j                  d      t
        |      |d<   t        |   ||      S ),See :meth:`telegram.TelegramObject.de_json`.r   N)tzinfor   r   r%   r&   )_parse_datar
   r   getr   r   r   de_json)clsr%   r&   
loc_tzinfor"   s       r#   r-   zStarTransaction.de_jsonu   s     t$ 2#6
%dhhvt&<ZPV)$((8*<>PRUVX+DHHZ,@BTVYZZwDc22r$   )NNNN)__name__
__module____qualname____doc__	__slots__strintdtmdatetimer   r   r   r   classmethodr-   __classcell__r"   s   @r#   r   r   %   s    1f RI 0415)- *.  ll	
 +, -. "# X& 
4 38 3(5/ 3EV 3 3r$   r   c                   l     e Zd ZdZdZdddee   dee   f fdZ	e
dded	ed
   dd f fd       Z xZS )StarTransactionsa  
    Contains a list of Telegram Star transactions.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal, if their :attr:`transactions` are equal.

    .. versionadded:: 21.4

    Args:
        transactions (Sequence[:class:`telegram.StarTransaction`]): The list of transactions.

    Attributes:
        transactions (tuple[:class:`telegram.StarTransaction`]): The list of transactions.
    )transactionsNr   r?   r   c                    t         |   |       t        |      | _        | j                  f| _        | j                          y r   )r   r   r	   r?   r   r    )r!   r?   r   r"   s      r#   r   zStarTransactions.__init__   s;     	J/9KL9Y++-r$   r%   r&   r   r   c                     | j                  |      }t        |j                  d      t        |      |d<   t        |   ||      S )r(   r?   r*   )r+   r   r,   r   r   r-   )r.   r%   r&   r"   s      r#   r-   zStarTransactions.de_json   sC     t$/0H/[^_^wDc22r$   r0   )r1   r2   r3   r4   r5   r   r   r   r   r   r:   r-   r;   r<   s   @r#   r>   r>      sc     "I \`$_5FNxFX 38 3(5/ 3EW 3 3r$   r>   )r4   r9   r8   collections.abcr   typingr   r   telegram._telegramobjectr   telegram._utils.argumentparsingr   r   r	   telegram._utils.datetimer
   r   telegram._utils.typesr   transactionpartnerr   telegramr   r   r>    r$   r#   <module>rK      sG   ( H  $ * 3 b b Q * 2\3n \3~!3~ !3r$   