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
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
fix(connector): [Paypal]fix error deserelization for source verification call (#2611)
chikke srujanda77d1393b8f
diff --git a/crates/router/src/connector/paypal.rs b/crates/router/src/connector/paypal.rsindex a0a787269e..4a1689338f 100644--- a/crates/router/src/connector/paypal.rs+++ b/crates/router/src/connector/paypal.rs@@ -174,26 +174,31 @@ impl ConnectorCommon for Paypal {.map(|error_details| {error_details.iter()- .try_fold::<_, _, CustomResult<_, errors::ConnectorError>>(- String::new(),- |mut acc, error| {- write!(acc, "description - {} ;", error.description)+ .try_fold(String::new(), |mut acc, error| {+ if let Some(description) = &error.description {+ write!(acc, "description - {} ;", description).into_report().change_context(errors::ConnectorError::ResponseDeserializationFailed,).attach_printable("Failed to concatenate error details").map(|_| acc)- },- )+ } else {+ Ok(acc)+ }+ })}).transpose()?;+ let reason = error_reason+ .unwrap_or(response.message.to_owned())+ .is_empty()+ .then_some(response.message.to_owned());Ok(ErrorResponse {status_code: res.status_code,code: response.name,message: response.message.clone(),- reason: error_reason.or(Some(response.message)),+ reason,})}}diff --git a/crates/router/src/connector/paypal/transformers.rs b/crates/router/src/connector/paypal/transformers.rsindex 72dccaed73..927c33277a 100644--- a/crates/router/src/connector/paypal/transformers.rs+++ b/crates/router/src/connector/paypal/transformers.rs@@ -1380,7 +1380,7 @@ pub struct PaypalOrderErrorResponse {#[derive(Default, Clone, Debug, Serialize, Deserialize, PartialEq)]pub struct ErrorDetails {pub issue: String,- pub description: String,+ pub description: Option<String>,}#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]