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
import * as fixtures from "../../../fixtures/imports";
import State from "../../../utils/State";
import * as utils from "../../configs/Payout/Utils";
let globalState;
let payoutBody;
describe("[Payout] Saved Card", () => {
let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
before("seed global state", function () {
cy.task("getGlobalState")
.then((state) => {
globalState = new State(state);
if (!globalState.get("payoutsExecution")) {
shouldContinue = false;
}
if (
!utils.CONNECTOR_LISTS.INCLUDE.SAVED_CARD.includes(
globalState.get("connectorId")
)
) {
shouldContinue = false;
}
})
.then(() => {
if (!shouldContinue) {
this.skip();
}
});
});
after("flush global state", () => {
cy.task("setGlobalState", globalState.data);
});
beforeEach(function () {
if (!shouldContinue) {
this.skip();
}
});
context("[Payout] [Card] Onboard customer prior to transaction", () => {
let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
// This is needed to get customer payment methods
beforeEach("seed global state", () => {
payoutBody = Cypress._.cloneDeep(fixtures.createPayoutBody);
});
it("create customer", () => {
cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
});
it("create payment method", () => {
const data = utils.getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["SavePayoutMethod"];
cy.createPaymentMethodTest(globalState, data);
});
it("list customer payment methods", () => {
cy.listCustomerPMCallTest(globalState);
});
it("confirm-payout-call-with-auto-fulfill-test", () => {
const data = utils.getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["Token"];
cy.createConfirmWithTokenPayoutTest(
payoutBody,
data,
true,
true,
globalState
);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
it("retrieve-payout-call-test", () => {
cy.retrievePayoutCallTest(globalState);
});
});
context(
"[Payout] [Card] Save payment method after successful transaction",
() => {
let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
beforeEach(function () {
if (!shouldContinue) {
this.skip();
}
});
it("create customer", () => {
cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
});
it("confirm-payout-call-with-auto-fulfill-test", () => {
const data = utils.getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["Fulfill"];
cy.createConfirmPayoutTest(payoutBody, data, true, true, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
});
it("list customer payment methods", () => {
cy.listCustomerPMCallTest(globalState);
});
it("confirm-payout-call-with-auto-fulfill-test", () => {
const data = utils.getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["Token"];
cy.createConfirmWithTokenPayoutTest(
payoutBody,
data,
true,
true,
globalState
);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
});
it("retrieve-payout-call-test", () => {
cy.retrievePayoutCallTest(globalState);
});
}
);
});
describe("[Payout] Saved Bank transfer - Open Banking", () => {
let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
before("seed global state", function () {
cy.task("getGlobalState")
.then((state) => {
globalState = new State(state);
if (!globalState.get("payoutsExecution")) {
shouldContinue = false;
}
if (
!utils.CONNECTOR_LISTS.INCLUDE.SAVED_BANK_TRANSFER_OPEN_BANKING.includes(
globalState.get("connectorId")
)
) {
shouldContinue = false;
}
})
.then(() => {
if (!shouldContinue) {
this.skip();
}
});
});
after("flush global state", () => {
cy.task("setGlobalState", globalState.data);
});
beforeEach(function () {
if (!shouldContinue) {
this.skip();
}
});
// Trustly bank transfers can't be vaulted via POST /payment_methods (422
// IR_06 - trustly subtype is only valid for bank_redirect), so the save is
// exercised through the connector: a recurring payout makes the payout core
// vault the recipient as a saved payout method (subtype "trustly"), which is
// then listed and reused via payout_token.
context(
"[Payout] [Bank Transfer - Open Banking] Save payment method after successful transaction",
() => {
let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
beforeEach("reset payoutBody", () => {
payoutBody = Cypress._.cloneDeep(fixtures.createPayoutBody);
payoutBody.recurring = true;
});
beforeEach(function () {
if (!shouldContinue) {
this.skip();
}
});
it("create customer", () => {
cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
});
it("confirm-payout-call-with-auto-fulfill-test", () => {
const data = utils.getConnectorDetails(globalState.get("connectorId"))[
"bank_transfer_pm"
]["open_banking"]["Fulfill"];
cy.createConfirmPayoutTest(payoutBody, data, true, true, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
});
it("list customer payment methods", () => {
cy.listCustomerPMCallTest(globalState);
});
it("[Payout] [Bank transfer - Open Banking] Fulfill using Token", () => {
const data = utils.getConnectorDetails(globalState.get("connectorId"))[
"bank_transfer_pm"
]["open_banking"]["Token"];
cy.createConfirmWithTokenPayoutTest(
payoutBody,
data,
true,
true,
globalState
);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
});
it("retrieve-payout-call-test", () => {
const data = utils.getConnectorDetails(globalState.get("connectorId"))[
"bank_transfer_pm"
]["open_banking"]["RetrieveAfterFulfill"];
if (data) {
cy.pollPayoutStatusCallTest(globalState);
}
cy.retrievePayoutCallTest(globalState, data);
});
}
);
});
describe("[Payout] Saved Bank transfer", () => {
let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
before("seed global state", function () {
cy.task("getGlobalState")
.then((state) => {
globalState = new State(state);
if (!globalState.get("payoutsExecution")) {
shouldContinue = false;
}
if (
!utils.CONNECTOR_LISTS.INCLUDE.SAVED_BANK_TRANSFER_SEPA.includes(
globalState.get("connectorId")
)
) {
shouldContinue = false;
}
})
.then(() => {
if (!shouldContinue) {
this.skip();
}
});
});
after("flush global state", () => {
cy.task("setGlobalState", globalState.data);
});
beforeEach(function () {
if (!shouldContinue) {
this.skip();
}
});
context(
"[Payout] [Bank Transfer] Onboard Customer Prior to Transaction",
() => {
let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
beforeEach("reset payoutBody", () => {
payoutBody = Cypress._.cloneDeep(fixtures.createPayoutBody);
});
it("create customer", () => {
cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
});
it("create payment method", () => {
const data = utils.getConnectorDetails(globalState.get("connectorId"))[
"bank_transfer_pm"
]["sepa_bank_transfer"]["SavePayoutMethod"];
cy.createPaymentMethodTest(globalState, data);
});
it("list customer payment methods", () => {
cy.listCustomerPMCallTest(globalState);
});
it("[Payout] [Bank transfer] [SEPA_BANK_TRANSFER] Fulfill using Token", () => {
const data = utils.getConnectorDetails(globalState.get("connectorId"))[
"bank_transfer_pm"
]["sepa_bank_transfer"]["Token"];
cy.createConfirmWithTokenPayoutTest(
payoutBody,
data,
true,
true,
globalState
);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
});
it("retrieve-payout-call-test", () => {
cy.retrievePayoutCallTest(globalState);
});
}
);
context(
"[Payout] [Bank Transfer] Save payment method after successful transaction",
() => {
let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
beforeEach(function () {
if (!shouldContinue) {
this.skip();
}
});
it("create customer", () => {
cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
});
it("confirm-payout-call-with-auto-fulfill-test", () => {
const data = utils.getConnectorDetails(globalState.get("connectorId"))[
"bank_transfer_pm"
]["sepa_bank_transfer"]["Fulfill"];
cy.createConfirmPayoutTest(payoutBody, data, true, true, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
});
it("list customer payment methods", () => {
cy.listCustomerPMCallTest(globalState);
});
it("[Payout] [Bank transfer] [SEPA_BANK_TRANSFER] Fulfill using Token", () => {
const data = utils.getConnectorDetails(globalState.get("connectorId"))[
"bank_transfer_pm"
]["sepa_bank_transfer"]["Token"];
cy.createConfirmWithTokenPayoutTest(
payoutBody,
data,
true,
true,
globalState
);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
});
it("retrieve-payout-call-test", () => {
cy.retrievePayoutCallTest(globalState);
});
}
);
});