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	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 erDd dlmZ G d	d
 d
ed
 ZdS )    )CreateableAPIResource)
ListObject)RequestOptions)StripeObject)class_method_variantsanitize_id)ClassVarListOptionalcastoverload)LiteralNotRequired	TypedDictUnpackTYPE_CHECKING)CalculationLineItemc                	   @   sL  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eed < 	 eed!< 	 ee ed"< 	 e	ed#< ee ed$< 	 ee ed%< 	 eed&  ed'< 	 eed(< 	 ed ed)< 	 ee
 ed*< 	 ee ed+< 	 eed,< 	 eed-< 	 ee ed.< 	 eed/< 	 ed0e d1 d2d fd3d4Z!ed0e d1 d2d fd5d6Z"ed7ed0e d8 d2ed& fd9d:Z#e$e%d7ed0e d8 d2ed& fd;d<Z&e$d0e d8 d2ed& fd=d<Z&e'd>d0e d8 d2ed& fd?d<Z&ed7ed0e d8 d2ed& fd@dAZ(e$e%d7ed0e d8 d2ed& fdBdCZ)e$d0e d8 d2ed& fdDdCZ)e'dEd0e d8 d2ed& fdFdCZ)ed%ed0e dG d2d fdHdIZ*ed%ed0e dG d2d fdJdKZ+e	e
eedLZ,dMS )NCalculationz
    A Tax Calculation allows you to calculate the tax to collect from your customer.

    Related guide: [Calculate tax in your custom payment flow](https://stripe.com/docs/tax/custom)
    ztax.calculationOBJECT_NAMEc                   @   s   e Zd ZU G dd deZG dd deZee ed< 	 eed  ed< 	 ee	 ed< 	 e
e ed	< 	 ed
 ed< 	 eedZdS )zCalculation.CustomerDetailsc                   @   \   e Zd ZU ee ed< 	 eed< 	 ee ed< 	 ee ed< 	 ee ed< 	 ee ed< dS )z#Calculation.CustomerDetails.Addresscitycountryline1line2postal_codestateN__name__
__module____qualname__r
   str__annotations__ r"   r"   W/var/www/html/Trade-python/venv/lib/python3.10/site-packages/stripe/tax/_calculation.pyAddress      
 r$   c                   @   $   e Zd ZU ed ed< 	 eed< dS )z!Calculation.CustomerDetails.TaxId)Kad_nrtae_trnar_cuitau_abnau_arnbg_uicbh_vatbo_tinbr_cnpjbr_cpfca_bn
ca_gst_hst	ca_pst_bc	ca_pst_mb	ca_pst_skca_qstch_uidch_vatcl_tincn_tinco_nitcr_tinde_stndo_rcnec_ruceg_tines_cif
eu_oss_vateu_vatgb_vatge_vathk_brhr_oibhu_tinid_npwpil_vatin_gstis_vatjp_cnjp_rnjp_trnke_pinkr_brnkz_binli_uidmx_rfcmy_frpmy_itnmy_sstng_tinno_vatno_voecnz_gstom_vatpe_rucph_tinro_tinrs_pibru_innru_kppsa_vatsg_gstsg_uensi_tinsv_nitth_vattr_tintw_vatua_vatunknownus_einuy_rucve_rifvn_tinza_vattypevalueNr   r   r   r   r!   r    r"   r"   r"   r#   TaxId9   s   
 Mru   addressbillingshippingaddress_source
ip_addresstax_idscustomer_exemptnonereverse_chargetaxability_override)rv   r|   N)r   r   r   r   r$   ru   r
   r!   r   r    r	   _inner_class_typesr"   r"   r"   r#   CustomerDetails   s    
 Vr   c                   @   s.   e Zd ZU G dd deZeed< deiZdS )zCalculation.ShipFromDetailsc                   @   r   )z#Calculation.ShipFromDetails.Addressr   r   r   r   r   r   Nr   r"   r"   r"   r#   r$      r%   r$   rv   N)r   r   r   r   r$   r!   r   r"   r"   r"   r#   ShipFromDetails   s   
 r   c                   @   sr   e Zd ZU G dd deZeed< 	 eed< 	 ee ed< 	 e	d ed< 	 ee
