
    <@g                     h   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 d dlmZmZmZm Z m!Z! e!r$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-  ed       ed       G d ded   ed   e	d   ed                       Z.y)    )CreateableAPIResource)DeletableAPIResource)ExpandableField)
ListObject)ListableAPIResource)nested_resource_class_methods)RequestOptions)StripeObject)UpdateableAPIResource)class_method_variantsanitize_id)ClassVarDictListOptionalcastoverload)LiteralNotRequired	TypedDictUnpackTYPE_CHECKING)Discount)Plan)Price)TaxRate)UsageRecord)UsageRecordSummaryusage_recordusage_record_summaryc                   X   e Zd ZU dZdZeed      ed<    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 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	   ed$<   	 eed%<   	 eed&      ed'<   	 eed(<   	 e eef   ed)<   	 ed   ed*<   	 d+ed,<   	 d-ed.<   	 ee   ed/<   	 eed0<   	 eed1      ed2<   	 eed3      ed4<   	 e!d5e"d6   d7d fd8       Z#e!d5e"d6   d7d fd9       Z$e!d:ed5e"d;   d7d fd<       Z%e&e'd:ed5e"d;   d7d fd=              Z(e&d5e"d;   d7d fd>       Z( e)d?      d5e"d;   d7d fd@       Z(e!d:ed5e"d;   d7d fdA       Z*e&e'd:ed5e"d;   d7d fdB              Z+e&d5e"d;   d7d fdC       Z+ e)dD      d5e"d;   d7d fdE       Z+e!d5e"dF   d7e,d    fdG       Z-e!d5e"dF   d7e,d    fdH       Z.e!d(ed5e"dI   d7d fdJ       Z/e!d(ed5e"dI   d7d fdK       Z0e!d(ed5e"dL   d7d fdM       Z1e!d(ed5e"dL   d7d fdN       Z2e!ded5e"dO   d7dPfdQ       Z3e!ded5e"dO   d7dPfdR       Z4e!ded5e"dS   d7e,dT   fdU       Z5e!ded5e"dS   d7e,dT   fdV       Z6d$e	iZ7yW)XSubscriptionItemz
    Subscription items allow you to create customer subscriptions with more than
    one plan, making it easy to represent complex billing relationships.
    subscription_itemOBJECT_NAMEc                       e Zd ZU ee   ed<   y)"SubscriptionItem.BillingThresholds	usage_gteN)__name__
