
    +hJ[              	           d dl 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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rd d
lm Z   G d ded   ed   ed   ed         Z!y)    )CreateableAPIResourceDeletableAPIResourceListableAPIResourceUpdateableAPIResource)ExpandableField)
ListObject)RequestOptions)StripeObject)class_method_variant)ClassVarDictListOptionalUnioncastoverload)LiteralNotRequired	TypedDictUnpackTYPE_CHECKING)
quote_plus)Productc                   .   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rc G d d	e      Z G d
 de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Zeed<   	 eed      ed<   	 ee   ed<   	 ee   ed<   	 ed   ed <   	 eed!<   	 eed"<   	 eed#<   	 ed$   ed%<   	 eed&<   	 eed'<   	 eeeef      ed(<   	 ee   ed)<   	 ed   ed*<   	 eed+      ed,<   	 eee	      ed-<   	 eed.      ed/<   	 ee
   ed0<   	 ee   ed1<   	 ed2   ed3<   	 eed4      ed5<   	 e	 	 	 	 dMd7ee   d8ee   d9ee   d:ee   d;ed<   d=d fd>       Z ed?ed;ed@   d=d fdA       Z!e"e#d?ed;ed@   d=d fdB              Z$e"d;ed@   d=d fdC       Z$ e%dD      d;ed@   d=d fdE       Z$e	 	 	 dNd7ee   d9ee   d:ee   d;edF   d=e&d    f
dG       Z'ed#ed;edH   d=d fdI       Z(ed#ed;edJ   d=d fdK       Z)e	e
dLZ*y6)OPlanu  
    You can now model subscriptions more flexibly using the [Prices API](https://stripe.com/docs/api#prices). It replaces the Plans API and is backwards compatible to simplify your migration.

    Plans define the base price, currency, and billing cycle for recurring purchases of products.
    [Products](https://stripe.com/docs/api#products) help you track inventory or provisioning, and plans help you track pricing. Different physical goods or levels of service should be represented by products, and pricing options should be represented by plans. This approach lets you change prices without having to change your provisioning scheme.

    For example, you might have a single "gold" product that has plans for $10/month, $100/year, €9/month, and €90/year.

    Related guides: [Set up a subscription](https://stripe.com/docs/billing/subscriptions/set-up-subscription) and more about [products and prices](https://stripe.com/docs/products-prices/overview).
    planOBJECT_NAMEc                   f    e Zd ZU ee   ed<   	 ee   ed<   	 ee   ed<   	 ee   ed<   	 ee   ed<   y)	Plan.Tierflat_amountflat_amount_decimalunit_amountunit_amount_decimalup_toN)__name__
__module____qualname__r   int__annotations__str     L/var/www/html/venv/lib/python3.12/site-packages/stripe/api_resources/plan.pyTierr   /   sU    c]"	 &c]*	 c]"	 &c]*	 }	r,   r.   c                   *    e Zd ZU eed<   	 ed   ed<   y)Plan.TransformUsage	divide_bydownuproundNr%   r&   r'   r(   r)   r   r+   r,   r-   TransformUsager0   E   s    	 |$$	r,   r7   c                   H   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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<   y )!Plan.CreateParamsboolactivez8Literal['last_during_period', 'last_ever', 'max', 'sum']aggregate_usager(   amountr*   amount_decimalzLiteral['per_unit', 'tiered']billing_schemecurrency	List[str]expandiddaymonthweekyearintervalinterval_countLiteral['']|Dict[str, str]metadatanicknamezPlan.CreateParamsProduct|strproductzList[Plan.CreateParamsTier]tierszLiteral['graduated', 'volume']
tiers_modePlan.CreateParamsTransformUsagetransform_usagetrial_period_dayszLiteral['licensed', 'metered']
usage_typeN)r%   r&   r'   r   r)   r*   r   r+   r,   r-   CreateParamsr9   Q   sD   '' )J   && (.. ((GHH M  ,, E"" <== (.. "">?? "%(( !!?@@<== $$DEE ))JKK  +511 $$DEEr,   rU   c                   *    e Zd ZU eed<   	 ed   ed<   y)rQ   r1   r2   r5   Nr6   r+   r,   r-   CreateParamsTransformUsagezPlan.CreateParamsTransformUsage   s    N <((r,   rW   c                   p    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<   y	)
Plan.CreateParamsTierr(   r    r*   r!   r"   r#   infr$   N)r%   r&   r'   r   r)   r   r   r(   r+   r,   r-   CreateParamsTierrY      sc    $U++ "-U!33 %U++ "-U!33 ,--r,   r[   c                       e Zd ZU 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
<   y)Plan.CreateParamsProductr:   r;   r*   rC   zDict[str, str]rL   namestatement_descriptortax_code
unit_labelN)r%   r&   r'   r   r)   r*   r+   r,   r-   CreateParamsProductr]      sy    '' E"" ""233 I #.e"44
 "%(( $E**r,   rb   c                       e Zd Zy)Plan.DeleteParamsN)r%   r&   r'   r+   r,   r-   DeleteParamsrd      s    r,   re   c                       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<   y)Plan.ListParamsr:   r;   zPlan.ListParamsCreated|intcreatedr*   ending_beforerA   rB   r(   limitrN   starting_afterNr%   r&   r'   r   r)   r+   r,   r-   
