
    Aib                         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 erd dlmZ d dlmZ d d	lmZ  G d
 de      Zy)    )StripeService)AuthenticationError)_api_encode)	urlencode)castOptional)NotRequired	TypedDictTYPE_CHECKING)_ClientOptions)RequestOptions)OAuthc                        e Zd ZU ed   ed<   d fd	Z G d de      Zd Z	 	 dded   d	ee   d
e	fdZ
	 dddd	ed   d
dfdZ	 dddd	ed   d
dfdZ xZS )OAuthServicer   _optionsc                 :    t         t        |   |       || _        y N)superr   __init__r   )selfclientoptions	__class__s      H/var/www/html/immo/lib/python3.12/site-packages/stripe/_oauth_service.pyr   zOAuthService.__init__   s    lD*62    c                       e Zd ZU ee   ed<   y)%OAuthService.OAuthAuthorizeUrlOptionsexpressN)__name__
__module____qualname__r	   bool__annotations__ r   r   OAuthAuthorizeUrlOptionsr      s    T""	r   r%   c                 z    d|v ry | j                   xr | j                   j                  }|r||d<   y t        d      )N	client_ida  No client_id provided. (HINT: set your client_id when configuring your StripeClient: "stripe.StripeClient(..., client_id=<CLIENT_ID>)"). You can find your client_ids in your Stripe dashboard at https://dashboard.stripe.com/account/applications/settings, after registering your account as a platform. See https://stripe.com/docs/connect/standalone-accounts for details, or email support@stripe.com if you have any questions.)r   r'   r   )r   paramsr'   s      r   _set_client_idzOAuthService._set_client_id   sH    & MM=dmm&=&=	"+F;!E
 	
r   r(   zOAuth.OAuthAuthorizeUrlParamsr   returnc                    |i }|i }|j                  d      rd}nd}| j                  |       d|vrd|d<   t        t        t	        |d                  }| j
                  j                  j                  d      }|J ||z   dz   |z   }|S )	Nr   z/express/oauth/authorizez/oauth/authorizeresponse_typecodeV1connect?)getr)   r   listr   
_requestorbase_addresses)r   r(   r   pathqueryconnect_api_baseurls          r   authorize_urlzOAuthService.authorize_url1   s    
 >F?G;;y!-D%DF#&(&,F?#${6489:  ??99==iH+++%+e3
r   zOAuth.OAuthTokenParamsr   OAuth.OAuthTokenc           
      ^    |i }t        d| j                  j                  dd||d            S )Nr:   postz/oauth/tokenr/   r(   r   base_address)r   r3   requestr   r(   r   s      r   tokenzOAuthService.tokenM   sD    
 ?GOO##& $ 	
 		
r   zOAuth.OAuthDeauthorizeParamsOAuth.OAuthDeauthorizationc           
          |i }| j                  |       t        d| j                  j                  dd||d            S )NrB   r<   z/oauth/deauthorizer/   r=   )r)   r   r3   r?   r@   s      r   deauthorizezOAuthService.deauthorize_   sR    
 ?GF#(OO##$& $ 	
 		
r   r   )NN)r   r    r!   r   r#   r   r
   r%   r)   strr9   rA   rD   __classcell__)r   s   @r   r   r      s    '(( 9 
, =A6:89 23 
	> /3
(
 *+
 
	
* /3
.
 *+
 
&	
r   r   N)stripe._stripe_servicer   stripe._errorr   stripe._encoder   urllib.parser   typingr   r   typing_extensionsr	   r
   r   stripe._client_optionsr   stripe._request_optionsr   stripe._oauthr   r   r$   r   r   <module>rP      s4    0 - & " ! C C56#a
= a
r   