o
    Q?ha                     @   sh   d dl mZ d dlmZ d dlmZ d dlmZ d dlm	Z	 d dl
mZ defdd	Zdefd
dZdS )    )db)Application)
EtsyClient)Shop)	API_Error)Paramsparamsc                 C   s   t | jd}t|j}| jd}| jd}| jd| jd}}| jd| jd}}t||||||d}	d	|j d
}
t|j|}|j	|
|	d}|j
dkr\| S t|j|j
)NshopIdtitleoriginCountryprimaryCostsecondaryCostminProcessingTimemaxProcessingTime)r
   origin_country_isoprimary_costsecondary_costmin_processing_timemax_processing_time.https://openapi.etsy.com/v3/application/shops//shipping-profiles)data   )r   getargsr   appIddictplatformShopIdr   apiKeypoststatus_codejsonr   text)r   shopappr
   r   r   r   r   r   shippingProfileurlclientres r)   P/var/www/html/riverr-enterprise-integrations-main/V2/functions/Etsy/Shipments.pycreateShippingProfile	   s&   r+   c                 C   s^   t | jd}t|j}t|j|}|d|j d}|jdkr(|	 S t
|j|j)Nr	   r   r   r   )r   r   r   r   r   r   r   r   r    r!   r   r"   )r   r#   r$   r'   r(   r)   r)   r*   getShippingProfiles   s   
r,   N)configs.firebaser   V2.functions.Applications.mainr   V2.functions.Etsy.Authr   V2.functions.Shops.mainr   V2.middlewares.authr   	V2.Paramsr   r+   r,   r)   r)   r)   r*   <module>   s    