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
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
fix(checkout): send external 3DS authentication data to connector for no_3ds payments (#13776)
Aniket Burman0ba2044ffcd1
diff --git a/crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs b/crates/hyperswitch_connectors/src/connectors/checkout/transformers.rsindex 99e08da215..a2606f364e 100644--- a/crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs@@ -963,30 +963,38 @@ impl TryFrom<&CheckoutRouterData<&PaymentsAuthorizeRouterData>> for PaymentsRequlet authentication_data = item.router_data.request.authentication_data.as_ref();- let three_ds = match item.router_data.auth_type {- enums::AuthenticationType::ThreeDs => CheckoutThreeDS {- enabled: true,- force_3ds: true,- eci: authentication_data.and_then(|auth| auth.eci.clone()),- cryptogram: authentication_data.map(|auth| auth.cavv.clone()),- xid: authentication_data- .and_then(|auth| auth.threeds_server_transaction_id.clone()),- version: authentication_data.and_then(|auth| {- auth.message_version- .clone()- .map(|version| version.to_string())- }),- challenge_indicator,- },- enums::AuthenticationType::NoThreeDs => CheckoutThreeDS {+ let three_ds = if let Some(auth) = authentication_data {+ // External 3DS passthrough: merchant already authenticated, send proof without asking Checkout to re-run 3DS+ CheckoutThreeDS {enabled: false,force_3ds: false,- eci: None,- cryptogram: None,- xid: None,- version: None,+ eci: auth.eci.clone(),+ cryptogram: Some(auth.cavv.clone()),+ xid: auth.threeds_server_transaction_id.clone(),+ version: auth.message_version.clone().map(|v| v.to_string()),challenge_indicator: CheckoutChallengeIndicator::NoPreference,- },+ }+ } else {+ match item.router_data.auth_type {+ enums::AuthenticationType::ThreeDs => CheckoutThreeDS {+ enabled: true,+ force_3ds: true,+ eci: None,+ cryptogram: None,+ xid: None,+ version: None,+ challenge_indicator,+ },+ enums::AuthenticationType::NoThreeDs => CheckoutThreeDS {+ enabled: false,+ force_3ds: false,+ eci: None,+ cryptogram: None,+ xid: None,+ version: None,+ challenge_indicator: CheckoutChallengeIndicator::NoPreference,+ },+ }};let return_url = ReturnUrl {diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.jsindex 04a83f7c69..923da19ae7 100644--- a/cypress-tests/cypress/support/commands.js+++ b/cypress-tests/cypress/support/commands.js@@ -3316,7 +3316,10 @@ Cypress.Commands.add(}}for (const key in resData.body) {- if (key === "payment_method_data" && globalState.get("connectorId") === "checkout") {+ if (+ key === "payment_method_data" &&+ globalState.get("connectorId") === "checkout"+ ) {expect(response.body[key], [key]).to.not.be.empty;expect(response.body[key]?.card?.auth_code,@@ -3352,7 +3355,10 @@ Cypress.Commands.add();}for (const key in resData.body) {- if (key === "payment_method_data" && globalState.get("connectorId") === "checkout") {+ if (+ key === "payment_method_data" &&+ globalState.get("connectorId") === "checkout"+ ) {expect(response.body[key], [key]).to.not.be.empty;expect(response.body[key]?.card?.auth_code,@@ -3418,7 +3424,10 @@ Cypress.Commands.add(}}for (const key in resData.body) {- if (key === "payment_method_data" && globalState.get("connectorId") === "checkout") {+ if (+ key === "payment_method_data" &&+ globalState.get("connectorId") === "checkout"+ ) {expect(response.body[key], [key]).to.not.be.empty;expect(response.body[key]?.card?.auth_code,@@ -3443,7 +3452,10 @@ Cypress.Commands.add(globalState.set("nextActionType", "redirect_to_url");}for (const key in resData.body) {- if (key === "payment_method_data" && globalState.get("connectorId") === "checkout") {+ if (+ key === "payment_method_data" &&+ globalState.get("connectorId") === "checkout"+ ) {expect(response.body[key], [key]).to.not.be.empty;expect(response.body[key]?.card?.auth_code,@@ -4121,7 +4133,10 @@ Cypress.Commands.add(}}for (const key in resData.body) {- if (key === "payment_method_data" && globalState.get("connectorId") === "checkout") {+ if (+ key === "payment_method_data" &&+ globalState.get("connectorId") === "checkout"+ ) {expect(response.body[key], [key]).to.not.be.empty;expect(response.body[key]?.card?.auth_code,@@ -4135,7 +4150,10 @@ Cypress.Commands.add(}} else if (response.body.authentication_type === "no_three_ds") {for (const key in resData.body) {- if (key === "payment_method_data" && globalState.get("connectorId") === "checkout") {+ if (+ key === "payment_method_data" &&+ globalState.get("connectorId") === "checkout"+ ) {expect(response.body[key], [key]).to.not.be.empty;expect(response.body[key]?.card?.auth_code,@@ -4182,7 +4200,10 @@ Cypress.Commands.add(}}for (const key in resData.body) {- if (key === "payment_method_data" && globalState.get("connectorId") === "checkout") {+ if (+ key === "payment_method_data" &&+ globalState.get("connectorId") === "checkout"+ ) {expect(response.body[key], [key]).to.not.be.empty;expect(response.body[key]?.card?.auth_code,@@ -4196,7 +4217,10 @@ Cypress.Commands.add(}} else if (response.body.authentication_type === "no_three_ds") {for (const key in resData.body) {- if (key === "payment_method_data" && globalState.get("connectorId") === "checkout") {+ if (+ key === "payment_method_data" &&+ globalState.get("connectorId") === "checkout"+ ) {expect(response.body[key], [key]).to.not.be.empty;expect(response.body[key]?.card?.auth_code,@@ -4325,7 +4349,10 @@ Cypress.Commands.add(}} else if (response.body.authentication_type === "no_three_ds") {for (const key in resData.body) {- if (key === "payment_method_data" && globalState.get("connectorId") === "checkout") {+ if (+ key === "payment_method_data" &&+ globalState.get("connectorId") === "checkout"+ ) {expect(response.body[key], [key]).to.not.be.empty;expect(response.body[key]?.card?.auth_code,@@ -4382,7 +4409,10 @@ Cypress.Commands.add();} else if (response.body.authentication_type === "no_three_ds") {for (const key in resData.body) {- if (key === "payment_method_data" && globalState.get("connectorId") === "checkout") {+ if (+ key === "payment_method_data" &&+ globalState.get("connectorId") === "checkout"+ ) {expect(response.body[key], [key]).to.not.be.empty;expect(response.body[key]?.card?.auth_code,@@ -4459,7 +4489,10 @@ Cypress.Commands.add(if (response.body.capture_method !== undefined) {expect(response.body.payment_id).to.equal(paymentId);for (const key in resData.body) {- if (key === "payment_method_data" && globalState.get("connectorId") === "checkout") {+ if (+ key === "payment_method_data" &&+ globalState.get("connectorId") === "checkout"+ ) {expect(response.body[key], [key]).to.not.be.empty;expect(response.body[key]?.card?.auth_code,@@ -5106,7 +5139,10 @@ Cypress.Commands.add(// Response body key comparison runs for all three_ds paths, including succeeded status// — the redirect URL is extracted above when status !== succeeded, but all response keys are verified herefor (const key in resData.body) {- if (key === "payment_method_data" && globalState.get("connectorId") === "checkout") {+ if (+ key === "payment_method_data" &&+ globalState.get("connectorId") === "checkout"+ ) {expect(response.body[key], [key]).to.not.be.empty;expect(response.body[key]?.card?.auth_code,@@ -5187,7 +5223,10 @@ Cypress.Commands.add(// Response body key comparison runs for all three_ds paths, including succeeded status// — the redirect URL is extracted above when status !== succeeded, but all response keys are verified herefor (const key in resData.body) {- if (key === "payment_method_data" && globalState.get("connectorId") === "checkout") {+ if (+ key === "payment_method_data" &&+ globalState.get("connectorId") === "checkout"+ ) {expect(response.body[key], [key]).to.not.be.empty;expect(response.body[key]?.card?.auth_code,