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): add 3DS routing region UAS config coverage (#13388)
venkatakarthikm-makerb5bbb0d4cffb
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Commons.js b/cypress-tests/cypress/e2e/configs/Payment/Commons.jsindex caf0218c5f..45c62d4253 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Commons.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Commons.js@@ -4501,6 +4501,37 @@ export const connectorDetails = {},}),},+ threeds_routing_region_uas: (() => {+ // Region only selects which UAS deployment the pre/post-auth calls are+ // routed to — it does not change the observable payment outcome. All+ // scenarios below intentionally share one exchange definition, since a+ // valid region, an invalid region (falls back to default), and no+ // config at all (also falls back to default) are all expected to+ // produce the same 3DS challenge.+ const uasRoutingRegionExchange = getCustomExchange({+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulThreeDSTestCardDetails,+ },+ currency: "USD",+ amount: 6500,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_customer_action",+ authentication_type: "three_ds",+ },+ },+ });+ return {+ Region1: uasRoutingRegionExchange,+ Region2: uasRoutingRegionExchange,+ InvalidRegion: uasRoutingRegionExchange,+ NoConfigDefault: uasRoutingRegionExchange,+ };+ })(),Dispute: {ListDisputes: {Response: {diff --git a/cypress-tests/cypress/e2e/spec/Payment/43-ThreeDSRoutingRegionUAS.cy.js b/cypress-tests/cypress/e2e/spec/Payment/43-ThreeDSRoutingRegionUAS.cy.jsnew file mode 100644index 0000000000..2d40dd57e5--- /dev/null+++ b/cypress-tests/cypress/e2e/spec/Payment/43-ThreeDSRoutingRegionUAS.cy.js@@ -0,0 +1,153 @@+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import getConnectorDetails, {+ CONNECTOR_LISTS,+ shouldIncludeConnector,+} from "../../configs/Payment/Utils";++let globalState;++describe("3DS Routing Region for Unified Authentication Service", () => {+ before("seed global state", function () {+ let skip = false;++ cy.task("getGlobalState")+ .then((state) => {+ globalState = new State(state);++ if (+ shouldIncludeConnector(+ globalState.get("connectorId"),+ CONNECTOR_LISTS.INCLUDE.AUTH_SERVICE_ELIGIBILITY+ )+ ) {+ skip = true;+ }+ })+ .then(() => {+ if (skip) {+ this.skip();+ }+ });+ });++ after("flush global state", () => {+ cy.task("setGlobalState", globalState.data);+ });++ context("threeds_routing_region_uas = Region1", () => {+ before("set org config to Region1", () => {+ const orgId = globalState.get("organizationId");+ cy.setupConfigs(+ globalState,+ `threeds_routing_region_uas_${orgId}`,+ "Region1"+ );+ });++ it("should confirm 3DS payment with UAS routing region set to Region1", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))+ .threeds_routing_region_uas.Region1;+ cy.createConfirmPaymentTest(+ fixtures.createConfirmPaymentBody,+ data,+ "three_ds",+ "automatic",+ globalState+ );+ });++ after("cleanup org config", () => {+ const orgId = globalState.get("organizationId");+ cy.setConfigs(+ globalState,+ `threeds_routing_region_uas_${orgId}`,+ "Region1",+ "DELETE"+ );+ });+ });++ context("threeds_routing_region_uas = Region2", () => {+ before("set org config to Region2", () => {+ const orgId = globalState.get("organizationId");+ cy.setupConfigs(+ globalState,+ `threeds_routing_region_uas_${orgId}`,+ "Region2"+ );+ });++ it("should confirm 3DS payment with UAS routing region set to Region2", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))+ .threeds_routing_region_uas.Region2;+ cy.createConfirmPaymentTest(+ fixtures.createConfirmPaymentBody,+ data,+ "three_ds",+ "automatic",+ globalState+ );+ });++ after("cleanup org config", () => {+ const orgId = globalState.get("organizationId");+ cy.setConfigs(+ globalState,+ `threeds_routing_region_uas_${orgId}`,+ "Region2",+ "DELETE"+ );+ });+ });++ context(+ "threeds_routing_region_uas set to an invalid value - falls back to default region",+ () => {+ before("set org config to an invalid value", () => {+ const orgId = globalState.get("organizationId");+ cy.setupConfigs(+ globalState,+ `threeds_routing_region_uas_${orgId}`,+ "NotARegion"+ );+ });++ it("should still confirm 3DS payment, falling back to the default region on parse failure", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))+ .threeds_routing_region_uas.InvalidRegion;+ cy.createConfirmPaymentTest(+ fixtures.createConfirmPaymentBody,+ data,+ "three_ds",+ "automatic",+ globalState+ );+ });++ after("cleanup org config", () => {+ const orgId = globalState.get("organizationId");+ cy.setConfigs(+ globalState,+ `threeds_routing_region_uas_${orgId}`,+ "NotARegion",+ "DELETE"+ );+ });+ }+ );++ context("No threeds_routing_region_uas config set - default behavior", () => {+ it("should confirm 3DS payment using the default UAS routing region (Region1)", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))+ .threeds_routing_region_uas.NoConfigDefault;+ cy.createConfirmPaymentTest(+ fixtures.createConfirmPaymentBody,+ data,+ "three_ds",+ "automatic",+ globalState+ );+ });+ });+});