
    Ai;9                         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r0d 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)  G d ded   ed   ed         Z*y)    )CreateableAPIResource)ExpandableField)
ListObject)ListableAPIResource)StripeObject)UpdateableAPIResource)class_method_variantsanitize_id)ClassVarDictListOptionalcastoverload)LiteralUnpackTYPE_CHECKING)Customer)CreditGrantCreateParams)CreditGrantExpireParams)CreditGrantListParams)CreditGrantModifyParams)CreditGrantRetrieveParams)CreditGrantVoidGrantParams)	TestClockc                      e Zd ZU dZdZeed      ed<    G d de      Z	 G d de      Z
e	ed<   e
ed	<   ed
   ed<   	 eed<   	 ed   ed<   	 ee   ed<   	 ee   ed<   	 eed<   	 eed<   	 eeef   ed<   	 ee   ed<   	 ed   ed<   	 ee   ed<   	 eed      ed<   	 eed<   	 ee   ed<   	 eded   dd fd       Zeded   dd fd       Zededed    dd fd!       Zeededed    dd fd"              Zeded    dd fd#       Z ed$      ded    dd fd%       Zededed    dd fd&       Zeededed    dd fd'              Zeded    dd fd(       Z ed)      ded    dd fd*       Zeded+   ded    fd,       Zeded+   ded    fd-       Zededed.   dd fd/       Zededed.   dd fd0       Z ededed1   dd fd2       Z!ededed1   dd fd3       Z"ededed4   dd fd5       Z#eededed4   dd fd6              Z$eded4   dd fd7       Z$ ed8      ded4   dd fd9       Z$ededed4   dd fd:       Z%eededed4   dd fd;              Z&eded4   dd fd<       Z& ed=      ded4   dd fd>       Z&e	e
d?Z'y@)ACreditGrantz
    A credit grant is an API resource that documents the allocation of some billing credits to a customer.

    Related guide: [Billing credits](https://docs.stripe.com/billing/subscriptions/usage-based/billing-credits)
    zbilling.credit_grantOBJECT_NAMEc                   P    e Zd ZU  G d de      Zee   ed<   	 ed   ed<   	 deiZy)CreditGrant.Amountc                   $    e Zd ZU eed<   	 eed<   y)CreditGrant.Amount.MonetarycurrencyvalueN)__name__
__module____qualname__str__annotations__int     O/var/www/html/immo/lib/python3.12/site-packages/stripe/billing/_credit_grant.pyMonetaryr"   4   s    M Jr,   r.   monetarytypeN)	r%   r&   r'   r   r.   r   r)   r   _inner_class_typesr+   r,   r-   Amountr    3   s?    	| 	 8$$	 j!!	 )(3r,   r2   c                   6    e Zd ZU  G d de      Zeed<   deiZy)CreditGrant.ApplicabilityConfigc                   \    e Zd ZU  G d de      Zeed      ed<   	 eee      ed<   	 deiZ	y)%CreditGrant.ApplicabilityConfig.Scopec                       e Zd ZU ee   ed<   y)+CreditGrant.ApplicabilityConfig.Scope.PriceidN)r%   r&   r'   r   r(   r)   r+   r,   r-   Pricer8   J   s    SM!r,   r:   metered
price_typepricesN)
r%   r&   r'   r   r:   r   r   r)   r   r1   r+   r,   r-   Scoper6   I   sH      !!344 T%[)) #+E!2r,   r>   scopeN)r%   r&   r'   r   r>   r)   r1   r+   r,   r-   ApplicabilityConfigr4   H   s     	3L 	3" %u-r,   r@   amountapplicability_config)paidpromotionalcategorycreatedr   customereffective_at
expires_atr9   livemodemetadatanameobjectpriorityr   
test_clockupdated	voided_atparamsr   returnc                 Z    t        d| j                  d| j                         |            S ))
        Creates a credit grant.
        r   postrR   )r   _static_request	class_urlclsrR   s     r-   createzCreditGrant.create   s6        
 	
r,   c                 v   K   t        d| j                  d| j                         |       d{         S 7 w)rU   r   rV   rW   N)r   _static_request_asyncrY   rZ   s     r-   create_asynczCreditGrant.create_async   sD      ++ ,  
 	
s   ,97
	9r   c                 p    t        d| j                  ddj                  t        |            |            S ))
        Expires a credit grant.
        r   rV   %/v1/billing/credit_grants/{id}/expirer9   rW   r   rX   formatr
   r[   r9   rR   s      r-   _cls_expirezCreditGrant._cls_expire   sI     7>>"2 ?     	
 		
r,   c                      yra   Nr+   r9   rR   s     r-   expirezCreditGrant.expire        	r,   c                      yri   r+   selfrR   s     r-   rk   zCreditGrant.expire        	r,   rg   c                     t        d| j                  ddj                  t        | j	                  d                  |            S )ra   r   rV   rb   r9   rc   rW   r   _requestre   r
   getrn   s     r-   rk   zCreditGrant.expire   sP     MM7>>"488D>2 ?    	
 		
