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 BankDebit Mandates spec for Adyen (SEPA, BACS) (#12901)

HS-QUALIBOTc383660a9cb2
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Adyen.js b/cypress-tests/cypress/e2e/configs/Payment/Adyen.js
index b87f552275..18301cf1f0 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Adyen.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Adyen.js
@@ -2720,12 +2720,8 @@ export const connectorDetails = {
PaymentIntent: (paymentMethodType) => {
if (paymentMethodType === "Ach") {
return {
- Configs: {
- TRIGGER_SKIP: true,
- },
Request: {
currency: "USD",
- setup_future_usage: "off_session",
},
Response: {
status: 200,
@@ -2799,19 +2795,14 @@ export const connectorDetails = {
},
},
},
- Ach: {
- Configs: {
- TRIGGER_SKIP: true,
- },
+ SepaMandate: {
Request: {
payment_method: "bank_debit",
- payment_method_type: "ach",
+ payment_method_type: "sepa",
payment_method_data: {
bank_debit: {
- ach_bank_debit: {
- account_number: "000123456789",
- routing_number: "121000358",
- bank_type: "checking",
+ sepa_bank_debit: {
+ iban: "DE89370400440532013000",
bank_account_holder_name: "John Doe",
},
},
@@ -2821,25 +2812,64 @@ export const connectorDetails = {
line1: "1467",
line2: "Harrison Street",
line3: "Harrison Street",
- city: "San Francisco",
- state: "California",
- zip: "94122",
- country: "US",
+ city: "Amsterdam",
+ state: "North Holland",
+ zip: "1012",
+ country: "NL",
first_name: "John",
last_name: "Doe",
},
},
customer_acceptance: customerAcceptance,
+ setup_future_usage: "off_session",
mandate_data: {
customer_acceptance: customerAcceptance,
mandate_type: {
multi_use: {
amount: 8000,
- currency: "USD",
+ currency: "EUR",
},
},
},
payment_type: "new_mandate",
+ currency: "EUR",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ },
+ },
+ },
+ Ach: {
+ Request: {
+ payment_method: "bank_debit",
+ payment_method_type: "ach",
+ payment_method_data: {
+ bank_debit: {
+ ach_bank_debit: {
+ account_number: "1234567890",
+ routing_number: "011000138",
+ bank_type: "checking",
+ bank_account_holder_name: "John Doe",
+ },
+ },
+ },
+ billing: {
+ address: {
+ line1: "1467",
+ line2: "Harrison Street",
+ line3: "Harrison Street",
+ city: "San Francisco",
+ state: "CA",
+ zip: "94122",
+ country: "US",
+ first_name: "John",
+ last_name: "Doe",
+ },
+ },
+ customer_acceptance: customerAcceptance,
+ currency: "USD",
},
Response: {
status: 200,
@@ -2885,6 +2915,7 @@ export const connectorDetails = {
},
},
payment_type: "new_mandate",
+ currency: "GBP",
},
Response: {
status: 200,
@@ -2924,5 +2955,17 @@ export const connectorDetails = {
},
},
},
+ BankdebitMIT: {
+ Request: {
+ currency: "EUR",
+ off_session: true,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ },
+ },
+ },
},
};
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Commons.js b/cypress-tests/cypress/e2e/configs/Payment/Commons.js
index 2f360ba506..0830175af9 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Commons.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Commons.js
@@ -1376,6 +1376,38 @@ export const connectorDetails = {
},
},
}),
+ BankdebitMIT: {
+ Request: {
+ currency: "EUR",
+ off_session: true,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ },
+ },
+ },
+ SepaMandate: getCustomExchange({
+ 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: {
+ country: "DE",
+ },
+ email: "[email protected]",
+ },
+ },
+ }),
},
wallet_pm: {
PaymentIntent: (paymentMethodType) =>
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 f55a000048..bef6068994 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/45-BankDebit.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/45-BankDebit.cy.js
@@ -32,11 +32,11 @@ describe("Bank Debit tests", () => {
});
});
- afterEach("flush global state", () => {
+ after("flush global state", () => {
cy.task("setGlobalState", globalState.data);
});
- context("SEPA Bank Debit Create and Confirm flow test", () => {
+ context("SEPA Bank Debit - Create and Confirm flow", () => {
it("Create Payment Intent -> List Merchant Payment Methods -> Confirm SEPA Bank Debit -> Retrieve Payment", () => {
let shouldContinue = true;
@@ -66,7 +66,7 @@ describe("Bank Debit tests", () => {
cy.step("Confirm SEPA Bank Debit", () => {
if (!shouldContinue) {
- cy.task("cli_log", "Skipping step: List Merchant Payment Methods");
+ cy.task("cli_log", "Skipping step: Confirm SEPA Bank Debit");
return;
}
const confirmData = getConnectorDetails(globalState.get("connectorId"))[
@@ -92,14 +92,11 @@ 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 test", () => {
+ context("ACH Bank Debit - Create and Confirm flow", () => {
it("Create Payment Intent -> List Merchant Payment Methods -> Confirm ACH Bank Debit -> Retrieve Payment", () => {
let shouldContinue = true;
@@ -129,7 +126,7 @@ describe("Bank Debit tests", () => {
cy.step("Confirm ACH Bank Debit", () => {
if (!shouldContinue) {
- cy.task("cli_log", "Skipping step: List Merchant Payment Methods");
+ cy.task("cli_log", "Skipping step: Confirm ACH Bank Debit");
return;
}
const confirmData = getConnectorDetails(globalState.get("connectorId"))[
@@ -155,14 +152,11 @@ 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 test", () => {
+ context("BECS Bank Debit - Create and Confirm flow", () => {
it("Create Payment Intent -> List Merchant Payment Methods -> Confirm BECS Bank Debit -> Retrieve Payment", () => {
let shouldContinue = true;
@@ -192,7 +186,7 @@ describe("Bank Debit tests", () => {
cy.step("Confirm BECS Bank Debit", () => {
if (!shouldContinue) {
- cy.task("cli_log", "Skipping step: List Merchant Payment Methods");
+ cy.task("cli_log", "Skipping step: Confirm BECS Bank Debit");
return;
}
const confirmData = getConnectorDetails(globalState.get("connectorId"))[
@@ -218,14 +212,11 @@ describe("Bank Debit tests", () => {
"bank_debit_pm"
]["Becs"];
cy.retrievePaymentCallTest({ globalState, data: confirmData });
- if (!utils.should_continue_further(confirmData)) {
- shouldContinue = false;
- }
});
});
});
- context("BACS Bank Debit Create and Confirm flow test", () => {
+ context("BACS Bank Debit - Create and Confirm flow", () => {
it("Create Payment Intent -> List Merchant Payment Methods -> Confirm BACS Bank Debit -> Retrieve Payment", () => {
let shouldContinue = true;
@@ -255,7 +246,7 @@ describe("Bank Debit tests", () => {
cy.step("Confirm BACS Bank Debit", () => {
if (!shouldContinue) {
- cy.task("cli_log", "Skipping step: List Merchant Payment Methods");
+ cy.task("cli_log", "Skipping step: Confirm BACS Bank Debit");
return;
}
const confirmData = getConnectorDetails(globalState.get("connectorId"))[
@@ -281,10 +272,106 @@ 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",
+ () => {
+ let shouldContinue = true;
+
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+
+ it("create-customer-call-test", () => {
+ cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
+ });
+
+ it("sepa-bank-debit-mandate-cit-test", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_debit_pm"
+ ]["SepaMandate"];
+
+ cy.citForMandatesCallTest(
+ fixtures.citConfirmBody,
+ data,
+ 6000,
+ true,
+ "automatic",
+ "new_mandate",
+ globalState
+ );
+
+ if (shouldContinue)
+ shouldContinue = utils.should_continue_further(data);
+ });
+
+ it("retrieve-mandate-call-test", () => {
+ cy.mandateGETCallTest(globalState);
+ });
+
+ it("sepa-bank-debit-mandate-mit-test", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_debit_pm"
+ ]["BankdebitMIT"];
+
+ cy.mitForMandatesCallTest(
+ fixtures.mitConfirmBody,
+ data,
+ 6000,
+ true,
+ "automatic",
+ globalState
+ );
+
+ if (shouldContinue)
+ shouldContinue = utils.should_continue_further(data);
+ });
+
+ it("list-mandate-call-test", () => {
+ cy.listMandateCallTest(globalState);
+ });
+
+ it("revoke-mandate-call-test", () => {
+ cy.revokeMandateCallTest(globalState);
+ });
+ }
+ );
+
+ context(
+ "BACS Bank Debit - NoThreeDS Create + Confirm Automatic CIT payment flow test",
+ () => {
+ const shouldContinue = true;
+
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+
+ it("bacs-create-customer-call-test", () => {
+ cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
+ });
+
+ it("bacs-bank-debit-mandate-cit-test", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_debit_pm"
+ ]["Bacs"];
+
+ cy.citForMandatesCallTest(
+ fixtures.citConfirmBody,
+ data,
+ 6000,
+ true,
+ "automatic",
+ "new_mandate",
+ globalState
+ );
+ });
+ }
+ );
});
diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js
index 6a19be2fd7..56e5ef5965 100644
--- a/cypress-tests/cypress/support/commands.js
+++ b/cypress-tests/cypress/support/commands.js
@@ -4527,7 +4527,8 @@ Cypress.Commands.add(
response.body.setup_future_usage === "off_session" &&
response.body.mandate_id === null &&
response.body.status === "succeeded" &&
- globalState.get("connectorId") !== "peachpayments"
+ globalState.get("connectorId") !== "peachpayments" &&
+ requestBody.mandate_data !== null
) {
expect(
response.body.connector_mandate_id,
@@ -4676,8 +4677,10 @@ Cypress.Commands.add(
expect(response.headers["content-type"]).to.include("application/json");
if (response.status === 200) {
globalState.set("paymentID", response.body.payment_id);
- expect(response.body.payment_method_data, "payment_method_data").to
- .not.be.empty;
+ if (response.body.payment_method_data !== null) {
+ expect(response.body.payment_method_data, "payment_method_data").to
+ .not.be.empty;
+ }
const expectedConnector = getOriginalConnectorName(
globalState.get("connectorId")
);
@@ -5086,6 +5089,29 @@ Cypress.Commands.add("revokeMandateCallTest", (globalState) => {
});
});
+Cypress.Commands.add("mandateGETCallTest", (globalState) => {
+ const mandateId = globalState.get("mandateId");
+ cy.request({
+ method: "GET",
+ url: `${globalState.get("baseUrl")}/mandates/${mandateId}`,
+ headers: {
+ "Content-Type": "application/json",
+ "api-key": globalState.get("apiKey"),
+ },
+ failOnStatusCode: false,
+ }).then((response) => {
+ logRequestId(response.headers["x-request-id"]);
+
+ cy.wrap(response).then(() => {
+ expect(response.headers["content-type"]).to.include("application/json");
+ expect(response.status, "status_code").to.equal(200);
+ expect(response.body).to.have.property("mandate_id", mandateId);
+ expect(response.body).to.have.property("status", "active");
+ expect(response.body).to.have.property("payment_method", "bank_debit");
+ });
+ });
+});
+
Cypress.Commands.add(
"handleRedirection",
(globalState, expectedRedirection) => {