Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cypress): add 2 more payout connectors and bank transfer support for payout #4993

Merged
merged 9 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cypress-tests/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"trailingComma": "es5",
"tabWidth": 2,
"semi": true,
"singleQuote": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ describe("Account Create flow test", () => {
it("merchant-create-call-test", () => {
cy.merchantCreateCallTest(merchantCreateBody, globalState);
});

it("api-key-create-call-test", () => {
cy.apiKeyCreateTest(apiKeyCreateBody, globalState);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ describe("Customer Create flow test", () => {
globalState = new State(state);
});
});

after("flush global state", () => {
cy.task("setGlobalState", globalState.data);
});

it("customer-create-call-test", () => {
cy.createCustomerCallTest(customerCreateBody, globalState);
});
Expand Down
11 changes: 6 additions & 5 deletions cypress-tests/cypress/e2e/PayoutTest/00003-CardTest.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as utils from "../PayoutUtils/utils";

let globalState;

describe("Card - Auto Fulfill", () => {
describe("[Payout] Cards", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails

before("seed global state", () => {
Expand All @@ -18,16 +18,16 @@ describe("Card - Auto Fulfill", () => {
});
});

after("flush global state", () => {
cy.task("setGlobalState", globalState.data);
});

beforeEach(function () {
if (!should_continue) {
this.skip();
}
});

afterEach("flush global state", () => {
cy.task("setGlobalState", globalState.data);
});

context("Payout Card with Auto Fulfill", () => {
it("confirm-payout-call-with-auto-fulfill-test", () => {
let data = utils.getConnectorDetails(globalState.get("connectorId"))[
Expand All @@ -43,6 +43,7 @@ describe("Card - Auto Fulfill", () => {
true,
globalState
);

if (should_continue)
should_continue = utils.should_continue_further(res_data);
});
Expand Down
234 changes: 234 additions & 0 deletions cypress-tests/cypress/e2e/PayoutTest/00004-BankTransfer.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
import createPayoutBody from "../../fixtures/create-payout-confirm-body.json";
import State from "../../utils/State";
import * as utils from "../PayoutUtils/utils";

let globalState;

// TODO: Add test for Bank Transfer - ACH
describe("[Payout] [Bank Transfer - ACH]", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails

before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);

// Check if the connector supports card payouts (based on the connector configuration in creds)
if (!globalState.get("payoutsExecution")) {
should_continue = false;
}
});
});

after("flush global state", () => {
cy.task("setGlobalState", globalState.data);
});

beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
});

// TODO: Add test for Bank Transfer - BACS
describe("[Payout] [Bank Transfer - BACS]", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails

before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);

// Check if the connector supports card payouts (based on the connector configuration in creds)
if (!globalState.get("payoutsExecution")) {
should_continue = false;
}
});
});

after("flush global state", () => {
cy.task("setGlobalState", globalState.data);
});

beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
});

describe("[Payout] [Bank Transfer - SEPA]", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails

before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);

// Check if the connector supports card payouts (based on the connector configuration in creds)
if (!globalState.get("payoutsExecution")) {
should_continue = false;
}
});
});

after("flush global state", () => {
cy.task("setGlobalState", globalState.data);
});

beforeEach(function () {
if (!should_continue) {
this.skip();
}
});

context("[Payout] [Bank transfer - SEPA] Auto Fulfill", () => {
it("confirm-payout-call-with-auto-fulfill-test", () => {
let data = utils.getConnectorDetails(globalState.get("connectorId"))[
"bank_transfer_pm"
]["sepa"]["Fulfill"];

let req_data = data["Request"];
let res_data = data["Response"];
cy.createConfirmPayoutTest(
createPayoutBody,
req_data,
res_data,
true,
true,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
});

it("retrieve-payout-call-test", () => {
cy.retrievePayoutCallTest(globalState);
});
});

context("[Payout] [Bank transfer - SEPA] Manual Fulfill", () => {
it("confirm-payout-call-with-manual-fulfill-test", () => {
let data = utils.getConnectorDetails(globalState.get("connectorId"))[
"bank_transfer_pm"
]["sepa"]["Confirm"];
let req_data = data["Request"];
let res_data = data["Response"];
cy.createConfirmPayoutTest(
createPayoutBody,
req_data,
res_data,
true,
false,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
});

it("fulfill-payout-call-test", () => {
let data = utils.getConnectorDetails(globalState.get("connectorId"))[
"bank_transfer_pm"
]["sepa"]["Fulfill"];
let req_data = data["Request"];
let res_data = data["Response"];
cy.fulfillPayoutCallTest({}, req_data, res_data, globalState);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
});

it("retrieve-payout-call-test", () => {
cy.retrievePayoutCallTest(globalState);
});
});

context("[Payout] [Bank transfer - SEPA] Manual Confirm", () => {
it("confirm-payout-call-with-manual-confirm-test", () => {
let data = utils.getConnectorDetails(globalState.get("connectorId"))[
"bank_transfer_pm"
]["sepa"]["Create"];
let req_data = data["Request"];
let res_data = data["Response"];
cy.createConfirmPayoutTest(
createPayoutBody,
req_data,
res_data,
false,
true,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
});

it("confirm-payout-call", () => {
let data = utils.getConnectorDetails(globalState.get("connectorId"))[
"bank_transfer_pm"
]["sepa"]["Confirm"];
let req_data = data["Request"];
let res_data = data["Response"];
cy.updatePayoutCallTest({}, req_data, res_data, false, globalState);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
});

it("fulfill-payout-call-test", () => {
let data = utils.getConnectorDetails(globalState.get("connectorId"))[
"bank_transfer_pm"
]["sepa"]["Fulfill"];
let req_data = data["Request"];
let res_data = data["Response"];
cy.fulfillPayoutCallTest({}, req_data, res_data, globalState);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
});

it("retrieve-payout-call-test", () => {
cy.retrievePayoutCallTest(globalState);
});
});

context("[Payout] [Bank transfer - SEPA] Manual", () => {
it("create-payout-call", () => {
let data = utils.getConnectorDetails(globalState.get("connectorId"))[
"bank_transfer_pm"
]["sepa"]["Create"];
let req_data = data["Request"];
let res_data = data["Response"];
cy.createConfirmPayoutTest(
createPayoutBody,
req_data,
res_data,
false,
false,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
});

it("confirm-payout-call", () => {
let data = utils.getConnectorDetails(globalState.get("connectorId"))[
"bank_transfer_pm"
]["sepa"]["Confirm"];
let req_data = data["Request"];
let res_data = data["Response"];
cy.updatePayoutCallTest({}, req_data, res_data, false, globalState);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
});

it("fulfill-payout-call-test", () => {
let data = utils.getConnectorDetails(globalState.get("connectorId"))[
"bank_transfer_pm"
]["sepa"]["Fulfill"];
let req_data = data["Request"];
let res_data = data["Response"];
cy.fulfillPayoutCallTest({}, req_data, res_data, globalState);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
});

it("retrieve-payout-call-test", () => {
cy.retrievePayoutCallTest(globalState);
});
});
});
Loading
Loading