mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-10-31 01:57:45 +08:00 
			
		
		
		
	fix(payment_methods): return appropriate error when basilisk locker token expires (#1517)
Co-authored-by: SamraatBansal <samraatbansal7@gmail.com>
This commit is contained in:
		| @ -203,6 +203,8 @@ pub enum StripeErrorCode { | ||||
|     WebhookProcessingError, | ||||
|     #[error(error_type = StripeErrorType::InvalidRequestError, code = "payment_method_unactivated", message = "The operation cannot be performed as the payment method used has not been activated. Activate the payment method in the Dashboard, then try again.")] | ||||
|     PaymentMethodUnactivated, | ||||
|     #[error(error_type = StripeErrorType::HyperswitchError, code = "", message = "{entity} expired or invalid")] | ||||
|     HyperswitchUnprocessableEntity { entity: String }, | ||||
|     // [#216]: https://github.com/juspay/hyperswitch/issues/216 | ||||
|     // Implement the remaining stripe error codes | ||||
|  | ||||
| @ -379,6 +381,9 @@ impl From<errors::ApiErrorResponse> for StripeErrorCode { | ||||
|                     param: field_name.to_string(), | ||||
|                 } | ||||
|             } | ||||
|             errors::ApiErrorResponse::UnprocessableEntity { entity } => { | ||||
|                 Self::HyperswitchUnprocessableEntity { entity } | ||||
|             } | ||||
|             errors::ApiErrorResponse::MissingRequiredFields { field_names } => { | ||||
|                 // Instead of creating a new error variant in StripeErrorCode for MissingRequiredFields, converted vec<&str> to String | ||||
|                 Self::ParameterMissing { | ||||
| @ -529,7 +534,9 @@ impl actix_web::ResponseError for StripeErrorCode { | ||||
|         match self { | ||||
|             Self::Unauthorized => StatusCode::UNAUTHORIZED, | ||||
|             Self::InvalidRequestUrl => StatusCode::NOT_FOUND, | ||||
|             Self::ParameterUnknown { .. } => StatusCode::UNPROCESSABLE_ENTITY, | ||||
|             Self::ParameterUnknown { .. } | Self::HyperswitchUnprocessableEntity { .. } => { | ||||
|                 StatusCode::UNPROCESSABLE_ENTITY | ||||
|             } | ||||
|             Self::ParameterMissing { .. } | ||||
|             | Self::RefundAmountExceedsPaymentAmount { .. } | ||||
|             | Self::PaymentIntentAuthenticationFailure { .. } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Shankar Singh C
					Shankar Singh C