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): [Paypal]fix paypal error reason mapping when it is empty string. (#2700)

chikke srujan2c007675aec1
diff --git a/crates/router/src/connector/paypal.rs b/crates/router/src/connector/paypal.rs
index 120795bef9..854d48dcaa 100644
--- a/crates/router/src/connector/paypal.rs
+++ b/crates/router/src/connector/paypal.rs
@@ -190,10 +190,13 @@ impl ConnectorCommon for Paypal {
})
})
.transpose()?;
- let reason = error_reason
- .unwrap_or(response.message.to_owned())
- .is_empty()
- .then_some(response.message.to_owned());
+ let reason = match error_reason {
+ Some(err_reason) => err_reason
+ .is_empty()
+ .then(|| response.message.to_owned())
+ .or(Some(err_reason)),
+ None => Some(response.message.to_owned()),
+ };
Ok(ErrorResponse {
status_code: res.status_code,