r,   c                    K   t        d| j                  ddj                  t        |            |       d{         S 7 w)ra   r   rV   rb   rc   rW   Nr   r^   re   r
   rf   s      r-   _cls_expire_asynczCreditGrant._cls_expire_async   sW      ++7>>"2 ?   ,  	
 		
   7AA
	Ac                    K   ywri   r+   rj   s     r-   expire_asynczCreditGrant.expire_async        	   c                    K   ywri   r+   rn   s     r-   rz   zCreditGrant.expire_async        	r|   rw   c                    K   t        d| j                  ddj                  t        | j	                  d                  |       d{         S 7 w)ra   r   rV   rb   r9   rc   rW   Nr   _request_asyncre   r
   rt   rn   s     r-   rz   zCreditGrant.expire_async  s`      %%7>>"488D>2 ?   &  	
 		
   AAA
		Ar   c                     | j                  d| j                         |      }t        |t              s!t	        dt        |      j                  z        |S )3
        Retrieve a list of credit grants.
        rt   rW   %Expected list object from API, got %s)rX   rY   
isinstancer   	TypeErrorr0   r%   r[   rR   results      r-   listzCreditGrant.list&  s]     $$MMO % 

 &*-7<((* 
 r,   c                    K   | j                  d| j                         |       d{   }t        |t              s!t	        dt        |      j                  z        |S 7 7w)r   rt   rW   Nr   )r^   rY   r   r   r   r0   r%   r   s      r-   
list_asynczCreditGrant.list_async:  sk      00MMO 1 
 

 &*-7<((* 
 
s   &A"A 8A"r   c                 z    | j                         dt        |      }t        d| j                  d||            S ))
        Updates a credit grant.
        /r   rV   rW   )rY   r
   r   rX   r[   r9   rR   urls       r-   modifyzCreditGrant.modifyN  sD     +b/:   
 	
r,   c                    K   | j                         dt        |      }t        d| j                  d||       d{         S 7 w)r   r   r   rV   rW   N)rY   r
   r   r^   r   s       r-   modify_asynczCreditGrant.modify_async_  sR      +b/:++ ,  
 	
s   <A	A
	A	r   c                 8     | |fi |}|j                          |S )+
        Retrieves a credit grant.
        )refreshr[   r9   rR   instances       r-   retrievezCreditGrant.retrievep  s$     r$V$r,   c                 T   K    | |fi |}|j                          d{    |S 7 w)r   N)refresh_asyncr   s       r-   retrieve_asynczCreditGrant.retrieve_async{  s3      r$V$$$&&& 	's   (&(r   c                 p    t        d| j                  ddj                  t        |            |            S )'
        Voids a credit grant.
        r   rV   #/v1/billing/credit_grants/{id}/voidrc   rW   rd   rf   s      r-   _cls_void_grantzCreditGrant._cls_void_grant  sI     5<<"2 =     	
 		
r,   c                      yr   Nr+   rj   s     r-   
void_grantzCreditGrant.void_grant  rl   r,   c                      yr   r+   rn   s     r-   r   zCreditGrant.void_grant  rp   r,   r   c                     t        d| j                  ddj                  t        | j	                  d                  |            S )r   r   rV   r   r9   rc   rW   rr   rn   s     r-   r   zCreditGrant.void_grant  sP     MM5<<"488D>2 =    	
 		
r,   c                    K   t        d| j                  ddj                  t        |            |       d{         S 7 w)r   r   rV   r   rc   rW   Nrv   rf   s      r-   _cls_void_grant_asyncz!CreditGrant._cls_void_grant_async  sW      ++5<<"2 =   ,  	
 		
rx   c                    K   ywr   r+   rj   s     r-   void_grant_asynczCreditGrant.void_grant_async  r{   r|   c                    K   ywr   r+   rn   s     r-   r   zCreditGrant.void_grant_async  r~   r|   r   c                    K   t        d| j                  ddj                  t        | j	                  d                  |       d{         S 7 w)r   r   rV   r   r9   rc   rW   Nr   rn   s     r-   r   zCreditGrant.void_grant_async  s`      %%5<<"488D>2 =   &  	
 		
r   )rA   rB   N)(r%   r&   r'   __doc__r   r   r   r)   r   r2   r@   r*   r   r   r(   boolr   classmethodr   r\   r_   rg   r   staticmethodrk   r	   rw   rz   r   r   r   r   r   r   r   r   r   r   r   r1   r+   r,   r-   r   r   $   s   
 	 '"89: 4 4*.l .* N--+,, L j)) 3-  	G N 38n 3- *++ sm 566 L } 
78
	
 
 
78
	
 
 

 &'@ A
	
 
" !";<	   89	  -(
89
	
 )
" 

 &'@ A
	
 
" !";<	   89	  -.
89
	
 /
" 56	M	" & 56	M	" & 

 &'@ A
	
 
  

 &'@ A
	
 
   &'B C	   &'B C	  

 &'C D
	
 
" !">?	   ;<	  +,
;<
	
 -
" 

 &'C D
	
 
" !">?	   ;<	  12
;<
	
 3
$  3r,   r   N)+stripe._createable_api_resourcer   stripe._expandable_fieldr   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._customerr   1stripe.params.billing._credit_grant_create_paramsr   1stripe.params.billing._credit_grant_expire_paramsr   /stripe.params.billing._credit_grant_list_paramsr   1stripe.params.billing._credit_grant_modify_paramsr   3stripe.params.billing._credit_grant_retrieve_paramsr   5stripe.params.billing._credit_grant_void_grant_paramsr   stripe.test_helpers._test_clockr   r   r+   r,   r-   <module>r      sv    B 4 * = . A : A A < <) :S-(&-(Sr,   