
    jofD                         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dS )    )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	i i fde
j        ded	efd
Zi fde
j        ded	e
j        fdZi fde
j        ded	e
j        fdZ xZS )OAuthService_optionsNc                 f    t          t          |                               |           || _        d S N)superr   __init__r   )selfclientoptions	__class__s      O/var/www/html/Alfredo/env/lib/python3.11/site-packages/stripe/_oauth_service.pyr   zOAuthService.__init__   s,    lD!!**6222    c                   &    e Zd ZU ee         ed<   dS )%OAuthService.OAuthAuthorizeUrlOptionsexpressN)__name__
__module____qualname__r   bool__annotations__ r   r   OAuthAuthorizeUrlOptionsr      s'         T""""	 	r   r$   c                 d    d|v rd S | j         o| j         j        }|r||d<   d S 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   sR    &  FM=dm&=	 	"+F;F!E
 
 	
r   r'   r   returnc                 $   |                     d          rd}nd}|                     |           d|vrd|d<   t          t          t	          |                              }| j        j                             d          }|J ||z   dz   |z   }|S )Nr   z/express/oauth/authorizez/oauth/authorizeresponse_typecodeconnect?)getr(   r   listr   
_requestorbase_addresses)r   r'   r   pathqueryconnect_api_baseurls          r   authorize_urlzOAuthService.authorize_url/   s    
 ;;y!! 	&-DD%DF###&((&,F?#${6223344  ?9==iHH+++%+e3
r   c                 r    t          t          j        | j                            dd||dd                    S )Npostz/oauth/tokenr-   V1r'   r   base_addressapi_mode)r
   r   
OAuthTokenr1   requestr   r'   r   s      r   tokenzOAuthService.tokenF   sH     O##& $  

 

 
	
r   c                     |                      |           t          t          j        | j                            dd||dd                    S )Nr9   z/oauth/deauthorizer-   r:   r;   )r(   r
   r   OAuthDeauthorizationr1   r?   r@   s      r   deauthorizezOAuthService.deauthorizeU   s\    
 	F###&O##$& $  

 

 
	
r   r   )r   r   r    r   r	   r"   r   r   r$   r(   r   OAuthAuthorizeUrlParamsstrr7   OAuthTokenParamsr   r>   rA   OAuthDeauthorizeParamsrC   rD   __classcell__)r   s   @r   r   r      sG        ~&&&&               9   
 
 
, 13,. - * 
	   0 IK
 
,
7E
		
 
 
 
$ #%
 
,
  
 
	#	
 
 
 
 
 
 
 
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>rS      s    0 0 0 0 0 0 - - - - - - & & & & & &       " " " " " " 2 2 2 2 2 2 1 1 1 1 1 1 ! ! ! ! ! ! ! ! 4 4 4 4 4 4 4 4X
 X
 X
 X
 X
= X
 X
 X
 X
 X
r   