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 Stripe wallet tests for AliPay, AmazonPay, Cashapp, RevolutPay, WeChatPay (#12572)

HS-QUALIBOTdbfa943e7892
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Commons.js b/cypress-tests/cypress/e2e/configs/Payment/Commons.js
index 8abe2a126c..54969c7e5a 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Commons.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Commons.js
@@ -649,6 +649,30 @@ export const payment_methods_enabled = [
recurring_enabled: false,
installment_payment_enabled: false,
},
+ {
+ payment_method_type: "amazon_pay",
+ payment_experience: "redirect_to_url",
+ minimum_amount: 1,
+ maximum_amount: 68607706,
+ recurring_enabled: false,
+ installment_payment_enabled: false,
+ },
+ {
+ payment_method_type: "cashapp",
+ payment_experience: "display_qr_code",
+ minimum_amount: 1,
+ maximum_amount: 68607706,
+ recurring_enabled: false,
+ installment_payment_enabled: false,
+ },
+ {
+ payment_method_type: "revolut_pay",
+ payment_experience: "redirect_to_url",
+ minimum_amount: 1,
+ maximum_amount: 68607706,
+ recurring_enabled: false,
+ installment_payment_enabled: false,
+ },
],
},
{
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Stripe.js b/cypress-tests/cypress/e2e/configs/Payment/Stripe.js
index 15485aab82..24d0327cd3 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Stripe.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Stripe.js
@@ -1484,4 +1484,375 @@ export const connectorDetails = {
type: "string",
},
},
+ wallet_pm: {
+ PaymentIntent: (walletType, overrideCurrency) => {
+ const currencyMap = {
+ AliPay: "USD",
+ AmazonPay: "USD",
+ Cashapp: "USD",
+ RevolutPay: "EUR",
+ WeChatPay: "USD",
+ };
+ return {
+ Request: {
+ currency: overrideCurrency || currencyMap[walletType] || "USD",
+ amount: 1000,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ },
+ },
+ };
+ },
+ PaymentIntentMandate: (walletType, overrideCurrency) => {
+ const currencyMap = {
+ AmazonPay: "USD",
+ Cashapp: "USD",
+ RevolutPay: "EUR",
+ };
+ return {
+ Request: {
+ currency: overrideCurrency || currencyMap[walletType] || "USD",
+ amount: 1000,
+ setup_future_usage: "off_session",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ },
+ },
+ };
+ },
+ AliPay: {
+ Request: {
+ payment_method: "wallet",
+ payment_method_type: "ali_pay",
+ payment_method_data: {
+ wallet: {
+ ali_pay_redirect: {},
+ },
+ },
+ billing: {
+ address: {
+ country: "CN",
+ },
+ },
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ Configs: {
+ skipBillingAssertion: true,
+ },
+ },
+ AmazonPay: {
+ Request: {
+ payment_method: "wallet",
+ payment_method_type: "amazon_pay",
+ payment_method_data: {
+ wallet: {
+ amazon_pay_redirect: {},
+ },
+ },
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ Configs: {
+ skipBillingAssertion: true,
+ },
+ },
+ AmazonPayMandate: {
+ Request: {
+ payment_method: "wallet",
+ payment_method_type: "amazon_pay",
+ payment_method_data: {
+ wallet: {
+ amazon_pay_redirect: {},
+ },
+ },
+ mandate_data: {
+ customer_acceptance: {
+ acceptance_type: "offline",
+ accepted_at: "1963-05-03T04:07:52.723Z",
+ online: {
+ ip_address: "in sit",
+ user_agent: "amet irure esse sunt",
+ },
+ },
+ mandate_type: {
+ single_use: {
+ amount: 1000,
+ currency: "USD",
+ },
+ },
+ },
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ Configs: {
+ skipBillingAssertion: true,
+ },
+ },
+ Cashapp: {
+ Request: {
+ payment_method: "wallet",
+ payment_method_type: "cashapp",
+ payment_method_data: {
+ wallet: {
+ cashapp_qr: {},
+ },
+ },
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ Configs: {
+ skipBillingAssertion: true,
+ },
+ },
+ CashappMandate: {
+ Request: {
+ payment_method: "wallet",
+ payment_method_type: "cashapp",
+ payment_method_data: {
+ wallet: {
+ cashapp_qr: {},
+ },
+ },
+ mandate_data: {
+ customer_acceptance: {
+ acceptance_type: "offline",
+ accepted_at: "1963-05-03T04:07:52.723Z",
+ online: {
+ ip_address: "in sit",
+ user_agent: "amet irure esse sunt",
+ },
+ },
+ mandate_type: {
+ single_use: {
+ amount: 1000,
+ currency: "USD",
+ },
+ },
+ },
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ Configs: {
+ skipBillingAssertion: true,
+ },
+ },
+ RevolutPay: {
+ Request: {
+ payment_method: "wallet",
+ payment_method_type: "revolut_pay",
+ payment_method_data: {
+ wallet: {
+ revolut_pay: {},
+ },
+ },
+ mandate_data: null,
+ setup_future_usage: null,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ Configs: {
+ skipBillingAssertion: true,
+ TRIGGER_SKIP: true,
+ },
+ },
+ RevolutPayMandate: {
+ Request: {
+ payment_method: "wallet",
+ payment_method_type: "revolut_pay",
+ payment_method_data: {
+ wallet: {
+ revolut_pay: {},
+ },
+ },
+ mandate_data: {
+ customer_acceptance: {
+ acceptance_type: "offline",
+ accepted_at: "1963-05-03T04:07:52.723Z",
+ online: {
+ ip_address: "in sit",
+ user_agent: "amet irure esse sunt",
+ },
+ },
+ mandate_type: {
+ single_use: {
+ amount: 1000,
+ currency: "EUR",
+ },
+ },
+ },
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ Configs: {
+ skipBillingAssertion: true,
+ TRIGGER_SKIP: true,
+ },
+ },
+ WeChatPay: {
+ Request: {
+ payment_method: "wallet",
+ payment_method_type: "we_chat_pay",
+ payment_method_data: {
+ wallet: {
+ we_chat_pay_qr: {},
+ },
+ },
+ mandate_data: null,
+ setup_future_usage: null,
+ billing: {
+ address: {
+ country: "CN",
+ },
+ },
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ Configs: {
+ skipBillingAssertion: true,
+ },
+ },
+ AliPayInvalidCurrency: {
+ Request: {
+ payment_method: "wallet",
+ payment_method_type: "ali_pay",
+ payment_method_data: {
+ wallet: {
+ ali_pay_redirect: {},
+ },
+ },
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "failed",
+ error_code: "payment_method_not_available",
+ error_message:
+ "AliPay is not available in the selected region/currency",
+ },
+ },
+ },
+ AmazonPayInvalidCurrency: {
+ Request: {
+ payment_method: "wallet",
+ payment_method_type: "amazon_pay",
+ payment_method_data: {
+ wallet: {
+ amazon_pay_redirect: {},
+ },
+ },
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "failed",
+ error_code: "payment_method_not_available",
+ error_message:
+ "AmazonPay is not available in the selected region/currency",
+ },
+ },
+ },
+ CashappInvalidCurrency: {
+ Request: {
+ payment_method: "wallet",
+ payment_method_type: "cashapp",
+ payment_method_data: {
+ wallet: {
+ cashapp_qr: {},
+ },
+ },
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "failed",
+ error_code: "payment_method_not_available",
+ error_message:
+ "Cashapp is not available in the selected region/currency",
+ },
+ },
+ },
+ RevolutPayInvalidCurrency: {
+ Request: {
+ payment_method: "wallet",
+ payment_method_type: "revolut_pay",
+ payment_method_data: {
+ wallet: {
+ revolut_pay: {},
+ },
+ },
+ mandate_data: null,
+ setup_future_usage: null,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "failed",
+ error_code: "payment_method_not_available",
+ error_message:
+ "RevolutPay is not available in the selected region/currency",
+ },
+ },
+ },
+ WeChatPayInvalidCurrency: {
+ Request: {
+ payment_method: "wallet",
+ payment_method_type: "we_chat_pay",
+ payment_method_data: {
+ wallet: {
+ we_chat_pay_qr: {},
+ },
+ },
+ mandate_data: null,
+ setup_future_usage: null,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "failed",
+ error_code: "payment_method_not_available",
+ error_message:
+ "WeChatPay is not available in the selected region/currency",
+ },
+ },
+ },
+ },
};
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
index d34647b662..c3c059ab85 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
@@ -563,8 +563,8 @@ export const CONNECTOR_LISTS = {
"paypal",
],
MIFINITY_WALLET: ["mifinity"],
- ALIPAY_WALLET: ["multisafepay"],
- WECHATPAY_WALLET: ["multisafepay"],
+ ALIPAY_WALLET: ["stripe", "multisafepay"],
+ WECHATPAY_WALLET: ["stripe", "multisafepay"],
MBWAY_WALLET: ["multisafepay"],
SKRILL_WALLET: ["paysafe"],
PAYSAFECARD_GIFT_CARD: ["paysafe"],
@@ -618,6 +618,9 @@ export const CONNECTOR_LISTS = {
GIFT_CARD: ["adyen"],
VOUCHER: ["adyen", "dlocal"],
RELAY_OPERATIONS: ["bankofamerica"],
+ AMAZONPAY_WALLET: ["stripe"],
+ CASHAPP_WALLET: ["stripe"],
+ REVOLUTPAY_WALLET: ["stripe"],
PAY_LATER: [
"klarna",
"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 c992bedf04..21715e2381 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/19-Wallet.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/19-Wallet.cy.js
@@ -591,7 +591,7 @@ describe("Wallet tests", () => {
}
const expected_redirection = fixtures.confirmBody["return_url"];
const payment_method_type = globalState.get("paymentMethodType");
- cy.handleBankRedirectRedirection(
+ cy.handleWalletRedirection(
globalState,
payment_method_type,
expected_redirection
@@ -704,7 +704,7 @@ describe("Wallet tests", () => {
}
const expected_redirection = fixtures.confirmBody["return_url"];
const payment_method_type = globalState.get("paymentMethodType");
- cy.handleBankRedirectRedirection(
+ cy.handleWalletRedirection(
globalState,
payment_method_type,
expected_redirection
@@ -935,3 +935,1166 @@ describe("Wallet tests", () => {
});
});
});
+describe("Stripe AliPay Wallet tests", () => {
+ afterEach("flush global state", () => {
+ cy.task("setGlobalState", globalState.data);
+ });
+
+ context("Stripe 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) {
+ cy.log(
+ "Skipping Stripe AliPay wallet tests — connector not in ALIPAY_WALLET list"
+ );
+ this.skip();
+ }
+ });
+ });
+
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+
+ it("create-payment-call-test", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "wallet_pm"
+ ]["PaymentIntent"]("AliPay");
+
+ 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 AliPay redirect", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "wallet_pm"
+ ]["AliPay"];
+
+ cy.confirmBankRedirectCallTest(
+ fixtures.confirmBody,
+ data,
+ true,
+ globalState
+ );
+
+ if (shouldContinue) shouldContinue = should_continue_further(data);
+ });
+
+ it("Handle wallet redirection", () => {
+ const expected_redirection = fixtures.confirmBody["return_url"];
+ const payment_method_type = "ali_pay";
+ 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"
+ ]["AliPay"];
+
+ cy.retrievePaymentCallTest({
+ globalState,
+ data,
+ expectedIntentStatus: "requires_customer_action",
+ });
+ });
+ });
+
+ context("Stripe AliPay - Invalid Currency error 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;
+ }
+ const details = getConnectorDetails(connector);
+ if (!details?.wallet_pm?.AliPayInvalidCurrency) {
+ skip = true;
+ return;
+ }
+ })
+ .then(() => {
+ if (skip) {
+ this.skip();
+ }
+ });
+ });
+
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+
+ it("confirm-alipay-with-invalid-currency-should-fail", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "wallet_pm"
+ ]["PaymentIntent"]("AliPay", "INR");
+
+ 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 AliPay with invalid currency", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "wallet_pm"
+ ]["AliPayInvalidCurrency"];
+
+ cy.confirmBankRedirectCallTest(
+ fixtures.confirmBody,
+ data,
+ true,
+ globalState
+ );
+
+ if (shouldContinue) shouldContinue = should_continue_further(data);
+ });
+ });
+});
+
+describe("Stripe AmazonPay Wallet tests", () => {
+ afterEach("flush global state", () => {
+ cy.task("setGlobalState", globalState.data);
+ });
+
+ context("Stripe AmazonPay 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.AMAZONPAY_WALLET
+ )
+ ) {
+ skip = true;
+ return;
+ }
+ })
+ .then(() => {
+ if (skip) {
+ cy.log(
+ "Skipping Stripe AmazonPay wallet tests — connector not in AMAZONPAY_WALLET list"
+ );
+ this.skip();
+ }
+ });
+ });
+
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+
+ it("create-payment-call-test", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "wallet_pm"
+ ]["PaymentIntent"]("AmazonPay");
+
+ 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 AmazonPay redirect", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "wallet_pm"
+ ]["AmazonPay"];
+
+ cy.confirmBankRedirectCallTest(
+ fixtures.confirmBody,
+ data,
+ true,
+ globalState
+ );
+
+ if (shouldContinue) shouldContinue = should_continue_further(data);
+ });
+
+ it("Handle wallet redirection", () => {
+ const expected_redirection = fixtures.confirmBody["return_url"];
+ const payment_method_type = "amazon_pay";
+ 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"
+ ]["AmazonPay"];
+
+ cy.retrievePaymentCallTest({
+ globalState,
+ data,
+ expectedIntentStatus: "requires_customer_action",
+ });
+ });
+ });
+
+ context("Stripe AmazonPay Mandate 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.AMAZONPAY_WALLET
+ )
+ ) {
+ 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"
+ ]["PaymentIntentMandate"]("AmazonPay");
+
+ 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 AmazonPay mandate redirect", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "wallet_pm"
+ ]["AmazonPayMandate"];
+
+ cy.confirmBankRedirectCallTest(
+ fixtures.confirmBody,
+ data,
+ true,
+ globalState
+ );
+
+ if (shouldContinue) shouldContinue = should_continue_further(data);
+ });
+
+ it("Handle wallet redirection", () => {
+ const expected_redirection = fixtures.confirmBody["return_url"];
+ const payment_method_type = "amazon_pay";
+ 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"
+ ]["AmazonPayMandate"];
+
+ cy.retrievePaymentCallTest({
+ globalState,
+ data,
+ expectedIntentStatus: "requires_customer_action",
+ });
+ });
+ });
+
+ context("Stripe AmazonPay - Invalid Currency error 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.AMAZONPAY_WALLET
+ )
+ ) {
+ skip = true;
+ return;
+ }
+ })
+ .then(() => {
+ if (skip) {
+ this.skip();
+ }
+ });
+ });
+
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+
+ it("confirm-amazonpay-with-invalid-currency-should-fail", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "wallet_pm"
+ ]["PaymentIntent"]("AmazonPay", "INR");
+
+ 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 AmazonPay with invalid currency", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "wallet_pm"
+ ]["AmazonPayInvalidCurrency"];
+
+ cy.confirmBankRedirectCallTest(
+ fixtures.confirmBody,
+ data,
+ true,
+ globalState
+ );
+
+ if (shouldContinue) shouldContinue = should_continue_further(data);
+ });
+ });
+});
+
+describe("Stripe Cashapp Wallet tests", () => {
+ afterEach("flush global state", () => {
+ cy.task("setGlobalState", globalState.data);
+ });
+
+ context("Stripe Cashapp 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.CASHAPP_WALLET
+ )
+ ) {
+ skip = true;
+ return;
+ }
+ })
+ .then(() => {
+ if (skip) {
+ cy.log(
+ "Skipping Stripe Cashapp wallet tests — connector not in CASHAPP_WALLET list"
+ );
+ this.skip();
+ }
+ });
+ });
+
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+
+ it("create-payment-call-test", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "wallet_pm"
+ ]["PaymentIntent"]("Cashapp");
+
+ 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 Cashapp redirect", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "wallet_pm"
+ ]["Cashapp"];
+
+ cy.confirmBankRedirectCallTest(
+ fixtures.confirmBody,
+ data,
+ true,
+ globalState
+ );
+
+ if (shouldContinue) shouldContinue = should_continue_further(data);
+ });
+
+ it("Handle wallet redirection", () => {
+ const nextActionUrl = globalState.get("nextActionUrl");
+ if (!nextActionUrl) {
+ cy.log("Cashapp QR code flow — no redirect URL, skipping redirection");
+ return;
+ }
+ const expected_redirection = fixtures.confirmBody["return_url"];
+ cy.handleWalletRedirection(globalState, "cashapp", expected_redirection);
+ });
+
+ it("Sync payment status", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "wallet_pm"
+ ]["Cashapp"];
+
+ cy.retrievePaymentCallTest({
+ globalState,
+ data,
+ expectedIntentStatus: "requires_customer_action",
+ });
+ });
+ });
+
+ context("Stripe Cashapp Mandate 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.CASHAPP_WALLET
+ )
+ ) {
+ 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"
+ ]["PaymentIntentMandate"]("Cashapp");
+
+ 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 Cashapp mandate redirect", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "wallet_pm"
+ ]["CashappMandate"];
+
+ cy.confirmBankRedirectCallTest(
+ fixtures.confirmBody,
+ data,
+ true,
+ globalState
+ );
+
+ if (shouldContinue) shouldContinue = should_continue_further(data);
+ });
+
+ it("Handle wallet redirection", () => {
+ const nextActionUrl = globalState.get("nextActionUrl");
+ if (!nextActionUrl) {
+ cy.log("Cashapp QR code flow — no redirect URL, skipping redirection");
+ return;
+ }
+ const expected_redirection = fixtures.confirmBody["return_url"];
+ cy.handleWalletRedirection(globalState, "cashapp", expected_redirection);
+ });
+
+ it("Sync payment status", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "wallet_pm"
+ ]["CashappMandate"];
+
+ cy.retrievePaymentCallTest({
+ globalState,
+ data,
+ expectedIntentStatus: "requires_customer_action",
+ });
+ });
+ });
+
+ context("Stripe Cashapp - Invalid Currency error 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.CASHAPP_WALLET
+ )
+ ) {
+ skip = true;
+ return;
+ }
+ })
+ .then(() => {
+ if (skip) {
+ this.skip();
+ }
+ });
+ });
+
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+
+ it("confirm-cashapp-with-invalid-currency-should-fail", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "wallet_pm"
+ ]["PaymentIntent"]("Cashapp", "INR");
+
+ 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 Cashapp with invalid currency", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "wallet_pm"
+ ]["CashappInvalidCurrency"];
+
+ cy.confirmBankRedirectCallTest(
+ fixtures.confirmBody,
+ data,
+ true,
+ globalState
+ );
+
+ if (shouldContinue) shouldContinue = should_continue_further(data);
+ });
+ });
+});
+
+describe("Stripe RevolutPay Wallet tests", () => {
+ afterEach("flush global state", () => {
+ cy.task("setGlobalState", globalState.data);
+ });
+
+ context("Stripe RevolutPay 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.REVOLUTPAY_WALLET
+ )
+ ) {
+ skip = true;
+ return;
+ }
+ })
+ .then(() => {
+ if (skip) {
+ cy.log(
+ "Skipping Stripe RevolutPay wallet tests — connector not in REVOLUTPAY_WALLET list"
+ );
+ this.skip();
+ }
+ });
+ });
+
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+
+ it("create-payment-call-test", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "wallet_pm"
+ ]["PaymentIntent"]("RevolutPay");
+
+ 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 RevolutPay redirect", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "wallet_pm"
+ ]["RevolutPay"];
+
+ cy.confirmBankRedirectCallTest(
+ fixtures.confirmBody,
+ data,
+ true,
+ globalState
+ );
+
+ if (shouldContinue) shouldContinue = should_continue_further(data);
+ });
+
+ it("Handle wallet redirection", () => {
+ const expected_redirection = fixtures.confirmBody["return_url"];
+ const payment_method_type = "revolut_pay";
+ 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"
+ ]["RevolutPay"];
+
+ cy.retrievePaymentCallTest({
+ globalState,
+ data,
+ expectedIntentStatus: "requires_customer_action",
+ });
+ });
+ });
+
+ context("Stripe RevolutPay Mandate 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.REVOLUTPAY_WALLET
+ )
+ ) {
+ 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"]("RevolutPay");
+
+ 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 RevolutPay mandate redirect", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "wallet_pm"
+ ]["RevolutPayMandate"];
+
+ cy.confirmBankRedirectCallTest(
+ fixtures.confirmBody,
+ data,
+ true,
+ globalState
+ );
+
+ if (shouldContinue) shouldContinue = should_continue_further(data);
+ });
+
+ it("Handle wallet redirection", () => {
+ const expected_redirection = fixtures.confirmBody["return_url"];
+ const payment_method_type = "revolut_pay";
+ 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"
+ ]["RevolutPayMandate"];
+
+ cy.retrievePaymentCallTest({
+ globalState,
+ data,
+ expectedIntentStatus: "requires_customer_action",
+ });
+ });
+ });
+
+ context("Stripe RevolutPay - Invalid Currency error 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.REVOLUTPAY_WALLET
+ )
+ ) {
+ skip = true;
+ return;
+ }
+ })
+ .then(() => {
+ if (skip) {
+ this.skip();
+ }
+ });
+ });
+
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+
+ it("confirm-revolutpay-with-invalid-currency-should-fail", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "wallet_pm"
+ ]["PaymentIntent"]("RevolutPay", "INR");
+
+ 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 RevolutPay with invalid currency", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "wallet_pm"
+ ]["RevolutPayInvalidCurrency"];
+
+ cy.confirmBankRedirectCallTest(
+ fixtures.confirmBody,
+ data,
+ true,
+ globalState
+ );
+
+ if (shouldContinue) shouldContinue = should_continue_further(data);
+ });
+ });
+});
+
+describe("Stripe WeChatPay Wallet tests", () => {
+ afterEach("flush global state", () => {
+ cy.task("setGlobalState", globalState.data);
+ });
+
+ context("Stripe WeChatPay 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.WECHATPAY_WALLET
+ )
+ ) {
+ skip = true;
+ return;
+ }
+ })
+ .then(() => {
+ if (skip) {
+ cy.log(
+ "Skipping Stripe WeChatPay wallet tests — connector not in WECHATPAY_WALLET list"
+ );
+ this.skip();
+ }
+ });
+ });
+
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+
+ it("create-payment-call-test", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "wallet_pm"
+ ]["PaymentIntent"]("WeChatPay");
+
+ 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 WeChatPay redirect", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "wallet_pm"
+ ]["WeChatPay"];
+
+ cy.confirmBankRedirectCallTest(
+ fixtures.confirmBody,
+ data,
+ true,
+ globalState
+ );
+
+ if (shouldContinue) shouldContinue = should_continue_further(data);
+ });
+
+ it("Handle wallet redirection", () => {
+ const nextActionUrl = globalState.get("nextActionUrl");
+ if (!nextActionUrl) {
+ cy.log(
+ "WeChatPay QR code flow — no redirect URL, skipping redirection"
+ );
+ return;
+ }
+ const expected_redirection = fixtures.confirmBody["return_url"];
+ cy.handleWalletRedirection(
+ globalState,
+ "we_chat_pay",
+ expected_redirection
+ );
+ });
+
+ it("Sync payment status", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "wallet_pm"
+ ]["WeChatPay"];
+
+ cy.retrievePaymentCallTest({
+ globalState,
+ data,
+ expectedIntentStatus: "requires_customer_action",
+ });
+ });
+ });
+
+ context("Stripe WeChatPay - Invalid Currency error 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.WECHATPAY_WALLET
+ )
+ ) {
+ skip = true;
+ return;
+ }
+ })
+ .then(() => {
+ if (skip) {
+ this.skip();
+ }
+ });
+ });
+
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+
+ it("confirm-wechatpay-with-invalid-currency-should-fail", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "wallet_pm"
+ ]["PaymentIntent"]("WeChatPay", "INR");
+
+ 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 WeChatPay with invalid currency", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "wallet_pm"
+ ]["WeChatPayInvalidCurrency"];
+
+ cy.confirmBankRedirectCallTest(
+ fixtures.confirmBody,
+ data,
+ true,
+ globalState
+ );
+
+ if (shouldContinue) shouldContinue = should_continue_further(data);
+ });
+ });
+});
diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js
index 460342fa17..4221460198 100644
--- a/cypress-tests/cypress/support/commands.js
+++ b/cypress-tests/cypress/support/commands.js
@@ -2371,13 +2371,14 @@ Cypress.Commands.add(
const configInfo = execConfig(validateConfig(configs));
const profile_id = globalState.get(`${configInfo.profilePrefix}Id`);
+ const body = JSON.parse(JSON.stringify(createPaymentBody));
for (const key in reqData) {
- createPaymentBody[key] = reqData[key];
+ body[key] = reqData[key];
}
- createPaymentBody.authentication_type = authentication_type;
- createPaymentBody.capture_method = capture_method;
- createPaymentBody.customer_id = globalState.get("customerId");
- createPaymentBody.profile_id = profile_id;
+ body.authentication_type = authentication_type;
+ body.capture_method = capture_method;
+ body.customer_id = globalState.get("customerId");
+ body.profile_id = profile_id;
const headers = {
"Content-Type": "application/json",
@@ -2389,16 +2390,16 @@ Cypress.Commands.add(
headers["x-connected-merchant-id"] = connectedMerchantId;
}
- globalState.set("paymentAmount", createPaymentBody.amount);
- globalState.set("paymentCurrency", createPaymentBody.currency);
+ globalState.set("paymentAmount", body.amount);
+ globalState.set("paymentCurrency", body.currency);
globalState.set("captureMethod", capture_method);
- globalState.set("setupFutureUsage", createPaymentBody.setup_future_usage);
+ globalState.set("setupFutureUsage", body.setup_future_usage);
cy.request({
method: "POST",
url: `${globalState.get("baseUrl")}/payments`,
headers,
failOnStatusCode: false,
- body: createPaymentBody,
+ body: body,
}).then((response) => {
logRequestId(response.headers["x-request-id"]);
@@ -2438,50 +2439,43 @@ Cypress.Commands.add(
}
expect(response.body.payment_id, "payment_id").to.not.be.null;
expect(response.body.merchant_id, "merchant_id").to.not.be.null;
- expect(createPaymentBody.amount, "amount").to.equal(
- response.body.amount
- );
- expect(createPaymentBody.currency, "currency").to.equal(
- response.body.currency
- );
- expect(createPaymentBody.capture_method, "capture_method").to.equal(
+ expect(body.amount, "amount").to.equal(response.body.amount);
+ expect(body.currency, "currency").to.equal(response.body.currency);
+ expect(body.capture_method, "capture_method").to.equal(
response.body.capture_method
);
- expect(
- createPaymentBody.authentication_type,
- "authentication_type"
- ).to.equal(response.body.authentication_type);
- expect(createPaymentBody.description, "description").to.equal(
- response.body.description
+ expect(body.authentication_type, "authentication_type").to.equal(
+ response.body.authentication_type
);
- expect(createPaymentBody.email, "email").to.equal(
- response.body.email
+ expect(body.description, "description").to.equal(
+ response.body.description
);
- expect(createPaymentBody.email, "customer.email").to.equal(
+ expect(body.email, "email").to.equal(response.body.email);
+ expect(body.email, "customer.email").to.equal(
response.body.customer.email
);
- if (createPaymentBody.customer_id !== undefined) {
- expect(createPaymentBody.customer_id, "customer.id").to.equal(
+ if (body.customer_id !== undefined) {
+ expect(body.customer_id, "customer.id").to.equal(
response.body.customer.id
);
} else {
expect(response.body.customer.id, "customer.id").to.be.null;
}
- expect(createPaymentBody.metadata, "metadata").to.deep.equal(
+ expect(body.metadata, "metadata").to.deep.equal(
response.body.metadata
);
expect(
- createPaymentBody.setup_future_usage ?? null,
+ body.setup_future_usage ?? null,
"setup_future_usage"
).to.equal(response.body.setup_future_usage);
- // If 'shipping_cost' is not included in the request, the 'amount' in 'createPaymentBody' should match the 'amount_capturable' in the response.
- if (typeof createPaymentBody?.shipping_cost === "undefined") {
- expect(createPaymentBody.amount, "amount_capturable").to.equal(
+ // If 'shipping_cost' is not included in the request, the 'amount' in 'body' should match the 'amount_capturable' in the response.
+ if (typeof body?.shipping_cost === "undefined") {
+ expect(body.amount, "amount_capturable").to.equal(
response.body.amount_capturable
);
} else {
expect(
- createPaymentBody.amount + createPaymentBody.shipping_cost,
+ body.amount + body.shipping_cost,
"amount_capturable"
).to.equal(response.body.amount_capturable);
}
@@ -2490,7 +2484,7 @@ Cypress.Commands.add(
null,
]);
expect(response.body.connector, "connector").to.be.null;
- expect(createPaymentBody.capture_method, "capture_method").to.equal(
+ expect(body.capture_method, "capture_method").to.equal(
response.body.capture_method
);
expect(response.body.payment_method, "payment_method").to.be.null;
@@ -3085,13 +3079,14 @@ Cypress.Commands.add(
const profile_id = globalState.get(`${configInfo.profilePrefix}Id`);
const customer_id = globalState.get("customerId");
+ const body = JSON.parse(JSON.stringify(confirmBody));
for (const key in reqData) {
- confirmBody[key] = reqData[key];
+ body[key] = reqData[key];
}
- confirmBody.client_secret = globalState.get("clientSecret");
- confirmBody.confirm = confirm;
- confirmBody.profile_id = profile_id;
- confirmBody.customer_id = customer_id;
+ body.client_secret = globalState.get("clientSecret");
+ body.confirm = confirm;
+ body.profile_id = profile_id;
+ body.customer_id = customer_id;
cy.request({
method: "POST",
@@ -3101,7 +3096,7 @@ Cypress.Commands.add(
"api-key": globalState.get("publishableKey"),
},
failOnStatusCode: false,
- body: confirmBody,
+ body: body,
}).then((response) => {
logRequestId(response.headers["x-request-id"]);
@@ -3112,7 +3107,7 @@ Cypress.Commands.add(
);
globalState.set("paymentID", paymentIntentId);
updateConnectorState(globalState, response.body.connector);
- globalState.set("paymentMethodType", confirmBody.payment_method_type);
+ globalState.set("paymentMethodType", body.payment_method_type);
if (response.status === 200) {
validateErrorMessage(response, resData);
@@ -3177,13 +3172,21 @@ Cypress.Commands.add(
response.body.capture_method === "manual" ||
response.body.capture_method === "manual_multiple"
) {
- expect(response.body)
- .to.have.property("next_action")
- .to.have.property("redirect_to_url");
- globalState.set(
- "nextActionUrl",
- response.body.next_action.redirect_to_url
- );
+ if (response.body.status !== "failed") {
+ expect(response.body).to.have.property("next_action");
+ if (response.body.next_action?.redirect_to_url) {
+ globalState.set(
+ "nextActionUrl",
+ response.body.next_action.redirect_to_url
+ );
+ }
+ // QR code wallet types (e.g. Stripe Cashapp, WeChatPay) return
+ // next_action.type = "qr_code_information" with no redirect_to_url
+ } else if (response.body.status === "failed") {
+ expect(response.body.error_code).to.equal(
+ resData.body.error_code
+ );
+ }
} else {
throw new Error(
`Invalid capture method ${response.body.capture_method}`
diff --git a/cypress-tests/cypress/support/redirectionHandler.js b/cypress-tests/cypress/support/redirectionHandler.js
index 36effa53c7..89deb1cf49 100644
--- a/cypress-tests/cypress/support/redirectionHandler.js
+++ b/cypress-tests/cypress/support/redirectionHandler.js
@@ -1265,6 +1265,29 @@ function bankRedirectRedirection(
return;
}
+ // Stripe wallet redirects (AliPay, AmazonPay, Cashapp, RevolutPay, WeChatPay) point to
+ // external wallet pages that cannot be automated in CI. Skip the redirect visit entirely
+ // and rely on the payment status (requires_customer_action) verified in the retrieve step.
+ if (
+ connectorId === "stripe" &&
+ ["ali_pay", "amazon_pay", "cashapp", "revolut_pay", "we_chat_pay"].includes(
+ paymentMethodType
+ )
+ ) {
+ expect(
+ redirectionUrl,
+ `Stripe ${paymentMethodType} forward flow redirect URL`
+ ).to.not.be.null;
+ expect(
+ redirectionUrl.href,
+ `Stripe ${paymentMethodType} redirect URL href`
+ ).to.be.a("string").and.to.not.be.empty;
+ cy.log(
+ `Verified forward flow for Stripe ${paymentMethodType} — redirect URL present: ${redirectionUrl.href} (external page not automatable)`
+ );
+ return;
+ }
+
const adyenWalletTypesWithNullRedirect = ["dana", "go_pay", "momo", "vipps"];
if (