
    hQQ              	           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y)    )CreateableAPIResource)DeletableAPIResource)
ListObject)ListableAPIResource)RequestOptions)StripeObject)UpdateableAPIResource)class_method_variantsanitize_id)ClassVarDictListOptionalcastoverload)LiteralNotRequired	TypedDictUnpackc                      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.yI)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<   y)Coupon.AppliesToproductsN)__name__
__module____qualname__r   str__annotations__     N/var/www/api/v1/venv_getwork_v1/lib/python3.12/site-packages/stripe/_coupon.py	AppliesTor      s    s)	r#   r%   c                       e Zd ZU eed<   y)Coupon.CurrencyOptions
amount_offNr   r   r   intr!   r"   r#   r$   CurrencyOptionsr'   #       	r#   r+   c                      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<   y)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.   )   s   $$	   >??	 c""	 &::;
 	
	 g&DEFF	 (,,	 DI&&	 	 %S))	 :;;	 #	 !''	 s##	r#   rC   c                   $    e Zd ZU eee      ed<   y)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<   y)r2   r(   Nr)   r"   r#   r$   CreateParamsCurrencyOptionsz"Coupon.CreateParamsCurrencyOptionsg   r,   r#   rH   c                       e Zd Zy)Coupon.DeleteParamsN)r   r   r   r"   r#   r$   DeleteParamsrJ   m   s    r#   rK   c                   l    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<   y)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                   T    e Zd ZU ee   ed<   	 ee   ed<   	 ee   ed<   	 ee   ed<   y)Coupon.ListParamsCreatedgtgteltlteN)r   r   r   r   r*   r!   r"   r#   r$   ListParamsCreatedrT      sH    	 	 	 	r#   rY   c                   d    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<   y)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<   y)r\   r(   Nr)   r"   r#   r$   ModifyParamsCurrencyOptionsz"Coupon.ModifyParamsCurrencyOptions   r,   r#   r_   c                   $    e Zd ZU eee      ed<   y)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                 Z    t        d| j                  d| j                         |            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   s6        
 	
r#   c                 v   K   t        d| j                  d| j                         |       d{         S 7 w)rk   r   rl   rm   N)r   _static_request_asyncro   rp   s     r$   create_asynczCoupon.create_async  sD      ++ ,  
 	
s   ,97
	9sidrJ   c                 z    | j                         dt        |      }t        d| j                  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   sE     +c*:;   
 	
r#   c                      yrx   Nr"   rv   rh   s     r$   rz   zCoupon.delete1  s     	r#   c                      yr   r"   selfrh   s     r$   rz   zCoupon.delete9  s    
 	r#   r~   c                 F    | j                  d| j                         |      S )rx   rz   rm   )_request_and_refreshinstance_urlr   s     r$   rz   zCoupon.delete@  s.     (( ) 
 	
r#   c                    K   | j                         dt        |      }t        d| j                  d||       d{         S 7 w)rx   ry   r   rz   rm   Nro   r   r   rt   r|   s       r$   _cls_delete_asynczCoupon._cls_delete_asyncM  sS      +c*:;++ ,  
 	
   <A	A
	A	c                    K   ywr   r"   r   s     r$   delete_asynczCoupon.delete_async^  s      	   c                    K   ywr   r"   r   s     r$   r   zCoupon.delete_asynch  s      	r   r   c                 b   K   | j                  d| j                         |       d{   S 7 w)rx   rz   rm   N)_request_and_refresh_asyncr   r   s     r$   r   zCoupon.delete_asyncq  s<      44 5 
 
 	
 
s   &/-/rM   c                     | j                  d| j                         |      }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~  s]     $$MMO % 

 &*-7<((* 
 r#   c                    K   | j                  d| j                         |       d{   }t        |t              s!t	        dt        |      j                  z        |S 7 7w)r   r   rm   Nr   )rt   ro   r   r   r   r   r   r   s      r$   
list_asynczCoupon.list_async  sk      00MMO 1 
 

 &*-7<((* 
 
s   &A"A 8A"r[   c                 z    | j                         dt        |      }t        d| j                  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  sD     +b/:   
 	
r#   c                    K   | j                         dt        |      }t        d| j                  d||       d{         S 7 w)r   ry   r   rl   rm   Nr   r   s       r$   modify_asynczCoupon.modify_async  sR      +b/:++ ,  
 	
r   ra   c                 8     | |fi |}|j                          |S )9
        Retrieves the coupon with the given ID.
        )refreshrq   r;   rh   instances       r$   retrievezCoupon.retrieve  s$     r$V$r#   c                 T   K    | |fi |}|j                          d{    |S 7 w)r   N)refresh_asyncr   s       r$   retrieve_asynczCoupon.retrieve_async  s3      r$V$$$&&& 	's   (&()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L , 6~ 6p	 i ~ ^ ,I $~ (i    ##L sm tC$89:: 455 !% 	G N c]" tCH~&& 3- H %  }  K gdm$$ 
f%:; 
 
 
 
34
	
 
" 

!'(=!>
	
 
  C 6*?#@ X    v&;<    -(

45

	

 )

 

!'(=!>
	
 
  "#89	   45	  -.

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      sX    B ? * = 2 . A : A A E ER(#"!(#	Rr#   