o
    Bi                  
   @   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	 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m Z m!Z!m"Z" d dl#m$Z$m%Z%m&Z&m'Z'm(Z( e(rd dl)m*Z* d dl+m,Z, d dl-m.Z. edG dd ded ed e	d ed ed Z/dS )    )CreateableAPIResource)DeletableAPIResource)ExpandableField)
ListObject)ListableAPIResource)nested_resource_class_methods)RequestOptions)SearchResultObject)SearchableAPIResource)StripeObject)UpdateableAPIResource)class_method_variantsanitize_id)	AsyncIteratorClassVarDictIteratorListOptionalUnioncastoverload)LiteralNotRequired	TypedDictUnpackTYPE_CHECKING)Price)ProductFeature)TaxCodefeaturec                	   @   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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d0< 	 e"ed1< 	 e#e$d2  ed3< 	 e#e% ed4< 	 e%ed5< 	 e&e% ed6< 	 e!ed7< 	 e&e	 ed8< 	 e'e%e%f ed9< 	 e%ed:< 	 ed ed;< 	 e#e
 ed<< 	 e#e! ed=< 	 e#e% ed>< 	 e#e$d?  ed@< 	 edA edB< 	 e#e% edC< 	 e"edD< 	 e#e% edE< 	 e#edF  edG< 	 e(dHe)dI dJd fdKdLZ*e(dHe)dI dJd fdMdNZ+e(dOe%dHe)dP dJd fdQdRZ,e-e.dOe%dHe)dP dJd fdSdTZ/e-dHe)dP dJd fdUdTZ/e0dVdHe)dP dJd fdWdTZ/e(dOe%dHe)dP dJd fdXdYZ1e-e.dOe%dHe)dP dJd fdZd[Z2e-dHe)dP dJd fd\d[Z2e0d]dHe)dP dJd fd^d[Z2e(dHe)d_ dJe3d  fd`daZ4e(dHe)d_ dJe3d  fdbdcZ5e(d5e%dHe)dd dJd fdedfZ6e(d5e%dHe)dd dJd fdgdhZ7e(d5e%dHe)di dJd fdjdkZ8e(d5e%dHe)di dJd fdldmZ9e(dne)do dJe:d  fdpdqZ;e(dne)do dJe:d  fdrdsZ<e(dne)do dJe=d  fdtduZ>e(dne)do dJe?d  fdvdwZ@e(de%d5e%dHe)dx dJdyfdzd{ZAe(de%d5e%dHe)dx dJdyfd|d}ZBe(de%dHe)d~ dJe3dy fddZCe(de%dHe)d~ dJe3dy fddZDe(de%dHe)d dJdyfddZEe(de%dHe)d dJdyfddZFe(de%d5e%dHe)d dJdyfddZGe(de%d5e%dHe)d dJdyfddZHe	e
dZIdS )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.MarketingFeaturenameN)__name__
__module____qualname__r   str__annotations__ r*   r*   O/var/www/html/Trade-python/venv/lib/python3.10/site-packages/stripe/_product.pyMarketingFeature=   s   
 r,   c                   @   4   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+   PackageDimensionsC      
 r4   c                   @   s(   e Zd ZU eed< 	 eee  ed< dS )Product.CreateFeatureParamsentitlement_featureexpandN)r%   r&   r'   r(   r)   r   r   r*   r*   r*   r+   CreateFeatureParamsU   s
   
 r9   c                   @   s   e Zd ZU ee ed< 	 ed ed< 	 ee ed< 	 eee  ed< 	 ee ed< 	 eee  ed< 	 eed  ed	< 	 eeeef  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d< 	 ee ed< 	 ee ed< dS )Product.CreateParamsactive$Product.CreateParamsDefaultPriceDatadefault_price_datadescriptionr8   idimages$Product.CreateParamsMarketingFeaturemarketing_featuresmetadatar$   %Product.CreateParamsPackageDimensionspackage_dimensions	shippablestatement_descriptortax_codegoodservicetype
