Skip to content

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

test(cypress): add bank debit coverage for stripe (#12377)

HS-QUALIBOTdb02b4f06a53
diff --git a/.github/workflows/cypress-tests-runner.yml b/.github/workflows/cypress-tests-runner.yml
index c940ff02bd..1706add02a 100644
--- a/.github/workflows/cypress-tests-runner.yml
+++ b/.github/workflows/cypress-tests-runner.yml
@@ -291,7 +291,7 @@ jobs:
CONNECTOR_AUTH_PASSPHRASE: ${{ secrets.CONNECTOR_AUTH_PASSPHRASE }}
CONNECTOR_CREDS_S3_BUCKET_URI: ${{ secrets.CONNECTOR_CREDS_S3_BUCKET_URI}}
DESTINATION_FILE_NAME: "creds.json.gpg"
- S3_SOURCE_FILE_NAME: "68bba6ea-3c75-440f-9c4b-00a30ecbb79d.json.gpg"
+ S3_SOURCE_FILE_NAME: "e8883809-7b5d-4ab1-b54d-8709db59e8b1.json.gpg"
shell: bash
run: |
mkdir -p ".github/secrets" ".github/test"
@@ -579,7 +579,7 @@ jobs:
CONNECTOR_AUTH_PASSPHRASE: ${{ secrets.CONNECTOR_AUTH_PASSPHRASE }}
CONNECTOR_CREDS_S3_BUCKET_URI: ${{ secrets.CONNECTOR_CREDS_S3_BUCKET_URI}}
DESTINATION_FILE_NAME: "creds.json.gpg"
- S3_SOURCE_FILE_NAME: "68bba6ea-3c75-440f-9c4b-00a30ecbb79d.json.gpg"
+ S3_SOURCE_FILE_NAME: "5da926cb-68c9-405b-889b-0d3da40922ac.json.gpg"
shell: bash
run: |
mkdir -p ".github/secrets" ".github/test"
@@ -845,7 +845,7 @@ jobs:
CONNECTOR_AUTH_PASSPHRASE: ${{ secrets.CONNECTOR_AUTH_PASSPHRASE }}
CONNECTOR_CREDS_S3_BUCKET_URI: ${{ secrets.CONNECTOR_CREDS_S3_BUCKET_URI }}
DESTINATION_FILE_NAME: "creds.json.gpg"
- S3_SOURCE_FILE_NAME: "68bba6ea-3c75-440f-9c4b-00a30ecbb79d.json.gpg"
+ S3_SOURCE_FILE_NAME: "5da926cb-68c9-405b-889b-0d3da40922ac.json.gpg"
shell: bash
run: |
mkdir -p ".github/secrets" ".github/test"
@@ -1281,7 +1281,7 @@ jobs:
CONNECTOR_AUTH_PASSPHRASE: ${{ secrets.CONNECTOR_AUTH_PASSPHRASE }}
CONNECTOR_CREDS_S3_BUCKET_URI: ${{ secrets.CONNECTOR_CREDS_S3_BUCKET_URI}}
DESTINATION_FILE_NAME: "creds.json.gpg"
- S3_SOURCE_FILE_NAME: "68bba6ea-3c75-440f-9c4b-00a30ecbb79d.json.gpg"
+ S3_SOURCE_FILE_NAME: "5da926cb-68c9-405b-889b-0d3da40922ac.json.gpg"
shell: bash
run: |
mkdir -p ".github/secrets" ".github/test"
@@ -1691,7 +1691,7 @@ jobs:
CONNECTOR_AUTH_PASSPHRASE: ${{ secrets.CONNECTOR_AUTH_PASSPHRASE }}
CONNECTOR_CREDS_S3_BUCKET_URI: ${{ secrets.CONNECTOR_CREDS_S3_BUCKET_URI}}
DESTINATION_FILE_NAME: "creds.json.gpg"
- S3_SOURCE_FILE_NAME: "68bba6ea-3c75-440f-9c4b-00a30ecbb79d.json.gpg"
+ S3_SOURCE_FILE_NAME: "5da926cb-68c9-405b-889b-0d3da40922ac.json.gpg"
shell: bash
run: |
mkdir -p ".github/secrets" ".github/test"
diff --git a/cypress-tests/README.md b/cypress-tests/README.md
index 0518a271f5..5dd8070fc2 100644
--- a/cypress-tests/README.md
+++ b/cypress-tests/README.md
@@ -523,7 +523,7 @@ This will redirect all Silverflow API calls from Hyperswitch to your local mock
- There are some use cases where a connector supports a feature that requires a different set of API keys (example: Network transaction ID for Stripe expects a different API Key to be passed). This forces the need for having multiple credentials that serves different use cases
- This basically means that a connector can have multiple credentials
-- At present the maximum number of credentials that can be supported is `2`
+- Additional credentials can be added using the `connector_N` format, for example `connector_3`, `connector_4`, and so on.
- The `creds.json` file should be structured to support multiple credentials for such connectors. The `creds.json` file should be structured as follows:
```json
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Adyen.js b/cypress-tests/cypress/e2e/configs/Payment/Adyen.js
index acbd496f81..5356467b67 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Adyen.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Adyen.js
@@ -3202,40 +3202,16 @@ export const connectorDetails = {
bank_debit_pm: {
PaymentIntent: (paymentMethodType) => {
- if (paymentMethodType === "Ach") {
- return {
- Request: {
- currency: "USD",
- },
- Response: {
- status: 200,
- body: {
- status: "requires_payment_method",
- },
- },
- };
- }
- if (paymentMethodType === "Sepa") {
- return {
- Request: {
- currency: "EUR",
- },
- Response: {
- status: 200,
- body: {
- status: "requires_payment_method",
- },
- },
- };
- }
- const currencyMap = {
- Becs: "AUD",
- Bacs: "GBP",
- };
+ const currencyMap = { Sepa: "EUR", Ach: "USD", Becs: "AUD", Bacs: "GBP" };
return {
+ ...(paymentMethodType === "Ach"
+ ? { Configs: { TRIGGER_SKIP: true } }
+ : {}),
Request: {
currency: currencyMap[paymentMethodType] || "USD",
- setup_future_usage: "off_session",
+ ...(paymentMethodType !== "Sepa"
+ ? { setup_future_usage: "off_session" }
+ : {}),
},
Response: {
status: 200,
@@ -3269,6 +3245,7 @@ export const connectorDetails = {
first_name: "John",
last_name: "Doe",
},
+ email: "[email protected]",
},
customer_acceptance: customerAcceptance,
},
@@ -3351,6 +3328,7 @@ export const connectorDetails = {
first_name: "John",
last_name: "Doe",
},
+ email: "[email protected]",
},
customer_acceptance: customerAcceptance,
currency: "USD",
@@ -3387,6 +3365,7 @@ export const connectorDetails = {
first_name: "John",
last_name: "Doe",
},
+ email: "[email protected]",
},
customer_acceptance: customerAcceptance,
mandate_data: {
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Commons.js b/cypress-tests/cypress/e2e/configs/Payment/Commons.js
index db8a1f2da1..de652ca42c 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Commons.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Commons.js
@@ -207,6 +207,38 @@ export const fullNameRequiredField = {
export const billingRequiredField = {};
+// Bank debit specific billing addresses - derived from standardBillingAddress
+export const sepaBillingAddress = {
+ address: {
+ ...standardBillingAddress.address,
+ city: "Amsterdam",
+ state: "North Holland",
+ zip: "1012",
+ country: "NL",
+ },
+ email: "[email protected]",
+};
+
+export const achBillingAddress = {
+ address: {
+ ...standardBillingAddress.address,
+ city: "San Francisco",
+ state: "California",
+ },
+ email: "[email protected]",
+};
+
+export const bacsBillingAddress = {
+ address: {
+ ...standardBillingAddress.address,
+ city: "London",
+ state: "England",
+ zip: "SW1A 1AA",
+ country: "GB",
+ },
+ email: "[email protected]",
+};
+
export const payment_methods_enabled = [
{
payment_method: "bank_redirect",
@@ -1450,18 +1482,56 @@ export const connectorDetails = {
},
},
}),
- BankdebitMIT: {
+ get MandateSingleUseSepa() {
+ return this.Sepa;
+ },
+ get MandateSingleUseBecs() {
+ return this.Becs;
+ },
+ get MandateSingleUseAch() {
+ return this.Ach;
+ },
+ get MandateSingleUseBacs() {
+ return this.Bacs;
+ },
+ MITAutoCaptureSepa: getCustomExchange({
Request: {
+ amount: 6540,
+ off_session: true,
+ confirm: true,
currency: "EUR",
+ },
+ }),
+ MITAutoCaptureBecs: getCustomExchange({
+ Request: {
+ amount: 6540,
off_session: true,
+ confirm: true,
+ currency: "AUD",
},
- Response: {
- status: 200,
- body: {
- status: "succeeded",
- },
+ }),
+ MITAutoCaptureAch: getCustomExchange({
+ Request: {
+ amount: 6540,
+ off_session: true,
+ confirm: true,
+ currency: "USD",
},
- },
+ }),
+ MITAutoCaptureBacs: getCustomExchange({
+ Request: {
+ amount: 6540,
+ off_session: true,
+ confirm: true,
+ currency: "GBP",
+ },
+ }),
+ BankdebitMIT: getCustomExchange({
+ Request: {
+ currency: "EUR",
+ off_session: true,
+ },
+ }),
SepaMandate: getCustomExchange({
Request: {
payment_method: "bank_debit",
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Stripe.js b/cypress-tests/cypress/e2e/configs/Payment/Stripe.js
index 24d0327cd3..1fc6fba97b 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Stripe.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Stripe.js
@@ -57,6 +57,27 @@ const multiUseMandateData = {
},
};
+const onlineCustomerAcceptance = {
+ ...customerAcceptance,
+ acceptance_type: "online",
+};
+
+const connectorCredential = (connectorIndex) => ({
+ value: `connector_${connectorIndex}`,
+});
+
+const bankDebitCredentialIndex = {
+ Sepa: 5,
+ Ach: 1,
+ Becs: 4,
+ Bacs: 3,
+};
+
+const bankDebitConnectorCredential = (paymentMethodType) =>
+ connectorCredential(
+ bankDebitCredentialIndex[paymentMethodType] ?? bankDebitCredentialIndex.Sepa
+ );
+
const payment_method_data_3ds = {
card: {
last4: "3155",
@@ -1422,6 +1443,502 @@ export const connectorDetails = {
},
}),
},
+ bank_debit_pm: {
+ PaymentIntent: (paymentMethodType) => {
+ const currencyMap = { Sepa: "EUR", Ach: "USD", Becs: "AUD", Bacs: "GBP" };
+ return {
+ Configs: {
+ CONNECTOR_CREDENTIAL: bankDebitConnectorCredential(paymentMethodType),
+ ...(paymentMethodType === "Bacs" ? { TRIGGER_SKIP: true } : {}),
+ },
+ Request: {
+ currency: currencyMap[paymentMethodType] || "USD",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ },
+ },
+ };
+ },
+ Sepa: {
+ Configs: {
+ CONNECTOR_CREDENTIAL: bankDebitConnectorCredential("Sepa"),
+ },
+ Request: {
+ payment_method: "bank_debit",
+ payment_method_type: "sepa",
+ payment_method_data: {
+ bank_debit: {
+ sepa_bank_debit: {
+ iban: "DE89370400440532013000",
+ bank_account_holder_name: "Test Account",
+ },
+ },
+ },
+ billing: {
+ address: {
+ first_name: "Test",
+ last_name: "Account",
+ country: "FR",
+ },
+ email: "[email protected]",
+ },
+ mandate_data: {
+ customer_acceptance: onlineCustomerAcceptance,
+ mandate_type: {
+ multi_use: {
+ amount: 1000,
+ currency: "EUR",
+ start_date: "2025-04-21T00:00:00Z",
+ end_date: "2028-05-21T00:00:00Z",
+ metadata: {
+ frequency: "13",
+ },
+ },
+ },
+ },
+ setup_future_usage: "off_session",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "processing",
+ },
+ },
+ },
+ Becs: {
+ Configs: {
+ CONNECTOR_CREDENTIAL: bankDebitConnectorCredential("Becs"),
+ },
+ Request: {
+ currency: "AUD",
+ payment_method: "bank_debit",
+ payment_method_type: "becs",
+ payment_method_data: {
+ bank_debit: {
+ becs_bank_debit: {
+ bsb_number: "000000",
+ account_number: "000123456",
+ bank_account_holder_name: "Test Account",
+ },
+ },
+ },
+ billing: {
+ address: {
+ first_name: "Test",
+ last_name: "Account",
+ country: "AU",
+ line1: "123 Test St",
+ zip: "2000",
+ },
+ email: "[email protected]",
+ },
+ mandate_data: {
+ customer_acceptance: onlineCustomerAcceptance,
+ mandate_type: {
+ multi_use: {
+ amount: 1000,
+ currency: "AUD",
+ start_date: "2025-04-21T00:00:00Z",
+ end_date: "2028-05-21T00:00:00Z",
+ metadata: {
+ frequency: "13",
+ },
+ },
+ },
+ },
+ setup_future_usage: "off_session",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "processing",
+ },
+ },
+ },
+ Ach: {
+ Configs: {
+ LOCAL_VAULT_REQUIRED: true,
+ },
+ 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: "Test Account",
+ },
+ },
+ },
+ billing: {
+ address: {
+ country: "US",
+ first_name: "Test",
+ last_name: "Account",
+ },
+ email: "[email protected]",
+ },
+ mandate_data: {
+ customer_acceptance: onlineCustomerAcceptance,
+ mandate_type: {
+ multi_use: {
+ amount: 6000,
+ currency: "USD",
+ },
+ },
+ },
+ setup_future_usage: "off_session",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ },
+ Bacs: {
+ Configs: {
+ CONNECTOR_CREDENTIAL: bankDebitConnectorCredential("Bacs"),
+ },
+ Request: {
+ payment_method: "bank_debit",
+ payment_method_type: "bacs",
+ payment_method_data: {
+ bank_debit: {
+ bacs_bank_debit: {
+ account_number: "00012345",
+ sort_code: "108800",
+ bank_account_holder_name: "Test Account",
+ },
+ },
+ },
+ billing: {
+ address: {
+ line1: "1 Oxford Street",
+ city: "London",
+ zip: "SW1A 1AA",
+ country: "GB",
+ first_name: "Test",
+ last_name: "Account",
+ },
+ email: "[email protected]",
+ },
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "processing",
+ },
+ },
+ },
+ MandateSingleUseAch: {
+ Configs: {
+ CONNECTOR_CREDENTIAL: bankDebitConnectorCredential("Ach"),
+ 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: "Test Account",
+ },
+ },
+ },
+ mandate_data: {
+ customer_acceptance: onlineCustomerAcceptance,
+ mandate_type: {
+ multi_use: {
+ amount: 8000,
+ currency: "USD",
+ },
+ },
+ },
+ setup_future_usage: "off_session",
+ billing: {
+ address: {
+ country: "US",
+ first_name: "Test",
+ last_name: "Account",
+ },
+ email: "[email protected]",
+ },
+ payment_type: "new_mandate",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ },
+ MandateSingleUseBacs: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ CONNECTOR_CREDENTIAL: bankDebitConnectorCredential("Bacs"),
+ },
+ Request: {
+ amount: 6540,
+ payment_method: "bank_debit",
+ payment_method_type: "bacs",
+ currency: "GBP",
+ payment_method_data: {
+ bank_debit: {
+ bacs_bank_debit: {
+ account_number: "00012345",
+ sort_code: "108800",
+ bank_account_holder_name: "Test Account",
+ },
+ },
+ },
+ mandate_data: {
+ customer_acceptance: onlineCustomerAcceptance,
+ mandate_type: {
+ multi_use: {
+ amount: 1000,
+ currency: "GBP",
+ },
+ },
+ },
+ setup_future_usage: "off_session",
+ billing: {
+ address: {
+ line1: "1 Oxford Street",
+ city: "London",
+ zip: "SW1A 1AA",
+ country: "GB",
+ first_name: "Test",
+ last_name: "Account",
+ },
+ email: "[email protected]",
+ },
+ payment_type: "new_mandate",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "processing",
+ },
+ },
+ },
+ MandateSingleUseSepa: {
+ Configs: {
+ CONNECTOR_CREDENTIAL: bankDebitConnectorCredential("Sepa"),
+ },
+ Request: {
+ amount: 6540,
+ payment_method: "bank_debit",
+ payment_method_type: "sepa",
+ currency: "EUR",
+ payment_method_data: {
+ bank_debit: {
+ sepa_bank_debit: {
+ iban: "DE89370400440532013000",
+ bank_account_holder_name: "Test Account",
+ },
+ },
+ },
+ mandate_data: {
+ customer_acceptance: onlineCustomerAcceptance,
+ mandate_type: {
+ multi_use: {
+ amount: 8000,
+ currency: "EUR",
+ start_date: "2025-04-21T00:00:00Z",
+ end_date: "2028-05-21T00:00:00Z",
+ metadata: {
+ frequency: "13",
+ },
+ },
+ },
+ },
+ setup_future_usage: "off_session",
+ billing: {
+ address: {
+ first_name: "Test",
+ last_name: "Account",
+ country: "FR",
+ },
+ email: "[email protected]",
+ },
+ payment_type: "new_mandate",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "processing",
+ },
+ },
+ },
+ MandateSingleUseBecs: {
+ Configs: {
+ CONNECTOR_CREDENTIAL: bankDebitConnectorCredential("Becs"),
+ },
+ Request: {
+ amount: 6540,
+ payment_method: "bank_debit",
+ payment_method_type: "becs",
+ currency: "AUD",
+ payment_method_data: {
+ bank_debit: {
+ becs_bank_debit: {
+ bsb_number: "000000",
+ account_number: "000123456",
+ bank_account_holder_name: "Test Account",
+ },
+ },
+ },
+ mandate_data: {
+ customer_acceptance: onlineCustomerAcceptance,
+ mandate_type: {
+ multi_use: {
+ amount: 8000,
+ currency: "AUD",
+ start_date: "2025-04-21T00:00:00Z",
+ end_date: "2028-05-21T00:00:00Z",
+ metadata: {
+ frequency: "13",
+ },
+ },
+ },
+ },
+ setup_future_usage: "off_session",
+ billing: {
+ address: {
+ first_name: "Test",
+ last_name: "Account",
+ country: "AU",
+ line1: "123 Test St",
+ zip: "2000",
+ },
+ email: "[email protected]",
+ },
+ payment_type: "new_mandate",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "processing",
+ },
+ },
+ },
+ MITAutoCaptureSepa: {
+ Configs: {
+ CONNECTOR_CREDENTIAL: bankDebitConnectorCredential("Sepa"),
+ },
+ Request: {
+ amount: 6540,
+ off_session: true,
+ confirm: true,
+ currency: "EUR",
+ payment_method: "bank_debit",
+ payment_method_type: "sepa",
+ payment_method_data: {
+ bank_debit: {
+ sepa_bank_debit: {
+ iban: "DE89370400440532013000",
+ bank_account_holder_name: "Test Account",
+ },
+ },
+ },
+ billing: {
+ address: {
+ first_name: "Test",
+ last_name: "Account",
+ country: "FR",
+ },
+ email: "[email protected]",
+ },
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "processing",
+ },
+ },
+ },
+ MITAutoCaptureBecs: {
+ Configs: {
+ CONNECTOR_CREDENTIAL: bankDebitConnectorCredential("Becs"),
+ },
+ Request: {
+ amount: 6540,
+ off_session: true,
+ confirm: true,
+ currency: "AUD",
+ payment_method: "bank_debit",
+ payment_method_type: "becs",
+ payment_method_data: {
+ bank_debit: {
+ becs_bank_debit: {
+ bsb_number: "000000",
+ account_number: "000123456",
+ bank_account_holder_name: "Test Account",
+ },
+ },
+ },
+ billing: {
+ address: {
+ first_name: "Test",
+ last_name: "Account",
+ country: "AU",
+ line1: "123 Test St",
+ zip: "2000",
+ },
+ email: "[email protected]",
+ },
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "processing",
+ },
+ },
+ },
+ MITAutoCaptureAch: {
+ Configs: {
+ CONNECTOR_CREDENTIAL: bankDebitConnectorCredential("Ach"),
+ },
+ Request: {
+ amount: 6540,
+ off_session: true,
+ confirm: true,
+ currency: "USD",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "processing",
+ },
+ },
+ },
+ MITAutoCaptureBacs: {
+ Configs: {
+ CONNECTOR_CREDENTIAL: bankDebitConnectorCredential("Bacs"),
+ },
+ Request: {
+ amount: 6540,
+ off_session: true,
+ confirm: true,
+ currency: "GBP",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "processing",
+ },
+ },
+ },
+ },
auth_service_eligibility: {
// Storage flag does not affect authentication outcome — both enabled and
// disabled flows produce the same 3DS challenge. Distinction is only
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
index 912be54e60..6b2cfdc956 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
@@ -230,6 +230,7 @@ export function handleMultipleConnectors(keys) {
MULTIPLE_CONNECTORS: {
status: true,
count: keys.length,
+ connectorCredentials: keys,
},
};
}
@@ -406,6 +407,49 @@ export function createMerchantConnectorAccount(
}
}
+export function createBusinessProfilesAndMerchantConnectorAccounts(
+ paymentType,
+ createMerchantConnectorAccountBody,
+ createBusinessProfileBody,
+ globalState,
+ paymentMethodsEnabled
+) {
+ const connectorCount = globalState.get("MULTIPLE_CONNECTORS")?.count || 0;
+
+ if (connectorCount <= 1) {
+ cy.task(
+ "cli_log",
+ "Skipping multiple connector account setup; no multiple connector credentials configured."
+ );
+ return;
+ }
+
+ for (
+ let connectorIndex = 2;
+ connectorIndex <= connectorCount;
+ connectorIndex++
+ ) {
+ const multipleConnector = {
+ nextConnector: true,
+ value: `connector_${connectorIndex}`,
+ };
+
+ createBusinessProfile(
+ structuredClone(createBusinessProfileBody),
+ globalState,
+ multipleConnector
+ );
+
+ createMerchantConnectorAccount(
+ paymentType,
+ structuredClone(createMerchantConnectorAccountBody),
+ globalState,
+ paymentMethodsEnabled,
+ multipleConnector
+ );
+ }
+}
+
export function updateBusinessProfile(
updateBusinessProfileBody,
is_connector_agnostic_enabled,
@@ -552,7 +596,14 @@ export const CONNECTOR_LISTS = {
"paypal",
"stripe",
],
- BANK_DEBIT: ["adyen", "novalnet", "payload", "wellsfargo", "stax"], // payload verified as working
+ BANK_DEBIT: [
+ "adyen",
+ "novalnet",
+ "payload",
+ "stax",
+ "stripe",
+ "wellsfargo",
+ ], // payload verified as working
BANK_REDIRECT_BANCONTACT: ["adyen", "stripe"],
BANK_REDIRECT_MANDATE: ["adyen"],
BLUECODE_WALLET: ["calida"],
diff --git a/cypress-tests/cypress/e2e/spec/Payment/03-ConnectorCreate.cy.js b/cypress-tests/cypress/e2e/spec/Payment/03-ConnectorCreate.cy.js
index cde959ad8e..1ab543a6e3 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/03-ConnectorCreate.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/03-ConnectorCreate.cy.js
@@ -24,27 +24,13 @@ describe("Connector Account Create flow test", () => {
);
});
- // subsequent profile and mca ids should check for the existence of multiple connectors
- context(
- "Create another business profile and merchant connector account if MULTIPLE_CONNECTORS flag is true",
- () => {
- it("Create business profile", () => {
- utils.createBusinessProfile(
- fixtures.businessProfile.bpCreate,
- globalState,
- { nextConnector: true }
- );
- });
-
- it("Create merchant connector account", () => {
- utils.createMerchantConnectorAccount(
- "payment_processor",
- fixtures.createConnectorBody,
- globalState,
- payment_methods_enabled,
- { nextConnector: true }
- );
- });
- }
- );
+ it("Create multiple business profiles and merchant connector accounts", () => {
+ utils.createBusinessProfilesAndMerchantConnectorAccounts(
+ "payment_processor",
+ fixtures.createConnectorBody,
+ fixtures.businessProfile.bpCreate,
+ globalState,
+ payment_methods_enabled
+ );
+ });
});
diff --git a/cypress-tests/cypress/e2e/spec/Payment/45-BankDebit.cy.js b/cypress-tests/cypress/e2e/spec/Payment/45-BankDebit.cy.js
index bef6068994..5ad4453af2 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/45-BankDebit.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/45-BankDebit.cy.js
@@ -5,9 +5,35 @@ import getConnectorDetails, {
shouldIncludeConnector,
} from "../../configs/Payment/Utils";
import * as utils from "../../configs/Payment/Utils";
+import { isLocalhost } from "../../../utils/RequestBodyUtils";
let globalState;
+function isVaultMarkedAvailable() {
+ const vaultAvailable = Cypress.env("VAULT_AVAILABLE");
+ return vaultAvailable === true || vaultAvailable === "true";
+}
+
+function skipIfLocalVaultUnavailable(testContext, testName, data) {
+ const connectorId = globalState.get("connectorId");
+ const baseUrl = globalState.get("baseUrl");
+ const localVaultRequired = data?.Configs?.LOCAL_VAULT_REQUIRED === true;
+
+ if (
+ !localVaultRequired ||
+ !isLocalhost(baseUrl) ||
+ isVaultMarkedAvailable()
+ ) {
+ return;
+ }
+
+ cy.task(
+ "cli_log",
+ `Skipping ${testName} for ${connectorId} on localhost. Set CYPRESS_VAULT_AVAILABLE=true when vault is available locally.`
+ );
+ testContext.skip();
+}
+
describe("Bank Debit tests", () => {
before("seed global state", function () {
let skip = false;
@@ -32,11 +58,11 @@ describe("Bank Debit tests", () => {
});
});
- after("flush global state", () => {
+ afterEach("flush global state", () => {
cy.task("setGlobalState", globalState.data);
});
- context("SEPA Bank Debit - Create and Confirm flow", () => {
+ context("SEPA Bank Debit Create and Confirm flow test", () => {
it("Create Payment Intent -> List Merchant Payment Methods -> Confirm SEPA Bank Debit -> Retrieve Payment", () => {
let shouldContinue = true;
@@ -92,11 +118,21 @@ describe("Bank Debit tests", () => {
"bank_debit_pm"
]["Sepa"];
cy.retrievePaymentCallTest({ globalState, data: confirmData });
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
});
});
});
- context("ACH Bank Debit - Create and Confirm flow", () => {
+ context("ACH Bank Debit Create and Confirm flow test", () => {
+ before(function () {
+ const achData = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_debit_pm"
+ ]["Ach"];
+ skipIfLocalVaultUnavailable(this, "ACH Bank Debit tests", achData);
+ });
+
it("Create Payment Intent -> List Merchant Payment Methods -> Confirm ACH Bank Debit -> Retrieve Payment", () => {
let shouldContinue = true;
@@ -152,53 +188,46 @@ describe("Bank Debit tests", () => {
"bank_debit_pm"
]["Ach"];
cy.retrievePaymentCallTest({ globalState, data: confirmData });
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
});
});
});
- context("BECS Bank Debit - Create and Confirm flow", () => {
- it("Create Payment Intent -> List Merchant Payment Methods -> Confirm BECS Bank Debit -> Retrieve Payment", () => {
+ context("BECS Bank Debit Create and Confirm flow test", () => {
+ before(function () {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_debit_pm"
+ ]["Becs"];
+ if (!utils.should_continue_further(data)) {
+ this.skip();
+ }
+ });
+
+ it("Create and Confirm BECS Bank Debit -> Retrieve Payment", () => {
let shouldContinue = true;
- cy.step("Create Payment Intent for BECS", () => {
+ cy.step("Create and Confirm BECS Bank Debit", () => {
const data = getConnectorDetails(globalState.get("connectorId"))[
"bank_debit_pm"
- ]["PaymentIntent"]("Becs");
- cy.createPaymentIntentTest(
- fixtures.createPaymentBody,
- data,
- "no_three_ds",
- "automatic",
- globalState
- );
+ ]["Becs"];
if (!utils.should_continue_further(data)) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Create and Confirm BECS Bank Debit"
+ );
shouldContinue = false;
- }
- });
-
- cy.step("List Merchant Payment Methods", () => {
- if (!shouldContinue) {
- cy.task("cli_log", "Skipping step: List Merchant Payment Methods");
return;
}
- cy.paymentMethodsCallTest(globalState);
- });
-
- cy.step("Confirm BECS Bank Debit", () => {
- if (!shouldContinue) {
- cy.task("cli_log", "Skipping step: Confirm BECS Bank Debit");
- return;
- }
- const confirmData = getConnectorDetails(globalState.get("connectorId"))[
- "bank_debit_pm"
- ]["Becs"];
- cy.confirmCallTest(
- fixtures.confirmBody,
- confirmData,
- true,
+ cy.createConfirmPaymentTest(
+ fixtures.createConfirmPaymentBody,
+ data,
+ "no_three_ds",
+ "automatic",
globalState
);
- if (!utils.should_continue_further(confirmData)) {
+ if (!utils.should_continue_further(data)) {
shouldContinue = false;
}
});
@@ -208,15 +237,15 @@ describe("Bank Debit tests", () => {
cy.task("cli_log", "Skipping step: Retrieve Payment");
return;
}
- const confirmData = getConnectorDetails(globalState.get("connectorId"))[
+ const data = getConnectorDetails(globalState.get("connectorId"))[
"bank_debit_pm"
]["Becs"];
- cy.retrievePaymentCallTest({ globalState, data: confirmData });
+ cy.retrievePaymentCallTest({ globalState, data: data });
});
});
});
- context("BACS Bank Debit - Create and Confirm flow", () => {
+ context("BACS Bank Debit Create and Confirm flow test", () => {
it("Create Payment Intent -> List Merchant Payment Methods -> Confirm BACS Bank Debit -> Retrieve Payment", () => {
let shouldContinue = true;
@@ -272,106 +301,249 @@ describe("Bank Debit tests", () => {
"bank_debit_pm"
]["Bacs"];
cy.retrievePaymentCallTest({ globalState, data: confirmData });
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
});
});
});
- context(
- "SEPA Bank Debit - NoThreeDS Create + Confirm Automatic CIT and MIT payment flow test",
- () => {
+ context("SEPA Bank Debit Mandate flow test", () => {
+ it("CIT mandate creation -> MIT mandate reuse for SEPA", () => {
let shouldContinue = true;
- beforeEach(function () {
- if (!shouldContinue) {
- this.skip();
+ cy.step("CIT mandate creation for SEPA", () => {
+ // citForMandatesCallTest params: requestBody, data, amount, confirm, capture_method, payment_type, globalState
+ // data contains connector-specific Request (amount, currency, bank details) and Response (expected status)
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_debit_pm"
+ ]["MandateSingleUseSepa"];
+ if (!utils.should_continue_further(data)) {
+ cy.task("cli_log", "Skipping step: CIT mandate creation for SEPA");
+ shouldContinue = false;
+ return;
+ }
+ cy.citForMandatesCallTest(
+ fixtures.citConfirmBody,
+ data,
+ data.Request.amount,
+ true,
+ "automatic",
+ "new_mandate",
+ globalState
+ );
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
}
});
- it("create-customer-call-test", () => {
- cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
+ cy.step("MIT mandate reuse for SEPA", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: MIT mandate reuse for SEPA");
+ return;
+ }
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_debit_pm"
+ ]["MITAutoCaptureSepa"];
+ cy.mitForMandatesCallTest(
+ fixtures.mitConfirmBody,
+ data,
+ data.Request.amount,
+ true,
+ "automatic",
+ globalState
+ );
});
+ });
+ });
- it("sepa-bank-debit-mandate-cit-test", () => {
+ context("BECS Bank Debit Mandate flow test", () => {
+ before(function () {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_debit_pm"
+ ]["MandateSingleUseBecs"];
+ if (!utils.should_continue_further(data)) {
+ this.skip();
+ }
+ });
+
+ it("CIT mandate creation -> MIT mandate reuse for BECS", () => {
+ let shouldContinue = true;
+
+ cy.step("CIT mandate creation for BECS", () => {
+ // citForMandatesCallTest parameter mapping:
+ // 1. fixtures.citConfirmBody -> requestBody (base template with default mandate fields)
+ // 2. data -> data object from connector config containing Request and Response
+ // 3. data.Request.amount -> amount (payment amount in cents, e.g., 8000 = $80.00)
+ // 4. true -> confirm (whether to confirm payment immediately)
+ // 5. "automatic" -> capture_method (how to capture funds: automatic/manual)
+ // 6. "new_mandate" -> payment_type (creates new mandate for bank debit)
+ // 7. globalState -> globalState (shared state to store payment_id, mandate_id)
+ //
+ // data structure comes from Adyen.js/Stripe.js bank_debit_pm config:
+ // data.Request: {payment_method, payment_method_type, payment_method_data, billing, mandate_data, ...}
+ // data.Response: {status: "processing"} - expected API response status
const data = getConnectorDetails(globalState.get("connectorId"))[
"bank_debit_pm"
- ]["SepaMandate"];
-
+ ]["MandateSingleUseBecs"];
+ if (!utils.should_continue_further(data)) {
+ cy.task("cli_log", "Skipping step: CIT mandate creation for BECS");
+ shouldContinue = false;
+ return;
+ }
cy.citForMandatesCallTest(
fixtures.citConfirmBody,
data,
- 6000,
+ data.Request.amount,
true,
"automatic",
"new_mandate",
globalState
);
-
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
- });
-
- it("retrieve-mandate-call-test", () => {
- cy.mandateGETCallTest(globalState);
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
});
- it("sepa-bank-debit-mandate-mit-test", () => {
+ cy.step("MIT mandate reuse for BECS", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: MIT mandate reuse for BECS");
+ return;
+ }
const data = getConnectorDetails(globalState.get("connectorId"))[
"bank_debit_pm"
- ]["BankdebitMIT"];
-
+ ]["MITAutoCaptureBecs"];
cy.mitForMandatesCallTest(
fixtures.mitConfirmBody,
data,
- 6000,
+ data.Request.amount,
true,
"automatic",
globalState
);
-
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
});
+ });
+ });
- it("list-mandate-call-test", () => {
- cy.listMandateCallTest(globalState);
- });
+ context("ACH Bank Debit Mandate flow test", () => {
+ before(function () {
+ const mandateData = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_debit_pm"
+ ]["MandateSingleUseAch"];
+ skipIfLocalVaultUnavailable(
+ this,
+ "ACH Bank Debit Mandate tests",
+ mandateData
+ );
+ });
- it("revoke-mandate-call-test", () => {
- cy.revokeMandateCallTest(globalState);
- });
- }
- );
+ it("CIT mandate creation -> MIT mandate reuse for ACH", () => {
+ let shouldContinue = true;
- context(
- "BACS Bank Debit - NoThreeDS Create + Confirm Automatic CIT payment flow test",
- () => {
- const shouldContinue = true;
+ cy.step("CIT mandate creation for ACH", () => {
+ // citForMandatesCallTest params: requestBody, data, amount, confirm, capture_method, payment_type, globalState
+ // data contains connector-specific Request (amount, currency, bank details) and Response (expected status)
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_debit_pm"
+ ]["MandateSingleUseAch"];
+ if (!utils.should_continue_further(data)) {
+ cy.task("cli_log", "Skipping step: CIT mandate creation for ACH");
+ shouldContinue = false;
+ return;
+ }
+ cy.citForMandatesCallTest(
+ fixtures.citConfirmBody,
+ data,
+ data.Request.amount,
+ true,
+ "automatic",
+ "new_mandate",
+ globalState
+ );
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
- beforeEach(function () {
+ cy.step("Verify ACH microdeposits for mandate", () => {
if (!shouldContinue) {
- this.skip();
+ cy.task(
+ "cli_log",
+ "Skipping step: Verify ACH microdeposits for mandate"
+ );
+ return;
}
+ cy.verifyAchMicrodepositCallTest(globalState);
});
- it("bacs-create-customer-call-test", () => {
- cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
+ cy.step("MIT mandate reuse for ACH", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: MIT mandate reuse for ACH");
+ return;
+ }
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_debit_pm"
+ ]["MITAutoCaptureAch"];
+ cy.mitForMandatesCallTest(
+ fixtures.mitConfirmBody,
+ data,
+ data.Request.amount,
+ true,
+ "automatic",
+ globalState
+ );
});
+ });
+ });
+
+ context("BACS Bank Debit Mandate flow test", () => {
+ it("CIT mandate creation -> MIT mandate reuse for BACS", () => {
+ let shouldContinue = true;
- it("bacs-bank-debit-mandate-cit-test", () => {
+ cy.step("CIT mandate creation for BACS", () => {
const data = getConnectorDetails(globalState.get("connectorId"))[
"bank_debit_pm"
- ]["Bacs"];
-
+ ]["MandateSingleUseBacs"];
+ if (!utils.should_continue_further(data)) {
+ cy.task("cli_log", "Skipping step: CIT mandate creation for BACS");
+ shouldContinue = false;
+ return;
+ }
cy.citForMandatesCallTest(
fixtures.citConfirmBody,
data,
- 6000,
+ data.Request.amount,
true,
"automatic",
"new_mandate",
globalState
);
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
});
- }
- );
+
+ cy.step("MIT mandate reuse for BACS", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: MIT mandate reuse for BACS");
+ return;
+ }
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_debit_pm"
+ ]["MITAutoCaptureBacs"];
+ if (!utils.should_continue_further(data)) {
+ cy.task("cli_log", "Skipping step: MIT mandate reuse for BACS");
+ return;
+ }
+ cy.mitForMandatesCallTest(
+ fixtures.mitConfirmBody,
+ data,
+ data.Request.amount,
+ true,
+ "automatic",
+ globalState
+ );
+ });
+ });
+ });
});
diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js
index 95bda3f24d..a8aa2d28bf 100644
--- a/cypress-tests/cypress/support/commands.js
+++ b/cypress-tests/cypress/support/commands.js
@@ -30,13 +30,12 @@ import getConnectorDetails, {
extractIntegerAtEnd,
getOriginalConnectorName,
getValueByKey,
- injectHelcimTestCard,
setNormalizedValue,
} from "../e2e/configs/Payment/Utils";
import { execConfig, validateConfig } from "../utils/featureFlags";
import * as RequestBodyUtils from "../utils/RequestBodyUtils";
import { isoTimeTomorrow, validateEnv } from "../utils/RequestBodyUtils.js";
-import { handleRedirection } from "./redirectionHandler";
+import { handleRedirection, MICRODEPOSIT_CONFIG } from "./redirectionHandler";
// In MITM replay mode (MOCK_SERVER=true) there is no live browser redirection
// to drive. Cypress.env may return a boolean or a string, hence String().
@@ -2750,8 +2749,6 @@ Cypress.Commands.add(
confirmBody.split_payments = reqData.split_payments;
}
- injectHelcimTestCard(confirmBody, globalState);
-
const headers = {
"Content-Type": "application/json",
"api-key": apiKey,
@@ -3541,8 +3538,6 @@ Cypress.Commands.add(
createConfirmPaymentBody.split_payments = reqData.split_payments;
}
- injectHelcimTestCard(createConfirmPaymentBody, globalState);
-
const headers = {
"Content-Type": "application/json",
"api-key": globalState.get("apiKey"),
@@ -4502,6 +4497,13 @@ Cypress.Commands.add(
globalState.set("mandateId", response.body.mandate_id);
}
+ if (response.body.connector_transaction_id) {
+ globalState.set(
+ "connectorTransactionId",
+ response.body.connector_transaction_id
+ );
+ }
+
if (response.body.capture_method === "automatic") {
expect(response.body).to.have.property("mandate_id");
if (response.body.authentication_type === "three_ds") {
@@ -4708,7 +4710,7 @@ Cypress.Commands.add(
expect(response.headers["content-type"]).to.include("application/json");
if (response.status === 200) {
globalState.set("paymentID", response.body.payment_id);
- if (response.body.payment_method_data !== null) {
+ if (response.body.payment_method_data) {
expect(response.body.payment_method_data, "payment_method_data").to
.not.be.empty;
}
@@ -4790,6 +4792,87 @@ Cypress.Commands.add(
}
);
+// Generic microdeposit verification for bank debit mandates
+Cypress.Commands.add("verifyAchMicrodepositCallTest", (globalState) => {
+ const connectorTransactionId = globalState.get("connectorTransactionId");
+ const connectorId = globalState.get("connectorId");
+ const connectorAuthFilePath = globalState.get("connectorAuthFilePath");
+
+ if (!connectorTransactionId) {
+ cy.task(
+ "cli_log",
+ "No connector_transaction_id found, skipping microdeposit verification"
+ );
+ return;
+ }
+
+ // Read auth file to get provider credentials using the shared getValueByKey helper
+ cy.readFile(connectorAuthFilePath).then((jsonContent) => {
+ const { authDetails } = getValueByKey(
+ JSON.stringify(jsonContent),
+ connectorId
+ );
+ const microdepositConfig = MICRODEPOSIT_CONFIG[connectorId];
+
+ if (!microdepositConfig) {
+ cy.task(
+ "cli_log",
+ `No microdeposit config for connector: ${connectorId}, skipping verification`
+ );
+ return;
+ }
+
+ if (!authDetails?.connector_account_details?.api_key) {
+ cy.task(
+ "cli_log",
+ "Provider credentials not found, skipping verification"
+ );
+ return;
+ }
+
+ const apiKey = authDetails.connector_account_details.api_key;
+
+ const providerBaseUrl = microdepositConfig.providerBaseUrl.startsWith(
+ "http"
+ )
+ ? microdepositConfig.providerBaseUrl
+ : `https://${microdepositConfig.providerBaseUrl}`;
+
+ cy.task("cli_log", `Fetching payment intent for microdeposit verification`);
+
+ cy.request({
+ method: "GET",
+ url: `${providerBaseUrl}/v1/payment_intents/${connectorTransactionId}`,
+ headers: {
+ Authorization: `Bearer ${apiKey}`,
+ },
+ failOnStatusCode: false,
+ }).then((result) => {
+ if (result.status !== 200) {
+ cy.task("cli_log", `Failed to fetch payment intent: ${result.status}`);
+ return;
+ }
+
+ const hostedVerificationUrl =
+ result.body.next_action?.verify_with_microdeposits
+ ?.hosted_verification_url;
+
+ if (!hostedVerificationUrl) {
+ cy.task("cli_log", "No verification required or already verified");
+ return;
+ }
+
+ cy.task("cli_log", `Verifying microdeposit at: ${hostedVerificationUrl}`);
+ cy.handleMicrodepositVerification({
+ hostedUrl: hostedVerificationUrl,
+ origin: microdepositConfig.origin,
+ inputSelector: microdepositConfig.inputSelector,
+ verificationCode: microdepositConfig.verificationCode,
+ });
+ });
+ });
+});
+
Cypress.Commands.add(
"mitUsingPMId",
(
diff --git a/cypress-tests/cypress/support/redirectionHandler.js b/cypress-tests/cypress/support/redirectionHandler.js
index 66c575bc2d..4552141855 100644
--- a/cypress-tests/cypress/support/redirectionHandler.js
+++ b/cypress-tests/cypress/support/redirectionHandler.js
@@ -4128,3 +4128,47 @@ function handleFlow(
}
});
}
+
+// Generic microdeposit verification handler for bank debit mandates
+// Works with any provider that has a hosted verification page
+// Parameters:
+// - hostedUrl: The URL of the hosted verification page
+// - origin: The origin domain (e.g., "https://payments.stripe.com")
+// - inputSelector: CSS selector for the input field
+// - verificationCode: The code to enter (e.g., "11AA")
+// - submitKey: Key to press to submit (e.g., "{enter}")
+Cypress.Commands.add(
+ "handleMicrodepositVerification",
+ ({
+ hostedUrl,
+ origin,
+ inputSelector,
+ verificationCode,
+ submitKey = "{enter}",
+ }) => {
+ cy.origin(
+ origin,
+ { args: { hostedUrl, inputSelector, verificationCode, submitKey } },
+ ({ hostedUrl, inputSelector, verificationCode, submitKey }) => {
+ cy.visit(hostedUrl);
+ cy.get(inputSelector).type(`${verificationCode}${submitKey}`, {
+ force: true,
+ });
+ cy.wait(5000);
+ }
+ );
+ }
+);
+
+export const MICRODEPOSIT_CONFIG = {
+ get stripe() {
+ return {
+ providerBaseUrl:
+ Cypress.env("STRIPE_PROVIDER_BASE_URL") || "api.stripe.com",
+ origin:
+ Cypress.env("STRIPE_PAYMENTS_ORIGIN") || "https://payments.stripe.com",
+ inputSelector: "input.p-CodePuncher-controllingInput",
+ verificationCode: "11AA",
+ };
+ },
+};
diff --git a/cypress-tests/cypress/utils/RequestBodyUtils.js b/cypress-tests/cypress/utils/RequestBodyUtils.js
index f680b7f2fd..55a50eaf3f 100644
--- a/cypress-tests/cypress/utils/RequestBodyUtils.js
+++ b/cypress-tests/cypress/utils/RequestBodyUtils.js
@@ -75,6 +75,16 @@ export function validateEnv(baseUrl, keyIdType) {
return prefix;
}
+export function isLocalhost(baseUrl) {
+ if (!baseUrl) {
+ return false;
+ }
+
+ return ["localhost", "127.0.0.1", "host.docker.internal", "::1"].some(
+ (host) => baseUrl.includes(host)
+ );
+}
+
/**
* Generates a random email address for testing purposes.
* @returns {string} A randomly generated email address (e.g., "[email protected]").
diff --git a/cypress-tests/cypress/utils/featureFlags.js b/cypress-tests/cypress/utils/featureFlags.js
index 728016ebbb..0937e51374 100644
--- a/cypress-tests/cypress/utils/featureFlags.js
+++ b/cypress-tests/cypress/utils/featureFlags.js
@@ -1,7 +1,18 @@
/* eslint-disable no-console */
-const config_fields = ["CONNECTOR_CREDENTIAL", "DELAY", "TRIGGER_SKIP"];
+const config_fields = [
+ "CONNECTOR_CREDENTIAL",
+ "DELAY",
+ "TRIGGER_SKIP",
+ "LOCAL_VAULT_REQUIRED",
+];
const DEFAULT_CONNECTOR = "connector_1";
+const CONNECTOR_CREDENTIAL_PATTERN = /^connector_([1-9]\d*)$/;
+
+function getConnectorCredentialIndex(connectorType) {
+ const match = CONNECTOR_CREDENTIAL_PATTERN.exec(connectorType || "");
+ return match ? Number(match[1]) : null;
+}
// Helper function for type and range validation
function validateType(value, type) {
@@ -16,9 +27,6 @@ function validateType(value, type) {
// Helper function to validate specific config keys based on schema rules
function validateConfigValue(key, value) {
- // At present, there are only 2 api keys for connectors. Will be scaled based on the need
- const SUPPORTED_CONNECTOR_CREDENTIAL = ["connector_1", "connector_2"];
-
if (config_fields.includes(key)) {
switch (key) {
case "DELAY":
@@ -63,18 +71,16 @@ function validateConfigValue(key, value) {
}
// Validate structure
- if (
- !value.value ||
- !SUPPORTED_CONNECTOR_CREDENTIAL.includes(value.value)
- ) {
+ if (!getConnectorCredentialIndex(value.value)) {
console.error(
- `Config ${key}.value must be one of ${SUPPORTED_CONNECTOR_CREDENTIAL.join(", ")}.`
+ `Config ${key}.value must use the connector_<positive-number> format.`
);
return false;
}
break;
case "TRIGGER_SKIP":
+ case "LOCAL_VAULT_REQUIRED":
case "DELAY.STATUS":
if (!validateType(value, "boolean")) return false;
break;
@@ -113,18 +119,19 @@ export function validateConfig(configObject) {
}
export function getProfileAndConnectorId(connectorType) {
- const credentials = {
- connector_1: {
+ const connectorIndex = getConnectorCredentialIndex(connectorType);
+
+ if (!connectorIndex || connectorIndex === 1) {
+ return {
profileId: "profile",
connectorId: "merchantConnector",
- },
- connector_2: {
- profileId: "profile1",
- connectorId: "merchantConnector1",
- },
- };
+ };
+ }
- return credentials[connectorType] || credentials.connector_1;
+ return {
+ profileId: `profile${connectorIndex - 1}`,
+ connectorId: `merchantConnector${connectorIndex - 1}`,
+ };
}
function getSpecName() {
@@ -168,7 +175,7 @@ export function determineConnectorConfig(config) {
multipleConnectors?.status === true &&
multipleConnectors?.count > 1
) {
- return "connector_2";
+ return connectorCredential.value || "connector_2";
}
return DEFAULT_CONNECTOR;
}