a
    !f8                     @   s   d dl mZmZ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mZmZmZ d dlmZmZmZmZmZ d dlmZ erd d	lmZ d d
lmZ G dd ded ed ed ZdS )    )CreateableAPIResourceListableAPIResourceUpdateableAPIResource)ExpandableField)
ListObject)RequestOptions)StripeObject)ClassVarDictListOptionalcast)LiteralNotRequired	TypedDictUnpackTYPE_CHECKING)
quote_plus)Coupon)Customerc                	   @   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G dd	 d	eZG d
d deZG dd de
ZG dd deZG dd de
ZG dd deZG dd deZG dd de
Zeed< eed< ded< eed< e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d ed$< e	ed%< eed&< ed7ee ee ee ee ed( d d)d*d+Zed8ee ee ee ed, ed  d-d.d/Zeeed0 d d1d2d3Z eeed4 d d1d5d6Z!d%e	iZ"d'S )9PromotionCodez
    A Promotion Code represents a customer-redeemable code for a [coupon](https://stripe.com/docs/api#coupons). It can be used to
    create multiple codes for a single coupon.
    Zpromotion_codeOBJECT_NAMEc                   @   s`   e Zd ZU G dd deZeeeef  ed< e	ed< ee
 ed< ee ed< deiZdgZdS )zPromotionCode.Restrictionsc                   @   s   e Zd ZU eed< dS )z*PromotionCode.Restrictions.CurrencyOptionsminimum_amountN)__name__
__module____qualname__int__annotations__ r   r   d/var/www/html/python-backend/venv/lib/python3.9/site-packages/stripe/api_resources/promotion_code.pyCurrencyOptions(   s   
r    currency_optionsfirst_time_transactionr   minimum_amount_currencyN)r   r   r   r   r    r   r
   strr   boolr   _inner_class_typesZ_inner_class_dictsr   r   r   r   Restrictions'   s   
r'   c                   @   sv   e Zd ZU ed ed< ed ed< eed< ed ed< ed ed< ed	 ed
< ed	 ed< ed ed< ed ed< dS )PromotionCode.CreateParamsr%   activer$   codecouponcustomer	List[str]expandr   
expires_atmax_redemptionszDict[str, str]metadata&PromotionCode.CreateParamsRestrictionsrestrictionsN)r   r   r   r   r   r$   r   r   r   r   CreateParamsA   s   
r4   c                   @   s>   e Zd ZU ed ed< ed ed< ed ed< ed ed< d	S )
r2   z@Dict[str, PromotionCode.CreateParamsRestrictionsCurrencyOptions]r!   r%   r"   r   r   r$   r#   Nr   r   r   r   r   r   r   r   r   CreateParamsRestrictionsg   s   
r6   c                   @   s   e Zd ZU ed ed< dS )z5PromotionCode.CreateParamsRestrictionsCurrencyOptionsr   r   Nr5   r   r   r   r   'CreateParamsRestrictionsCurrencyOptions{   s   
r7   c                   @   sz   e Zd ZU ed ed< ed ed< ed ed< ed ed< ed ed< ed ed	< ed
 ed< ed ed< ed ed< dS )PromotionCode.ListParamsr%   r)   r$   r*   r+   z#PromotionCode.ListParamsCreated|intcreatedr,   Zending_beforer-   r.   r   limitZstarting_afterNr5   r   r   r   r   
ListParams   s   
r;   c                   @   s>   e Zd ZU ed ed< ed ed< ed ed< ed ed< dS )zPromotionCode.ListParamsCreatedr   gtZgteltZlteNr5   r   r   r   r   ListParamsCreated   s
   
r>   c                   @   s>   e Zd ZU ed ed< ed ed< ed ed< ed ed< d	S )
PromotionCode.ModifyParamsr%   r)   r-   r.   zLiteral['']|Dict[str, str]r1   &PromotionCode.ModifyParamsRestrictionsr3   Nr5   r   r   r   r   ModifyParams   s
   
rA   c                   @   s   e Zd ZU ed ed< dS )r@   z@Dict[str, PromotionCode.ModifyParamsRestrictionsCurrencyOptions]r!   Nr5   r   r   r   r   ModifyParamsRestrictions   s   
rB   c                   @   s   e Zd ZU ed ed< dS )z5PromotionCode.ModifyParamsRestrictionsCurrencyOptionsr   r   Nr5   r   r   r   r   'ModifyParamsRestrictionsCurrencyOptions   s   
rC   c                   @   s   e Zd ZU ed ed< dS )PromotionCode.RetrieveParamsr-   r.   Nr5   r   r   r   r   RetrieveParams   s   
rE   r)   r*   r   r+   r9   r   r,   r/   idZlivemoder0   r1   objectr3   Ztimes_redeemedNr(   )api_keyidempotency_keystripe_versionstripe_accountparamsreturnc                 K   s    t d| d|  |||||S )z
        A promotion code points to a coupon. You can optionally restrict the code to a specific customer, redemption limit, and expiration date.
        r   post)r   _static_request	class_url)clsrH   rI   rJ   rK   rL   r   r   r   create  s    zPromotionCode.creater8   )rH   rJ   rK   rL   rM   c                 K   s:   | j d|  ||||d}t|ts6tdt|j |S )z9
        Returns a list of your promotion codes.
        get)rH   rJ   rK   rL   z%Expected list object from API, got %s)rO   rP   
isinstancer   	TypeErrortyper   )rQ   rH   rJ   rK   rL   resultr   r   r   list.  s    
zPromotionCode.listr?   )rF   rL   rM   c                 K   s*   d|   t|f }td| jd||dS )z
        Updates the specified promotion code by setting the values of the parameters passed. Most fields are, by design, not editable.
        z%s/%sr   rN   )rL   )rP   r   r   rO   )rQ   rF   rL   urlr   r   r   modifyL  s
    zPromotionCode.modifyrD   c                 K   s   | |fi |}|   |S )z
        Retrieves the promotion code with the given ID. In order to retrieve a promotion code by the customer-facing code use [list](https://stripe.com/docs/api/promotion_codes/list) with the desired code.
        )refresh)rQ   rF   rL   instancer   r   r   retrieveY  s    zPromotionCode.retrieve)NNNN)NNN)#r   r   r   __doc__r   r	   r   r   r   r'   r   r4   r   r6   r7   r;   r>   rA   rB   rC   rE   r%   r$   r   r   r   r
   classmethodr   rR   r   rX   rZ   r]   r&   r   r   r   r   r      s|   
&&       
r   N)Zstripe.api_resources.abstractr   r   r   Z%stripe.api_resources.expandable_fieldr   Z stripe.api_resources.list_objectr   Zstripe.request_optionsr   Zstripe.stripe_objectr   typingr	   r
   r   r   r   Ztyping_extensionsr   r   r   r   r   urllib.parser   Zstripe.api_resources.couponr   Zstripe.api_resources.customerr   r   r   r   r   r   <module>   s   