__module____qualname__r   int__annotations__     X/var/www/html/AdoubleTech/venv/lib/python3.12/site-packages/stripe/_subscription_item.pyBillingThresholdsr&   .   s    C= 	r.   r0   c                      e Zd ZU ed   ed<   	 ed   ed<   	 eee      ed<   	 eeeef      ed<   	 eed      ed<   	 ee   ed	<   	 ee   ed
<   	 ed   ed<   	 eed      ed<   	 ee	   ed<   	 ee	   ed<   	 eed<   	 ed   ed<   y)SubscriptionItem.CreateParamsz:Literal['']|SubscriptionItem.CreateParamsBillingThresholdsbilling_thresholdsz7Literal['']|List[SubscriptionItem.CreateParamsDiscount]	discountsexpandmetadataallow_incompletedefault_incompleteerror_if_incompletepending_if_incompletepayment_behaviorplanprice&SubscriptionItem.CreateParamsPriceData
price_dataalways_invoicecreate_prorationsnoneproration_behaviorproration_datequantitysubscriptionLiteral['']|List[str]	tax_ratesN)
r(   r)   r*   r   r,   r   strr   r   r+   r-   r.   r/   CreateParamsr2   4   s   'H
 	
	 E
 	
	 DI&&	 d38n--	 &)
 	
	 #	 3	   HII	 (AB
 	
	 $C((	 c""	 	 677	r.   rL   c                       e Zd ZU eed<   y).SubscriptionItem.CreateParamsBillingThresholdsr'   Nr(   r)   r*   r+   r,   r-   r.   r/   CreateParamsBillingThresholdsrN   }       	r.   rP   c                   B    e Zd ZU ee   ed<   	 ee   ed<   	 ee   ed<   y)%SubscriptionItem.CreateParamsDiscountcoupondiscountpromotion_codeNr(   r)   r*   r   rK   r,   r-   r.   r/   CreateParamsDiscountrS      6    C  	 c""	 $C((	r.   rX   c                   l    e Zd ZU eed<   	 eed<   	 ded<   	 eed      ed<   	 ee   ed<   	 ee   ed<   y	)
r?   currencyproduct/SubscriptionItem.CreateParamsPriceDataRecurring	recurring	exclusive	inclusiveunspecifiedtax_behaviorunit_amountunit_amount_decimalNr(   r)   r*   rK   r,   r   r   r+   r-   r.   r/   CreateParamsPriceDataz&SubscriptionItem.CreateParamsPriceData   g    	 	 ED	 ";<
 	
	 !%%	 )--	r.   rg   c                   0    e Zd ZU ed   ed<   	 ee   ed<   y)r]   daymonthweekyearintervalinterval_countNr(   r)   r*   r   r,   r   r+   r-   r.   r/   CreateParamsPriceDataRecurringz/SubscriptionItem.CreateParamsPriceDataRecurring   %    899	 $C((	r.   rr   c                   Z    e Zd ZU eed      ed<   	 eee      ed<   	 eed<   	 ed   ed<   y)(SubscriptionItem.CreateUsageRecordParams)	incrementsetactionr5   rG   zLiteral['now']|int	timestampN)	r(   r)   r*   r   r   r,   r   rK   r+   r-   r.   r/   CreateUsageRecordParamsru      sM    G$6788	 DI&&	 	 344	r.   rz   c                   H    e Zd ZU ee   ed<   	 eed      ed<   	 ee   ed<   y)SubscriptionItem.DeleteParamsclear_usagerA   rE   rF   N)r(   r)   r*   r   boolr,   r   r+   r-   r.   r/   DeleteParamsr|      sA     &&	 (AB
 	
	 $C((	r.   r   c                   f    e Zd ZU ee   ed<   	 eee      ed<   	 ee   ed<   	 ee   ed<   	 eed<   y)SubscriptionItem.ListParamsending_beforer5   limitstarting_afterrH   Nr(   r)   r*   r   rK   r,   r   r+   r-   r.   r/   
ListParamsr      sY    "3''	 DI&&	 3	 $C((	 	r.   r   c                   Z    e Zd ZU ee   ed<   	 eee      ed<   	 ee   ed<   	 ee   ed<   y)/SubscriptionItem.ListUsageRecordSummariesParamsr   r5   r   r   Nr   r-   r.   r/   ListUsageRecordSummariesParamsr      sL    "3''	 DI&&	 3	 $C((	r.   r   c                      e Zd ZU ed   ed<   	 ed   ed<   	 eee      ed<   	 ed   ed<   	 ee   ed<   	 eed	      ed
<   	 ee   ed<   	 ee   ed<   	 ed   ed<   	 eed      ed<   	 ee	   ed<   	 ee	   ed<   	 ed   ed<   y)SubscriptionItem.ModifyParamsz:Literal['']|SubscriptionItem.ModifyParamsBillingThresholdsr3   z7Literal['']|List[SubscriptionItem.ModifyParamsDiscount]r4   r5   zLiteral['']|Dict[str, str]r6   off_sessionr7   r<   r=   r>   &SubscriptionItem.ModifyParamsPriceDatar@   rA   rE   rF   rG   rI   rJ   N)
r(   r)   r*   r   r,   r   rK   r~   r   r+   r-   r.   r/   ModifyParamsr     s   'H
 	
	 E
 	
	 DI&&	 :;;	 !&&	 &)
 	
	 #	 3	   HII	 (AB
 	
	 $C((	 c""	 677	r.   r   c                       e Zd ZU eed<   y).SubscriptionItem.ModifyParamsBillingThresholdsr'   NrO   r-   r.   r/   ModifyParamsBillingThresholdsr   J  rQ   r.   r   c                   B    e Zd ZU ee   ed<   	 ee   ed<   	 ee   ed<   y)%SubscriptionItem.ModifyParamsDiscountrT   rU   rV   NrW   r-   r.   r/   ModifyParamsDiscountr   P  rY   r.   r   c                   l    e Zd ZU eed<   	 eed<   	 ded<   	 eed      ed<   	 ee   ed<   	 ee   ed<   y	)
r   r[   r\   /SubscriptionItem.ModifyParamsPriceDataRecurringr^   r_   rc   rd   re   Nrf   r-   r.   r/   ModifyParamsPriceDataz&SubscriptionItem.ModifyParamsPriceData^  rh   r.   r   c                   0    e Zd ZU ed   ed<   	 ee   ed<   y)r   rj   ro   rp   Nrq   r-   r.   r/   ModifyParamsPriceDataRecurringz/SubscriptionItem.ModifyParamsPriceDataRecurringz  rs   r.   r   c                   $    e Zd ZU eee      ed<   y)SubscriptionItem.RetrieveParamsr5   N)r(   r)   r*   r   r   rK   r,   r-   r.   r/   RetrieveParamsr     s    DI&&	r.   r   r3   createdr   r4   idr6   objectr   r=   r   r>   rG   rH   r   rJ   Tdeletedparamsr2   returnc                 Z    t        d| j                  d| j                         |            S )m
        Adds a new item to an existing subscription. No existing items will be changed or replaced.
        r"   postr   )r   _static_request	class_urlclsr   s     r/   createzSubscriptionItem.create  s6        
 	
