
    h>                     r   d dl Z d dlmZ 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mZ d d	lmZ d d
l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 m!Z! d dl"m#Z#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. d dl/m0Z0 d dl1m2Z2 d dl3m4Z4 d dl5m6Z6 d dl7m8Z8 d dl9m:Z: d dl;m<Z< d dl=m>Z> d dl?m@Z@ d dlAmBZB d dlCmDZD d dlEmFZF d dlGmHZH d d lImJZJ d d!lKmLZL d d"lMmNZN d d#lOmPZP d d$lQmRZR d d%lSmTZT d d&lUmVZV d d'lWmXZX d d(lYmZZZ d d)l[m\Z\ d d*l]m^Z^ d d+l_m`Z` d d,lambZb d d-lcmdZd d d.lemfZf d d/lgmhZh d d0limjZj d d1lkmlZl d d2lmmnZn d d3lompZp d d4lqmrZr d d5lsmtZt d d6lumvZv d d7lwmxZx d d8lymzZz d d9l{m|Z| d d:l}m~Z~ d d;lmZ d d<lmZ d d=lmZ d d>lmZ d d?lmZ d d@lmZ d dAlmZ d dBlmZ d dClmZ d dDlmZ d dElmZ d dFlmZ d dGlmZ d dHlmZ d dIlmZ d dJlmZ d dKlmZ d dLlmZ d dMlmZ d dNlmZ d dOlmZ d dPlmZ d dQlmZ d dRlmZ d dSlmZ d dTlmZ d dUlmZ d dVlmZ d dWlmZ d dXlmZ d dYlmZ  G dZ d[e      Zy)\    N)OrderedDict)DEFAULT_API_BASEDEFAULT_CONNECT_API_BASEDEFAULT_UPLOAD_API_BASEDEFAULT_METER_EVENTS_API_BASE)ApiMode)AuthenticationError)_APIRequestor)extract_options_from_dict)RequestorOptionsBaseAddresses)_ClientOptions)
HTTPClientnew_default_http_clientnew_http_client_async_fallback)_ApiVersion)StripeObject)StripeResponse)_convert_to_stripe_objectget_api_mode)WebhookWebhookSignature)Event)	ThinEvent)AnyDictOptionalUnioncast)OAuthService)AccountService)AccountLinkService)AccountSessionService)ApplePayDomainService)ApplicationFeeService)AppsService)BalanceService)BalanceTransactionService)BillingService)BillingPortalService)ChargeService)CheckoutService)ClimateService)ConfirmationTokenService)TestHelpersService)CountrySpecService)CouponService)CreditNoteService)CustomerService)CustomerSessionService)DisputeService)EntitlementsService)EphemeralKeyService)EventService)ExchangeRateService)FileService)FileLinkService)FinancialConnectionsService)ForwardingService)IdentityService)InvoiceService)InvoicePaymentService)InvoiceRenderingTemplateService)InvoiceItemService)IssuingService)MandateService)PaymentIntentService)PaymentLinkService)PaymentMethodService)!PaymentMethodConfigurationService)PaymentMethodDomainService)PayoutService)PlanService)PriceService)ProductService)PromotionCodeService)QuoteService)RadarService)RefundService)ReportingService)ReviewService)SigmaService)SetupAttemptService)SetupIntentService)ShippingRateService)SourceService)SubscriptionService)SubscriptionItemService)SubscriptionScheduleService)
TaxService)TaxCodeService)TaxIdService)TaxRateService)TerminalService)TokenService)TopupService)TransferService)TreasuryService)WebhookEndpointService)
V2Servicesc                   Z   e Zd Zdddi dddddd	dedee   dee   dee   ded	ee   d
edee   dee   dee   fdZ	e
j                  fdeeeef   dedededef
dZe
j                  fdeeef   dedededef
dZdedefdZdedefdZ	 ddeeeeef   f   deeeef      dedefdZy) StripeClientNT)	stripe_accountstripe_contextstripe_versionbase_addresses	client_idverify_ssl_certsproxymax_network_retrieshttp_clientapi_keyri   rj   rk   rl   rm   rn   ro   rp   rq   c       	            |t        d      |
r|s|durt        d      t        t        t        t
        d|}t        ||||xs t        j                  ||	      }|
