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 PayLater coverage for AfterpayClearpay, Alma, and Walley connectors (#13071)

HS-QUALIBOTddfa072e9c8d
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Adyen.js b/cypress-tests/cypress/e2e/configs/Payment/Adyen.js
index 82e1cad2bd..acbd496f81 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Adyen.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Adyen.js
@@ -2190,6 +2190,287 @@ export const connectorDetails = {
},
},
}),
+ AfterpayClearpayAutoCapture: getCustomExchange({
+ Request: {
+ currency: "GBP",
+ capture_method: "automatic",
+ billing: {
+ address: {
+ line1: "123",
+ line2: "Test Street",
+ city: "Test City",
+ zip: "12345",
+ country: "GB",
+ first_name: "John",
+ last_name: "Doe",
+ },
+ email: "[email protected]",
+ },
+ shipping: {
+ address: {
+ line1: "123 Test Street",
+ line2: "Apt 4",
+ city: "San Francisco",
+ state: "California",
+ zip: "94122",
+ country: "US",
+ first_name: "John",
+ last_name: "Doe",
+ },
+ },
+ order_details: [
+ {
+ product_name: "Test Product",
+ quantity: 1,
+ amount: 6000,
+ },
+ ],
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ },
+ },
+ }),
+ AfterpayClearpay: getCustomExchange({
+ Request: {
+ payment_method: "pay_later",
+ payment_method_type: "afterpay_clearpay",
+ payment_experience: "redirect_to_url",
+ payment_method_data: {
+ pay_later: {
+ afterpay_clearpay_redirect: {},
+ },
+ },
+ currency: "GBP",
+ billing: {
+ address: {
+ line1: "123",
+ line2: "Test Street",
+ city: "Test City",
+ zip: "12345",
+ country: "GB",
+ first_name: "John",
+ last_name: "Doe",
+ },
+ email: "[email protected]",
+ },
+ shipping: {
+ address: {
+ line1: "123 Test Street",
+ line2: "Apt 4",
+ city: "San Francisco",
+ state: "California",
+ zip: "94122",
+ country: "US",
+ first_name: "John",
+ last_name: "Doe",
+ },
+ },
+ order_details: [
+ {
+ product_name: "Test Product",
+ quantity: 1,
+ amount: 6000,
+ },
+ ],
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ }),
+ AlmaAutoCapture: getCustomExchange({
+ Request: {
+ currency: "EUR",
+ capture_method: "automatic",
+ billing: {
+ address: {
+ line1: "123",
+ line2: "Test Street",
+ city: "Test City",
+ zip: "12345",
+ country: "FR",
+ first_name: "John",
+ last_name: "Doe",
+ },
+ email: "[email protected]",
+ phone: {
+ number: "612345678",
+ country_code: "+33",
+ },
+ },
+ shipping: {
+ address: {
+ line1: "123 Test Street",
+ line2: "Apt 4",
+ city: "San Francisco",
+ state: "California",
+ zip: "94122",
+ country: "US",
+ first_name: "John",
+ last_name: "Doe",
+ },
+ },
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ },
+ },
+ }),
+ Alma: getCustomExchange({
+ Request: {
+ payment_method: "pay_later",
+ payment_method_type: "alma",
+ payment_experience: "redirect_to_url",
+ payment_method_data: {
+ pay_later: {
+ alma_redirect: {},
+ },
+ },
+ currency: "EUR",
+ billing: {
+ address: {
+ line1: "123",
+ line2: "Test Street",
+ city: "Test City",
+ zip: "12345",
+ country: "FR",
+ first_name: "John",
+ last_name: "Doe",
+ },
+ email: "[email protected]",
+ phone: {
+ number: "612345678",
+ country_code: "+33",
+ },
+ },
+ shipping: {
+ address: {
+ line1: "123 Test Street",
+ line2: "Apt 4",
+ city: "San Francisco",
+ state: "California",
+ zip: "94122",
+ country: "US",
+ first_name: "John",
+ last_name: "Doe",
+ },
+ },
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ }),
+ WalleyAutoCapture: getCustomExchange({
+ Request: {
+ currency: "SEK",
+ capture_method: "automatic",
+ billing: {
+ address: {
+ line1: "123",
+ line2: "Test Street",
+ city: "Test City",
+ zip: "12345",
+ country: "SE",
+ first_name: "John",
+ last_name: "Doe",
+ },
+ email: "[email protected]",
+ phone: {
+ number: "9123456789",
+ country_code: "+46",
+ },
+ },
+ shipping: {
+ address: {
+ line1: "123 Test Street",
+ line2: "Apt 4",
+ city: "San Francisco",
+ state: "California",
+ zip: "94122",
+ country: "US",
+ first_name: "John",
+ last_name: "Doe",
+ },
+ },
+ order_details: [
+ {
+ product_name: "Test Product",
+ quantity: 1,
+ amount: 6000,
+ },
+ ],
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ },
+ },
+ }),
+ Walley: getCustomExchange({
+ Request: {
+ payment_method: "pay_later",
+ payment_method_type: "walley",
+ payment_experience: "redirect_to_url",
+ payment_method_data: {
+ pay_later: {
+ walley_redirect: {},
+ },
+ },
+ currency: "SEK",
+ billing: {
+ address: {
+ line1: "123",
+ line2: "Test Street",
+ city: "Test City",
+ zip: "12345",
+ country: "SE",
+ first_name: "John",
+ last_name: "Doe",
+ },
+ email: "[email protected]",
+ phone: {
+ number: "9123456789",
+ country_code: "+46",
+ },
+ },
+ shipping: {
+ address: {
+ line1: "123 Test Street",
+ line2: "Apt 4",
+ city: "San Francisco",
+ state: "California",
+ zip: "94122",
+ country: "US",
+ first_name: "John",
+ last_name: "Doe",
+ },
+ },
+ order_details: [
+ {
+ product_name: "Test Product",
+ quantity: 1,
+ amount: 6000,
+ },
+ ],
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ }),
CaptureOnWrongStatus: getCustomExchange({
Request: {
amount_to_capture: 6000,
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Commons.js b/cypress-tests/cypress/e2e/configs/Payment/Commons.js
index 71fb16974e..8abe2a126c 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Commons.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Commons.js
@@ -872,6 +872,39 @@ export const payment_methods_enabled = [
recurring_enabled: false,
installment_payment_enabled: false,
},
+ {
+ payment_method_type: "afterpay_clearpay",
+ payment_experience: "redirect_to_url",
+ card_networks: null,
+ accepted_currencies: null,
+ accepted_countries: null,
+ minimum_amount: 1,
+ maximum_amount: 68607706,
+ recurring_enabled: false,
+ installment_payment_enabled: false,
+ },
+ {
+ payment_method_type: "alma",
+ payment_experience: "redirect_to_url",
+ card_networks: null,
+ accepted_currencies: null,
+ accepted_countries: null,
+ minimum_amount: 1,
+ maximum_amount: 68607706,
+ recurring_enabled: false,
+ installment_payment_enabled: false,
+ },
+ {
+ payment_method_type: "walley",
+ payment_experience: "redirect_to_url",
+ card_networks: null,
+ accepted_currencies: null,
+ accepted_countries: null,
+ minimum_amount: 1,
+ maximum_amount: 68607706,
+ recurring_enabled: false,
+ installment_payment_enabled: false,
+ },
],
},
];
@@ -1711,7 +1744,7 @@ export const connectorDetails = {
}),
SyncRefund: getCustomExchange({}),
SyncRefundScheduled: getCustomExchange({}),
- AfterpayClearplay: getCustomExchange({
+ AfterpayClearpay: getCustomExchange({
Request: {
payment_method: "pay_later",
payment_method_type: "afterpay_clearpay",
@@ -1769,6 +1802,7 @@ export const connectorDetails = {
},
},
billing: {
+ email: "[email protected]",
phone: {
number: "612345678",
country_code: "+33",
@@ -1841,6 +1875,52 @@ export const connectorDetails = {
],
},
}),
+ Walley: getCustomExchange({
+ Request: {
+ payment_method: "pay_later",
+ payment_method_type: "walley",
+ payment_experience: "redirect_to_url",
+ payment_method_data: {
+ pay_later: {
+ walley_redirect: {},
+ },
+ },
+ billing: {
+ email: "[email protected]",
+ phone: {
+ number: "0701234567",
+ country_code: "+46",
+ },
+ address: {
+ line1: "123 Test Street",
+ city: "Stockholm",
+ state: "Stockholm",
+ zip: "11122",
+ country: "SE",
+ first_name: "Lars",
+ last_name: "Eriksson",
+ },
+ },
+ shipping: {
+ address: {
+ line1: "123 Test Street",
+ city: "Stockholm",
+ state: "Stockholm",
+ zip: "11122",
+ country: "SE",
+ first_name: "Lars",
+ last_name: "Eriksson",
+ },
+ },
+ order_details: [
+ {
+ product_name: "Test Product",
+ quantity: 1,
+ amount: 6000,
+ },
+ ],
+ },
+ }),
CaptureOnWrongStatus: getCustomExchange({
Request: {
amount_to_capture: 6000,
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Modifiers.js b/cypress-tests/cypress/e2e/configs/Payment/Modifiers.js
index 63cee888f3..7eb71e380d 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Modifiers.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Modifiers.js
@@ -205,6 +205,7 @@ const CURRENCY_MAP = {
Mifinity: "EUR", // Mifinity wallet payment method
Alma: "EUR", // French pay_later
Atome: "SGD", // Singapore pay_later
+ Walley: "SEK", // Swedish pay_later
// Voucher payment methods
Boleto: "BRL",
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
index d7b771be1c..0363ed4883 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
@@ -607,6 +607,9 @@ export const CONNECTOR_LISTS = {
EXTERNAL_THREE_DS: ["stripe", "finix"],
PARTNER_MERCHANT_IDENTIFIER: ["adyen", "checkout"],
AFFIRM_PAY_LATER: ["affirm"],
+ AFTERPAY_CLEARPAY: ["adyen"],
+ ALMA: ["adyen"],
+ WALLEY: ["adyen"],
EXTEND_AUTHORIZATION: ["adyen", "paypal"],
GIFT_CARD: ["adyen"],
VOUCHER: ["adyen", "dlocal"],
diff --git a/cypress-tests/cypress/e2e/spec/Payment/43-PayLater.cy.js b/cypress-tests/cypress/e2e/spec/Payment/43-PayLater.cy.js
index 0905daf6f2..ccf2c1a5d2 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/43-PayLater.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/43-PayLater.cy.js
@@ -558,4 +558,268 @@ describe("PayLater tests", () => {
});
});
});
+
+ context("AfterpayClearpay PayLater - Auto Capture flow test", () => {
+ before("skip if connector does not support AfterpayClearpay", function () {
+ if (
+ shouldIncludeConnector(
+ globalState.get("connectorId"),
+ CONNECTOR_LISTS.INCLUDE.AFTERPAY_CLEARPAY
+ )
+ ) {
+ this.skip();
+ }
+ });
+ it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Payment -> Handle PayLater Redirection -> Retrieve Payment", () => {
+ let shouldContinue = true;
+
+ cy.step("Create Payment Intent", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "pay_later_pm"
+ ]["AfterpayClearpayAutoCapture"];
+ 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"))[
+ "pay_later_pm"
+ ]["AfterpayClearpay"];
+ cy.confirmBankRedirectCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Handle PayLater Redirection", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Handle PayLater Redirection");
+ return;
+ }
+ const expected_redirection =
+ globalState.get("baseUrl") + "/payments/completion";
+ const payment_method_type = globalState.get("paymentMethodType");
+ cy.handlePayLaterRedirection(
+ globalState,
+ payment_method_type,
+ expected_redirection
+ );
+ });
+
+ cy.step("Retrieve Payment after Redirection", () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Retrieve Payment after Redirection"
+ );
+ return;
+ }
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "pay_later_pm"
+ ]["AfterpayClearpay"];
+ cy.retrievePaymentCallTest({ globalState, data });
+ });
+ });
+ });
+
+ context("Alma PayLater - Auto Capture flow test", () => {
+ before("skip if connector does not support Alma", function () {
+ if (
+ shouldIncludeConnector(
+ globalState.get("connectorId"),
+ CONNECTOR_LISTS.INCLUDE.ALMA
+ )
+ ) {
+ this.skip();
+ }
+ });
+ it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Payment -> Handle PayLater Redirection -> Retrieve Payment", () => {
+ let shouldContinue = true;
+
+ cy.step("Create Payment Intent", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "pay_later_pm"
+ ]["AlmaAutoCapture"];
+ 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"))[
+ "pay_later_pm"
+ ]["Alma"];
+ cy.confirmBankRedirectCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Handle PayLater Redirection", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Handle PayLater Redirection");
+ return;
+ }
+ const expected_redirection =
+ globalState.get("baseUrl") + "/payments/completion";
+ const payment_method_type = globalState.get("paymentMethodType");
+ cy.handlePayLaterRedirection(
+ globalState,
+ payment_method_type,
+ expected_redirection
+ );
+ });
+
+ cy.step("Retrieve Payment after Redirection", () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Retrieve Payment after Redirection"
+ );
+ return;
+ }
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "pay_later_pm"
+ ]["Alma"];
+ cy.retrievePaymentCallTest({ globalState, data });
+ });
+ });
+ });
+
+ context("Walley PayLater - Auto Capture flow test", () => {
+ before("skip if connector does not support Walley", function () {
+ if (
+ shouldIncludeConnector(
+ globalState.get("connectorId"),
+ CONNECTOR_LISTS.INCLUDE.WALLEY
+ )
+ ) {
+ this.skip();
+ }
+ });
+ it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Payment -> Handle PayLater Redirection -> Retrieve Payment", () => {
+ let shouldContinue = true;
+
+ cy.step("Create Payment Intent", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "pay_later_pm"
+ ]["WalleyAutoCapture"];
+ 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"))[
+ "pay_later_pm"
+ ]["Walley"];
+ cy.confirmBankRedirectCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Handle PayLater Redirection", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Handle PayLater Redirection");
+ return;
+ }
+ const expected_redirection =
+ globalState.get("baseUrl") + "/payments/completion";
+ const payment_method_type = globalState.get("paymentMethodType");
+ cy.handlePayLaterRedirection(
+ globalState,
+ payment_method_type,
+ expected_redirection
+ );
+ });
+
+ cy.step("Retrieve Payment after Redirection", () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Retrieve Payment after Redirection"
+ );
+ return;
+ }
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "pay_later_pm"
+ ]["Walley"];
+ cy.retrievePaymentCallTest({ globalState, data });
+ });
+ });
+ });
});