From d086fa69f483a8192379ea7fe283bedf548c3d46 Mon Sep 17 00:00:00 2001 From: Debarati Date: Tue, 24 Dec 2024 16:40:42 +0530 Subject: [PATCH] add improvements for fiuu connector --- .../hyperswitch_connectors/src/connectors/fiuu.rs | 4 ++-- .../src/connectors/fiuu/transformers.rs | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/crates/hyperswitch_connectors/src/connectors/fiuu.rs b/crates/hyperswitch_connectors/src/connectors/fiuu.rs index df2d0f5006fe..5a663d45cba0 100644 --- a/crates/hyperswitch_connectors/src/connectors/fiuu.rs +++ b/crates/hyperswitch_connectors/src/connectors/fiuu.rs @@ -904,7 +904,7 @@ impl webhooks::IncomingWebhook for Fiuu { serde_urlencoded::from_bytes::(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 = serde_json::from_str(extra_p); + let mandate_token: Result = 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 { @@ -914,7 +914,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 ); diff --git a/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs b/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs index 143cd1aa0474..14ce13f971b6 100644 --- a/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs @@ -1168,9 +1168,9 @@ impl TryFrom> 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, }) @@ -1199,7 +1199,7 @@ impl TryFrom> for PaymentsSy status: response.status, })?; let mandate_reference = response.extra_parameters.as_ref().and_then(|extra_p| { - let mandate_token: Result = serde_json::from_str(extra_p); + let mandate_token: Result = serde_json::from_str(&extra_p.clone().expose()); match mandate_token { Ok(token) => { token.token.as_ref().map(|token| MandateReference { @@ -1212,7 +1212,7 @@ impl TryFrom> 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 ); @@ -1228,7 +1228,7 @@ impl TryFrom> 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(), @@ -1697,7 +1697,7 @@ pub struct FiuuWebhooksPaymentResponse { pub error_desc: Option, pub error_code: Option, #[serde(rename = "extraP")] - pub extra_parameters: Option, + pub extra_parameters: Option>, } #[derive(Debug, Deserialize, Serialize, Clone)]