
    _j\                         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dS )    )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   _optionsNc                 f    t          t          |                               |           || _        d S N)superr   __init__r   )selfclientoptions	__class__s      Y/var/www/app.qaans.com/backend/venv/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(   zOAuth.OAuthAuthorizeUrlParamsr   returnc                 4   |i }|i }|                     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_url1   s    
 >F?G;;y!! 	&-DD%DF###&((&,F?#${6223344  ?9==iHH+++%+e3
r   zOAuth.OAuthTokenParamsr   OAuth.OAuthTokenc           
      d    |i }t          d| j                            dd||d                    S )Nr9   postz/oauth/tokenr.   r(   r   base_address)r   r2   requestr   r(   r   s      r   tokenzOAuthService.tokenM   sL    
 ?GO##& $  	
 	
 		
r   zOAuth.OAuthDeauthorizeParamsOAuth.OAuthDeauthorizationc           
          |i }|                      |           t          d| j                            dd||d                    S )NrA   r;   z/oauth/deauthorizer.   r<   )r)   r   r2   r>   r?   s      r   deauthorizezOAuthService.deauthorize_   s`    
 ?GF###(O##$& $  	
 	
 		
r   r   )NN)r   r    r!   r   r#   r   r
   r%   r)   strr8   r@   rC   __classcell__)r   s   @r   r   r      sT        '((((               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>rO      s    0 0 0 0 0 0 - - - - - - & & & & & & " " " " " " ! ! ! ! ! ! ! ! C C C C C C C C C C $555555666666######a
 a
 a
 a
 a
= a
 a
 a
 a
 a
r   