diff --git a/crates/router/src/connector/cybersource/transformers.rs b/crates/router/src/connector/cybersource/transformers.rs index 106ce2e3c2..3558f75284 100644 --- a/crates/router/src/connector/cybersource/transformers.rs +++ b/crates/router/src/connector/cybersource/transformers.rs @@ -275,6 +275,13 @@ pub struct CybersourcePaymentsResponse { id: String, status: CybersourcePaymentStatus, error_information: Option, + client_reference_information: Option, +} + +#[derive(Default, Debug, Clone, Deserialize, Eq, PartialEq)] +#[serde(rename_all = "camelCase")] +pub struct ClientReferenceInformation { + code: Option, } #[derive(Default, Debug, Clone, Deserialize, Eq, PartialEq)] @@ -313,12 +320,18 @@ impl status_code: item.http_code, }), _ => Ok(types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::ConnectorTransactionId(item.response.id), + resource_id: types::ResponseId::ConnectorTransactionId( + item.response.id.clone(), + ), redirection_data: None, mandate_reference: None, connector_metadata: None, network_txn_id: None, - connector_response_reference_id: None, + connector_response_reference_id: item + .response + .client_reference_information + .map(|cref| cref.code) + .unwrap_or(Some(item.response.id)), }), }, ..item.data @@ -331,6 +344,7 @@ impl pub struct CybersourceTransactionResponse { id: String, application_information: ApplicationInformation, + client_reference_information: Option, } #[derive(Debug, Deserialize)] @@ -378,12 +392,16 @@ impl item.response.application_information.status.into(), ), response: Ok(types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::ConnectorTransactionId(item.response.id), + resource_id: types::ResponseId::ConnectorTransactionId(item.response.id.clone()), redirection_data: None, mandate_reference: None, connector_metadata: None, network_txn_id: None, - connector_response_reference_id: None, + connector_response_reference_id: item + .response + .client_reference_information + .map(|cref| cref.code) + .unwrap_or(Some(item.response.id)), }), ..item.data })