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 redirection handling for iatapay RealTimePayment DuitNow (#12644)
HS-QUALIBOT3488da4d3a1f
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Fiuu.js b/cypress-tests/cypress/e2e/configs/Payment/Fiuu.jsindex 89c9b71896..1c38aac82a 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Fiuu.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Fiuu.js@@ -88,6 +88,9 @@ const requiredFields = {export const connectorDetails = {real_time_payment_pm: {DuitNow: {+ Configs: {+ TRIGGER_SKIP: true, //Since fiuu follows a qr flow we are skipping the qr handling+ },Request: {payment_method: "real_time_payment",payment_method_type: "duit_now",diff --git a/cypress-tests/cypress/e2e/configs/Payment/Iatapay.js b/cypress-tests/cypress/e2e/configs/Payment/Iatapay.jsindex 2015c9d208..10d8ae9550 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Iatapay.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Iatapay.js@@ -106,6 +106,23 @@ export const connectorDetails = {},},},+ DuitNowRetrieve: {+ Configs: {+ CONNECTOR_CREDENTIAL: {+ specName: ["realTimePayment"],+ value: "connector_2",+ },+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ amount: 6000,+ amount_received: 6000,+ amount_capturable: 0,+ },+ },+ },},card_pm: {ZeroAuthMandate: {diff --git a/cypress-tests/cypress/e2e/spec/Payment/31-RealTimePayment.cy.js b/cypress-tests/cypress/e2e/spec/Payment/31-RealTimePayment.cy.jsindex 93d8c0a20d..00ea586124 100644--- a/cypress-tests/cypress/e2e/spec/Payment/31-RealTimePayment.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/31-RealTimePayment.cy.js@@ -16,7 +16,7 @@ describe("Real Time Payment", () => {});context("DuitNow automatic capture flow", () => {- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails+ let shouldContinue = true;beforeEach(function () {if (!shouldContinue) {@@ -59,12 +59,33 @@ describe("Real Time Payment", () => {if (shouldContinue) shouldContinue = utils.should_continue_further(data);});+ it("Handle Redirection", () => {+ const expected_redirection = fixtures.confirmBody["return_url"];+ cy.handleRedirection(globalState, expected_redirection);+ });+it("Retrieve Payment", () => {const data = getConnectorDetails(globalState.get("connectorId"))["real_time_payment_pm"- ]["DuitNow"];+ ]["DuitNowRetrieve"];++ cy.retrievePaymentCallTest({+ globalState,+ data,+ expectedIntentStatus: "succeeded",+ });+ });- cy.retrievePaymentCallTest({ globalState, data });+ it("Sync Payment", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "real_time_payment_pm"+ ]["DuitNowRetrieve"];++ cy.retrievePaymentCallTest({+ globalState,+ data,+ expectedIntentStatus: "succeeded",+ });});});});diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.jsindex c87f20300a..0c8636b3d0 100644--- a/cypress-tests/cypress/support/commands.js+++ b/cypress-tests/cypress/support/commands.js@@ -5084,7 +5084,7 @@ Cypress.Commands.add("three_ds",{ redirectionUrl, expectedUrl },connectorId,- null+ globalState.get("paymentMethodType"));});@@ -5345,10 +5345,15 @@ Cypress.Commands.add(response.body[key]);}- if (response.body.connector === "iatapay")+ if (response.body.connector === "iatapay") {expect(response.body).to.have.property("next_action").to.have.property("redirect_to_url");+ globalState.set(+ "nextActionUrl",+ response.body.next_action.redirect_to_url+ );+ }break;default:diff --git a/cypress-tests/cypress/support/redirectionHandler.js b/cypress-tests/cypress/support/redirectionHandler.jsindex 67d1167f86..b38510f9f7 100644--- a/cypress-tests/cypress/support/redirectionHandler.js+++ b/cypress-tests/cypress/support/redirectionHandler.js@@ -61,7 +61,8 @@ export function handleRedirection(threeDsRedirection(urls.redirectionUrl,urls.expectedUrl,- resolvedConnectorId+ resolvedConnectorId,+ paymentMethodType);break;case "upi":@@ -1981,7 +1982,12 @@ function bankRedirectRedirection(});}-function threeDsRedirection(redirectionUrl, expectedUrl, connectorId) {+function threeDsRedirection(+ redirectionUrl,+ expectedUrl,+ connectorId,+ paymentMethodType+) {let responseContentType = null;// First check what type of response we get from the redirect URL@@ -2051,6 +2057,26 @@ function threeDsRedirection(redirectionUrl, expectedUrl, connectorId) {return;}+ if (connectorId === "iatapay" && paymentMethodType === "duit_now") {+ cy.log("Starting iatapay RealTimePayment redirection flow for DuitNow");++ cy.get(".iatapay-button.iatapay-button--secondary", {+ timeout: CONSTANTS.TIMEOUT,+ })+ .should("be.visible")+ .click();++ cy.log("Clicked Simulate button");++ cy.url({ timeout: CONSTANTS.TIMEOUT }).should(+ "include",+ expectedUrl.hostname+ );++ verifyReturnUrl(redirectionUrl, expectedUrl, true);+ return;+ }+// Special handling for Airwallex which uses multiple domains in 3DS flow// Handle separately to avoid nested cy.origin() callsif (connectorId === "airwallex") {