e  ed< 	 eed	< 	 deiZd
S )zCalculation.ShippingCostc                   @   s~   e Zd ZU G dd deZG dd deZeed< 	 eed< ed ed< 	 e	e ed	< 	 ed
 ed< 	 eed< 	 eedZ
dS )z%Calculation.ShippingCost.TaxBreakdownc                   @   s<   e Zd ZU eed< 	 eed< 	 ed ed< 	 ee ed< dS )z2Calculation.ShippingCost.TaxBreakdown.Jurisdictionr   display_name)r   r   countydistrictr   levelr   N)r   r   r   r    r!   r   r
   r"   r"   r"   r#   Jurisdiction   s   
 r   c                   @   s.   e Zd ZU eed< 	 eed< 	 ed ed< dS )z4Calculation.ShippingCost.TaxBreakdown.TaxRateDetailsr   percentage_decimalamusement_taxcommunications_taxgsthstigstjct	lease_taxpstqstrst	sales_taxvattax_typeN)r   r   r   r    r!   r   r"   r"   r"   r#   TaxRateDetails   s   
 r   amountjurisdiction)destinationoriginsourcingtax_rate_detailsr~   not_collectingnot_subject_to_taxnot_supportedportion_product_exemptportion_reduced_ratedportion_standard_ratedproduct_exemptproduct_exempt_holidayproportionally_ratedreduced_ratedr   standard_ratedtaxable_basis_reduced
zero_ratedtaxability_reasontaxable_amount)r   r   N)r   r   r   r   r   r   intr!   r   r
   r   r"   r"   r"   r#   TaxBreakdown   s&   
 
r   r   
amount_taxshipping_rate	exclusive	inclusivetax_behaviortax_breakdowntax_codeN)r   r   r   r   r   r   r!   r
   r    r   r	   r   r"   r"   r"   r#   ShippingCost   s   
 Zr   c                   @   sZ   e Zd ZU G dd deZeed< 	 eed< 	 eed< ed ed< 	 eed< 	 deiZ	d	S )
zCalculation.TaxBreakdownc                   @   sD   e Zd ZU ee ed< 	 eed< 	 ee ed< 	 eed  ed< dS )z'Calculation.TaxBreakdown.TaxRateDetailsr   r   r   r   r   N)r   r   r   r
   r    r!   r   r"   r"   r"   r#   r   ;  s   
 r   r   r   r   r   r   r   N)
r   r   r   r   r   r   r!   boolr   r   r"   r"   r"   r#   r   :  s   
 !r   c                   @   s|   e Zd ZU 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< dS )Calculation.CreateParamscurrencycustomer'Calculation.CreateParamsCustomerDetailscustomer_detailsexpand Calculation.CreateParamsLineItem
line_items'Calculation.CreateParamsShipFromDetailsship_from_details$Calculation.CreateParamsShippingCostshipping_costtax_dateN)r   r   r   r    r!   r   r	   r   r"   r"   r"   r#   CreateParams  s*   
 r   c                   @   s^   e Zd ZU ed ed< 	 eed  ed< 	 ee ed< 	 eed  ed< 	 eed  ed	< d
