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 Payout Recurring coverage for adyenplatform (#12571)

HS-QUALIBOT777322d15372
diff --git a/cypress-tests/cypress/e2e/configs/Payout/AdyenPlatform.js b/cypress-tests/cypress/e2e/configs/Payout/AdyenPlatform.js
index 9f2cb95a3a..c3ebb41c5a 100644
--- a/cypress-tests/cypress/e2e/configs/Payout/AdyenPlatform.js
+++ b/cypress-tests/cypress/e2e/configs/Payout/AdyenPlatform.js
@@ -215,6 +215,154 @@ export const connectorDetails = {
},
},
},
+ // RecurringTrue/False/Default test the recurring flag field behaviour.
+ RecurringTrue: {
+ Request: {
+ payout_type: "bank",
+ priority: "instant",
+ payout_method_data: {
+ bank: {
+ iban: "NL57INGB4654188101",
+ },
+ },
+ billing: billing,
+ recurring: true,
+ confirm: true,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_fulfillment",
+ payout_type: "bank",
+ recurring: true,
+ },
+ },
+ },
+ RecurringFalse: {
+ Request: {
+ payout_type: "bank",
+ priority: "instant",
+ payout_method_data: {
+ bank: {
+ iban: "NL57INGB4654188101",
+ },
+ },
+ billing: billing,
+ recurring: false,
+ confirm: true,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_fulfillment",
+ payout_type: "bank",
+ recurring: false,
+ },
+ },
+ },
+ RecurringDefault: {
+ Request: {
+ payout_type: "bank",
+ priority: "instant",
+ payout_method_data: {
+ bank: {
+ iban: "NL57INGB4654188101",
+ },
+ },
+ billing: billing,
+ confirm: true,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_fulfillment",
+ payout_type: "bank",
+ recurring: false,
+ },
+ },
+ },
+ // RecurringInvalidConfirm is a negative test case — it expects a 422 error.
+ // Do NOT add TRIGGER_SKIP or should_continue_further guards here.
+ // Pattern matches EntityTypeInvalid in 00008-EntityType.cy.js.
+ RecurringInvalidConfirm: {
+ Request: {
+ payout_type: "bank",
+ priority: "instant",
+ confirm: false,
+ },
+ Response: {
+ status: 422,
+ body: {
+ error: {
+ type: "invalid_request",
+ message: "Confirm must be true for recurring payouts",
+ code: "IR_06",
+ },
+ },
+ },
+ },
+ // The payout_method_id is saved by SavePayoutMethod and injected
+ // from globalState at test runtime.
+ RecurringUseMethod: {
+ Request: {
+ payout_type: "bank",
+ priority: "instant",
+ // payout_method_id is injected from globalState at test runtime
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_fulfillment",
+ payout_type: "bank",
+ recurring: true,
+ },
+ },
+ },
+ // InitiatedFlow tests the complete create+confirm+fulfill flow
+ // that results in "initiated" status with instant priority and auto_fulfill=true
+ InitiatedFlow: {
+ Request: {
+ payout_type: "bank",
+ priority: "instant",
+ payout_method_data: {
+ bank: {
+ iban: "NL57INGB4654188101",
+ },
+ },
+ billing: billing,
+ confirm: true,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "initiated",
+ payout_type: "bank",
+ },
+ },
+ },
+ // RecurringInitiated tests recurring payout with confirm that results in initiated
+ RecurringInitiated: {
+ Request: {
+ payout_type: "bank",
+ priority: "instant",
+ payout_method_data: {
+ bank: {
+ iban: "NL57INGB4654188101",
+ },
+ },
+ billing: billing,
+ recurring: true,
+ confirm: true,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "initiated",
+ payout_type: "bank",
+ recurring: true,
+ },
+ },
+ },
},
PayoutPriority: {
Request: {
diff --git a/cypress-tests/cypress/e2e/configs/Payout/Utils.js b/cypress-tests/cypress/e2e/configs/Payout/Utils.js
index 9a7610d09b..6a59e02eb5 100644
--- a/cypress-tests/cypress/e2e/configs/Payout/Utils.js
+++ b/cypress-tests/cypress/e2e/configs/Payout/Utils.js
@@ -88,9 +88,12 @@ export function getValueByKey(jsonObject, key) {
}
}
+// Connector inclusion/exclusion lists for feature gates
export const CONNECTOR_LISTS = {
INCLUDE: {
ENTITY_TYPE: ["wise"],
+ // Payout recurring feature - only verified connectors
+ PAYOUT_RECURRING: ["adyenplatform"],
PAYOUT_LINK: ["wise"],
},
};
diff --git a/cypress-tests/cypress/e2e/spec/Payout/00008-PayoutRecurring.cy.js b/cypress-tests/cypress/e2e/spec/Payout/00008-PayoutRecurring.cy.js
new file mode 100644
index 0000000000..16dbdc66bb
--- /dev/null
+++ b/cypress-tests/cypress/e2e/spec/Payout/00008-PayoutRecurring.cy.js
@@ -0,0 +1,283 @@
+import * as fixtures from "../../../fixtures/imports";
+import State from "../../../utils/State";
+import * as utils from "../../configs/Payout/Utils";
+
+let globalState;
+
+const getPayoutBody = () => Cypress._.cloneDeep(fixtures.createPayoutBody);
+
+describe("[Payout] Recurring", () => {
+ let shouldContinue = true;
+
+ before("seed global state", () => {
+ cy.task("getGlobalState").then((state) => {
+ globalState = new State(state);
+
+ if (
+ !globalState.get("payoutsExecution") ||
+ !utils.CONNECTOR_LISTS?.INCLUDE?.PAYOUT_RECURRING?.includes(
+ globalState.get("connectorId")
+ )
+ ) {
+ shouldContinue = false;
+ }
+ });
+ });
+
+ after("flush global state", () => {
+ cy.task("setGlobalState", globalState.data);
+ });
+
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+
+ it("create customer", () => {
+ cy.createCustomerCallTest(
+ Cypress._.cloneDeep(fixtures.customerCreateBody),
+ globalState
+ );
+ });
+
+ context("Create payout with recurring=true", () => {
+ let shouldContinue = true;
+
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+
+ it("create-payout-with-recurring-true", () => {
+ const data = Cypress._.cloneDeep(
+ utils.getConnectorDetails(globalState.get("connectorId"))[
+ "bank_transfer_pm"
+ ]["sepa_bank_transfer"]["RecurringTrue"]
+ );
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ return;
+ }
+ cy.createConfirmPayoutTest(
+ getPayoutBody(),
+ data,
+ true,
+ false,
+ globalState
+ );
+ if (shouldContinue) shouldContinue = utils.should_continue_further(data);
+ });
+
+ it("save-payout-method-for-recurring", () => {
+ const data = Cypress._.cloneDeep(
+ utils.getConnectorDetails(globalState.get("connectorId"))[
+ "bank_transfer_pm"
+ ]["sepa_bank_transfer"]["SavePayoutMethod"]
+ );
+ cy.createPaymentMethodTest(globalState, data);
+ });
+
+ it("create-recurring-payout-using-saved-method", () => {
+ const data = Cypress._.cloneDeep(
+ utils.getConnectorDetails(globalState.get("connectorId"))[
+ "bank_transfer_pm"
+ ]["sepa_bank_transfer"]["RecurringUseMethod"]
+ );
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ return;
+ }
+ data.Request.recurring = true;
+ data.Request.payout_method_id = globalState.get("paymentMethodId");
+ cy.createConfirmPayoutTest(
+ getPayoutBody(),
+ data,
+ true,
+ false,
+ globalState
+ );
+ if (shouldContinue) shouldContinue = utils.should_continue_further(data);
+ });
+
+ it("retrieve-payout-call-test", () => {
+ cy.retrievePayoutCallTest(globalState);
+ });
+ });
+
+ context("Create payout with recurring=false", () => {
+ let shouldContinue = true;
+
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+
+ it("create-payout-with-recurring-false", () => {
+ const data = Cypress._.cloneDeep(
+ utils.getConnectorDetails(globalState.get("connectorId"))[
+ "bank_transfer_pm"
+ ]["sepa_bank_transfer"]["RecurringFalse"]
+ );
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ return;
+ }
+ cy.createConfirmPayoutTest(
+ getPayoutBody(),
+ data,
+ true,
+ false,
+ globalState
+ );
+ if (shouldContinue) shouldContinue = utils.should_continue_further(data);
+ });
+
+ it("retrieve-payout-call-test", () => {
+ cy.retrievePayoutCallTest(globalState);
+ });
+ });
+
+ context("Create payout without recurring field (defaults to false)", () => {
+ let shouldContinue = true;
+
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+
+ it("create-payout-with-recurring-omitted", () => {
+ const data = Cypress._.cloneDeep(
+ utils.getConnectorDetails(globalState.get("connectorId"))[
+ "bank_transfer_pm"
+ ]["sepa_bank_transfer"]["RecurringDefault"]
+ );
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ return;
+ }
+ const payoutBody = getPayoutBody();
+ delete payoutBody.recurring;
+ cy.createConfirmPayoutTest(payoutBody, data, true, false, globalState);
+ if (shouldContinue) shouldContinue = utils.should_continue_further(data);
+ });
+
+ it("retrieve-payout-call-test", () => {
+ cy.retrievePayoutCallTest(globalState);
+ });
+ });
+
+ context("Validation: payout_method_id requires confirm=true", () => {
+ const shouldContinue = true;
+
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+
+ it("save-payout-method-for-validation", () => {
+ const data = Cypress._.cloneDeep(
+ utils.getConnectorDetails(globalState.get("connectorId"))[
+ "bank_transfer_pm"
+ ]["sepa_bank_transfer"]["SavePayoutMethod"]
+ );
+ cy.createPaymentMethodTest(globalState, data);
+ });
+
+ it("attempt-payout-without-confirm-should-fail", () => {
+ const data = Cypress._.cloneDeep(
+ utils.getConnectorDetails(globalState.get("connectorId"))[
+ "bank_transfer_pm"
+ ]["sepa_bank_transfer"]["RecurringInvalidConfirm"]
+ );
+ data.Request.payout_method_id = globalState.get("paymentMethodId");
+ cy.createConfirmPayoutTest(
+ getPayoutBody(),
+ data,
+ false,
+ false,
+ globalState
+ );
+ });
+ });
+
+ context("Verify payout status: initiated", () => {
+ let shouldContinue = true;
+
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+
+ it("create-initiated-flow-payout", () => {
+ const data = Cypress._.cloneDeep(
+ utils.getConnectorDetails(globalState.get("connectorId"))[
+ "bank_transfer_pm"
+ ]["sepa_bank_transfer"]["InitiatedFlow"]
+ );
+
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ return;
+ }
+
+ cy.createConfirmPayoutTest(
+ getPayoutBody(),
+ data,
+ true,
+ true,
+ globalState
+ ).then((response) => {
+ expect(response.body.status).to.equal("initiated");
+ });
+
+ if (shouldContinue) shouldContinue = utils.should_continue_further(data);
+ });
+
+ it("retrieve-initiated-payout-verify-status", () => {
+ cy.retrievePayoutCallTest(globalState).then((response) => {
+ // Verify retrieved payout has initiated status
+ expect(response.body.status).to.equal("initiated");
+ });
+ });
+
+ it("create-recurring-initiated-payout", () => {
+ const data = Cypress._.cloneDeep(
+ utils.getConnectorDetails(globalState.get("connectorId"))[
+ "bank_transfer_pm"
+ ]["sepa_bank_transfer"]["RecurringInitiated"]
+ );
+
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ return;
+ }
+
+ cy.createConfirmPayoutTest(
+ getPayoutBody(),
+ data,
+ true,
+ true,
+ globalState
+ ).then((response) => {
+ expect(response.body.status).to.equal("initiated");
+ expect(response.body.recurring).to.equal(true);
+ });
+
+ if (shouldContinue) shouldContinue = utils.should_continue_further(data);
+ });
+
+ it("retrieve-recurring-initiated-payout-verify-status", () => {
+ cy.retrievePayoutCallTest(globalState).then((response) => {
+ // Verify retrieved recurring payout has initiated status
+ expect(response.body.status).to.equal("initiated");
+ expect(response.body.recurring).to.equal(true);
+ });
+ });
+ });
+});
diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js
index 8e80cd717a..a51be5a85b 100644
--- a/cypress-tests/cypress/support/commands.js
+++ b/cypress-tests/cypress/support/commands.js
@@ -6335,31 +6335,39 @@ Cypress.Commands.add(
createConfirmPayoutBody.confirm = confirm;
createConfirmPayoutBody.customer_id = globalState.get("customerId");
- cy.request({
- method: "POST",
- url: `${globalState.get("baseUrl")}/payouts/create`,
- headers: {
- "Content-Type": "application/json",
- "api-key": globalState.get("apiKey"),
- },
- failOnStatusCode: false,
- body: createConfirmPayoutBody,
- }).then((response) => {
- logRequestId(response.headers["x-request-id"]);
+ return cy
+ .request({
+ method: "POST",
+ url: `${globalState.get("baseUrl")}/payouts/create`,
+ headers: {
+ "Content-Type": "application/json",
+ "api-key": globalState.get("apiKey"),
+ },
+ failOnStatusCode: false,
+ body: createConfirmPayoutBody,
+ })
+ .then((response) => {
+ logRequestId(response.headers["x-request-id"]);
- cy.wrap(response).then(() => {
- expect(response.headers["content-type"]).to.include("application/json");
- if (response.status === 200) {
- globalState.set("payoutAmount", createConfirmPayoutBody.amount);
- globalState.set("payoutID", response.body.payout_id);
- for (const key in resData.body) {
- expect(resData.body[key]).to.deep.equal(response.body[key]);
+ cy.wrap(response).then(() => {
+ expect(response.headers["content-type"]).to.include(
+ "application/json"
+ );
+ if (response.status === 200) {
+ globalState.set("payoutAmount", createConfirmPayoutBody.amount);
+ globalState.set("payoutID", response.body.payout_id);
+ if (response.body.payout_method_id) {
+ globalState.set("payoutMethodId", response.body.payout_method_id);
+ }
+ for (const key in resData.body) {
+ expect(resData.body[key]).to.deep.equal(response.body[key]);
+ }
+ } else {
+ defaultErrorHandler(response, resData);
}
- } else {
- defaultErrorHandler(response, resData);
- }
+ return response;
+ });
});
- });
}
);