Skip to content

Commit

Permalink
feat(connector): [Fiuu] Consume error message thrown by connector for…
Browse files Browse the repository at this point in the history
… Psync flow and make extraP from response struct Secret (#6934)
  • Loading branch information
cookieg13 authored Dec 27, 2024
1 parent cb12e3d commit e393a03
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions crates/hyperswitch_connectors/src/connectors/fiuu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ impl webhooks::IncomingWebhook for Fiuu {
serde_urlencoded::from_bytes::<transformers::FiuuWebhooksPaymentResponse>(request.body)
.change_context(errors::ConnectorError::WebhookResourceObjectNotFound)?;
let mandate_reference = webhook_payment_response.extra_parameters.as_ref().and_then(|extra_p| {
let mandate_token: Result<ExtraParameters, _> = serde_json::from_str(extra_p);
let mandate_token: Result<ExtraParameters, _> = serde_json::from_str(&extra_p.clone().expose());
match mandate_token {
Ok(token) => {
token.token.as_ref().map(|token| hyperswitch_domain_models::router_flow_types::ConnectorMandateDetails {
Expand All @@ -918,7 +918,7 @@ impl webhooks::IncomingWebhook for Fiuu {
Err(err) => {
router_env::logger::warn!(
"Failed to convert 'extraP' from fiuu webhook response to fiuu::ExtraParameters. \
Input: '{}', Error: {}",
Input: '{:?}', Error: {}",
extra_p,
err
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1168,9 +1168,9 @@ impl TryFrom<PaymentsSyncResponseRouterData<FiuuPaymentResponse>> for PaymentsSy
let error_response = if status == enums::AttemptStatus::Failure {
Some(ErrorResponse {
status_code: item.http_code,
code: response.stat_code.to_string(),
message: response.stat_name.clone().to_string(),
reason: Some(response.stat_name.clone().to_string()),
code: response.error_code.clone(),
message: response.error_desc.clone(),
reason: Some(response.error_desc),
attempt_status: Some(enums::AttemptStatus::Failure),
connector_transaction_id: None,
})
Expand Down Expand Up @@ -1199,7 +1199,7 @@ impl TryFrom<PaymentsSyncResponseRouterData<FiuuPaymentResponse>> for PaymentsSy
status: response.status,
})?;
let mandate_reference = response.extra_parameters.as_ref().and_then(|extra_p| {
let mandate_token: Result<ExtraParameters, _> = serde_json::from_str(extra_p);
let mandate_token: Result<ExtraParameters, _> = serde_json::from_str(&extra_p.clone().expose());
match mandate_token {
Ok(token) => {
token.token.as_ref().map(|token| MandateReference {
Expand All @@ -1212,7 +1212,7 @@ impl TryFrom<PaymentsSyncResponseRouterData<FiuuPaymentResponse>> for PaymentsSy
Err(err) => {
router_env::logger::warn!(
"Failed to convert 'extraP' from fiuu webhook response to fiuu::ExtraParameters. \
Input: '{}', Error: {}",
Input: '{:?}', Error: {}",
extra_p,
err
);
Expand All @@ -1228,7 +1228,7 @@ impl TryFrom<PaymentsSyncResponseRouterData<FiuuPaymentResponse>> for PaymentsSy
.clone()
.unwrap_or(consts::NO_ERROR_CODE.to_owned()),
message: response
.error_code
.error_desc
.clone()
.unwrap_or(consts::NO_ERROR_MESSAGE.to_owned()),
reason: response.error_desc.clone(),
Expand Down Expand Up @@ -1697,7 +1697,7 @@ pub struct FiuuWebhooksPaymentResponse {
pub error_desc: Option<String>,
pub error_code: Option<String>,
#[serde(rename = "extraP")]
pub extra_parameters: Option<String>,
pub extra_parameters: Option<Secret<String>>,
}

#[derive(Debug, Deserialize, Serialize, Clone)]
Expand Down

0 comments on commit e393a03

Please # to comment.