t        t        ||      ||      }
t        ||
      | _        t        |||	      | _        t        | j                  | j                        | _        t#        | j                        | _        t'        | j                        | _        t+        | j                        | _        t/        | j                        | _        t3        | j                        | _        t7        | j                        | _        t;        | j                        | _        t?        | j                        | _         tC        | j                        | _"        tG        | j                        | _$        tK        | j                        | _&        tO        | j                        | _(        tS        | j                        | _*        tW        | j                        | _,        t[        | j                        | _.        t_        | j                        | _0        tc        | j                        | _2        tg        | j                        | _4        tk        | j                        | _6        to        | j                        | _8        ts        | j                        | _:        tw        | j                        | _<        t{        | j                        | _>        t        | j                        | _@        t        | j                        | _B        t        | j                        | _D        t        | j                        | _F        t        | j                        | _H        t        | j                        | _J        t        | j                        | _L        t        | j                        | _N        t        | j                        | _P        t        | j                        | _R        t        | j                        | _T        t        | j                        | _V        t        | j                        | _X        t        | j                        | _Z        t        | j                        | _\        t        | j                        | _^        t        | j                        | _`        t        | j                        | _b        t        | j                        | _d        t        | j                        | _f        t        | j                        | _h        t        | j                        | _j        t        | j                        | _l        t        | j                        | _n        t        | j                        | _p        t        | j                        | _r        t        | j                        | _t        t        | j                        | _v        t        | j                        | _x        t        | j                        | _z        t        | j                        | _|        t        | j                        | _~        t        | j                        | _        t        | j                        | _        t        | j                        | _        t        | j                        | _        t        | j                        | _        t        | j                        | _        t        | j                        | _        t        | j                        | _        t        | j                        | _        t#        | j                        | _        t'        | j                        | _        t+        | j                        | _        t/        | j                        | _        t3        | j                        | _        t7        | j                        | _        y )
NzNo API key provided. (HINT: set your API key using "client = stripe.StripeClient(<API-KEY>)"). You can generate API keys from the Stripe web interface. See https://stripe.com/api for details, or email support@stripe.com if you have any questions.TzYou cannot specify `proxy` or `verify_ssl_certs` when passing in a custom `http_client`. Please set these values on your custom `http_client` instead.)apiconnectfilesmeter_events)rr   ri   rj   rk   rl   rp   )ro   rn   )async_fallback_clientro   rn   )optionsclient)rm   ro   rn   )r	   
ValueErrorr   r   r   r   r   r   CURRENTr   r   r
   
