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 L2/L3 Data Processing coverage for checkout, nuvei, worldpayvantiv (#11932)
HS-QUALIBOT8c309f77365a
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Checkout.js b/cypress-tests/cypress/e2e/configs/Payment/Checkout.jsindex dbaab1853c..1e68368c5f 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Checkout.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Checkout.js@@ -722,6 +722,36 @@ export const connectorDetails = {},},},+ L2L3Data: {+ Request: {+ currency: "USD",+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ billing_descriptor: {+ name: "Juspay",+ city: "San Francisco",+ },+ order_tax_amount: 500,+ shipping_cost: 100,+ order_details: [+ {+ product_name: "Test Product",+ quantity: 1,+ amount: 6000,+ },+ ],+ customer_acceptance: null,+ setup_future_usage: "on_session",+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },PartnerMerchantIdentifier: {Request: {currency: "USD",diff --git a/cypress-tests/cypress/e2e/configs/Payment/Commons.js b/cypress-tests/cypress/e2e/configs/Payment/Commons.jsindex 4d5204b0d9..e704c9b46c 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Commons.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Commons.js@@ -2628,6 +2628,27 @@ export const connectorDetails = {},},}),+ L2L3Data: getCustomExchange({+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ metadata: {+ order_tax_amount: 500,+ shipping_cost: 100,+ order_po_number: "PO-12345",+ },+ customer_acceptance: null,+ setup_future_usage: "on_session",+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ }),UseBillingAsPaymentMethodBilling: getCustomExchange({Request: {payment_method: "card",diff --git a/cypress-tests/cypress/e2e/configs/Payment/Nuvei.js b/cypress-tests/cypress/e2e/configs/Payment/Nuvei.jsindex 4a0a9dbd55..24ebd0adf6 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Nuvei.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Nuvei.js@@ -744,6 +744,33 @@ export const connectorDetails = {},},},+ L2L3Data: {+ Request: {+ currency: "USD",+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ amount: 11500,+ order_tax_amount: 500,+ shipping_cost: 100,+ order_details: [+ {+ product_name: "Test Product",+ quantity: 1,+ amount: 6000,+ },+ ],+ customer_acceptance: null,+ setup_future_usage: "on_session",+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },PaymentIntentWithBillingDescriptor: {Request: {currency: "USD",diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.jsindex 26fd136ca5..2d9f7895e3 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js@@ -460,7 +460,7 @@ export const CONNECTOR_LISTS = {// "stripe",],DDC_RACE_CONDITION: ["worldpay"],- CONNECTOR_TESTING_DATA: ["adyen", "noon", "airwallex", "braintree"],+ CONNECTOR_TESTING_DATA: ["adyen", "airwallex", "braintree", "noon"],// ucs connectorsUCS_CONNECTORS: ["authorizedotnet"],OVERCAPTURE: ["adyen"],@@ -552,6 +552,7 @@ export const CONNECTOR_LISTS = {PARTIAL_AUTH: ["nuvei", "checkout", "worldpay", "worldpayvantiv"],USE_BILLING_AS_PAYMENT_METHOD_BILLING: ["bankofamerica"],MIT_WITH_LIMITED_CARD_DATA: ["peachpayments"],+ L2L3DATA: ["checkout", "nuvei", "worldpayvantiv"],REFUND_MANUAL_UPDATE: ["bankofamerica", "cybersource"],// Add more inclusion lists},diff --git a/cypress-tests/cypress/e2e/configs/Payment/Worldpayvantiv.js b/cypress-tests/cypress/e2e/configs/Payment/Worldpayvantiv.jsindex 6cfd64b354..96497ba82e 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Worldpayvantiv.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Worldpayvantiv.js@@ -599,6 +599,20 @@ export const connectorDetails = {},},},+ // Worldpayvantiv does not support L2/L3 data processing in test environment+ // Requires special credential configuration that is not available in sandbox+ L2L3Data: {+ Configs: {+ TRIGGER_SKIP: true,+ },+ Request: {},+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },PaymentIntentOffSession: {Configs: {TRIGGER_SKIP: true,diff --git a/cypress-tests/cypress/e2e/spec/Payment/46-L2L3DataProcessing.cy.js b/cypress-tests/cypress/e2e/spec/Payment/46-L2L3DataProcessing.cy.jsnew file mode 100644index 0000000000..3609d58cea--- /dev/null+++ b/cypress-tests/cypress/e2e/spec/Payment/46-L2L3DataProcessing.cy.js@@ -0,0 +1,177 @@+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import getConnectorDetails, * as utils from "../../configs/Payment/Utils";++let globalState;++describe("L2/L3 Data Processing Tests", () => {+ before(function () {+ let skip = false;++ cy.task("getGlobalState")+ .then((state) => {+ globalState = new State(state);++ if (+ utils.shouldIncludeConnector(+ globalState.get("connectorId"),+ utils.CONNECTOR_LISTS.INCLUDE.L2L3DATA+ )+ ) {+ skip = true;+ }+ })+ .then(() => {+ if (skip) {+ this.skip();+ }+ });+ });++ afterEach("flush global state", () => {+ cy.task("setGlobalState", globalState.data);+ });++ context("L2/L3 Data - Intent+Confirm Flow", () => {+ it("Update Business Profile (L2/L3 enabled) -> Create Payment Intent -> Payment Methods Call -> Confirm Payment with L2/L3 -> Retrieve Payment", () => {+ let shouldContinue = true;++ cy.step("Update Business Profile (L2/L3 enabled)", () => {+ const body = {+ ...fixtures.businessProfile.bpUpdate,+ is_l2_l3_enabled: true,+ };+ cy.UpdateBusinessProfileTest(+ body,+ body.is_connector_agnostic_mit_enabled,+ body.collect_billing_details_from_wallet_connector,+ body.collect_shipping_details_from_wallet_connector,+ body.always_collect_billing_details_from_wallet_connector,+ body.always_collect_shipping_details_from_wallet_connector,+ globalState+ );+ });++ cy.step("Create Payment Intent", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["PaymentIntent"];++ cy.createPaymentIntentTest(+ fixtures.createPaymentBody,+ data,+ "no_three_ds",+ "automatic",+ globalState+ );++ if (!utils.should_continue_further(data)) {+ shouldContinue = false;+ }+ });++ cy.step("Payment Methods Call", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: Payment Methods Call");+ return;+ }+ cy.paymentMethodsCallTest(globalState);+ });++ cy.step("Confirm Payment with L2/L3 Data", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: Confirm Payment with L2/L3 Data");+ return;+ }+ const confirmData = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["L2L3Data"];++ if (!utils.should_continue_further(confirmData)) {+ shouldContinue = false;+ cy.task(+ "cli_log",+ "Skipping step: Confirm Payment with L2/L3 Data (TRIGGER_SKIP)"+ );+ return;+ }++ cy.confirmCallTest(+ fixtures.confirmBody,+ confirmData,+ true,+ globalState+ );+ });++ cy.step("Retrieve Payment", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: Retrieve Payment");+ return;+ }+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["L2L3Data"];++ cy.retrievePaymentCallTest({ globalState, data });+ });+ });+ });++ context("L2/L3 Data - Negative Test (Feature Disabled)", () => {+ it("Attempt L2/L3 payment WITHOUT is_l2_l3_enabled -> Should process without L2/L3 data", () => {+ let shouldContinue = true;++ cy.step("Update Business Profile (L2/L3 disabled)", () => {+ const body = {+ ...fixtures.businessProfile.bpUpdate,+ is_l2_l3_enabled: false,+ };+ cy.UpdateBusinessProfileTest(+ body,+ body.is_connector_agnostic_mit_enabled,+ body.collect_billing_details_from_wallet_connector,+ body.collect_shipping_details_from_wallet_connector,+ body.always_collect_billing_details_from_wallet_connector,+ body.always_collect_shipping_details_from_wallet_connector,+ globalState+ );+ });++ cy.step("Create and Confirm Payment with L2/L3 fields", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["L2L3Data"];++ if (!utils.should_continue_further(data)) {+ shouldContinue = false;+ return;+ }++ cy.createConfirmPaymentTest(+ fixtures.createConfirmPaymentBody,+ data,+ "no_three_ds",+ "automatic",+ globalState+ );++ if (!utils.should_continue_further(data)) {+ shouldContinue = false;+ }+ });++ cy.step("Retrieve Payment and verify", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: Retrieve Payment");+ return;+ }+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["L2L3Data"];++ cy.retrievePaymentCallTest({ globalState, data });+ });+ });+ });+});