r.   c                 v   K   t        d| j                  d| j                         |       d{         S 7 w)r   r"   r   r   N)r   _static_request_asyncr   r   s     r/   create_asynczSubscriptionItem.create_async  sD      ++ ,  
 	
s   ,97
	9sidr|   c                 z    | j                         dt        |      }t        d| j                  d||            S )
        Deletes an item from the subscription. Removing a subscription item from a subscription will not cancel the subscription.
        /r"   deleter   r   r   r   r   r   r   r   urls       r/   _cls_deletezSubscriptionItem._cls_delete  sE     +c*:;   
 	
r.   c                      yr   Nr-   r   r   s     r/   r   zSubscriptionItem.delete  s     	r.   c                      yr   r-   selfr   s     r/   r   zSubscriptionItem.delete  s     	r.   r   c                 F    | j                  d| j                         |      S )r   r   r   )_request_and_refreshinstance_urlr   s     r/   r   zSubscriptionItem.delete  s.     (( ) 
 	
r.   c                    K   | j                         dt        |      }t        d| j                  d||       d{         S 7 w)r   r   r"   r   r   Nr   r   r   r   r   s       r/   _cls_delete_asyncz"SubscriptionItem._cls_delete_async  sS      +c*:;++ ,  
 	
   <A	A
	A	c                    K   ywr   r-   r   s     r/   delete_asynczSubscriptionItem.delete_async)  s      	   c                    K   ywr   r-   r   s     r/   r   zSubscriptionItem.delete_async3  s      	r   r   c                 b   K   | j                  d| j                         |       d{   S 7 w)r   r   r   N)_request_and_refresh_asyncr   r   s     r/   r   zSubscriptionItem.delete_async<  s<      44 5 
 
 	
 
s   &/-/r   c                     | j                  d| j                         |      }t        |t              s!t	        dt        |      j                  z        |S )U
        Returns a list of your subscription items for a given subscription.
        getr   %Expected list object from API, got %s)r   r   
isinstancer   	TypeErrortyper(   r   r   results      r/   listzSubscriptionItem.listI  s]     $$MMO % 

 &*-7<((* 
 r.   c                    K   | j                  d| j                         |       d{   }t        |t              s!t	        dt        |      j                  z        |S 7 7w)r   r   r   Nr   )r   r   r   r   r   r   r(   r   s      r/   
list_asynczSubscriptionItem.list_async]  sk      00MMO 1 
 

 &*-7<((* 
 
s   &A"A 8A"r   c                 z    | j                         dt        |      }t        d| j                  d||            S )T
        Updates the plan or quantity of an item on a current subscription.
        r   r"   r   r   r   r   r   r   r   s       r/   modifyzSubscriptionItem.modifyq  sD     +b/:   
 	
r.   c                    K   | j                         dt        |      }t        d| j                  d||       d{         S 7 w)r   r   r"   r   r   Nr   r   s       r/   modify_asynczSubscriptionItem.modify_async  sR      +b/:++ ,  
 	
