
    jofRQ              	           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 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mZ  G d ded         ed         ed         ed                   ZdS )    )CreateableAPIResource)DeletableAPIResource)
ListObject)ListableAPIResource)RequestOptions)StripeObject)UpdateableAPIResource)class_method_variantsanitize_id)ClassVarDictListOptionalcastoverload)LiteralNotRequired	TypedDictUnpackc                   R   e Zd ZU dZdZeed                  ed<    G d de          Z	 G d de          Z
 G d d	e          Z G d
 de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G 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d.ed/         d0d fd1            Zed.ed/         d0d fd2            Zed3ed.ed4         d0d fd5            Z e!e"d3ed.ed4         d0d fd6                        Z#e!d.ed4         d0d fd7            Z# e$d8          d.ed4         d0d fd9            Z#ed3ed.ed4         d0d fd:            Z%e!e"d3ed.ed4         d0d fd;                        Z&e!d.ed4         d0d fd<            Z& e$d=          d.ed4         d0d fd>            Z&ed.ed?         d0e'd          fd@            Z(ed.ed?         d0e'd          fdA            Z)ed"ed.edB         d0d fdC            Z*ed"ed.edB         d0d fdD            Z+ed"ed.edE         d0d fdF            Z,ed"ed.edE         d0d fdG            Z-e	e
dHZ.dIS )J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                   &    e Zd ZU ee         ed<   dS )Coupon.AppliesToproductsN)__name__
__module____qualname__r   str__annotations__     H/var/www/html/Alfredo/env/lib/python3.11/site-packages/stripe/_coupon.py	AppliesTor      s&         s)	 	r#   r%   c                       e Zd ZU eed<   dS )Coupon.CurrencyOptions
amount_offNr   r   r   intr!   r"   r#   r$   CurrencyOptionsr'   #            	 	r#   r+   c                   n   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 )Coupon.CreateParamsr(   Coupon.CreateParamsAppliesTo
applies_tocurrency"Coupon.CreateParamsCurrencyOptionscurrency_optionsforeveronce	repeatingdurationduration_in_monthsexpandidmax_redemptionsLiteral['']|Dict[str, str]metadatanamepercent_off	redeem_byN)r   r   r   r   r*   r!   r    r   r   r   floatr"   r#   r$   CreateParamsr.   )   sg        $$$$	   >????	 c""""	 &::;
 	
 	
 	
	 g&DEFFFF	 (,,,,	 DI&&&&	 	 %S))))	 :;;;;	 #	 !''''	 s####	 	r#   rC   c                   2    e Zd ZU eee                  ed<   dS )r/   r   Nr   r   r   r   r   r    r!   r"   r#   r$   CreateParamsAppliesTozCoupon.CreateParamsAppliesToa   s+         d3i((((	 	r#   rF   c                       e Zd ZU eed<   dS )r2   r(   Nr)   r"   r#   r$   CreateParamsCurrencyOptionsz"Coupon.CreateParamsCurrencyOptionsg   r,   r#   rH   c                       e Zd ZdS )Coupon.DeleteParamsN)r   r   r   r"   r#   r$   DeleteParamsrJ   m   s        r#   rK   c                       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 )Coupon.ListParamszCoupon.ListParamsCreated|intcreatedending_beforer:   limitstarting_afterN)r   r   r   r   r!   r    r   r*   r"   r#   r$   
ListParamsrM   p   s         ;<<<<	 #3''''	 DI&&&&	 3	 $C((((	 	r#   rR   c                   n    e Zd ZU ee         ed<   	 ee         ed<   	 ee         ed<   	 ee         ed<   dS )Coupon.ListParamsCreatedgtgteltlteN)r   r   r   r   r*   r!   r"   r#   r$   ListParamsCreatedrT      so         	 	 	 	 	r#   rY   c                       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 )Coupon.ModifyParams"Coupon.ModifyParamsCurrencyOptionsr3   r:   r=   r>   r?   N)r   r   r   r   r   r    r!   r   r"   r#   r$   ModifyParamsr[      s         %::;
 	
 	
 	
	 DI&&&&	 :;;;;	 #	 	r#   r]   c                       e Zd ZU eed<   dS )r\   r(   Nr)   r"   r#   r$   ModifyParamsCurrencyOptionsz"Coupon.ModifyParamsCurrencyOptions   r,   r#   r_   c                   2    e Zd ZU eee                  ed<   dS )Coupon.RetrieveParamsr:   NrE   r"   r#   r$   RetrieveParamsra      s+         DI&&&&	 	r#   rb   r(   r0   rN   r1   r3   r4   r8   r9   r;   livemoder<   r>   r?   objectr@   rA   times_redeemedvalidTdeletedparamsr.   returnc                 r    t          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rh   )r   _static_request	class_urlclsrh   s     r$   createzCoupon.create   sB         
 
 	
