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
feat(cypress): add 2 more payout connectors and bank transfer support for payout (#4993)
Pa1NarK45a908b4407d
diff --git a/cypress-tests/.prettierrc.json b/cypress-tests/.prettierrc.jsonnew file mode 100644index 0000000000..f0eb61e0f7--- /dev/null+++ b/cypress-tests/.prettierrc.json@@ -0,0 +1,6 @@+{+ "trailingComma": "es5",+ "tabWidth": 2,+ "semi": true,+ "singleQuote": false+}diff --git a/cypress-tests/cypress/e2e/PayoutTest/00000-AccountCreate.cy.js b/cypress-tests/cypress/e2e/PayoutTest/00000-AccountCreate.cy.jsindex c1b62c883f..25305cc4fc 100644--- a/cypress-tests/cypress/e2e/PayoutTest/00000-AccountCreate.cy.js+++ b/cypress-tests/cypress/e2e/PayoutTest/00000-AccountCreate.cy.js@@ -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);});diff --git a/cypress-tests/cypress/e2e/PayoutTest/00001-CustomerCreate.cy.js b/cypress-tests/cypress/e2e/PayoutTest/00001-CustomerCreate.cy.jsindex 584296bdae..d51a2f78ae 100644--- a/cypress-tests/cypress/e2e/PayoutTest/00001-CustomerCreate.cy.js+++ b/cypress-tests/cypress/e2e/PayoutTest/00001-CustomerCreate.cy.js@@ -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);});diff --git a/cypress-tests/cypress/e2e/PayoutTest/00003-CardTest.cy.js b/cypress-tests/cypress/e2e/PayoutTest/00003-CardTest.cy.jsindex da055d0bbd..54fa7f31d2 100644--- a/cypress-tests/cypress/e2e/PayoutTest/00003-CardTest.cy.js+++ b/cypress-tests/cypress/e2e/PayoutTest/00003-CardTest.cy.js@@ -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 failsbefore("seed global state", () => {@@ -18,17 +18,18 @@ 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", () => {+ let should_continue = true; // variable that will be used to skip tests if a previous test failsit("confirm-payout-call-with-auto-fulfill-test", () => {let data = utils.getConnectorDetails(globalState.get("connectorId"))["card_pm"@@ -43,6 +44,7 @@ describe("Card - Auto Fulfill", () => {true,globalState);+if (should_continue)should_continue = utils.should_continue_further(res_data);});@@ -53,6 +55,8 @@ describe("Card - Auto Fulfill", () => {});context("Payout Card with Manual Fulfill - Create Confirm", () => {+ let should_continue = true; // variable that will be used to skip tests if a previous test fails+it("confirm-payout-call-with-manual-fulfill-test", () => {let data = utils.getConnectorDetails(globalState.get("connectorId"))["card_pm"@@ -88,6 +92,8 @@ describe("Card - Auto Fulfill", () => {});context("Payout Card with Manual Fulfill - Create Intent + Confirm", () => {+ let should_continue = true; // variable that will be used to skip tests if a previous test fails+it("create-payout-call", () => {let data = utils.getConnectorDetails(globalState.get("connectorId"))["card_pm"diff --git a/cypress-tests/cypress/e2e/PayoutTest/00004-BankTransfer.cy.js b/cypress-tests/cypress/e2e/PayoutTest/00004-BankTransfer.cy.jsnew file mode 100644index 0000000000..8c2e401231--- /dev/null+++ b/cypress-tests/cypress/e2e/PayoutTest/00004-BankTransfer.cy.js@@ -0,0 +1,242 @@+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", () => {+ let should_continue = true; // variable that will be used to skip tests if a previous test fails++ 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", () => {+ let should_continue = true; // variable that will be used to skip tests if a previous test fails++ 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", () => {+ let should_continue = true; // variable that will be used to skip tests if a previous test fails++ 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", () => {+ let should_continue = true; // variable that will be used to skip tests if a previous test fails++ 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);+ });+ });+});diff --git a/cypress-tests/cypress/e2e/PayoutTest/00005-SavePayout.cy.js b/cypress-tests/cypress/e2e/PayoutTest/00005-SavePayout.cy.jsnew file mode 100644index 0000000000..c5af6e5e06--- /dev/null+++ b/cypress-tests/cypress/e2e/PayoutTest/00005-SavePayout.cy.js@@ -0,0 +1,270 @@+import customerCreateBody from "../../fixtures/create-customer-body.json";+import initialCreatePayoutBody from "../../fixtures/create-payout-confirm-body.json";+import State from "../../utils/State";+import * as utils from "../PayoutUtils/utils";++let globalState;+let createPayoutBody;++describe("[Payout] Saved Card", () => {+ 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] [Card] Onboard customer prior to transaction", () => {+ let should_continue = 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", () => {+ createPayoutBody = Cypress._.cloneDeep(initialCreatePayoutBody);+ });++ it("create customer", () => {+ cy.createCustomerCallTest(customerCreateBody, globalState);+ });++ it("create payment method", () => {+ let data = utils.getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["SavePayoutMethod"];+ let req_data = data["Request"];+ let res_data = data["Response"];+ cy.createPaymentMethodTest(globalState, req_data, res_data);+ });++ it("list customer payment methods", () => {+ cy.listCustomerPMCallTest(globalState);+ });++ it("confirm-payout-call-with-auto-fulfill-test", () => {+ let data = utils.getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["Token"];+ let req_data = data["Request"];+ let res_data = data["Response"];+ cy.createConfirmWithTokenPayoutTest(+ 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] [Card] Save payment method after successful transaction",+ () => {+ let should_continue = true; // variable that will be used to skip tests if a previous test fails++ it("create customer", () => {+ cy.createCustomerCallTest(customerCreateBody, globalState);+ });++ it("confirm-payout-call-with-auto-fulfill-test", () => {+ let data = utils.getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["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("list customer payment methods", () => {+ cy.listCustomerPMCallTest(globalState);+ });++ it("confirm-payout-call-with-auto-fulfill-test", () => {+ let data = utils.getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["Token"];+ let req_data = data["Request"];+ let res_data = data["Response"];+ cy.createConfirmWithTokenPayoutTest(+ 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);+ });+ }+ );+});++describe("[Payout] Saved Bank transfer", () => {+ 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] Onboard Customer Prior to Transaction",+ () => {+ let should_continue = true; // variable that will be used to skip tests if a previous test fails+ beforeEach("reset createPayoutBody", () => {+ createPayoutBody = Cypress._.cloneDeep(initialCreatePayoutBody);+ });++ it("create customer", () => {+ cy.createCustomerCallTest(customerCreateBody, globalState);+ });++ it("create payment method", () => {+ let data = utils.getConnectorDetails(globalState.get("connectorId"))[+ "bank_transfer_pm"+ ]["sepa"]["SavePayoutMethod"];+ let req_data = data["Request"];+ let res_data = data["Response"];+ cy.createPaymentMethodTest(globalState, req_data, res_data);+ });++ it("list customer payment methods", () => {+ cy.listCustomerPMCallTest(globalState);+ });++ it("[Payout] [Bank transfer] [SEPA] Fulfill using Token", () => {+ let data = utils.getConnectorDetails(globalState.get("connectorId"))[+ "bank_transfer_pm"+ ]["sepa"]["Token"];+ let req_data = data["Request"];+ let res_data = data["Response"];+ cy.createConfirmWithTokenPayoutTest(+ 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] Save payment method after successful transaction",+ () => {+ let should_continue = true; // variable that will be used to skip tests if a previous test fails++ it("create customer", () => {+ cy.createCustomerCallTest(customerCreateBody, globalState);+ });++ 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("list customer payment methods", () => {+ cy.listCustomerPMCallTest(globalState);+ });++ it("[Payout] [Bank transfer] [SEPA] Fulfill using Token", () => {+ let data = utils.getConnectorDetails(globalState.get("connectorId"))[+ "bank_transfer_pm"+ ]["sepa"]["Token"];+ let req_data = data["Request"];+ let res_data = data["Response"];+ cy.createConfirmWithTokenPayoutTest(+ 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);+ });+ }+ );+});diff --git a/cypress-tests/cypress/e2e/PayoutUtils/Adyen.js b/cypress-tests/cypress/e2e/PayoutUtils/Adyen.jsindex eaa25e7fa2..b437d89d05 100644--- a/cypress-tests/cypress/e2e/PayoutUtils/Adyen.js+++ b/cypress-tests/cypress/e2e/PayoutUtils/Adyen.js@@ -5,6 +5,30 @@ const card_data = {card_holder_name: "John Smith",};+const payment_card_data = {+ card_number: "4111111111111111",+ card_exp_month: "03",+ card_exp_year: "2030",+ card_holder_name: "John Doe",+};++const billing = {+ address: {+ line1: "Raadhuisplein",+ line2: "92",+ city: "Hoogeveen",+ state: "FL",+ zip: "7901 BW",+ country: "NL",+ first_name: "John",+ last_name: "Doe",+ },+ phone: {+ number: "0650242319",+ country_code: "+31",+ },+};+export const connectorDetails = {card_pm: {Create: {@@ -46,6 +70,34 @@ export const connectorDetails = {},currency: "EUR",payout_type: "card",+ recurring: true,+ },+ Response: {+ status: 200,+ body: {+ status: "success",+ payout_type: "card",+ },+ },+ },+ SavePayoutMethod: {+ Request: {+ payment_method: "card",+ payment_method_type: "credit",+ card: payment_card_data,+ metadata: {+ city: "NY",+ unit: "245",+ },+ },+ Response: {+ status: 200,+ },+ },+ Token: {+ Request: {+ payout_token: "token",+ payout_type: "card",},Response: {status: 200,@@ -56,4 +108,95 @@ export const connectorDetails = {},},},+ bank_transfer_pm: {+ sepa: {+ Create: {+ Request: {+ payout_type: "bank",+ priority: "regular",+ payout_method_data: {+ bank: {+ iban: "NL57INGB4654188101",+ },+ },+ billing: billing,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_creation",+ payout_type: "bank",+ },+ },+ },+ Confirm: {+ Request: {+ payout_type: "bank",+ priority: "regular",+ payout_method_data: {+ bank: {+ iban: "NL57INGB4654188101",+ },+ },+ billing: billing,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_fulfillment",+ payout_type: "bank",+ },+ },+ },+ Fulfill: {+ Request: {+ payout_type: "bank",+ priority: "regular",+ payout_method_data: {+ bank: {+ iban: "NL57INGB4654188101",+ },+ },+ billing: billing,+ recurring: true,+ },+ Response: {+ status: 200,+ body: {+ status: "initiated",+ payout_type: "bank",+ },+ },+ },+ SavePayoutMethod: {+ Request: {+ payment_method: "bank_transfer",+ payment_method_type: "sepa",+ bank_transfer: {+ iban: "NL57INGB4654188101",+ },+ },+ Response: {+ status: 200,+ body: {+ payment_method: "bank_transfer",+ payment_method_type: "sepa",+ },+ },+ },+ Token: {+ Request: {+ payout_token: "token",+ payout_type: "bank",+ },+ Response: {+ status: 200,+ body: {+ status: "initiated",+ payout_type: "bank",+ },+ },+ },+ },+ },};diff --git a/cypress-tests/cypress/e2e/PayoutUtils/AdyenPlatform.js b/cypress-tests/cypress/e2e/PayoutUtils/AdyenPlatform.jsnew file mode 100644index 0000000000..56975f140f--- /dev/null+++ b/cypress-tests/cypress/e2e/PayoutUtils/AdyenPlatform.js@@ -0,0 +1,111 @@+const billing = {+ address: {+ line1: "Raadhuisplein",+ line2: "92",+ city: "Hoogeveen",+ state: "FL",+ zip: "7901 BW",+ country: "NL",+ first_name: "John",+ last_name: "Doe",+ },+ phone: {+ number: "0650242319",+ country_code: "+31",+ },+};++export const connectorDetails = {+ bank_transfer_pm: {+ sepa: {+ Create: {+ Request: {+ payout_type: "bank",+ priority: "instant",+ payout_method_data: {+ bank: {+ iban: "NL57INGB4654188101",+ },+ },+ billing: billing,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_creation",+ payout_type: "bank",+ },+ },+ },+ Confirm: {+ Request: {+ payout_type: "bank",+ priority: "instant",+ payout_method_data: {+ bank: {+ iban: "NL57INGB4654188101",+ },+ },+ billing: billing,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_fulfillment",+ payout_type: "bank",+ },+ },+ },+ Fulfill: {+ Request: {+ payout_type: "bank",+ priority: "instant",+ payout_method_data: {+ bank: {+ iban: "NL57INGB4654188101",+ },+ },+ billing: billing,+ recurring: true,+ },+ Response: {+ status: 200,+ body: {+ status: "success",+ payout_type: "bank",+ },+ },+ },+ SavePayoutMethod: {+ Request: {+ payment_method: "bank_transfer",+ payment_method_type: "sepa",+ bank_transfer: {+ iban: "NL57INGB4654188101",+ },+ },+ Response: {+ status: 200,+ body: {+ payment_method: "bank_transfer",+ payment_method_type: "sepa",+ },+ },+ },+ Token: {+ Request: {+ payout_token: "token",+ payout_type: "bank",+ priority: "instant",+ },+ Response: {+ status: 200,+ body: {+ status: "success",+ payout_type: "bank",+ },+ },+ },+ },+ },+};diff --git a/cypress-tests/cypress/e2e/PayoutUtils/Commons.js b/cypress-tests/cypress/e2e/PayoutUtils/Commons.jsnew file mode 100644index 0000000000..f40149e22b--- /dev/null+++ b/cypress-tests/cypress/e2e/PayoutUtils/Commons.js@@ -0,0 +1,221 @@+// This file is the default. To override, add to connector.js+import State from "../../utils/State";++const globalState = new State({+ connectorId: Cypress.env("CONNECTOR"),+ baseUrl: Cypress.env("BASEURL"),+ adminApiKey: Cypress.env("ADMINAPIKEY"),+ connectorAuthFilePath: Cypress.env("CONNECTOR_AUTH_FILE_PATH"),+});++const connectorName = normalise(globalState.get("connectorId"));++function normalise(input) {+ const exceptions = {+ adyenplatform: "Adyenplatform",+ wise: "Wise",+ // Add more known exceptions here+ };++ if (exceptions[input.toLowerCase()]) {+ return exceptions[input.toLowerCase()];+ } else {+ return input;+ }+}++const card_data = {+ card_number: "4111111111111111",+ expiry_month: "3",+ expiry_year: "2030",+ card_holder_name: "John Smith",+};++const payment_card_data = {+ card_number: "4111111111111111",+ card_exp_month: "03",+ card_exp_year: "2030",+ card_holder_name: "John Doe",+};++const billing = {+ address: {+ line1: "Raadhuisplein",+ line2: "92",+ city: "Hoogeveen",+ state: "FL",+ zip: "7901 BW",+ country: "NL",+ first_name: "John",+ last_name: "Doe",+ },+ phone: {+ number: "0650242319",+ country_code: "+31",+ },+};++/*+`getDefaultExchange` contains the default Request and Response to be considered if none provided.+`getCustomExchange` takes in 2 optional fields named as Request and Response.+with `getCustomExchange`, if 501 response is expected, there is no need to pass Response as it considers default values.+*/++// Const to get default PaymentExchange object+const getDefaultExchange = () => ({+ Request: {},+ Response: {+ status: 501,+ body: {+ error: {+ type: "invalid_request",+ message: `Selected payment method through ${connectorName} is not implemented`,+ code: "IR_00",+ },+ },+ },+});++// Const to get PaymentExchange with overridden properties+export const getCustomExchange = (overrides) => {+ const defaultExchange = getDefaultExchange();++ return {+ ...defaultExchange,+ Request: {+ ...defaultExchange.Request,+ ...(overrides.Request || {}),+ },+ Response: {+ ...defaultExchange.Response,+ ...(overrides.Response || {}),+ },+ };+};++export const connectorDetails = {+ card_pm: {+ Create: getCustomExchange({+ Request: {+ payout_type: "card",+ payout_method_data: {+ card: card_data,+ },+ currency: "EUR",+ payout_type: "card",+ },+ Response: {+ status: 200,+ body: {+ status: "requires_creation",+ payout_type: "card",+ },+ },+ }),+ Confirm: getCustomExchange({+ Request: {+ payout_type: "card",+ payout_method_data: {+ card: card_data,+ },+ currency: "EUR",+ payout_type: "card",+ },+ Response: {+ status: 200,+ body: {+ status: "requires_fulfillment",+ payout_type: "card",+ },+ },+ }),+ Fulfill: getCustomExchange({+ Request: {+ payout_type: "card",+ payout_method_data: {+ card: card_data,+ },+ currency: "EUR",+ payout_type: "card",+ },+ }),+ SavePayoutMethod: getCustomExchange({+ Request: {+ payment_method: "card",+ payment_method_type: "credit",+ card: payment_card_data,+ metadata: {+ city: "NY",+ unit: "245",+ },+ },+ Response: {+ status: 200,+ },+ }),+ Token: getCustomExchange({+ Request: {+ payout_token: "token",+ payout_type: "card",+ },+ }),+ },+ bank_transfer_pm: {+ Create: getCustomExchange({+ Request: {+ payout_type: "bank",+ priority: "regular",+ payout_method_data: {+ bank: {+ iban: "NL57INGB4654188101",+ },+ },+ billing: billing,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_creation",+ payout_type: "bank",+ },+ },+ }),+ Confirm: getCustomExchange({+ Request: {+ payout_type: "bank",+ priority: "regular",+ payout_method_data: {+ bank: {+ iban: "NL57INGB4654188101",+ },+ },+ billing: billing,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_fulfillment",+ payout_type: "bank",+ },+ },+ }),+ Fulfill: getCustomExchange({+ Request: {+ payout_type: "bank",+ priority: "regular",+ payout_method_data: {+ bank: {+ iban: "NL57INGB4654188101",+ },+ },+ billing: billing,+ },+ }),+ Token: getCustomExchange({+ Request: {+ payout_token: "token",+ payout_type: "card",+ },+ }),+ },+};diff --git a/cypress-tests/cypress/e2e/PayoutUtils/Wise.js b/cypress-tests/cypress/e2e/PayoutUtils/Wise.jsnew file mode 100644index 0000000000..6e14c0a6b6--- /dev/null+++ b/cypress-tests/cypress/e2e/PayoutUtils/Wise.js@@ -0,0 +1,232 @@+const card_data = {+ card_number: "4111111111111111",+ expiry_month: "3",+ expiry_year: "2030",+ card_holder_name: "John Smith",+};++const payment_card_data = {+ card_number: "4111111111111111",+ card_exp_month: "03",+ card_exp_year: "2030",+ card_holder_name: "John Doe",+};++const billing = {+ address: {+ line1: "1467",+ line2: "Harrison Street",+ line3: "Harrison Street",+ city: "San Fransico",+ state: "CA",+ zip: "94122",+ country: "US",+ first_name: "John",+ last_name: "Doe",+ },+ phone: {+ number: "8056594427",+ country_code: "+91",+ },+};++export const connectorDetails = {+ card_pm: {+ Create: {+ Request: {+ payout_method_data: {+ card: card_data,+ },+ currency: "EUR",+ payout_type: "card",+ },+ Response: {+ status: 501,+ body: {+ error: {+ type: "invalid_request",+ message: `Payout Eligibility for Wise is not implemented`,+ code: "IR_00",+ },+ },+ },+ },+ Confirm: {+ Request: {+ payout_method_data: {+ card: card_data,+ },+ currency: "EUR",+ payout_type: "card",+ },+ Response: {+ status: 501,+ body: {+ error: {+ type: "invalid_request",+ message: `Payout Eligibility for Wise is not implemented`,+ code: "IR_00",+ },+ },+ },+ },+ Fulfill: {+ Request: {+ payout_method_data: {+ card: card_data,+ },+ currency: "EUR",+ payout_type: "card",+ recurring: true,+ },+ Response: {+ status: 501,+ body: {+ error: {+ type: "invalid_request",+ message: `Payout Eligibility for Wise is not implemented`,+ code: "IR_00",+ },+ },+ },+ },+ SavePayoutMethod: {+ Request: {+ payment_method: "card",+ payment_method_type: "credit",+ card: payment_card_data,+ metadata: {+ city: "NY",+ unit: "245",+ },+ },+ Response: {+ status: 200,+ },+ },+ Token: {+ Request: {+ payout_token: "token",+ payout_type: "card",+ },+ Response: {+ status: 501,+ body: {+ error: {+ type: "invalid_request",+ message: `Payout Eligibility for Wise is not implemented`,+ code: "IR_00",+ },+ },+ },+ },+ },+ bank_transfer_pm: {+ sepa: {+ Create: {+ Request: {+ currency: "GBP",+ payout_type: "bank",+ payout_method_data: {+ bank: {+ iban: "NL46TEST0136169112",+ bic: "ABNANL2A",+ bank_name: "Deutsche Bank",+ bank_country_code: "NL",+ bank_city: "Amsterdam",+ },+ },+ billing: billing,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_creation",+ payout_type: "bank",+ },+ },+ },+ Confirm: {+ Request: {+ currency: "GBP",+ payout_type: "bank",+ payout_method_data: {+ bank: {+ iban: "NL46TEST0136169112",+ bic: "ABNANL2A",+ bank_name: "Deutsche Bank",+ bank_country_code: "NL",+ bank_city: "Amsterdam",+ },+ },+ billing: billing,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_fulfillment",+ payout_type: "bank",+ },+ },+ },+ Fulfill: {+ Request: {+ currency: "GBP",+ payout_type: "bank",+ payout_method_data: {+ bank: {+ iban: "NL46TEST0136169112",+ bic: "ABNANL2A",+ bank_name: "Deutsche Bank",+ bank_country_code: "NL",+ bank_city: "Amsterdam",+ },+ },+ billing: billing,+ recurring: true,+ },+ Response: {+ status: 200,+ body: {+ status: "success",+ payout_type: "bank",+ },+ },+ },+ SavePayoutMethod: {+ Request: {+ payment_method: "bank_transfer",+ payment_method_type: "sepa",+ bank_transfer: {+ iban: "NL46TEST0136169112",+ bic: "ABNANL2A",+ bank_name: "Deutsche Bank",+ bank_country_code: "NL",+ bank_city: "Amsterdam",+ },+ },+ Response: {+ status: 200,+ body: {+ payment_method: "bank_transfer",+ payment_method_type: "sepa",+ },+ },+ },+ Token: {+ Request: {+ currency: "GBP",+ payout_token: "token",+ payout_type: "bank",+ },+ Response: {+ status: 200,+ body: {+ status: "success",+ payout_type: "bank",+ },+ },+ },+ },+ },+};diff --git a/cypress-tests/cypress/e2e/PayoutUtils/utils.js b/cypress-tests/cypress/e2e/PayoutUtils/utils.jsindex 619fd313f2..d57aac2290 100644--- a/cypress-tests/cypress/e2e/PayoutUtils/utils.js+++ b/cypress-tests/cypress/e2e/PayoutUtils/utils.js@@ -1,13 +1,54 @@import { connectorDetails as adyenConnectorDetails } from "./Adyen.js";+import { connectorDetails as adyenPlatformConnectorDetails } from "./AdyenPlatform.js";+import { connectorDetails as CommonConnectorDetails } from "./Commons.js";+import { connectorDetails as wiseConnectorDetails } from "./Wise.js";const connectorDetails = {adyen: adyenConnectorDetails,+ adyenplatform: adyenPlatformConnectorDetails,+ commons: CommonConnectorDetails,+ wise: wiseConnectorDetails,};-export const getConnectorDetails = (connectorId) => {- let x = getValueByKey(connectorDetails, connectorId);+export function getConnectorDetails(connectorId) {+ let x = mergeDetails(connectorId);return x;-};+}++function mergeDetails(connectorId) {+ const connectorData = getValueByKey(connectorDetails, connectorId);+ const fallbackData = getValueByKey(connectorDetails, "commons");+ // Merge data, prioritizing connectorData and filling missing data from fallbackData+ const mergedDetails = mergeConnectorDetails(connectorData, fallbackData);+ return mergedDetails;+}++function mergeConnectorDetails(source, fallback) {+ const merged = {};++ // Loop through each key in the source object+ for (const key in source) {+ merged[key] = { ...source[key] }; // Copy properties from source++ // Check if fallback has the same key and properties are missing in source+ if (fallback[key]) {+ for (const subKey in fallback[key]) {+ if (!merged[key][subKey]) {+ merged[key][subKey] = fallback[key][subKey];+ }+ }+ }+ }++ // Add missing keys from fallback that are not present in source+ for (const key in fallback) {+ if (!merged[key]) {+ merged[key] = fallback[key];+ }+ }++ return merged;+}function getValueByKey(jsonObject, key) {const data =diff --git a/cypress-tests/cypress/e2e/RoutingTest/00000-PaymentRoutingTest.cy.js b/cypress-tests/cypress/e2e/RoutingTest/00000-PaymentRoutingTest.cy.jsindex 7d22791396..16f7458eaa 100644--- a/cypress-tests/cypress/e2e/RoutingTest/00000-PaymentRoutingTest.cy.js+++ b/cypress-tests/cypress/e2e/RoutingTest/00000-PaymentRoutingTest.cy.js@@ -19,7 +19,6 @@ describe("Routing Test", () => {before("seed global state", () => {cy.task("getGlobalState").then((state) => {globalState = new State(state);-});});@@ -71,7 +70,7 @@ describe("Routing Test", () => {res_data,"priority",routing_data,- globalState,+ globalState);if (should_continue)should_continue = utils.should_continue_further(res_data);@@ -105,7 +104,7 @@ describe("Routing Test", () => {res_data,"no_three_ds","automatic",- globalState,+ globalState);if (should_continue)should_continue = utils.should_continue_further(res_data);diff --git a/cypress-tests/cypress/fixtures/create-payout-confirm-body.json b/cypress-tests/cypress/fixtures/create-payout-confirm-body.jsonindex 2eb32bf26d..5834873cc0 100644--- a/cypress-tests/cypress/fixtures/create-payout-confirm-body.json+++ b/cypress-tests/cypress/fixtures/create-payout-confirm-body.json@@ -1,5 +1,5 @@{- "amount": 1,+ "amount": 100,"currency": "EUR","customer_id": "payout_customer","email": "[email protected]",@@ -7,8 +7,6 @@"phone": "999999999","phone_country_code": "+65","description": "Its my first payout request",- "payout_type": "card",- "payout_method_data": {},"billing": {"address": {"line1": "1467",diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.jsindex 61a449c5f1..c886ebe832 100644--- a/cypress-tests/cypress/support/commands.js+++ b/cypress-tests/cypress/support/commands.js@@ -65,7 +65,7 @@ Cypress.Commands.add(// Handle the response as neededglobalState.set("publishableKey", response.body.publishable_key);});- },+ });Cypress.Commands.add("apiKeyCreateTest", (apiKeyCreateBody, globalState) => {@@ -98,7 +98,7 @@ Cypress.Commands.add((jsonContent) => {const authDetails = getValueByKey(JSON.stringify(jsonContent),- globalState.get("connectorId"),+ globalState.get("connectorId"));createConnectorBody.connector_account_details = authDetails;cy.request({@@ -116,18 +116,18 @@ Cypress.Commands.add(if (response.status === 200) {expect(globalState.get("connectorId")).to.equal(- response.body.connector_name,+ response.body.connector_name);} else {cy.task("cli_log",- "response status -> " + JSON.stringify(response.status),+ "response status -> " + JSON.stringify(response.status));}});- },+ });- },+ });Cypress.Commands.add(@@ -141,11 +141,20 @@ Cypress.Commands.add(// it is best to use then() to handle the response within the same block of codecy.readFile(globalState.get("connectorAuthFilePath")).then((jsonContent) => {- const authDetails = getValueByKey(+ let authDetails = getValueByKey(JSON.stringify(jsonContent),- `${connectorName}_payout`,+ `${connectorName}_payout`);+ let sourceBalanceAccount = null;+ if (authDetails && typeof authDetails === "object") {+ // Specific to `AdyenPlatform` payout connector+ // If the connector has source_balance_account in creds file, set it in the body and remove it from authDetails+ sourceBalanceAccount = authDetails.source_balance_account;+ delete authDetails.source_balance_account;+ }+ authDetails = authDetails;+// If the connector does not have payout connector creds in creds file, set payoutsExecution to falseif (authDetails === null) {globalState.set("payoutsExecution", false);@@ -155,6 +164,8 @@ Cypress.Commands.add(}createConnectorBody.connector_account_details = authDetails;+ createConnectorBody.metadata.source_balance_account =+ sourceBalanceAccount;cy.request({method: "POST",url: `${globalState.get("baseUrl")}/account/${merchantId}/connectors`,@@ -170,18 +181,18 @@ Cypress.Commands.add(if (response.status === 200) {expect(globalState.get("connectorId")).to.equal(- response.body.connector_name,+ response.body.connector_name);} else {cy.task("cli_log",- "response status -> " + JSON.stringify(response.status),+ "response status -> " + JSON.stringify(response.status));}});- },+ });- },+ });function getValueByKey(jsonObject, key) {@@ -210,7 +221,7 @@ Cypress.Commands.add(globalState.set("customerId", response.body.customer_id);});- },+ });Cypress.Commands.add(@@ -221,7 +232,7 @@ Cypress.Commands.add(res_data,authentication_type,capture_method,- globalState,+ globalState) => {if (!request ||@@ -230,7 +241,7 @@ Cypress.Commands.add(!authentication_type) {throw new Error(- "Invalid parameters provided to createPaymentIntentTest command",+ "Invalid parameters provided to createPaymentIntentTest command");}request.currency = req_data.currency;@@ -272,7 +283,7 @@ Cypress.Commands.add(defaultErrorHandler(response, res_data);}});- },+ });Cypress.Commands.add("paymentMethodsCallTest", (globalState) => {@@ -297,6 +308,37 @@ Cypress.Commands.add("paymentMethodsCallTest", (globalState) => {});});+Cypress.Commands.add(+ "createPaymentMethodTest",+ (globalState, req_data, res_data) => {+ req_data.customer_id = globalState.get("customerId");++ cy.request({+ method: "POST",+ url: `${globalState.get("baseUrl")}/payment_methods`,+ body: req_data,+ headers: {+ "Content-Type": "application/json",+ Accept: "application/json",+ "api-key": globalState.get("apiKey"),+ },+ }).then((response) => {+ logRequestId(response.headers["x-request-id"]);++ expect(res_data.status).to.equal(response.status);+ expect(response.headers["content-type"]).to.include("application/json");++ if (response.status === 200) {+ expect(response.body).to.have.property("payment_method_id");+ expect(response.body).to.have.property("client_secret");+ globalState.set("paymentMethodId", response.body.payment_method_id);+ } else {+ defaultErrorHandler(response, res_data);+ }+ });+ }+);+Cypress.Commands.add("confirmCallTest",(confirmBody, req_data, res_data, confirm, globalState) => {@@ -328,7 +370,7 @@ Cypress.Commands.add(.to.have.property("redirect_to_url");globalState.set("nextActionUrl",- response.body.next_action.redirect_to_url,+ response.body.next_action.redirect_to_url);} else if (response.body.authentication_type === "no_three_ds") {for (const key in res_data.body) {@@ -344,7 +386,7 @@ Cypress.Commands.add(.to.have.property("redirect_to_url");globalState.set("nextActionUrl",- response.body.next_action.redirect_to_url,+ response.body.next_action.redirect_to_url);} else if (response.body.authentication_type === "no_three_ds") {for (const key in res_data.body) {@@ -358,7 +400,7 @@ Cypress.Commands.add(defaultErrorHandler(response, res_data);}});- },+ });Cypress.Commands.add(@@ -410,12 +452,12 @@ Cypress.Commands.add(.to.have.property("redirect_to_url");globalState.set("nextActionUrl",- response.body.next_action.redirect_to_url,+ response.body.next_action.redirect_to_url);}} else if (response.body.status === "failed") {expect(response.body.error_code).to.equal(- res_data.body.error_code,+ res_data.body.error_code);}} else {@@ -432,7 +474,7 @@ Cypress.Commands.add(.to.have.property("redirect_to_url");globalState.set("nextActionUrl",- response.body.next_action.redirect_to_url,+ response.body.next_action.redirect_to_url);} else {defaultErrorHandler(response, res_data);@@ -442,7 +484,7 @@ Cypress.Commands.add(defaultErrorHandler(response, res_data);}});- },+ });Cypress.Commands.add(@@ -482,7 +524,7 @@ Cypress.Commands.add(.to.have.property("qr_code_url");globalState.set("nextActionUrl", // This is intentionally kept as nextActionUrl to avoid issues during handleRedirection call,- response.body.next_action.qr_code_url,+ response.body.next_action.qr_code_url);break;default:@@ -491,7 +533,7 @@ Cypress.Commands.add(.to.have.property("redirect_to_url");globalState.set("nextActionUrl",- response.body.next_action.redirect_to_url,+ response.body.next_action.redirect_to_url);break;}@@ -502,7 +544,7 @@ Cypress.Commands.add(defaultErrorHandler(response, res_data);}});- },+ });Cypress.Commands.add(@@ -513,7 +555,7 @@ Cypress.Commands.add(res_data,authentication_type,capture_method,- globalState,+ globalState) => {createConfirmPaymentBody.payment_method_data.card = req_data.card;createConfirmPaymentBody.authentication_type = authentication_type;@@ -549,7 +591,7 @@ Cypress.Commands.add(.to.have.property("redirect_to_url");globalState.set("nextActionUrl",- response.body.next_action.redirect_to_url,+ response.body.next_action.redirect_to_url);} else if (response.body.authentication_type === "no_three_ds") {for (const key in res_data.body) {@@ -568,7 +610,7 @@ Cypress.Commands.add(.to.have.property("redirect_to_url");globalState.set("nextActionUrl",- response.body.next_action.redirect_to_url,+ response.body.next_action.redirect_to_url);} else if (response.body.authentication_type === "no_three_ds") {for (const key in res_data.body) {@@ -582,7 +624,7 @@ Cypress.Commands.add(defaultErrorHandler(response, res_data);}});- },+ });// This is consequent saved card payment confirm call test(Using payment token)@@ -620,7 +662,7 @@ Cypress.Commands.add(expect(res_data.body[key]).to.equal(response.body[key]);}expect(response.body.customer_id).to.equal(- globalState.get("customerId"),+ globalState.get("customerId"));} else {// Handle other authentication types as needed@@ -636,7 +678,7 @@ Cypress.Commands.add(expect(res_data.body[key]).to.equal(response.body[key]);}expect(response.body.customer_id).to.equal(- globalState.get("customerId"),+ globalState.get("customerId"));} else {// Handle other authentication types as needed@@ -647,7 +689,7 @@ Cypress.Commands.add(defaultErrorHandler(response, res_data);}});- },+ });Cypress.Commands.add(@@ -679,7 +721,7 @@ Cypress.Commands.add(defaultErrorHandler(response, res_data);}});- },+ });Cypress.Commands.add(@@ -708,7 +750,7 @@ Cypress.Commands.add(defaultErrorHandler(response, res_data);}});- },+ });Cypress.Commands.add("retrievePaymentCallTest", (globalState) => {@@ -761,7 +803,7 @@ Cypress.Commands.add(defaultErrorHandler(response, res_data);}});- },+ });Cypress.Commands.add(@@ -784,7 +826,7 @@ Cypress.Commands.add(expect(res_data.body[key]).to.equal(response.body[key]);}});- },+ });Cypress.Commands.add(@@ -797,7 +839,7 @@ Cypress.Commands.add(confirm,capture_method,payment_type,- globalState,+ globalState) => {requestBody.payment_method_data.card = req_data.card;requestBody.payment_type = payment_type;@@ -834,7 +876,7 @@ Cypress.Commands.add(const nextActionUrl = response.body.next_action.redirect_to_url;globalState.set("nextActionUrl",- response.body.next_action.redirect_to_url,+ response.body.next_action.redirect_to_url);cy.log(response.body);cy.log(nextActionUrl);@@ -859,7 +901,7 @@ Cypress.Commands.add(defaultErrorHandler(response, res_data);}});- },+ });Cypress.Commands.add(@@ -912,7 +954,7 @@ Cypress.Commands.add(}}});- },+ });Cypress.Commands.add("listMandateCallTest", (globalState) => {@@ -970,9 +1012,9 @@ Cypress.Commands.add("three_ds",{ redirection_url, expected_url },connectorId,- null,+ null);- },+ });Cypress.Commands.add(@@ -988,10 +1030,10 @@ Cypress.Commands.add("bank_redirect",{ redirection_url, expected_url },connectorId,- payment_method_type,+ payment_method_type);}- },+ });Cypress.Commands.add(@@ -1004,9 +1046,9 @@ Cypress.Commands.add("bank_transfer",{ redirection_url, expected_redirection },connectorId,- payment_method_type,+ payment_method_type);- },+ });Cypress.Commands.add("listCustomerPMCallTest", (globalState) => {@@ -1026,9 +1068,11 @@ Cypress.Commands.add("listCustomerPMCallTest", (globalState) => {const paymentToken =response.body.customer_payment_methods[0].payment_token;globalState.set("paymentToken", paymentToken); // Set paymentToken in globalState- expect(paymentToken).to.equal(globalState.get("paymentToken")); // Verify paymentToken} else {- defaultErrorHandler(response, res_data);+ // We only get an empty array if something's wrong. One exception is a 4xx when no customer exist but it is handled in the test+ expect(response.body)+ .to.have.property("customer_payment_methods")+ .to.be.an("array").and.empty;}});});@@ -1057,7 +1101,7 @@ Cypress.Commands.add(res_data,confirm,auto_fulfill,- globalState,+ globalState) => {for (const key in req_data) {createConfirmPayoutBody[key] = req_data[key];@@ -1094,7 +1138,56 @@ Cypress.Commands.add(}}});- },+ }+);++Cypress.Commands.add(+ "createConfirmWithTokenPayoutTest",+ (+ createConfirmPayoutBody,+ req_data,+ res_data,+ confirm,+ auto_fulfill,+ globalState+ ) => {+ for (const key in req_data) {+ createConfirmPayoutBody[key] = req_data[key];+ }+ createConfirmPayoutBody.customer_id = globalState.get("customerId");+ createConfirmPayoutBody.payout_token = globalState.get("paymentToken");+ createConfirmPayoutBody.auto_fulfill = auto_fulfill;+ createConfirmPayoutBody.confirm = confirm;++ 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"]);++ expect(res_data.status).to.equal(response.status);+ 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 res_data.body) {+ expect(res_data.body[key]).to.equal(response.body[key]);+ }+ } else {+ expect(response.body).to.have.property("error");+ for (const key in res_data.body.error) {+ expect(res_data.body.error[key]).to.equal(response.body.error[key]);+ }+ }+ });+ });Cypress.Commands.add(@@ -1128,7 +1221,7 @@ Cypress.Commands.add(}}});- },+ });Cypress.Commands.add(@@ -1163,7 +1256,7 @@ Cypress.Commands.add(}}});- },+ });Cypress.Commands.add("retrievePayoutCallTest", (globalState) => {@@ -1248,7 +1341,6 @@ Cypress.Commands.add("ListMCAbyMID", (globalState) => {globalState.set("profileId", response.body[0].profile_id);globalState.set("stripeMcaId", response.body[0].merchant_connector_id);globalState.set("adyenMcaId", response.body[1].merchant_connector_id);-});});@@ -1292,7 +1384,7 @@ Cypress.Commands.add(}}});- },+ });Cypress.Commands.add(@@ -1326,7 +1418,7 @@ Cypress.Commands.add(}}});- },+ });Cypress.Commands.add(@@ -1360,5 +1452,5 @@ Cypress.Commands.add(}}});- },+ });diff --git a/cypress-tests/cypress/utils/State.js b/cypress-tests/cypress/utils/State.jsindex 1f81703bdc..84f96c0bda 100644--- a/cypress-tests/cypress/utils/State.js+++ b/cypress-tests/cypress/utils/State.js@@ -8,7 +8,7 @@ class State {this.data["email"] = Cypress.env("HS_EMAIL");this.data["password"] = Cypress.env("HS_PASSWORD");this.data["connectorAuthFilePath"] = Cypress.env(- "CONNECTOR_AUTH_FILE_PATH",+ "CONNECTOR_AUTH_FILE_PATH");}diff --git a/cypress-tests/readme.md b/cypress-tests/readme.mdindex db497bd331..dccb66ed0e 100644--- a/cypress-tests/readme.md+++ b/cypress-tests/readme.md@@ -159,7 +159,7 @@ Cypress.Commands.add("listMandateCallTest", (globalState) => {} else {cy.task("cli_log",- "x-request-id is not available in the response headers",+ "x-request-id is not available in the response headers");}expect(response.headers["content-type"]).to.include("application/json");