a
    !f1o                  	   @   s   d dl mZmZ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 d dlmZ d dlmZmZmZ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 ed ed Z'dS )    )CreateableAPIResourceDeletableAPIResourceListableAPIResourceSearchableAPIResourceUpdateableAPIResource)ExpandableField)
ListObject)SearchResultObject)RequestOptions)StripeObject)class_method_variant)ClassVarDictIteratorListOptionalUnioncastoverload)LiteralNotRequired	TypedDictUnpackTYPE_CHECKING)
quote_plus)Price)TaxCodec                	   @   sr  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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)< ee d*  ed+< ee! ed,< e"e	 ed-< e!ed.< e"e! ed/< eed0< e#e!e!f ed1< e!ed2< ed ed3< ee
 ed4< ee ed5< ee! ed6< ee d7  ed8< ed9 ed:< ee! ed;< eed<< ee! ed=< eed>  ed?< e$daee! ee! ee! ee! e%dA d dBdCdDZ&e$e!e%dE d dFdGdHZ'e(e)e!e%dE d dFdIdJZ*e(e%dE d dKdLdJZ*e+dMe%dE d dKdNdJZ*e$dbee! ee! ee! e%dO e,d  dPdQdRZ-e$e!e%dS d dTdUdVZ.e$e!e%dW d dTdXdYZ/e$e%dZ e0d  d[d\d]Z1e$e%dZ e2d  d[d^d_Z3e	e