ListParamsrg      s    '' !!=>> 'u--  ,, u%% !'' (..r,   rm   c                   T    e Zd ZU ed   ed<   	 ed   ed<   	 ed   ed<   	 ed   ed<   y)Plan.ListParamsCreatedr(   gtgteltlteNrl   r+   r,   r-   ListParamsCreatedro      sH    E"" U## E"" U##r,   rt   c                   x    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<   y)Plan.ModifyParamsr:   r;   rA   rB   rK   rL   r*   rM   rN   r(   rS   Nrl   r+   r,   r-   ModifyParamsrv     sm    ''  ,, "">?? "%(( !''  +511r,   rw   c                       e Zd ZU ed   ed<   y)Plan.RetrieveParamsrA   rB   Nrl   r+   r,   r-   RetrieveParamsry   '  s    ,,r,   rz   r;   )last_during_period	last_evermaxsumr<   r=   r>   )per_unittieredr?   rh   r@   rC   rD   rI   rJ   livemoderL   rM   objectr   rN   rO   )	graduatedvolumerP   rR   rS   )licensedmeteredrT   TdeletedNapi_keyidempotency_keystripe_versionstripe_accountparamsr9   returnc                 `    t        d| j                  d| j                         |||||            S )z
        You can now model subscriptions more flexibly using the [Prices API](https://stripe.com/docs/api#prices). It replaces the Plans API and is backwards compatible to simplify your migration.
        r   post)r   _static_request	class_url)clsr   r   r   r   r   s         r-   createzPlan.create  s=     
 	
r,   sidrd   c                 z    | j                         dt        |      }t        d| j                  d||            S )l
        Deleting plans means new subscribers can't be added. Existing subscribers aren't affected.
        /r   deleter   r   r   r   r   )r   r   r   urls       r-   _cls_deletezPlan._cls_delete  s=     *S/:#f=
 	
r,   c                      yr   Nr+   )r   r   s     r-   r   zPlan.delete  s     	r,   c                      yr   r+   selfr   s     r-   r   zPlan.delete  s    
 	r,   r   c                 F    | j                  d| j                         |      S )r   r   r   )_request_and_refreshinstance_urlr   s     r-   r   zPlan.delete  s.     (( ) 
 	
r,   rg   c                     | j                  d| j                         ||||      }t        |t              s!t	        dt        |      j                  z        |S )z/
        Returns a list of your plans.
        get)r   r   r   r   z%Expected list object from API, got %s)r   r   
isinstancer   	TypeErrortyper%   )r   r   r   r   r   results         r-   listz	Plan.list  sf     $$MMO)) % 
 &*-7<((* 
 r,   rv   c                 z    | j                         dt        |      }t        d| j                  d||            S )z
        Updates the specified plan by setting the values of the parameters passed. Any parameters not provided are left unchanged. By design, you cannot change a plan's ID, amount, currency, or billing cycle.
        r   r   r   r   r   )r   rC   r   r   s       r-   modifyzPlan.modify  s=    
 *R.9F;
 	
r,   ry   c                 8     | |fi |}|j                          |S )z7
        Retrieves the plan with the given ID.
        )refresh)r   rC   r   instances       r-   retrievezPlan.retrieve  s$     r$V$r,   )rO   rR   )NNNN)NNN)+r%   r&   r'   __doc__r   r   r   r)   r
   r.   r7   r   r	   rU   r   rW   r[   rb   re   rm   rt   rw   rz   r:   r   r(   r*   r   r   r   classmethodr   r   r   r   staticmethodr   r   r   r   r   r   _inner_class_typesr+   r,   r-   r   r      s*   	 .4K'&/*3| ,  G	> G	R	 		y 	,	) 	@	> 		 	<		 	$	> 	4	^ 	 L ?@  SM SM! 011 L M 	G 455  N tCH~&& sm FO oi011 DJ !6788 n--  }$ -.. gdm$$  "&)-(,(,
#
 "#
 !	

 !
 ,-
 

 
0 



!'(;!<

	

 

 C 6*=#> 6    v&9: v   -(

23

	

 )

  "&(,(,	# ! !	
 *+ 
F	 6 
 
v.A'B 
v 
 
  &'< =	  $(NKr,   r   N)"stripe.api_resources.abstractr   r   r   r   %stripe.api_resources.expandable_fieldr    stripe.api_resources.list_objectr   stripe.request_optionsr	   stripe.stripe_objectr
   stripe.utilr   typingr   r   r   r   r   r   r   typing_extensionsr   r   r   r   r   urllib.parser   stripe.api_resources.productr   r   r+   r,   r-   <module>r      sm     B 7 1 - , H H H  $4\L&! &!	\Lr,   