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 authentication service eligibility test cases (#12005)
likhinbopannace161f5c5944
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Commons.js b/cypress-tests/cypress/e2e/configs/Payment/Commons.jsindex 61ba067069..9f54c6c4a4 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Commons.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Commons.js@@ -2599,6 +2599,127 @@ export const connectorDetails = {},}),},+ auth_service_eligibility: {+ OrgEnabledMerchantEnabled: 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",+ },+ },+ }),+ OrgEnabledMerchantDisabled: 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",+ },+ },+ }),+ OrgDisabledMerchantEnabled: getCustomExchange({+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ currency: "USD",+ amount: 6500,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ authentication_type: "no_three_ds",+ },+ },+ }),+ OrgDisabledMerchantDisabled: getCustomExchange({+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ currency: "USD",+ amount: 6500,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ authentication_type: "no_three_ds",+ },+ },+ }),+ MerchantOnlyEnabled: 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",+ },+ },+ }),+ MerchantOnlyDisabled: getCustomExchange({+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ currency: "USD",+ amount: 6500,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ authentication_type: "no_three_ds",+ },+ },+ }),+ NoConfigDefault: 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",+ },+ },+ }),+ },Dispute: {ListDisputes: {Response: {diff --git a/cypress-tests/cypress/e2e/configs/Payment/Cybersource.js b/cypress-tests/cypress/e2e/configs/Payment/Cybersource.jsindex 1467a8ad28..b0d31b6c91 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Cybersource.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Cybersource.js@@ -1081,6 +1081,113 @@ export const connectorDetails = {},},},+ auth_service_eligibility: {+ OrgEnabledMerchantEnabled: 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",+ },+ },+ }),+ OrgEnabledMerchantDisabled: 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",+ },+ },+ }),+ OrgDisabledMerchantEnabled: getCustomExchange({+ Request: {+ payment_method: "card",+ payment_method_data: { card: successfulNo3DSCardDetails },+ currency: "USD",+ amount: 6500,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ authentication_type: "no_three_ds",+ },+ },+ }),+ OrgDisabledMerchantDisabled: getCustomExchange({+ Request: {+ payment_method: "card",+ payment_method_data: { card: successfulNo3DSCardDetails },+ currency: "USD",+ amount: 6500,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ authentication_type: "no_three_ds",+ },+ },+ }),+ MerchantOnlyEnabled: 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",+ },+ },+ }),+ MerchantOnlyDisabled: getCustomExchange({+ Request: {+ payment_method: "card",+ payment_method_data: { card: successfulNo3DSCardDetails },+ currency: "USD",+ amount: 6500,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ authentication_type: "no_three_ds",+ },+ },+ }),+ NoConfigDefault: 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",+ },+ },+ }),+ },pm_list: {PmListResponse: {PmListNull: {diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.jsindex b0c0adb014..29ece4c089 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js@@ -544,6 +544,7 @@ export const CONNECTOR_LISTS = {BANK_DEBIT: ["novalnet"],PARTNER_MERCHANT_IDENTIFIER: ["adyen", "checkout"],GIFT_CARD: ["adyen"],+ AUTH_SERVICE_ELIGIBILITY: ["stripe", "cybersource"],// Add more inclusion lists},};diff --git a/cypress-tests/cypress/e2e/spec/Payment/43-AuthenticationServiceEligibility.cy.js b/cypress-tests/cypress/e2e/spec/Payment/43-AuthenticationServiceEligibility.cy.jsnew file mode 100644index 0000000000..1edeb525fb--- /dev/null+++ b/cypress-tests/cypress/e2e/spec/Payment/43-AuthenticationServiceEligibility.cy.js@@ -0,0 +1,298 @@+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import getConnectorDetails, {+ CONNECTOR_LISTS,+ shouldIncludeConnector,+} from "../../configs/Payment/Utils";++let globalState;++describe("Authentication Service Eligibility", () => {+ 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(+ "Org enabled, Merchant enabled - org takes precedence (3DS enabled)",+ () => {+ it("should set org config to true", () => {+ const orgId = globalState.get("organizationId");+ const key = `authentication_service_eligible_${orgId}`;+ cy.setConfigs(globalState, key, "true", "CREATE");+ });++ it("should set merchant config to true", () => {+ const merchantId = globalState.get("merchantId");+ const key = `authentication_service_eligible_${merchantId}`;+ cy.setConfigs(globalState, key, "true", "CREATE");+ });++ it("should confirm 3DS payment with org and merchant both enabled", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))+ .auth_service_eligibility.OrgEnabledMerchantEnabled;+ cy.createConfirmPaymentTest(+ fixtures.createConfirmPaymentBody,+ data,+ "three_ds",+ "automatic",+ globalState+ );+ });++ after("cleanup org and merchant configs", () => {+ const orgId = globalState.get("organizationId");+ const merchantId = globalState.get("merchantId");+ cy.setConfigs(+ globalState,+ `authentication_service_eligible_${orgId}`,+ "true",+ "DELETE"+ );+ cy.setConfigs(+ globalState,+ `authentication_service_eligible_${merchantId}`,+ "true",+ "DELETE"+ );+ });+ }+ );++ context(+ "Org enabled, Merchant disabled - org takes precedence (3DS enabled)",+ () => {+ it("should set org config to true", () => {+ const orgId = globalState.get("organizationId");+ const key = `authentication_service_eligible_${orgId}`;+ cy.setConfigs(globalState, key, "true", "CREATE");+ });++ it("should set merchant config to false", () => {+ const merchantId = globalState.get("merchantId");+ const key = `authentication_service_eligible_${merchantId}`;+ cy.setConfigs(globalState, key, "false", "CREATE");+ });++ it("should confirm 3DS payment with org overriding merchant", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))+ .auth_service_eligibility.OrgEnabledMerchantDisabled;+ cy.createConfirmPaymentTest(+ fixtures.createConfirmPaymentBody,+ data,+ "three_ds",+ "automatic",+ globalState+ );+ });++ after("cleanup org and merchant configs", () => {+ const orgId = globalState.get("organizationId");+ const merchantId = globalState.get("merchantId");+ cy.setConfigs(+ globalState,+ `authentication_service_eligible_${orgId}`,+ "true",+ "DELETE"+ );+ cy.setConfigs(+ globalState,+ `authentication_service_eligible_${merchantId}`,+ "false",+ "DELETE"+ );+ });+ }+ );++ context(+ "Org disabled, Merchant enabled - org takes precedence (3DS disabled)",+ () => {+ it("should set org config to false", () => {+ const orgId = globalState.get("organizationId");+ const key = `authentication_service_eligible_${orgId}`;+ cy.setConfigs(globalState, key, "false", "CREATE");+ });++ it("should set merchant config to true", () => {+ const merchantId = globalState.get("merchantId");+ const key = `authentication_service_eligible_${merchantId}`;+ cy.setConfigs(globalState, key, "true", "CREATE");+ });++ it("should confirm payment with no_three_ds when org overrides merchant", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))+ .auth_service_eligibility.OrgDisabledMerchantEnabled;+ cy.createConfirmPaymentTest(+ fixtures.createConfirmPaymentBody,+ data,+ "no_three_ds",+ "automatic",+ globalState+ );+ });++ after("cleanup org and merchant configs", () => {+ const orgId = globalState.get("organizationId");+ const merchantId = globalState.get("merchantId");+ cy.setConfigs(+ globalState,+ `authentication_service_eligible_${orgId}`,+ "false",+ "DELETE"+ );+ cy.setConfigs(+ globalState,+ `authentication_service_eligible_${merchantId}`,+ "true",+ "DELETE"+ );+ });+ }+ );++ context("Org disabled, Merchant disabled - both deny (3DS disabled)", () => {+ it("should set org config to false", () => {+ const orgId = globalState.get("organizationId");+ const key = `authentication_service_eligible_${orgId}`;+ cy.setConfigs(globalState, key, "false", "CREATE");+ });++ it("should set merchant config to false", () => {+ const merchantId = globalState.get("merchantId");+ const key = `authentication_service_eligible_${merchantId}`;+ cy.setConfigs(globalState, key, "false", "CREATE");+ });++ it("should confirm payment with no_three_ds when both configs disabled", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))+ .auth_service_eligibility.OrgDisabledMerchantDisabled;+ cy.createConfirmPaymentTest(+ fixtures.createConfirmPaymentBody,+ data,+ "no_three_ds",+ "automatic",+ globalState+ );+ });++ after("cleanup org and merchant configs", () => {+ const orgId = globalState.get("organizationId");+ const merchantId = globalState.get("merchantId");+ cy.setConfigs(+ globalState,+ `authentication_service_eligible_${orgId}`,+ "false",+ "DELETE"+ );+ cy.setConfigs(+ globalState,+ `authentication_service_eligible_${merchantId}`,+ "false",+ "DELETE"+ );+ });+ });++ context(+ "No org config, Merchant enabled - merchant fallback (3DS enabled)",+ () => {+ it("should set merchant config to true", () => {+ const merchantId = globalState.get("merchantId");+ const key = `authentication_service_eligible_${merchantId}`;+ cy.setConfigs(globalState, key, "true", "CREATE");+ });++ it("should confirm 3DS payment with merchant-only config enabled", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))+ .auth_service_eligibility.MerchantOnlyEnabled;+ cy.createConfirmPaymentTest(+ fixtures.createConfirmPaymentBody,+ data,+ "three_ds",+ "automatic",+ globalState+ );+ });++ after("cleanup merchant config", () => {+ const merchantId = globalState.get("merchantId");+ cy.setConfigs(+ globalState,+ `authentication_service_eligible_${merchantId}`,+ "true",+ "DELETE"+ );+ });+ }+ );++ context(+ "No org config, Merchant disabled - merchant fallback (3DS disabled)",+ () => {+ it("should set merchant config to false", () => {+ const merchantId = globalState.get("merchantId");+ const key = `authentication_service_eligible_${merchantId}`;+ cy.setConfigs(globalState, key, "false", "CREATE");+ });++ it("should confirm payment with no_three_ds when merchant config disabled", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))+ .auth_service_eligibility.MerchantOnlyDisabled;+ cy.createConfirmPaymentTest(+ fixtures.createConfirmPaymentBody,+ data,+ "no_three_ds",+ "automatic",+ globalState+ );+ });++ after("cleanup merchant config", () => {+ const merchantId = globalState.get("merchantId");+ cy.setConfigs(+ globalState,+ `authentication_service_eligible_${merchantId}`,+ "false",+ "DELETE"+ );+ });+ }+ );++ context("No config at all - default behavior", () => {+ it("should confirm 3DS payment with default behavior (no config set)", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))+ .auth_service_eligibility.NoConfigDefault;+ cy.createConfirmPaymentTest(+ fixtures.createConfirmPaymentBody,+ data,+ "three_ds",+ "automatic",+ globalState+ );+ });+ });+});