Skip to content

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

feat(cypress): Cypress test for ucs (#8967)

Amitsingh Tanwar7ad5cd5531ee
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Authorizedotnet.js b/cypress-tests/cypress/e2e/configs/Payment/Authorizedotnet.js
index d4ff9bf1cb..e81f4b6eff 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Authorizedotnet.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Authorizedotnet.js
@@ -11,14 +11,17 @@ const successfulNo3DSCardDetails = {
card_exp_year: "2029",
card_holder_name: "John Doe",
card_cvc: "123",
+ card_network: "Visa",
};
const successfulThreeDSTestCardDetails = {
- card_number: "4000000000000002",
+ // Visa test card (approved in Authorize.Net sandbox)
+ card_number: "4111111111111111",
card_exp_month: "12",
card_exp_year: "2029",
card_holder_name: "John Doe",
card_cvc: "123",
+ card_network: "Visa",
};
const failedNo3DSCardDetails = {
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
index fcd4f6e4e8..0f65dd331d 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
@@ -409,6 +409,8 @@ export const CONNECTOR_LISTS = {
// "stripe",
],
DDC_RACE_CONDITION: ["worldpay"],
+ // ucs connectors
+ UCS_CONNECTORS: ["authorizedotnet"],
// Add more inclusion lists
},
};
diff --git a/cypress-tests/cypress/e2e/spec/UnifiedConnectorService/0001-UCSComprehensiveTest.cy.js b/cypress-tests/cypress/e2e/spec/UnifiedConnectorService/0001-UCSComprehensiveTest.cy.js
new file mode 100644
index 0000000000..f02259960a
--- /dev/null
+++ b/cypress-tests/cypress/e2e/spec/UnifiedConnectorService/0001-UCSComprehensiveTest.cy.js
@@ -0,0 +1,536 @@
+import * as fixtures from "../../../fixtures/imports";
+import State from "../../../utils/State";
+import getConnectorDetails, * as utils from "../../configs/Payment/Utils";
+import { cardCreditEnabled } from "../../configs/PaymentMethodList/Commons";
+
+let globalState;
+
+describe("UCS Comprehensive Test", () => {
+ before("Initialize and Setup", function () {
+ cy.task("getGlobalState").then((state) => {
+ globalState = new State(state);
+ const connectorId = Cypress.env("CYPRESS_CONNECTOR");
+ if (
+ utils.shouldIncludeConnector(
+ connectorId,
+ utils.CONNECTOR_LISTS.INCLUDE.UCS_CONNECTORS
+ )
+ ) {
+ cy.log(`Skipping UCS tests - connector not supported: ${connectorId}`);
+ this.skip();
+ }
+ cy.log(`Running UCS tests for: ${connectorId}`);
+ });
+ });
+
+ after("UCS Cleanup", () => {
+ cy.task("setGlobalState", globalState.data);
+ });
+
+ context("0001-UCS Setup", () => {
+ it("merchant-create-call-test", () => {
+ cy.merchantCreateCallTest(fixtures.merchantCreateBody, globalState);
+ });
+
+ it("api-key-create-call-test", () => {
+ cy.apiKeyCreateTest(fixtures.apiKeyCreateBody, globalState);
+ });
+
+ it("connector-create-call-test", () => {
+ cy.createNamedConnectorCallTest(
+ "payment_processor",
+ fixtures.createConnectorBody,
+ cardCreditEnabled,
+ globalState,
+ "authorizedotnet",
+ "authorizedotnet_default"
+ );
+ });
+
+ it("customer-create-call-test", () => {
+ cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
+ });
+
+ it("setup-ucs-configs", () => {
+ const connectorId = globalState.get("connectorId");
+ cy.setupUCSConfigs(globalState, connectorId);
+ });
+ });
+
+ context("00004-NoThreeDSAutoCapture", () => {
+ it("create-payment-call-test", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentIntent"];
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+ });
+
+ it("payment_methods-call-test", () => {
+ cy.paymentMethodsCallTest(globalState);
+ });
+
+ it("Confirm No 3DS", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["No3DSAutoCapture"];
+ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);
+ });
+
+ it("retrieve-payment-call-test", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["No3DSAutoCapture"];
+ cy.retrievePaymentCallTest(globalState, data);
+ });
+
+ it("create+confirm-payment-call-test", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["No3DSAutoCapture"];
+ cy.createConfirmPaymentTest(
+ fixtures.createConfirmPaymentBody,
+ data,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+ });
+
+ it("retrieve-payment-call-test-2", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["No3DSAutoCapture"];
+ cy.retrievePaymentCallTest(globalState, data);
+ });
+ });
+
+ context("00005-ThreeDSAutoCapture", () => {
+ it("create-payment-call-test", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentIntent"];
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "three_ds",
+ "automatic",
+ globalState
+ );
+ });
+
+ it("payment_methods-call-test", () => {
+ cy.paymentMethodsCallTest(globalState);
+ });
+
+ it("Confirm 3DS", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["3DSAutoCapture"];
+ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);
+ });
+
+ it("Handle redirection", () => {
+ const expected_redirection = fixtures.confirmBody["return_url"];
+ cy.handleRedirection(globalState, expected_redirection);
+ });
+ });
+
+ context("00006-NoThreeDSManualCapture", () => {
+ it("create-payment-call-test", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentIntent"];
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "no_three_ds",
+ "manual",
+ globalState
+ );
+ });
+
+ it("payment_methods-call-test", () => {
+ cy.paymentMethodsCallTest(globalState);
+ });
+
+ it("Confirm No 3DS", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["No3DSManualCapture"];
+ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);
+ });
+
+ it("capture-call-test", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["Capture"];
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
+ });
+
+ it("retrieve-payment-call-test", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["No3DSManualCapture"];
+ cy.retrievePaymentCallTest(globalState, data);
+ });
+ });
+
+ context("00007-VoidPayment", () => {
+ it("create-payment-call-test", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentIntent"];
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "no_three_ds",
+ "manual",
+ globalState
+ );
+ });
+
+ it("payment_methods-call-test", () => {
+ cy.paymentMethodsCallTest(globalState);
+ });
+
+ it("Confirm No 3DS", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["No3DSManualCapture"];
+ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);
+ });
+
+ it("void-call-test", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["Void"];
+ cy.voidCallTest(fixtures.voidBody, data, globalState);
+ });
+ });
+
+ context("00008-SyncPayment", () => {
+ it("create-payment-call-test", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentIntent"];
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+ });
+
+ it("payment_methods-call-test", () => {
+ cy.paymentMethodsCallTest(globalState);
+ });
+
+ it("Confirm No 3DS", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["No3DSAutoCapture"];
+ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);
+ });
+
+ it("sync-payment-call-test", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["SyncPayment"];
+ cy.syncCallTest(data, globalState);
+ });
+ });
+
+ context("00009-RefundPayment", () => {
+ it("create-payment-call-test", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentIntent"];
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+ });
+
+ it("payment_methods-call-test", () => {
+ cy.paymentMethodsCallTest(globalState);
+ });
+
+ it("Confirm No 3DS", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["No3DSAutoCapture"];
+ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);
+ });
+
+ it("refund-call-test", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["Refund"];
+ cy.refundCallTest(fixtures.refundBody, data, globalState);
+ });
+ });
+
+ context("00010-SyncRefund", () => {
+ it("create-payment-call-test", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentIntent"];
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+ });
+
+ it("payment_methods-call-test", () => {
+ cy.paymentMethodsCallTest(globalState);
+ });
+
+ it("Confirm No 3DS", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["No3DSAutoCapture"];
+ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);
+ });
+
+ it("refund-call-test", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["Refund"];
+ cy.refundCallTest(fixtures.refundBody, data, globalState);
+ });
+
+ it("sync-refund-call-test", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["SyncRefund"];
+ cy.syncRefundCallTest(data, globalState);
+ });
+ });
+
+ context("00011-CreateSingleuseMandate", () => {
+ it("Confirm No 3DS CIT", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["MandateSingleUseNo3DSAutoCapture"];
+ cy.citForMandatesCallTest(
+ fixtures.citConfirmBody,
+ data,
+ 6000,
+ true,
+ "automatic",
+ "new_mandate",
+ globalState
+ );
+ });
+
+ it("Confirm No 3DS MIT", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["MITAutoCapture"];
+ cy.mitForMandatesCallTest(
+ fixtures.mitConfirmBody,
+ data,
+ 6000,
+ true,
+ "automatic",
+ globalState
+ );
+ });
+ });
+
+ context("00012-CreateMultiuseMandate", () => {
+ it("Confirm No 3DS CIT", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["MandateMultiUseNo3DSAutoCapture"];
+ cy.citForMandatesCallTest(
+ fixtures.citConfirmBody,
+ data,
+ 6000,
+ true,
+ "automatic",
+ "new_mandate",
+ globalState
+ );
+ });
+
+ it("Confirm No 3DS MIT 1", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["MITAutoCapture"];
+ cy.mitForMandatesCallTest(
+ fixtures.mitConfirmBody,
+ data,
+ 6000,
+ true,
+ "automatic",
+ globalState
+ );
+ });
+
+ it("Confirm No 3DS MIT 2", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["MITAutoCapture"];
+ cy.mitForMandatesCallTest(
+ fixtures.mitConfirmBody,
+ data,
+ 6000,
+ true,
+ "automatic",
+ globalState
+ );
+ });
+ });
+
+ context("00013-ListAndRevokeMandate", () => {
+ it("Confirm No 3DS CIT", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["MandateSingleUseNo3DSAutoCapture"];
+ cy.citForMandatesCallTest(
+ fixtures.citConfirmBody,
+ data,
+ 6000,
+ true,
+ "automatic",
+ "new_mandate",
+ globalState
+ );
+ });
+
+ it("list-mandate-call-test", () => {
+ cy.listMandateCallTest(globalState);
+ });
+
+ it("revoke-mandate-call-test", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["MandateRevoke"];
+ cy.revokeMandateCallTest(fixtures.revokeMandateBody, data, globalState);
+ });
+ });
+
+ context("00014-SaveCardFlow", () => {
+ it("create-payment-call-test", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["SaveCardUseNo3DSAutoCapture"];
+ cy.createConfirmPaymentTest(
+ fixtures.saveCardConfirmBody,
+ data,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+ });
+
+ it("list-payment-method-call-test", () => {
+ cy.listCustomerPMCallTest(globalState);
+ });
+
+ it("payment-method-call-test", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["SavedCardConfirm"];
+ cy.createConfirmWithSavedPMTest(
+ fixtures.createConfirmPaymentBody,
+ data,
+ globalState
+ );
+ });
+ });
+
+ context("00015-ZeroAuthMandate", () => {
+ it("customer-create-call-test", () => {
+ cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
+ });
+
+ it("Confirm No 3DS CIT", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["ZeroAuthMandate"];
+ cy.citForMandatesCallTest(
+ fixtures.citConfirmBody,
+ data,
+ 0,
+ true,
+ "automatic",
+ "setup_mandate",
+ globalState
+ );
+ });
+
+ it("Confirm No 3DS MIT", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["MITAutoCapture"];
+ cy.mitUsingPMId(
+ fixtures.pmIdConfirmBody,
+ data,
+ 7000,
+ true,
+ "automatic",
+ globalState
+ );
+ });
+ });
+
+ context("00016-ThreeDSManualCapture", () => {
+ it("create-payment-call-test", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentIntent"];
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "three_ds",
+ "manual",
+ globalState
+ );
+ });
+
+ it("payment_methods-call-test", () => {
+ cy.paymentMethodsCallTest(globalState);
+ });
+
+ it("Confirm 3DS", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["3DSManualCapture"];
+ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);
+ });
+
+ it("Handle redirection", () => {
+ const expected_redirection = fixtures.confirmBody["return_url"];
+ cy.handleRedirection(globalState, expected_redirection);
+ });
+
+ it("capture-call-test", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["Capture"];
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
+ });
+ });
+
+ context("00019-UCS Cleanup", () => {
+ it("cleanup-ucs-configs", () => {
+ const connectorId = globalState.get("connectorId");
+ cy.cleanupUCSConfigs(globalState, connectorId);
+ });
+ });
+});
diff --git a/cypress-tests/cypress/fixtures/merchant-create-body.json b/cypress-tests/cypress/fixtures/merchant-create-body.json
index 67b77f4c89..9919f86f51 100644
--- a/cypress-tests/cypress/fixtures/merchant-create-body.json
+++ b/cypress-tests/cypress/fixtures/merchant-create-body.json
@@ -9,7 +9,7 @@
"secondary_contact_person": "John Test2",
"secondary_email": "[email protected]",
"secondary_phone": "cillum do dolor id",
- "website": "www.example.com",
+ "website": "https://www.example.com",
"about_business": "Online Retail with a wide selection of organic products for North America",
"address": {
"line1": "1467",
@@ -18,10 +18,11 @@
"city": "San Francisco",
"state": "California",
"zip": "94122",
- "country": "US"
+ "country": "US",
+ "first_name": "john",
+ "last_name": "Doe"
}
},
- "return_url": "https://example.com",
"webhook_details": {
"webhook_version": "1.0.1",
"webhook_username": "ekart_retail",
@@ -30,6 +31,7 @@
"payment_succeeded_enabled": true,
"payment_failed_enabled": true
},
+ "return_url": "https://example.com",
"sub_merchants_enabled": false,
"metadata": {
"city": "NY",
diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js
index dcc95c5f43..f340389315 100644
--- a/cypress-tests/cypress/support/commands.js
+++ b/cypress-tests/cypress/support/commands.js
@@ -4075,14 +4075,51 @@ Cypress.Commands.add("setConfigs", (globalState, key, value, requestType) => {
expect(response.body).to.have.property("key").to.equal(key);
expect(response.body).to.have.property("value").to.equal(value);
} else {
- throw new Error(
- `Failed to set configs with status ${response.status} and message ${response.body.error.message}`
- );
+ Cypress.log({
+ name: "setConfigs",
+ message: `Failed for key: ${key} → status ${response.status}, message: ${response.body?.error?.message}`,
+ });
}
});
});
});
+Cypress.Commands.add("setupConfigs", (globalState, key, value) => {
+ cy.setConfigs(globalState, key, value, "DELETE");
+ cy.setConfigs(globalState, key, value, "CREATE");
+});
+
+// UCS Configuration Commands
+Cypress.Commands.add("setupUCSConfigs", (globalState, connector) => {
+ cy.setupConfigs(globalState, "ucs_enabled", "true");
+
+ const merchantId = globalState.get("merchantId");
+ const rolloutConfigs = [
+ `ucs_rollout_config_${merchantId}_${connector}_card_Authorize`,
+ `ucs_rollout_config_${merchantId}_${connector}_card_SetupMandate`,
+ `ucs_rollout_config_${merchantId}_${connector}_card_PSync`,
+ ];
+
+ rolloutConfigs.forEach((key) => {
+ cy.setConfigs(globalState, key, "1.0", "CREATE");
+ });
+});
+
+Cypress.Commands.add("cleanupUCSConfigs", (globalState, connector) => {
+ const merchantId = globalState.get("merchantId");
+ const rolloutConfigs = [
+ `ucs_rollout_config_${merchantId}_${connector}_card_Authorize`,
+ `ucs_rollout_config_${merchantId}_${connector}_card_SetupMandate`,
+ `ucs_rollout_config_${merchantId}_${connector}_card_PSync`,
+ ];
+
+ rolloutConfigs.forEach((key) => {
+ cy.setConfigs(globalState, key, "1.0", "DELETE");
+ });
+
+ cy.setConfigs(globalState, "ucs_enabled", "true", "DELETE");
+});
+
// DDC Race Condition Test Commands
Cypress.Commands.add(
"ddcServerSideRaceConditionTest",