mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-11-01 02:57:02 +08:00 
			
		
		
		
	feat(connector): (adyen) add support for multiple partial capture adyen (#2102)
This commit is contained in:
		| @ -1450,16 +1450,30 @@ pub(crate) fn validate_capture_method( | ||||
| } | ||||
|  | ||||
| #[instrument(skip_all)] | ||||
| pub(crate) fn validate_status(status: storage_enums::IntentStatus) -> RouterResult<()> { | ||||
| pub(crate) fn validate_status_with_capture_method( | ||||
|     status: storage_enums::IntentStatus, | ||||
|     capture_method: storage_enums::CaptureMethod, | ||||
| ) -> RouterResult<()> { | ||||
|     if status == storage_enums::IntentStatus::Processing | ||||
|         && !(capture_method == storage_enums::CaptureMethod::ManualMultiple) | ||||
|     { | ||||
|         return Err(report!(errors::ApiErrorResponse::PaymentUnexpectedState { | ||||
|             field_name: "capture_method".to_string(), | ||||
|             current_flow: "captured".to_string(), | ||||
|             current_value: capture_method.to_string(), | ||||
|             states: "manual_multiple".to_string() | ||||
|         })); | ||||
|     } | ||||
|     utils::when( | ||||
|         status != storage_enums::IntentStatus::RequiresCapture | ||||
|             && status != storage_enums::IntentStatus::PartiallyCaptured, | ||||
|             && status != storage_enums::IntentStatus::PartiallyCaptured | ||||
|             && status != storage_enums::IntentStatus::Processing, | ||||
|         || { | ||||
|             Err(report!(errors::ApiErrorResponse::PaymentUnexpectedState { | ||||
|                 field_name: "payment.status".to_string(), | ||||
|                 current_flow: "captured".to_string(), | ||||
|                 current_value: status.to_string(), | ||||
|                 states: "requires_capture, partially captured".to_string() | ||||
|                 states: "requires_capture, partially_captured, processing".to_string() | ||||
|             })) | ||||
|         }, | ||||
|     ) | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Hrithikesh
					Hrithikesh