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
test(cypress): cover business profile FRM routing precedence (#14365) (#14736)
HS-QUALIBOT5ee11d6cf720
diff --git a/cypress-tests/cypress/e2e/spec/Payment/52-FRM.cy.js b/cypress-tests/cypress/e2e/spec/Payment/52-FRM.cy.jsindex 97e9423a43..574ce512f8 100644--- a/cypress-tests/cypress/e2e/spec/Payment/52-FRM.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/52-FRM.cy.js@@ -97,7 +97,12 @@ describe("FRM - Fraud Risk Management Tests", () => {return;}- cy.retrievePaymentCallTest({ globalState });+ cy.retrievePaymentCallTest({+ globalState,+ data: {+ Response: { body: { frm_message: { frm_name: "signifyd" } } },+ },+ });cy.screenshot("frm-approve-payment-status");});});@@ -106,4 +111,73 @@ describe("FRM - Fraud Risk Management Tests", () => {cy.deleteFrmConnector(globalState);});});++ context("FRM routing - profile precedence", () => {+ it("skip-frm-when-profile-routes-to-connector-without-mca", () => {+ let shouldContinue = true;++ cy.step("Create FRM Connector (Signifyd)", () => {+ cy.createNamedConnectorCallTest(+ "payment_vas",+ fixtures.createConnectorBody,+ {},+ globalState,+ "signifyd",+ "signifyd_frm",+ "profile",+ "frmConnector"+ );+ });++ cy.step("Set business profile FRM routing to riskified (no MCA)", () => {+ cy.setProfileFrmRoutingAlgorithm(+ { type: "single", data: "riskified" },+ globalState+ );+ });++ cy.step("Create and Confirm Payment - FRM is not invoked", () => {+ const data = getConnectorDetails("signifyd")["card_pm"]["FRMApprove"];++ cy.createConfirmPaymentTest(+ fixtures.createConfirmPaymentBody,+ data,+ "no_three_ds",+ "automatic",+ globalState+ );++ if (!utils.should_continue_further(data)) {+ shouldContinue = false;+ }+ });++ cy.step("Retrieve Payment - no FRM message", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: Retrieve Payment");+ return;+ }++ cy.retrievePaymentCallTest({+ globalState,+ data: { Response: { body: { frm_message: null } } },+ });+ });+ });++ afterEach("Delete FRM connector and restore profile FRM routing", () => {+ cy.deleteFrmConnector(globalState);+ // The business profile endpoint's update is a diesel AsChangeset over+ // Option<T> fields with no `treat_none_as_null`, so sending `null` here+ // would be silently skipped rather than clearing the override set above+ // — it must be reset to an explicit, known-good value instead. Reset to+ // signifyd (the merchant account's value) so later specs in this phase,+ // which share this same merchant/profile via globalState, don't inherit+ // a profile-level override pointing at a connector with no MCA.+ cy.setProfileFrmRoutingAlgorithm(+ { type: "single", data: "signifyd" },+ globalState+ );+ });+ });});diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.jsindex 0e04556ddc..c868d97dda 100644--- a/cypress-tests/cypress/support/commands.js+++ b/cypress-tests/cypress/support/commands.js@@ -2382,6 +2382,35 @@ Cypress.Commands.add("setFrmRoutingAlgorithm", (body, globalState) => {});});+Cypress.Commands.add(+ "setProfileFrmRoutingAlgorithm",+ (frmRoutingAlgorithm, globalState) => {+ const merchantId = globalState.get("merchantId");+ const profileId = globalState.get("profileId");++ cy.request({+ method: "POST",+ url: `${globalState.get("baseUrl")}/account/${merchantId}/business_profile/${profileId}`,+ headers: {+ "Content-Type": "application/json",+ Accept: "application/json",+ "api-key": globalState.get("apiKey"),+ },+ body: { frm_routing_algorithm: frmRoutingAlgorithm },+ failOnStatusCode: false,+ }).then((response) => {+ logRequestId(response.headers["x-request-id"]);++ cy.wrap(response).then(() => {+ expect(response.status, "business profile update status").to.equal(200);+ expect(+ response.body.frm_routing_algorithm,+ "profile frm_routing_algorithm"+ ).to.deep.equal(frmRoutingAlgorithm);+ });+ });+ }+);// Overwrites the FRM connector's account details with an invalid api_key, to// force the FRM connector itself to fail (4xx) - used to test// fail_open/fail_closed behavior when pre-FRM is unreachable.@@ -5085,6 +5114,19 @@ Cypress.Commands.add(}}+ if (+ resData.body &&+ Object.prototype.hasOwnProperty.call(resData.body, "frm_message")+ ) {+ if (resData.body.frm_message === null) {+ expect(response.body.frm_message, "frm_message").to.not.exist;+ } else {+ expect(response.body.frm_message?.frm_name, "frm_name").to.equal(+ resData.body.frm_message.frm_name+ );+ }+ }+if (resData.body &&Object.prototype.hasOwnProperty.call(