o
    
¼>h¦  ã                   @   s4   d dl mZ ddlmZ ddlZG dd„ deƒZdS )é   )ÚResourceé   )ÚURLé    Nc                       s‚   e Zd Zd‡ fdd„	Zi fdd„Zi f‡ fdd„	Zi f‡ fdd	„	Zi fd
d„Zdd„ Zdd„ Z	dd„ Z
dd„ Zi fdd„Z‡  ZS )ÚInvoiceNc                    s"   t t| ƒ |¡ tjtj | _d S ©N)Úsuperr   Ú__init__r   ÚV1ÚINVOICE_URLÚbase_url)ÚselfÚclient©Ú	__class__© úz/var/www/vedio/testing/chatpythonscript.ninositsolution.com/env/lib/python3.10/site-packages/razorpay/resources/invoice.pyr	      s   zInvoice.__init__c                 K   s   t  dt¡ | j|fi |¤ŽS )Nz"Will be Deprecated in next release)ÚwarningsÚwarnÚDeprecationWarningÚall©r   ÚdataÚkwargsr   r   r   Ú	fetch_all   s   zInvoice.fetch_allc                    s   t t| ƒj|fi |¤ŽS )ze
        Fetch all Invoice entities

        Returns:
            Dictionary of Invoice data
        )r   r   r   r   r   r   r   r      s   zInvoice.allc                    s   t t| ƒj||fi |¤ŽS )zÄ
        Fetch Invoice for given Id

        Args:
            invoice_id : Id for which invoice object has to be retrieved

        Returns:
            Invoice dict for given invoice Id
        )r   r   Úfetch)r   Ú
invoice_idr   r   r   r   r   r      s   
zInvoice.fetchc                 K   s   | j }| j||fi |¤ŽS )zÍ
        Create Invoice from given dict

        Args:
            data : Dictionary having keys using which invoice have to be created

        Returns:
            Invoice Dict which was created
        )r   Úpost_url)r   r   r   Úurlr   r   r   Úcreate$   s   
zInvoice.createc                 K   s$   d  | j||¡}| j|i fi |¤ŽS )zü
        Send/Resend notifications to customer via email/sms

        Args:
            invoice_id : Id for trigger notify
            medium : Medium for triggering notification via email or sms

        Returns:
            {"success": true}
        z{}/{}/notify_by/{}©Úformatr   r   )r   r   Úmediumr   r   r   r   r   Ú	notify_by1   s   zInvoice.notify_byc                 K   ó"   d  | j|¡}| j|i fi |¤ŽS )aq  
        Cancel an unpaid Invoice with given ID via API
        It can only be called on an invoice that is not in the paid state.

        Args:
            invoice_id : Id for cancel the invoice
        Returns:
            The response for the API will be the invoice entity, similar to create/update API response, with status attribute's value as cancelled
        z{}/{}/cancelr    ©r   r   r   r   r   r   r   Úcancel?   ó   
zInvoice.cancelc                 K   r$   )zù
        Delete an invoice
        You can delete an invoice which is in the draft state.

        Args:
            invoice_id : Id for delete the invoice
        Returns:
            The response is always be an empty array like this - []
        ú{}/{})r!   r   Ú
delete_urlr%   r   r   r   ÚdeleteL   r'   zInvoice.deletec                 K   r$   )zü
        Issues an invoice in draft state

        Args:
            invoice_id : Id for delete the invoice
        Returns:
            Its response is the invoice entity, similar to create/update API response. Its status now would be issued.
        z{}/{}/issuer    r%   r   r   r   ÚissueY   s   	zInvoice.issuec                 K   s"   d  | j|¡}| j||fi |¤ŽS )aÀ  
        Update an invoice
        In draft state all the attributes are allowed.

        Args:
            invoice_id : Id for delete the invoice
            data : Dictionary having keys using which invoice have to be updated
        Returns:
            Its response is the invoice entity, similar to create/update API response. Its status now would be issued.
            Refer https://razorpay.com/docs/invoices/api/#entity-structure
        r(   )r!   r   Ú	patch_url)r   r   r   r   r   r   r   r   Úedite   s   zInvoice.editr   )Ú__name__Ú
__module__Ú__qualname__r	   r   r   r   r   r#   r&   r*   r+   r-   Ú__classcell__r   r   r   r   r      s    	r   )Úbaser   Úconstants.urlr   r   r   r   r   r   r   Ú<module>   s    