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 split payments coverage for payload connector (#13518)
venkatakarthikm-makeref54e9e6ec13
diff --git a/cypress-tests/cypress/e2e/configs/Payment/PayloadConnect.js b/cypress-tests/cypress/e2e/configs/Payment/PayloadConnect.jsnew file mode 100644index 0000000000..d7233d27e0--- /dev/null+++ b/cypress-tests/cypress/e2e/configs/Payment/PayloadConnect.js@@ -0,0 +1,940 @@+import {+ connectorDetails as commonConnectorDetails,+ customerAcceptance,+ multiUseMandateData,+ singleUseMandateData,+} from "./Commons";+import { getCustomExchange } from "./Modifiers";++const DUPLICATION_TIMEOUT = 30000; // 30 seconds++const successfulNo3DSCardDetails = {+ card_number: "4242424242424242",+ card_exp_month: "12",+ card_exp_year: "30",+ card_holder_name: "John Doe",+ card_cvc: "123",+};++const successfulThreeDSTestCardDetails = {+ ...successfulNo3DSCardDetails,+};++const billingDescriptor = {+ name: "Test Business",+ city: "San Francisco",+ phone: "1234567890",+ statement_descriptor: "Test Descriptor",+ statement_descriptor_suffix: "Suffix",+ reference: "REF123",+};++const threeDSNotSupportedError = {+ type: "invalid_request",+ message: "3DS authentication is not supported by Payload",+ code: "IR_00",+};++// Payload Connect Split Payments Configuration+const payloadSplitPaymentData = {+ payload_split_payment: {+ ledger: [+ {+ receiver_id: "acct_3eoxafCHioIB3jNMKJev4",+ amount: 5000,+ },+ {+ receiver_id: "acct_3epxuNyAtNd77zShIaaL1",+ amount: 1000,+ },+ ],+ },+};++export const connectorDetails = {+ card_pm: {+ PaymentIntent: {+ Request: {+ currency: "USD",+ customer_acceptance: null,+ setup_future_usage: "on_session",+ split_payments: payloadSplitPaymentData,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_payment_method",+ setup_future_usage: "on_session",+ },+ },+ },+ PaymentIntentOffSession: {+ Request: {+ currency: "USD",+ customer_acceptance: null,+ amount: 6000,+ authentication_type: "no_three_ds",+ setup_future_usage: "off_session",+ split_payments: payloadSplitPaymentData,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_payment_method",+ setup_future_usage: "off_session",+ },+ },+ },+ // NOTE: split_payments is intentionally omitted here -- the split+ // ledger (payloadSplitPaymentData) sums to 6000, which does not cover+ // the full 6050 order total once shipping_cost is added, and combining+ // the two produced a live "amount" error_message from payload. Revisit+ // if/when a shipping-cost-aware ledger is verified to work.+ PaymentIntentWithShippingCost: {+ Request: {+ currency: "USD",+ shipping_cost: 50,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_payment_method",+ shipping_cost: 50,+ amount: 6000,+ },+ },+ },+ PaymentConfirmWithShippingCost: {+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ customer_acceptance: null,+ setup_future_usage: "on_session",+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ shipping_cost: 50,+ amount_received: 6050,+ amount: 6000,+ net_amount: 6050,+ },+ },+ },+ PaymentIntentWithBillingDescriptor: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: DUPLICATION_TIMEOUT,+ },+ },+ Request: {+ currency: "USD",+ billing_descriptor: billingDescriptor,+ split_payments: payloadSplitPaymentData,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_payment_method",+ },+ },+ },+ PaymentConfirmWithBillingDescriptor: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: DUPLICATION_TIMEOUT,+ },+ },+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ billing_descriptor: billingDescriptor,+ split_payments: payloadSplitPaymentData,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ amount_received: 6000,+ split_payments: payloadSplitPaymentData,+ },+ },+ },+ "3DSManualCapture": {+ Configs: {+ TRIGGER_SKIP: true,+ },+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulThreeDSTestCardDetails,+ },+ currency: "USD",+ customer_acceptance: null,+ setup_future_usage: "on_session",+ },+ Response: {+ status: 400,+ body: {+ error: threeDSNotSupportedError,+ },+ },+ },+ "3DSAutoCapture": {+ Configs: {+ TRIGGER_SKIP: true,+ },+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulThreeDSTestCardDetails,+ },+ currency: "USD",+ customer_acceptance: null,+ setup_future_usage: "on_session",+ },+ Response: {+ status: 400,+ body: {+ error: threeDSNotSupportedError,+ },+ },+ },+ No3DSManualCapture: {+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ currency: "USD",+ customer_acceptance: null,+ setup_future_usage: "on_session",+ split_payments: payloadSplitPaymentData,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_capture", // Manual capture should require explicit capture+ payment_method: "card",+ attempt_count: 1,+ split_payments: payloadSplitPaymentData,+ },+ },+ },+ No3DSAutoCapture: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: DUPLICATION_TIMEOUT,+ },+ },+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ currency: "USD",+ customer_acceptance: null,+ setup_future_usage: "on_session",+ split_payments: payloadSplitPaymentData,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ payment_method: "card",+ attempt_count: 1,+ split_payments: payloadSplitPaymentData,+ },+ },+ },+ No3DSFailPayment: {+ // DELAY is required here (missing on the base Payload.js key too) --+ // without a cooldown, this reuses the same card+amount as other+ // No3DS* keys closely enough in a full-suite run to trip Payload's+ // duplicate-transaction detection.+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: DUPLICATION_TIMEOUT,+ },+ },+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetails, //payload doesnt support failed cards+ },+ customer_acceptance: null,+ setup_future_usage: "on_session",+ split_payments: payloadSplitPaymentData,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ payment_method: "card",+ attempt_count: 1,+ split_payments: payloadSplitPaymentData,+ },+ },+ },+ // NOTE: split_payments is intentionally not asserted in Response.body+ // here -- captureCallTest (commands.js) compares resData.body fields+ // with plain `.to.equal`, which fails on nested objects even when+ // their contents match (strict reference equality), unlike+ // createConfirmPaymentTest which uses `.to.deep.equal`. Whether the+ // /capture response actually preserves split_payments is unverified.+ Capture: {+ Request: {+ amount_to_capture: 6000,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ amount: 6000,+ amount_capturable: 0,+ amount_received: 6000,+ },+ },+ },+ PartialCapture: {+ Request: {+ amount_to_capture: 2000,+ },+ Response: {+ status: 200,+ body: {+ status: "partially_captured",+ amount: 6000,+ amount_capturable: 0,+ amount_received: 2000,+ },+ },+ },+ Void: {+ Request: {},+ Response: {+ status: 200,+ body: {+ status: "cancelled",+ },+ },+ },+ // payloadconnect splits the full payment amount to receivers via the+ // ledger, leaving nothing in the merchant's transaction balance for a+ // standard refund. Payload's connector integration has no split-aware+ // refund mechanism (unlike stripeconnect's split_refunds), so every+ // refund attempt against a split payment fails -- verified live against+ // the real API: HTTP 200 with a business-level "failed" refund status.+ Refund: {+ Request: {+ amount: 6000,+ },+ Response: {+ status: 200,+ body: {+ status: "failed",+ error_code: "InvalidAttributes",+ error_message:+ '{"ledger":[{"amount":"Amount is above transaction balance"}]}',+ unified_code: "UE_9000",+ unified_message: "Something went wrong",+ },+ },+ },+ manualPaymentRefund: {+ Request: {+ amount: 6000,+ },+ Response: {+ status: 200,+ body: {+ status: "failed",+ error_code: "InvalidAttributes",+ error_message:+ '{"ledger":[{"amount":"Amount is above transaction balance"}]}',+ unified_code: "UE_9000",+ unified_message: "Something went wrong",+ },+ },+ },+ manualPaymentPartialRefund: {+ Request: {+ amount: 2000,+ },+ Response: {+ status: 200,+ body: {+ status: "failed",+ error_code: "InvalidAttributes",+ error_message:+ '{"ledger":[{"amount":"Amount is above transaction balance"}]}',+ unified_code: "UE_9000",+ unified_message: "Something went wrong",+ },+ },+ },+ PartialRefund: {+ Request: {+ amount: 2000,+ },+ Response: {+ status: 200,+ body: {+ status: "failed",+ error_code: "InvalidAttributes",+ error_message:+ '{"ledger":[{"amount":"Amount is above transaction balance"}]}',+ unified_code: "UE_9000",+ unified_message: "Something went wrong",+ },+ },+ },+ SyncRefund: {+ Response: {+ status: 200,+ body: {+ status: "failed",+ },+ },+ },+ SaveCardUseNo3DSAutoCapture: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: DUPLICATION_TIMEOUT,+ },+ },+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ currency: "USD",+ setup_future_usage: "on_session",+ customer_acceptance: customerAcceptance,+ split_payments: payloadSplitPaymentData,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ split_payments: payloadSplitPaymentData,+ },+ },+ },+ SaveCardUseNo3DSManualCapture: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: DUPLICATION_TIMEOUT / 2, // 15 seconds+ },+ },+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ currency: "USD",+ setup_future_usage: "on_session",+ customer_acceptance: customerAcceptance,+ split_payments: payloadSplitPaymentData,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_capture", // Keep this as requires_capture for manual flows+ split_payments: payloadSplitPaymentData,+ },+ },+ },+ PaymentMethodIdMandateNo3DSAutoCapture: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: DUPLICATION_TIMEOUT / 2, // 15 seconds+ },+ TRIGGER_SKIP: true,+ },+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ currency: "USD",+ mandate_data: null,+ customer_acceptance: customerAcceptance,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },+ SaveCardUseNo3DSAutoCaptureOffSession: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: DUPLICATION_TIMEOUT,+ },+ },+ Request: {+ payment_method: "card",+ payment_method_type: "debit",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ setup_future_usage: "off_session",+ customer_acceptance: customerAcceptance,+ split_payments: payloadSplitPaymentData,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ split_payments: payloadSplitPaymentData,+ },+ },+ },+ SaveCardUse3DSAutoCaptureOffSession: {+ Configs: {+ TRIGGER_SKIP: true,+ },+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulThreeDSTestCardDetails,+ },+ currency: "USD",+ customer_acceptance: null,+ setup_future_usage: "on_session",+ },+ Response: {+ status: 400,+ body: {+ error: threeDSNotSupportedError,+ },+ },+ },+ SaveCardUseNo3DSManualCaptureOffSession: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: DUPLICATION_TIMEOUT / 2, // 15 seconds+ },+ },+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ setup_future_usage: "off_session",+ customer_acceptance: customerAcceptance,+ split_payments: payloadSplitPaymentData,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_capture",+ split_payments: payloadSplitPaymentData,+ },+ },+ },+ SaveCardConfirmAutoCaptureOffSession: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: DUPLICATION_TIMEOUT / 2, // 15 seconds+ },+ },+ Request: {+ setup_future_usage: "off_session",+ split_payments: payloadSplitPaymentData,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ split_payments: payloadSplitPaymentData,+ },+ },+ },+ SaveCardConfirmManualCaptureOffSession: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: DUPLICATION_TIMEOUT / 2, // 15 seconds+ },+ },+ Request: {+ setup_future_usage: "off_session",+ split_payments: payloadSplitPaymentData,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_capture",+ split_payments: payloadSplitPaymentData,+ },+ },+ },+ SaveCardConfirmAutoCaptureOffSessionWithoutBilling: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: DUPLICATION_TIMEOUT,+ },+ },+ Request: {+ setup_future_usage: "off_session",+ billing: null,+ split_payments: payloadSplitPaymentData,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ split_payments: payloadSplitPaymentData,+ },+ },+ },+ PaymentMethodIdMandateNo3DSManualCapture: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: DUPLICATION_TIMEOUT,+ },+ },+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ currency: "USD",+ mandate_data: null,+ customer_acceptance: customerAcceptance,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_capture",+ },+ },+ },+ MandateSingleUseNo3DSAutoCapture: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: DUPLICATION_TIMEOUT,+ },+ },+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ currency: "USD",+ mandate_data: singleUseMandateData,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },+ // NOTE: split_payments is intentionally omitted from all+ // Mandate*/MIT* keys below -- payload is excluded from every mandate+ // spec in this suite (MANDATE_ID_TEST exclusion list, plus+ // PaymentMethodIdMandateNo3DSAutoCapture's TRIGGER_SKIP cascades a+ // skip through 20-MandatesUsingPMID.cy.js), so this config is never+ // actually exercised. Revisit if payload mandate support is ever+ // un-excluded.+ MandateSingleUseNo3DSManualCapture: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: DUPLICATION_TIMEOUT,+ },+ },+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ currency: "USD",+ mandate_data: singleUseMandateData,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_capture",+ },+ },+ },+ MandateMultiUseNo3DSAutoCapture: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: DUPLICATION_TIMEOUT,+ },+ },+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ currency: "USD",+ mandate_data: multiUseMandateData,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },+ MandateMultiUseNo3DSManualCapture: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: DUPLICATION_TIMEOUT,+ },+ },+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ currency: "USD",+ mandate_data: multiUseMandateData,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_capture",+ },+ },+ },+ ZeroAuthPaymentIntent: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: DUPLICATION_TIMEOUT,+ },+ },+ Request: {+ amount: 0,+ setup_future_usage: "off_session",+ currency: "USD",+ },+ Response: {+ status: 200,+ body: {+ status: "requires_payment_method",+ setup_future_usage: "off_session",+ amount: 0,+ },+ },+ },+ ZeroAuthConfirmPayment: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: DUPLICATION_TIMEOUT,+ },+ },+ Request: {+ payment_type: "setup_mandate",+ payment_method: "card",+ payment_method_type: "debit",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ setup_future_usage: "off_session",+ mandate_data: null,+ customer_acceptance: customerAcceptance,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ amount: 0,+ setup_future_usage: "off_session",+ payment_method_type: "credit",+ },+ },+ },+ ZeroAuthMandate: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: DUPLICATION_TIMEOUT,+ },+ },+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ currency: "USD",+ mandate_data: singleUseMandateData,+ customer_acceptance: customerAcceptance,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ amount: 0,+ },+ },+ },+ MITAutoCapture: getCustomExchange({+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: DUPLICATION_TIMEOUT,+ },+ },+ ...commonConnectorDetails.card_pm.MITAutoCapture,+ }),+ MITManualCapture: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: DUPLICATION_TIMEOUT,+ },+ },+ Request: {},+ Response: {+ status: 200,+ body: {+ status: "requires_capture",+ },+ },+ },+ },+ bank_debit_pm: {+ Ach: getCustomExchange({+ Request: {+ payment_method: "bank_debit",+ payment_method_type: "ach",+ payment_method_data: {+ bank_debit: {+ ach_bank_debit: {+ account_number: "000123456789",+ routing_number: "110000000",+ bank_account_holder_name: "John Doe",+ bank_type: "checking",+ },+ },+ },+ billing: {+ address: {+ first_name: "John",+ last_name: "Doe",+ line1: "123 Main St",+ city: "San Francisco",+ state: "California",+ zip: "94122",+ country: "US",+ },+ },+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ }),+ MandateSingleUseAch: getCustomExchange({+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: DUPLICATION_TIMEOUT,+ },+ LOCAL_VAULT_REQUIRED: true,+ },+ Request: {+ amount: 6540,+ payment_method: "bank_debit",+ payment_method_type: "ach",+ currency: "USD",+ payment_method_data: {+ bank_debit: {+ ach_bank_debit: {+ account_number: "000123456789",+ routing_number: "110000000",+ bank_account_holder_name: "John Doe",+ bank_type: "checking",+ },+ },+ },+ mandate_data: {+ customer_acceptance: customerAcceptance,+ mandate_type: {+ multi_use: {+ amount: 8000,+ currency: "USD",+ },+ },+ },+ setup_future_usage: "off_session",+ billing: {+ address: {+ first_name: "John",+ last_name: "Doe",+ line1: "123 Main St",+ city: "San Francisco",+ state: "California",+ zip: "94122",+ country: "US",+ },+ },+ payment_type: "new_mandate",+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ }),+ MITAutoCaptureAch: getCustomExchange({+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: DUPLICATION_TIMEOUT,+ },+ },+ Request: {+ amount: 6540,+ off_session: true,+ confirm: true,+ currency: "USD",+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ }),+ },+ webhook: {+ TransactionIdConfig: {+ path: "triggered_on.id",+ type: "string",+ },+ },+};diff --git a/cypress-tests/cypress/e2e/configs/Payment/StripeConnect.js b/cypress-tests/cypress/e2e/configs/Payment/StripeConnect.jsindex b486c4e18f..b7e521f9f0 100644--- a/cypress-tests/cypress/e2e/configs/Payment/StripeConnect.js+++ b/cypress-tests/cypress/e2e/configs/Payment/StripeConnect.js@@ -76,7 +76,7 @@ const payment_method_data_3ds = {last4: "3155",card_type: "CREDIT",card_network: "Visa",- card_issuer: "Intl Hdqtrs Center Owned",+ card_issuer: "INTL HDQTRS CENTER OWNED",card_issuing_country: "UNITED STATES OF AMERICA",card_isin: "400000",card_extended_bin: null,@@ -95,7 +95,7 @@ const payment_method_data_no3ds = {last4: "0005",card_type: "CREDIT",card_network: "AmericanExpress",- card_issuer: "American Express US Cars",+ card_issuer: "AMERICAN EXPRESS US CARS",card_issuing_country: "UNITED STATES OF AMERICA",card_isin: "378282",card_extended_bin: null,diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.jsindex ef7a034bd5..537e833833 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js@@ -64,6 +64,7 @@ import { connectorDetails as payboxConnectorDetails } from "./Paybox.js";import { connectorDetails as payjustnowConnectorDetails } from "./Payjustnow.js";import { connectorDetails as payjustnowinstoreConnectorDetails } from "./Payjustnowinstore.js";import { connectorDetails as payloadConnectorDetails } from "./Payload.js";+import { connectorDetails as payloadconnectConnectorDetails } from "./PayloadConnect.js";import { connectorDetails as paypalConnectorDetails } from "./Paypal.js";import { connectorDetails as paysafeConnectorDetails } from "./Paysafe.js";import { connectorDetails as paystackConnectorDetails } from "./Paystack.js";@@ -153,6 +154,7 @@ const connectorDetails = {payjustnow: payjustnowConnectorDetails,payjustnowinstore: payjustnowinstoreConnectorDetails,payload: payloadConnectorDetails,+ payloadconnect: payloadconnectConnectorDetails,paypal: paypalConnectorDetails,paysafe: paysafeConnectorDetails,paystack: paystackConnectorDetails,@@ -187,14 +189,26 @@ const connectorDetails = {mifinity: mifinityConnectorDetails,};+/**+ * Test-only connector IDs that alias a real backend connector under a+ * different merchant-connector-account configuration (e.g. split payments).+ * The backend never sees these IDs -- API requests/assertions always use+ * the mapped name.+ */+const ALIASED_CONNECTORS = {+ stripeconnect: "stripe",+ payloadconnect: "payload",+};+/*** Get the backend connector name for a given connector ID- * Maps stripeconnect -> stripe for backend API calls+ * Maps stripeconnect -> stripe, payloadconnect -> payload, etc. for backend+ * API calls* @param {string} connectorId - The test connector ID* @returns {string} - The backend connector name*/export function getOriginalConnectorName(connectorId) {- return connectorId === "stripeconnect" ? "stripe" : connectorId;+ return ALIASED_CONNECTORS[connectorId] || connectorId;}export default function getConnectorDetails(connectorId) {@@ -527,6 +541,7 @@ export const CONNECTOR_LISTS = {"noon","novalnet","payload",+ "payloadconnect","paypal","stax","stripeconnect",@@ -540,6 +555,7 @@ export const CONNECTOR_LISTS = {"airwallex","calida","payload",+ "payloadconnect","gigadat","loonio","redsys",@@ -569,6 +585,8 @@ export const CONNECTOR_LISTS = {// Inclusion lists (only run for these connectors)INCLUDE: {+ // Tracking extension to other connectors: #13520+ SPLIT_PAYMENTS: ["stripeconnect", "payloadconnect"],MANDATES_USING_NTID_PROXY: ["cybersource", "checkout"],// Card and mandate flows of 54-TsysTransitMandates. The mandates need a// profile with connector agnostic MIT enabled, which keeps them out of thediff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.jsindex 9cfbe0ede8..e540ecfa9f 100644--- a/cypress-tests/cypress/support/commands.js+++ b/cypress-tests/cypress/support/commands.js@@ -33,6 +33,7 @@ import getConnectorDetails, {getValueByKey,injectHelcimTestCard,setNormalizedValue,+ shouldIncludeConnector,stringifyWithBigInt,} from "../e2e/configs/Payment/Utils";import { execConfig, validateConfig } from "../utils/featureFlags";@@ -70,16 +71,31 @@ function getOriginalConnectorId(globalState) {);}-function isStripeConnect(globalState) {+// True for test-only connector IDs (stripeconnect, payloadconnect, ...)+// that alias a real backend connector under a different merchant-connector+// -account configuration -- see getOriginalConnectorName.+function isAliasedConnector(globalState) {const connectorId = getOriginalConnectorId(globalState);return (typeof connectorId === "string" &&- connectorId.toLowerCase() === "stripeconnect"+ getOriginalConnectorName(connectorId.toLowerCase()) !==+ connectorId.toLowerCase()+ );+}++function supportsSplitPayments(globalState) {+ const connectorId = getOriginalConnectorId(globalState);+ return (+ typeof connectorId === "string" &&+ !shouldIncludeConnector(+ connectorId.toLowerCase(),+ CONNECTOR_LISTS.INCLUDE.SPLIT_PAYMENTS+ ));}function updateConnectorState(globalState, responseConnector) {- if (isStripeConnect(globalState)) {+ if (isAliasedConnector(globalState)) {const originalConnectorId = getOriginalConnectorId(globalState);globalState.set("connectorId", originalConnectorId);return;@@ -3163,7 +3179,7 @@ Cypress.Commands.add(delete confirmBody.setup_future_usage;}- if (reqData?.split_payments && isStripeConnect(globalState)) {+ if (reqData?.split_payments && supportsSplitPayments(globalState)) {confirmBody.split_payments = reqData.split_payments;}@@ -3965,7 +3981,7 @@ Cypress.Commands.add(}}- if (reqData?.split_payments && isStripeConnect(globalState)) {+ if (reqData?.split_payments && supportsSplitPayments(globalState)) {createConfirmPaymentBody.split_payments = reqData.split_payments;}@@ -4880,7 +4896,7 @@ Cypress.Commands.add(// Include split_payments only for stripeconnect connector// This handles Stripe Connect flows where split_payments is defined in the connector config- if (reqData?.split_payments && isStripeConnect(globalState)) {+ if (reqData?.split_payments && supportsSplitPayments(globalState)) {requestBody.split_payments = reqData.split_payments;}@@ -5153,7 +5169,7 @@ Cypress.Commands.add(// Include split_payments only for stripeconnect connector// This handles Stripe Connect flows where split_payments is defined in the connector config- if (reqData?.split_payments && isStripeConnect(globalState)) {+ if (reqData?.split_payments && supportsSplitPayments(globalState)) {requestBody.split_payments = reqData.split_payments;}diff --git a/cypress-tests/cypress/utils/featureFlags.js b/cypress-tests/cypress/utils/featureFlags.jsindex ca4a5fb0c3..d82f532a24 100644--- a/cypress-tests/cypress/utils/featureFlags.js+++ b/cypress-tests/cypress/utils/featureFlags.js@@ -197,7 +197,27 @@ export function determineConnectorConfig(config) {export function execConfig(configs) {if (configs?.DELAY?.STATUS && String(Cypress.env("MOCK_SERVER")) !== "true") {- cy.wait(configs.DELAY.TIMEOUT);+ // Chunk the cooldown into 5s increments (instead of one silent block)+ // so progress is visible in the test log. Total wait time is unchanged.+ const POLL_INTERVAL = 5000;+ const totalTimeout = configs.DELAY.TIMEOUT;+ const fullIntervals = Math.floor(totalTimeout / POLL_INTERVAL);+ const remainder = totalTimeout % POLL_INTERVAL;++ for (let i = 0; i < fullIntervals; i++) {+ cy.wait(POLL_INTERVAL);+ cy.task(+ "cli_log",+ `DELAY: waited ${(i + 1) * POLL_INTERVAL}ms of ${totalTimeout}ms`+ );+ }+ if (remainder > 0) {+ cy.wait(remainder);+ cy.task(+ "cli_log",+ `DELAY: waited ${totalTimeout}ms of ${totalTimeout}ms`+ );+ }}const connectorType = determineConnectorConfig(configs);