
     h                     r   d dl mZmZmZ d dlZd dlmZ e G d de                      Z G d de          Z	 G d d	e          Z
 G d
 de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          ZdS )    )absolute_importdivisionprint_functionN)python_2_unicode_compatiblec                   T     e Zd Z	 	 	 	 	 	 d fd	Zd Zed             Zd Zd Z xZ	S )StripeErrorNc                    t          t          |                               |           |r9t          |d          r)	 |                    d          }n# t
          $ r d}Y nw xY w|| _        || _        || _        || _	        |pi | _
        || _        | j
                            dd           | _        |                                 | _        d S )Ndecodezutf-8zE<Could not decode body as utf-8. Please report to support@stripe.com>z
request-id)superr   __init__hasattrr
   BaseException_message	http_bodyhttp_status	json_bodyheaderscodeget
request_idconstruct_error_objecterror)selfmessager   r   r   r   r   	__class__s          H/var/www/html/Sam_Eipo/venv/lib/python3.11/site-packages/stripe/error.pyr   zStripeError.__init__	   s     	k4  ))'222 	H55 	%,,W55		    ; 		  "&"}"	,**<>>0022


s   A A"!A"c                 \    | j         pd}| j        d                    | j        |          S |S )Nz<empty message>zRequest {0}: {1})r   r   format)r   msgs     r   __str__zStripeError.__str__&   s4    m00?&&--dosCCCJ    c                     | j         S N)r   r   s    r   user_messagezStripeError.user_message1   s
    }r!   c                 P    | j         j        d| j        d| j        d| j        dS )N	(message=, http_status=, request_id=))r   __name__r   r   r   r$   s    r   __repr__zStripeError.__repr__5   s8    N###MMMOOO	
 	
r!   c                     | j         )d| j         vs t          | j         d         t                    sd S t          j        j        j                            | j         d         t          j                  S )Nr   )	r   
isinstancedictstripeapi_resourceserror_objectErrorObjectconstruct_fromapi_keyr$   s    r   r   z"StripeError.construct_error_object=   sf    N"dn,,dnW5t<< - 4#0<KKN7#V^
 
 	
r!   )NNNNNN)
r+   
__module____qualname__r   r    propertyr%   r,   r   __classcell__r   s   @r   r   r      s         3 3 3 3 3 3:     X
 
 


 

 

 

 

 

 

r!   r   c                       e Zd ZdS )APIErrorNr+   r6   r7    r!   r   r<   r<   J           Dr!   r<   c                   ,     e Zd Z	 	 	 	 	 	 d fd	Z xZS )APIConnectionErrorNFc                 p    t          t          |                               ||||||           || _        d S r#   )r   rA   r   should_retry)	r   r   r   r   r   r   r   rC   r   s	           r   r   zAPIConnectionError.__init__O   sE     	 $''00YY	
 	
 	
 )r!   )NNNNNFr+   r6   r7   r   r9   r:   s   @r   rA   rA   N   sQ         ) ) ) ) ) ) ) ) ) )r!   rA   c                       e Zd Zd ZdS )StripeErrorWithParamCodec                 p    | j         j        d| j        d| j        d| j        d| j        d| j        dS )Nr'   z, param=z, code=r(   r)   r*   )r   r+   r   paramr   r   r   r$   s    r   r,   z!StripeErrorWithParamCode.__repr__`   sL    
 '''


			   		
r!   N)r+   r6   r7   r,   r>   r!   r   rF   rF   _   s#        
 
 
 
 
r!   rF   c                   (     e Zd Z	 	 	 	 d fd	Z xZS )	CardErrorNc                 p    t          t          |                               ||||||           || _        d S r#   )r   rJ   r   rH   	r   r   rH   r   r   r   r   r   r   s	           r   r   zCardError.__init__p   sA     	i''YY	
 	
 	
 


r!   )NNNNrD   r:   s   @r   rJ   rJ   o   sK                  r!   rJ   c                       e Zd ZdS )IdempotencyErrorNr=   r>   r!   r   rN   rN      r?   r!   rN   c                   *     e Zd Z	 	 	 	 	 d fd	Z xZS )InvalidRequestErrorNc                 p    t          t          |                               ||||||           || _        d S r#   )r   rP   r   rH   rL   s	           r   r   zInvalidRequestError.__init__   sB     	!4((11YY	
 	
 	
 


r!   )NNNNNrD   r:   s   @r   rP   rP      sN        
          r!   rP   c                       e Zd ZdS )AuthenticationErrorNr=   r>   r!   r   rS   rS      r?   r!   rS   c                       e Zd ZdS )PermissionErrorNr=   r>   r!   r   rU   rU      r?   r!   rU   c                       e Zd ZdS )RateLimitErrorNr=   r>   r!   r   rW   rW      r?   r!   rW   c                         e Zd Zd fd	Z xZS )SignatureVerificationErrorNc                 h    t          t          |                               ||           || _        d S r#   )r   rY   r   
sig_header)r   r   r[   r   r   s       r   r   z#SignatureVerificationError.__init__   s/    ($//88)LLL$r!   r#   rD   r:   s   @r   rY   rY      s=        % % % % % % % % % %r!   rY   )
__future__r   r   r   r0   
stripe.sixr   	Exceptionr   r<   rA   rF   rJ   rN   rP   rS   rU   rW   rY   r>   r!   r   <module>r_      s&   @ @ @ @ @ @ @ @ @ @  2 2 2 2 2 2 ?
 ?
 ?
 ?
 ?
) ?
 ?
 ?
D	 	 	 	 	{ 	 	 	) ) ) ) ) ) ) )"
 
 
 
 
{ 
 
 
     (   "	 	 	 	 	{ 	 	 	    2   "	 	 	 	 	+ 	 	 		 	 	 	 	k 	 	 		 	 	 	 	[ 	 	 	% % % % % % % % % %r!   