unit_labelurlN)
r%   r&   r'   r   boolr)   r(   r   r   r   r*   r*   r*   r+   CreateParams_   sJ   
 rP   c                   @   sh   e Zd ZU eed< 	 eeedf  ed< 	 ed ed< 	 eed  ed< 	 ee ed< 	 ee ed	< d
S )r<   currency3Product.CreateParamsDefaultPriceDataCurrencyOptionscurrency_options-Product.CreateParamsDefaultPriceDataRecurring	recurring	exclusive	inclusiveunspecifiedtax_behaviorunit_amountunit_amount_decimalN)	r%   r&   r'   r(   r)   r   r   r   intr*   r*   r*   r+   CreateParamsDefaultPriceData   s"   
 
r^   c                   @   sZ   e Zd ZU ed ed< 	 eed  ed< 	 eed  ed< 	 ee ed< 	 ee ed< d	S )
rR   CProduct.CreateParamsDefaultPriceDataCurrencyOptionsCustomUnitAmountcustom_unit_amountrV   rZ   7Product.CreateParamsDefaultPriceDataCurrencyOptionsTiertiersr[   r\   N)	r%   r&   r'   r   r)   r   r   r]   r(   r*   r*   r*   r+   +CreateParamsDefaultPriceDataCurrencyOptions   s"   
 rc   c                   @   s@   e Zd ZU eed< 	 ee ed< 	 ee ed< 	 ee ed< dS )r_   enabledmaximumminimumpresetN)r%   r&   r'   rO   r)   r   r]   r*   r*   r*   r+   ;CreateParamsDefaultPriceDataCurrencyOptionsCustomUnitAmount   s   
 rh   c                   @   sZ   e Zd ZU ee ed< 	 ee ed< 	 ee ed< 	 ee ed< 	 eed ef ed< dS )ra   flat_amountflat_amount_decimalr[   r\   infup_toN)	r%   r&   r'   r   r]   r)   r(   r   r   r*   r*   r*   r+   /CreateParamsDefaultPriceDataCurrencyOptionsTier   s   
 rm   c                   @   s(   e Zd ZU ed ed< 	 ee ed< dS )rT   )daymonthweekyearintervalinterval_countN)r%   r&   r'   r   r)   r   r]   r*   r*   r*   r+   %CreateParamsDefaultPriceDataRecurring  s
   
 rt   c                   @      e Zd ZU eed< dS )rA   r$   Nr%   r&   r'   r(   r)   r*   r*   r*   r+   CreateParamsMarketingFeature     
 rw   c                   @   r-   )rD   r.   r/   r0   r1   Nr2   r*   r*   r*   r+   CreateParamsPackageDimensions  r5   ry   c                   @      e Zd ZdS )Product.DeleteFeatureParamsNr%   r&   r'   r*   r*   r*   r+   DeleteFeatureParams.      r}   c                   @   rz   )Product.DeleteParamsNr|   r*   r*   r*   r+   DeleteParams1  r~   r   c                   @   sH   e Zd ZU ee ed< 	 eee  ed< 	 ee ed< 	 ee ed< dS )Product.ListFeaturesParamsending_beforer8   limitstarting_afterN)r%   r&   r'   r   r(   r)   r   r]   r*   r*   r*   r+   ListFeaturesParams4  s   
 r   c                   @   s   e Zd ZU ee ed< 	 ed ed< 	 ee ed< 	 eee  ed< 	 eee  ed< 	 ee ed< 	 ee ed< 	 ee ed	< 	 ee	d
  ed< 	 ee ed< dS )Product.ListParamsr;   zProduct.ListParamsCreated|intcreatedr   r8   idsr   rF   r   rI   rL   rN   N)
