From 81cb8da4d47fe2a75330d39c665bb259faa35b00 Mon Sep 17 00:00:00 2001 From: Sahal Saad Date: Thu, 12 Oct 2023 13:57:50 +0800 Subject: [PATCH] feat(connector): [Cybersource] Use connector_request_reference_id as reference to the connector (#2512) Co-authored-by: Prasunna Soppa <70575890+prasunna09@users.noreply.github.com> --- .../src/connector/cybersource/transformers.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/crates/router/src/connector/cybersource/transformers.rs b/crates/router/src/connector/cybersource/transformers.rs index 3558f75284..5a3060f99e 100644 --- a/crates/router/src/connector/cybersource/transformers.rs +++ b/crates/router/src/connector/cybersource/transformers.rs @@ -21,6 +21,7 @@ pub struct CybersourcePaymentsRequest { processing_information: ProcessingInformation, payment_information: PaymentInformation, order_information: OrderInformationWithBill, + client_reference_information: ClientReferenceInformation, } #[derive(Default, Debug, Serialize, Eq, PartialEq)] @@ -150,10 +151,15 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for CybersourcePaymentsRequest capture_options: None, }; + let client_reference_information = ClientReferenceInformation { + code: Some(item.connector_request_reference_id.clone()), + }; + Ok(Self { processing_information, payment_information, order_information, + client_reference_information, }) } _ => Err(errors::ConnectorError::NotImplemented("Payment methods".to_string()).into()), @@ -179,6 +185,9 @@ impl TryFrom<&types::PaymentsCaptureRouterData> for CybersourcePaymentsRequest { }, ..Default::default() }, + client_reference_information: ClientReferenceInformation { + code: Some(value.connector_request_reference_id.clone()), + }, ..Default::default() }) } @@ -195,6 +204,9 @@ impl TryFrom<&types::RefundExecuteRouterData> for CybersourcePaymentsRequest { }, ..Default::default() }, + client_reference_information: ClientReferenceInformation { + code: Some(value.connector_request_reference_id.clone()), + }, ..Default::default() }) } @@ -278,7 +290,7 @@ pub struct CybersourcePaymentsResponse { client_reference_information: Option, } -#[derive(Default, Debug, Clone, Deserialize, Eq, PartialEq)] +#[derive(Default, Debug, Clone, Serialize, Deserialize, Eq, PartialEq)] #[serde(rename_all = "camelCase")] pub struct ClientReferenceInformation { code: Option,