Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

fix(connector): [Authorizedotnet] fix deserialization error for Paypal while canceling payment (#7141)

Swangi Kumari698a0aa75af6
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<String>,
+ payer_id: Option<Secret<String>>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct PaypalQueryParams {
#[serde(rename = "PayerID")]
- payer_id: Secret<String>,
+ payer_id: Option<Secret<String>>,
}
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<String> =
- serde_urlencoded::from_str::<PaypalQueryParams>(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)