mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-01 11:06:50 +08:00
fix(connector): [Paypal]fix error deserelization for source verification call (#2611)
This commit is contained in:
@ -174,26 +174,31 @@ impl ConnectorCommon for Paypal {
|
|||||||
.map(|error_details| {
|
.map(|error_details| {
|
||||||
error_details
|
error_details
|
||||||
.iter()
|
.iter()
|
||||||
.try_fold::<_, _, CustomResult<_, errors::ConnectorError>>(
|
.try_fold(String::new(), |mut acc, error| {
|
||||||
String::new(),
|
if let Some(description) = &error.description {
|
||||||
|mut acc, error| {
|
write!(acc, "description - {} ;", description)
|
||||||
write!(acc, "description - {} ;", error.description)
|
|
||||||
.into_report()
|
.into_report()
|
||||||
.change_context(
|
.change_context(
|
||||||
errors::ConnectorError::ResponseDeserializationFailed,
|
errors::ConnectorError::ResponseDeserializationFailed,
|
||||||
)
|
)
|
||||||
.attach_printable("Failed to concatenate error details")
|
.attach_printable("Failed to concatenate error details")
|
||||||
.map(|_| acc)
|
.map(|_| acc)
|
||||||
},
|
} else {
|
||||||
)
|
Ok(acc)
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
.transpose()?;
|
.transpose()?;
|
||||||
|
let reason = error_reason
|
||||||
|
.unwrap_or(response.message.to_owned())
|
||||||
|
.is_empty()
|
||||||
|
.then_some(response.message.to_owned());
|
||||||
|
|
||||||
Ok(ErrorResponse {
|
Ok(ErrorResponse {
|
||||||
status_code: res.status_code,
|
status_code: res.status_code,
|
||||||
code: response.name,
|
code: response.name,
|
||||||
message: response.message.clone(),
|
message: response.message.clone(),
|
||||||
reason: error_reason.or(Some(response.message)),
|
reason,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1380,7 +1380,7 @@ pub struct PaypalOrderErrorResponse {
|
|||||||
#[derive(Default, Clone, Debug, Serialize, Deserialize, PartialEq)]
|
#[derive(Default, Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||||
pub struct ErrorDetails {
|
pub struct ErrorDetails {
|
||||||
pub issue: String,
|
pub issue: String,
|
||||||
pub description: String,
|
pub description: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
|
#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
|
||||||
|
|||||||
Reference in New Issue
Block a user