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 wallet coverage for mifinity (#12295)
HS-QUALIBOT8665f1dade80
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Commons.js b/cypress-tests/cypress/e2e/configs/Payment/Commons.jsindex ec0ec5229b..57d7687c23 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Commons.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Commons.js@@ -542,6 +542,14 @@ export const payment_methods_enabled = [recurring_enabled: false,installment_payment_enabled: false,},+ {+ payment_method_type: "mifinity",+ payment_experience: "redirect_to_url",+ minimum_amount: 1,+ maximum_amount: 68607706,+ recurring_enabled: false,+ installment_payment_enabled: false,+ },{payment_method_type: "paypal",payment_experience: "redirect_to_url",@@ -1128,6 +1136,33 @@ export const connectorDetails = {TRIGGER_SKIP: true,},}),+ Mifinity: getCustomExchange({+ Request: {+ payment_method: "wallet",+ payment_method_type: "mifinity",+ authentication_type: "no_three_ds",+ billing: {+ ...standardBillingAddress,+ address: {+ ...standardBillingAddress.address,+ country: "GB",+ },+ phone: {+ number: "1234567890",+ country_code: "+44",+ },+ email: "[email protected]",+ },+ payment_method_data: {+ wallet: {+ mifinity: {+ date_of_birth: "1990-01-01",+ language_preference: "en",+ },+ },+ },+ },+ }),PaypalRedirect: getCustomExchange({Request: {payment_method: "wallet",diff --git a/cypress-tests/cypress/e2e/configs/Payment/Mifinity.js b/cypress-tests/cypress/e2e/configs/Payment/Mifinity.jsnew file mode 100644index 0000000000..5c4d2e2688--- /dev/null+++ b/cypress-tests/cypress/e2e/configs/Payment/Mifinity.js@@ -0,0 +1,42 @@+import { getCustomExchange } from "./Modifiers";+import { standardBillingAddress } from "./Commons";++export const connectorDetails = {+ wallet_pm: {+ Mifinity: getCustomExchange({+ Request: {+ payment_method: "wallet",+ payment_method_type: "mifinity",+ authentication_type: "no_three_ds",+ billing: {+ ...standardBillingAddress,+ address: {+ ...standardBillingAddress.address,+ country: "GB",+ },+ phone: {+ number: "1234567890",+ country_code: "+44",+ },+ email: "[email protected]",+ },+ payment_method_data: {+ wallet: {+ mifinity: {+ date_of_birth: "1990-01-01",+ language_preference: "en",+ },+ },+ },+ },+ Response: {+ status: 200,+ body: {+ status: "requires_customer_action",+ payment_method_type: "mifinity",+ connector: "mifinity",+ },+ },+ }),+ },+};diff --git a/cypress-tests/cypress/e2e/configs/Payment/Modifiers.js b/cypress-tests/cypress/e2e/configs/Payment/Modifiers.jsindex 795f3f61ba..2aa0237072 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Modifiers.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Modifiers.js@@ -133,6 +133,7 @@ const CURRENCY_MAP = {OnlineBankingFpx: "MYR", // Malaysian payment methodsInterac: "CAD", // Canadian payment methodAliPayHk: "HKD", // Hong Kong payment method+ Mifinity: "EUR", // Mifinity wallet payment method};export const getCurrency = (paymentMethodType) => {diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.jsindex 725e4c3226..1ca009471b 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js@@ -76,6 +76,7 @@ import { connectorDetails as worldpayvantivConnectorDetails } from "./Worldpayvaimport { connectorDetails as worldpayxmlConnectorDetails } from "./Worldpayxml.js";import { connectorDetails as xenditConnectorDetails } from "./Xendit.js";import { connectorDetails as ziftConnectorDetails } from "./Zift.js";+import { connectorDetails as mifinityConnectorDetails } from "./Mifinity.js";const connectorDetails = {aci: aciConnectorDetails,adyen: adyenConnectorDetails,@@ -151,6 +152,7 @@ const connectorDetails = {xendit: xenditConnectorDetails,zift: ziftConnectorDetails,loonio: loonioConnectorDetails,+ mifinity: mifinityConnectorDetails,};/**@@ -514,6 +516,7 @@ export const CONNECTOR_LISTS = {BLUECODE_WALLET: ["calida"],ALIPAY_HK_WALLET: ["adyen"],PAYPAL_WALLET: ["novalnet", "paypal"],+ MIFINITY_WALLET: ["mifinity"],PAYPAL_MANDATE: ["paypal"],CARD_INSTALLMENTS: ["adyen"],BILLING_DESCRIPTOR: [diff --git a/cypress-tests/cypress/e2e/spec/Payment/19-Wallet.cy.js b/cypress-tests/cypress/e2e/spec/Payment/19-Wallet.cy.jsindex 5587f5a0c7..eecfb1416c 100644--- a/cypress-tests/cypress/e2e/spec/Payment/19-Wallet.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/19-Wallet.cy.js@@ -207,6 +207,113 @@ describe("Wallet tests", () => {});});});++ context("Mifinity Create and Confirm flow test", () => {+ const shouldContinue = true;++ before("seed global state", function () {+ let skip = false;++ cy.task("getGlobalState")+ .then((state) => {+ globalState = new State(state);+ const connector = globalState.get("connectorId");++ if (+ shouldIncludeConnector(+ connector,+ CONNECTOR_LISTS.INCLUDE.MIFINITY_WALLET+ )+ ) {+ skip = true;+ return;+ }+ })+ .then(() => {+ if (skip) {+ this.skip();+ }+ });+ });++ beforeEach(function () {+ if (!shouldContinue) {+ this.skip();+ }+ });++ it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Payment -> Handle Wallet Redirection -> Retrieve Payment", () => {+ let shouldContinue = true;++ cy.step("Create Payment Intent", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "wallet_pm"+ ]["PaymentIntent"]("Mifinity");+ cy.createPaymentIntentTest(+ fixtures.createPaymentBody,+ data,+ "no_three_ds",+ "automatic",+ globalState+ );+ if (!should_continue_further(data)) {+ shouldContinue = false;+ }+ });++ cy.step("List Merchant Payment Methods", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: List Merchant Payment Methods");+ return;+ }+ cy.paymentMethodsCallTest(globalState);+ });++ cy.step("Confirm Payment", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: Confirm Payment");+ return;+ }+ const confirmData = getConnectorDetails(globalState.get("connectorId"))[+ "wallet_pm"+ ]["Mifinity"];+ cy.confirmBankRedirectCallTest(+ fixtures.confirmBody,+ confirmData,+ true,+ globalState+ );+ if (!should_continue_further(confirmData)) {+ shouldContinue = false;+ }+ });++ cy.step("Handle Bank Redirect Redirection", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: Handle Bank Redirect Redirection");+ return;+ }+ const expected_redirection = fixtures.confirmBody["return_url"];+ const payment_method_type = globalState.get("paymentMethodType");+ cy.handleBankRedirectRedirection(+ globalState,+ payment_method_type,+ expected_redirection+ );+ });++ cy.step("Retrieve Payment", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: Retrieve Payment");+ return;+ }+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "wallet_pm"+ ]["Mifinity"];+ cy.retrievePaymentCallTest({ globalState, data });+ });+ });+ });});describe("PayPal Wallet tests", () => {diff --git a/cypress-tests/cypress/support/redirectionHandler.js b/cypress-tests/cypress/support/redirectionHandler.jsindex d4ef639315..1880b26e15 100644--- a/cypress-tests/cypress/support/redirectionHandler.js+++ b/cypress-tests/cypress/support/redirectionHandler.js@@ -494,6 +494,26 @@ function bankRedirectRedirection(connectorId = normalizeConnectorForRedirect(connectorId);let verifyUrl = false;+ // Mifinity wallet redirect: visit the redirect URL and verify the redirection+ // without waiting for a host change (mifinity redirects to an external wallet+ // authentication page that doesn't trigger a secondary redirect)+ if (connectorId === "mifinity") {+ cy.on("uncaught:exception", () => false);++ cy.log(`Handling Mifinity wallet redirect for ${paymentMethodType}`);+ cy.visit(redirectionUrl.href, { failOnStatusCode: false });+ cy.document().should("have.property", "readyState", "complete");+ cy.url().then((currentUrl) => {+ cy.log(`Mifinity redirect: navigated to ${currentUrl}`);+ cy.log("Mifinity wallet redirect verified - redirection is happening");+ });+ verifyUrl = false;+ cy.then(() => {+ verifyReturnUrl(redirectionUrl, expectedUrl, verifyUrl);+ });+ return;+ }+cy.visit(redirectionUrl.href);waitForRedirect(redirectionUrl.href); // Wait for the first redirect