d`Z4d@S )cProducta  
    Products describe the specific goods or services you offer to your customers.
    For example, you might offer a Standard and Premium version of your goods or service; each version would be a separate Product.
    They can be used in conjunction with [Prices](https://stripe.com/docs/api#prices) to configure pricing in Payment Links, Checkout, and Subscriptions.

    Related guides: [Set up a subscription](https://stripe.com/docs/billing/subscriptions/set-up-subscription),
    [share a Payment Link](https://stripe.com/docs/payment-links),
    [accept payments with Checkout](https://stripe.com/docs/payments/accept-a-payment#create-product-prices-upfront),
    and more about [Products and Prices](https://stripe.com/docs/products-prices/overview)
    productOBJECT_NAMEc                   @   s   e Zd ZU ee ed< dS )zProduct.FeaturenameN)__name__
__module____qualname__r   str__annotations__ r&   r&   ]/var/www/html/python-backend/venv/lib/python3.9/site-packages/stripe/api_resources/product.pyFeature<   s   
r(   c                   @   s.   e Zd ZU eed< eed< eed< eed< dS )zProduct.PackageDimensionsheightlengthweightwidthNr!   r"   r#   floatr%   r&   r&   r&   r'   PackageDimensionsB   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< ed	 ed
< ed ed< 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< ed ed< dS )Product.CreateParamsboolactive$Product.CreateParamsDefaultPriceDataZdefault_price_datar$   description	List[str]expandz!List[Product.CreateParamsFeature]featuresidimageszDict[str, str]metadatar    %Product.CreateParamsPackageDimensionspackage_dimensions	shippablestatement_descriptortax_codeLiteral['good', 'service']type
unit_labelurlNr!   r"   r#   r   r%   r$   r&   r&   r&   r'   CreateParamsT   s&   
rE   c                   @   s.   e Zd ZU eed< eed< eed< eed< dS )r;   r)   r*   r+   r,   Nr-   r&   r&   r&   r'   CreateParamsPackageDimensions   s
   
rF   c                   @   s   e Zd ZU eed< dS )zProduct.CreateParamsFeaturer    Nr!   r"   r#   r$   r%   r&   r&   r&   r'   CreateParamsFeature   s   
rH   c                   @   sR   e Zd ZU eed< ed ed< ed ed< ed ed< ed ed	< ed
 ed< dS )r3   currencyz>Dict[str, Product.CreateParamsDefaultPriceDataCurrencyOptions]Zcurrency_options-Product.CreateParamsDefaultPriceDataRecurringZ	recurring0Literal['exclusive', 'inclusive', 'unspecified']tax_behaviorintunit_amountr$   unit_amount_decimalN)r!   r"   r#   r$   r%   r   r&   r&   r&   r'   CreateParamsDefaultPriceData   s   
rP   c                   @   s&   e Zd ZU ed ed< ed ed< dS )rJ   )daymonthweekyearintervalrM   Zinterval_countN)r!   r"   r#   r   r%   r   r&   r&   r&   r'   %CreateParamsDefaultPriceDataRecurring   s   
rV   c                   @   sJ   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
< dS )z3Product.CreateParamsDefaultPriceDataCurrencyOptionsCProduct.CreateParamsDefaultPriceDataCurrencyOptionsCustomUnitAmountZcustom_unit_amountrK   rL   z=List[Product.CreateParamsDefaultPriceDataCurrencyOptionsTier]ZtiersrM   rN   r$   rO   Nr!   r"   r#   r   r%   r&   r&   r&   r'   +CreateParamsDefaultPriceDataCurrencyOptions   s   
rY   c                   @   sR   e Zd ZU ed ed< ed ed< ed ed< ed ed< eed ef ed< d	S )
z7Product.CreateParamsDefaultPriceDataCurrencyOptionsTierrM   Zflat_amountr$   Zflat_amount_decimalrN   rO   infZup_toN)r!   r"   r#   r   r%   r   r   rM   r&   r&   r&   r'   /CreateParamsDefaultPriceDataCurrencyOptionsTier   s   
r[   c                   @   s:   e Zd ZU eed< ed ed< ed ed< ed ed< dS )rW   enabledrM   maximumminimumpresetN)r!   r"   r#   r1   r%   r   r&   r&   r&   r'   ;CreateParamsDefaultPriceDataCurrencyOptionsCustomUnitAmount  s
   
r`   c                   @   s   e Zd ZdS )Product.DeleteParamsN)r!   r"   r#   r&   r&   r&   r'   DeleteParams!  s   rb   c                   @   s   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< ed ed< dS )Product.ListParamsr1   r2   zProduct.ListParamsCreated|intcreatedr$   Zending_beforer5   r6   ZidsrM   limitr=   Zstarting_afterr@   rA   rC   NrX   r&   r&   r&   r'   
ListParams$  s   
rf   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Product.ListParamsCreatedrM   gtZgteltZlteNrX   r&   r&   r&   r'   ListParamsCreatedN  s
   
ri   c                   @   s   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< ed ed< ed ed< ed ed< ed ed< ed ed< dS )Product.ModifyParamsr1   r2   r$   default_pricezLiteral['']|strr4   r5   r6   z-Literal['']|List[Product.ModifyParamsFeature]r7   zLiteral['']|List[str]r9   zLiteral['']|Dict[str, str]r:   r    z1Literal['']|Product.ModifyParamsPackageDimensionsr<   r=   r>   r?   rB   rC   NrX   r&   r&   r&   r'   ModifyParams`  s"   
rl   c                   @   s.   e Zd ZU eed< eed< eed< eed< dS )z%Product.ModifyParamsPackageDimensionsr)   r*   r+   r,   Nr-   r&   r&   r&   r'   ModifyParamsPackageDimensions  s
   
rm   c                   @   s   e Zd ZU eed< dS )zProduct.ModifyParamsFeaturer    NrG   r&   r&   r&   r'   ModifyParamsFeature  s   
rn   c                   @   s   e Zd ZU ed ed< dS )Product.RetrieveParamsr5   r6   NrX   r&   r&   r&   r'   RetrieveParams  s   
rp   c                   @   s:   e Zd ZU ed ed< ed ed< ed ed< eed< dS )	Product.SearchParamsr5   r6   rM   re   r$   pagequeryNrD   r&   r&   r&   r'   SearchParams  s
   
