o
    tBh                     @   s@   d dl Z ddlmZ ddlmZ ddlmZ G dd deZdS )	    N   )ShopifyResource   )DiscountCode)DiscountCodeCreationc                   @   s6   e Zd Ze fddZdd Zg fddZdd Zd	S )
	PriceRulec                 C   s"   |  d| }ttj|jS )Ndiscount_codes)postencoder   r   formatdecodebody)selfdiscount_coderesource r   s/var/www/html/riverr-enterprise-integrations-main/venv/lib/python3.10/site-packages/shopify/resources/price_rule.pyadd_discount_code   s   zPriceRule.add_discount_codec                 C   s   t j| jdS )N)price_rule_id)r   findid)r   r   r   r   r      s   zPriceRule.discount_codesc                 C   s0   t d|i}| d| }ttj|jS )Nr   batch)	jsondumpsr	   r
   r   r   r   r   r   )r   codes
codes_jsonresponser   r   r   create_batch   s   zPriceRule.create_batchc                 C   s   t dtj| j|tjjf S )Nz%s/price_rules/%s/batch/%s.%s)r   find_oner   siter   r   r   	extension)r   batch_idr   r   r   
find_batch   s   zPriceRule.find_batchN)__name__
__module____qualname__r   r   r   r   r"   r   r   r   r   r      s
    r   )r   baser   r   r   discount_code_creationr   r   r   r   r   r   <module>   s
    