mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-10-31 10:06:32 +08:00 
			
		
		
		
	feat(router): added dispute accept api, file module apis and dispute evidence submission api (#900)
Co-authored-by: Sangamesh <sangamesh.kulkarni@juspay.in> Co-authored-by: sai harsha <sai.harsha@sai.harsha-MacBookPro> Co-authored-by: Arun Raj M <jarnura47@gmail.com>
This commit is contained in:
		 Sai Harsha Vardhan
					Sai Harsha Vardhan
				
			
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			 GitHub
						GitHub
					
				
			
						parent
						
							bcbf4c882c
						
					
				
				
					commit
					bdf1e5147e
				
			| @ -182,6 +182,20 @@ pub enum StripeErrorCode { | ||||
|     IncorrectConnectorNameGiven, | ||||
|     #[error(error_type = StripeErrorType::HyperswitchError, code = "", message = "No such {object}: '{id}'")] | ||||
|     ResourceMissing { object: String, id: String }, | ||||
|     #[error(error_type = StripeErrorType::HyperswitchError, code = "", message = "File validation failed")] | ||||
|     FileValidationFailed, | ||||
|     #[error(error_type = StripeErrorType::HyperswitchError, code = "", message = "File not found in the request")] | ||||
|     MissingFile, | ||||
|     #[error(error_type = StripeErrorType::HyperswitchError, code = "", message = "File puropse not found in the request")] | ||||
|     MissingFilePurpose, | ||||
|     #[error(error_type = StripeErrorType::HyperswitchError, code = "", message = "File content type not found")] | ||||
|     MissingFileContentType, | ||||
|     #[error(error_type = StripeErrorType::HyperswitchError, code = "", message = "Dispute id not found in the request")] | ||||
|     MissingDisputeId, | ||||
|     #[error(error_type = StripeErrorType::HyperswitchError, code = "", message = "File does not exists in our records")] | ||||
|     FileNotFound, | ||||
|     #[error(error_type = StripeErrorType::HyperswitchError, code = "", message = "File not available")] | ||||
|     FileNotAvailable, | ||||
|     // [#216]: https://github.com/juspay/hyperswitch/issues/216 | ||||
|     // Implement the remaining stripe error codes | ||||
|  | ||||
| @ -466,6 +480,16 @@ impl From<errors::ApiErrorResponse> for StripeErrorCode { | ||||
|                 object: "dispute".to_owned(), | ||||
|                 id: dispute_id, | ||||
|             }, | ||||
|             errors::ApiErrorResponse::DisputeStatusValidationFailed { reason } => { | ||||
|                 Self::InternalServerError | ||||
|             } | ||||
|             errors::ApiErrorResponse::FileValidationFailed { .. } => Self::FileValidationFailed, | ||||
|             errors::ApiErrorResponse::MissingFile => Self::MissingFile, | ||||
|             errors::ApiErrorResponse::MissingFilePurpose => Self::MissingFilePurpose, | ||||
|             errors::ApiErrorResponse::MissingFileContentType => Self::MissingFileContentType, | ||||
|             errors::ApiErrorResponse::MissingDisputeId => Self::MissingDisputeId, | ||||
|             errors::ApiErrorResponse::FileNotFound => Self::FileNotFound, | ||||
|             errors::ApiErrorResponse::FileNotAvailable => Self::FileNotAvailable, | ||||
|             errors::ApiErrorResponse::NotSupported { .. } => Self::InternalServerError, | ||||
|         } | ||||
|     } | ||||
| @ -514,7 +538,14 @@ impl actix_web::ResponseError for StripeErrorCode { | ||||
|             | Self::PaymentIntentUnexpectedState { .. } | ||||
|             | Self::DuplicatePayment { .. } | ||||
|             | Self::IncorrectConnectorNameGiven | ||||
|             | Self::ResourceMissing { .. } => StatusCode::BAD_REQUEST, | ||||
|             | Self::ResourceMissing { .. } | ||||
|             | Self::FileValidationFailed | ||||
|             | Self::MissingFile | ||||
|             | Self::MissingFileContentType | ||||
|             | Self::MissingFilePurpose | ||||
|             | Self::MissingDisputeId | ||||
|             | Self::FileNotFound | ||||
|             | Self::FileNotAvailable => StatusCode::BAD_REQUEST, | ||||
|             Self::RefundFailed | ||||
|             | Self::InternalServerError | ||||
|             | Self::MandateActive | ||||
|  | ||||
| @ -56,6 +56,9 @@ where | ||||
|         } | ||||
|         Ok(api::ApplicationResponse::StatusOk) => api::http_response_ok(), | ||||
|         Ok(api::ApplicationResponse::TextPlain(text)) => api::http_response_plaintext(text), | ||||
|         Ok(api::ApplicationResponse::FileData((file_data, content_type))) => { | ||||
|             api::http_response_file_data(file_data, content_type) | ||||
|         } | ||||
|         Ok(api::ApplicationResponse::JsonForRedirection(response)) => { | ||||
|             match serde_json::to_string(&response) { | ||||
|                 Ok(res) => api::http_redirect_response(res, response), | ||||
|  | ||||
		Reference in New Issue
	
	Block a user