r%   r&   r'   r   rO   r)   r(   r   r]   r   r*   r*   r*   r+   
ListParamsF  s*   
 r   c                   @   sD   e Zd ZU ee ed< 	 ee ed< 	 ee ed< 	 ee ed< dS )zProduct.ListParamsCreatedgtgteltlteN)r%   r&   r'   r   r]   r)   r*   r*   r*   r+   ListParamsCreatedp  s   
 r   c                   @   s   e Zd ZU ee ed< 	 ee ed< 	 ed ed< 	 eee  ed< 	 ed ed< 	 ed ed	< 	 ed
 ed< 	 ee ed< 	 ed ed< 	 ee ed< 	 ee ed< 	 ed ed< 	 ed ed< 	 ed ed< dS )Product.ModifyParamsr;   default_pricezLiteral['']|strr>   r8   zLiteral['']|List[str]r@   z6Literal['']|List[Product.ModifyParamsMarketingFeature]rB   zLiteral['']|Dict[str, str]rC   r$   z1Literal['']|Product.ModifyParamsPackageDimensionsrE   rF   rG   rH   rM   rN   N)r%   r&   r'   r   rO   r)   r(   r   r*   r*   r*   r+   ModifyParams  sB   
 r   c                   @   ru   )z$Product.ModifyParamsMarketingFeaturer$   Nrv   r*   r*   r*   r+   ModifyParamsMarketingFeature  rx   r   c                   @   r-   )z%Product.ModifyParamsPackageDimensionsr.   r/   r0   r1   Nr2   r*   r*   r*   r+   ModifyParamsPackageDimensions  r5   r   c                   @      e Zd ZU eee  ed< dS )Product.RetrieveFeatureParamsr8   Nr%   r&   r'   r   r   r(   r)   r*   r*   r*   r+   RetrieveFeatureParams     
 r   c                   @   r   )Product.RetrieveParamsr8   Nr   r*   r*   r*   r+   RetrieveParams  r   r   c                   @   sD   e Zd ZU eee  ed< 	 ee ed< 	 ee ed< 	 eed< dS )Product.SearchParamsr8   r   pagequeryN)r%   r&   r'   r   r   r(   r)   r]   r*   r*   r*   r+   SearchParams  s   
 r   r;   r   r   r   r>   r?   r@   livemoderB   rC   r$   objectrE   rF   rG   r   rH   rI   rL   rM   updatedrN   Tdeletedparamsr:   returnc                 K   s   t d| jd|  |dS )/
        Creates a new product object.
        r!   postr   )r   _static_request	class_urlclsr   r*   r*   r+   createJ  s   zProduct.createc                    s"   t d| jd|  |dI dH S )r   r!   r   r   N)r   _static_request_asyncr   r   r*   r*   r+   create_asyncX  s   
zProduct.create_asyncsidr   c                 K   *   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!   deleter   r   r   r   r   r   r   r   rN   r*   r*   r+   _cls_deleteh     zProduct._cls_deletec                 K      dS r   Nr*   r   r   r*   r*   r+   r   y  s   zProduct.deletec                 K   r   r   r*   selfr   r*   r*   r+   r     s   r   c                 K   s   | j d|  |dS )r   r   r   )_request_and_refreshinstance_urlr   r*   r*   r+   r     s
   c                    2   d|   t|f }td| jd||dI dH S )r   r   r!   r   r   Nr   r   r   r   r   r*   r*   r+   _cls_delete_async     
zProduct._cls_delete_asyncc                       dS r   r*   r   r*   r*   r+   delete_async  s   zProduct.delete_asyncc                    r   r   r*   r   r*   r*   r+   r     s   r   c                    s   | j d|  |dI dH S )r   r   r   N)_request_and_refresh_asyncr   r   r*   r*   r+   r     s   r   c                 K   s4   | j d|  |d}t|tstdt|j |S )
        Returns a list of your products. The products are returned sorted by creation date, with the most recently created products appearing first.
        getr   %Expected list object from API, got %s)r   r   
