
    _j9                     :   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*dS )    )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         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d0            Zededed/         dd fd1            Z ededed2         dd fd3            Z!ededed2         dd fd4            Z"ededed5         dd fd6            Z#eededed5         dd fd7                        Z$eded5         dd fd8            Z$ ed9          ded5         dd fd:            Z$ededed5         dd fd;            Z%eededed5         dd fd<                        Z&eded5         dd fd=            Z& ed>          ded5         dd fd?            Z&e	e
d@Z'dAS )B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                   d    e Zd ZU  G d de          Zee         ed<   	 ed         ed<   	 deiZdS )CreditGrant.Amountc                   &    e Zd ZU eed<   	 eed<   dS )CreditGrant.Amount.MonetarycurrencyvalueN)__name__
__module____qualname__str__annotations__int     `/var/www/app.qaans.com/backend/venv/lib/python3.11/site-packages/stripe/billing/_credit_grant.pyMonetaryr"   4   s/         MMM JJJ r,   r.   monetarytypeN)	r%   r&   r'   r   r.   r   r)   r   _inner_class_typesr+   r,   r-   Amountr    3   sy         	 	 	 	 	| 	 	 	 8$$$$	 j!!!!	 )(3r,   r2   c                   >    e Zd ZU  G d de          Zeed<   deiZdS )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	dS )%CreditGrant.ApplicabilityConfig.Scopec                   &    e Zd ZU ee         ed<   dS )+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   s                 !!34444 T%[)))) #+E!2r,   r>   scopeN)r%   r&   r'   r   r>   r)   r1   r+   r,   r-   ApplicabilityConfigr4   H   sR         	3 	3 	3 	3 	3L 	3 	3 	3" %u-r,   r@   amountapplicability_config)paidpromotionalcategorycreatedr   customercustomer_accounteffective_at
expires_atr9   livemodemetadatanameobjectpriorityr   
test_clockupdated	voided_atparamsr   returnc                 r    t          d|                     d|                                 |                    S ))
        Creates a credit grant.
        r   postrS   )r   _static_request	class_urlclsrS   s     r-   createzCreditGrant.create   sB         
 
 	
r,   c                    K   t          d|                     d|                                 |           d{V           S )rV   r   rW   rX   N)r   _static_request_asyncrZ   r[   s     r-   create_asynczCreditGrant.create_async   sd       ++ ,        
 
 	
r,   r   c                     t          d|                     dd                    t          |                    |                    S ))
        Expires a credit grant.
        r   rW   %/v1/billing/credit_grants/{id}/expirer9   rX   r   rY   formatr
   r\   r9   rS   s      r-   _cls_expirezCreditGrant._cls_expire   sZ     7>>"2 ?       	
 	
 		
r,   c                     dS rb   Nr+   r9   rS   s     r-   expirezCreditGrant.expire   	     	r,   c                     dS rj   r+   selfrS   s     r-   rl   zCreditGrant.expire   	     	r,   rh   c                     t          d|                     dd                    t          |                     d                              |                    S )rb   r   rW   rc   r9   rd   rX   r   _requestrf   r
   getro   s     r-   rl   zCreditGrant.expire   sd     MM7>>"488D>>22 ?      	
 	
 		
r,   c                    K   t          d|                     dd                    t          |                    |           d{V           S )rb   r   rW   rc   rd   rX   Nr   r_   rf   r
   rg   s      r-   _cls_expire_asynczCreditGrant._cls_expire_async   s|       ++7>>"2 ?    ,        	
 	
 		
r,   c                 
   K   dS rj   r+   rk   s     r-   expire_asynczCreditGrant.expire_async         	r,   c                 
   K   dS rj   r+   ro   s     r-   rz   zCreditGrant.expire_async         	r,   rx   c                    K   t          d|                     dd                    t          |                     d                              |           d{V           S )rb   r   rW   rc   r9   rd   rX   Nr   _request_asyncrf   r
   ru   ro   s     r-   rz   zCreditGrant.expire_async  s       %%7>>"488D>>22 ?    &        	
 	
 		
r,   r   c                     |                      d|                                 |          }t          |t                    s$t	          dt          |          j        z            |S )3
        Retrieve a list of credit grants.
        ru   rX   %Expected list object from API, got %s)rY   rZ   
isinstancer   	TypeErrorr0   r%   r\   rS   results      r-   listzCreditGrant.list*  sp     $$MMOO % 
 

 &*-- 	7<<(*  
 r,   c                    K   |                      d|                                 |           d{V }t          |t                    s$t	          dt          |          j        z            |S )r   ru   rX   Nr   )r_   rZ   r   r   r   r0   r%   r   s      r-   
list_asynczCreditGrant.list_async>  s       00MMOO 1 
 
 
 
 
 
 
 

 &*-- 	7<<(*  
 r,   r   c                     |                                  dt          |          }t          d|                     d||                    S ))
        Updates a credit grant.
        /r   rW   rX   )rZ   r
   r   rY   r\   r9   rS   urls       r-   modifyzCreditGrant.modifyR  sX     +b///:    
 
 	
r,   c                    K   |                                  dt          |          }t          d|                     d||           d{V           S )r   r   r   rW   rX   N)rZ   r
   r   r_   r   s       r-   modify_asynczCreditGrant.modify_asyncc  sz       +b///:++ ,        
 
 	
r,   r   c                 @     | |fi |}|                                  |S )+
        Retrieves a credit grant.
        )refreshr\   r9   rS   instances       r-   retrievezCreditGrant.retrievet  s2     3r$$V$$r,   c                 P   K    | |fi |}|                                  d{V  |S )r   N)refresh_asyncr   s       r-   retrieve_asynczCreditGrant.retrieve_async  sH       3r$$V$$$$&&&&&&&&&r,   r   c                     t          d|                     dd                    t          |                    |                    S )'
        Voids a credit grant.
        r   rW   #/v1/billing/credit_grants/{id}/voidrd   rX   re   rg   s      r-   _cls_void_grantzCreditGrant._cls_void_grant  sZ     5<<"2 =       	
 	
 		
r,   c                     dS r   Nr+   rk   s     r-   
void_grantzCreditGrant.void_grant  rm   r,   c                     dS r   r+   ro   s     r-   r   zCreditGrant.void_grant  rq   r,   r   c                     t          d|                     dd                    t          |                     d                              |                    S )r   r   rW   r   r9   rd   rX   rs   ro   s     r-   r   zCreditGrant.void_grant  sd     MM5<<"488D>>22 =      	
 	
 		
r,   c                    K   t          d|                     dd                    t          |                    |           d{V           S )r   r   rW   r   rd   rX   Nrw   rg   s      r-   _cls_void_grant_asyncz!CreditGrant._cls_void_grant_async  s|       ++5<<"2 =    ,        	
 	
 		
r,   c                 
   K   dS r   r+   rk   s     r-   void_grant_asynczCreditGrant.void_grant_async  r{   r,   c                 
   K   dS r   r+   ro   s     r-   r   zCreditGrant.void_grant_async  r}   r,   r   c                    K   t          d|                     dd                    t          |                     d                              |           d{V           S )r   r   rW   r   r9   rd   rX   Nr   ro   s     r-   r   zCreditGrant.void_grant_async  s       %%5<<"488D>>22 =    &        	
 	
 		
r,   )rA   rB   N)(r%   r&   r'   __doc__r   r   r   r)   r   r2   r@   r*   r   r   r(   boolr   classmethodr   r]   r`   rh   r   staticmethodrl   r	   rx   rz   r   r   r   r   r   r   r   r   r   r   r   r1   r+   r,   r-   r   r   $   s        
  	 '"89:   4 4 4 4 4 4 4 4*. . . . .l . . .* NNN----+,,,, LLL j)))) sm### 3-  	GGG NNN 38n 3- *++++ sm 56666 LLL } 
78
	
 
 
 [
 
78
	
 
 
 [
 

 &'@ A
	
 
 
 [
" !";<	   \ X 89	   X -((
89
	
 
 
 )(
" 

 &'@ A
	
 
 
 [
" !";<	   \ X 89	   X -..
89
	
 
 
 /.
" 56	M	"   [& 56	M	"   [& 

 &'@ A
	
 
 
 [
  

 &'@ A
	
 
 
 [
   &'B C	   [  &'B C	   [ 

 &'C D
	
 
 
 [
" !">?	   \ X ;<	   X +,,
;<
	
 
 
 -,
" 

 &'C D
	
 
 
 [
" !">?	   \ X ;<	   X 122
;<
	
 
 
 32
$  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      s   B A A A A A 4 4 4 4 4 4 * * * * * * = = = = = = . . . . . . A A A A A A : : : : : : : : A A A A A A A A A A A A A A A A < < < < < < < < < < :))))))                               :99999W W W W W-(&-(W W W W Wr,   