r#   c                    K   t          d|                     d|                                 |           d{V           S )rk   r   rl   rm   N)r   _static_request_asyncro   rp   s     r$   create_asynczCoupon.create_async  sd       ++ ,        
 
 	
r#   sidrJ   c                     |                                  dt          |          }t          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.
        /r   deleterm   ro   r   r   rn   rq   rv   rh   urls       r$   _cls_deletezCoupon._cls_delete   s[     +c*:*:*:;    
 
 	
r#   c                     dS rx   Nr"   rv   rh   s     r$   rz   zCoupon.delete1  s	     	r#   c                     dS r   r"   selfrh   s     r$   rz   zCoupon.delete9  s	    
 	r#   r~   c                 V    |                      d|                                 |          S )rx   rz   rm   )_request_and_refreshinstance_urlr   s     r$   rz   zCoupon.delete@  s6     (( ) 
 
 	
r#   c                    K   |                                  dt          |          }t          d|                     d||           d{V           S )rx   ry   r   rz   rm   Nro   r   r   rt   r|   s       r$   _cls_delete_asynczCoupon._cls_delete_asyncM  s}       +c*:*:*:;++ ,        
 
 	
r#   c                 
   K   dS r   r"   r   s     r$   delete_asynczCoupon.delete_async^  s       	r#   c                 
   K   dS r   r"   r   s     r$   r   zCoupon.delete_asynch  s       	r#   r   c                 f   K   |                      d|                                 |           d{V S )rx   rz   rm   N)_request_and_refresh_asyncr   r   s     r$   r   zCoupon.delete_asyncq  sX       44 5 
 
 
 
 
 
 
 
 	
r#   rM   c                     |                      d|                                 |          }t          |t                    s$t	          dt          |          j        z            |S )1
        Returns a list of your coupons.
        getrm   %Expected list object from API, got %s)rn   ro   
isinstancer   	TypeErrortyper   rq   rh   results      r$   listzCoupon.list~  sp     $$MMOO % 
 

 &*-- 	7<<(*  
 r#   c                    K   |                      d|                                 |           d{V }t          |t                    s$t	          dt          |          j        z            |S )r   r   rm   Nr   )rt   ro   r   r   r   r   r   r   s      r$   
list_asynczCoupon.list_async  s       00MMOO 1 
 
 
 
 
 
 
 

 &*-- 	7<<(*  
 r#   r[   c                     |                                  dt          |          }t          d|                     d||                    S )
        Updates the metadata of a coupon. Other coupon details (currency, duration, amount_off) are, by design, not editable.
        ry   r   rl   rm   r{   rq   r;   rh   r}   s       r$   modifyzCoupon.modify  sX     +b///:    
 
 	
r#   c                    K   |                                  dt          |          }t          d|                     d||           d{V           S )r   ry   r   rl   rm   Nr   r   s       r$   modify_asynczCoupon.modify_async  sz       +b///:++ ,        
 
 	
r#   ra   c                 @     | |fi |}|                                  |S )9
        Retrieves the coupon with the given ID.
        )refreshrq   r;   rh   instances       r$   retrievezCoupon.retrieve  s2     3r$$V$$r#   c                 P   K    | |fi |}|                                  d{V  |S )r   N)refresh_asyncr   s       r$   retrieve_asynczCoupon.retrieve_async  sH       3r$$V$$$$&&&&&&&&&r#   )r0   r3   N)/r   r   r   __doc__r   r   r   r!   r   r%   r+   r   rC   r   rF   rH   rK   rR   rY   r]   r_   rb   r   r*   r    r   boolrB   classmethodr   rr   ru   r~   r   staticmethodrz   r
   r   r   r   r   r   r   r   r   r   _inner_class_typesr"   r#   r$   r   r      s          08K'(+,777    L       ,   6 6 6 6 6~ 6 6 6p    	       i       ~       ^   ,    I   $    ~   (    i            ####LLL sm tC$89:::: 45555 !%%% 	GGG NNN c]""" tCH~&&&& 3- H %    }  KKK gdm$$$$ 
f%:; 
 
 
 
 [
 
34
	
 
 
 [
" 

!'(=!>
	
 
 
 [
  C 6*?#@ X    \ X v&;<     X -((

45

	

 

 

 )(

 

!'(=!>
	
 
 
 [
  "#89	   \ X 45	   X -..

45

	

 

 

 /.

 12	H	   [& 12	H	   [& 

 &'< =
	
 
 
 [
  

 &'< =
	
 
 
 [
   &'> ?	   [  &'> ?	   [  + r#   r   N)stripe._createable_api_resourcer   stripe._deletable_api_resourcer   stripe._list_objectr   stripe._listable_api_resourcer   stripe._request_optionsr   stripe._stripe_objectr   stripe._updateable_api_resourcer	   stripe._utilr
   r   typingr   r   r   r   r   r   typing_extensionsr   r   r   r   r   r"   r#   r$   <module>r      sN   B A A A A A ? ? ? ? ? ? * * * * * * = = = = = = 2 2 2 2 2 2 . . . . . . A A A A A A : : : : : : : : A A A A A A A A A A A A A A A A E E E E E E E E E E E ER R R R R(#"!(#	R R R R Rr#   