isinstancer   	TypeErrorrL   r%   r   r   resultr*   r*   r+   list  s   
zProduct.listc                    s<   | j d|  |dI dH }t|tstdt|j |S )r   r   r   Nr   )r   r   r   r   r   rL   r%   r   r*   r*   r+   
list_async  s   
zProduct.list_asyncr   c                 K   r   )
        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   r?   r   rN   r*   r*   r+   modify  r   zProduct.modifyc                    r   )r   r   r!   r   r   Nr   r   r*   r*   r+   modify_async  r   zProduct.modify_asyncr   c                 K   s   | |fi |}|   |S )
        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   r?   r   instancer*   r*   r+   retrieve  s   zProduct.retrievec                    s$   | |fi |}|  I dH  |S )r   N)refresh_asyncr   r*   r*   r+   retrieve_async  s   zProduct.retrieve_asynckwargsr   c                 O   s   | j |ddi|S )  
        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.
        
search_url/v1/products/search)_searchr   argsr   r*   r*   r+   search(  s   
zProduct.searchc                    s   | j |ddi|I dH S )r   r   r   N)_search_asyncr   r*   r*   r+   search_async4  s   
zProduct.search_asyncc                 O   s   | j |i | S N)r   auto_paging_iterr   r*   r*   r+   search_auto_paging_iterB  s   zProduct.search_auto_paging_iterc                    s   | j |i |I d H  S r   )r   r   r   r*   r*   r+   search_auto_paging_iter_asyncH  s   z%Product.search_auto_paging_iter_asyncr{   r   c                 K   (   t d| jddjt|t|d|dS )=
        Deletes the feature attachment to a product
        r   r   $/v1/products/{product}/features/{id}r"   r?   r   r   r   formatr   r   r"   r?   r   r*   r*   r+   delete_featureN     
zProduct.delete_featurec                    0   t d| jddjt|t|d|dI dH S )r   r   r   r   r   r   Nr   r   r   r   r   r*   r*   r+   delete_feature_asyncc     

zProduct.delete_feature_asyncr   c                 K   s&   t td | jddjt|d|dS );
        Retrieve a list of features for a product
        r   r   /v1/products/{product}/featuresr"   r   )r   r   r   r   r   r   r"   r   r*   r*   r+   list_featuresx  s   zProduct.list_featuresc                    s.   t td | jddjt|d|dI dH S )r   r   r   r   r   r   N)r   r   r   r   r   r   r*   r*   r+   list_features_async  s   
zProduct.list_features_asyncr6   c                 K   s"   t d| jddjt|d|dS )_
        Creates a product_feature, which represents a feature attachment to a product
        r   r   r   r   r   r   r   r*   r*   r+   create_feature  s   zProduct.create_featurec                    s*   t d| jddjt|d|dI dH S )r   r   r   r   r   r   Nr   r   r*   r*   r+   create_feature_async  s   
zProduct.create_feature_asyncr   c                 K   r   )a
        Retrieves a product_feature, which represents a feature attachment to a product
        r   r   r   r   r   r   r   r*   r*   r+   retrieve_feature  r   zProduct.retrieve_featurec                    r   )r   r   r   r   r   r   Nr   r   r*   r*   r+   retrieve_feature_async  r   zProduct.retrieve_feature_async)rB   rE   N)Jr%   r&   r'   __doc__r#   r   r   r)   r   r,   r4   r   r9   rP   r   r^   rc   rh   rm   rt   rw   ry   r}   r   r   r   r   r   r   r   r   r   r   rO   r]   r   r   r(   r   r   classmethodr   r   r   r   r   staticmethodr   r   r   r   r   r   r   r   r   r   r   r	   r   r   r   r   r   r   r   r   r   r   r   r   r   r   _inner_class_typesr*   r*   r*   r+   r!   (   s   
 
I

*A


r!   N)0stripe._createable_api_resourcer   stripe._deletable_api_resourcer   stripe._expandable_fieldr   stripe._list_objectr   stripe._listable_api_resourcer   %stripe._nested_resource_class_methodsr   stripe._request_optionsr   stripe._search_result_objectr	   stripe._searchable_api_resourcer
   stripe._stripe_objectr   stripe._updateable_api_resourcer   stripe._utilr   r   typingr   r   r   r   r   r   r   r   r   typing_extensionsr   r   r   r   r   stripe._pricer   stripe._product_featurer   stripe._tax_coder   r!   r*   r*   r*   r+   <module>   s4   ,

