Skip to content

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

ci(cypress): fix tsys transit connector tests and superposition api (#14290)

likhinbopanna5b0d041ff6cd
diff --git a/cypress-tests/cypress.config.js b/cypress-tests/cypress.config.js
index b2fad47685..fa92283162 100644
--- a/cypress-tests/cypress.config.js
+++ b/cypress-tests/cypress.config.js
@@ -21,6 +21,7 @@ const forwardedEnv = [
"SUPERPOSITION_BASE_URL",
"SUPERPOSITION_SECRET",
"SUPERPOSITION_API_KEY",
+ "SUPERPOSITION_AUTH_TOKEN",
"SUPERPOSITION_ORG_ID",
"SUPERPOSITION_WORKSPACE_ID",
].reduce((acc, name) => {
diff --git a/cypress-tests/cypress/e2e/configs/Payment/TsysTransit.js b/cypress-tests/cypress/e2e/configs/Payment/TsysTransit.js
index 2fe73009ef..c29fcd91ad 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/TsysTransit.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/TsysTransit.js
@@ -134,7 +134,7 @@ export const connectorDetails = {
Configs: {
DELAY: {
STATUS: true,
- TIMEOUT: 5000,
+ TIMEOUT: 10000,
},
},
Request: {
@@ -209,7 +209,7 @@ export const connectorDetails = {
Configs: {
DELAY: {
STATUS: true,
- TIMEOUT: 5000,
+ TIMEOUT: 10000,
},
TRIGGER_SKIP: true,
},
@@ -296,8 +296,8 @@ export const connectorDetails = {
body: {
status: "succeeded",
amount: 6000,
- amount_capturable: 6000,
- amount_received: null,
+ amount_capturable: 0,
+ amount_received: 6000,
},
},
},
@@ -309,10 +309,10 @@ export const connectorDetails = {
Response: {
status: 200,
body: {
- status: "succeeded",
+ status: "partially_captured",
amount: 6000,
- amount_capturable: 6000,
- amount_received: null,
+ amount_capturable: 0,
+ amount_received: 2000,
},
},
},
@@ -489,7 +489,7 @@ export const connectorDetails = {
Configs: {
DELAY: {
STATUS: true,
- TIMEOUT: 5000,
+ TIMEOUT: 10000,
},
TRIGGER_SKIP: true,
},
@@ -515,7 +515,7 @@ export const connectorDetails = {
Configs: {
DELAY: {
STATUS: true,
- TIMEOUT: 5000,
+ TIMEOUT: 10000,
},
},
Request: {
@@ -663,7 +663,7 @@ export const connectorDetails = {
Configs: {
DELAY: {
STATUS: true,
- TIMEOUT: 5000,
+ TIMEOUT: 10000,
},
TRIGGER_SKIP: true,
},
@@ -734,7 +734,7 @@ export const connectorDetails = {
Configs: {
DELAY: {
STATUS: true,
- TIMEOUT: 5000,
+ TIMEOUT: 10000,
},
},
Request: {
@@ -807,7 +807,7 @@ export const connectorDetails = {
Configs: {
DELAY: {
STATUS: true,
- TIMEOUT: 5000,
+ TIMEOUT: 10000,
},
TRIGGER_SKIP: true,
},
@@ -861,7 +861,7 @@ export const connectorDetails = {
Configs: {
DELAY: {
STATUS: true,
- TIMEOUT: 5000,
+ TIMEOUT: 10000,
},
TRIGGER_SKIP: true,
},
diff --git a/cypress-tests/cypress/e2e/spec/Payment/54-BlockImplicitCustomerCreation.cy.js b/cypress-tests/cypress/e2e/spec/Payment/54-BlockImplicitCustomerCreation.cy.js
index 328a068d6e..64af98efa8 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/54-BlockImplicitCustomerCreation.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/54-BlockImplicitCustomerCreation.cy.js
@@ -17,7 +17,8 @@ describe("Block Implicit Customer Creation", () => {
);
if (
!globalState.get("superpositionBaseUrl") ||
- !globalState.get("superpositionSecret")
+ !globalState.get("superpositionSecret") ||
+ !globalState.get("superpositionAuthToken")
) {
cy.task(
"cli_log",
@@ -37,7 +38,7 @@ describe("Block Implicit Customer Creation", () => {
after("cleanup superposition config + flush global state", () => {
cy.setSuperpositionConfig(
globalState,
- "block_implicit_customer_creation",
+ "payments.block_implicit_customer_creation",
false,
{
organization_id: globalState.get("organizationId"),
@@ -96,7 +97,7 @@ describe("Block Implicit Customer Creation", () => {
() => {
cy.setSuperpositionConfig(
globalState,
- "block_implicit_customer_creation",
+ "payments.block_implicit_customer_creation",
true,
{
organization_id: globalState.get("organizationId"),
@@ -110,7 +111,11 @@ describe("Block Implicit Customer Creation", () => {
cy.task("cli_log", "Skipping step: Wait for config propagation");
return;
}
- cy.waitForConfigPropagation(globalState, 404, "block");
+ cy.waitForConfigPropagation(
+ globalState,
+ 404,
+ "payments.block_implicit_customer_creation"
+ );
});
cy.step(
@@ -120,7 +125,7 @@ describe("Block Implicit Customer Creation", () => {
cy.task("cli_log", "Skipping step: Create payment");
return;
}
- globalState.set("customerId", `non_existent_customer_${Date.now()}`);
+ globalState.set("customerId", `non_existent_cust_${Date.now()}`);
const data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["BlockImplicitCustomerCreationBlocked"];
@@ -157,7 +162,7 @@ describe("Block Implicit Customer Creation", () => {
() => {
cy.setSuperpositionConfig(
globalState,
- "block_implicit_customer_creation",
+ "payments.block_implicit_customer_creation",
false,
{
organization_id: globalState.get("organizationId"),
@@ -171,7 +176,11 @@ describe("Block Implicit Customer Creation", () => {
cy.task("cli_log", "Skipping step: Wait for config propagation");
return;
}
- cy.waitForConfigPropagation(globalState, 200, "allow");
+ cy.waitForConfigPropagation(
+ globalState,
+ 200,
+ "payments.block_implicit_customer_creation"
+ );
});
cy.step(
diff --git a/cypress-tests/cypress/e2e/spec/Payment/54-ConnectorAgnosticMandates.cy.js b/cypress-tests/cypress/e2e/spec/Payment/54-ConnectorAgnosticMandates.cy.js
index 6ed4fc30a2..957fb38530 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/54-ConnectorAgnosticMandates.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/54-ConnectorAgnosticMandates.cy.js
@@ -22,8 +22,8 @@ const superpositionContext = () => ({
// `should_call_pm_modular_service`; when false the SDK skips vaulting. It
// defaults to true, so this spec has to turn it off.
const superpositionOverrides = {
- should_call_pm_modular_service: true,
- should_perform_sdk_vaulting: false,
+ "system.should_call_pm_modular_service": true,
+ "vaulting.should_perform_sdk_vaulting": false,
};
// The modular payment method service is a separate deployment addressed by
diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js
index c09a7b440e..4678c210c2 100644
--- a/cypress-tests/cypress/support/commands.js
+++ b/cypress-tests/cypress/support/commands.js
@@ -12218,14 +12218,19 @@ Cypress.Commands.add(
(globalState, overrides, context) => {
const superpositionBaseUrl = globalState.get("superpositionBaseUrl");
const superpositionSecret = globalState.get("superpositionSecret");
+ const superpositionAuthToken = globalState.get("superpositionAuthToken");
const orgId = globalState.get("superpositionOrgId") || "hyperswitch";
const workspaceId =
globalState.get("superpositionWorkspaceId") || "hyperswitch";
- if (!superpositionBaseUrl || !superpositionSecret) {
+ if (
+ !superpositionBaseUrl ||
+ !superpositionSecret ||
+ !superpositionAuthToken
+ ) {
cy.task(
"cli_log",
- "Superposition credentials not set (SUPERPOSITION_BASE_URL, SUPERPOSITION_SECRET) — skipping config set"
+ "Superposition credentials not set (SUPERPOSITION_BASE_URL, SUPERPOSITION_SECRET, SUPERPOSITION_AUTH_TOKEN) — skipping config set"
);
return;
}
@@ -12238,6 +12243,7 @@ Cypress.Commands.add(
"x-org-id": orgId,
"x-workspace": workspaceId,
"X-Superposition-Secret": superpositionSecret,
+ Authorization: `Bearer ${superpositionAuthToken}`,
"Content-Type": "application/json",
},
body: {
@@ -12280,11 +12286,16 @@ Cypress.Commands.add(
Cypress.Commands.add("deleteSuperpositionContext", (globalState, context) => {
const superpositionBaseUrl = globalState.get("superpositionBaseUrl");
const superpositionSecret = globalState.get("superpositionSecret");
+ const superpositionAuthToken = globalState.get("superpositionAuthToken");
const orgId = globalState.get("superpositionOrgId") || "hyperswitch";
const workspaceId =
globalState.get("superpositionWorkspaceId") || "hyperswitch";
- if (!superpositionBaseUrl || !superpositionSecret) {
+ if (
+ !superpositionBaseUrl ||
+ !superpositionSecret ||
+ !superpositionAuthToken
+ ) {
cy.task(
"cli_log",
"Superposition credentials not set — skipping context delete"
@@ -12300,6 +12311,7 @@ Cypress.Commands.add("deleteSuperpositionContext", (globalState, context) => {
"x-org-id": orgId,
"x-workspace": workspaceId,
"X-Superposition-Secret": superpositionSecret,
+ Authorization: `Bearer ${superpositionAuthToken}`,
"Content-Type": "application/json",
},
body: { context },
@@ -12365,6 +12377,10 @@ Cypress.Commands.add(
`Superposition config did not propagate within ${(maxAttempts * intervalMs) / 1000}s`
);
}
+ const suffix = `_${Date.now()}_${attempt}`;
+ const idPrefix = `config_poll_${label}`
+ .replace(/[^a-zA-Z0-9_-]/g, "_")
+ .slice(0, 64 - suffix.length);
cy.request({
method: "POST",
url: `${globalState.get("baseUrl")}/payments`,
@@ -12375,7 +12391,7 @@ Cypress.Commands.add(
body: {
currency: "USD",
amount: 100,
- customer_id: `config_poll_${label}_${Date.now()}_${attempt}`,
+ customer_id: `${idPrefix}${suffix}`,
authentication_type: "no_three_ds",
capture_method: "automatic",
profile_id: globalState.get("profileId"),
diff --git a/cypress-tests/cypress/utils/State.js b/cypress-tests/cypress/utils/State.js
index 53854d3048..cf12b29f73 100644
--- a/cypress-tests/cypress/utils/State.js
+++ b/cypress-tests/cypress/utils/State.js
@@ -45,6 +45,10 @@ class State {
"SUPERPOSITION_API_KEY",
"superpositionApiKey"
);
+ this.data["superpositionAuthToken"] = this.getEnvOrState(
+ "SUPERPOSITION_AUTH_TOKEN",
+ "superpositionAuthToken"
+ );
this.data["superpositionOrgId"] = this.getEnvOrState(
"SUPERPOSITION_ORG_ID",
"superpositionOrgId"