_requestorr   _optionsr    oauthr!   accountsr"   account_linksr#   account_sessionsr$   apple_pay_domainsr%   application_feesr&   appsr'   balancer(   balance_transactionsr)   billingr*   billing_portalr+   chargesr,   checkoutr-   climater.   confirmation_tokensr/   test_helpersr0   country_specsr1   couponsr2   credit_notesr3   	customersr4   customer_sessionsr5   disputesr6   entitlementsr7   ephemeral_keysr8   eventsr9   exchange_ratesr:   rv   r;   
file_linksr<   financial_connectionsr=   
forwardingr>   identityr?   invoicesr@   invoice_paymentsrA   invoice_rendering_templatesrB   invoice_itemsrC   issuingrD   mandatesrE   payment_intentsrF   payment_linksrG   payment_methodsrH   payment_method_configurationsrI   payment_method_domainsrJ   payoutsrK   plansrL   pricesrM   productsrN   promotion_codesrO   quotesrP   radarrQ   refundsrR   	reportingrS   reviewsrT   sigmarU   setup_attemptsrV   setup_intentsrW   shipping_ratesrX   sourcesrY   subscriptionsrZ   subscription_itemsr[   subscription_schedulesr\   taxr]   	tax_codesr^   tax_idsr_   	tax_ratesr`   terminalra   tokensrb   topupsrc   	transfersrd   treasuryre   webhook_endpointsrf   v2)selfrr   ri   rj   rk   rl   rm   rn   ro   rp   rq   requestor_optionss               U/var/www/api/v1/venv_getwork_v1/lib/python3.12/site-packages/stripe/_stripe_client.py__init__zStripeClient.__init__t   s    ?%@  E%5T%A0  $/,9	

 
 -)))@[-@-@) 3
 1&D2B' !1K (%

 '-
 "$//4==A
 't7/@ 5doo F!6t!G 5doo F0	%doo6$=doo$N!%doo624??C$T__5'8%doo6#;DOO#L .t?/@$T__5-doo>(9!7!H&t7/@1$//B"4??31$//B 1
)$//:%@OO&
" ,DOO<'8&t7 5doo F+JOO,
( 0@%doo6&t73DOOD/@3DOOD-NOO.
* 'AOO'
# %T__5 1
"4??3&t73DOOD"4??3!$//2
$T__5)$//:$T__5!$//2
1$//B/@1$//B$T__50A"9$//"J&AOO'
# doo.'8#DOO4'8'8"4??3"4??3(9'8!7!HT__-    raw
sig_headersecret	tolerancereturnc                     t        |d      r,t        t        t        t        f   |      j                  d      nt        t        |      }t        j                  ||||       t        |      S )Ndecodeutf-8)
hasattrr   r   bytes	bytearrayr   strr   verify_headerr   )r   r   r   r   r   payloads         r   parse_thin_eventzStripeClient.parse_thin_event  s^     sH% ui'(#.55g>c3 	 	&&w
FIN!!r   r   c                    t        |d      rt        t        |      j                  d      }t	        j
                  ||||       t        j                  |t              }t        j                  || j                  d      }|S )Nr   r   )object_pairs_hookV1)values	requestorapi_mode)r   r   r   r   r   r   jsonloadsr   r   _construct_fromr}   )r   r   r   r   r   dataevents          r   construct_eventzStripeClient.construct_event   sm     7H%5'*11':G&&w
FINzz'[A%%oo
 r   method_url_c           	         |j                         }t        |      \  }}t        |      }|j                  dd      }|j                  dd       }|@|j	                  di       |d<   t        |d   t              sJ |d   j                  d|i       | j                  j                  ||||||dg      \  }}	}
| j                  j                  ||	|
|      S )Nbasert   rj   headerszStripe-Contextraw_requestparamsry   base_addressr   usage)copyr   r   popget
isinstancedictupdater}   request_raw_interpret_response)r   r   r   r   ry   r   r   rj   rbodyrcoderheaderss              r   r   zStripeClient.raw_request5  s    3F;%zz&%0$4d; %!(Y!;GIgi0$777I%%'7&HI!%!<!<% / "= "
uh 225(H
 	
r   c           	        K   |j                         }t        |      \  }}t        |      }|j                  dd      }| j                  j                  ||||||dg       d {   \  }}}	| j                  j                  |||	|      S 7 &w)Nr   rt   r   r   )r   r   r   r   r}   request_raw_asyncr   )
r   r   r   r   ry   r   r   r   r   r   s
             r   raw_request_asynczStripeClient.raw_request_asyncT  s     3F;%zz&%0'+'H'H% / (I (
 "
uh 225(H
 	
"
s   A"B$B%'Brespr   r   c                4    t        ||| j                  |      S )N)r   r   r   r   )r   r}   )r   r   r   r   s       r   deserializezStripeClient.deserializeh  s!     )oo	
 	
r   )N)__name__
__module____qualname__r   r   r   boolintr   r   r   DEFAULT_TOLERANCEr   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r   r   rh   rh   s   s   
 )-(,(,(*#'!%#-1,0X.X. !	X.
 !X. !X. &X. C=X. X. }X. &c]X. j)X.@ !22"5#y()" " 	"
 " 
", !22ucz"  	
  
*
3 
c 
>
s 
# 
. ,0
NDcN23
 c3h(

 
 

r   rh   )r   collectionsr   striper   r   r   r   stripe._api_moder   stripe._errorr	   stripe._api_requestorr
   stripe._request_optionsr   stripe._requestor_optionsr   r   stripe._client_optionsr   stripe._http_clientr   r   r   stripe._api_versionr   stripe._stripe_objectr   stripe._stripe_responser   stripe._utilr   r   stripe._webhookr   r   stripe._eventr   stripe.v2._eventr   typingr   r   r   r   r   stripe._oauth_servicer    stripe._account_servicer!   stripe._account_link_servicer"   stripe._account_session_servicer#    stripe._apple_pay_domain_servicer$   stripe._application_fee_servicer%   stripe._apps_servicer&   stripe._balance_servicer'   #stripe._balance_transaction_servicer(   stripe._billing_servicer)   stripe._billing_portal_servicer*   stripe._charge_servicer+   stripe._checkout_servicer,   stripe._climate_servicer-   "stripe._confirmation_token_servicer.   stripe._test_helpers_servicer/   stripe._country_spec_servicer0   stripe._coupon_servicer1   stripe._credit_note_servicer2   stripe._customer_servicer3    stripe._customer_session_servicer4   stripe._dispute_servicer5   stripe._entitlements_servicer6   stripe._ephemeral_key_servicer7   stripe._event_servicer8   stripe._exchange_rate_servicer9   stripe._file_servicer:   stripe._file_link_servicer;   %stripe._financial_connections_servicer<   stripe._forwarding_servicer=   stripe._identity_servicer>   stripe._invoice_servicer?   stripe._invoice_payment_servicer@   *stripe._invoice_rendering_template_servicerA   stripe._invoice_item_servicerB   stripe._issuing_servicerC   stripe._mandate_servicerD   stripe._payment_intent_servicerE   stripe._payment_link_servicerF   stripe._payment_method_servicerG   ,stripe._payment_method_configuration_servicerH   %stripe._payment_method_domain_servicerI   stripe._payout_servicerJ   stripe._plan_servicerK   stripe._price_servicerL   stripe._product_servicerM   stripe._promotion_code_servicerN   stripe._quote_servicerO   stripe._radar_servicerP   stripe._refund_servicerQ   stripe._reporting_servicerR   stripe._review_servicerS   stripe._sigma_servicerT   stripe._setup_attempt_servicerU   stripe._setup_intent_servicerV   stripe._shipping_rate_servicerW   stripe._source_servicerX   stripe._subscription_servicerY   !stripe._subscription_item_servicerZ   %stripe._subscription_schedule_servicer[   stripe._tax_servicer\   stripe._tax_code_servicer]   stripe._tax_id_servicer^   stripe._tax_rate_servicer_   stripe._terminal_servicer`   stripe._token_servicera   stripe._topup_servicerb   stripe._transfer_servicerc   stripe._treasury_servicerd    stripe._webhook_endpoint_servicere   stripe._v2_servicesrf   objectrh   r  r   r   <module>r`     sB    #  % - / = E 1 
 , . 2 @ 5  & 3 3 / 3 ; A B A , 2 I 2 ? 0 4 2 G ; ; 0 9 4 C 2 < = . = , 5 M 8 4 2 A < 2 2 ? ; ? M 0 , . 2 ? . . 0 6 0 . = ; = 0 < E M * 3 / 3 4 . . 4 4 C *A
6 A
r   