From b96652507a6ab37f3c75aeb0cf715fd6454b9f32 Mon Sep 17 00:00:00 2001 From: Pa1NarK <69745008+pixincreate@users.noreply.github.com> Date: Mon, 5 Jun 2023 13:04:09 +0530 Subject: [PATCH] fix(Connector): [Adyen] Address Internal Server Error when calling PSync without redirection (#1311) --- crates/router/src/connector/adyen.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/router/src/connector/adyen.rs b/crates/router/src/connector/adyen.rs index 380a96c6b5..149beb97c6 100644 --- a/crates/router/src/connector/adyen.rs +++ b/crates/router/src/connector/adyen.rs @@ -310,12 +310,19 @@ impl &self, req: &types::RouterData, ) -> CustomResult, errors::ConnectorError> { + // Adyen doesn't support PSync flow. We use PSync flow to fetch payment details, + // specifically the redirect URL that takes the user to their Payment page. In non-redirection flows, + // we rely on webhooks to obtain the payment status since there is no encoded data available. + // encoded_data only includes the redirect URL and is only relevant in redirection flows. let encoded_data = req .request .encoded_data .clone() .get_required_value("encoded_data") - .change_context(errors::ConnectorError::RequestEncodingFailed)?; + .change_context(errors::ConnectorError::FlowNotSupported { + flow: String::from("PSync"), + connector: self.id().to_string(), + })?; let adyen_redirection_type = serde_urlencoded::from_str::< transformers::AdyenRedirectRequestTypes,