From 698a0aa75af646107ac796f719b51e74530f11dc Mon Sep 17 00:00:00 2001 From: Swangi Kumari <85639103+swangi-kumari@users.noreply.github.com> Date: Wed, 5 Feb 2025 19:08:18 +0530 Subject: [PATCH] fix(connector): [Authorizedotnet] fix deserialization error for Paypal while canceling payment (#7141) --- .../src/connector/authorizedotnet/transformers.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/crates/router/src/connector/authorizedotnet/transformers.rs b/crates/router/src/connector/authorizedotnet/transformers.rs index 8e0af603a3..c430191a1e 100644 --- a/crates/router/src/connector/authorizedotnet/transformers.rs +++ b/crates/router/src/connector/authorizedotnet/transformers.rs @@ -1872,13 +1872,13 @@ pub struct PaypalPaymentConfirm { #[derive(Debug, Serialize, Deserialize)] pub struct Paypal { #[serde(rename = "payerID")] - payer_id: Secret, + payer_id: Option>, } #[derive(Debug, Serialize, Deserialize)] pub struct PaypalQueryParams { #[serde(rename = "PayerID")] - payer_id: Secret, + payer_id: Option>, } impl TryFrom<&AuthorizedotnetRouterData<&types::PaymentsCompleteAuthorizeRouterData>> @@ -1895,10 +1895,13 @@ impl TryFrom<&AuthorizedotnetRouterData<&types::PaymentsCompleteAuthorizeRouterD .as_ref() .and_then(|redirect_response| redirect_response.params.as_ref()) .ok_or(errors::ConnectorError::ResponseDeserializationFailed)?; - let payer_id: Secret = - serde_urlencoded::from_str::(params.peek()) - .change_context(errors::ConnectorError::ResponseDeserializationFailed)? - .payer_id; + + let query_params: PaypalQueryParams = serde_urlencoded::from_str(params.peek()) + .change_context(errors::ConnectorError::ResponseDeserializationFailed) + .attach_printable("Failed to parse connector response")?; + + let payer_id = query_params.payer_id; + let transaction_type = match item.router_data.request.capture_method { Some(enums::CaptureMethod::Manual) => Ok(TransactionType::ContinueAuthorization), Some(enums::CaptureMethod::SequentialAutomatic)