Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

fix(connector): skip 3DS in `network_transaction_id` flow for cybersource (#5781)

Shankar Singh C84f079ccd0e9
diff --git a/crates/router/src/connector/cybersource.rs b/crates/router/src/connector/cybersource.rs
index 15242ddb11..806cf67b2d 100644
--- a/crates/router/src/connector/cybersource.rs
+++ b/crates/router/src/connector/cybersource.rs
@@ -901,7 +901,8 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
) -> CustomResult<String, errors::ConnectorError> {
if req.is_three_ds()
&& req.request.is_card()
- && req.request.connector_mandate_id().is_none()
+ && (req.request.connector_mandate_id().is_none()
+ && req.request.get_optional_network_transaction_id().is_none())
&& req.request.authentication_data.is_none()
{
Ok(format!(
@@ -929,7 +930,8 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
))?;
if req.is_three_ds()
&& req.request.is_card()
- && req.request.connector_mandate_id().is_none()
+ && (req.request.connector_mandate_id().is_none()
+ && req.request.get_optional_network_transaction_id().is_none())
&& req.request.authentication_data.is_none()
{
let connector_req =
@@ -970,7 +972,8 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {
if data.is_three_ds()
&& data.request.is_card()
- && data.request.connector_mandate_id().is_none()
+ && (data.request.connector_mandate_id().is_none()
+ && data.request.get_optional_network_transaction_id().is_none())
&& data.request.authentication_data.is_none()
{
let response: cybersource::CybersourceAuthSetupResponse = res
diff --git a/crates/router/src/connector/cybersource/transformers.rs b/crates/router/src/connector/cybersource/transformers.rs
index 2375dd578b..d1f15082ee 100644
--- a/crates/router/src/connector/cybersource/transformers.rs
+++ b/crates/router/src/connector/cybersource/transformers.rs
@@ -1043,12 +1043,23 @@ impl
Err(_) => None,
};
+ let security_code = if item
+ .router_data
+ .request
+ .get_optional_network_transaction_id()
+ .is_some()
+ {
+ None
+ } else {
+ Some(ccard.card_cvc)
+ };
+
let payment_information = PaymentInformation::Cards(Box::new(CardPaymentInformation {
card: Card {
number: ccard.card_number,
expiration_month: ccard.card_exp_month,
expiration_year: ccard.card_exp_year,
- security_code: Some(ccard.card_cvc),
+ security_code,
card_type: card_type.clone(),
},
}));
diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs
index d5c01503ed..f8eed11d16 100644
--- a/crates/router/src/connector/utils.rs
+++ b/crates/router/src/connector/utils.rs
@@ -763,6 +763,7 @@ pub trait PaymentsAuthorizeRequestData {
fn get_card(&self) -> Result<domain::Card, Error>;
fn get_return_url(&self) -> Result<String, Error>;
fn connector_mandate_id(&self) -> Option<String>;
+ fn get_optional_network_transaction_id(&self) -> Option<String>;
fn is_mandate_payment(&self) -> bool;
fn is_customer_initiated_mandate_payment(&self) -> bool;
fn get_webhook_url(&self) -> Result<String, Error>;
@@ -843,6 +844,18 @@ impl PaymentsAuthorizeRequestData for types::PaymentsAuthorizeData {
Some(payments::MandateReferenceId::NetworkMandateId(_)) | None => None,
})
}
+
+ fn get_optional_network_transaction_id(&self) -> Option<String> {
+ self.mandate_id
+ .as_ref()
+ .and_then(|mandate_ids| match &mandate_ids.mandate_reference_id {
+ Some(payments::MandateReferenceId::NetworkMandateId(network_transaction_id)) => {
+ Some(network_transaction_id.clone())
+ }
+ Some(payments::MandateReferenceId::ConnectorMandateId(_)) | None => None,
+ })
+ }
+
fn is_mandate_payment(&self) -> bool {
((self.customer_acceptance.is_some() || self.setup_mandate_details.is_some())
&& self.setup_future_usage.map_or(false, |setup_future_usage| {