r   r   c                 8     | |fi |}|j                          |S )D
        Retrieves the subscription item with the given ID.
        )refreshr   r   r   instances       r/   retrievezSubscriptionItem.retrieve  s$     r$V$r.   c                 T   K    | |fi |}|j                          d{    |S 7 w)r   N)refresh_asyncr   s       r/   retrieve_asynczSubscriptionItem.retrieve_async  s3      r$V$$$&&& 	's   (&(ru   r   c                 p    t        d| j                  ddj                  t        |            |            S )  
        Creates a usage record for a specified subscription item and date, and fills it with a quantity.

        Usage records provide quantity information that Stripe uses to track how much a customer is using your service. With usage information and the pricing model set up by the [metered billing](https://stripe.com/docs/billing/subscriptions/metered-billing) plan, Stripe helps you send accurate invoices to your customers.

        The default calculation for usage is to add up all the quantity values of the usage records within a billing period. You can change this default behavior with the billing plan's aggregate_usage [parameter](https://stripe.com/docs/api/plans/create#create_plan-aggregate_usage). When there is more than one usage record with the same timestamp, Stripe adds the quantity values together. In most cases, this is the desired resolution, however, you can change this behavior with the action parameter.

        The default pricing model for metered billing is [per-unit pricing. For finer granularity, you can configure metered billing to have a <a href="https://stripe.com/docs/billing/subscriptions/tiers">tiered pricing](https://stripe.com/docs/api/plans/object#plan_object-billing_scheme) model.
        r   r   8/v1/subscription_items/{subscription_item}/usage_recordsr#   r   )r   r   formatr   r   r#   r   s      r/   create_usage_recordz$SubscriptionItem.create_usage_record  sL     JQQ&12C&D R     	
 		
r.   c                    K   t        d| j                  ddj                  t        |            |       d{         S 7 w)r   r   r   r   r   r   N)r   r   r   r   r   s      r/   create_usage_record_asyncz*SubscriptionItem.create_usage_record_async  sZ      ++JQQ&12C&D R   ,  	
 		
s   7AA
	Ar   r   c                 ~    t        t        d   | j                  ddj                  t	        |            |            S )l  
        For the specified subscription item, returns a list of summary objects. Each object in the list provides usage information that's been summarized from multiple usage records and over a subscription billing period (e.g., 15 usage records in the month of September).

        The list is sorted in reverse-chronological order (newest first). The first list item represents the most current usage period that hasn't ended yet. Since new usage records can still be added, the returned summary information for the subscription item's ID should be seen as unstable until the subscription billing period ends.
        r   r   A/v1/subscription_items/{subscription_item}/usage_record_summariesr   r   )r   r   r   r   r   r   s      r/   list_usage_record_summariesz,SubscriptionItem.list_usage_record_summaries  sR     +,SZZ&12C&D [     	
 		
r.   c                    K   t        t        d   | j                  ddj                  t	        |            |       d{         S 7 w)r   r   r   r   r   r   N)r   r   r   r   r   r   s      r/   !list_usage_record_summaries_asyncz2SubscriptionItem.list_usage_record_summaries_async  s`      +,++SZZ&12C&D [   ,  	
 		
s   >A A	
	AN)8r(   r)   r*   __doc__r$   r   r   r,   r
   r0   r	   rL   r   rP   rX   rg   rr   rz   r   r   r   r   r   r   r   r   r   r   r+   r   r   rK   r   classmethodr   r   r   r   r   staticmethodr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   _inner_class_typesr-   r.   r/   r"   r"      s   
 ;NK'"567ML G~ GR	 y 	 8 . $~  ^ , $G~ GR	 y 	 8   !!233 L OJ/00 	G 38n '(( L	 N sm  Y(( gdm$$ 
=>
	
 
 
=>
	
 
 

!'(G!H
	
 
  "#BC	   >?	  -(

>?

	

 )

 

!'(G!H
	
 
  "#BC	   >?	  -.

>?

	

 /

 ;<	&	' & ;<	&	' & 

 &'F G
	
 
  

 &'F G
	
 
   &'H I	   &'H I	  

 CD
 
	
 
2 

 CD
 
	
 
2 

 JK
 
(	)	
 
* 

 JK
 
(	)	
 
* /0ABr.   r"   N)/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._stripe_objectr
   stripe._updateable_api_resourcer   stripe._utilr   r   typingr   r   r   r   r   r   typing_extensionsr   r   r   r   r   stripe._discountr   stripe._planr   stripe._pricer   stripe._tax_rater   stripe._usage_recordr   stripe._usage_record_summaryr   r"   r-   r.   r/   <module>r     s    B ? 4 * = O 2 . A : A A  )!#(0? ~.56hC,-+,*+,-	hC 7 /hCr.   