o
    i^7                     @   s   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 dlmZmZ d dlmZmZmZmZmZmZ d d	lmZmZmZ erfd d
lmZ d dlmZ d dlmZ d dl m!Z! d dl"m#Z# G dd ded ed ed ed Z$dS )    )CreateableAPIResource)DeletableAPIResource)
ListObject)ListableAPIResource)StripeObject)UpdateableAPIResource)class_method_variantsanitize_id)ClassVarDictListOptionalcastoverload)LiteralUnpackTYPE_CHECKING)CouponCreateParams)CouponDeleteParams)CouponListParams)CouponModifyParams)CouponRetrieveParamsc                   @   s"  e Zd ZU dZdZeed  ed< G dd deZ	G dd deZ
ee ed< 	 ee	 ed	< eed
< 	 ee ed< 	 eeee
f  ed< 	 eed  ed< 	 ed ed< 	 ee ed< 	 eed< 	 eed< 	 ee ed< 	 eeeef  ed< 	 ee ed< 	 ed ed< 	 ee ed< 	 ee ed< 	 eed< 	 eed< 	 eded dd fdd Zeded dd fd!d"Zed#eded$ dd fd%d&Zeed#eded$ dd fd'd(Zeded$ dd fd)d(Zed*ded$ dd fd+d(Zed#eded$ dd fd,d-Zeed#eded$ dd fd.d/Zeded$ dd fd0d/Zed1ded$ dd fd2d/Zeded3 ded  fd4d5Zeded3 ded  fd6d7Zededed8 dd fd9d:Zededed8 dd fd;d<Z ededed= dd fd>d?Z!ededed= dd fd@dAZ"e	e
dBZ#dCS )DCoupona+  
    A coupon contains information about a percent-off or amount-off discount you
    might want to apply to a customer. Coupons may be applied to [subscriptions](https://stripe.com/docs/api#subscriptions), [invoices](https://stripe.com/docs/api#invoices),
    [checkout sessions](https://stripe.com/docs/api/checkout/sessions), [quotes](https://stripe.com/docs/api#quotes), and more. Coupons do not work with conventional one-off [charges](https://stripe.com/docs/api#create_charge) or [payment intents](https://stripe.com/docs/api/payment_intents).
    couponOBJECT_NAMEc                   @   s   e Zd ZU ee ed< dS )zCoupon.AppliesToproductsN)__name__
__module____qualname__r   str__annotations__ r!   r!   n/var/www/snowflake_co_dev_github/snow_flake_back_end_deploy/env/lib/python3.10/site-packages/stripe/_coupon.py	AppliesTo#   s   
 r#   c                   @   s   e Zd ZU eed< dS )zCoupon.CurrencyOptions
amount_offN)r   r   r   intr    r!   r!   r!   r"   CurrencyOptions)   s   
 r&   r$   
applies_tocreatedcurrencycurrency_optionsTdeleted)foreveronce	repeatingdurationduration_in_monthsidlivemodemax_redemptionsmetadatanameobjectpercent_off	redeem_bytimes_redeemedvalidparamsr   returnc                 K   s   t d| j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.
        r   postr;   )r   _static_request	class_urlclsr;   r!   r!   r"   createu   s   zCoupon.createc                    s"   t d| jd|  |dI dH S )r=   r   r>   r?   N)r   _static_request_asyncrA   rB   r!   r!   r"   create_async   s   	
zCoupon.create_asyncsidr   c                 K   *   d|   t|f }td| j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.
        %s/%sr   deleter?   rA   r	   r   r@   rC   rG   r;   urlr!   r!   r"   _cls_delete      zCoupon._cls_deletec                 K      dS rI   Nr!   rG   r;   r!   r!   r"   rK      s   zCoupon.deletec                 K   rQ   rR   r!   selfr;   r!   r!   r"   rK      s   rO   c                 K   s   | j d|  |dS )rI   rK   r?   )_request_and_refreshinstance_urlrT   r!   r!   r"   rK      s
   c                    2   d|   t|f }td| jd||dI dH S )rI   rJ   r   rK   r?   NrA   r	   r   rE   rM   r!   r!   r"   _cls_delete_async      
zCoupon._cls_delete_asyncc                       dS rR   r!   rS   r!   r!   r"   delete_async   s   zCoupon.delete_asyncc                    r\   rR   r!   rT   r!   r!   r"   r]      s   rZ   c                    s   | j d|  |dI dH S )rI   rK   r?   N)_request_and_refresh_asyncrW   rT   r!   r!   r"   r]      s   r   c                 K   s4   | j d|  |d}t|tstdt|j |S )1
        Returns a list of your coupons.
        getr?   %Expected list object from API, got %s)r@   rA   
isinstancer   	TypeErrortyper   rC   r;   resultr!   r!   r"   list   s   
zCoupon.listc                    s<   | j d|  |dI dH }t|tstdt|j |S )r_   r`   r?   Nra   )rE   rA   rb   r   rc   rd   r   re   r!   r!   r"   
list_async	  s   
zCoupon.list_asyncr   c                 K   rH   )
        Updates the metadata of a coupon. Other coupon details (currency, duration, amount_off) are, by design, not editable.
        rJ   r   r>   r?   rL   rC   r1   r;   rN   r!   r!   r"   modify  rP   zCoupon.modifyc                    rX   )ri   rJ   r   r>   r?   NrY   rj   r!   r!   r"   modify_async.  r[   zCoupon.modify_asyncr   c                 K   s   | |fi |}|   |S )9
        Retrieves the coupon with the given ID.
        )refreshrC   r1   r;   instancer!   r!   r"   retrieve?  s   zCoupon.retrievec                    s$   | |fi |}|  I dH  |S )rm   N)refresh_asyncro   r!   r!   r"   retrieve_asyncJ  s   zCoupon.retrieve_async)r'   r*   N)$r   r   r   __doc__r   r
   r   r    r   r#   r&   r   r%   r   r   boolfloatclassmethodr   rD   rF   rO   r   staticmethodrK   r   rZ   r]   r   rg   rh   rk   rl   rq   rs   _inner_class_typesr!   r!   r!   r"   r      s  
 

r   N)%stripe._createable_api_resourcer   stripe._deletable_api_resourcer   stripe._list_objectr   stripe._listable_api_resourcer   stripe._stripe_objectr   stripe._updateable_api_resourcer   stripe._utilr   r	   typingr
   r   r   r   r   r   typing_extensionsr   r   r   #stripe.params._coupon_create_paramsr   #stripe.params._coupon_delete_paramsr   !stripe.params._coupon_list_paramsr   #stripe.params._coupon_modify_paramsr   %stripe.params._coupon_retrieve_paramsr   r   r!   r!   r!   r"   <module>   s*    
