o
    -˜Žj«  ã                   @   sL   d dl Z d dlmZmZ d dlZd dlmZmZ e  e¡Z	G dd„ dƒZ
dS )é    N)ÚListÚUnion)ÚrawÚtypesc                +   @   sœ   e Zd Z														ddddededeeef deded	ed	 f d
ededededededededededededededef*dd„Z	dS )ÚCreateInvoiceLinkNÚselfzpyrogram.ClientÚtitleÚdescriptionÚpayloadÚcurrencyÚpricesztypes.LabeledPriceÚprovider_tokenÚstart_parameterÚprovider_dataÚ	photo_urlÚ
photo_sizeÚphoto_widthÚphoto_heightÚ	need_nameÚneed_phone_numberÚ
need_emailÚneed_shipping_addressÚsend_phone_number_to_providerÚsend_email_to_providerÚis_flexibleÚreturnc                 Ã   sÎ   �t |tjƒ }tjjjtjj|||	r$tjj|	d|
tjj	||d�gd�ndtjj
||r2dd„ |D ƒn| ¡ g| j|||||||d�
t |tƒrJ| ¡ n||tjj|rS|ndd	�|d
�d�}|  |¡I dH }|jS )a*  Use this method to create a link for an invoice.

        .. include:: /_includes/usable-by/bots.rst

        Parameters:
            title (``str``):
                Product name, 1-32 characters.

            description (``str``):
                Product description, 1-255 characters

            payload (``str`` | ``bytes``):
                Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.

            currency (``str``):
                Three-letter ISO 4217 currency code, see `more on currencies <https://core.telegram.org/bots/payments#supported-currencies>`_. Pass ``XTR`` for payments in `Telegram Stars <https://t.me/BotNews/90>`_.

            prices (:obj:`~pyrogram.types.LabeledPrice` | List of :obj:`~pyrogram.types.LabeledPrice`):
                Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in `Telegram Stars <https://t.me/BotNews/90>`_.
                If you add multiple prices, the prices will be added up.
                For stars invoice you can only have one item.

            provider_token (``str``, *optional*):
                Payment provider token, obtained via `@BotFather <https://t.me/botfather>`_. Pass an empty string for payments in `Telegram Stars <https://t.me/BotNews/90>`_.

            start_parameter (``str``, *optional*):
                Unique deep-linking parameter. If left empty, **forwarded copies** of the sent message will have a Pay button, allowing multiple users to pay directly from the forwarded message, using the same invoice. If non-empty, forwarded copies of the sent message will have a URL button with a deep link to the bot (instead of a Pay button), with the value used as the start parameter.

            provider_data (``str``, *optional*):
                JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider.

            photo_url (``str``, *optional*):
                URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for.

            photo_size (``int``, *optional*):
                Photo size in bytes

            photo_width (``int``, *optional*):
                Photo width

            photo_height (``int``, *optional*):
                Photo height

            need_name (``bool``, *optional*):
                Pass True if you require the user's full name to complete the order. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_.

            need_phone_number (``bool``, *optional*):
                Pass True if you require the user's phone number to complete the order. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_.

            need_email (``bool``, *optional*):
                Pass True if you require the user's email address to complete the order. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_.

            need_shipping_address (``bool``, *optional*):
                Pass True if you require the user's shipping address to complete the order. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_.

            send_phone_number_to_provider (``bool``, *optional*):
                Pass True if the user's phone number should be sent to the provider. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_.

            send_email_to_provider (``bool``, *optional*):
                Pass True if the user's email address should be sent to the provider. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_.

            is_flexible (``bool``, *optional*):
                Pass True if the final price depends on the shipping method. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_.

        Returns:
            ``str``: On success, the created invoice link is returned.

        z	image/jpg)ÚwÚh)ÚurlÚ	mime_typeÚsizeÚ
attributesNc                 S   s   g | ]}|  ¡ ‘qS © )Úwrite)Ú.0Úir"   r"   új/var/www/kodo/Anonymous/send/lib/python3.10/site-packages/pyrogram/methods/payments/create_invoice_link.pyÚ
<listcomp>‹   s    z9CreateInvoiceLink.create_invoice_link.<locals>.<listcomp>)
r   r   ÚtestÚname_requestedÚphone_requestedÚemail_requestedÚshipping_address_requestedÚflexibleÚphone_to_providerÚemail_to_providerz{})Údata)r   r	   ÚphotoÚinvoicer
   Úproviderr   Ústart_param)Úinvoice_media)Ú
isinstancer   ÚLabeledPricer   Ú	functionsÚpaymentsÚExportInvoiceÚInputMediaInvoiceÚInputWebDocumentÚDocumentAttributeImageSizeÚInvoicer#   Ú	test_modeÚstrÚencodeÚDataJSONÚinvoker   )r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   Úis_iterableÚrpcÚrr"   r"   r&   Úcreate_invoice_link   sP   €[öþÿü
ö
ÿáÿ#z%CreateInvoiceLink.create_invoice_link)NNNNNNNNNNNNNN)
Ú__name__Ú
__module__Ú__qualname__r@   r   Úbytesr   ÚintÚboolrG   r"   r"   r"   r&   r      st    ìÿþý
üûúùø	÷
öõôóòñðïîíìër   )ÚloggingÚtypingr   r   Úpyrogramr   r   Ú	getLoggerrH   Úlogr   r"   r"   r"   r&   Ú<module>   s   
