a
    !fA                     @   s   d dl mZmZmZ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mZmZmZ d dlmZmZmZmZ d dlmZ G d	d
 d
ed
 ed
 ed
 ed
 ZdS )    )CreateableAPIResourceDeletableAPIResourceListableAPIResourceUpdateableAPIResource)
ListObject)RequestOptions)StripeObject)class_method_variant)ClassVarDictListOptionalcastoverload)LiteralNotRequired	TypedDictUnpack)
quote_plusc                	   @   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
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ee ed< ee	 ed< eed< ee ed< eeee
f  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ed,  ed-< edIee ee ee ee ed/ d d0d1d2Zeeed3 d d4d5d6Ze e!eed3 d d4d7d8Z"e ed3 d d9d:d8Z"e#d;ed3 d d9d<d8Z"edJee ee ee ed= e$d  d>d?d@Z%eeedA d dBdCdDZ&eeedE d dBdFdGZ'e	e
dHZ(d.S )K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).
    Z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   \/var/www/html/python-backend/venv/lib/python3.9/site-packages/stripe/api_resources/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#   c                   @   s   e Zd ZU ed ed< ed ed< ed ed< ed ed< ed	 ed
< ed ed< ed ed< ed ed< ed ed< ed ed< ed ed< ed ed< ed ed< dS )Coupon.CreateParamsr"   r    Coupon.CreateParamsAppliesTo
applies_tor   currencyz-Dict[str, Coupon.CreateParamsCurrencyOptions]currency_optionsz'Literal['forever', 'once', 'repeating']durationduration_in_months	List[str]expandidmax_redemptionsLiteral['']|Dict[str, str]metadatanamefloatpercent_off	redeem_byNr   r   r   r   r   r   r   r   r   CreateParams,   s    
r6   c                   @   s   e Zd ZU eed< dS )z"Coupon.CreateParamsCurrencyOptionsr    Nr!   r   r   r   r   CreateParamsCurrencyOptionsd   s   
r7   c                   @   s   e Zd ZU ed ed< dS )r%   r+   r   Nr5   r   r   r   r   CreateParamsAppliesToj   s   
r8   c                   @   s   e Zd ZdS )Coupon.DeleteParamsN)r   r   r   r   r   r   r   DeleteParamsp   s   r:   c                   @   sJ   e Zd ZU ed ed< ed ed< ed ed< ed ed< ed ed	< d
S )Coupon.ListParamszCoupon.ListParamsCreated|intcreatedr   Zending_beforer+   r,   r"   limitZstarting_afterNr5   r   r   r   r   
ListParamss   s   
r>   c                   @   s>   e Zd ZU ed ed< ed ed< ed ed< ed ed< dS )zCoupon.ListParamsCreatedr"   gtZgteltZlteNr5   r   r   r   r   ListParamsCreated   s
   
rA   c                   @   s>   e Zd ZU ed ed< ed ed< ed ed< ed ed< d	S )
Coupon.ModifyParamsz-Dict[str, Coupon.ModifyParamsCurrencyOptions]r(   r+   r,   r/   r0   r   r1   Nr5   r   r   r   r   ModifyParams   s   
rC   c                   @   s   e Zd ZU eed< dS )z"Coupon.ModifyParamsCurrencyOptionsr    Nr!   r   r   r   r   ModifyParamsCurrencyOptions   s   
rD   c                   @   s   e Zd ZU ed ed< dS )Coupon.RetrieveParamsr+   r,   Nr5   r   r   r   r   RetrieveParams   s   
rF   r    r&   r<   r'   r(   )foreveronceZ	repeatingr)   r*   r-   Zlivemoder.   r0   r1   objectr3   r4   Ztimes_redeemedZvalidTZdeletedNr$   )api_keyidempotency_keystripe_versionstripe_accountparamsreturnc                 K   s    t d| d|  |||||S )a  
        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   _static_request	class_url)clsrJ   rK   rL   rM   rN   r   r   r   create  s    zCoupon.creater9   )sidrN   rO   c                 K   s*   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   deleterN   rR   r   r   rQ   )rS   rU   rN   urlr   r   r   _cls_delete  s
    zCoupon._cls_deletec                 K   s   dS rV   Nr   )rU   rN   r   r   r   rX   +  s    zCoupon.delete)rN   rO   c                 K   s   dS r]   r   selfrN   r   r   r   rX   3  s    r\   c                 K   s   | j d|  |dS )rV   rX   rY   )Z_request_and_refreshZinstance_urlr^   r   r   r   rX   :  s
    r;   )rJ   rL   rM   rN   rO   c                 K   s:   | j d|  ||||d}t|ts6tdt|j |S )z1
        Returns a list of your coupons.
        get)rJ   rL   rM   rN   z%Expected list object from API, got %s)rQ   rR   
isinstancer   	TypeErrortyper   )rS   rJ   rL   rM   rN   resultr   r   r   listG  s    
zCoupon.listrB   )r-   rN   rO   c                 K   s*   d|   t|f }td| jd||dS )z
        Updates the metadata of a coupon. Other coupon details (currency, duration, amount_off) are, by design, not editable.
        rW   r   rP   rY   rZ   )rS   r-   rN   r[   r   r   r   modifye  s
    zCoupon.modifyrE   c                 K   s   | |fi |}|   |S )z9
        Retrieves the coupon with the given ID.
        )refresh)rS   r-   rN   instancer   r   r   retriever  s    zCoupon.retrieve)r&   r(   )NNNN)NNN))r   r   r   __doc__r   r
   r   r   r   r   r#   r   r6   r   r7   r8   r:   r>   rA   rC   rD   rF   r   r"   r   r   boolr2   classmethodr   rT   r\   r   staticmethodrX   r	   r   re   rf   ri   Z_inner_class_typesr   r   r   r   r      s   
8       r   N)Zstripe.api_resources.abstractr   r   r   r   Z stripe.api_resources.list_objectr   Zstripe.request_optionsr   Zstripe.stripe_objectr   Zstripe.utilr	   typingr
   r   r   r   r   r   Ztyping_extensionsr   r   r   r   urllib.parser   r   r   r   r   r   <module>   s    
