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
feat(cypress): Add cypress test cases (#4271)
Prasunna Soppa06e30e04b067
diff --git a/.gitignore b/.gitignoreindex 81ef10ad21..1aa3faf2c1 100644--- a/.gitignore+++ b/.gitignore@@ -261,3 +261,6 @@ result*# node_modulesnode_modules/++# cypress credentials+creds.json\ No newline at end of filediff --git a/cypress-tests/.gitignore b/cypress-tests/.gitignorenew file mode 100644index 0000000000..0954393e10--- /dev/null+++ b/cypress-tests/.gitignore@@ -0,0 +1,2 @@+creds.json+screenshots\ No newline at end of filediff --git a/cypress-tests/cypress.config.js b/cypress-tests/cypress.config.jsnew file mode 100644index 0000000000..2ce0169cf8--- /dev/null+++ b/cypress-tests/cypress.config.js@@ -0,0 +1,23 @@++let globalState;+module.exports = {+ e2e: {+ setupNodeEvents(on, config) {+ on('task', {+ setGlobalState: (val) => {+ return (globalState = (val || {}))+ },+ getGlobalState: () => {+ return (globalState || {})+ },+ cli_log: (message) => {+ console.log("Logging console message from task");+ console.log(message);+ return null;+ }+ })+ },+ experimentalRunAllSpecs: true+ },+ chromeWebSecurity: false+};\ No newline at end of filediff --git a/cypress-tests/cypress.env.json b/cypress-tests/cypress.env.jsonnew file mode 100644index 0000000000..9e26dfeeb6--- /dev/null+++ b/cypress-tests/cypress.env.json@@ -0,0 +1 @@+{}\ No newline at end of filediff --git a/cypress-tests/cypress/e2e/ConnectorTest/00000-AccountCreate.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00000-AccountCreate.cy.jsnew file mode 100644index 0000000000..94700d1a1b--- /dev/null+++ b/cypress-tests/cypress/e2e/ConnectorTest/00000-AccountCreate.cy.js@@ -0,0 +1,27 @@+import merchantCreateBody from "../../fixtures/merchant-create-body.json";+import apiKeyCreateBody from "../../fixtures/create-api-key-body.json";+import State from "../../utils/State";++let globalState;+describe("Account Create 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);+ })++ it("merchant-create-call-test", () => {+ cy.merchantCreateCallTest(merchantCreateBody, globalState);+ });+ it("api-key-create-call-test", () => {+ cy.apiKeyCreateTest(apiKeyCreateBody, globalState);+ });++});diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00001-CustomerCreate.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00001-CustomerCreate.cy.jsnew file mode 100644index 0000000000..c21152ca89--- /dev/null+++ b/cypress-tests/cypress/e2e/ConnectorTest/00001-CustomerCreate.cy.js@@ -0,0 +1,24 @@+import customerCreateBody from "../../fixtures/create-customer-body.json";+import State from "../../utils/State";++let globalState;++describe("Customer Create 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);+ })+ it("customer-create-call-test", () => {++ cy.createCustomerCallTest(customerCreateBody, globalState);++ });+});\ No newline at end of filediff --git a/cypress-tests/cypress/e2e/ConnectorTest/00002-ConnectorCreate.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00002-ConnectorCreate.cy.jsnew file mode 100644index 0000000000..1241048f28--- /dev/null+++ b/cypress-tests/cypress/e2e/ConnectorTest/00002-ConnectorCreate.cy.js@@ -0,0 +1,23 @@+import createConnectorBody from "../../fixtures/create-connector-body.json";+import State from "../../utils/State";++let globalState;+describe("Connector Account Create 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);+ })++ it("connector-create-call-test", () => {+ cy.createConnectorCallTest(createConnectorBody, globalState);+ });+});diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00003-NoThreeDSAutoCapture.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00003-NoThreeDSAutoCapture.cy.jsnew file mode 100644index 0000000000..3d86d292a0--- /dev/null+++ b/cypress-tests/cypress/e2e/ConnectorTest/00003-NoThreeDSAutoCapture.cy.js@@ -0,0 +1,60 @@+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";++let globalState;++describe("Card - NoThreeDS 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-NoThreeDS payment flow test Create and confirm", () => {++ it("create-payment-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.createPaymentIntentTest(createPaymentBody, det.currency, "no_three_ds", "automatic", globalState);+ });++ it("payment_methods-call-test", () => {+ cy.paymentMethodsCallTest(globalState);+ });++ it("Confirm No 3DS", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.confirmCallTest(confirmBody, det, true, globalState);+ });++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });++ });++ context("Card-NoThreeDS payment flow test Create+Confirm", () => {++ it("create+confirm-payment-call-test", () => {+ console.log("confirm -> " + globalState.get("connectorId"));+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.createConfirmPaymentTest(createConfirmPaymentBody, det, "no_three_ds", "automatic", globalState);+ });++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });+++ });+});\ No newline at end of filediff --git a/cypress-tests/cypress/e2e/ConnectorTest/00004-ThreeDSAutoCapture.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00004-ThreeDSAutoCapture.cy.jsnew file mode 100644index 0000000000..7766935df0--- /dev/null+++ b/cypress-tests/cypress/e2e/ConnectorTest/00004-ThreeDSAutoCapture.cy.js@@ -0,0 +1,48 @@+import createPaymentBody from "../../fixtures/create-payment-body.json";+import confirmBody from "../../fixtures/confirm-body.json";+import getConnectorDetails from "../ConnectorUtils/utils";+import State from "../../utils/State";++let globalState;++describe("Card - ThreeDS payment flow test", () => {++ before("seed global state", () => {++ cy.task('getGlobalState').then((state) => {+ globalState = new State(state);+ console.log("seeding globalState -> " + JSON.stringify(globalState));+ cy.task('cli_log', "SEEDING GLOBAL STATE -> " + JSON.stringify(globalState));+ })++ })++ afterEach("flush global state", () => {+ console.log("flushing globalState -> " + JSON.stringify(globalState));+ cy.task('setGlobalState', globalState.data);+ cy.task('cli_log', " FLUSHING GLOBAL STATE -> " + JSON.stringify(globalState));+ })+++ it("create-payment-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.createPaymentIntentTest(createPaymentBody, det.currency, "three_ds", "automatic", globalState);+ });++ it("payment_methods-call-test", () => {+ cy.task('cli_log', "PM CALL ");+ cy.paymentMethodsCallTest(globalState);+ });++ it("Confirm 3DS", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["3DS"];+ cy.task('cli_log', "GLOBAL STATE -> " + JSON.stringify(globalState.data));+ cy.confirmCallTest(confirmBody, det, true, globalState);+ });++ it("Handle redirection", () => {+ let expected_redirection = confirmBody["return_url"];+ cy.handleRedirection(globalState, expected_redirection);+ })++});\ No newline at end of filediff --git a/cypress-tests/cypress/e2e/ConnectorTest/00005-NoThreeDSManualCapture.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00005-NoThreeDSManualCapture.cy.jsnew file mode 100644index 0000000000..8fef11b830--- /dev/null+++ b/cypress-tests/cypress/e2e/ConnectorTest/00005-NoThreeDSManualCapture.cy.js@@ -0,0 +1,147 @@+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 - NoThreeDS 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 - NoThreeDS Manual Full Capture payment flow test", () => {++ context("payment Create and Confirm", () => {++ it("create-payment-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.createPaymentIntentTest(createPaymentBody, det.currency, "no_three_ds", "manual", globalState);+ });++ it("payment_methods-call-test", () => {+ cy.paymentMethodsCallTest(globalState);+ });++ it("confirm-call-test", () => {+ console.log("confirm -> " + globalState.get("connectorId"));+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ console.log("det -> " + det.card);+ cy.confirmCallTest(confirmBody, det, true, globalState);+ });++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });++ it("capture-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ console.log("det -> " + det.card);+ 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", () => {+ console.log("confirm -> " + globalState.get("connectorId"));+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ console.log("det -> " + det.card);+ cy.createConfirmPaymentTest(createConfirmPaymentBody, det, "no_three_ds", "manual", globalState);+ });++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });++ it("capture-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ console.log("det -> " + det.card);+ cy.captureCallTest(captureBody, 6540, det.paymentSuccessfulStatus, globalState);+ });++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });+ });+++ });++ context("Card - NoThreeDS 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"))["No3DS"];+ cy.createPaymentIntentTest(createPaymentBody, det.currency, "no_three_ds", "manual", globalState);+ });++ it("payment_methods-call-test", () => {+ cy.paymentMethodsCallTest(globalState);+ });++ it("confirm-call-test", () => {+ console.log("confirm -> " + globalState.get("connectorId"));+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ console.log("det -> " + det.card);+ cy.confirmCallTest(confirmBody, det, true, globalState);+ });++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });++ it("capture-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.captureCallTest(captureBody, 100, det.paymentSuccessfulStatus, globalState);+ });++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });+ });++ context("payment + Confirm", () => {+ it("create+confirm-payment-call-test", () => {+ console.log("confirm -> " + globalState.get("connectorId"));+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ console.log("det -> " + det.card);+ cy.createConfirmPaymentTest(createConfirmPaymentBody, det, "no_three_ds", "manual", globalState);+ });++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });++ it("capture-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ console.log("det -> " + det.card);+ cy.captureCallTest(captureBody, 5000, det.paymentSuccessfulStatus, globalState);+ });++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });++ });+++ });+});\ No newline at end of filediff --git a/cypress-tests/cypress/e2e/ConnectorTest/00006-VoidPayment.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00006-VoidPayment.cy.jsnew file mode 100644index 0000000000..ef5262716e--- /dev/null+++ b/cypress-tests/cypress/e2e/ConnectorTest/00006-VoidPayment.cy.js@@ -0,0 +1,82 @@+import createPaymentBody from "../../fixtures/create-payment-body.json";+import confirmBody from "../../fixtures/confirm-body.json";+import getConnectorDetails from "../ConnectorUtils/utils";+import State from "../../utils/State";+import voidBody from "../../fixtures/void-payment-body.json";++let globalState;++describe("Card - NoThreeDS 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 - void payment in Requires_capture state flow test", () => {+ it("create-payment-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.createPaymentIntentTest(createPaymentBody, det.currency, "no_three_ds", "manual", globalState);+ });++ it("payment_methods-call-test", () => {+ cy.paymentMethodsCallTest(globalState);+ });++ it("confirm-call-test", () => {+ console.log("confirm -> " + globalState.get("connectorId"));+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ console.log("det -> " + det.card);+ cy.confirmCallTest(confirmBody, det, true, globalState);+ });++ it("void-call-test", () => {+ cy.voidCallTest(voidBody, globalState);+ });+ });++ context("Card - void payment in Requires_payment_method state flow test", () => {+ it("create-payment-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.createPaymentIntentTest(createPaymentBody, det.currency, "no_three_ds", "manual", globalState);+ });++ it("payment_methods-call-test", () => {+ cy.paymentMethodsCallTest(globalState);+ });++ it("void-call-test", () => {+ cy.voidCallTest(voidBody, globalState);+ });+ });++ context("Card - void payment in Requires_payment_method state flow test", () => {+ it("create-payment-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.createPaymentIntentTest(createPaymentBody, det.currency, "no_three_ds", "manual", globalState);+ });++ it("payment_methods-call-test", () => {+ cy.paymentMethodsCallTest(globalState);+ });++ it("confirm-call-test", () => {+ console.log("confirm -> " + globalState.get("connectorId"));+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ console.log("det -> " + det.card);+ cy.confirmCallTest(confirmBody, det, false, globalState);+ });++ it("void-call-test", () => {+ cy.voidCallTest(voidBody, globalState);+ });+ });+});\ No newline at end of filediff --git a/cypress-tests/cypress/e2e/ConnectorTest/00007-SyncPayment.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00007-SyncPayment.cy.jsnew file mode 100644index 0000000000..02b030e356--- /dev/null+++ b/cypress-tests/cypress/e2e/ConnectorTest/00007-SyncPayment.cy.js@@ -0,0 +1,42 @@+import createPaymentBody from "../../fixtures/create-payment-body.json";+import confirmBody from "../../fixtures/confirm-body.json";+import getConnectorDetails from "../ConnectorUtils/utils";+import State from "../../utils/State";++let globalState;++describe("Card - Sync 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);+ })+ it("create-payment-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.createPaymentIntentTest(createPaymentBody, det.currency, "no_three_ds", "automatic", globalState);+ });++ it("payment_methods-call-test", () => {+ cy.paymentMethodsCallTest(globalState);+ });++ it("confirm-call-test", () => {+ console.log("confirm -> " + globalState.get("connectorId"));+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ console.log("det -> " + det.card);+ cy.confirmCallTest(confirmBody, det, true, globalState);+ });++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });++});\ No newline at end of filediff --git a/cypress-tests/cypress/e2e/ConnectorTest/00008-RefundPayment.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00008-RefundPayment.cy.jsnew file mode 100644index 0000000000..73f92381a1--- /dev/null+++ b/cypress-tests/cypress/e2e/ConnectorTest/00008-RefundPayment.cy.js@@ -0,0 +1,331 @@+import createPaymentBody from "../../fixtures/create-payment-body.json";+import confirmBody from "../../fixtures/confirm-body.json";+import createConfirmPaymentBody from "../../fixtures/create-confirm-body.json";+import getConnectorDetails from "../ConnectorUtils/utils";+import captureBody from "../../fixtures/capture-flow-body.json";+import refundBody from "../../fixtures/refund-flow-body.json";+import citConfirmBody from "../../fixtures/create-mandate-cit.json";+import mitConfirmBody from "../../fixtures/create-mandate-mit.json";+import State from "../../utils/State";++let globalState;++describe("Card - Refund 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 - Full Refund flow test for No-3DS", () => {++ it("create-payment-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.createPaymentIntentTest(createPaymentBody, det.currency, "no_three_ds", "automatic", globalState);+ });++ it("payment_methods-call-test", () => {+ cy.paymentMethodsCallTest(globalState);+ });++ it("confirm-call-test", () => {+ console.log("confirm -> " + globalState.get("connectorId"));+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ console.log("det -> " + det.card);+ cy.confirmCallTest(confirmBody, det, true, globalState);+ });++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });++ it("refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.refundCallTest(refundBody, 6500, det, globalState);+ });+ });++ context("Card - Partial Refund flow test for No-3DS", () => {++ it("create-payment-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.createPaymentIntentTest(createPaymentBody, det.currency, "no_three_ds", "automatic", globalState);+ });++ it("payment_methods-call-test", () => {+ cy.paymentMethodsCallTest(globalState);+ });++ it("confirm-call-test", () => {+ console.log("confirm -> " + globalState.get("connectorId"));+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ console.log("det -> " + det.card);+ cy.confirmCallTest(confirmBody, det, true, globalState);+ });++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });++ it("refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.refundCallTest(refundBody, 1200, det, globalState);+ });++ it("refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.refundCallTest(refundBody, 1200, det, globalState);+ });+ });++ context("Fully Refund Card-NoThreeDS payment flow test Create+Confirm", () => {++ it("create+confirm-payment-call-test", () => {+ console.log("confirm -> " + globalState.get("connectorId"));+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.createConfirmPaymentTest( createConfirmPaymentBody, det,"no_three_ds", "automatic", globalState);+ });++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });++ it("refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.refundCallTest(refundBody, 6540, det, globalState);+ });++ });++ context("Partially Refund Card-NoThreeDS payment flow test Create+Confirm", () => {++ it("create+confirm-payment-call-test", () => {+ console.log("confirm -> " + globalState.get("connectorId"));+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.createConfirmPaymentTest( createConfirmPaymentBody, det,"no_three_ds", "automatic", globalState);+ });++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });++ it("refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.refundCallTest(refundBody, 3000, det, globalState);+ });++ it("refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.refundCallTest(refundBody, 3000, det, globalState);+ });++ it("sync-refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.syncRefundCallTest(det, globalState);+ });++ });++ context("Card - Full Refund for fully captured No-3DS payment", () => {++ it("create-payment-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.createPaymentIntentTest(createPaymentBody, det.currency, "no_three_ds", "manual", globalState);+ });++ it("payment_methods-call-test", () => {+ cy.paymentMethodsCallTest(globalState);+ });++ it("confirm-call-test", () => {+ console.log("confirm -> " + globalState.get("connectorId"));+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ console.log("det -> " + det.card);+ cy.confirmCallTest(confirmBody, det, true, globalState);+ });++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });++ it("capture-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ console.log("det -> " + det.card);+ cy.captureCallTest(captureBody, 6500, det.paymentSuccessfulStatus, globalState);+ });++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });++ it("refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.refundCallTest(refundBody, 6500, det, globalState);+ });++ it("sync-refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.syncRefundCallTest(det, globalState);+ });+ });++ context("Card - Partial Refund for fully captured No-3DS payment", () => {++ it("create-payment-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.createPaymentIntentTest(createPaymentBody, det.currency, "no_three_ds", "manual", globalState);+ });++ it("payment_methods-call-test", () => {+ cy.paymentMethodsCallTest(globalState);+ });++ it("confirm-call-test", () => {+ console.log("confirm -> " + globalState.get("connectorId"));+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ console.log("det -> " + det.card);+ cy.confirmCallTest(confirmBody, det, true, globalState);+ });++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });++ it("capture-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ console.log("det -> " + det.card);+ cy.captureCallTest(captureBody, 6500, det.paymentSuccessfulStatus, globalState);+ });++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });++ it("refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.refundCallTest(refundBody, 5000, det, globalState);+ });+ it("refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.refundCallTest(refundBody, 500, det, globalState);+ });++ it("sync-refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.syncRefundCallTest(det, globalState);+ });+ });++ context("Card - Full Refund for partially captured No-3DS payment", () => {++ it("create-payment-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.createPaymentIntentTest(createPaymentBody, det.currency, "no_three_ds", "manual", globalState);+ });++ it("payment_methods-call-test", () => {+ cy.paymentMethodsCallTest(globalState);+ });++ it("confirm-call-test", () => {+ console.log("confirm -> " + globalState.get("connectorId"));+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ console.log("det -> " + det.card);+ cy.confirmCallTest(confirmBody, det, true, globalState);+ });++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });++ it("capture-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ console.log("det -> " + det.card);+ cy.captureCallTest(captureBody, 4000, det.paymentSuccessfulStatus, globalState);+ });++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });++ it("refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.refundCallTest(refundBody, 4000, det, globalState);+ });++ it("sync-refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.syncRefundCallTest(det, globalState);+ });+ });++ context("Card - partial Refund for partially captured No-3DS payment", () => {++ it("create-payment-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.createPaymentIntentTest(createPaymentBody, det.currency, "no_three_ds", "manual", globalState);+ });++ it("payment_methods-call-test", () => {+ cy.paymentMethodsCallTest(globalState);+ });++ it("confirm-call-test", () => {+ console.log("confirm -> " + globalState.get("connectorId"));+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ console.log("det -> " + det.card);+ cy.confirmCallTest(confirmBody, det, true, globalState);+ });++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });++ it("capture-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ console.log("det -> " + det.card);+ cy.captureCallTest(captureBody, 4000, det.paymentSuccessfulStatus, globalState);+ });++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });++ it("refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.refundCallTest(refundBody, 3000, det, globalState);+ });++ it("sync-refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.syncRefundCallTest(det, globalState);+ });+ });++ context("Card - Full Refund for Create + Confirm Automatic CIT and MIT payment flow test", () => {++ it("Confirm No 3DS CIT", () => {+ console.log("confirm -> " + globalState.get("connectorId"));+ let det = getConnectorDetails(globalState.get("connectorId"))["MandateMultiUseNo3DS"];+ console.log("det -> " + det.card);+ cy.citForMandatesCallTest(citConfirmBody, det, true, "automatic", globalState);+ });++ it("Confirm No 3DS MIT", () => {+ cy.mitForMandatesCallTest(mitConfirmBody, 7000, true, "automatic", globalState);+ });++ it("Confirm No 3DS MIT", () => {+ cy.mitForMandatesCallTest(mitConfirmBody, 7000, true, "automatic", globalState);+ });+ });++});diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00009-SyncRefund.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00009-SyncRefund.cy.jsnew file mode 100644index 0000000000..890ca2fcbe--- /dev/null+++ b/cypress-tests/cypress/e2e/ConnectorTest/00009-SyncRefund.cy.js@@ -0,0 +1,54 @@+import createPaymentBody from "../../fixtures/create-payment-body.json";+import confirmBody from "../../fixtures/confirm-body.json";+import getConnectorDetails from "../ConnectorUtils/utils";+import refundBody from "../../fixtures/refund-flow-body.json"+import State from "../../utils/State";++let globalState;++describe("Card - Sync Refund 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);+ })++ it("create-payment-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.createPaymentIntentTest(createPaymentBody, det.currency, "no_three_ds", "automatic", globalState);+ });++ it("payment_methods-call-test", () => {+ cy.paymentMethodsCallTest(globalState);+ });++ it("confirm-call-test", () => {+ console.log("confirm -> " + globalState.get("connectorId"));+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ console.log("det -> " + det.card);+ cy.confirmCallTest(confirmBody, det, true, globalState);+ });++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });++ it("refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.refundCallTest(refundBody, 6500, det, globalState);+ });++ it("sync-refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.syncRefundCallTest(det, globalState);+ });++});\ No newline at end of filediff --git a/cypress-tests/cypress/e2e/ConnectorTest/00010-CreateSingleuseMandate.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00010-CreateSingleuseMandate.cy.jsnew file mode 100644index 0000000000..a80368dd3f--- /dev/null+++ b/cypress-tests/cypress/e2e/ConnectorTest/00010-CreateSingleuseMandate.cy.js@@ -0,0 +1,91 @@+import captureBody from "../../fixtures/capture-flow-body.json";+import citConfirmBody from "../../fixtures/create-mandate-cit.json";+import mitConfirmBody from "../../fixtures/create-mandate-mit.json";+import getConnectorDetails from "../ConnectorUtils/utils";+import State from "../../utils/State";++let globalState;++describe("Card - SingleUse Mandates 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 - NoThreeDS Create + Confirm Automatic CIT and MIT payment flow test", () => {++ it("Confirm No 3DS CIT", () => {+ console.log("confirm -> " + globalState.get("connectorId"));+ let det = getConnectorDetails(globalState.get("connectorId"))["MandateSingleUseNo3DS"];+ console.log("det -> " + det.card);+ cy.citForMandatesCallTest(citConfirmBody, det, true, "automatic", globalState);+ });++ it("Confirm No 3DS MIT", () => {+ cy.mitForMandatesCallTest(mitConfirmBody, 7000, true, "automatic", globalState);+ });+ });++ context("Card - NoThreeDS Create + Confirm Manual CIT and MIT payment flow test", () => {++ it("Confirm No 3DS CIT", () => {+ console.log("confirm -> " + globalState.get("connectorId"));+ let det = getConnectorDetails(globalState.get("connectorId"))["MandateSingleUseNo3DS"];+ console.log("det -> " + det.card);+ cy.citForMandatesCallTest(citConfirmBody, det, true, "manual", globalState);+ });++ it("cit-capture-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["MandateSingleUseNo3DS"];+ console.log("det -> " + det.card);+ cy.captureCallTest(captureBody, 7000, det.paymentSuccessfulStatus, globalState);+ });++ it("Confirm No 3DS MIT", () => {+ cy.mitForMandatesCallTest(mitConfirmBody, 7000, true, "manual", globalState);+ });++ it("mit-capture-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["MandateSingleUseNo3DS"];+ console.log("det -> " + det.card);+ cy.captureCallTest(captureBody, 7000, det.paymentSuccessfulStatus, globalState);+ });++ it("list-mandate-call-test", () => {+ cy.listMandateCallTest(globalState);+ });+ });++ context.skip("Card - ThreeDS Create + Confirm Manual CIT and MIT payment flow test", () => {++ it("Confirm No 3DS CIT", () => {+ console.log("confirm -> " + globalState.get("connectorId"));+ let det = getConnectorDetails(globalState.get("connectorId"))["MandateSingleUse3DS"];+ console.log("det -> " + det.card);+ cy.citForMandatesCallTest(citConfirmBody, det, true, "automatic", globalState);+ });++ it("cit-capture-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["MandateSingleUse3DS"];+ console.log("det -> " + det.card);+ cy.captureCallTest(captureBody, 6500, det.paymentSuccessfulStatus, globalState);+ });++ it("Confirm No 3DS MIT", () => {+ cy.mitForMandatesCallTest(mitConfirmBody, 7000, true, "automatic", globalState);+ });++ it("list-mandate-call-test", () => {+ cy.listMandateCallTest(globalState);+ });+ });+});\ No newline at end of filediff --git a/cypress-tests/cypress/e2e/ConnectorTest/00011-CreateMultiuseMandate.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00011-CreateMultiuseMandate.cy.jsnew file mode 100644index 0000000000..74aa5ece67--- /dev/null+++ b/cypress-tests/cypress/e2e/ConnectorTest/00011-CreateMultiuseMandate.cy.js@@ -0,0 +1,97 @@+import createPaymentBody from "../../fixtures/create-payment-body.json";+import captureBody from "../../fixtures/capture-flow-body.json";+import citConfirmBody from "../../fixtures/create-mandate-cit.json";+import mitConfirmBody from "../../fixtures/create-mandate-mit.json";+import getConnectorDetails from "../ConnectorUtils/utils";+import State from "../../utils/State";++let globalState;++describe("Card - MultiUse Mandates 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 - NoThreeDS Create + Confirm Automatic CIT and MIT payment flow test", () => {++ it("Confirm No 3DS CIT", () => {+ console.log("confirm -> " + globalState.get("connectorId"));+ let det = getConnectorDetails(globalState.get("connectorId"))["MandateMultiUseNo3DS"];+ console.log("det -> " + det.card);+ cy.citForMandatesCallTest(citConfirmBody, det, true, "automatic", globalState);+ });++ it("Confirm No 3DS MIT", () => {+ cy.mitForMandatesCallTest(mitConfirmBody, 7000, true, "automatic", globalState);+ });+ it("Confirm No 3DS MIT", () => {+ cy.mitForMandatesCallTest(mitConfirmBody, 7000, true, "automatic", globalState);+ });+ });++ context("Card - NoThreeDS Create + Confirm Manual CIT and MIT payment flow test", () => {++ it("Confirm No 3DS CIT", () => {+ console.log("confirm -> " + globalState.get("connectorId"));+ let det = getConnectorDetails(globalState.get("connectorId"))["MandateMultiUseNo3DS"];+ console.log("det -> " + det.card);+ cy.citForMandatesCallTest(citConfirmBody, det, true, "manual", globalState);+ });++ it("cit-capture-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["MandateMultiUseNo3DS"];+ console.log("det -> " + det.card);+ cy.captureCallTest(captureBody, 7000, det.paymentSuccessfulStatus, globalState);+ });++ it("Confirm No 3DS MIT 1", () => {+ cy.mitForMandatesCallTest(mitConfirmBody, 7000, true, "manual", globalState);+ });++ it("mit-capture-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["MandateMultiUseNo3DS"];+ console.log("det -> " + det.card);+ cy.captureCallTest(captureBody, 7000, det.paymentSuccessfulStatus, globalState);+ });++ it("Confirm No 3DS MIT 2", () => {+ cy.mitForMandatesCallTest(mitConfirmBody, 7000, true, "manual", globalState);+ });++ it("mit-capture-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["MandateMultiUseNo3DS"];+ console.log("det -> " + det.card);+ cy.captureCallTest(captureBody, 7000, det.paymentSuccessfulStatus, globalState);+ });+ });++ context.skip("Card - ThreeDS Create + Confirm Manual CIT and MIT payment flow test", () => {++ it("Confirm No 3DS CIT", () => {+ console.log("confirm -> " + globalState.get("connectorId"));+ let det = getConnectorDetails(globalState.get("connectorId"))["MandateMultiUse3DS"];+ console.log("det -> " + det.card);+ cy.citForMandatesCallTest(citConfirmBody, det, true, "automatic", globalState);+ });++ it("cit-capture-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["MandateMultiUse3DS"];+ console.log("det -> " + det.card);+ cy.captureCallTest(captureBody, 6500, det.paymentSuccessfulStatus, globalState);+ });++ it("Confirm No 3DS MIT", () => {+ cy.mitForMandatesCallTest(mitConfirmBody, 7000, true, "automatic", globalState);+ });+ });+});\ No newline at end of filediff --git a/cypress-tests/cypress/e2e/ConnectorTest/00012-ListAndRevokeMandate.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00012-ListAndRevokeMandate.cy.jsnew file mode 100644index 0000000000..00f676cab5--- /dev/null+++ b/cypress-tests/cypress/e2e/ConnectorTest/00012-ListAndRevokeMandate.cy.js@@ -0,0 +1,51 @@+import citConfirmBody from "../../fixtures/create-mandate-cit.json";+import mitConfirmBody from "../../fixtures/create-mandate-mit.json";+import getConnectorDetails from "../ConnectorUtils/utils";+import customerCreateBody from "../../fixtures/create-customer-body.json";++import State from "../../utils/State";++let globalState;++describe("Card - SingleUse Mandates 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 - NoThreeDS Create + Confirm Automatic CIT and MIT payment flow test", () => {++ it("Confirm No 3DS CIT", () => {+ console.log("confirm -> " + globalState.get("connectorId"));+ let det = getConnectorDetails(globalState.get("connectorId"))["MandateSingleUseNo3DS"];+ console.log("det -> " + det.card);+ cy.citForMandatesCallTest(citConfirmBody, det, true, "automatic", globalState);+ });++ it("Confirm No 3DS MIT", () => {+ cy.mitForMandatesCallTest(mitConfirmBody, 7000, true, "automatic", globalState);+ });++ it("list-mandate-call-test", () => {+ cy.listMandateCallTest(globalState);+ });++ it("revoke-mandate-call-test", () => {+ cy.revokeMandateCallTest(globalState);+ });++ it("revoke-revoked-mandate-call-test", () => {+ cy.revokeMandateCallTest(globalState);+ });+ });++});\ No newline at end of filediff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Adyen.js b/cypress-tests/cypress/e2e/ConnectorUtils/Adyen.jsnew file mode 100644index 0000000000..3c1e00c53b--- /dev/null+++ b/cypress-tests/cypress/e2e/ConnectorUtils/Adyen.js@@ -0,0 +1,91 @@++const successfulNo3DSCardDetails = {+ "card_number": "371449635398431",+ "card_exp_month": "03",+ "card_exp_year": "30",+ "card_holder_name": "John Doe",+ "card_cvc": "7373"+};++const successfulThreeDSTestCardDetails = {+ "card_number": "4917610000000000",+ "card_exp_month": "03",+ "card_exp_year": "30",+ "card_holder_name": "Joseph Doe",+ "card_cvc": "737"+};++export const connectorDetails = {+ "3DS": {+ "card": successfulThreeDSTestCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "requires_customer_action",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "pending",+ "refundSyncStatus": "pending"+ },+ "No3DS": {+ "card": successfulNo3DSCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "succeeded",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "pending",+ "refundSyncStatus": "pending"+ },+ "MandateSingleUse3DS": {+ "card": successfulThreeDSTestCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "requires_customer_action",+ "paymentSyncStatus": "processing",+ "refundStatus": "pending",+ "refundSyncStatus": "pending",+ "mandate_type": {+ "single_use": {+ "amount": 6000,+ "currency": "USD"+ }+ }+ },+ "MandateSingleUseNo3DS": {+ "card": successfulNo3DSCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "succeeded",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "pending",+ "refundSyncStatus": "pending",+ "mandate_type": {+ "single_use": {+ "amount": 6000,+ "currency": "USD"+ }+ }+ },+ "MandateMultiUseNo3DS": {+ "card": successfulNo3DSCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "succeeded",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "pending",+ "refundSyncStatus": "pending",+ "mandate_type": {+ "multi_use": {+ "amount": 6000,+ "currency": "USD"+ }+ }+ },+ "MandateMultiUse3DS": {+ "card": successfulThreeDSTestCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "requires_customer_action",+ "paymentSyncStatus": "processing",+ "refundStatus": "pending",+ "refundSyncStatus": "pending",+ "mandate_type": {+ "multi_use": {+ "amount": 6000,+ "currency": "USD"+ }+ }+ },+};\ No newline at end of filediff --git a/cypress-tests/cypress/e2e/ConnectorUtils/BankOfAmerica.js b/cypress-tests/cypress/e2e/ConnectorUtils/BankOfAmerica.jsnew file mode 100644index 0000000000..07d0494519--- /dev/null+++ b/cypress-tests/cypress/e2e/ConnectorUtils/BankOfAmerica.js@@ -0,0 +1,91 @@+const successfulNo3DSCardDetails = {+ "card_number": "4242424242424242",+ "card_exp_month": "01",+ "card_exp_year": "25",+ "card_holder_name": "joseph Doe",+ "card_cvc": "123"++};++const successfulThreeDSTestCardDetails = {+ "card_number": "4000000000001000",+ "card_exp_month": "01",+ "card_exp_year": "25",+ "card_holder_name": "joseph Doe",+ "card_cvc": "123"+};++export const connectorDetails = {+ "3DS": {+ "card": successfulThreeDSTestCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "requires_customer_action",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "pending",+ "refundSyncStatus": "pending"+ },+ "No3DS": {+ "card": successfulNo3DSCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "succeeded",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "pending",+ "refundSyncStatus": "pending"+ },+ "MandateSingleUse3DS": {+ "card": successfulThreeDSTestCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "requires_customer_action",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "pending",+ "refundSyncStatus": "pending",+ "mandate_type": {+ "single_use": {+ "amount": 8000,+ "currency": "USD"+ }+ }+ },+ "MandateSingleUseNo3DS": {+ "card": successfulNo3DSCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "succeeded",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "pending",+ "refundSyncStatus": "pending",+ "mandate_type": {+ "single_use": {+ "amount": 8000,+ "currency": "USD"+ }+ }+ },+ "MandateMultiUseNo3DS": {+ "card": successfulNo3DSCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "succeeded",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "pending",+ "refundSyncStatus": "pending",+ "mandate_type": {+ "multi_use": {+ "amount": 8000,+ "currency": "USD"+ }+ }+ },+ "MandateMultiUse3DS": {+ "card": successfulThreeDSTestCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "requires_customer_action",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "pending",+ "refundSyncStatus": "pending",+ "mandate_type": {+ "multi_use": {+ "amount": 8000,+ "currency": "USD"+ }+ }+ },+};\ No newline at end of filediff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Bluesnap.js b/cypress-tests/cypress/e2e/ConnectorUtils/Bluesnap.jsnew file mode 100644index 0000000000..95d18f0ab8--- /dev/null+++ b/cypress-tests/cypress/e2e/ConnectorUtils/Bluesnap.js@@ -0,0 +1,90 @@+const successfulNo3DSCardDetails = {+ "card_number": "4242424242424242",+ "card_exp_month": "10",+ "card_exp_year": "30",+ "card_holder_name": "John",+ "card_cvc": "737"+};++const successfulThreeDSTestCardDetails = {+ "card_number": "4000000000003063",+ "card_exp_month": "10",+ "card_exp_year": "30",+ "card_holder_name": "Joseph",+ "card_cvc": "737"+};++export const connectorDetails = {+ "3DS": {+ "card": successfulThreeDSTestCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "requires_customer_action",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "succeeded",+ "refundSyncStatus": "succeeded"+ },+ "No3DS": {+ "card": successfulNo3DSCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "succeeded",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "succeeded",+ "refundSyncStatus": "succeeded",+ },+ "MandateSingleUse3DS": {+ "card": successfulThreeDSTestCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "requires_customer_action",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "succeeded",+ "refundSyncStatus": "succeeded",+ "mandate_type": {+ "single_use": {+ "amount": 8000,+ "currency": "USD"+ }+ }+ },+ "MandateSingleUseNo3DS": {+ "card": successfulNo3DSCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "succeeded",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "succeeded",+ "refundSyncStatus": "succeeded",+ "mandate_type": {+ "single_use": {+ "amount": 8000,+ "currency": "USD"+ }+ }+ },+ "MandateMultiUseNo3DS": {+ "card": successfulNo3DSCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "succeeded",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "succeeded",+ "refundSyncStatus": "succeeded",+ "mandate_type": {+ "multi_use": {+ "amount": 8000,+ "currency": "USD"+ }+ }+ },+ "MandateMultiUse3DS": {+ "card": successfulThreeDSTestCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "requires_customer_action",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "succeeded",+ "refundSyncStatus": "succeeded",+ "mandate_type": {+ "multi_use": {+ "amount": 8000,+ "currency": "USD"+ }+ }+ },+};\ No newline at end of filediff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Cybersource.js b/cypress-tests/cypress/e2e/ConnectorUtils/Cybersource.jsnew file mode 100644index 0000000000..b4839f0e2b--- /dev/null+++ b/cypress-tests/cypress/e2e/ConnectorUtils/Cybersource.js@@ -0,0 +1,90 @@+const successfulNo3DSCardDetails = {+ "card_number": "4242424242424242",+ "card_exp_month": "01",+ "card_exp_year": "25",+ "card_holder_name": "joseph Doe",+ "card_cvc": "123"+};++const successfulThreeDSTestCardDetails = {+ "card_number": "4000000000001000",+ "card_exp_month": "01",+ "card_exp_year": "25",+ "card_holder_name": "joseph Doe",+ "card_cvc": "123"+};++export const connectorDetails = {+ "3DS": {+ "card": successfulThreeDSTestCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "requires_customer_action",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "pending",+ "refundSyncStatus": "pending",+ },+ "No3DS": {+ "card": successfulNo3DSCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "succeeded",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "pending",+ "refundSyncStatus": "pending",+ },+ "MandateSingleUse3DS": {+ "card": successfulThreeDSTestCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "requires_customer_action",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "pending",+ "refundSyncStatus": "pending",+ "mandate_type": {+ "single_use": {+ "amount": 8000,+ "currency": "USD"+ }+ }+ },+ "MandateSingleUseNo3DS": {+ "card": successfulNo3DSCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "succeeded",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "pending",+ "refundSyncStatus": "pending",+ "mandate_type": {+ "single_use": {+ "amount": 8000,+ "currency": "USD"+ }+ }+ },+ "MandateMultiUseNo3DS": {+ "card": successfulNo3DSCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "succeeded",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "pending",+ "refundSyncStatus": "pending",+ "mandate_type": {+ "multi_use": {+ "amount": 8000,+ "currency": "USD"+ }+ }+ },+ "MandateMultiUse3DS": {+ "card": successfulThreeDSTestCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "requires_customer_action",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "pending",+ "refundSyncStatus": "pending",+ "mandate_type": {+ "multi_use": {+ "amount": 8000,+ "currency": "USD"+ }+ }+ },+};\ No newline at end of filediff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Nmi.js b/cypress-tests/cypress/e2e/ConnectorUtils/Nmi.jsnew file mode 100644index 0000000000..75774165fa--- /dev/null+++ b/cypress-tests/cypress/e2e/ConnectorUtils/Nmi.js@@ -0,0 +1,91 @@+const successfulNo3DSCardDetails = {+ "card_number": "4000000000002503",+ "card_exp_month": "08",+ "card_exp_year": "25",+ "card_holder_name": "joseph Doe",+ "card_cvc": "999"+};++const successfulThreeDSTestCardDetails = {+ "card_number": "4000000000002503",+ "card_exp_month": "10",+ "card_exp_year": "25",+ "card_holder_name": "morino",+ "card_cvc": "999"+};++export const connectorDetails = {+ "3DS": {+ "card": successfulThreeDSTestCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "requires_customer_action",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "pending",+ "refundSyncStatus": "succeeded"++ },+ "No3DS": {+ "card": successfulNo3DSCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "processing",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "pending",+ "refundSyncStatus": "succeeded"+ },+ "MandateSingleUse3DS": {+ "card": successfulThreeDSTestCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "requires_customer_action",+ "paymentSyncStatus": "processing",+ "refundStatus": "pending",+ "refundSyncStatus": "succeeded",+ "mandate_type": {+ "single_use": {+ "amount": 8000,+ "currency": "USD"+ }+ }+ },+ "MandateSingleUseNo3DS": {+ "card": successfulNo3DSCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "processing",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "pending",+ "refundSyncStatus": "succeeded",+ "mandate_type": {+ "single_use": {+ "amount": 8000,+ "currency": "USD"+ }+ }+ },+ "MandateMultiUseNo3DS": {+ "card": successfulNo3DSCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "processing",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "pending",+ "refundSyncStatus": "succeeded",+ "mandate_type": {+ "multi_use": {+ "amount": 8000,+ "currency": "USD"+ }+ }+ },+ "MandateMultiUse3DS": {+ "card": successfulThreeDSTestCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "requires_customer_action",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "pending",+ "refundSyncStatus": "succeeded",+ "mandate_type": {+ "multi_use": {+ "amount": 8000,+ "currency": "USD"+ }+ }+ },+};\ No newline at end of filediff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Paypal.js b/cypress-tests/cypress/e2e/ConnectorUtils/Paypal.jsnew file mode 100644index 0000000000..a3ced376cf--- /dev/null+++ b/cypress-tests/cypress/e2e/ConnectorUtils/Paypal.js@@ -0,0 +1,81 @@+const successfulNo3DSCardDetails = {+ "card_number": "4012000033330026",+ "card_exp_month": "01",+ "card_exp_year": "25",+ "card_holder_name": "joseph Doe",+ "card_cvc": "123"++};++const successfulThreeDSTestCardDetails = {+ "card_number": "4868719460707704",+ "card_exp_month": "01",+ "card_exp_year": "25",+ "card_holder_name": "joseph Doe",+ "card_cvc": "123"+};++export const connectorDetails = {+ "3DS": {+ "card": successfulThreeDSTestCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "requires_customer_action",+ "paymentSyncStatus": "processing",++ },+ "No3DS": {+ "card": successfulNo3DSCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "processing",+ "paymentSyncStatus": "processing",++ },+ "MandateSingleUse3DS": {+ "card": successfulThreeDSTestCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "requires_customer_action",+ "paymentSyncStatus": "processing",+ "mandate_type": {+ "single_use": {+ "amount": 8000,+ "currency": "USD"+ }+ }+ },+ "MandateSingleUseNo3DS": {+ "card": successfulNo3DSCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "succeeded",+ "paymentSyncStatus": "succeeded",+ "mandate_type": {+ "single_use": {+ "amount": 8000,+ "currency": "USD"+ }+ }+ },+ "MandateMultiUseNo3DS": {+ "card": successfulNo3DSCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "succeeded",+ "paymentSyncStatus": "succeeded",+ "mandate_type": {+ "multi_use": {+ "amount": 8000,+ "currency": "USD"+ }+ }+ },+ "MandateMultiUse3DS": {+ "card": successfulThreeDSTestCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "requires_customer_action",+ "paymentSyncStatus": "processing",+ "mandate_type": {+ "multi_use": {+ "amount": 8000,+ "currency": "USD"+ }+ }+ }+};\ No newline at end of filediff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Stripe.js b/cypress-tests/cypress/e2e/ConnectorUtils/Stripe.jsnew file mode 100644index 0000000000..04dfd4b73a--- /dev/null+++ b/cypress-tests/cypress/e2e/ConnectorUtils/Stripe.js@@ -0,0 +1,93 @@+const successfulTestCard = "4242424242424242";+const successful3DSCard = "4000002760003184";++const successfulTestCardDetails = {+ "card_number": "4242424242424242",+ "card_exp_month": "10",+ "card_exp_year": "25",+ "card_holder_name": "morino",+ "card_cvc": "737"+};++const successfulThreeDSTestCardDetails = {+ "card_number": "4000002760003184",+ "card_exp_month": "10",+ "card_exp_year": "25",+ "card_holder_name": "morino",+ "card_cvc": "737"+};++export const connectorDetails = {+ "3DS": {+ "card": successfulThreeDSTestCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "requires_customer_action",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "succeeded",+ "refundSyncStatus": "succeeded"+ },+ "No3DS": {+ "card": successfulTestCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "succeeded",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "succeeded",+ "refundSyncStatus": "succeeded"+ },+ "MandateSingleUse3DS": {+ "card": successfulThreeDSTestCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "requires_customer_action",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "succeeded",+ "refundSyncStatus": "succeeded",+ "mandate_type": {+ "single_use": {+ "amount": 8000,+ "currency": "USD"+ }+ }+ },+ "MandateSingleUseNo3DS": {+ "card": successfulTestCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "succeeded",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "succeeded",+ "refundSyncStatus": "succeeded",+ "mandate_type": {+ "single_use": {+ "amount": 8000,+ "currency": "USD"+ }+ }+ },+ "MandateMultiUseNo3DS": {+ "card": successfulTestCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "succeeded",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "succeeded",+ "refundSyncStatus": "succeeded",+ "mandate_type": {+ "multi_use": {+ "amount": 8000,+ "currency": "USD"+ }+ }+ },+ "MandateMultiUse3DS": {+ "card": successfulThreeDSTestCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "requires_customer_action",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "succeeded",+ "refundSyncStatus": "succeeded",+ "mandate_type": {+ "multi_use": {+ "amount": 8000,+ "currency": "USD"+ }+ }+ },+};\ No newline at end of filediff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Trustpay.js b/cypress-tests/cypress/e2e/ConnectorUtils/Trustpay.jsnew file mode 100644index 0000000000..f190e145f9--- /dev/null+++ b/cypress-tests/cypress/e2e/ConnectorUtils/Trustpay.js@@ -0,0 +1,90 @@+const successfulNo3DSCardDetails = {+ "card_number": "4200000000000000",+ "card_exp_month": "10",+ "card_exp_year": "25",+ "card_holder_name": "joseph Doe",+ "card_cvc": "123"+};++const successfulThreeDSTestCardDetails = {+ "card_number": "4200000000000067",+ "card_exp_month": "03",+ "card_exp_year": "2030",+ "card_holder_name": "John Doe",+ "card_cvc": "737",+};++export const connectorDetails = {+ "3DS": {+ "card": successfulThreeDSTestCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "requires_customer_action",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "succeeded",+ "refundSyncStatus": "succeeded",+ },+ "No3DS": {+ "card": successfulNo3DSCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "succeeded",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "succeeded",+ "refundSyncStatus": "succeeded",+ },+ "MandateSingleUse3DS": {+ "card": successfulThreeDSTestCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "requires_customer_action",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "succeeded",+ "refundSyncStatus": "succeeded",+ "mandate_type": {+ "single_use": {+ "amount": 8000,+ "currency": "USD"+ }+ }+ },+ "MandateSingleUseNo3DS": {+ "card": successfulNo3DSCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "succeeded",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "succeeded",+ "refundSyncStatus": "succeeded",+ "mandate_type": {+ "single_use": {+ "amount": 8000,+ "currency": "USD"+ }+ }+ },+ "MandateMultiUseNo3DS": {+ "card": successfulNo3DSCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "succeeded",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "succeeded",+ "refundSyncStatus": "succeeded",+ "mandate_type": {+ "multi_use": {+ "amount": 8000,+ "currency": "USD"+ }+ }+ },+ "MandateMultiUse3DS": {+ "card": successfulThreeDSTestCardDetails,+ "currency": "USD",+ "paymentSuccessfulStatus": "requires_customer_action",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "succeeded",+ "refundSyncStatus": "succeeded",+ "mandate_type": {+ "multi_use": {+ "amount": 8000,+ "currency": "USD"+ }+ }+ },+};\ No newline at end of filediff --git a/cypress-tests/cypress/e2e/ConnectorUtils/utils.js b/cypress-tests/cypress/e2e/ConnectorUtils/utils.jsnew file mode 100644index 0000000000..abcef584b2--- /dev/null+++ b/cypress-tests/cypress/e2e/ConnectorUtils/utils.js@@ -0,0 +1,37 @@+import { connectorDetails as adyenConnectorDetails } from "./Adyen.js";+import { connectorDetails as bankOfAmericaConnectorDetails } from "./BankOfAmerica.js";+import { connectorDetails as bluesnapConnectorDetails } from "./Bluesnap.js";+import { connectorDetails as cybersourceConnectorDetails } from "./Cybersource.js";+import { connectorDetails as nmiConnectorDetails } from "./Nmi.js";+import { connectorDetails as paypalConnectorDetails } from "./Paypal.js";+import { connectorDetails as stripeConnectorDetails } from "./Stripe.js";+import { connectorDetails as trustpayConnectorDetails } from "./Trustpay.js";+import globalState from "../../utils/State.js";++const connectorDetails = {+ "adyen": adyenConnectorDetails,+ "bankofamerica": bankOfAmericaConnectorDetails,+ "bluesnap": bluesnapConnectorDetails,+ "cybersource": cybersourceConnectorDetails,+ "nmi": nmiConnectorDetails,+ "paypal": paypalConnectorDetails,+ "stripe": stripeConnectorDetails,+ "trustpay": trustpayConnectorDetails++}+++export default function getConnectorDetails(connectorId) {+ let x = getValueByKey(connectorDetails, connectorId);+ return x;+}++function getValueByKey(jsonObject, key) {+ const data = typeof jsonObject === 'string' ? JSON.parse(jsonObject) : jsonObject;++ if (data && typeof data === 'object' && key in data) {+ return data[key];+ } else {+ return null;+ }+}\ No newline at end of filediff --git a/cypress-tests/cypress/fixtures/capture-flow-body.json b/cypress-tests/cypress/fixtures/capture-flow-body.jsonnew file mode 100644index 0000000000..cafda7261d--- /dev/null+++ b/cypress-tests/cypress/fixtures/capture-flow-body.json@@ -0,0 +1,5 @@+{+ "amount_to_capture": 100,+ "statement_descriptor_name": "Joseph",+ "statement_descriptor_suffix": "JS"+}\ No newline at end of filediff --git a/cypress-tests/cypress/fixtures/confirm-body.json b/cypress-tests/cypress/fixtures/confirm-body.jsonnew file mode 100644index 0000000000..e0ffceffec--- /dev/null+++ b/cypress-tests/cypress/fixtures/confirm-body.json@@ -0,0 +1,43 @@+{+ "client_secret": "",+ "return_url": "https://hyperswitch.io",+ "payment_method": "card",+ "confirm": true,+ "payment_method_data": {+ "card": {+ "_comment": "these details are fetched from utils",+ "card_number": "YourCardNumberHere",+ "card_exp_month": "04",+ "card_exp_year": "24",+ "card_holder_name": "xyz",+ "card_cvc": "424",+ "card_issuer": "",+ "card_network": "Visa"+ }+ },+ "billing": {+ "address": {+ "state": "New York",+ "city": "New York",+ "country": "US",+ "first_name": "john",+ "last_name": "doe",+ "zip": "10001",+ "line1": "123 Main Street Apt 4B",+ "line2": "123 Main Street Apt 4B",+ "line3": "123 Main Street Apt 4B"+ }+ },+ "email": "[email protected]",+ "browser_info": {+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",+ "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",+ "language": "en-US",+ "color_depth": 30,+ "screen_height": 1117,+ "screen_width": 1728,+ "time_zone": -330,+ "java_enabled": true,+ "java_script_enabled": true+ }+}\ No newline at end of filediff --git a/cypress-tests/cypress/fixtures/create-api-key-body.json b/cypress-tests/cypress/fixtures/create-api-key-body.jsonnew file mode 100644index 0000000000..2f67633e17--- /dev/null+++ b/cypress-tests/cypress/fixtures/create-api-key-body.json@@ -0,0 +1,5 @@+{+ "name": "API Key 1",+ "description": null,+ "expiration": "2069-09-23T01:02:03.000Z"+}\ No newline at end of filediff --git a/cypress-tests/cypress/fixtures/create-confirm-body.json b/cypress-tests/cypress/fixtures/create-confirm-body.jsonnew file mode 100644index 0000000000..c835ed3ea1--- /dev/null+++ b/cypress-tests/cypress/fixtures/create-confirm-body.json@@ -0,0 +1,75 @@+{+ "amount": 6540,+ "currency": "USD",+ "confirm": true,+ "business_country": "US",+ "business_label": "default",+ "capture_method": "automatic",+ "capture_on": "2022-09-10T10:11:12Z",+ "amount_to_capture": 6540,+ "customer_id": "john123",+ "email": "[email protected]",+ "name": "John Doe",+ "phone": "999999999",+ "phone_country_code": "+65",+ "description": "Its my first payment request",+ "authentication_type": "no_three_ds",+ "return_url": "https://duck.com",+ "setup_future_usage": "on_session",+ "payment_method": "card",+ "payment_method_type": "debit",+ "payment_method_data": {+ "card": {+ "card_number": "4242424242424242",+ "card_exp_month": "01",+ "card_exp_year": "24",+ "card_holder_name": "joseph Doe",+ "card_cvc": "123"+ }+ },+ "billing": {+ "address": {+ "line1": "1467",+ "line2": "Harrison Street",+ "line3": "Harrison Street",+ "city": "San Fransico",+ "state": "California",+ "zip": "94122",+ "country": "US",+ "first_name": "john",+ "last_name": "doe"+ }+ },+ "shipping": {+ "address": {+ "line1": "1467",+ "line2": "Harrison Street",+ "line3": "Harrison Street",+ "city": "San Fransico",+ "state": "California",+ "zip": "94122",+ "country": "US",+ "first_name": "john",+ "last_name": "doe"+ }+ },+ "statement_descriptor_name": "joseph",+ "statement_descriptor_suffix": "JS",+ "metadata": {+ "udf1": "value1",+ "new_customer": "true",+ "login_date": "2019-09-10T10:11:12Z"+ },+ "browser_info": {+ "ip_address": "129.0.0.1",+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",+ "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",+ "language": "en-US",+ "color_depth": 30,+ "screen_height": 1117,+ "screen_width": 1728,+ "time_zone": -330,+ "java_enabled": true,+ "java_script_enabled": true+ }+}\ No newline at end of filediff --git a/cypress-tests/cypress/fixtures/create-connector-body.json b/cypress-tests/cypress/fixtures/create-connector-body.jsonnew file mode 100644index 0000000000..068a59a695--- /dev/null+++ b/cypress-tests/cypress/fixtures/create-connector-body.json@@ -0,0 +1,62 @@+{+ "connector_type": "fiz_operations",+ "connector_name": "stripe",+ "business_country": "US",+ "business_label": "default",+ "connector_label": "first_stripe_connector",+ "connector_account_details": {+ "auth_type": "BodyKey",+ "api_key": "api-key",+ "key1": "value1"+ },+ "test_mode": false,+ "disabled": false,+ "payment_methods_enabled": [+ {+ "payment_method": "card",+ "payment_method_types": [+ {+ "payment_method_type": "credit",+ "card_networks": [+ "AmericanExpress",+ "Discover",+ "Interac",+ "JCB",+ "Mastercard",+ "Visa",+ "DinersClub",+ "UnionPay",+ "RuPay"+ ],+ "minimum_amount": 1,+ "maximum_amount": 68607706,+ "recurring_enabled": false,+ "installment_payment_enabled": true+ },+ {+ "payment_method_type": "debit",+ "card_networks": [+ "AmericanExpress",+ "Discover",+ "Interac",+ "JCB",+ "Mastercard",+ "Visa",+ "DinersClub",+ "UnionPay",+ "RuPay"+ ],+ "minimum_amount": 1,+ "maximum_amount": 68607706,+ "recurring_enabled": false,+ "installment_payment_enabled": true+ }+ ]+ }+ ],+ "metadata": {+ "city": "NY",+ "unit": "245",+ "endpoint_prefix": "AD"+ }+}\ No newline at end of filediff --git a/cypress-tests/cypress/fixtures/create-customer-body.json b/cypress-tests/cypress/fixtures/create-customer-body.jsonnew file mode 100644index 0000000000..26c6bb9ec7--- /dev/null+++ b/cypress-tests/cypress/fixtures/create-customer-body.json@@ -0,0 +1,23 @@+{+ "email": "[email protected]",+ "name": "John Doe",+ "phone": "999999999",+ "phone_country_code": "+65",+ "description": "First customer",+ "address": {+ "city": "Bangalore",+ "country": "IN",+ "line1": "Juspay router",+ "line2": "Koramangala",+ "line3": "Stallion",+ "state": "Karnataka",+ "zip": "560095",+ "first_name": "John",+ "last_name": "Doe"+ },+ "metadata": {+ "udf1": "value1",+ "new_customer": "true",+ "login_date": "2019-09-10T10:11:12Z"+ }+}\ No newline at end of filediff --git a/cypress-tests/cypress/fixtures/create-mandate-cit.json b/cypress-tests/cypress/fixtures/create-mandate-cit.jsonnew file mode 100644index 0000000000..49837e77ba--- /dev/null+++ b/cypress-tests/cypress/fixtures/create-mandate-cit.json@@ -0,0 +1,89 @@+{+ "amount": 7000,+ "currency": "USD",+ "confirm": true,+ "capture_method": "automatic",+ "capture_on": "2022-09-10T10:11:12Z",+ "amount_to_capture": 7000,+ "customer_id": "StripeCustomer",+ "email": "[email protected]",+ "name": "John Doe",+ "phone": "999999999",+ "phone_country_code": "+65",+ "description": "Its my first payment request",+ "authentication_type": "no_three_ds",+ "return_url": "https://duck.com",+ "payment_method": "card",+ "payment_method_type": "debit",+ "payment_method_data": {+ "card": {+ "card_number": "4242424242424242",+ "card_exp_month": "10",+ "card_exp_year": "25",+ "card_holder_name": "joseph Doe",+ "card_cvc": "123"+ }+ },+ "setup_future_usage": "off_session",+ "mandate_data": {+ "customer_acceptance": {+ "acceptance_type": "offline",+ "accepted_at": "1963-05-03T04:07:52.723Z",+ "online": {+ "ip_address": "127.0.0.1",+ "user_agent": "amet irure esse"+ }+ },+ "mandate_type": {+ "single_use": {+ "amount": 8000,+ "currency": "USD"+ }+ }+ },+ "billing": {+ "address": {+ "line1": "1467",+ "line2": "Harrison Street",+ "line3": "Harrison Street",+ "city": "San Fransico",+ "state": "California",+ "zip": "94122",+ "country": "US",+ "first_name": "john",+ "last_name": "Doe"+ }+ },+ "shipping": {+ "address": {+ "line1": "1467",+ "line2": "Harrison Street",+ "line3": "Harrison Street",+ "city": "San Fransico",+ "state": "California",+ "zip": "94122",+ "country": "US",+ "first_name": "john",+ "last_name": "Doe"+ }+ },+ "statement_descriptor_name": "joseph",+ "statement_descriptor_suffix": "JS",+ "metadata": {+ "udf1": "value1",+ "new_customer": "true",+ "login_date": "2019-09-10T10:11:12Z"+ },+ "browser_info": {+ "ip_address": "129.0.0.1",+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",+ "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",+ "language": "en-US",+ "color_depth": 30,+ "screen_height": 1117,+ "screen_width": 1728,+ "time_zone": -330,+ "java_enabled": true,+ "java_script_enabled": true+ }+}\ No newline at end of filediff --git a/cypress-tests/cypress/fixtures/create-mandate-mit.json b/cypress-tests/cypress/fixtures/create-mandate-mit.jsonnew file mode 100644index 0000000000..14afdf6609--- /dev/null+++ b/cypress-tests/cypress/fixtures/create-mandate-mit.json@@ -0,0 +1,35 @@+{+ "amount": 6540,+ "currency": "USD",+ "capture_method": "automatic",+ "off_session": true,+ "confirm": true,+ "description": "Initiated by merchant",+ "mandate_id": "mandate_id",+ "customer_id": "StripeCustomer",+ "billing": {+ "address": {+ "line1": "1467",+ "line2": "Harrison Street",+ "line3": "Harrison Street",+ "city": "San Fransico",+ "state": "California",+ "zip": "94122",+ "country": "US",+ "first_name": "john",+ "last_name": "Doe"+ }+ },+ "browser_info": {+ "ip_address": "129.0.0.1",+ "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",+ "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",+ "language": "en-US",+ "color_depth": 30,+ "screen_height": 1117,+ "screen_width": 1728,+ "time_zone": -330,+ "java_enabled": true,+ "java_script_enabled": true+ }+}\ No newline at end of filediff --git a/cypress-tests/cypress/fixtures/create-payment-body.json b/cypress-tests/cypress/fixtures/create-payment-body.jsonnew file mode 100644index 0000000000..14ef202a07--- /dev/null+++ b/cypress-tests/cypress/fixtures/create-payment-body.json@@ -0,0 +1,19 @@+{+ "currency": "USD",+ "amount": 6500,+ "authentication_type": "three_ds",+ "description": "Joseph First Crypto",+ "email": "[email protected]",+ "connector_metadata": {+ "noon": {+ "order_category": "applepay"+ }+ },+ "metadata": {+ "udf1": "value1",+ "new_customer": "true",+ "login_date": "2019-09-10T10:11:12Z"+ },+ "business_country": "US",+ "business_label": "default"+}\ No newline at end of filediff --git a/cypress-tests/cypress/fixtures/merchant-create-body.json b/cypress-tests/cypress/fixtures/merchant-create-body.jsonnew file mode 100644index 0000000000..00a28adbf0--- /dev/null+++ b/cypress-tests/cypress/fixtures/merchant-create-body.json@@ -0,0 +1,44 @@+{+ "merchant_id": "cypress_merchant_GHAction_6dcfed64-ec62-46a2-9961-cafa3c1faa01",+ "locker_id": "m0010",+ "merchant_name": "NewAge Retailers",+ "merchant_details": {+ "primary_contact_person": "John Test",+ "primary_email": "[email protected]",+ "primary_phone": "sunt laborum",+ "secondary_contact_person": "John Test2",+ "secondary_email": "[email protected]",+ "secondary_phone": "cillum do dolor id",+ "website": "www.example.com",+ "about_business": "Online Retail with a wide selection of organic products for North America",+ "address": {+ "line1": "1467",+ "line2": "Harrison Street",+ "line3": "Harrison Street",+ "city": "San Francisco",+ "state": "California",+ "zip": "94122",+ "country": "US"+ }+ },+ "return_url": "https://duck.com/success",+ "webhook_details": {+ "webhook_version": "1.0.1",+ "webhook_username": "ekart_retail",+ "webhook_password": "password_ekart@123",+ "payment_created_enabled": true,+ "payment_succeeded_enabled": true,+ "payment_failed_enabled": true+ },+ "sub_merchants_enabled": false,+ "metadata": {+ "city": "NY",+ "unit": "245"+ },+ "primary_business_details": [+ {+ "country": "US",+ "business": "default"+ }+ ]+}\ No newline at end of filediff --git a/cypress-tests/cypress/fixtures/refund-flow-body.json b/cypress-tests/cypress/fixtures/refund-flow-body.jsonnew file mode 100644index 0000000000..4579d121a0--- /dev/null+++ b/cypress-tests/cypress/fixtures/refund-flow-body.json@@ -0,0 +1,11 @@+{+ "payment_id": "payment_id",+ "amount": 100,+ "reason": "FRAUD",+ "refund_type": "instant",+ "metadata": {+ "udf1": "value1",+ "new_customer": "true",+ "login_date": "2019-09-10T10:11:12Z"+ }+}\ No newline at end of filediff --git a/cypress-tests/cypress/fixtures/void-payment-body.json b/cypress-tests/cypress/fixtures/void-payment-body.jsonnew file mode 100644index 0000000000..29b5c8be3f--- /dev/null+++ b/cypress-tests/cypress/fixtures/void-payment-body.json@@ -0,0 +1,3 @@+{+ "cancellation_reason": "requested_by_customer"+}\ No newline at end of filediff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.jsnew file mode 100644index 0000000000..9ab3b092ac--- /dev/null+++ b/cypress-tests/cypress/support/commands.js@@ -0,0 +1,567 @@+// ***********************************************+// This example commands.js shows you how to+// create various custom commands and overwrite+// existing commands.+//+// For more comprehensive examples of custom+// commands please read more here:+// https://on.cypress.io/custom-commands+// ***********************************************+//+//+// -- This is a parent command --+// Cypress.Commands.add('login', (email, password) => { ... })+//+//+// -- This is a child command --+// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })+//+//+// -- This is a dual command --+// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })+//+//+// -- This will overwrite an existing command --+// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })++// commands.js or your custom support file+import * as RequestBodyUtils from "../utils/RequestBodyUtils";+import ConnectorAuthDetails from "../../../.github/secrets/creds.json";++++Cypress.Commands.add("merchantCreateCallTest", (merchantCreateBody, globalState) => {++ const randomMerchantId = RequestBodyUtils.generateRandomString();+ RequestBodyUtils.setMerchantId(merchantCreateBody, randomMerchantId);+ globalState.set("merchantId", randomMerchantId);++ cy.request({+ method: "POST",+ url: `${globalState.get("baseUrl")}/accounts`,+ headers: {+ "Content-Type": "application/json",+ Accept: "application/json",+ "api-key": globalState.get("adminApiKey"),+ },+ body: merchantCreateBody,+ }).then((response) => {+ // Handle the response as needed+ console.log(response.body);+ globalState.set("publishableKey", response.body.publishable_key);+ });+});++Cypress.Commands.add("apiKeyCreateTest", (apiKeyCreateBody, globalState) => {+ cy.request({+ method: "POST",+ url: `${globalState.get("baseUrl")}/api_keys/${globalState.get("merchantId")}`,+ headers: {+ "Content-Type": "application/json",+ Accept: "application/json",+ "api-key": globalState.get("adminApiKey"),+ },+ body: apiKeyCreateBody,+ }).then((response) => {+ // Handle the response as needed+ console.log(response.body);+ globalState.set("apiKey", response.body.api_key);+ });+});++Cypress.Commands.add("createConnectorCallTest", (createConnectorBody, globalState) => {+ const merchantId = globalState.get("merchantId");+ createConnectorBody.connector_name = globalState.get("connectorId");+ const authDetails = getValueByKey(ConnectorAuthDetails, globalState.get("connectorId"));+ createConnectorBody.connector_account_details = authDetails;+ cy.request({+ method: "POST",+ url: `${globalState.get("baseUrl")}/account/${merchantId}/connectors`,+ headers: {+ "Content-Type": "application/json",+ Accept: "application/json",+ "api-key": globalState.get("adminApiKey"),+ },+ body: createConnectorBody,+ failOnStatusCode: false+ }).then((response) => {+ // Handle the response as needed+ const xRequestId = response.headers['x-request-id'];+ if (xRequestId) {+ cy.task('cli_log', "x-request-id ->> " + xRequestId);+ } else {+ cy.task('cli_log', "x-request-id is not available in the response headers");+ }++ if (response.status === 200) {+ expect(globalState.get("connectorId")).to.equal(response.body.connector_name);+ }+ else {+ cy.task('cli_log', "response status ->> " + JSON.stringify(response.status));+ cy.task('cli_log', "res body ->> " + JSON.stringify(response.body));+ }+++ });+});++function getValueByKey(jsonObject, key) {+ const data = typeof jsonObject === 'string' ? JSON.parse(jsonObject) : jsonObject;+ if (data && typeof data === 'object' && key in data) {+ return data[key];+ } else {+ return null;+ }+}++Cypress.Commands.add("createCustomerCallTest", (customerCreateBody, globalState) => {+ cy.request({+ method: "POST",+ url: `${globalState.get("baseUrl")}/customers`,+ headers: {+ "Content-Type": "application/json",+ "api-key": globalState.get("apiKey"),+ },+ body: customerCreateBody,+ }).then((response) => {+ // Handle the response as needed+ console.log(response);++ globalState.set("customerId", response.body.customer_id);+ });+});++Cypress.Commands.add("createPaymentIntentTest", (request, currency, authentication_type, capture_method, globalState) => {+ if (!request || typeof request !== "object" || !currency || !authentication_type) {+ throw new Error("Invalid parameters provided to createPaymentIntentTest command");+ }+ request.currency = currency;+ request.authentication_type = authentication_type;+ request.capture_method = capture_method;+ globalState.set("paymentAmount", request.amount);+ cy.request({+ method: "POST",+ url: `${globalState.get("baseUrl")}/payments`,+ headers: {+ "Content-Type": "application/json",+ Accept: "application/json",+ "api-key": globalState.get("apiKey"),+ },+ body: request,+ }).then((response) => {+ expect(response.headers["content-type"]).to.include("application/json");+ expect(response.body).to.have.property("client_secret");+ const clientSecret = response.body.client_secret;+ globalState.set("clientSecret", clientSecret);+ globalState.set("paymentID", response.body.payment_id);+ cy.log(clientSecret);+ expect("requires_payment_method").to.equal(response.body.status);+ expect(request.amount).to.equal(response.body.amount);+ expect(null).to.equal(response.body.amount_received);+ expect(request.amount).to.equal(response.body.amount_capturable);+ });+});++Cypress.Commands.add("paymentMethodsCallTest", (globalState) => {+ const clientSecret = globalState.get("clientSecret");+ const paymentIntentID = clientSecret.split("_secret_")[0];++ cy.request({+ method: "GET",+ url: `${globalState.get("baseUrl")}/account/payment_methods?client_secret=${clientSecret}`,+ headers: {+ "Content-Type": "application/json",+ "api-key": globalState.get("publishableKey"),+ },+ }).then((response) => {+ console.log(response);+ expect(response.headers["content-type"]).to.include("application/json");+ expect(response.body).to.have.property("redirect_url");+ expect(response.body).to.have.property("payment_methods");+ globalState.set("paymentID", paymentIntentID);+ cy.log(response);+ });+});++Cypress.Commands.add("confirmCallTest", (confirmBody, details, confirm, globalState) => {++ const paymentIntentID = globalState.get("paymentID");+ confirmBody.payment_method_data.card = details.card;+ confirmBody.confirm = confirm;+ confirmBody.client_secret = globalState.get("clientSecret");++ cy.request({+ method: "POST",+ url: `${globalState.get("baseUrl")}/payments/${paymentIntentID}/confirm`,+ headers: {+ "Content-Type": "application/json",+ "api-key": globalState.get("publishableKey"),+ },+ body: confirmBody,+ }).then((response) => {+ expect(response.headers["content-type"]).to.include("application/json");+ console.log(response.body);+ globalState.set("paymentID", paymentIntentID);+ if (response.body.capture_method === "automatic") {+ 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);+ } else {+ // Handle other authentication types as needed+ throw new Error(`Unsupported authentication type: ${authentication_type}`);+ }+ } else if (response.body.capture_method === "manual") {+ 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);+ } else {+ // Handle other authentication types as needed+ throw new Error(`Unsupported authentication type: ${authentication_type}`);+ }+ }+ else {+ throw new Error(`Unsupported capture method: ${capture_method}`);+ }+ });+});++Cypress.Commands.add("createConfirmPaymentTest", (createConfirmPaymentBody, details, authentication_type, capture_method, globalState) => {+ createConfirmPaymentBody.payment_method_data.card = details.card;+ createConfirmPaymentBody.authentication_type = authentication_type;+ createConfirmPaymentBody.currency = details.currency;+ createConfirmPaymentBody.capture_method = capture_method;+ cy.request({+ method: "POST",+ url: `${globalState.get("baseUrl")}/payments`,+ headers: {+ "Content-Type": "application/json",+ "api-key": globalState.get("apiKey"),+ },+ body: createConfirmPaymentBody,+ }).then((response) => {+ expect(response.headers["content-type"]).to.include("application/json");+ expect(response.body).to.have.property("status");+ console.log(response.body);+ globalState.set("paymentAmount", createConfirmPaymentBody.amount);+ globalState.set("paymentID", response.body.payment_id);+ if (response.body.capture_method === "automatic") {+ if (response.body.authentication_type === "three_ds") {+ expect(response.body).to.have.property("next_action")+ .to.have.property("redirect_to_url")+ }+ else if (response.body.authentication_type === "no_three_ds") {+ expect(details.paymentSuccessfulStatus).to.equal(response.body.status);+ } else {+ // Handle other authentication types as needed+ throw new Error(`Unsupported authentication type: ${authentication_type}`);+ }+ }+ else if (response.body.capture_method === "manual") {+ if (response.body.authentication_type === "three_ds") {+ expect(response.body).to.have.property("next_action")+ .to.have.property("redirect_to_url")+ }+ else if (response.body.authentication_type === "no_three_ds") {+ expect("requires_capture").to.equal(response.body.status);+ } else {+ // Handle other authentication types as needed+ throw new Error(`Unsupported authentication type: ${authentication_type}`);+ }+ }+ });+});+++Cypress.Commands.add("captureCallTest", (requestBody, amount_to_capture, paymentSuccessfulStatus, globalState) => {+ const payment_id = globalState.get("paymentID");+ requestBody.amount_to_capture = amount_to_capture;+ let amount = globalState.get("paymentAmount");+ cy.request({+ method: "POST",+ url: `${globalState.get("baseUrl")}/payments/${payment_id}/capture`,+ headers: {+ "Content-Type": "application/json",+ "api-key": globalState.get("apiKey"),+ },+ body: requestBody,+ }).then((response) => {+ expect(response.headers["content-type"]).to.include("application/json");+ expect(response.body.payment_id).to.equal(payment_id);+ console.log(response.body);+ if (amount_to_capture == amount) {+ expect(response.body.amount).to.equal(amount_to_capture);+ expect(response.body.amount_capturable).to.equal(0);+ expect(response.body.amount_received).to.equal(amount);+ expect(response.body.status).to.equal(paymentSuccessfulStatus);+ } else {+ expect(response.body.amount).to.equal(amount);+ expect(response.body.amount_capturable).to.equal(0);+ expect(response.body.amount_received).to.equal(amount_to_capture);+ expect(response.body.status).to.equal("partially_captured");+ }+ });+});++Cypress.Commands.add("voidCallTest", (requestBody, globalState) => {+ const payment_id = globalState.get("paymentID");+ cy.request({+ method: "POST",+ url: `${globalState.get("baseUrl")}/payments/${payment_id}/cancel`,+ headers: {+ "Content-Type": "application/json",+ "api-key": globalState.get("apiKey"),+ },+ body: requestBody,+ }).then((response) => {+ expect(response.headers["content-type"]).to.include("application/json");+ expect(response.body.payment_id).to.equal(payment_id);+ expect(response.body.amount).to.equal(globalState.get("paymentAmount"));+ // expect(response.body.amount_capturable).to.equal(0);+ expect(response.body.amount_received).to.be.oneOf([0, null]);+ expect(response.body.status).to.equal("cancelled");+ console.log(response.body);+ });+});++Cypress.Commands.add("retrievePaymentCallTest", (globalState) => {+ console.log("syncpaymentID------>" + globalState.get("paymentID"));+ const payment_id = globalState.get("paymentID");+ cy.request({+ method: "GET",+ url: `${globalState.get("baseUrl")}/payments/${payment_id}?force_sync=true`,+ headers: {+ "Content-Type": "application/json",+ "api-key": globalState.get("apiKey"),+ },+ }).then((response) => {+ expect(response.headers["content-type"]).to.include("application/json");+ console.log(response.body);+ expect(response.body.payment_id).to.equal(payment_id);+ expect(response.body.amount).to.equal(globalState.get("paymentAmount"));+ globalState.set("paymentID", response.body.payment_id);++ });+});++Cypress.Commands.add("refundCallTest", (requestBody, refund_amount, det, globalState) => {+ const payment_id = globalState.get("paymentID");+ requestBody.payment_id = payment_id;+ requestBody.amount = refund_amount;+ cy.request({+ method: "POST",+ url: `${globalState.get("baseUrl")}/refunds`,+ headers: {+ "Content-Type": "application/json",+ "api-key": globalState.get("apiKey"),+ },+ body: requestBody+ }).then((response) => {+ expect(response.headers["content-type"]).to.include("application/json");+ console.log(response.body);+ globalState.set("refundId", response.body.refund_id);+ expect(response.body.status).to.equal(det.refundStatus);+ expect(response.body.amount).to.equal(refund_amount);+ expect(response.body.payment_id).to.equal(payment_id);+ });+});++Cypress.Commands.add("syncRefundCallTest", (det, globalState) => {+ const refundId = globalState.get("refundId");+ cy.request({+ method: "GET",+ url: `${globalState.get("baseUrl")}/refunds/${refundId}?force_sync=true`,+ headers: {+ "Content-Type": "application/json",+ "api-key": globalState.get("apiKey"),+ },+ }).then((response) => {+ expect(response.headers["content-type"]).to.include("application/json");+ console.log(response.body);+ expect(response.body.status).to.equal(det.refundSyncStatus);+ });+});++Cypress.Commands.add("citForMandatesCallTest", (requestBody, details, confirm, capture_method, globalState) => {++ requestBody.payment_method_data.card = details.card;+ requestBody.confirm = confirm;+ requestBody.currency = details.currency;+ requestBody.capture_method = capture_method;+ requestBody.mandate_data.mandate_type = details.mandate_type;+ requestBody.customer_id = globalState.get("customerId");+ globalState.set("paymentAmount", requestBody.amount);+ cy.request({+ method: "POST",+ url: `${globalState.get("baseUrl")}/payments`,+ headers: {+ "Content-Type": "application/json",+ "api-key": globalState.get("apiKey"),+ },+ body: requestBody,+ }).then((response) => {+ expect(response.headers["content-type"]).to.include("application/json");+ expect(response.body).to.have.property("mandate_id");+ console.log(response.body);+ globalState.set("mandateId", response.body.mandate_id);+ globalState.set("paymentID", response.body.payment_id);++ if (response.body.capture_method === "automatic") {+ if (response.body.authentication_type === "three_ds") {+ expect(response.body).to.have.property("next_action")+ .to.have.property("redirect_to_url");+ const nextActionUrl = response.body.next_action.redirect_to_url;+ cy.log(response.body);+ cy.log(nextActionUrl);+ } else if (response.body.authentication_type === "no_three_ds") {+ expect(response.body.status).to.equal(details.paymentSuccessfulStatus);+ } else {+ // Handle other authentication types as needed+ throw new Error(`Unsupported authentication type: ${authentication_type}`);+ }+ }+ else if (response.body.capture_method === "manual") {+ if (response.body.authentication_type === "three_ds") {+ expect(response.body).to.have.property("next_action")+ }+ else if (response.body.authentication_type === "no_three_ds") {+ expect(response.body.status).to.equal("requires_capture");+ } else {+ throw new Error(`Unsupported authentication type: ${authentication_type}`);+ }+ }++ });+});++Cypress.Commands.add("mitForMandatesCallTest", (requestBody, amount, confirm, capture_method, globalState) => {+ requestBody.amount = amount;+ requestBody.confirm = confirm;+ requestBody.capture_method = capture_method;+ requestBody.mandate_id = globalState.get("mandateId");+ requestBody.customer_id = globalState.get("customerId");+ globalState.set("paymentAmount", requestBody.amount);+ console.log("mit body " + JSON.stringify(requestBody));+ cy.request({+ method: "POST",+ url: `${globalState.get("baseUrl")}/payments`,+ headers: {+ "Content-Type": "application/json",+ "api-key": globalState.get("apiKey"),+ },+ body: requestBody,+ }).then((response) => {+ expect(response.headers["content-type"]).to.include("application/json");+ globalState.set("paymentID", response.body.payment_id);+ console.log(response.body);+ console.log("mit statusss-> " + response.body.status);+ if (response.body.capture_method === "automatic") {+ if (response.body.authentication_type === "three_ds") {+ expect(response.body).to.have.property("next_action")+ .to.have.property("redirect_to_url");+ const nextActionUrl = response.body.next_action.redirect_to_url;+ cy.log(response.body);+ cy.log(nextActionUrl);+ } else if (response.body.authentication_type === "no_three_ds") {+ expect(response.body.status).to.equal("succeeded");+ } else {+ // Handle other authentication types as needed+ throw new Error(`Unsupported authentication type: ${authentication_type}`);+ }+ }+ else if (response.body.capture_method === "manual") {+ if (response.body.authentication_type === "three_ds") {+ expect(response.body).to.have.property("next_action")+ .to.have.property("redirect_to_url");+ const nextActionUrl = response.body.next_action.redirect_to_url;+ cy.log(response.body);+ cy.log(nextActionUrl);+ } else if (response.body.authentication_type === "no_three_ds") {+ expect(response.body.status).to.equal("requires_capture");+ } else {+ // Handle other authentication types as needed+ throw new Error(`Unsupported authentication type: ${authentication_type}`);+ }+ }+ });+});+++Cypress.Commands.add("listMandateCallTest", (globalState) => {+ const customerId = globalState.get("customerId");+ cy.request({+ method: "GET",+ url: `${globalState.get("baseUrl")}/customers/${customerId}/mandates`,+ headers: {+ "Content-Type": "application/json",+ "api-key": globalState.get("apiKey"),+ },+ }).then((response) => {+ expect(response.headers["content-type"]).to.include("application/json");+ console.log(response.body);+ let i = 0;+ for (i in response.body) {+ if (response.body[i].mandate_id === globalState.get("mandateId")) {+ expect(response.body[i].status).to.equal("active");+ }+ };+ });+});++Cypress.Commands.add("revokeMandateCallTest", (globalState) => {+ const mandateId = globalState.get("mandateId");+ cy.request({+ method: "POST",+ url: `${globalState.get("baseUrl")}/mandates/revoke/${mandateId}`,+ headers: {+ "Content-Type": "application/json",+ "api-key": globalState.get("apiKey"),+ },+ failOnStatusCode: false+ }).then((response) => {+ expect(response.headers["content-type"]).to.include("application/json");+ console.log(response.body);+ if (response.body.status === 200) {+ expect(response.body.status).to.equal("revoked");+ } else if (response.body.status === 400) {+ expect(response.body.reason).to.equal("Mandate has already been revoked");+ }+ });+});+++Cypress.Commands.add("handleRedirection", (globalState, expected_redirection) => {+ let expected_url = new URL(expected_redirection);+ let redirection_url = new URL(globalState.get("nextActionUrl"));+ cy.visit(redirection_url.href);++ if (globalState.get("connectorId") == "stripe") {+ cy.get('iframe')+ .its('0.contentDocument.body')+ .within((body) => {+ cy.get('iframe')+ .its('0.contentDocument.body')+ .within((body) => {+ cy.get('#test-source-authorize-3ds').click();+ })+ })+ } else {+ cy.wait(10000);+ }++ if (redirection_url.host.endsWith(expected_url.host)) {+ // no cors workaround needed+ cy.window().its('location.origin').should('eq', expected_url.origin);+ } else {+ // workaround for cors to allow cross origin iframe+ cy.origin(expected_url.origin, { args: { expected_url: expected_url.origin} }, ({expected_url}) => {+ cy.window().its('location.origin').should('eq', expected_url);+ })+ }+});\ No newline at end of filediff --git a/cypress-tests/cypress/support/e2e.js b/cypress-tests/cypress/support/e2e.jsnew file mode 100644index 0000000000..0e7290a13d--- /dev/null+++ b/cypress-tests/cypress/support/e2e.js@@ -0,0 +1,20 @@+// ***********************************************************+// This example support/e2e.js is processed and+// loaded automatically before your test files.+//+// This is a great place to put global configuration and+// behavior that modifies Cypress.+//+// You can change the location of this file or turn off+// automatically serving support files with the+// 'supportFile' configuration option.+//+// You can read more here:+// https://on.cypress.io/configuration+// ***********************************************************++// Import commands.js using ES2015 syntax:+import './commands'++// Alternatively you can use CommonJS syntax:+// require('./commands')\ No newline at end of filediff --git a/cypress-tests/cypress/utils/RequestBodyUtils.js b/cypress-tests/cypress/utils/RequestBodyUtils.jsnew file mode 100644index 0000000000..59c7ac164c--- /dev/null+++ b/cypress-tests/cypress/utils/RequestBodyUtils.js@@ -0,0 +1,27 @@+export const setClientSecret = (requestBody, clientSecret) => {+ requestBody["client_secret"] = clientSecret;+};+export const setCardNo = (requestBody, cardNo) => {+ // pass confirm body here to set CardNo+ requestBody["payment_method_data"]["card"]["card_number"] = cardNo;+};++export const setApiKey = (requestBody, apiKey) => {+ requestBody["connector_account_details"]["api_key"] = apiKey;+};++export const generateRandomString = (prefix = "cypress_merchant_GHAction_") => {+ const uuidPart = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";++ const randomString = uuidPart.replace(/[xy]/g, function (c) {+ const r = (Math.random() * 16) | 0;+ const v = c === "x" ? r : (r & 0x3) | 0x8;+ return v.toString(16);+ });++ return prefix + randomString;+};++export const setMerchantId = (merchantCreateBody, merchantId) => {+ merchantCreateBody["merchant_id"] = merchantId;+};diff --git a/cypress-tests/cypress/utils/State.js b/cypress-tests/cypress/utils/State.jsnew file mode 100644index 0000000000..342c220a41--- /dev/null+++ b/cypress-tests/cypress/utils/State.js@@ -0,0 +1,19 @@+class State {+ data = {};+ constructor(data) {+ this.data = data;+ this.data["connectorId"] = Cypress.env("CONNECTOR");+ this.data["baseUrl"] = Cypress.env("BASEURL");+ this.data["adminApiKey"] = Cypress.env("ADMINAPIKEY");+ }++ set(key, val) {+ this.data[key] = val;+ }++ get(key) {+ return this.data[key];+ }+}++export default State;diff --git a/cypress-tests/package.json b/cypress-tests/package.jsonnew file mode 100644index 0000000000..62eab5e380--- /dev/null+++ b/cypress-tests/package.json@@ -0,0 +1,13 @@+{+ "name": "test",+ "version": "1.0.0",+ "description": "",+ "main": "index.js",+ "scripts": {+ "cypress":"npx cypress open",+ "cypress-e2e": "npx cypress run --e2e",+ "cypress:ci":"npx cypress run --headless"+ },+ "author": "",+ "license": "ISC"+}diff --git a/cypress-tests/readme.md b/cypress-tests/readme.mdnew file mode 100644index 0000000000..8e08d6c01d--- /dev/null+++ b/cypress-tests/readme.md@@ -0,0 +1,45 @@+# Cypress Tests++## Overview+This Tool is a solution designed to automate testing for the [Hyperswitch](https://github.com/juspay/hyperswitch/) using Cypress, an open-source tool capable of conducting API call tests and UI tests. This README provides guidance on installing Cypress and its dependencies.++## Installation++### Prerequisites+Before installing Cypress, ensure you have the following prerequisites installed:+- npm (Node Package Manager)+- Node.js (18.x and above)++### Run Test Cases on your local+To run test cases, follow these steps:++1. Install Cypress+ ```shell+ npm install cypress --save-dev+ ```+3. Clone the repository and switch to the project directory:++ ```shell+ git clone https://github.com/juspay/hyperswitch+ cd cypress-tests+ ```+4. Set environment variables for cypress+ ```shell+ export CYPRESS_CONNECTOR="connector_id"+ export CYPRESS_BASEURL="base_url"+ export DEBUG=cypress:cli+ export CYPRESS_ADMINAPIKEY="admin_api_key"+ ```++5. Run Cypress test cases+ To run the tests in a browser in interactive mode run the following command+ ```+ npm run cypress+ ```+ To run the tests in headless mode run the following command+ ```+ npm run cypress:ci+ ```++## Additional Resources+For more information on using Cypress and writing effective tests, refer to the official Cypress documentation: [Cypress Documentation](https://docs.cypress.io/)diff --git a/cypress-tests/yarn.lock b/cypress-tests/yarn.locknew file mode 100644index 0000000000..fb57ccd13a--- /dev/null+++ b/cypress-tests/yarn.lock@@ -0,0 +1,4 @@+# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.+# yarn lockfile v1++