o
    Bi8                     @   sx   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mZmZ d dlmZmZmZ G dd	 d	eZd
S )    )Coupon)
ListObject)RequestOptions)StripeService)sanitize_id)DictListcast)LiteralNotRequired	TypedDictc                	   @   s  e Zd ZG dd deZG dd deZG dd deZG dd deZG d	d
 d
eZG dd deZ	G dd deZ
G dd deZG dd deZi i fdedddedefddZi i fdedddedefddZi i fdedddedefddZi i fdedddedefdd Zi i fdedd!dedefd"d#Zi i fdedd!dedefd$d%Zi i fdd&dedee fd'd(Zi i fdd&dedee fd)d*Zi i fdd+dedefd,d-Zi i fdd+dedefd.d/Zd0S )1CouponServicec                   @   s   e Zd ZU ee ed< 	 ed ed< 	 ee ed< 	 eeedf  ed< 	 eed  ed< 	 ee ed	< 	 ee	e  ed
< 	 ee ed< 	 ee ed< 	 ed ed< 	 ee ed< 	 ee
 ed< 	 ee ed< dS )CouponService.CreateParams
amount_off#CouponService.CreateParamsAppliesTo
applies_tocurrency)CouponService.CreateParamsCurrencyOptionscurrency_options)foreveronce	repeatingdurationduration_in_monthsexpandidmax_redemptionsLiteral['']|Dict[str, str]metadatanamepercent_off	redeem_byN)__name__
__module____qualname__r   int__annotations__strr   r
   r   float r)   r)   V/var/www/html/Trade-python/venv/lib/python3.10/site-packages/stripe/_coupon_service.pyCreateParams   s:   
 
r+   c                   @      e Zd ZU eee  ed< dS )r   productsNr"   r#   r$   r   r   r'   r&   r)   r)   r)   r*   CreateParamsAppliesToE      
 r/   c                   @      e Zd ZU eed< dS )r   r   Nr"   r#   r$   r%   r&   r)   r)   r)   r*   CreateParamsCurrencyOptionsK      
 r3   c                   @   s   e Zd ZdS )CouponService.DeleteParamsN)r"   r#   r$   r)   r)   r)   r*   DeleteParamsQ   s    r6   c                   @   sV   e Zd ZU ed ed< 	 ee ed< 	 eee  ed< 	 ee ed< 	 ee ed< dS )CouponService.ListParamsz#CouponService.ListParamsCreated|intcreatedending_beforer   limitstarting_afterN)r"   r#   r$   r   r&   r'   r   r%   r)   r)   r)   r*   
ListParamsT   s   
 r<   c                   @   sD   e Zd ZU ee ed< 	 ee ed< 	 ee ed< 	 ee ed< dS )zCouponService.ListParamsCreatedgtgteltlteN)r"   r#   r$   r   r%   r&   r)   r)   r)   r*   ListParamsCreatedj   s   
 rA   c                   @   r,   )CouponService.RetrieveParamsr   Nr.   r)   r)   r)   r*   RetrieveParams|   r0   rC   c                   @   sP   e Zd ZU eeedf  ed< 	 eee  ed< 	 ed ed< 	 ee ed< dS )CouponService.UpdateParams)CouponService.UpdateParamsCurrencyOptionsr   r   r   r   r   N)r"   r#   r$   r   r   r'   r&   r   r)   r)   r)   r*   UpdateParams   s   
 
rF   c                   @   r1   )rE   r   Nr2   r)   r)   r)   r*   UpdateParamsCurrencyOptions   r4   rG   couponparamsr5   optionsreturnc              	   C   &   t t| jddjt|dd||dS )D  
        You can delete coupons via the [coupon management](https://dashboard.stripe.com/coupons) page of the Stripe dashboard. However, deleting a coupon does not affect any customers who have already applied the coupon; it means that new customers can't redeem the coupon. You can also delete coupons via the API.
        delete/v1/coupons/{coupon}rH   apibase_addressrI   rJ   r	   r   _requestformatr   selfrH   rI   rJ   r)   r)   r*   rN         	zCouponService.deletec              	      .   t t| jddjt|dd||dI dH S )rM   rN   rO   rP   rQ   rR   Nr	   r   _request_asyncrV   r   rW   r)   r)   r*   delete_async      	
zCouponService.delete_asyncrB   c              	   C   rL   )9
        Retrieves the coupon with the given ID.
        getrO   rP   rQ   rR   rT   rW   r)   r)   r*   retrieve   rY   zCouponService.retrievec              	      rZ   )r_   r`   rO   rP   rQ   rR   Nr[   rW   r)   r)   r*   retrieve_async   r^   zCouponService.retrieve_asyncrD   c              	   C   rL   )
        Updates the metadata of a coupon. Other coupon details (currency, duration, amount_off) are, by design, not editable.
        postrO   rP   rQ   rR   rT   rW   r)   r)   r*   update   rY   zCouponService.updatec              	      rZ   )rc   rd   rO   rP   rQ   rR   Nr[   rW   r)   r)   r*   update_async   r^   zCouponService.update_asyncr7   c              	   C   s   t tt | jddd||dS )1
        Returns a list of your coupons.
        r`   /v1/couponsrQ   rR   )r	   r   r   rU   rX   rI   rJ   r)   r)   r*   list  s   zCouponService.listc              	      s&   t tt | jddd||dI dH S )rg   r`   rh   rQ   rR   N)r	   r   r   r\   ri   r)   r)   r*   
list_async'  s   
zCouponService.list_asyncr   c              	   C   s   t t| jddd||dS )  
        You can create coupons easily via the [coupon management](https://dashboard.stripe.com/coupons) page of the Stripe dashboard. Coupon creation is also accessible via the API if you need to create coupons on the fly.

        A coupon has either a percent_off or an amount_off and currency. If you set an amount_off, that amount will be subtracted from any invoice's subtotal. For example, an invoice with a subtotal of 100 will have a final total of 0 if a coupon with an amount_off of 200 is applied to it and an invoice with a subtotal of 300 will have a final total of 100 if a coupon with an amount_off of 200 is applied to it.
        rd   rh   rQ   rR   )r	   r   rU   ri   r)   r)   r*   create:  s   
zCouponService.createc              	      s"   t t| jddd||dI dH S )rl   rd   rh   rQ   rR   N)r	   r   r\   ri   r)   r)   r*   create_asyncO  s   

zCouponService.create_asyncN)r"   r#   r$   r   r+   r/   r3   r6   r<   rA   rC   rF   rG   r'   r   r   rN   r]   ra   rb   re   rf   r   rj   rk   rm   rn   r)   r)   r)   r*   r      s    8	








r   N)stripe._couponr   stripe._list_objectr   stripe._request_optionsr   stripe._stripe_servicer   stripe._utilr   typingr   r   r	   typing_extensionsr
   r   r   r   r)   r)   r)   r*   <module>   s   