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

fix(cypress): fixed autoretries, setupretries and truelayer bankredirect (#14669)

Vasanth5da12054874a
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Truelayer.js b/cypress-tests/cypress/e2e/configs/Payment/Truelayer.js
index f461d2f6e1..9445688ea7 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Truelayer.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Truelayer.js
@@ -1,4 +1,5 @@
import { getCustomExchange } from "./Modifiers";
+import { connectorDetails as commonDetails } from "./Commons";
const billingAddressGB = {
address: {
@@ -16,8 +17,55 @@ const billingAddressGB = {
},
};
+// Truelayer is served exclusively by the Unified Connector Service. For
+// unsupported payment methods the UCS server returns its own message
+// ("This feature is not implemented: ..." with the title-cased connector
+// name) instead of the router-generated message used by Modifiers' default
+// exchange. The commons defaults are reused for the unsupported methods, but
+// with the not-implemented (IR_00) error message rewritten to the UCS
+// variant - the connector-specific handling stays in this file rather than
+// being hardcoded in the shared Modifiers.
+const UCS_NOT_IMPLEMENTED_MESSAGE =
+ "This feature is not implemented: Selected payment method through Truelayer is not implemented";
+
+const withUcsNotImplementedMessage = (node) => {
+ if (!node || typeof node !== "object" || Array.isArray(node)) {
+ return node;
+ }
+
+ // Exchange object: only the Response may need the message rewrite; Request,
+ // Configs and any nested exchanges are left untouched.
+ if ("Response" in node) {
+ const error = node.Response?.body?.error;
+
+ return error?.code === "IR_00"
+ ? {
+ ...node,
+ Response: {
+ ...node.Response,
+ body: {
+ error: { ...error, message: UCS_NOT_IMPLEMENTED_MESSAGE },
+ },
+ },
+ }
+ : node;
+ }
+
+ // Payment-method category map: recurse into each entry.
+ return Object.fromEntries(
+ Object.entries(node).map(([key, value]) => [
+ key,
+ withUcsNotImplementedMessage(value),
+ ])
+ );
+};
+
+const ucsCommonDetails = withUcsNotImplementedMessage(commonDetails);
+
export const connectorDetails = {
+ ...ucsCommonDetails,
bank_redirect_pm: {
+ ...ucsCommonDetails.bank_redirect_pm,
// Required supported-method config for the Truelayer confirm flow. The CI
// selection runs only this bank redirect flow for Truelayer.
Truelayer: getCustomExchange({
diff --git a/cypress-tests/cypress/e2e/configs/Payout/Modifiers.js b/cypress-tests/cypress/e2e/configs/Payout/Modifiers.js
index ab24a6c26f..358090290b 100644
--- a/cypress-tests/cypress/e2e/configs/Payout/Modifiers.js
+++ b/cypress-tests/cypress/e2e/configs/Payout/Modifiers.js
@@ -46,6 +46,25 @@ function normalise(input) {
with `getCustomExchange`, if 501 response is expected, there is no need to pass Response as it considers default values.
*/
+// Connectors served exclusively by the Unified Connector Service surface the
+// UCS server's message for unsupported payment methods: the UCS server
+// prefixes the reason with "This feature is not implemented: " and uses the
+// title-cased connector name (the router forwards it verbatim and appends the
+// trailing " is not implemented"). Legacy-path connectors keep the
+// router-generated message without the prefix, so only UCS-only connectors
+// are listed here.
+const UCS_SERVER_MESSAGE_CONNECTORS = new Set(["truelayer"]);
+
+const rawConnectorId = String(
+ globalState.get("connectorId") || ""
+).toLowerCase();
+
+const notImplementedMessage = UCS_SERVER_MESSAGE_CONNECTORS.has(rawConnectorId)
+ ? `This feature is not implemented: Selected payment method through ${
+ rawConnectorId.charAt(0).toUpperCase() + rawConnectorId.slice(1)
+ } is not implemented`
+ : `Selected payment method through ${connectorName} is not implemented`;
+
// Const to get default PaymentExchange object
const getDefaultExchange = () => ({
Request: {},
@@ -54,7 +73,7 @@ const getDefaultExchange = () => ({
body: {
error: {
type: "invalid_request",
- message: `Selected payment method through ${connectorName} is not implemented`,
+ message: notImplementedMessage,
code: "IR_00",
},
},
diff --git a/cypress-tests/cypress/e2e/configs/Payout/Trustly.js b/cypress-tests/cypress/e2e/configs/Payout/Trustly.js
index 7ca8a31def..79c360fecf 100644
--- a/cypress-tests/cypress/e2e/configs/Payout/Trustly.js
+++ b/cypress-tests/cypress/e2e/configs/Payout/Trustly.js
@@ -25,6 +25,12 @@ const bank_payout_method_data = {
},
};
+// Malformed (non-numeric) Swedish account number. Verified behavior against
+// integ: the UCS intake transformer cannot map an unmappable account string
+// to a recipient, so it demands raw payout_connector_metadata and the create
+// is rejected up front with a 400. Well-formed numbers map inline and settle
+// as "success" in the sandbox (e.g. "99999999" completes), so the intake
+// rejection is the only observable invalid-account rejection path.
const invalid_bank_payout_method_data = {
bank: {
country_code: "SE",
@@ -103,11 +109,18 @@ export const connectorDetails = {
billing: billing,
},
Response: {
- status: 200,
+ status: 400,
body: {
- status: "failed",
- error_code: "624",
- error_message: "ERROR_INVALID_BANK_ACCOUNT_NUMBER",
+ error: {
+ type: "invalid_request",
+ // Intake-phase rejection of the unmappable account number.
+ // The message is asserted as well; defaultErrorHandler
+ // compares strings whitespace-tolerant because trailing
+ // whitespace in this UCS-generated text drifts.
+ message:
+ "Missing required param: Missing required field: payout_connector_metadata. Trustly Payout Transfer - missing required field",
+ code: "IR_04",
+ },
},
},
},
diff --git a/cypress-tests/cypress/e2e/configs/Payout/Utils.js b/cypress-tests/cypress/e2e/configs/Payout/Utils.js
index f6e9958d06..31b67acf96 100644
--- a/cypress-tests/cypress/e2e/configs/Payout/Utils.js
+++ b/cypress-tests/cypress/e2e/configs/Payout/Utils.js
@@ -103,7 +103,11 @@ export const CONNECTOR_LISTS = {
// gotyme_sanlam only supports bank transfer payouts (payshap /
// payshap_proxy) and has no card payout method, so it is skipped for
// the card payout tests in 00003-CardTest.cy.js
- CARD_TEST: ["gotyme_sanlam", "trustly"],
+ // truelayer only supports open-banking bank transfer payouts; card
+ // payout eligibility is not implemented ("payout_eligibility flow for
+ // truelayer" is unimplemented over UCS), so it is skipped for the card
+ // payout tests in 00003-CardTest.cy.js
+ CARD_TEST: ["gotyme_sanlam", "trustly", "truelayer"],
},
INCLUDE: {
ENTITY_TYPE: ["wise"],
diff --git a/cypress-tests/cypress/e2e/spec/Payment/18-BankRedirect.cy.js b/cypress-tests/cypress/e2e/spec/Payment/18-BankRedirect.cy.js
index 4e4ad43c36..efe2044167 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/18-BankRedirect.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/18-BankRedirect.cy.js
@@ -505,9 +505,13 @@ describe("Bank Redirect tests", () => {
let shouldContinue = true;
cy.step("Setup UCS rollout config", () => {
+ // Authorize covers the confirm call; PSync covers the force-sync
+ // retrieve below - without its rollout key the router falls back to
+ // the legacy interface, which truelayer (UCS-only) does not implement
+ // ("get_url method is not implemented").
cy.createRolloutConfig(
globalState,
- "bank_redirect_open_banking_Authorize"
+ "bank_redirect_open_banking_Authorize,bank_redirect_open_banking_PSync"
);
});
diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js
index c868d97dda..abb2540676 100644
--- a/cypress-tests/cypress/support/commands.js
+++ b/cypress-tests/cypress/support/commands.js
@@ -276,7 +276,9 @@ function createIndividualRolloutConfig(
};
return makeRequest("POST", url, requestBody, "created").then((response) => {
- if (response.status === 200) {
+ // makeRequest resolves { success: true } on HTTP 200; a raw response
+ // object (with .status/.body) is only returned for non-200 outcomes.
+ if (response.success) {
return cy.wrap({ success: true, flow: methodFlow });
}
@@ -294,7 +296,9 @@ function createIndividualRolloutConfig(
const updateConfig = () => {
return makeRequest("POST", `${url}${key}`, { value }, "updated").then(
(updateResponse) => {
- if (updateResponse.status === 200) {
+ // makeRequest resolves { success: true } on HTTP 200; a raw response
+ // object (with .status/.body) is only returned for non-200 outcomes.
+ if (updateResponse.success) {
return cy.wrap({ success: true, flow: methodFlow });
}
@@ -395,14 +399,24 @@ function createUcsConfigs(globalState, flow, type, configValueOverride = null) {
const connector = getConnectorIdForRedirect(globalState);
const methodFlowInput = flow || globalState.get("methodFlow");
- if ((!httpUrl || !httpsUrl) && !configValueOverride) {
- throw new Error(
- `Missing proxyHttp or proxyHttps in globalState. globalState.proxyHttp=${httpUrl}, globalState.proxyHttps=${httpsUrl}, Cypress.env("PROXY_HTTP")=${Cypress.env("PROXY_HTTP")}, Cypress.env("PROXY_HTTPS")=${Cypress.env("PROXY_HTTPS")}`
+ // Proxy URLs are optional: since #14222 the router sources UCS/comparison
+ // endpoints from its own deployment config and ignores http_url/https_url
+ // in the rollout config value. Warn and continue when they are absent -
+ // hard failing here breaks otherwise valid runs (e.g. distributed UCS and
+ // sharded CI would never run a season without PROXY_HTTP/PROXY_HTTPS set).
+ if (!httpUrl || !httpsUrl) {
+ cy.task(
+ "cli_log",
+ "INFO: proxyHttp/proxyHttps not set - creating rollout config without http_url/https_url; the router will use its deployment-configured UCS endpoints"
);
}
if (!connector || !methodFlowInput) {
- throw new Error("Missing connectorId or methodFlow in globalState");
+ cy.task(
+ "cli_log",
+ `UCS ${type} config creation skipped - connectorId or methodFlow not set in globalState`
+ );
+ return;
}
if (!globalState) {
@@ -1267,6 +1281,27 @@ Cypress.Commands.add(
updateBusinessProfileBody.merchant_category_code
);
}
+ // Auto-retry specs rely on these flags being persisted on the
+ // profile; assert them so a stale/rejected update fails at the
+ // setup step instead of surfacing as a retry that never happened.
+ if (
+ typeof updateBusinessProfileBody.is_auto_retries_enabled !==
+ "undefined"
+ ) {
+ expect(
+ response.body.is_auto_retries_enabled,
+ "is_auto_retries_enabled"
+ ).to.equal(updateBusinessProfileBody.is_auto_retries_enabled);
+ }
+ if (
+ typeof updateBusinessProfileBody.max_auto_retries_enabled !==
+ "undefined"
+ ) {
+ expect(
+ response.body.max_auto_retries_enabled,
+ "max_auto_retries_enabled"
+ ).to.equal(updateBusinessProfileBody.max_auto_retries_enabled);
+ }
} else {
throw new Error(
`Business Profile Update Failed: ${response.body.error?.message || response.status}`
diff --git a/cypress-tests/cypress/support/redirectionHandler.js b/cypress-tests/cypress/support/redirectionHandler.js
index 12b9eddb16..cf231d2191 100644
--- a/cypress-tests/cypress/support/redirectionHandler.js
+++ b/cypress-tests/cypress/support/redirectionHandler.js
@@ -1819,11 +1819,25 @@ function bankRedirectRedirection(
});
};
- clickAction(/go to bank/i, "Opening TrueLayer bank page");
- clickAction(
- /open mock uk payments\s*-\s*redirect flow on this device/i,
- "Opening TrueLayer mock UK payments redirect flow"
- );
+ // Some TrueLayer sandbox consent pages show an intermediate "Go to bank"
+ // button before the mock provider page; others render the mock provider
+ // entry point directly. Click it only when present so the flow does not
+ // hang waiting for a button that may not exist.
+ clickActionIfPresent(/go to bank/i, "Opening TrueLayer bank page");
+
+ // The "Open Mock UK Payments - Redirect Flow on this device" entry point
+ // sits below the fold on the TrueLayer sandbox page and is rendered as a
+ // selectable card rather than a button/anchor, so the action-selector
+ // lookups above cannot find it. Scroll the page down first, then click the
+ // exact label - anchoring on "this device" also avoids matching a sibling
+ // QR-code/other-device option when both are rendered.
+ cy.scrollTo("bottom", { ensureScrollable: false });
+ cy.contains(
+ /open mock uk payments[\s\S]*redirect flow[\s\S]*on this device/i,
+ { timeout: CONSTANTS.TIMEOUT }
+ )
+ .scrollIntoView()
+ .click({ force: true });
fillTrueLayerMockCredentials();
clickAction(