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
test(cypress): add payout entity type coverage for wise (#12548)
HS-QUALIBOT76764965c837
diff --git a/cypress-tests/cypress/e2e/configs/Payout/Commons.js b/cypress-tests/cypress/e2e/configs/Payout/Commons.jsindex 749b39cc8d..0606aa5482 100644--- a/cypress-tests/cypress/e2e/configs/Payout/Commons.js+++ b/cypress-tests/cypress/e2e/configs/Payout/Commons.js@@ -153,5 +153,53 @@ export const connectorDetails = {payout_type: "card",},}),+ EntityTypeCompany: getCustomExchange({+ Request: {+ entity_type: "Company",+ },+ }),+ EntityTypeDefault: getCustomExchange({+ Request: {},+ }),+ EntityTypeIndividual: getCustomExchange({+ Request: {+ entity_type: "Individual",+ },+ }),+ EntityTypeInvalid: getCustomExchange({+ Request: {+ entity_type: "InvalidType",+ },+ Response: {+ status: 400,+ body: {+ error: {+ type: "invalid_request",+ message: "Json deserialize error: unknown variant `InvalidType`",+ code: "IR_06",+ },+ },+ },+ }),+ EntityTypeNaturalPerson: getCustomExchange({+ Request: {+ entity_type: "NaturalPerson",+ },+ }),+ EntityTypeNonProfit: getCustomExchange({+ Request: {+ entity_type: "NonProfit",+ },+ }),+ EntityTypePersonal: getCustomExchange({+ Request: {+ entity_type: "Personal",+ },+ }),+ EntityTypePublicSector: getCustomExchange({+ Request: {+ entity_type: "PublicSector",+ },+ }),},};diff --git a/cypress-tests/cypress/e2e/configs/Payout/Utils.js b/cypress-tests/cypress/e2e/configs/Payout/Utils.jsindex 4cff8760be..e35b9ba734 100644--- a/cypress-tests/cypress/e2e/configs/Payout/Utils.js+++ b/cypress-tests/cypress/e2e/configs/Payout/Utils.js@@ -88,6 +88,21 @@ export function getValueByKey(jsonObject, key) {}}+export const CONNECTOR_LISTS = {+ INCLUDE: {+ ENTITY_TYPE: ["wise"],+ },+};++export const ENTITY_TYPE_LIST = [+ { key: "EntityTypeIndividual", name: "Individual" },+ { key: "EntityTypeCompany", name: "Company" },+ { key: "EntityTypeNonProfit", name: "NonProfit" },+ { key: "EntityTypePublicSector", name: "PublicSector" },+ { key: "EntityTypeNaturalPerson", name: "NaturalPerson" },+ { key: "EntityTypePersonal", name: "Personal" },+];+export const should_continue_further = (data) => {const resData = data.Response || {};const configData = validateConfig(data.Configs) || {};diff --git a/cypress-tests/cypress/e2e/configs/Payout/Wise.js b/cypress-tests/cypress/e2e/configs/Payout/Wise.jsindex 7f590e7a60..242b5d605d 100644--- a/cypress-tests/cypress/e2e/configs/Payout/Wise.js+++ b/cypress-tests/cypress/e2e/configs/Payout/Wise.js@@ -227,6 +227,192 @@ export const connectorDetails = {},},},+ EntityTypeCompany: {+ Request: {+ currency: "EUR",+ payout_type: "bank",+ payout_method_data: {+ bank: {+ iban: "NL46TEST0136169112",+ bic: "ABNANL2A",+ bank_name: "Test Bank",+ bank_country_code: "NL",+ bank_city: "Amsterdam",+ },+ },+ billing: billing,+ entity_type: "Company",+ },+ Response: {+ status: 200,+ body: {+ payout_type: "bank",+ },+ },+ },+ EntityTypeDefault: {+ Request: {+ currency: "EUR",+ payout_type: "bank",+ payout_method_data: {+ bank: {+ iban: "NL46TEST0136169112",+ bic: "ABNANL2A",+ bank_name: "Test Bank",+ bank_country_code: "NL",+ bank_city: "Amsterdam",+ },+ },+ billing: billing,+ },+ Response: {+ status: 200,+ body: {+ payout_type: "bank",+ },+ },+ },+ EntityTypeIndividual: {+ Request: {+ currency: "EUR",+ payout_type: "bank",+ payout_method_data: {+ bank: {+ iban: "NL46TEST0136169112",+ bic: "ABNANL2A",+ bank_name: "Test Bank",+ bank_country_code: "NL",+ bank_city: "Amsterdam",+ },+ },+ billing: billing,+ entity_type: "Individual",+ },+ Response: {+ status: 200,+ body: {+ payout_type: "bank",+ },+ },+ },+ EntityTypeInvalid: {+ Request: {+ currency: "EUR",+ payout_type: "bank",+ payout_method_data: {+ bank: {+ iban: "NL46TEST0136169112",+ bic: "ABNANL2A",+ bank_name: "Test Bank",+ bank_country_code: "NL",+ bank_city: "Amsterdam",+ },+ },+ billing: billing,+ entity_type: "InvalidType",+ },+ Response: {+ status: 400,+ body: {+ error: {+ message: "Json deserialize error: unknown variant `InvalidType`",+ code: "IR_06",+ },+ },+ },+ },+ EntityTypeNaturalPerson: {+ Request: {+ currency: "EUR",+ payout_type: "bank",+ payout_method_data: {+ bank: {+ iban: "NL46TEST0136169112",+ bic: "ABNANL2A",+ bank_name: "Test Bank",+ bank_country_code: "NL",+ bank_city: "Amsterdam",+ },+ },+ billing: billing,+ entity_type: "NaturalPerson",+ },+ Response: {+ status: 200,+ body: {+ payout_type: "bank",+ },+ },+ },+ EntityTypeNonProfit: {+ Request: {+ currency: "EUR",+ payout_type: "bank",+ payout_method_data: {+ bank: {+ iban: "NL46TEST0136169112",+ bic: "ABNANL2A",+ bank_name: "Test Bank",+ bank_country_code: "NL",+ bank_city: "Amsterdam",+ },+ },+ billing: billing,+ entity_type: "NonProfit",+ },+ Response: {+ status: 200,+ body: {+ payout_type: "bank",+ },+ },+ },+ EntityTypePersonal: {+ Request: {+ currency: "EUR",+ payout_type: "bank",+ payout_method_data: {+ bank: {+ iban: "NL46TEST0136169112",+ bic: "ABNANL2A",+ bank_name: "Test Bank",+ bank_country_code: "NL",+ bank_city: "Amsterdam",+ },+ },+ billing: billing,+ entity_type: "Personal",+ },+ Response: {+ status: 200,+ body: {+ payout_type: "bank",+ },+ },+ },+ EntityTypePublicSector: {+ Request: {+ currency: "EUR",+ payout_type: "bank",+ payout_method_data: {+ bank: {+ iban: "NL46TEST0136169112",+ bic: "ABNANL2A",+ bank_name: "Test Bank",+ bank_country_code: "NL",+ bank_city: "Amsterdam",+ },+ },+ billing: billing,+ entity_type: "PublicSector",+ },+ Response: {+ status: 200,+ body: {+ payout_type: "bank",+ },+ },+ },},},};diff --git a/cypress-tests/cypress/e2e/spec/Payout/00007-EntityType.cy.js b/cypress-tests/cypress/e2e/spec/Payout/00007-EntityType.cy.jsnew file mode 100644index 0000000000..890e9c4bda--- /dev/null+++ b/cypress-tests/cypress/e2e/spec/Payout/00007-EntityType.cy.js@@ -0,0 +1,108 @@+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import * as utils from "../../configs/Payout/Utils";++let globalState;+let payoutBody;++describe("[Payout] Entity Type", () => {+ let shouldContinue = true;++ before("seed global state", () => {+ cy.task("getGlobalState").then((state) => {+ globalState = new State(state);++ if (!globalState.get("payoutsExecution")) {+ shouldContinue = false;+ }++ if (+ !utils.CONNECTOR_LISTS.INCLUDE.ENTITY_TYPE.includes(+ globalState.get("connectorId")+ )+ ) {+ shouldContinue = false;+ }+ });+ });++ after("flush global state", () => {+ cy.task("setGlobalState", globalState.data);+ });++ beforeEach(function () {+ if (!shouldContinue) {+ this.skip();+ }+ payoutBody = Cypress._.cloneDeep(fixtures.createPayoutBody);+ });++ utils.ENTITY_TYPE_LIST.forEach(({ key, name }) => {+ context(`[Payout] Entity Type - ${name}`, () => {+ let shouldContinue = true;++ beforeEach(function () {+ if (!shouldContinue) {+ this.skip();+ }+ });++ it(`create-payout-with-entity-type-${name.toLowerCase()}-test`, () => {+ const data = utils.getConnectorDetails(globalState.get("connectorId"))[+ "bank_transfer_pm"+ ]["sepa_bank_transfer"][key];++ cy.createConfirmPayoutTest(payoutBody, data, true, true, globalState);+ if (shouldContinue)+ shouldContinue = utils.should_continue_further(data);+ });++ it("retrieve-payout-call-test", () => {+ cy.retrievePayoutCallTest(globalState);+ });+ });+ });++ context("[Payout] Entity Type - Default (Individual)", () => {+ let shouldContinue = true;++ beforeEach(function () {+ if (!shouldContinue) {+ this.skip();+ }+ });++ it("create-payout-with-default-entity-type-test", () => {+ const data = utils.getConnectorDetails(globalState.get("connectorId"))[+ "bank_transfer_pm"+ ]["sepa_bank_transfer"]["EntityTypeDefault"];++ delete payoutBody.entity_type;++ cy.createConfirmPayoutTest(payoutBody, data, true, true, globalState);+ if (shouldContinue) shouldContinue = utils.should_continue_further(data);+ });++ it("retrieve-payout-call-test", () => {+ cy.retrievePayoutCallTest(globalState);+ });+ });++ context("[Payout] Entity Type - Invalid", () => {+ const shouldContinue = true;++ beforeEach(function () {+ if (!shouldContinue) {+ this.skip();+ }+ });++ it("create-payout-with-invalid-entity-type-test", () => {+ const data = utils.getConnectorDetails(globalState.get("connectorId"))[+ "bank_transfer_pm"+ ]["sepa_bank_transfer"]["EntityTypeInvalid"];++ cy.createConfirmPayoutTest(payoutBody, data, true, true, globalState);+ });+ });+});diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.jsindex daf90f251e..873750663a 100644--- a/cypress-tests/cypress/support/commands.js+++ b/cypress-tests/cypress/support/commands.js@@ -1171,7 +1171,10 @@ Cypress.Commands.add("apiKeyListCall", (globalState) => {if (base_url.includes("sandbox") || base_url.includes("integ")) {expect(response.body[key]).to.have.property("key_id").include("snd_").and.not.empty;- } else if (base_url.includes("localhost")) {+ } else if (+ base_url.includes("localhost") ||+ base_url.includes("host.docker.internal")+ ) {expect(response.body[key]).to.have.property("key_id").include("dev_").and.not.empty;}diff --git a/cypress-tests/cypress/utils/RequestBodyUtils.js b/cypress-tests/cypress/utils/RequestBodyUtils.jsindex a61b2cff4a..f680b7f2fd 100644--- a/cypress-tests/cypress/utils/RequestBodyUtils.js+++ b/cypress-tests/cypress/utils/RequestBodyUtils.js@@ -3,6 +3,10 @@ const keyPrefixes = {publishable_key: "pk_dev_",key_id: "dev_",},+ "host.docker.internal": {+ publishable_key: "pk_dev_",+ key_id: "dev_",+ },hyperswitch: {publishable_key: "pk_snd_",key_id: "snd_",