Skip to content

Commit 2c00767

Browse files
authored
fix(connector): [Paypal]fix paypal error reason mapping when it is empty string. (#2700)
1 parent d680eb2 commit 2c00767

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

crates/router/src/connector/paypal.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,13 @@ impl ConnectorCommon for Paypal {
190190
})
191191
})
192192
.transpose()?;
193-
let reason = error_reason
194-
.unwrap_or(response.message.to_owned())
195-
.is_empty()
196-
.then_some(response.message.to_owned());
193+
let reason = match error_reason {
194+
Some(err_reason) => err_reason
195+
.is_empty()
196+
.then(|| response.message.to_owned())
197+
.or(Some(err_reason)),
198+
None => Some(response.message.to_owned()),
199+
};
197200

198201
Ok(ErrorResponse {
199202
status_code: res.status_code,

0 commit comments

Comments
 (0)