
    kh                          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  G d
 de      Zy)    )StripeService)AuthenticationError)_api_encode)OAuth)	urlencode)RequestOptions)_ClientOptions)castOptional)NotRequired	TypedDictc                       e Zd ZU ee   ed<   d fd	Z G d de      Zd Z		 	 ddee
j                     dee   defd	Z	 dde
j                  dee   de
j                   fd
Z	 dde
j$                  dee   de
j&                  fdZ xZS )OAuthService_optionsc                 :    t         t        |   |       || _        y N)superr   __init__r   )selfclientoptions	__class__s      U/var/www/api/v1/venv_fitandmore/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'   r   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_url/   s    
 >F?G;;y!-D%DF#&(&,F?#${6489:  ??99==iH+++%+e3
r   c           
      z    |i }t        t        j                  | j                  j	                  dd||d            S )Npostz/oauth/tokenr.   r'   r   base_address)r
   r   
OAuthTokenr2   requestr   r'   r   s      r   tokenzOAuthService.tokenK   sJ    
 ?GOO##& $ 	
 		
r   c           
          |i }| j                  |       t        t        j                  | j                  j                  dd||d            S )Nr:   z/oauth/deauthorizer.   r;   )r(   r
   r   OAuthDeauthorizationr2   r>   r?   s      r   deauthorizezOAuthService.deauthorize]   sX    
 ?GF#&&OO##$& $ 	
 		
r   r   )NN)r   r   r    r   r	   r"   r   r   r$   r(   r   OAuthAuthorizeUrlParamsstrr8   OAuthTokenParamsr   r=   r@   OAuthDeauthorizeParamsrB   rC   __classcell__)r   s   @r   r   r      s    ~&& 9 
, ;?6:667 23 
	> -1
&&
 .)
 
			
* -1
,,
 .)
 
	#	#	
r   r   N)stripe._stripe_servicer   stripe._errorr   stripe._encoder   stripe._oauthr   urllib.parser   stripe._request_optionsr   stripe._client_optionsr	   typingr
   r   typing_extensionsr   r   r   r#   r   r   <module>rR      s.    0 - &  " 2 1 ! 4a
= a
r   