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 paypal_redirect wallet coverage for novalnet (#12262)
HS-QUALIBOT02f781fe4bb5
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Commons.js b/cypress-tests/cypress/e2e/configs/Payment/Commons.jsindex 0555903032..ec0ec5229b 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: "paypal",+ payment_experience: "redirect_to_url",+ minimum_amount: 1,+ maximum_amount: 68607706,+ recurring_enabled: false,+ installment_payment_enabled: false,+ },],},{@@ -1120,6 +1128,25 @@ export const connectorDetails = {TRIGGER_SKIP: true,},}),+ PaypalRedirect: getCustomExchange({+ Request: {+ payment_method: "wallet",+ payment_method_type: "paypal",+ authentication_type: "no_three_ds",+ payment_method_data: {+ wallet: {+ paypal_redirect: {},+ },+ },+ billing: standardBillingAddress,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_customer_action",+ },+ },+ }),},pay_later_pm: {PaymentIntent: (paymentMethodType) =>diff --git a/cypress-tests/cypress/e2e/configs/Payment/Novalnet.js b/cypress-tests/cypress/e2e/configs/Payment/Novalnet.jsindex b9c18f2c28..ce5b2303f4 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Novalnet.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Novalnet.js@@ -1,3 +1,5 @@+import { getCustomExchange } from "./Modifiers";+const successfulThreeDSTestCardDetails = {card_number: "4000000000001091",card_exp_month: "12",@@ -802,6 +804,20 @@ export const connectorDetails = {},},},+ wallet_pm: {+ PaymentIntent: () =>+ getCustomExchange({+ Request: {+ currency: "EUR",+ },+ Response: {+ status: 200,+ body: {+ status: "requires_payment_method",+ },+ },+ }),+ },webhook: {TransactionIdConfig: {// Defines how to locate and parse the payment reference ID from connector-specific webhook payloadsdiff --git a/cypress-tests/cypress/e2e/configs/Payment/Paypal.js b/cypress-tests/cypress/e2e/configs/Payment/Paypal.jsindex 0ce041b30e..b1deb4ae86 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Paypal.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Paypal.js@@ -1,4 +1,5 @@import { getCustomExchange } from "./Modifiers";+import { standardBillingAddress } from "./Commons";const successfulNo3DSCardDetails = {card_number: "4012000033330026",@@ -934,6 +935,48 @@ export const connectorDetails = {},},},+ wallet_pm: {+ PaypalRedirect: {+ Request: {+ payment_method: "wallet",+ payment_method_type: "paypal",+ authentication_type: "no_three_ds",+ billing: standardBillingAddress,+ payment_method_data: {+ wallet: {+ paypal_redirect: {},+ },+ },+ },+ Response: {+ status: 200,+ body: {+ status: "requires_customer_action",+ },+ },+ },+ PaypalRedirectMandateCIT: {+ Request: {+ payment_method: "wallet",+ payment_method_type: "paypal",+ authentication_type: "no_three_ds",+ billing: standardBillingAddress,+ payment_method_data: {+ wallet: {+ paypal_redirect: {},+ },+ },+ setup_future_usage: "off_session",+ mandate_data: singleUseMandateData,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_customer_action",+ },+ },+ },+ },webhook: {TransactionIdConfig: {path: "resource.supplementary_data.related_ids.order_id",diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.jsindex 6646965c13..725e4c3226 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js@@ -511,6 +511,10 @@ export const CONNECTOR_LISTS = {"stripe",],BANK_DEBIT: ["adyen", "novalnet", "payload"], // payload verified as working+ BLUECODE_WALLET: ["calida"],+ ALIPAY_HK_WALLET: ["adyen"],+ PAYPAL_WALLET: ["novalnet", "paypal"],+ PAYPAL_MANDATE: ["paypal"],CARD_INSTALLMENTS: ["adyen"],BILLING_DESCRIPTOR: ["adyen",diff --git a/cypress-tests/cypress/e2e/spec/Payment/19-Wallet.cy.js b/cypress-tests/cypress/e2e/spec/Payment/19-Wallet.cy.jsindex f61cdaccb0..5587f5a0c7 100644--- a/cypress-tests/cypress/e2e/spec/Payment/19-Wallet.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/19-Wallet.cy.js@@ -1,9 +1,12 @@import * as fixtures from "../../../fixtures/imports";import State from "../../../utils/State";-import getConnectorDetails, * as utils from "../../configs/Payment/Utils";+import getConnectorDetails, {+ CONNECTOR_LISTS,+ shouldIncludeConnector,+ should_continue_further,+} from "../../configs/Payment/Utils";let globalState;-describe("Wallet tests", () => {afterEach("flush global state", () => {cy.task("setGlobalState", globalState.data);@@ -12,10 +15,29 @@ describe("Wallet tests", () => {context("Bluecode Create and Confirm flow test", () => {let shouldContinue = true;- before("seed global state", () => {- cy.task("getGlobalState").then((state) => {- globalState = new State(state);- });+ 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.BLUECODE_WALLET+ )+ ) {+ skip = true;+ return;+ }+ })+ .then(() => {+ if (skip) {+ this.skip();+ }+ });});beforeEach(function () {@@ -36,7 +58,7 @@ describe("Wallet tests", () => {"automatic",globalState);- if (shouldContinue) shouldContinue = utils.should_continue_further(data);+ if (shouldContinue) shouldContinue = should_continue_further(data);});it("payment_methods-call-test", () => {@@ -55,7 +77,7 @@ describe("Wallet tests", () => {globalState);- if (shouldContinue) shouldContinue = utils.should_continue_further(data);+ if (shouldContinue) shouldContinue = should_continue_further(data);});it("Handle wallet redirection", () => {@@ -91,10 +113,29 @@ describe("Wallet tests", () => {context("AliPayHk Create and Confirm flow test", () => {let shouldContinue = true;- before("seed global state", () => {- cy.task("getGlobalState").then((state) => {- globalState = new State(state);- });+ 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.ALIPAY_HK_WALLET+ )+ ) {+ skip = true;+ return;+ }+ })+ .then(() => {+ if (skip) {+ this.skip();+ }+ });});beforeEach(function () {@@ -115,7 +156,7 @@ describe("Wallet tests", () => {"automatic",globalState);- if (shouldContinue) shouldContinue = utils.should_continue_further(data);+ if (shouldContinue) shouldContinue = should_continue_further(data);});it("payment_methods-call-test", () => {@@ -134,7 +175,7 @@ describe("Wallet tests", () => {globalState);- if (shouldContinue) shouldContinue = utils.should_continue_further(data);+ if (shouldContinue) shouldContinue = should_continue_further(data);});it("Handle wallet redirection", () => {@@ -167,3 +208,205 @@ describe("Wallet tests", () => {});});});++describe("PayPal Wallet tests", () => {+ 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.PAYPAL_WALLET+ )+ ) {+ skip = true;+ return;+ }+ })+ .then(() => {+ if (skip) {+ this.skip();+ }+ });+ });++ after("flush global state", () => {+ cy.task("setGlobalState", globalState.data);+ });++ context("PayPal Create and Confirm flow test", () => {+ let shouldContinue = true;++ beforeEach(function () {+ if (!shouldContinue) {+ this.skip();+ }+ });++ it("create-payment-call-test", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "wallet_pm"+ ]["PaymentIntent"]("PaypalRedirect");++ cy.createPaymentIntentTest(+ fixtures.createPaymentBody,+ data,+ "no_three_ds",+ "automatic",+ globalState+ );+ if (shouldContinue) shouldContinue = should_continue_further(data);+ });++ it("payment_methods-call-test", () => {+ cy.paymentMethodsCallTest(globalState);+ });++ it("Confirm PayPal redirect", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "wallet_pm"+ ]["PaypalRedirect"];++ cy.confirmBankRedirectCallTest(+ fixtures.confirmBody,+ data,+ true,+ globalState+ );++ if (shouldContinue) shouldContinue = should_continue_further(data);+ });++ it.skip("Handle wallet redirection", () => {+ const expected_redirection = fixtures.confirmBody["return_url"];+ const payment_method_type = globalState.get("paymentMethodType");+ const nextActionUrl = globalState.get("nextActionUrl");++ expect(+ nextActionUrl,+ "nextActionUrl should be defined before handling wallet redirection"+ ).to.be.a("string");++ cy.handleWalletRedirection(+ globalState,+ payment_method_type,+ expected_redirection+ );+ });++ it("Sync payment status", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "wallet_pm"+ ]["PaypalRedirect"];++ cy.retrievePaymentCallTest({+ globalState,+ data,+ expectedIntentStatus: "requires_customer_action",+ });+ });+ });++ context("PayPal Mandate CIT flow test", () => {+ let 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.PAYPAL_MANDATE+ )+ ) {+ skip = true;+ return;+ }+ })+ .then(() => {+ if (skip) {+ this.skip();+ }+ });+ });++ beforeEach(function () {+ if (!shouldContinue) {+ this.skip();+ }+ });++ it("create-payment-call-test", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "wallet_pm"+ ]["PaymentIntent"]("PaypalRedirect");++ cy.createPaymentIntentTest(+ fixtures.createPaymentBody,+ data,+ "no_three_ds",+ "automatic",+ globalState+ );+ if (shouldContinue) shouldContinue = should_continue_further(data);+ });++ it("payment_methods-call-test", () => {+ cy.paymentMethodsCallTest(globalState);+ });++ it("Confirm PayPal mandate CIT redirect", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "wallet_pm"+ ]["PaypalRedirectMandateCIT"];++ cy.confirmBankRedirectCallTest(+ fixtures.confirmBody,+ data,+ true,+ globalState+ );++ if (shouldContinue) shouldContinue = should_continue_further(data);+ });++ it.skip("Handle wallet redirection", () => {+ const expected_redirection = fixtures.confirmBody["return_url"];+ const payment_method_type = globalState.get("paymentMethodType");+ const nextActionUrl = globalState.get("nextActionUrl");++ expect(+ nextActionUrl,+ "nextActionUrl should be defined before handling wallet redirection"+ ).to.be.a("string");++ cy.handleWalletRedirection(+ globalState,+ payment_method_type,+ expected_redirection+ );+ });++ it("Sync payment status", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "wallet_pm"+ ]["PaypalRedirectMandateCIT"];++ cy.retrievePaymentCallTest({+ globalState,+ data,+ expectedIntentStatus: "requires_customer_action",+ });+ });+ });+});