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

test(cypress): External 3DS for stripe (#11884)

HS-QUALIBOT19f166adab0d
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Commons.js b/cypress-tests/cypress/e2e/configs/Payment/Commons.js
index d8cd5aaaf8..6bf50fd4af 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Commons.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Commons.js
@@ -2065,6 +2065,28 @@ export const connectorDetails = {
},
},
}),
+ external_three_ds: getCustomExchange({
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ authentication_type: "three_ds",
+ request_external_three_ds_authentication: true,
+ three_ds_data: {
+ authentication_cryptogram: {
+ cavv: {
+ authentication_cryptogram: "3q2+78r+ur7erb7vyv66vv////8=",
+ },
+ },
+ ds_trans_id: "c4e59ceb-a382-4d6a-bc87-385d591fa09d",
+ version: "2.1.0",
+ eci: "05",
+ transaction_status: "Y",
+ exemption_indicator: "low_value",
+ },
+ },
+ }),
},
upi_pm: {
PaymentIntent: getCustomExchange({
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Stripe.js b/cypress-tests/cypress/e2e/configs/Payment/Stripe.js
index ef08dcfaf3..f0aec4a52f 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Stripe.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Stripe.js
@@ -21,6 +21,14 @@ const successfulThreeDSTestCardDetails = {
card_cvc: "737",
};
+const externalThreeDSCardDetails = {
+ card_number: "4242424242424242",
+ card_exp_month: "12",
+ card_exp_year: "2030",
+ card_holder_name: "Test User",
+ card_cvc: "123",
+};
+
const failedNo3DSCardDetails = {
card_number: "4000000000000002",
card_exp_month: "01",
@@ -870,6 +878,35 @@ export const connectorDetails = {
},
},
},
+ external_three_ds: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: externalThreeDSCardDetails,
+ },
+ authentication_type: "three_ds",
+ request_external_three_ds_authentication: true,
+ three_ds_data: {
+ authentication_cryptogram: {
+ cavv: {
+ authentication_cryptogram: "3q2+78r+ur7erb7vyv66vv////8=",
+ },
+ },
+ ds_trans_id: "c4e59ceb-a382-4d6a-bc87-385d591fa09d",
+ version: "2.1.0",
+ eci: "05",
+ transaction_status: "Y",
+ exemption_indicator: "low_value",
+ },
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ authentication_type: "three_ds",
+ },
+ },
+ },
},
bank_transfer_pm: {
Ach: {
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
index c095197247..61593b3aec 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
@@ -531,6 +531,7 @@ export const CONNECTOR_LISTS = {
"worldpay",
"worldpayvantiv",
],
+ EXTERNAL_THREE_DS: ["stripe"],
// Add more inclusion lists
},
};
diff --git a/cypress-tests/cypress/e2e/spec/Payment/43-ExternalThreeDS.cy.js b/cypress-tests/cypress/e2e/spec/Payment/43-ExternalThreeDS.cy.js
new file mode 100644
index 0000000000..e01991f387
--- /dev/null
+++ b/cypress-tests/cypress/e2e/spec/Payment/43-ExternalThreeDS.cy.js
@@ -0,0 +1,71 @@
+import * as fixtures from "../../../fixtures/imports";
+import State from "../../../utils/State";
+import getConnectorDetails, * as utils from "../../configs/Payment/Utils";
+
+let globalState;
+
+describe("Card - External 3DS payment flow test", () => {
+ before("seed global state", function () {
+ let skip = false;
+
+ cy.task("getGlobalState")
+ .then((state) => {
+ globalState = new State(state);
+ const connectorId = globalState.get("connectorId");
+
+ if (
+ utils.shouldIncludeConnector(
+ connectorId,
+ utils.CONNECTOR_LISTS.INCLUDE.EXTERNAL_THREE_DS
+ )
+ ) {
+ skip = true;
+ return;
+ }
+ })
+ .then(() => {
+ if (skip) {
+ this.skip();
+ }
+ });
+ });
+
+ after("flush global state", () => {
+ cy.task("setGlobalState", globalState.data);
+ });
+
+ context(
+ "Card-External-3DS payment flow test Create, Confirm and Retrieve",
+ () => {
+ it("create confirm payment with external 3ds -> retrieve payment", () => {
+ let shouldContinue = true;
+
+ cy.step("create and confirm payment with external 3ds", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["external_three_ds"];
+
+ cy.createConfirmPaymentTest(
+ fixtures.createConfirmPaymentBody,
+ data,
+ "three_ds",
+ "automatic",
+ globalState
+ );
+
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("retrieve payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: retrieve payment");
+ return;
+ }
+ cy.retrievePaymentCallTest({ globalState });
+ });
+ });
+ }
+ );
+});
diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js
index 94c7ef28c9..59284e3ee9 100644
--- a/cypress-tests/cypress/support/commands.js
+++ b/cypress-tests/cypress/support/commands.js
@@ -2343,22 +2343,24 @@ Cypress.Commands.add(
if (response.body.capture_method === "automatic") {
if (response.body.authentication_type === "three_ds") {
- if (response.body.next_action.type === "invoke_ddc") {
- expect(response.body.next_action)
- .to.have.property("type")
- .to.equal("invoke_ddc");
- globalState.set(
- "nextActionUrl",
- response.body.next_action.ddc_data.iframe_url
- );
- } else {
- expect(response.body)
- .to.have.property("next_action")
- .to.have.property("redirect_to_url");
- globalState.set(
- "nextActionUrl",
- response.body.next_action.redirect_to_url
- );
+ if (response.body.next_action) {
+ if (response.body.next_action.type === "invoke_ddc") {
+ expect(response.body.next_action)
+ .to.have.property("type")
+ .to.equal("invoke_ddc");
+ globalState.set(
+ "nextActionUrl",
+ response.body.next_action.ddc_data.iframe_url
+ );
+ } else {
+ expect(response.body)
+ .to.have.property("next_action")
+ .to.have.property("redirect_to_url");
+ globalState.set(
+ "nextActionUrl",
+ response.body.next_action.redirect_to_url
+ );
+ }
}
for (const key in resData.body) {
expect(resData.body[key], [key]).to.deep.equal(
@@ -2387,23 +2389,24 @@ Cypress.Commands.add(
}
} else if (response.body.capture_method === "manual") {
if (response.body.authentication_type === "three_ds") {
- expect(response.body).to.have.property("next_action");
- if (response.body.next_action.type === "invoke_ddc") {
- expect(response.body.next_action)
- .to.have.property("type")
- .to.equal("invoke_ddc");
- globalState.set(
- "nextActionUrl",
- response.body.next_action.ddc_data.iframe_url
- );
- } else {
- expect(response.body.next_action).to.have.property(
- "redirect_to_url"
- );
- globalState.set(
- "nextActionUrl",
- response.body.next_action.redirect_to_url
- );
+ if (response.body.next_action) {
+ if (response.body.next_action.type === "invoke_ddc") {
+ expect(response.body.next_action)
+ .to.have.property("type")
+ .to.equal("invoke_ddc");
+ globalState.set(
+ "nextActionUrl",
+ response.body.next_action.ddc_data.iframe_url
+ );
+ } else {
+ expect(response.body.next_action).to.have.property(
+ "redirect_to_url"
+ );
+ globalState.set(
+ "nextActionUrl",
+ response.body.next_action.redirect_to_url
+ );
+ }
}
for (const key in resData.body) {
expect(resData.body[key], [key]).to.deep.equal(
@@ -2901,23 +2904,24 @@ Cypress.Commands.add(
if (response.body.capture_method === "automatic") {
if (response.body.authentication_type === "three_ds") {
- expect(response.body).to.have.property("next_action");
- if (response.body.next_action.type === "invoke_ddc") {
- expect(response.body.next_action)
- .to.have.property("type")
- .to.equal("invoke_ddc");
- globalState.set(
- "nextActionUrl",
- response.body.next_action.ddc_data.iframe_url
- );
- } else {
- expect(response.body.next_action).to.have.property(
- "redirect_to_url"
- );
- globalState.set(
- "nextActionUrl",
- response.body.next_action.redirect_to_url
- );
+ if (response.body.next_action) {
+ if (response.body.next_action.type === "invoke_ddc") {
+ expect(response.body.next_action)
+ .to.have.property("type")
+ .to.equal("invoke_ddc");
+ globalState.set(
+ "nextActionUrl",
+ response.body.next_action.ddc_data.iframe_url
+ );
+ } else {
+ expect(response.body.next_action).to.have.property(
+ "redirect_to_url"
+ );
+ globalState.set(
+ "nextActionUrl",
+ response.body.next_action.redirect_to_url
+ );
+ }
}
for (const key in resData.body) {
expect(resData.body[key], [key]).to.deep.equal(
@@ -2937,22 +2941,24 @@ Cypress.Commands.add(
}
} else if (response.body.capture_method === "manual") {
if (response.body.authentication_type === "three_ds") {
- if (response.body.next_action.type === "invoke_ddc") {
- expect(response.body.next_action)
- .to.have.property("type")
- .to.equal("invoke_ddc");
- globalState.set(
- "nextActionUrl",
- response.body.next_action.ddc_data.iframe_url
- );
- } else {
- expect(response.body)
- .to.have.property("next_action")
- .to.have.property("redirect_to_url");
- globalState.set(
- "nextActionUrl",
- response.body.next_action.redirect_to_url
- );
+ if (response.body.next_action) {
+ if (response.body.next_action.type === "invoke_ddc") {
+ expect(response.body.next_action)
+ .to.have.property("type")
+ .to.equal("invoke_ddc");
+ globalState.set(
+ "nextActionUrl",
+ response.body.next_action.ddc_data.iframe_url
+ );
+ } else {
+ expect(response.body.next_action).to.have.property(
+ "redirect_to_url"
+ );
+ globalState.set(
+ "nextActionUrl",
+ response.body.next_action.redirect_to_url
+ );
+ }
}
for (const key in resData.body) {
expect(resData.body[key], [key]).to.deep.equal(
diff --git a/cypress-tests/package-lock.json b/cypress-tests/package-lock.json
index 6c72df3e0f..27f8df7c43 100644
--- a/cypress-tests/package-lock.json
+++ b/cypress-tests/package-lock.json
@@ -10,8 +10,7 @@
"license": "ISC",
"dependencies": {
"cors": "^2.8.5",
- "express": "^5.1.0",
- "fsevents": "2.3.3"
+ "express": "^5.1.0"
},
"devDependencies": {
"@eslint/js": "^9.33.0",