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

ci(cypress): Added 3DS manual capture flow (#4481)

likhinbopanna5d7481ec2902
diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00015-ThreeDSManualCapture.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00015-ThreeDSManualCapture.cy.js
new file mode 100644
index 0000000000..9b3a29a92e
--- /dev/null
+++ b/cypress-tests/cypress/e2e/ConnectorTest/00015-ThreeDSManualCapture.cy.js
@@ -0,0 +1,152 @@
+import createPaymentBody from "../../fixtures/create-payment-body.json";
+import createConfirmPaymentBody from "../../fixtures/create-confirm-body.json";
+import confirmBody from "../../fixtures/confirm-body.json";
+import getConnectorDetails from "../ConnectorUtils/utils";
+import State from "../../utils/State";
+import captureBody from "../../fixtures/capture-flow-body.json";
+
+let globalState;
+
+describe("Card - ThreeDS Manual payment flow test", () => {
+
+ before("seed global state", () => {
+ cy.task('getGlobalState').then((state) => {
+ globalState = new State(state);
+ console.log("seeding globalState -> " + JSON.stringify(globalState));
+ })
+ })
+
+ after("flush global state", () => {
+ console.log("flushing globalState -> " + JSON.stringify(globalState));
+ cy.task('setGlobalState', globalState.data);
+ })
+
+ context("Card - ThreeDS Manual Full Capture payment flow test", () => {
+ context("payment Create and Confirm", () => {
+ it("create-payment-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["3DS"];
+ cy.createPaymentIntentTest(createPaymentBody, det, "three_ds", "manual", globalState);
+ });
+
+ it("payment_methods-call-test", () => {
+ cy.paymentMethodsCallTest(globalState);
+ });
+
+ it("confirm-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["3DS"];
+ cy.confirmCallTest(confirmBody, det, true, globalState);
+ });
+
+ it("Handle redirection", () => {
+ let expected_redirection = confirmBody["return_url"];
+ cy.handleRedirection(globalState, expected_redirection);
+ })
+
+ it("retrieve-payment-call-test", () => {
+ cy.retrievePaymentCallTest(globalState);
+ });
+
+ it("capture-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["3DS"];
+ cy.captureCallTest(captureBody, 6500, det.paymentSuccessfulStatus, globalState);
+ });
+
+ it("retrieve-payment-call-test", () => {
+ cy.retrievePaymentCallTest(globalState);
+ });
+
+ });
+
+ context("Payment Create+Confirm", () => {
+ it("create+confirm-payment-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["3DS"];
+ cy.createConfirmPaymentTest(createConfirmPaymentBody, det, "three_ds", "manual", globalState);
+ });
+
+ it("Handle redirection", () => {
+ let expected_redirection = createConfirmPaymentBody["return_url"];
+ cy.handleRedirection(globalState, expected_redirection);
+ })
+
+
+ it("retrieve-payment-call-test", () => {
+ cy.retrievePaymentCallTest(globalState);
+ });
+
+ it("capture-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["3DS"];
+ cy.captureCallTest(captureBody, 6540, det.paymentSuccessfulStatus, globalState);
+ });
+
+ it("retrieve-payment-call-test", () => {
+ cy.retrievePaymentCallTest(globalState);
+ });
+ });
+
+
+ });
+
+ context("Card - ThreeDS Manual Partial Capture payment flow test - Create and Confirm", () => {
+ context("payment Create and Payment Confirm", () => {
+ it("create-payment-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["3DS"];
+ cy.createPaymentIntentTest(createPaymentBody, det, "three_ds", "manual", globalState);
+ });
+
+ it("payment_methods-call-test", () => {
+ cy.paymentMethodsCallTest(globalState);
+ });
+
+ it("confirm-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["3DS"];
+ cy.confirmCallTest(confirmBody, det, true, globalState);
+ });
+
+ it("Handle redirection", () => {
+ let expected_redirection = confirmBody["return_url"];
+ cy.handleRedirection(globalState, expected_redirection);
+ })
+
+ it("retrieve-payment-call-test", () => {
+ cy.retrievePaymentCallTest(globalState);
+ });
+
+ it("capture-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["3DS"];
+ cy.captureCallTest(captureBody, 100, det.paymentSuccessfulStatus, globalState);
+ });
+
+ it("retrieve-payment-call-test", () => {
+ cy.retrievePaymentCallTest(globalState);
+ });
+ });
+
+ context("payment + Confirm", () => {
+ it("create+confirm-payment-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["3DS"];
+ cy.createConfirmPaymentTest(createConfirmPaymentBody, det, "three_ds", "manual", globalState);
+ });
+
+ it("Handle redirection", () => {
+ let expected_redirection = createConfirmPaymentBody["return_url"];
+ cy.handleRedirection(globalState, expected_redirection);
+ })
+
+ it("retrieve-payment-call-test", () => {
+ cy.retrievePaymentCallTest(globalState);
+ });
+
+ it("capture-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["3DS"];
+ cy.captureCallTest(captureBody, 5000, det.paymentSuccessfulStatus, globalState);
+ });
+
+ it("retrieve-payment-call-test", () => {
+ cy.retrievePaymentCallTest(globalState);
+ });
+
+ });
+
+
+ });
+});
\ No newline at end of file
diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Adyen.js b/cypress-tests/cypress/e2e/ConnectorUtils/Adyen.js
index 56ef464984..68f3303e7f 100644
--- a/cypress-tests/cypress/e2e/ConnectorUtils/Adyen.js
+++ b/cypress-tests/cypress/e2e/ConnectorUtils/Adyen.js
@@ -19,7 +19,7 @@ export const connectorDetails = {
"3DS": {
"card": successfulThreeDSTestCardDetails,
"currency": "USD",
- "paymentSuccessfulStatus": "requires_customer_action",
+ "paymentSuccessfulStatus": "succeeded",
"paymentSyncStatus": "succeeded",
"refundStatus": "pending",
"refundSyncStatus": "pending",
diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/BankOfAmerica.js b/cypress-tests/cypress/e2e/ConnectorUtils/BankOfAmerica.js
index 996122faa7..f89d7279ff 100644
--- a/cypress-tests/cypress/e2e/ConnectorUtils/BankOfAmerica.js
+++ b/cypress-tests/cypress/e2e/ConnectorUtils/BankOfAmerica.js
@@ -19,7 +19,7 @@ export const connectorDetails = {
"3DS": {
"card": successfulThreeDSTestCardDetails,
"currency": "USD",
- "paymentSuccessfulStatus": "requires_customer_action",
+ "paymentSuccessfulStatus": "succeeded",
"paymentSyncStatus": "succeeded",
"refundStatus": "pending",
"refundSyncStatus": "pending",
diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Bluesnap.js b/cypress-tests/cypress/e2e/ConnectorUtils/Bluesnap.js
index c42ef5ba5a..2b3f63529b 100644
--- a/cypress-tests/cypress/e2e/ConnectorUtils/Bluesnap.js
+++ b/cypress-tests/cypress/e2e/ConnectorUtils/Bluesnap.js
@@ -18,7 +18,7 @@ export const connectorDetails = {
"3DS": {
"card": successfulThreeDSTestCardDetails,
"currency": "USD",
- "paymentSuccessfulStatus": "requires_customer_action",
+ "paymentSuccessfulStatus": "succeeded",
"paymentSyncStatus": "succeeded",
"refundStatus": "succeeded",
"refundSyncStatus": "succeeded",
diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Cybersource.js b/cypress-tests/cypress/e2e/ConnectorUtils/Cybersource.js
index 8daef2ffec..53a936adb1 100644
--- a/cypress-tests/cypress/e2e/ConnectorUtils/Cybersource.js
+++ b/cypress-tests/cypress/e2e/ConnectorUtils/Cybersource.js
@@ -18,7 +18,7 @@ export const connectorDetails = {
"3DS": {
"card": successfulThreeDSTestCardDetails,
"currency": "USD",
- "paymentSuccessfulStatus": "requires_customer_action",
+ "paymentSuccessfulStatus": "succeeded",
"paymentSyncStatus": "succeeded",
"refundStatus": "pending",
"refundSyncStatus": "pending",
diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Nmi.js b/cypress-tests/cypress/e2e/ConnectorUtils/Nmi.js
index e2e4d4e80f..280778028b 100644
--- a/cypress-tests/cypress/e2e/ConnectorUtils/Nmi.js
+++ b/cypress-tests/cypress/e2e/ConnectorUtils/Nmi.js
@@ -18,7 +18,7 @@ export const connectorDetails = {
"3DS": {
"card": successfulThreeDSTestCardDetails,
"currency": "USD",
- "paymentSuccessfulStatus": "requires_customer_action",
+ "paymentSuccessfulStatus": "succeeded",
"paymentSyncStatus": "succeeded",
"refundStatus": "pending",
"refundSyncStatus": "succeeded",
diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Paypal.js b/cypress-tests/cypress/e2e/ConnectorUtils/Paypal.js
index 5337c3eac6..4a3bb998cf 100644
--- a/cypress-tests/cypress/e2e/ConnectorUtils/Paypal.js
+++ b/cypress-tests/cypress/e2e/ConnectorUtils/Paypal.js
@@ -19,7 +19,7 @@ export const connectorDetails = {
"3DS": {
"card": successfulThreeDSTestCardDetails,
"currency": "USD",
- "paymentSuccessfulStatus": "requires_customer_action",
+ "paymentSuccessfulStatus": "processing",
"paymentSyncStatus": "processing",
"customer_acceptance": null,
"setup_future_usage": "on_session",
diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Stripe.js b/cypress-tests/cypress/e2e/ConnectorUtils/Stripe.js
index 2d8d5efa81..43c136a87d 100644
--- a/cypress-tests/cypress/e2e/ConnectorUtils/Stripe.js
+++ b/cypress-tests/cypress/e2e/ConnectorUtils/Stripe.js
@@ -21,7 +21,7 @@ export const connectorDetails = {
"3DS": {
"card": successfulThreeDSTestCardDetails,
"currency": "USD",
- "paymentSuccessfulStatus": "requires_customer_action",
+ "paymentSuccessfulStatus": "succeeded",
"paymentSyncStatus": "succeeded",
"refundStatus": "succeeded",
"refundSyncStatus": "succeeded",
diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Trustpay.js b/cypress-tests/cypress/e2e/ConnectorUtils/Trustpay.js
index f6d6a88ffb..596da09940 100644
--- a/cypress-tests/cypress/e2e/ConnectorUtils/Trustpay.js
+++ b/cypress-tests/cypress/e2e/ConnectorUtils/Trustpay.js
@@ -18,7 +18,7 @@ export const connectorDetails = {
"3DS": {
"card": successfulThreeDSTestCardDetails,
"currency": "USD",
- "paymentSuccessfulStatus": "requires_customer_action",
+ "paymentSuccessfulStatus": "succeeded",
"paymentSyncStatus": "succeeded",
"refundStatus": "succeeded",
"refundSyncStatus": "succeeded",
diff --git a/cypress-tests/cypress/fixtures/create-confirm-body.json b/cypress-tests/cypress/fixtures/create-confirm-body.json
index 1f3307b61f..1399f18134 100644
--- a/cypress-tests/cypress/fixtures/create-confirm-body.json
+++ b/cypress-tests/cypress/fixtures/create-confirm-body.json
@@ -12,7 +12,7 @@
"phone_country_code": "+65",
"description": "Its my first payment request",
"authentication_type": "no_three_ds",
- "return_url": "https://duck.com",
+ "return_url": "https://hyperswitch.io",
"setup_future_usage": "on_session",
"customer_acceptance": {
"acceptance_type": "offline",
@@ -33,7 +33,6 @@
"card_cvc": "123"
}
},
-
"billing": {
"address": {
"line1": "1467",
diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js
index 61ce6a0970..3caed6e077 100644
--- a/cypress-tests/cypress/support/commands.js
+++ b/cypress-tests/cypress/support/commands.js
@@ -269,6 +269,7 @@ Cypress.Commands.add("createConfirmPaymentTest", (createConfirmPaymentBody, deta
if (response.body.authentication_type === "three_ds") {
expect(response.body).to.have.property("next_action")
.to.have.property("redirect_to_url")
+ globalState.set("nextActionUrl", response.body.next_action.redirect_to_url);
}
else if (response.body.authentication_type === "no_three_ds") {
expect(details.paymentSuccessfulStatus).to.equal(response.body.status);
@@ -281,6 +282,7 @@ Cypress.Commands.add("createConfirmPaymentTest", (createConfirmPaymentBody, deta
if (response.body.authentication_type === "three_ds") {
expect(response.body).to.have.property("next_action")
.to.have.property("redirect_to_url")
+ globalState.set("nextActionUrl", response.body.next_action.redirect_to_url);
}
else if (response.body.authentication_type === "no_three_ds") {
expect("requires_capture").to.equal(response.body.status);