mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-10-31 10:06:32 +08:00 
			
		
		
		
	fix: status goes from pending to partially captured in psync (#2915)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
		| @ -600,6 +600,29 @@ pub fn validate_request_amount_and_amount_to_capture( | ||||
|     } | ||||
| } | ||||
|  | ||||
| /// if confirm = true and capture method = automatic, amount_to_capture(if provided) must be equal to amount | ||||
| #[instrument(skip_all)] | ||||
| pub fn validate_amount_to_capture_in_create_call_request( | ||||
|     request: &api_models::payments::PaymentsRequest, | ||||
| ) -> CustomResult<(), errors::ApiErrorResponse> { | ||||
|     if request.capture_method.unwrap_or_default() == api_enums::CaptureMethod::Automatic | ||||
|         && request.confirm.unwrap_or(false) | ||||
|     { | ||||
|         if let Some((amount_to_capture, amount)) = request.amount_to_capture.zip(request.amount) { | ||||
|             let amount_int: i64 = amount.into(); | ||||
|             utils::when(amount_to_capture != amount_int, || { | ||||
|                 Err(report!(errors::ApiErrorResponse::PreconditionFailed { | ||||
|                     message: "amount_to_capture must be equal to amount when confirm = true and capture_method = automatic".into() | ||||
|                 })) | ||||
|             }) | ||||
|         } else { | ||||
|             Ok(()) | ||||
|         } | ||||
|     } else { | ||||
|         Ok(()) | ||||
|     } | ||||
| } | ||||
|  | ||||
| #[instrument(skip_all)] | ||||
| pub fn validate_card_data( | ||||
|     payment_method_data: Option<api::PaymentMethodData>, | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Hrithikesh
					Hrithikesh