
    h	                     2    d dl mZ ddlmZ  G d de      Zy)   )Resource   )URLc                        e Zd Zd fd	Zi f fd	Zi f fd	Zi fdZi fdZi fdZi fdZ	i fdZ
d	 Zi fd
Zi fdZi fdZ xZS )Subscriptionc                 x    t         t        |   |       t        j                  t        j
                  z   | _        y N)superr   __init__r   V1SUBSCRIPTION_URLbase_url)selfclient	__class__s     ]/var/www/html/eduruby.in/venv/lib/python3.12/site-packages/razorpay/resources/subscription.pyr   zSubscription.__init__   s(    lD*62!5!55    c                 ,    t        t        | 
  |fi |S )zo
        Fetch all Subscription entities

        Returns:
            Dictionary of Subscription data
        )r
   r   all)r   datakwargsr   s      r   r   zSubscription.all
   s     \4,T<V<<r   c                 .    t        t        | 
  ||fi |S )
        Fetch Subscription for given Id

        Args:
            subscription_id : Id for which subscription object is retrieved

        Returns:
            Subscription dict for given subscription Id
        )r
   r   fetch)r   subscription_idr   r   r   s       r   r   zSubscription.fetch   s     \4.OOOr   c                 B    | j                   } | j                  ||fi |S )z
        Create Subscription from given dict

        Args:
            data : Dictionary using which Subscription has to be created

        Returns:
            Subscription Dict which was created
        )r   post_url)r   r   r   urls       r   createzSubscription.create   s%     mmt}}S$1&11r   c                 b    dj                  | j                  |      } | j                  ||fi |S )z
        Cancel subscription given by subscription_id

        Args:
            subscription_id : Id for which subscription has to be cancelled

        Returns:
            Subscription Dict for given subscription id
        z{}/{}/cancelformatr   r   r   r   r   r   r   s        r   cancelzSubscription.cancel,   2     ##DMM?Ct}}S$1&11r   c                 b    dj                  | j                  |      } | j                  ||fi |S )z
        Cancel a update

        Args:
            subscription_id : Id for which subscription has to be cancelled

        Returns:
            Subscription Dict for given subscription id
        z{}/{}/cancel_scheduled_changesr!   r#   s        r   cancel_scheduled_changesz%Subscription.cancel_scheduled_changes9   s2     /55dmm_Ut}}S$1&11r   c                 b    dj                  | j                  |      } | j                  ||fi |S )z
        Create addon for given subscription

        Args:
            subscription_id : Id for which addon has to be created

        Return:
            Subscription dict for given subscription id
        z{}/{}/addonsr!   r#   s        r   createAddonzSubscription.createAddonF   r%   r   c                 b    dj                  | j                  |      } | j                  ||fi |S )z
         Update particular subscription

        Args:
            subscription_id : Id for which subscription has to be edited         
        Returns:
            Subscription dict for given subscription id
        z{}/{})r"   r   	patch_urlr#   s        r   editzSubscription.editS   s0     nnT]]O<t~~c42622r   c                 b    dj                  | j                  |      } | j                  |i fi |S )r   z {}/{}/retrieve_scheduled_changes)r"   r   get_url)r   r   r   r   s       r   pending_updatezSubscription.pending_update_   s2     177Wt||C.v..r   c                 b    dj                  | j                  |      } | j                  ||fi |S )z
        Cancel subscription given by subscription_id

        Args:
            subscription_id : Id for which subscription has to be paused

        Returns:
            Subscription Dict for given subscription id
        z{}/{}/pauser!   r#   s        r   pausezSubscription.pausel   s2     ""4==/Bt}}S$1&11r   c                 b    dj                  | j                  |      } | j                  ||fi |S )z
        Cancel subscription given by subscription_id

        Args:
            subscription_id : Id for which subscription has to be resume

        Returns:
            Subscription Dict for given subscription id
        z{}/{}/resumer!   r#   s        r   resumezSubscription.resumey   r%   r   c                 d    dj                  | j                  ||      } | j                  ||fi |S )a'  
        Delete offer linked to a subscription

        Args:
            subscription_id : The id of the subscription to offer need to be deleted
            offer_id : The id of the offer linked to subscription

        Returns:
            Subscription Dict for given subscription id
        z{}/{}/{})r"   r   
delete_url)r   r   offer_idr   r   r   s         r   delete_offerzSubscription.delete_offer   s4     ItsD3F33r   r	   )__name__
__module____qualname__r   r   r   r   r$   r'   r)   r,   r/   r1   r3   r7   __classcell__)r   s   @r   r   r      ss    6  = +- 
P  2 ,. 2 >@ 2 13 2 *, 
3/ +- 2 ,. 2 <> 4r   r   N)baser   constants.urlr   r    r   r   <module>r?      s     M48 M4r   