From e5627fbab9916b9c1d9d4eb5819451110916229c Mon Sep 17 00:00:00 2001 From: AkshayaFoiger Date: Thu, 11 Jan 2024 18:22:10 +0530 Subject: [PATCH 01/12] send merchant metadata to bluesnap --- .../src/connector/bluesnap/transformers.rs | 65 ++++++++++++++++++- .../router/src/core/payments/transformers.rs | 1 + crates/router/src/types.rs | 1 + 3 files changed, 65 insertions(+), 2 deletions(-) diff --git a/crates/router/src/connector/bluesnap/transformers.rs b/crates/router/src/connector/bluesnap/transformers.rs index 17cdf3b519bb..4970516e649a 100644 --- a/crates/router/src/connector/bluesnap/transformers.rs +++ b/crates/router/src/connector/bluesnap/transformers.rs @@ -1,3 +1,5 @@ +use std::collections::HashMap; + use api_models::{enums as api_enums, payments}; use base64::Engine; use common_utils::{ @@ -8,6 +10,7 @@ use common_utils::{ use error_stack::{IntoReport, ResultExt}; use masking::{ExposeInterface, PeekInterface}; use serde::{Deserialize, Serialize}; +use serde_json::Value; use crate::{ connector::utils::{ @@ -17,7 +20,11 @@ use crate::{ consts, core::errors, pii::Secret, - types::{self, api, storage::enums, transformers::ForeignTryFrom}, + types::{ + self, api, + storage::enums, + transformers::{ForeignFrom, ForeignTryFrom}, + }, utils::{Encode, OptionExt}, }; @@ -63,6 +70,21 @@ pub struct BluesnapPaymentsRequest { transaction_fraud_info: Option, card_holder_info: Option, merchant_transaction_id: Option, + transaction_meta_data: Option, +} + +#[derive(Debug, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct BluesnapMetadata { + meta_data: Vec, +} + +#[derive(Debug, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct RequestMetadata { + meta_key: String, + meta_value: String, + is_visible: String, //Property controlling whether the transaction metadata is visible in the invoice (Y) or hidden (N). } #[derive(Debug, Serialize)] @@ -241,6 +263,13 @@ impl TryFrom<&BluesnapRouterData<&types::PaymentsAuthorizeRouterData>> for Blues Some(enums::CaptureMethod::Manual) => BluesnapTxnType::AuthOnly, _ => BluesnapTxnType::AuthCapture, }; + let transaction_meta_data = match item.router_data.request.metadata.as_ref() { + Some(metadata) => Some(BluesnapMetadata { + meta_data: Vec::::foreign_try_from(metadata.peek().to_owned())?, + }), + None => None, + }; + let (payment_method, card_holder_info) = match item .router_data .request @@ -405,6 +434,7 @@ impl TryFrom<&BluesnapRouterData<&types::PaymentsAuthorizeRouterData>> for Blues }), card_holder_info, merchant_transaction_id: Some(item.router_data.connector_request_reference_id.clone()), + transaction_meta_data, }) } } @@ -569,6 +599,7 @@ pub struct BluesnapCompletePaymentsRequest { transaction_fraud_info: Option, card_holder_info: Option, merchant_transaction_id: Option, + transaction_meta_data: Option, } impl TryFrom<&BluesnapRouterData<&types::PaymentsCompleteAuthorizeRouterData>> @@ -590,6 +621,13 @@ impl TryFrom<&BluesnapRouterData<&types::PaymentsCompleteAuthorizeRouterData>> .parse_value("BluesnapRedirectionResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; + let transaction_meta_data = match item.router_data.request.metadata.as_ref() { + Some(metadata) => Some(BluesnapMetadata { + meta_data: Vec::::foreign_try_from(metadata.peek().to_owned())?, + }), + None => None, + }; + let pf_token = item .router_data .request @@ -637,6 +675,7 @@ impl TryFrom<&BluesnapRouterData<&types::PaymentsCompleteAuthorizeRouterData>> )?, merchant_transaction_id: Some(item.router_data.connector_request_reference_id.clone()), pf_token, + transaction_meta_data, }) } } @@ -1021,7 +1060,7 @@ pub struct BluesnapWebhookObjectResource { reversal_ref_num: Option, } -impl TryFrom for serde_json::Value { +impl TryFrom for Value { type Error = error_stack::Report; fn try_from(details: BluesnapWebhookObjectResource) -> Result { let (card_transaction_type, processing_status, transaction_id) = match details @@ -1118,3 +1157,25 @@ impl From for utils::ErrorCodeAndMessage { } } } + +impl ForeignTryFrom for Vec { + type Error = error_stack::Report; + fn foreign_try_from(metadata: Value) -> Result { + crate::logger::debug!("bbbbbbbbbb{:?}", metadata.clone()); + let hashmap: HashMap = serde_json::from_str(&metadata.to_string()) + .ok() + .ok_or(errors::ConnectorError::RequestEncodingFailedWithReason( + "Metadata not in format".to_string(), + ))?; + let mut vector: Self = Self::new(); + for (key, value) in hashmap { + crate::logger::debug!("aaaaaaaa{:?}:{:?}", key.clone(), value.clone()); + vector.push(RequestMetadata { + meta_key: key, + meta_value: value, + is_visible: "Y".to_owned(), + }); + } + Ok(vector) + } +} diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs index 5a3a322fb14d..ef1e4bb03301 100644 --- a/crates/router/src/core/payments/transformers.rs +++ b/crates/router/src/core/payments/transformers.rs @@ -1463,6 +1463,7 @@ impl TryFrom> for types::CompleteAuthoriz connector_transaction_id: payment_data.payment_attempt.connector_transaction_id, redirect_response, connector_meta: payment_data.payment_attempt.connector_metadata, + metadata: payment_data.payment_intent.metadata, }) } } diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs index 7cd45a0192f0..825a4220f268 100644 --- a/crates/router/src/types.rs +++ b/crates/router/src/types.rs @@ -510,6 +510,7 @@ pub struct CompleteAuthorizeData { pub browser_info: Option, pub connector_transaction_id: Option, pub connector_meta: Option, + pub metadata: Option, } #[derive(Debug, Clone)] From fc8f2754fdf8e0b58c037165c3ae41b6741a75b9 Mon Sep 17 00:00:00 2001 From: AkshayaFoiger Date: Fri, 12 Jan 2024 11:40:33 +0530 Subject: [PATCH 02/12] fix clippy error --- crates/router/src/connector/bluesnap/transformers.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/router/src/connector/bluesnap/transformers.rs b/crates/router/src/connector/bluesnap/transformers.rs index 4970516e649a..5d68f217a316 100644 --- a/crates/router/src/connector/bluesnap/transformers.rs +++ b/crates/router/src/connector/bluesnap/transformers.rs @@ -23,7 +23,7 @@ use crate::{ types::{ self, api, storage::enums, - transformers::{ForeignFrom, ForeignTryFrom}, + transformers::ForeignTryFrom, }, utils::{Encode, OptionExt}, }; From 6209e8846979b888f5380a721aeea80786d32d3d Mon Sep 17 00:00:00 2001 From: "hyperswitch-bot[bot]" <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Date: Fri, 12 Jan 2024 06:11:12 +0000 Subject: [PATCH 03/12] chore: run formatter --- crates/router/src/connector/bluesnap/transformers.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/crates/router/src/connector/bluesnap/transformers.rs b/crates/router/src/connector/bluesnap/transformers.rs index 5d68f217a316..2bf1614b17d7 100644 --- a/crates/router/src/connector/bluesnap/transformers.rs +++ b/crates/router/src/connector/bluesnap/transformers.rs @@ -20,11 +20,7 @@ use crate::{ consts, core::errors, pii::Secret, - types::{ - self, api, - storage::enums, - transformers::ForeignTryFrom, - }, + types::{self, api, storage::enums, transformers::ForeignTryFrom}, utils::{Encode, OptionExt}, }; From d2fdd9c731013cc9b517608f5d23e308e54854b2 Mon Sep 17 00:00:00 2001 From: AkshayaFoiger Date: Fri, 12 Jan 2024 11:46:40 +0530 Subject: [PATCH 04/12] remove logger --- crates/router/src/connector/bluesnap/transformers.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/crates/router/src/connector/bluesnap/transformers.rs b/crates/router/src/connector/bluesnap/transformers.rs index 2bf1614b17d7..344bf29ef576 100644 --- a/crates/router/src/connector/bluesnap/transformers.rs +++ b/crates/router/src/connector/bluesnap/transformers.rs @@ -1157,15 +1157,13 @@ impl From for utils::ErrorCodeAndMessage { impl ForeignTryFrom for Vec { type Error = error_stack::Report; fn foreign_try_from(metadata: Value) -> Result { - crate::logger::debug!("bbbbbbbbbb{:?}", metadata.clone()); let hashmap: HashMap = serde_json::from_str(&metadata.to_string()) .ok() .ok_or(errors::ConnectorError::RequestEncodingFailedWithReason( - "Metadata not in format".to_string(), + "Metadata is not in the expected format".to_string(), ))?; let mut vector: Self = Self::new(); for (key, value) in hashmap { - crate::logger::debug!("aaaaaaaa{:?}:{:?}", key.clone(), value.clone()); vector.push(RequestMetadata { meta_key: key, meta_value: value, From c385a39f001bdfdcac22ef192c4b533a6aabc1ca Mon Sep 17 00:00:00 2001 From: AkshayaFoiger Date: Fri, 12 Jan 2024 17:13:04 +0530 Subject: [PATCH 05/12] remove throwing error for metadata parsing --- .../src/connector/bluesnap/transformers.rs | 49 ++++++++++--------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/crates/router/src/connector/bluesnap/transformers.rs b/crates/router/src/connector/bluesnap/transformers.rs index 344bf29ef576..895d9ad44d86 100644 --- a/crates/router/src/connector/bluesnap/transformers.rs +++ b/crates/router/src/connector/bluesnap/transformers.rs @@ -20,6 +20,7 @@ use crate::{ consts, core::errors, pii::Secret, + routes::metrics, types::{self, api, storage::enums, transformers::ForeignTryFrom}, utils::{Encode, OptionExt}, }; @@ -75,12 +76,13 @@ pub struct BluesnapMetadata { meta_data: Vec, } -#[derive(Debug, Serialize)] +#[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct RequestMetadata { - meta_key: String, - meta_value: String, - is_visible: String, //Property controlling whether the transaction metadata is visible in the invoice (Y) or hidden (N). + meta_key: Option, + meta_value: Option, + meta_description: Option, + is_visible: Option, } #[derive(Debug, Serialize)] @@ -260,9 +262,9 @@ impl TryFrom<&BluesnapRouterData<&types::PaymentsAuthorizeRouterData>> for Blues _ => BluesnapTxnType::AuthCapture, }; let transaction_meta_data = match item.router_data.request.metadata.as_ref() { - Some(metadata) => Some(BluesnapMetadata { - meta_data: Vec::::foreign_try_from(metadata.peek().to_owned())?, - }), + Some(metadata) => Vec::::foreign_try_from(metadata.peek().to_owned()) + .ok() + .map(|meta_data| BluesnapMetadata { meta_data }), None => None, }; @@ -618,9 +620,9 @@ impl TryFrom<&BluesnapRouterData<&types::PaymentsCompleteAuthorizeRouterData>> .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; let transaction_meta_data = match item.router_data.request.metadata.as_ref() { - Some(metadata) => Some(BluesnapMetadata { - meta_data: Vec::::foreign_try_from(metadata.peek().to_owned())?, - }), + Some(metadata) => Vec::::foreign_try_from(metadata.peek().to_owned()) + .ok() + .map(|meta_data| BluesnapMetadata { meta_data }), None => None, }; @@ -1157,19 +1159,20 @@ impl From for utils::ErrorCodeAndMessage { impl ForeignTryFrom for Vec { type Error = error_stack::Report; fn foreign_try_from(metadata: Value) -> Result { - let hashmap: HashMap = serde_json::from_str(&metadata.to_string()) - .ok() - .ok_or(errors::ConnectorError::RequestEncodingFailedWithReason( - "Metadata is not in the expected format".to_string(), - ))?; - let mut vector: Self = Self::new(); - for (key, value) in hashmap { - vector.push(RequestMetadata { - meta_key: key, - meta_value: value, - is_visible: "Y".to_owned(), - }); + let merchant_metadata: Result, _> = + serde_json::from_str(&metadata.to_string()); + match merchant_metadata { + Ok(metadata_vector) => Ok(metadata_vector), + Err(_) => { + metrics::REQUEST_BUILD_FAILURE.add( + &metrics::CONTEXT, + 1, + &[metrics::request::add_attributes("connector", "bluesnap")], + ); + Err(errors::ConnectorError::InvalidDataFormat { + field_name: "Metadata is not in the expected format", + })? + } } - Ok(vector) } } From 126d49ba43f32789d7e15d08ca5abdb072049267 Mon Sep 17 00:00:00 2001 From: AkshayaFoiger Date: Fri, 12 Jan 2024 17:13:46 +0530 Subject: [PATCH 06/12] fix cargo clippy --- crates/router/src/connector/bluesnap/transformers.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/router/src/connector/bluesnap/transformers.rs b/crates/router/src/connector/bluesnap/transformers.rs index 895d9ad44d86..afa5f21cf86c 100644 --- a/crates/router/src/connector/bluesnap/transformers.rs +++ b/crates/router/src/connector/bluesnap/transformers.rs @@ -1,4 +1,3 @@ -use std::collections::HashMap; use api_models::{enums as api_enums, payments}; use base64::Engine; From e9f1101f1cfb245e70aea11c2633b0d8c2379a7d Mon Sep 17 00:00:00 2001 From: AkshayaFoiger Date: Fri, 12 Jan 2024 18:05:27 +0530 Subject: [PATCH 07/12] fix RequestMetadata serialization --- crates/router/src/connector/bluesnap/transformers.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/router/src/connector/bluesnap/transformers.rs b/crates/router/src/connector/bluesnap/transformers.rs index afa5f21cf86c..b7a630134ea2 100644 --- a/crates/router/src/connector/bluesnap/transformers.rs +++ b/crates/router/src/connector/bluesnap/transformers.rs @@ -76,7 +76,7 @@ pub struct BluesnapMetadata { } #[derive(Debug, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] +#[serde(rename_all(serialize = "camelCase", deserialize = "snake_case"))] pub struct RequestMetadata { meta_key: Option, meta_value: Option, From 55f21d95cd513d8966136bd092e52cd2b39117c4 Mon Sep 17 00:00:00 2001 From: AkshayaFoiger Date: Fri, 12 Jan 2024 18:26:15 +0530 Subject: [PATCH 08/12] refactor bluesnap metadata --- .../src/connector/bluesnap/transformers.rs | 48 ++++++++----------- 1 file changed, 20 insertions(+), 28 deletions(-) diff --git a/crates/router/src/connector/bluesnap/transformers.rs b/crates/router/src/connector/bluesnap/transformers.rs index b7a630134ea2..85b334316eaf 100644 --- a/crates/router/src/connector/bluesnap/transformers.rs +++ b/crates/router/src/connector/bluesnap/transformers.rs @@ -1,4 +1,6 @@ +use std::collections::HashMap; + use api_models::{enums as api_enums, payments}; use base64::Engine; use common_utils::{ @@ -19,8 +21,7 @@ use crate::{ consts, core::errors, pii::Secret, - routes::metrics, - types::{self, api, storage::enums, transformers::ForeignTryFrom}, + types::{self, api, storage::enums, transformers::{ForeignFrom, ForeignTryFrom}}, utils::{Encode, OptionExt}, }; @@ -76,11 +77,10 @@ pub struct BluesnapMetadata { } #[derive(Debug, Serialize, Deserialize)] -#[serde(rename_all(serialize = "camelCase", deserialize = "snake_case"))] +#[serde(rename_all = "camelCase")] pub struct RequestMetadata { meta_key: Option, meta_value: Option, - meta_description: Option, is_visible: Option, } @@ -261,9 +261,7 @@ impl TryFrom<&BluesnapRouterData<&types::PaymentsAuthorizeRouterData>> for Blues _ => BluesnapTxnType::AuthCapture, }; let transaction_meta_data = match item.router_data.request.metadata.as_ref() { - Some(metadata) => Vec::::foreign_try_from(metadata.peek().to_owned()) - .ok() - .map(|meta_data| BluesnapMetadata { meta_data }), + Some(metadata) => Some( BluesnapMetadata {meta_data : Vec::::foreign_from(metadata.peek().to_owned()) }), None => None, }; @@ -619,10 +617,9 @@ impl TryFrom<&BluesnapRouterData<&types::PaymentsCompleteAuthorizeRouterData>> .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; let transaction_meta_data = match item.router_data.request.metadata.as_ref() { - Some(metadata) => Vec::::foreign_try_from(metadata.peek().to_owned()) - .ok() - .map(|meta_data| BluesnapMetadata { meta_data }), - None => None, + Some(metadata) => Some( BluesnapMetadata {meta_data : Vec::::foreign_from(metadata.peek().to_owned()) }), + + None => None }; let pf_token = item @@ -1155,23 +1152,18 @@ impl From for utils::ErrorCodeAndMessage { } } -impl ForeignTryFrom for Vec { - type Error = error_stack::Report; - fn foreign_try_from(metadata: Value) -> Result { - let merchant_metadata: Result, _> = - serde_json::from_str(&metadata.to_string()); - match merchant_metadata { - Ok(metadata_vector) => Ok(metadata_vector), - Err(_) => { - metrics::REQUEST_BUILD_FAILURE.add( - &metrics::CONTEXT, - 1, - &[metrics::request::add_attributes("connector", "bluesnap")], - ); - Err(errors::ConnectorError::InvalidDataFormat { - field_name: "Metadata is not in the expected format", - })? - } +impl ForeignFrom for Vec { + fn foreign_from(metadata: Value) -> Self { + let hashmap: HashMap, Option> = + serde_json::from_str(&metadata.to_string()).unwrap_or(HashMap::new()); + let mut vector: Self = Self::new(); + for (key, value) in hashmap { + vector.push(RequestMetadata { + meta_key : key, + meta_value: value.map(|field_value| field_value.to_string()), + is_visible: Some("Y".to_string()) + }); } + vector } } From 285442f8dbbbdceb28065f6e45464e3fac47bc50 Mon Sep 17 00:00:00 2001 From: "hyperswitch-bot[bot]" <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Date: Fri, 12 Jan 2024 12:57:09 +0000 Subject: [PATCH 09/12] chore: run formatter --- .../src/connector/bluesnap/transformers.rs | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/crates/router/src/connector/bluesnap/transformers.rs b/crates/router/src/connector/bluesnap/transformers.rs index 85b334316eaf..9b65171cc7a6 100644 --- a/crates/router/src/connector/bluesnap/transformers.rs +++ b/crates/router/src/connector/bluesnap/transformers.rs @@ -1,4 +1,3 @@ - use std::collections::HashMap; use api_models::{enums as api_enums, payments}; @@ -21,7 +20,11 @@ use crate::{ consts, core::errors, pii::Secret, - types::{self, api, storage::enums, transformers::{ForeignFrom, ForeignTryFrom}}, + types::{ + self, api, + storage::enums, + transformers::{ForeignFrom, ForeignTryFrom}, + }, utils::{Encode, OptionExt}, }; @@ -261,7 +264,9 @@ impl TryFrom<&BluesnapRouterData<&types::PaymentsAuthorizeRouterData>> for Blues _ => BluesnapTxnType::AuthCapture, }; let transaction_meta_data = match item.router_data.request.metadata.as_ref() { - Some(metadata) => Some( BluesnapMetadata {meta_data : Vec::::foreign_from(metadata.peek().to_owned()) }), + Some(metadata) => Some(BluesnapMetadata { + meta_data: Vec::::foreign_from(metadata.peek().to_owned()), + }), None => None, }; @@ -617,9 +622,11 @@ impl TryFrom<&BluesnapRouterData<&types::PaymentsCompleteAuthorizeRouterData>> .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; let transaction_meta_data = match item.router_data.request.metadata.as_ref() { - Some(metadata) => Some( BluesnapMetadata {meta_data : Vec::::foreign_from(metadata.peek().to_owned()) }), + Some(metadata) => Some(BluesnapMetadata { + meta_data: Vec::::foreign_from(metadata.peek().to_owned()), + }), - None => None + None => None, }; let pf_token = item @@ -1159,9 +1166,9 @@ impl ForeignFrom for Vec { let mut vector: Self = Self::new(); for (key, value) in hashmap { vector.push(RequestMetadata { - meta_key : key, + meta_key: key, meta_value: value.map(|field_value| field_value.to_string()), - is_visible: Some("Y".to_string()) + is_visible: Some("Y".to_string()), }); } vector From e96c62ad2f563200d442ec186191179d90b5957f Mon Sep 17 00:00:00 2001 From: AkshayaFoiger Date: Fri, 19 Jan 2024 12:21:31 +0530 Subject: [PATCH 10/12] fix(clippy): refactor transaction_metadata --- .../src/connector/bluesnap/transformers.rs | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/crates/router/src/connector/bluesnap/transformers.rs b/crates/router/src/connector/bluesnap/transformers.rs index 9b65171cc7a6..1565dc18bc61 100644 --- a/crates/router/src/connector/bluesnap/transformers.rs +++ b/crates/router/src/connector/bluesnap/transformers.rs @@ -263,12 +263,14 @@ impl TryFrom<&BluesnapRouterData<&types::PaymentsAuthorizeRouterData>> for Blues Some(enums::CaptureMethod::Manual) => BluesnapTxnType::AuthOnly, _ => BluesnapTxnType::AuthCapture, }; - let transaction_meta_data = match item.router_data.request.metadata.as_ref() { - Some(metadata) => Some(BluesnapMetadata { - meta_data: Vec::::foreign_from(metadata.peek().to_owned()), - }), - None => None, - }; + let transaction_meta_data = + item.router_data + .request + .metadata + .as_ref() + .map(|metadata| BluesnapMetadata { + meta_data: Vec::::foreign_from(metadata.peek().to_owned()), + }); let (payment_method, card_holder_info) = match item .router_data @@ -621,13 +623,14 @@ impl TryFrom<&BluesnapRouterData<&types::PaymentsCompleteAuthorizeRouterData>> .parse_value("BluesnapRedirectionResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; - let transaction_meta_data = match item.router_data.request.metadata.as_ref() { - Some(metadata) => Some(BluesnapMetadata { - meta_data: Vec::::foreign_from(metadata.peek().to_owned()), - }), - - None => None, - }; + let transaction_meta_data = + item.router_data + .request + .metadata + .as_ref() + .map(|metadata| BluesnapMetadata { + meta_data: Vec::::foreign_from(metadata.peek().to_owned()), + }); let pf_token = item .router_data From 535311f91c178a5c42a46012eac6d7ac57d24a50 Mon Sep 17 00:00:00 2001 From: AkshayaFoiger Date: Tue, 23 Jan 2024 16:13:08 +0530 Subject: [PATCH 11/12] resolve comment --- crates/router/src/connector/bluesnap/transformers.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/router/src/connector/bluesnap/transformers.rs b/crates/router/src/connector/bluesnap/transformers.rs index 1565dc18bc61..56548b6ca3db 100644 --- a/crates/router/src/connector/bluesnap/transformers.rs +++ b/crates/router/src/connector/bluesnap/transformers.rs @@ -28,6 +28,8 @@ use crate::{ utils::{Encode, OptionExt}, }; +const IS_METADATA_VISIBLE: &str = "Y"; + #[derive(Debug, Serialize)] pub struct BluesnapRouterData { pub amount: String, @@ -1171,7 +1173,7 @@ impl ForeignFrom for Vec { vector.push(RequestMetadata { meta_key: key, meta_value: value.map(|field_value| field_value.to_string()), - is_visible: Some("Y".to_string()), + is_visible: Some(IS_METADATA_VISIBLE.to_string()), }); } vector From d95dbf694b9ed19943d02c6eb230574a883c0c63 Mon Sep 17 00:00:00 2001 From: AkshayaFoiger Date: Tue, 23 Jan 2024 16:15:21 +0530 Subject: [PATCH 12/12] update variable name --- crates/router/src/connector/bluesnap/transformers.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/router/src/connector/bluesnap/transformers.rs b/crates/router/src/connector/bluesnap/transformers.rs index 56548b6ca3db..e98b98e874aa 100644 --- a/crates/router/src/connector/bluesnap/transformers.rs +++ b/crates/router/src/connector/bluesnap/transformers.rs @@ -28,7 +28,7 @@ use crate::{ utils::{Encode, OptionExt}, }; -const IS_METADATA_VISIBLE: &str = "Y"; +const DISPLAY_METADATA: &str = "Y"; #[derive(Debug, Serialize)] pub struct BluesnapRouterData { @@ -1173,7 +1173,7 @@ impl ForeignFrom for Vec { vector.push(RequestMetadata { meta_key: key, meta_value: value.map(|field_value| field_value.to_string()), - is_visible: Some(IS_METADATA_VISIBLE.to_string()), + is_visible: Some(DISPLAY_METADATA.to_string()), }); } vector