rt   r2   rd   r   rk   r4   r7   r8   r9   Zlivemoder:   r    objectr<   r=   r>   r   r?   )ZgoodZservicerA   rB   updatedrC   TZdeletedNr0   )api_keyidempotency_keystripe_versionstripe_accountparamsreturnc                 K   s    t d| d|  |||||S )z/
        Creates a new product object.
        r   post)r   _static_request	class_url)clsrw   rx   ry   rz   r{   r&   r&   r'   create   s    zProduct.createra   )sidr{   r|   c                 K   s*   d|   t|f }td| jd||dS )
        Delete a product. Deleting a product is only possible if it has no prices associated with it. Additionally, deleting a product with type=good is only possible if it has no SKUs associated with it.
        %s/%sr   deleter{   r   r   r   r~   )r   r   r{   rC   r&   r&   r'   _cls_delete;  s
    zProduct._cls_deletec                 K   s   dS r   Nr&   )r   r{   r&   r&   r'   r   H  s    zProduct.delete)r{   r|   c                 K   s   dS r   r&   selfr{   r&   r&   r'   r   R  s    r   c                 K   s   | j d|  |dS )r   r   r   )Z_request_and_refreshZinstance_urlr   r&   r&   r'   r   Y  s
    rc   )rw   ry   rz   r{   r|   c                 K   s:   | j d|  ||||d}t|ts6tdt|j |S )z
        Returns a list of your products. The products are returned sorted by creation date, with the most recently created products appearing first.
        get)rw   ry   rz   r{   z%Expected list object from API, got %s)r~   r   
isinstancer   	TypeErrorrA   r!   )r   rw   ry   rz   r{   resultr&   r&   r'   listf  s    
zProduct.listrj   )r8   r{   r|   c                 K   s*   d|   t|f }td| jd||dS )z
        Updates the specific product by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
        r   r   r}   r   r   )r   r8   r{   rC   r&   r&   r'   modify  s
    zProduct.modifyro   c                 K   s   | |fi |}|   |S )z
        Retrieves the details of an existing product. Supply the unique product ID from either a product creation request or the product list, and Stripe will return the corresponding product information.
        )refresh)r   r8   r{   instancer&   r&   r'   retrieve  s    zProduct.retrieverq   )kwargsr|   c                 O   s   | j |ddi|S )a  
        Search for products you've previously created using Stripe's [Search Query Language](https://stripe.com/docs/search#search-query-language).
        Don't use search in read-after-write flows where strict consistency is necessary. Under normal operating
        conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up
        to an hour behind during outages. Search functionality is not available to merchants in India.
        Z
search_urlz/v1/products/search)Z_searchr   argsr   r&   r&   r'   search  s    
zProduct.searchc                 O   s   | j |i | S )N)r   Zauto_paging_iterr   r&   r&   r'   search_auto_paging_iter  s    zProduct.search_auto_paging_iter)r7   r<   )NNNN)NNN)5r!   r"   r#   __doc__r   r   r   r%   r   r(   r/   r
   rE   r   rF   rH   rP   rV   rY   r[   r`   rb   rf   ri   rl   rm   rn   rp   rt   r1   rM   r   r   r$   r   r   classmethodr   r   r   r   staticmethodr   r   r   r   r   r   r	   r   r   r   Z_inner_class_typesr&   r&   r&   r'   r   (   s   
G

*?       
r   N)(Zstripe.api_resources.abstractr   r   r   r   r   Z%stripe.api_resources.expandable_fieldr   Z stripe.api_resources.list_objectr   Z)stripe.api_resources.search_result_objectr	   Zstripe.request_optionsr
   Zstripe.stripe_objectr   Zstripe.utilr   typingr   r   r   r   r   r   r   r   Ztyping_extensionsr   r   r   r   r   urllib.parser   Zstripe.api_resources.pricer   Zstripe.api_resources.tax_coder   r   r&   r&   r&   r'   <module>   s&   (

