o
    
¼>hŸ
  ã                   @   s,   d dl mZ ddlmZ G dd„ deƒZdS )é   )ÚResourceé   )ÚURLc                       s^   e Zd Zd‡ fdd„	Zi dfdd„Zi fdd„Zi dfdd	„Zi fd
d„Zi fdd„Z‡  Z	S )ÚWebhookNc                    s"   t t| ƒ |¡ tjtj | _d S ©N)Úsuperr   Ú__init__r   ÚV2ÚACCOUNTÚbase_url)ÚselfÚclient©Ú	__class__© úz/var/www/vedio/testing/chatpythonscript.ninositsolution.com/env/lib/python3.10/site-packages/razorpay/resources/webhook.pyr      s   zWebhook.__init__c                 K   ó@   |du rd  tjtj¡}n	d  | j|tj¡}| j||fi |¤ŽS )zm
        Create webhook from given dict

        Returns:
            Webhook Dict which was created
        Nú{}{}ú{}/{}{})Úformatr   ÚV1ÚWEBHOOKr   Úpost_url©r   ÚdataÚ
account_idÚkwargsÚurlr   r   r   Úcreate
   s   zWebhook.createc                 K   s@   |rd  | j|tj|¡}n	d  tjtj|¡}| j||fi |¤ŽS )a  
        Fetch webhook for given webhook id

        Args:
            account_id : Id for which webhook object has to be retrieved
            webhook_id : Id for which account object has to be retrieved

        Returns:
            webhook dict for given webhook_id
        ú
{}/{}{}/{}ú{}{}/{})r   r   r   r   r   Úget_url©r   Ú
webhook_idr   r   r   r   r   r   r   Úfetch   s   zWebhook.fetchc                 K   r   )z¼
        Fetch all webhooks

        Args:
            account_id : Id for which webhook object has to be retrieved

        Returns:
            webhook dict for given account_id
        Nr   r   )r   r   r   r   r   r!   r   r   r   r   Úall*   s   
zWebhook.allc                 K   sR   |rd  | j|tj|¡}| j||fi |¤ŽS d  tjtj|¡}| j||fi |¤ŽS )zj
        Edit webhook from given dict

        Returns:
            Webhook Dict which was edited
        r   r    )r   r   r   r   Ú	patch_urlr   Úput_urlr"   r   r   r   Úedit;   s
   zWebhook.editc                 K   s(   d  | j|tj|¡}| j||fi |¤ŽS )a,  
        delete webhook for given webhook id

        Args:
            account_id : Id for which webhook object has to be retrieved
            webhook_id : Id for which account object has to be retrieved

        Returns:
            The response is always be an empty array like this - []
        r   )r   r   r   r   Ú
delete_urlr"   r   r   r   ÚdeleteJ   s   zWebhook.deleter   )
Ú__name__Ú
__module__Ú__qualname__r   r   r$   r%   r(   r*   Ú__classcell__r   r   r   r   r      s    r   N)Úbaser   Úconstants.urlr   r   r   r   r   r   Ú<module>   s    