S )r   .Calculation.CreateParamsCustomerDetailsAddressrv   rw   rz   r{   ,Calculation.CreateParamsCustomerDetailsTaxIdr|   r}   r   N)r   r   r   r   r!   r   r    r	   r"   r"   r"   r#   CreateParamsCustomerDetails  s   
 r   c                   @   \   e Zd ZU ed ed< 	 eed< 	 ed ed< 	 ed ed< 	 ed ed< 	 ed ed< dS )	r   Literal['']|strr   r   r   r   r   r   Nr   r   r   r   r!   r    r"   r"   r"   r#   "CreateParamsCustomerDetailsAddress  r%   r   c                   @   r&   )r   )Jr'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   r`   ra   rb   rc   rd   re   rf   rg   rh   ri   rj   rk   rm   rn   ro   rp   rq   rr   rs   Nrt   r"   r"   r"   r#    CreateParamsCustomerDetailsTaxId  s   
 Lr   c                   @   s`   e Zd ZU 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 )	r   r   productquantity	referencer   r   r   N)r   r   r   r   r!   r   r    r   r"   r"   r"   r#   CreateParamsLineItem.  s   
 r   c                   @   s   e Zd ZU ded< dS )r   .Calculation.CreateParamsShipFromDetailsAddressrv   N)r   r   r   r!   r"   r"   r"   r#   CreateParamsShipFromDetailsI  s   
 r   c                   @   r   )	r   r   r   r   r   r   r   r   Nr   r"   r"   r"   r#   "CreateParamsShipFromDetailsAddressO  r%   r   c                   @   sH   e Zd ZU ee ed< 	 ee ed< 	 eed  ed< 	 ee ed< dS )r   r   r   r   r   r   N)r   r   r   r   r   r!   r    r   r"   r"   r"   r#   CreateParamsShippingCosti  s   
 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 )Calculation.ListLineItemsParamsending_beforer   limitstarting_afterN)r   r   r   r   r    r!   r	   r   r"   r"   r"   r#   ListLineItemsParams{  s   
 r   c                   @   s   e Zd ZU eee  ed< dS )Calculation.RetrieveParamsr   N)r   r   r   r   r	   r    r!   r"   r"   r"   r#   RetrieveParams  s   
 r   amount_totalr   r   r   
expires_atidr   r   livemodeobjectr   r   tax_amount_exclusivetax_amount_inclusiver   r   paramsr   returnc                 K   s   t d| jd|  |dS )Y
        Calculates tax based on the input and returns a Tax Calculation object.
        r   postr   )r   _static_request	class_urlclsr   r"   r"   r#   create  s   zCalculation.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_async  s   
zCalculation.create_asynccalculationr   c                 K   s&   t td | jddjt|d|dS )s
        Retrieves the line items of a tax calculation as a collection, if the calculation hasn't expired.
        r   get-/v1/tax/calculations/{calculation}/line_itemsr   r   )r   r   r   formatr   r   r   r   r"   r"   r#   _cls_list_line_items  s   	z Calculation._cls_list_line_itemsc                 K      dS r   Nr"   r   r   r"   r"   r#   list_line_items  s   zCalculation.list_line_itemsc                 K   r   r   r"   selfr   r"   r"   r#   r     s   r   c              	   K   s,   t td | jddjt| dd|dS )r   r   r   r   r   r   r   )r   r   _requestr   r   r   r   r"   r"   r#   r     s   c                    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#   _cls_list_line_items_async&  s   	
z&Calculation._cls_list_line_items_asyncc                       dS r   r"   r   r"   r"   r#   list_line_items_async:  s   z!Calculation.list_line_items_asyncc                    r  r   r"   r   r"   r"   r#   r  D  s   r  c              	      s4   t td | jddjt| dd|dI dH S )r   r   r   r   r   r   r   N)r   r   _request_asyncr   r   r   r   r"   r"   r#   r  M  s   
r   c                 K   s   | |fi |}|   |S )X
        Retrieves a Tax Calculation object, if the calculation hasn't expired.
        )refreshr   r   r   instancer"   r"   r#   retrieve_  s   zCalculation.retrievec                    s$   | |fi |}|  I dH  |S )r  N)refresh_asyncr	  r"   r"   r#   retrieve_asyncj  s   zCalculation.retrieve_async)r   r   r   r   N)-r   r   r   __doc__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   r   r	   classmethodr   r   r   r   r   staticmethodr   r   r  r  r  r  r   r"   r"   r"   r#   r      s  
  
uE&U

r   N)stripe._createable_api_resourcer   stripe._list_objectr   stripe._request_optionsr   stripe._stripe_objectr   stripe._utilr   r   typingr   r	   r
   r   r   typing_extensionsr   r   r   r   r   !stripe.tax._calculation_line_itemr   r   r"   r"   r"   r#   <module>   s   