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 bank redirect tests for missing connectors (#12187)
HS-QUALIBOT51dd1d8965d6
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Aci.js b/cypress-tests/cypress/e2e/configs/Payment/Aci.jsindex 2f24438890..8875d217f2 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Aci.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Aci.js@@ -64,6 +64,14 @@ const billingAddress = {},};+const billingAddressAT = {+ ...billingAddress,+ address: {+ ...billingAddress.address,+ country: "AT",+ },+};+export const connectorDetails = {card_pm: {PaymentIntent: {@@ -715,6 +723,82 @@ export const connectorDetails = {},},},+ Giropay: {+ Configs: {+ TRIGGER_SKIP: true,+ },+ Request: {+ payment_method: "bank_redirect",+ payment_method_type: "giropay",+ payment_method_data: {+ bank_redirect: {+ giropay: {+ bank_name: "",+ bank_account_bic: "",+ bank_account_iban: "",+ preferred_language: "en",+ country: "DE",+ },+ },+ },+ billing: billingAddress,+ },+ Response: {+ status: 200,+ body: {+ status: "failed",+ error_code: "800.900.300",+ error_message: "invalid authentication information",+ },+ },+ },+ Eps: {+ Request: {+ payment_method: "bank_redirect",+ payment_method_type: "eps",+ payment_method_data: {+ bank_redirect: {+ eps: {+ bank_name: "ing",+ },+ },+ },+ billing: billingAddressAT,+ },+ Response: {+ status: 200,+ body: {+ status: "failed",+ error_code: "800.900.300",+ error_message: "invalid authentication information",+ },+ },+ },+ Sofort: {+ Configs: {+ TRIGGER_SKIP: true,+ },+ Request: {+ payment_method: "bank_redirect",+ payment_method_type: "sofort",+ payment_method_data: {+ bank_redirect: {+ sofort: {+ country: "DE",+ preferred_language: "en",+ },+ },+ },+ billing: billingAddress,+ },+ Response: {+ status: 200,+ body: {+ status: "failed",+ error_message: "invalid authentication information",+ },+ },+ },Przelewy24: {Request: {payment_method: "bank_redirect",@@ -740,6 +824,31 @@ export const connectorDetails = {},},},+ Interac: {+ Request: {+ payment_method: "bank_redirect",+ payment_method_type: "interac",+ payment_method_data: {+ bank_redirect: {+ interac: {+ bank_name: "ing",+ },+ },+ },+ billing: {+ ...billingAddress,+ email: "[email protected]",+ },+ },+ Response: {+ status: 200,+ body: {+ status: "failed",+ error_code: "800.900.300",+ error_message: "invalid authentication information",+ },+ },+ },},pay_later_pm: {PaymentIntent: getCustomExchange({diff --git a/cypress-tests/cypress/e2e/configs/Payment/Commons.js b/cypress-tests/cypress/e2e/configs/Payment/Commons.jsindex 2a244afcee..0555903032 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Commons.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Commons.js@@ -951,6 +951,23 @@ export const connectorDetails = {},},}),+ Trustly: getCustomExchange({+ Configs: {+ TRIGGER_SKIP: true,+ },+ Request: {+ payment_method: "bank_redirect",+ payment_method_type: "trustly",+ payment_method_data: {+ bank_redirect: {+ trustly: {+ country: "NL",+ },+ },+ },+ billing: standardBillingAddress,+ },+ }),},bank_debit_pm: {PaymentIntent: (paymentMethodType) => {diff --git a/cypress-tests/cypress/e2e/configs/Payment/Globalpay.js b/cypress-tests/cypress/e2e/configs/Payment/Globalpay.jsindex 90ae72322f..918fc4c41f 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Globalpay.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Globalpay.js@@ -885,6 +885,157 @@ export const connectorDetails = {},},},+ bank_redirect_pm: {+ Ideal: {+ Request: {+ payment_method: "bank_redirect",+ payment_method_type: "ideal",+ payment_method_data: {+ bank_redirect: {+ ideal: {+ bank_name: "ing",+ country: "NL",+ },+ },+ },+ billing: {+ address: {+ line1: "1467",+ line2: "Harrison Street",+ line3: "Harrison Street",+ city: "Amsterdam",+ state: "North Holland",+ zip: "1000",+ country: "NL",+ first_name: "john",+ last_name: "doe",+ },+ phone: {+ number: "9123456789",+ country_code: "+31",+ },+ },+ },+ Response: {+ status: 200,+ body: {+ status: "requires_customer_action",+ },+ },+ },+ Giropay: {+ Request: {+ payment_method: "bank_redirect",+ payment_method_type: "giropay",+ payment_method_data: {+ bank_redirect: {+ giropay: {+ country: "DE",+ },+ },+ },+ billing: {+ address: {+ line1: "1467",+ line2: "Harrison Street",+ line3: "Harrison Street",+ city: "Berlin",+ state: "Berlin",+ zip: "10115",+ country: "DE",+ first_name: "john",+ last_name: "doe",+ },+ phone: {+ number: "9123456789",+ country_code: "+49",+ },+ },+ },+ Response: {+ status: 200,+ body: {+ status: "requires_customer_action",+ },+ },+ },+ Sofort: {+ Request: {+ payment_method: "bank_redirect",+ payment_method_type: "sofort",+ payment_method_data: {+ bank_redirect: {+ sofort: {+ country: "DE",+ preferred_language: "en",+ },+ },+ },+ billing: {+ address: {+ line1: "1467",+ line2: "Harrison Street",+ line3: "Harrison Street",+ city: "Berlin",+ state: "Berlin",+ zip: "10115",+ country: "DE",+ first_name: "john",+ last_name: "doe",+ },+ phone: {+ number: "9123456789",+ country_code: "+49",+ },+ },+ },+ Response: {+ status: 200,+ body: {+ status: "failed",+ error_code: "INVALID_REQUEST_DATA",+ error_message: "FAILED",+ },+ },+ },+ Eps: {+ Request: {+ payment_method: "bank_redirect",+ payment_method_type: "eps",+ payment_method_data: {+ bank_redirect: {+ eps: {+ bank_name: "bank_austria",+ country: "AT",+ },+ },+ },+ billing: {+ address: {+ line1: "1467",+ line2: "Harrison Street",+ line3: "Harrison Street",+ city: "Vienna",+ state: "Vienna",+ zip: "1010",+ country: "AT",+ first_name: "john",+ last_name: "doe",+ },+ phone: {+ number: "9123456789",+ country_code: "+43",+ },+ },+ },+ Response: {+ status: 200,+ body: {+ status: "requires_customer_action",+ },+ },+ },+ },pm_list: {PmListResponse: {PmListNull: {diff --git a/cypress-tests/cypress/e2e/configs/Payment/Modifiers.js b/cypress-tests/cypress/e2e/configs/Payment/Modifiers.jsindex bf52252fed..795f3f61ba 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Modifiers.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Modifiers.js@@ -128,6 +128,7 @@ const CURRENCY_MAP = {Klarna: "EUR",Przelewy24: "EUR",Sofort: "EUR",+ Trustly: "EUR",OpenBankingUk: "GBP", // Great British Pound payment methodOnlineBankingFpx: "MYR", // Malaysian payment methodsInterac: "CAD", // Canadian payment methoddiff --git a/cypress-tests/cypress/e2e/configs/Payment/Nuvei.js b/cypress-tests/cypress/e2e/configs/Payment/Nuvei.jsindex 24ebd0adf6..55b0b25190 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Nuvei.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Nuvei.js@@ -996,7 +996,7 @@ export const connectorDetails = {Response: {status: 200,body: {- status: "requires_customer_action", // Bank redirect requires customer action+ status: "requires_customer_action",error_code: null,error_message: null,},diff --git a/cypress-tests/cypress/e2e/configs/Payment/Shift4.js b/cypress-tests/cypress/e2e/configs/Payment/Shift4.jsindex 7b6545cc17..68d57c4d9d 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Shift4.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Shift4.js@@ -862,5 +862,78 @@ export const connectorDetails = {},},},+ Giropay: {+ Request: {+ payment_method: "bank_redirect",+ payment_method_type: "giropay",+ payment_method_data: {+ bank_redirect: {+ giropay: {+ bank_name: "",+ bank_account_bic: "",+ bank_account_iban: "",+ preferred_language: "en",+ country: "DE",+ },+ },+ },+ billing: {+ address: {+ line1: "1467",+ line2: "Harrison Street",+ line3: "Harrison Street",+ city: "San Fransico",+ state: "California",+ zip: "94122",+ country: "DE",+ first_name: "john",+ last_name: "doe",+ },+ },+ },+ Response: {+ status: 200,+ body: {+ status: "failed",+ error_code: null,+ error_message: "Payment method type giropay not supported",+ },+ },+ },+ Sofort: {+ Request: {+ payment_method: "bank_redirect",+ payment_method_type: "sofort",+ payment_method_data: {+ bank_redirect: {+ sofort: {+ country: "DE",+ preferred_language: "en",+ },+ },+ },+ billing: {+ address: {+ line1: "1467",+ line2: "Harrison Street",+ line3: "Harrison Street",+ city: "San Fransico",+ state: "California",+ zip: "94122",+ country: "DE",+ first_name: "john",+ last_name: "doe",+ },+ },+ },+ Response: {+ status: 200,+ body: {+ status: "failed",+ error_code: null,+ error_message: "Payment method type sofort not supported",+ },+ },+ },},};diff --git a/cypress-tests/cypress/e2e/spec/Payment/18-BankRedirect.cy.js b/cypress-tests/cypress/e2e/spec/Payment/18-BankRedirect.cy.jsindex 14ff7adc3a..5b1ae20fe0 100644--- a/cypress-tests/cypress/e2e/spec/Payment/18-BankRedirect.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/18-BankRedirect.cy.js@@ -124,6 +124,69 @@ describe("Bank Redirect tests", () => {});});+ context("Giropay Create and Confirm flow test", () => {+ it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Payment -> Handle Bank Redirect Redirection", () => {+ let shouldContinue = true;++ cy.step("Create Payment Intent", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "bank_redirect_pm"+ ]["PaymentIntent"]("Giropay");+ cy.createPaymentIntentTest(+ fixtures.createPaymentBody,+ data,+ "three_ds",+ "automatic",+ globalState+ );+ if (!utils.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"))[+ "bank_redirect_pm"+ ]["Giropay"];+ cy.confirmBankRedirectCallTest(+ fixtures.confirmBody,+ confirmData,+ true,+ globalState+ );+ if (!utils.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+ );+ });+ });+ });+context("iDEAL Create and Confirm flow test", () => {it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Payment -> Handle Bank Redirect Redirection", () => {let shouldContinue = true;@@ -534,4 +597,67 @@ describe("Bank Redirect tests", () => {});});});++ context("Trustly Create and Confirm flow test", () => {+ it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Payment -> Handle Bank Redirect Redirection", () => {+ let shouldContinue = true;++ cy.step("Create Payment Intent", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "bank_redirect_pm"+ ]["PaymentIntent"]("Trustly");+ cy.createPaymentIntentTest(+ fixtures.createPaymentBody,+ data,+ "three_ds",+ "automatic",+ globalState+ );+ if (!utils.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"))[+ "bank_redirect_pm"+ ]["Trustly"];+ cy.confirmBankRedirectCallTest(+ fixtures.confirmBody,+ confirmData,+ true,+ globalState+ );+ if (!utils.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+ );+ });+ });+ });});diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.jsindex b8a42c5c5b..92def1854f 100644--- a/cypress-tests/cypress/support/commands.js+++ b/cypress-tests/cypress/support/commands.js@@ -2558,7 +2558,16 @@ Cypress.Commands.add(Response: resData,} = data || {};- const configInfo = execConfig(validateConfig(configs));+ const validatedConfigs = validateConfig(configs);+ if (validatedConfigs?.TRIGGER_SKIP) {+ cy.task(+ "cli_log",+ "TRIGGER_SKIP enabled, skipping confirmBankRedirectCallTest"+ );+ return;+ }++ const configInfo = execConfig(validatedConfigs);const connectorId = globalState.get("connectorId");const paymentIntentId = globalState.get("paymentID");const profile_id = globalState.get(`${configInfo.profilePrefix}Id`);diff --git a/cypress-tests/cypress/support/redirectionHandler.js b/cypress-tests/cypress/support/redirectionHandler.jsindex 8d0218c3ad..d4ef639315 100644--- a/cypress-tests/cypress/support/redirectionHandler.js+++ b/cypress-tests/cypress/support/redirectionHandler.js@@ -933,7 +933,8 @@ function bankRedirectRedirection(case "nexinets":switch (paymentMethodType) {case "ideal":- // Nexinets iDEAL specific selector - click the Success link+ case "giropay":+ // Nexinets iDEAL/Giropay selector - click the Success linkcy.get("a.btn.btn-primary.btn-block").contains("Success").click();@@ -947,6 +948,63 @@ function bankRedirectRedirection(}break;+ case "globalpay":+ switch (paymentMethodType) {+ case "ideal":+ case "eps":+ cy.get("body", { timeout: 15000 }).then(($body) => {+ const bodyText = $body.text().toLowerCase();+ if (+ bodyText.includes("timeout") ||+ bodyText.includes("error")+ ) {+ cy.log(+ `GlobalPay ${paymentMethodType} timeout detected - skipping interaction`+ );+ verifyUrl = false;+ return;+ }+ if ($body.find('button[type="submit"]').length > 0) {+ cy.get('button[type="submit"]').first().click();+ } else if (+ $body.find(+ '[data-testid*="confirm"], [data-testid*="continue"]'+ ).length > 0+ ) {+ cy.get(+ '[data-testid*="confirm"], [data-testid*="continue"]'+ )+ .first()+ .click();+ }+ });+ verifyUrl = false;+ break;+ case "giropay":+ cy.get("body", { timeout: 10000 }).then(($body) => {+ const bodyText = $body.text().toLowerCase();+ if (+ bodyText.includes("timeout") ||+ bodyText.includes("error") ||+ bodyText.includes("503") ||+ bodyText.includes("unavailable")+ ) {+ cy.log(+ "GlobalPay Giropay redirect page unavailable - skipping interaction"+ );+ verifyUrl = false;+ return;+ }+ });+ verifyUrl = false;+ break;+ default:+ throw new Error(+ `Unsupported GlobalPay payment method type: ${paymentMethodType}`+ );+ }+ break;+case "loonio":switch (paymentMethodType) {case "interac":