
    h
                     2    d dl mZ ddlmZ  G d de      Zy)   )Resource   )URLc                   V     e Zd Zd fd	Zi dfdZi fdZi dfdZi fdZi fdZ xZ	S )	WebhookNc                 x    t         t        |   |       t        j                  t        j
                  z   | _        y N)superr   __init__r   V2ACCOUNTbase_url)selfclient	__class__s     X/var/www/html/eduruby.in/venv/lib/python3.12/site-packages/razorpay/resources/webhook.pyr   zWebhook.__init__   s&    gt%f-,    c                     |/dj                  t        j                  t        j                        }n+dj                  | j                  |t        j                        } | j
                  ||fi |S )zm
        Create webhook from given dict

        Returns:
            Webhook Dict which was created
        {}{}{}/{}{})formatr   V1WEBHOOKr   post_urlr   data
account_idkwargsurls        r   createzWebhook.create
   sV     cffckk2#  
CKKH#t}}S$1&11r   c                     |r-dj                  | j                  |t        j                  |      }n/dj                  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   s         r   fetchzWebhook.fetch   sY     ##DMM:s{{JW#  jA#t||C000r   c                     |/dj                  t        j                  t        j                        }n+dj                  | j                  |t        j                        } | j
                  ||fi |S )z
        Fetch all webhooks

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

        Returns:
            webhook dict for given account_id
        r   r   )r   r   r   r   r   r$   r   s        r   allzWebhook.all*   sV     cffckk2#  
CKKH#t||C000r   c                    |r@dj                  | j                  |t        j                  |      } | j                  ||fi |S dj                  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%   s         r   editzWebhook.edit;   ss     ##DMM:s{{JW#T4V4
4   jA#c4262
2r   c                     dj                  | 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%   s         r   deletezWebhook.deleteJ   s:     !!$--S[[*UtsD3F33r   r	   )
__name__
__module____qualname__r   r    r'   r)   r-   r0   __classcell__)r   s   @r   r   r      s>    -  2 24 1$ d 1" 13 3 46 4r   r   N)baser   constants.urlr   r    r   r   <module>r8      s     Q4h Q4r   