From 688557ef95826622fe87a4de1dfbc09446496686 Mon Sep 17 00:00:00 2001 From: Sudharsan GS Date: Wed, 4 Oct 2023 23:08:05 +0530 Subject: [PATCH] feat(connector): [Noon] Use connector_response_reference_id as reference (#2442) --- .../router/src/connector/noon/transformers.rs | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/crates/router/src/connector/noon/transformers.rs b/crates/router/src/connector/noon/transformers.rs index d7dc832b445d..6c3084a75e4a 100644 --- a/crates/router/src/connector/noon/transformers.rs +++ b/crates/router/src/connector/noon/transformers.rs @@ -356,6 +356,7 @@ pub struct NoonPaymentsOrderResponse { id: u64, error_code: u64, error_message: Option, + reference: Option, } #[derive(Debug, Serialize, Deserialize)] @@ -410,14 +411,20 @@ impl reason: Some(error_message), status_code: item.http_code, }), - _ => Ok(types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::ConnectorTransactionId(order.id.to_string()), - redirection_data, - mandate_reference, - connector_metadata: None, - network_txn_id: None, - connector_response_reference_id: None, - }), + _ => { + let connector_response_reference_id = + order.reference.or(Some(order.id.to_string())); + Ok(types::PaymentsResponseData::TransactionResponse { + resource_id: types::ResponseId::ConnectorTransactionId( + order.id.to_string(), + ), + redirection_data, + mandate_reference, + connector_metadata: None, + network_txn_id: None, + connector_response_reference_id, + }) + } }, ..item.data }) @@ -660,6 +667,7 @@ impl From for NoonPaymentsResponse { //For successful payments Noon Always populates error_code as 0. error_code: 0, error_message: None, + reference: None, }, checkout_data: None, subscription: None,