Skip to content

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

ci(cypress): add bank redirect flow onlinebankingfpx for fiuu (#10642)

Vasantha35cfb92c66e
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Commons.js b/cypress-tests/cypress/e2e/configs/Payment/Commons.js
index 012e640416..f085d173b8 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Commons.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Commons.js
@@ -221,6 +221,17 @@ export const payment_methods_enabled = [
recurring_enabled: true,
installment_payment_enabled: true,
},
+ {
+ payment_method_type: "online_banking_fpx",
+ payment_experience: null,
+ card_networks: null,
+ accepted_currencies: null,
+ accepted_countries: null,
+ minimum_amount: 1,
+ maximum_amount: 68607706,
+ recurring_enabled: true,
+ installment_payment_enabled: true,
+ },
{
payment_method_type: "sofort",
payment_experience: null,
@@ -552,6 +563,20 @@ export const connectorDetails = {
},
},
}),
+ OnlineBankingFpx: getCustomExchange({
+ Request: {
+ payment_method: "bank_redirect",
+ payment_method_type: "online_banking_fpx",
+ payment_method_data: {
+ bank_redirect: {
+ online_banking_fpx: {
+ issuer: "affin_bank",
+ },
+ },
+ },
+ billing: standardBillingAddress,
+ },
+ }),
Giropay: getCustomExchange({
Request: {
payment_method: "bank_redirect",
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Fiuu.js b/cypress-tests/cypress/e2e/configs/Payment/Fiuu.js
index 9b3e52e979..a9e245f538 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Fiuu.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Fiuu.js
@@ -103,6 +103,33 @@ export const connectorDetails = {
},
},
},
+ bank_redirect_pm: {
+ OnlineBankingFpx: {
+ Request: {
+ payment_method: "bank_redirect",
+ payment_method_type: "online_banking_fpx",
+ amount: 6000,
+ currency: "MYR",
+ payment_method_data: {
+ bank_redirect: {
+ online_banking_fpx: {
+ issuer: "affin_bank",
+ },
+ },
+ },
+ billing: billingAddress,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ net_amount: 6000,
+ amount_received: null,
+ amount: 6000,
+ },
+ },
+ },
+ },
card_pm: {
PaymentIntent: {
Request: {
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Modifiers.js b/cypress-tests/cypress/e2e/configs/Payment/Modifiers.js
index 89310933db..fb6eee785f 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Modifiers.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Modifiers.js
@@ -125,6 +125,7 @@ const CURRENCY_MAP = {
Klarna: "EUR",
Przelewy24: "EUR",
Sofort: "EUR",
+ OnlineBankingFpx: "MYR", // Malaysian payment methods
};
export const getCurrency = (paymentMethodType) => {
diff --git a/cypress-tests/cypress/e2e/spec/Payment/00018-BankRedirect.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00018-BankRedirect.cy.js
index 4e27e7e504..328a357dd6 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/00018-BankRedirect.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/00018-BankRedirect.cy.js
@@ -300,4 +300,72 @@ describe("Bank Redirect tests", () => {
);
});
});
+
+ context("OnlineBankingFpx Create and Confirm flow test", () => {
+ let shouldContinue = 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);
+ });
+ });
+
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+
+ it("create-payment-call-test", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_redirect_pm"
+ ]["PaymentIntent"]("OnlineBankingFpx");
+
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "three_ds",
+ "automatic",
+ globalState
+ );
+ if (shouldContinue) shouldContinue = utils.should_continue_further(data);
+ });
+
+ it("payment_methods-call-test", () => {
+ cy.paymentMethodsCallTest(globalState);
+ });
+
+ it("Confirm bank redirect", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_redirect_pm"
+ ]["OnlineBankingFpx"];
+
+ cy.confirmBankRedirectCallTest(
+ fixtures.confirmBody,
+ data,
+ true,
+ globalState
+ );
+
+ if (shouldContinue) shouldContinue = utils.should_continue_further(data);
+ });
+
+ it("Handle bank redirect redirection", () => {
+ const expected_redirection = fixtures.confirmBody["return_url"];
+ const payment_method_type = globalState.get("paymentMethodType");
+ cy.handleBankRedirectRedirection(
+ globalState,
+ payment_method_type,
+ expected_redirection
+ );
+ });
+
+ it("Sync payment status", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_redirect_pm"
+ ]["OnlineBankingFpx"];
+
+ cy.retrievePaymentCallTest(globalState, data);
+ });
+ });
});
diff --git a/cypress-tests/cypress/support/redirectionHandler.js b/cypress-tests/cypress/support/redirectionHandler.js
index 64d679b2fb..3f5a4494cf 100644
--- a/cypress-tests/cypress/support/redirectionHandler.js
+++ b/cypress-tests/cypress/support/redirectionHandler.js
@@ -314,7 +314,7 @@ function bankRedirectRedirection(
redirectionUrl,
expectedUrl,
connectorId,
- ({ connectorId, paymentMethodType }) => {
+ ({ connectorId, paymentMethodType, constants }) => {
// Renamed expectedUrl arg for clarity
// This callback now runs either in cy.origin (if redirected) or directly (if iframe)
switch (connectorId) {
@@ -622,6 +622,64 @@ function bankRedirectRedirection(
}
break;
+ case "fiuu":
+ if (paymentMethodType === "online_banking_fpx") {
+ cy.log("Handling FIUU OnlineBankingFpx redirect flow");
+
+ cy.get("body", { timeout: constants.TIMEOUT }).then(($body) => {
+ if ($body.find("#txtUsername").length > 0) {
+ cy.get("#txtUsername").clear().type("Gaara", { delay: 10 });
+ }
+
+ if ($body.find("#txtPassword").length > 0) {
+ cy.get("#txtPassword")
+ .clear()
+ .type("letmepaywithsand", { delay: 10 });
+ }
+
+ if ($body.find("#login-btn").length > 0) {
+ cy.get("#login-btn").click();
+ }
+ });
+
+ cy.get("body", { timeout: constants.TIMEOUT }).then(($body) => {
+ const requestTacButton = $body.find(
+ "button.pay-btn:contains('Request TAC')"
+ );
+ if (requestTacButton.length > 0) {
+ cy.wrap(requestTacButton).click();
+ }
+ });
+
+ cy.get("body", { timeout: constants.TIMEOUT }).then(($body) => {
+ const otpText = $body.find("div.otp").text();
+ const otpMatch = otpText.match(/\d+/);
+
+ if (otpMatch) {
+ cy.get("#otp-input")
+ .should("be.visible")
+ .should("be.enabled")
+ .clear()
+ .type(otpMatch[0]);
+ } else {
+ cy.log("FIUU FPX OTP text not found; proceeding without OTP");
+ }
+ });
+
+ cy.contains("button.pay-btn", /Pay Now|Request TAC/i, {
+ timeout: constants.TIMEOUT,
+ })
+ .should("be.visible")
+ .click();
+
+ verifyUrl = true;
+ } else {
+ throw new Error(
+ `Unsupported FIUU payment method type: ${paymentMethodType}`
+ );
+ }
+ break;
+
default:
throw new Error(
`Unsupported connector in handleFlow: ${connectorId}`