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

test(cypress): add PayPal wallet payment coverage for GlobalPay (#12590)

HS-QUALIBOT25150d441b7a
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Commons.js b/cypress-tests/cypress/e2e/configs/Payment/Commons.js
index 872fdd9ee8..ee553c5cda 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Commons.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Commons.js
@@ -1419,6 +1419,35 @@ export const connectorDetails = {
},
},
}),
+ PaypalRedirectMandateCIT: getCustomExchange({
+ 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: {
+ customer_acceptance: customerAcceptance,
+ mandate_type: {
+ single_use: {
+ amount: 8000,
+ currency: "EUR",
+ },
+ },
+ },
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ }),
Skrill: getCustomExchange({
Request: {
payment_method: "wallet",
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Globalpay.js b/cypress-tests/cypress/e2e/configs/Payment/Globalpay.js
index 918fc4c41f..afe86984a9 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Globalpay.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Globalpay.js
@@ -1,5 +1,9 @@
-import { cardRequiredField, customerAcceptance } from "./Commons";
-import { getCustomExchange } from "./Modifiers";
+import {
+ cardRequiredField,
+ customerAcceptance,
+ standardBillingAddress,
+} from "./Commons";
+import { getCustomExchange, getCurrency } from "./Modifiers";
// Test card details for successful non-3DS transactions
// Based on Global Payments test cards
@@ -1036,6 +1040,72 @@ export const connectorDetails = {
},
},
},
+ wallet_pm: {
+ PaymentIntent: (paymentMethodType) =>
+ getCustomExchange({
+ Request: {
+ currency: getCurrency(paymentMethodType),
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ },
+ },
+ }),
+ PaypalRedirect: getCustomExchange({
+ 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",
+ payment_method_type: "paypal",
+ connector: "globalpay",
+ },
+ },
+ }),
+ PaypalRedirectMandateCIT: getCustomExchange({
+ 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: {
+ customer_acceptance: customerAcceptance,
+ mandate_type: {
+ single_use: {
+ amount: 8000,
+ currency: "EUR",
+ },
+ },
+ },
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ payment_method_type: "paypal",
+ connector: "globalpay",
+ },
+ },
+ }),
+ },
pm_list: {
PmListResponse: {
PmListNull: {
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
index b6ca907a1d..7173de8617 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
@@ -537,14 +537,20 @@ export const CONNECTOR_LISTS = {
BANK_REDIRECT_MANDATE: ["adyen"],
BLUECODE_WALLET: ["calida"],
ALIPAY_HK_WALLET: ["adyen"],
- PAYPAL_WALLET: ["novalnet", "paypal", "multisafepay"],
+ PAYPAL_WALLET: [
+ "airwallex",
+ "globalpay",
+ "multisafepay",
+ "novalnet",
+ "paypal",
+ ],
MIFINITY_WALLET: ["mifinity"],
ALIPAY_WALLET: ["multisafepay"],
WECHATPAY_WALLET: ["multisafepay"],
MBWAY_WALLET: ["multisafepay"],
SKRILL_WALLET: ["paysafe"],
PAYSAFECARD_GIFT_CARD: ["paysafe"],
- PAYPAL_MANDATE: ["paypal"],
+ PAYPAL_MANDATE: ["globalpay", "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.js
index ee6485a620..c992bedf04 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/19-Wallet.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/19-Wallet.cy.js
@@ -312,259 +312,50 @@ describe("Wallet tests", () => {
});
});
});
-});
-
-context("PayPal Create and Confirm 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_WALLET
- )
- ) {
- skip = true;
- return;
- }
- })
- .then(() => {
- if (skip) {
- this.skip();
- }
- });
- });
-
- after("flush global state", () => {
- cy.task("setGlobalState", globalState.data);
- });
-
- 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);
- });
+ context("PayPal Create and Confirm flow test", () => {
+ let shouldContinue = true;
- 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
- );
- });
+ before("seed global state", function () {
+ let skip = false;
- it("Sync payment status", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "wallet_pm"
- ]["PaypalRedirect"];
+ cy.task("getGlobalState")
+ .then((state) => {
+ globalState = new State(state);
+ const connector = globalState.get("connectorId");
- cy.retrievePaymentCallTest({
- globalState,
- data,
- expectedIntentStatus: "requires_customer_action",
+ if (
+ shouldIncludeConnector(
+ connector,
+ CONNECTOR_LISTS.INCLUDE.PAYPAL_WALLET
+ )
+ ) {
+ skip = true;
+ return;
+ }
+ })
+ .then(() => {
+ if (skip) {
+ this.skip();
+ }
+ });
});
- });
-});
-
-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_WALLET
- ) ||
- shouldIncludeConnector(
- connector,
- CONNECTOR_LISTS.INCLUDE.PAYPAL_MANDATE
- )
- ) {
- skip = true;
- return;
- }
- })
- .then(() => {
- if (skip) {
- this.skip();
- }
- });
- });
-
- after("flush global state", () => {
- cy.task("setGlobalState", globalState.data);
- });
-
- 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",
+ after("flush global state", () => {
+ cy.task("setGlobalState", globalState.data);
});
- });
-});
-
-context("AliPay Create and Confirm 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.ALIPAY_WALLET
- )
- ) {
- skip = true;
- return;
- }
- })
- .then(() => {
- if (skip) {
- this.skip();
- }
- });
- });
-
- afterEach("flush global state", () => {
- cy.task("setGlobalState", globalState.data);
- });
- beforeEach(function () {
- if (!shouldContinue) {
- this.skip();
- }
- });
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
- it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Payment -> Handle Wallet Redirection -> Retrieve Payment", () => {
- cy.step("Create Payment Intent", () => {
+ it("create-payment-call-test", () => {
const data = getConnectorDetails(globalState.get("connectorId"))[
"wallet_pm"
- ]["PaymentIntent"]("AliPay");
+ ]["PaymentIntent"]("PaypalRedirect");
+
cy.createPaymentIntentTest(
fixtures.createPaymentBody,
data,
@@ -572,60 +363,40 @@ context("AliPay Create and Confirm flow test", () => {
"automatic",
globalState
);
- if (!should_continue_further(data)) {
- shouldContinue = false;
- }
+ if (shouldContinue) shouldContinue = should_continue_further(data);
});
- cy.step("List Merchant Payment Methods", () => {
- if (!shouldContinue) {
- cy.task("cli_log", "Skipping step: List Merchant Payment Methods");
- return;
- }
+ it("payment_methods-call-test", () => {
cy.paymentMethodsCallTest(globalState);
});
- cy.step("Confirm Payment", () => {
- if (!shouldContinue) {
- cy.task("cli_log", "Skipping step: Confirm Payment");
- return;
- }
- const confirmData = getConnectorDetails(globalState.get("connectorId"))[
+ it("Confirm PayPal redirect", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
"wallet_pm"
- ]["AliPay"];
+ ]["PaypalRedirect"];
+
cy.confirmBankRedirectCallTest(
fixtures.confirmBody,
- confirmData,
+ data,
true,
globalState
);
- if (!should_continue_further(confirmData)) {
- shouldContinue = false;
- }
+
+ if (shouldContinue) shouldContinue = should_continue_further(data);
});
- cy.step("Handle Wallet Redirection", () => {
- if (!shouldContinue) {
- cy.task("cli_log", "Skipping step: Handle Wallet Redirection");
- return;
- }
- const expected_redirection = fixtures.confirmBody["return_url"];
- const payment_method_type = globalState.get("paymentMethodType");
- cy.handleBankRedirectRedirection(
- globalState,
- payment_method_type,
- expected_redirection
- );
+ it("Handle wallet redirection", () => {
+ const nextActionUrl = globalState.get("nextActionUrl");
+ expect(nextActionUrl, "PayPal redirect URL should be present").to.be.a(
+ "string"
+ ).and.not.be.empty;
});
- cy.step("Retrieve Payment", () => {
- if (!shouldContinue) {
- cy.task("cli_log", "Skipping step: Retrieve Payment");
- return;
- }
+ it("Sync payment status", () => {
const data = getConnectorDetails(globalState.get("connectorId"))[
"wallet_pm"
- ]["AliPay"];
+ ]["PaypalRedirect"];
+
cy.retrievePaymentCallTest({
globalState,
data,
@@ -633,51 +404,54 @@ context("AliPay Create and Confirm flow test", () => {
});
});
});
-});
-context("WeChatPay Create and Confirm flow test", () => {
- let shouldContinue = true;
+ context("PayPal Mandate CIT flow test", () => {
+ let shouldContinue = true;
- before("seed global state", function () {
- let skip = false;
+ before("seed global state", function () {
+ let skip = false;
- cy.task("getGlobalState")
- .then((state) => {
- globalState = new State(state);
- const connector = globalState.get("connectorId");
+ cy.task("getGlobalState")
+ .then((state) => {
+ globalState = new State(state);
+ const connector = globalState.get("connectorId");
- if (
- shouldIncludeConnector(
- connector,
- CONNECTOR_LISTS.INCLUDE.WECHATPAY_WALLET
- )
- ) {
- skip = true;
- return;
- }
- })
- .then(() => {
- if (skip) {
- this.skip();
- }
- });
- });
+ if (
+ shouldIncludeConnector(
+ connector,
+ CONNECTOR_LISTS.INCLUDE.PAYPAL_WALLET
+ ) ||
+ shouldIncludeConnector(
+ connector,
+ CONNECTOR_LISTS.INCLUDE.PAYPAL_MANDATE
+ )
+ ) {
+ skip = true;
+ return;
+ }
+ })
+ .then(() => {
+ if (skip) {
+ this.skip();
+ }
+ });
+ });
- afterEach("flush global state", () => {
- cy.task("setGlobalState", globalState.data);
- });
+ after("flush global state", () => {
+ cy.task("setGlobalState", globalState.data);
+ });
- beforeEach(function () {
- if (!shouldContinue) {
- this.skip();
- }
- });
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
- it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Payment -> Handle Wallet Redirection -> Retrieve Payment", () => {
- cy.step("Create Payment Intent", () => {
+ it("create-payment-call-test", () => {
const data = getConnectorDetails(globalState.get("connectorId"))[
"wallet_pm"
- ]["PaymentIntent"]("WeChatPay");
+ ]["PaymentIntent"]("PaypalRedirect");
+
cy.createPaymentIntentTest(
fixtures.createPaymentBody,
data,
@@ -685,60 +459,41 @@ context("WeChatPay Create and Confirm flow test", () => {
"automatic",
globalState
);
- if (!should_continue_further(data)) {
- shouldContinue = false;
- }
+ if (shouldContinue) shouldContinue = should_continue_further(data);
});
- cy.step("List Merchant Payment Methods", () => {
- if (!shouldContinue) {
- cy.task("cli_log", "Skipping step: List Merchant Payment Methods");
- return;
- }
+ it("payment_methods-call-test", () => {
cy.paymentMethodsCallTest(globalState);
});
- cy.step("Confirm Payment", () => {
- if (!shouldContinue) {
- cy.task("cli_log", "Skipping step: Confirm Payment");
- return;
- }
- const confirmData = getConnectorDetails(globalState.get("connectorId"))[
+ it("Confirm PayPal mandate CIT redirect", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
"wallet_pm"
- ]["WeChatPay"];
+ ]["PaypalRedirectMandateCIT"];
+
cy.confirmBankRedirectCallTest(
fixtures.confirmBody,
- confirmData,
+ data,
true,
globalState
);
- if (!should_continue_further(confirmData)) {
- shouldContinue = false;
- }
+
+ if (shouldContinue) shouldContinue = should_continue_further(data);
});
- cy.step("Handle Wallet Redirection", () => {
- if (!shouldContinue) {
- cy.task("cli_log", "Skipping step: Handle Wallet Redirection");
- return;
- }
- const expected_redirection = fixtures.confirmBody["return_url"];
- const payment_method_type = globalState.get("paymentMethodType");
- cy.handleBankRedirectRedirection(
- globalState,
- payment_method_type,
- expected_redirection
- );
+ it("Handle wallet redirection", () => {
+ const nextActionUrl = globalState.get("nextActionUrl");
+ expect(
+ nextActionUrl,
+ "PayPal mandate redirect URL should be present"
+ ).to.be.a("string").and.not.be.empty;
});
- cy.step("Retrieve Payment", () => {
- if (!shouldContinue) {
- cy.task("cli_log", "Skipping step: Retrieve Payment");
- return;
- }
+ it("Sync payment status", () => {
const data = getConnectorDetails(globalState.get("connectorId"))[
"wallet_pm"
- ]["WeChatPay"];
+ ]["PaypalRedirectMandateCIT"];
+
cy.retrievePaymentCallTest({
globalState,
data,
@@ -746,211 +501,437 @@ context("WeChatPay Create and Confirm flow test", () => {
});
});
});
-});
-context("MbWay Create and Confirm 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.MBWAY_WALLET
- )
- ) {
- skip = true;
- return;
- }
- })
- .then(() => {
- if (skip) {
- this.skip();
- }
- });
- });
+ context("AliPay Create and Confirm flow test", () => {
+ let shouldContinue = true;
- afterEach("flush global state", () => {
- cy.task("setGlobalState", globalState.data);
- });
+ before("seed global state", function () {
+ let skip = false;
- beforeEach(function () {
- if (!shouldContinue) {
- this.skip();
- }
- });
+ cy.task("getGlobalState")
+ .then((state) => {
+ globalState = new State(state);
+ const connector = globalState.get("connectorId");
- it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Payment -> Handle Wallet Redirection -> Retrieve Payment", () => {
- cy.step("Create Payment Intent", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "wallet_pm"
- ]["PaymentIntent"]("MbWay");
- cy.createPaymentIntentTest(
- fixtures.createPaymentBody,
- data,
- "no_three_ds",
- "automatic",
- globalState
- );
- if (!should_continue_further(data)) {
- shouldContinue = false;
- }
+ if (
+ shouldIncludeConnector(
+ connector,
+ CONNECTOR_LISTS.INCLUDE.ALIPAY_WALLET
+ )
+ ) {
+ skip = true;
+ return;
+ }
+ })
+ .then(() => {
+ if (skip) {
+ this.skip();
+ }
+ });
});
- cy.step("List Merchant Payment Methods", () => {
- if (!shouldContinue) {
- cy.task("cli_log", "Skipping step: List Merchant Payment Methods");
- return;
- }
- cy.paymentMethodsCallTest(globalState);
+ afterEach("flush global state", () => {
+ cy.task("setGlobalState", globalState.data);
});
- cy.step("Confirm Payment", () => {
+ beforeEach(function () {
if (!shouldContinue) {
- cy.task("cli_log", "Skipping step: Confirm Payment");
- return;
- }
- const confirmData = getConnectorDetails(globalState.get("connectorId"))[
- "wallet_pm"
- ]["MbWay"];
- cy.confirmBankRedirectCallTest(
- fixtures.confirmBody,
- confirmData,
- true,
- globalState
- );
- if (!should_continue_further(confirmData)) {
- shouldContinue = false;
+ this.skip();
}
});
- cy.step("Handle Wallet Redirection", () => {
- if (!shouldContinue) {
- cy.task("cli_log", "Skipping step: Handle Wallet Redirection");
- return;
- }
- const expected_redirection = fixtures.confirmBody["return_url"];
- const payment_method_type = globalState.get("paymentMethodType");
- cy.handleBankRedirectRedirection(
- globalState,
- payment_method_type,
- expected_redirection
- );
+ it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Payment -> Handle Wallet Redirection -> Retrieve Payment", () => {
+ cy.step("Create Payment Intent", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "wallet_pm"
+ ]["PaymentIntent"]("AliPay");
+ 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"
+ ]["AliPay"];
+ cy.confirmBankRedirectCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
+ if (!should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Handle Wallet Redirection", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Handle Wallet 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"
+ ]["AliPay"];
+ cy.retrievePaymentCallTest({
+ globalState,
+ data,
+ expectedIntentStatus: "requires_customer_action",
+ });
+ });
});
+ });
+
+ context("WeChatPay Create and Confirm flow test", () => {
+ let shouldContinue = true;
- cy.step("Retrieve Payment", () => {
+ 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.WECHATPAY_WALLET
+ )
+ ) {
+ skip = true;
+ return;
+ }
+ })
+ .then(() => {
+ if (skip) {
+ this.skip();
+ }
+ });
+ });
+
+ afterEach("flush global state", () => {
+ cy.task("setGlobalState", globalState.data);
+ });
+
+ beforeEach(function () {
if (!shouldContinue) {
- cy.task("cli_log", "Skipping step: Retrieve Payment");
- return;
+ this.skip();
}
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "wallet_pm"
- ]["MbWay"];
- cy.retrievePaymentCallTest({
- globalState,
- data,
- expectedIntentStatus: "requires_customer_action",
+ });
+
+ it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Payment -> Handle Wallet Redirection -> Retrieve Payment", () => {
+ cy.step("Create Payment Intent", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "wallet_pm"
+ ]["PaymentIntent"]("WeChatPay");
+ 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"
+ ]["WeChatPay"];
+ cy.confirmBankRedirectCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
+ if (!should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Handle Wallet Redirection", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Handle Wallet 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"
+ ]["WeChatPay"];
+ cy.retrievePaymentCallTest({
+ globalState,
+ data,
+ expectedIntentStatus: "requires_customer_action",
+ });
});
});
});
-});
-context("Skrill - Create and Confirm flow test", () => {
- let shouldContinue = true;
+ context("MbWay Create and Confirm 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.MBWAY_WALLET
+ )
+ ) {
+ skip = true;
+ return;
+ }
+ })
+ .then(() => {
+ if (skip) {
+ this.skip();
+ }
+ });
+ });
- before("seed global state", function () {
- let skip = false;
+ afterEach("flush global state", () => {
+ cy.task("setGlobalState", globalState.data);
+ });
- cy.task("getGlobalState")
- .then((state) => {
- globalState = new State(state);
- const connector = globalState.get("connectorId");
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
- if (
- shouldIncludeConnector(
- connector,
- CONNECTOR_LISTS.INCLUDE.SKRILL_WALLET
- )
- ) {
- skip = true;
+ it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Payment -> Handle Wallet Redirection -> Retrieve Payment", () => {
+ cy.step("Create Payment Intent", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "wallet_pm"
+ ]["PaymentIntent"]("MbWay");
+ 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;
}
- })
- .then(() => {
- if (skip) {
- cy.log(
- "Skipping Skrill wallet tests — connector not in SKRILL_WALLET list"
- );
- this.skip();
+ 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"
+ ]["MbWay"];
+ cy.confirmBankRedirectCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
+ if (!should_continue_further(confirmData)) {
+ shouldContinue = false;
}
});
- });
- afterEach("flush global state", () => {
- cy.task("setGlobalState", globalState.data);
- });
+ cy.step("Handle Wallet Redirection", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Handle Wallet Redirection");
+ return;
+ }
+ const expected_redirection = fixtures.confirmBody["return_url"];
+ const payment_method_type = globalState.get("paymentMethodType");
+ cy.handleBankRedirectRedirection(
+ globalState,
+ payment_method_type,
+ expected_redirection
+ );
+ });
- beforeEach(function () {
- if (!shouldContinue) {
- this.skip();
- }
+ cy.step("Retrieve Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Retrieve Payment");
+ return;
+ }
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "wallet_pm"
+ ]["MbWay"];
+ cy.retrievePaymentCallTest({
+ globalState,
+ data,
+ expectedIntentStatus: "requires_customer_action",
+ });
+ });
+ });
});
- it("create-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "wallet_pm"
- ]["PaymentIntent"]("Skrill");
-
- cy.createPaymentIntentTest(
- fixtures.createPaymentBody,
- data,
- "three_ds",
- "automatic",
- globalState
- );
- if (shouldContinue) shouldContinue = should_continue_further(data);
- });
+ context("Skrill - Create and Confirm flow test", () => {
+ let shouldContinue = true;
- it("payment_methods-call-test", () => {
- cy.paymentMethodsCallTest(globalState);
- });
+ before("seed global state", function () {
+ let skip = false;
- it("Confirm Skrill wallet redirect", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "wallet_pm"
- ]["Skrill"];
+ cy.task("getGlobalState")
+ .then((state) => {
+ globalState = new State(state);
+ const connector = globalState.get("connectorId");
- cy.confirmBankRedirectCallTest(
- fixtures.confirmBody,
- data,
- true,
- globalState
- );
+ if (
+ shouldIncludeConnector(
+ connector,
+ CONNECTOR_LISTS.INCLUDE.SKRILL_WALLET
+ )
+ ) {
+ skip = true;
+ return;
+ }
+ })
+ .then(() => {
+ if (skip) {
+ cy.log(
+ "Skipping Skrill wallet tests — connector not in SKRILL_WALLET list"
+ );
+ this.skip();
+ }
+ });
+ });
- if (shouldContinue) shouldContinue = should_continue_further(data);
- });
+ afterEach("flush global state", () => {
+ cy.task("setGlobalState", globalState.data);
+ });
- it("Handle Skrill 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
- );
- });
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+
+ it("create-payment-call-test", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "wallet_pm"
+ ]["PaymentIntent"]("Skrill");
+
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "three_ds",
+ "automatic",
+ globalState
+ );
+ if (shouldContinue) shouldContinue = should_continue_further(data);
+ });
- it("Sync payment status", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "wallet_pm"
- ]["Skrill"];
+ it("payment_methods-call-test", () => {
+ cy.paymentMethodsCallTest(globalState);
+ });
- cy.retrievePaymentCallTest({ globalState, data });
+ it("Confirm Skrill wallet redirect", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "wallet_pm"
+ ]["Skrill"];
+
+ cy.confirmBankRedirectCallTest(
+ fixtures.confirmBody,
+ data,
+ true,
+ globalState
+ );
+
+ if (shouldContinue) shouldContinue = should_continue_further(data);
+ });
+
+ it("Handle Skrill 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"))[
+ "wallet_pm"
+ ]["Skrill"];
+
+ cy.retrievePaymentCallTest({ globalState, data });
+ });
});
});
diff --git a/cypress-tests/cypress/support/redirectionHandler.js b/cypress-tests/cypress/support/redirectionHandler.js
index 779072afba..a342dc639f 100644
--- a/cypress-tests/cypress/support/redirectionHandler.js
+++ b/cypress-tests/cypress/support/redirectionHandler.js
@@ -1284,6 +1284,9 @@ function bankRedirectRedirection(
if (["eps", "ideal", "giropay"].includes(paymentMethodType)) {
cy.get('button[name="Successful"][value="SUCCEEDED"]').click();
verifyUrl = true;
+ } else if (paymentMethodType === "paypal") {
+ cy.url().should("include", "sandbox.paypal.com");
+ verifyUrl = false;
} else {
throw new Error(
`Unsupported Paypal payment method type: ${paymentMethodType}`
@@ -1622,6 +1625,10 @@ function bankRedirectRedirection(
});
verifyUrl = false;
break;
+ case "paypal":
+ cy.url().should("include", "sandbox.paypal.com");
+ verifyUrl = false;
+ break;
default:
throw new Error(
`Unsupported GlobalPay payment method type: ${paymentMethodType}`