o
    L)j9                     @   s  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 d dlmZmZ d dlmZmZmZmZmZ d d	lmZmZmZ erxd 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 ded ed ed Z*dS )    )CreateableAPIResource)ExpandableField)
ListObject)ListableAPIResource)StripeObjectUntypedStripeObject)UpdateableAPIResource)class_method_variantsanitize_id)ClassVarListOptionalcastoverload)LiteralUnpackTYPE_CHECKING)Customer)CreditGrantCreateParams)CreditGrantExpireParams)CreditGrantListParams)CreditGrantModifyParams)CreditGrantRetrieveParams)CreditGrantVoidGrantParams)	TestClockc                   @   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
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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d Zeded dd fd!d"Zededed# dd fd$d%Zeededed# dd fd&d'Zeded# dd fd(d'Zed)ded# dd fd*d'Zededed# dd fd+d,Zeededed# dd fd-d.Zeded# dd fd/d.Zed0ded# dd fd1d.Zeded2 ded  fd3d4Zeded2 ded  fd5d6Zededed7 dd fd8d9Zededed7 dd fd:d;Z ededed< dd fd=d>Z!ededed< dd fd?d@Z"edededA dd fdBdCZ#eedededA dd fdDdEZ$ededA dd fdFdEZ$edGdedA dd fdHdEZ$edededA dd fdIdJZ%eedededA dd fdKdLZ&ededA dd fdMdLZ&edNdedA dd fdOdLZ&e	e
dPZ'dQS )R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                   @   sB   e Zd ZU G dd deZee ed< 	 ed ed< 	 deiZdS )zCreditGrant.Amountc                   @   s    e Zd ZU eed< 	 eed< dS )zCreditGrant.Amount.MonetarycurrencyvalueN)__name__
__module____qualname__str__annotations__int r%   r%   /var/www/html/finance-dev.cargoinsureonline.com/_shared/backend-venv/lib/python3.10/site-packages/stripe/billing/_credit_grant.pyMonetary4   s
   
 r'   monetarytypeN)	r   r    r!   r   r'   r   r#   r   _inner_class_typesr%   r%   r%   r&   Amount3   s   
 
r+   c                   @   s.   e Zd ZU G dd deZeed< deiZdS )zCreditGrant.ApplicabilityConfigc                   @   sJ   e Zd ZU G dd deZeed  ed< 	 eee  ed< 	 deiZ	dS )z%CreditGrant.ApplicabilityConfig.Scopec                   @   s   e Zd ZU ee ed< dS )z+CreditGrant.ApplicabilityConfig.Scope.PriceidN)r   r    r!   r   r"   r#   r%   r%   r%   r&   PriceJ   s   
 r-   metered
price_typepricesN)
r   r    r!   r   r-   r   r   r#   r   r*   r%   r%   r%   r&   ScopeI   s   
 r1   scopeN)r   r    r!   r   r1   r#   r*   r%   r%   r%   r&   ApplicabilityConfigH   s   
 r3   amountapplicability_config)paidpromotionalcategorycreatedr   customercustomer_accounteffective_at
expires_atr,   livemodemetadatanameobjectpriorityr   
test_clockupdated	voided_atparamsr   returnc                 K   s   t d| jd|  |dS ))
        Creates a credit grant.
        r   postrF   )r   _static_request	class_urlclsrF   r%   r%   r&   create   s   zCreditGrant.createc                    s"   t d| jd|  |dI dH S )rH   r   rI   rJ   N)r   _static_request_asyncrL   rM   r%   r%   r&   create_async   s   
