
    h                     :    d dl mZ ddlmZ ddlZ G d de      Zy)   )Resource   )URL    Nc                   r     e Zd Zd fd	Zi fdZi f fd	Zi f fd	Zi fdZd Zd Z	d Z
d	 Zi fd
Z xZS )Invoicec                 x    t         t        |   |       t        j                  t        j
                  z   | _        y N)superr   __init__r   V1INVOICE_URLbase_url)selfclient	__class__s     X/var/www/html/eduruby.in/venv/lib/python3.12/site-packages/razorpay/resources/invoice.pyr   zInvoice.__init__   s&    gt%f-0    c                 \    t        j                  dt                | j                  |fi |S )Nz"Will be Deprecated in next release)warningswarnDeprecationWarningall)r   datakwargss      r   	fetch_allzInvoice.fetch_all   s(    :<NOtxx'''r   c                 ,    t        t        | 
  |fi |S )ze
        Fetch all Invoice entities

        Returns:
            Dictionary of Invoice data
        )r   r   r   )r   r   r   r   s      r   r   zInvoice.all   s     Wd'777r   c                 .    t        t        | 
  ||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   s       r   r   zInvoice.fetch   s     Wd)*dEfEEr   c                 B    | 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   urls       r   createzInvoice.create$   s%     mmt}}S$1&11r   c                 d    dj                  | 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#   s        r   	notify_byzInvoice.notify_by1   s4     #))$--VLt}}S"///r   c                 b    dj                  | 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#   s       r   cancelzInvoice.cancel?   s2     ##DMM:>t}}S"///r   c                 b    dj                  | j                  |      } | j                  |i fi |S )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+   s       r   deletezInvoice.deleteL   s0     nnT]]J7tsB1&11r   c                 b    dj                  | j                  |      } | j                  |i fi |S )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+   s       r   issuezInvoice.issueY   s2     ""4==*=t}}S"///r   c                 b    dj                  | 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#   s        r   editzInvoice.edite   s0     nnT]]J7t~~c42622r   r
   )__name__
__module____qualname__r   r   r   r   r$   r)   r,   r0   r2   r5   __classcell__)r   s   @r   r   r      sO    1   (  8 &( 
F  2002
0 %' 3r   r   )baser   constants.urlr   r   r    r   r   <module>r=      s      l3h l3r   