zCreditGrant.create_asyncr   c                 K   "   t d| jddjt|d|dS ))
        Expires a credit grant.
        r   rI   %/v1/billing/credit_grants/{id}/expirer,   rJ   r   rK   formatr
   rN   r,   rF   r%   r%   r&   _cls_expire      zCreditGrant._cls_expirec                 K      dS rS   Nr%   r,   rF   r%   r%   r&   expire      zCreditGrant.expirec                 K   r[   r\   r%   selfrF   r%   r%   r&   r^         rY   c              	   K   *   t d| jddjt| jdd|dS )rS   r   rI   rT   r,   rU   rJ   r   _requestrW   r
   _datagetr`   r%   r%   r&   r^         c                    *   t d| jddjt|d|dI dH S )rS   r   rI   rT   rU   rJ   Nr   rP   rW   r
   rX   r%   r%   r&   _cls_expire_async      
zCreditGrant._cls_expire_asyncc                       dS r\   r%   r]   r%   r%   r&   expire_async     zCreditGrant.expire_asyncc                    rm   r\   r%   r`   r%   r%   r&   rn        rk   c              	      2   t d| jddjt| jdd|dI dH S )rS   r   rI   rT   r,   rU   rJ   Nr   _request_asyncrW   r
   rf   rg   r`   r%   r%   r&   rn        
r   c                 K   s4   | j d|  |d}t|tstdt|j |S )3
        Retrieve a list of credit grants.
        rg   rJ   %Expected list object from API, got %s)rK   rL   
isinstancer   	TypeErrorr)   r   rN   rF   resultr%   r%   r&   list*  s   
zCreditGrant.listc                    s<   | j d|  |dI dH }t|tstdt|j |S )ru   rg   rJ   Nrv   )rP   rL   rw   r   rx   r)   r   ry   r%   r%   r&   
list_async>  s   
zCreditGrant.list_asyncr   c                 K   s*   d|   t|f }td| jd||dS ))
        Updates a credit grant.
        %s/%sr   rI   rJ   )rL   r
   r   rK   rN   r,   rF   urlr%   r%   r&   modifyR  s   zCreditGrant.modifyc                    s2   d|   t|f }td| jd||dI dH S )r}   r~   r   rI   rJ   N)rL   r
   r   rP   r   r%   r%   r&   modify_asyncc  s   
zCreditGrant.modify_asyncr   c                 K   s   | |fi |}|   |S )+
        Retrieves a credit grant.
        )refreshrN   r,   rF   instancer%   r%   r&   retrievet  s   zCreditGrant.retrievec                    s$   | |fi |}|  I dH  |S )r   N)refresh_asyncr   r%   r%   r&   retrieve_async  s   zCreditGrant.retrieve_asyncr   c                 K   rR   )'
        Voids a credit grant.
        r   rI   #/v1/billing/credit_grants/{id}/voidrU   rJ   rV   rX   r%   r%   r&   _cls_void_grant  rZ   zCreditGrant._cls_void_grantc                 K   r[   r   Nr%   r]   r%   r%   r&   
void_grant  r_   zCreditGrant.void_grantc                 K   r[   r   r%   r`   r%   r%   r&   r     rb   r   c              	   K   rc   )r   r   rI   r   r,   rU   rJ   rd   r`   r%   r%   r&   r     rh   c                    ri   )r   r   rI   r   rU   rJ   Nrj   rX   r%   r%   r&   _cls_void_grant_async  rl   z!CreditGrant._cls_void_grant_asyncc                    rm   r   r%   r]   r%   r%   r&   void_grant_async  ro   zCreditGrant.void_grant_asyncc                    rm   r   r%   r`   r%   r%   r&   r     rp   r   c              	      rq   )r   r   rI   r   r,   rU   rJ   Nrr   r`   r%   r%   r&   r     rt   )r4   r5   N)(r   r    r!   __doc__r   r   r   r#   r   r+   r3   r$   r   r   r"   boolr   classmethodr   rO   rQ   rY   r   staticmethodr^   r	   rk   rn   r   r{   r|   r   r   r   r   r   r   r   r   r*   r%   r%   r%   r&   r   $   s  
 


r   N)+stripe._createable_api_resourcer   stripe._expandable_fieldr   stripe._list_objectr   stripe._listable_api_resourcer   stripe._stripe_objectr   r   stripe._updateable_api_resourcer   stripe._utilr	   r
   typingr   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%   r&   <module>   s.   
