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 pay_later_pm configs for Airwallex and Mollie (#12183)

HS-QUALIBOT6ac0cd81db0d
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Airwallex.js b/cypress-tests/cypress/e2e/configs/Payment/Airwallex.js
index 8faed0a007..5e919a6840 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Airwallex.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Airwallex.js
@@ -1,4 +1,5 @@
import { customerAcceptance } from "./Commons";
+import { getCustomExchange } from "./Modifiers";
const successfulNo3DSCardDetails = {
card_number: "4111111111111111", // Non-3DS Airwallex test card
@@ -950,13 +951,108 @@ export const connectorDetails = {
},
},
},
+ pay_later_pm: {
+ AutoCapture: getCustomExchange({
+ Request: {
+ currency: "EUR",
+ capture_method: "automatic",
+ description: "Test Order",
+ return_url: "https://example.com",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ },
+ },
+ }),
+ ManualCapture: getCustomExchange({
+ Request: {
+ currency: "EUR",
+ capture_method: "manual",
+ description: "Test Order",
+ return_url: "https://example.com",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ },
+ },
+ }),
+ Klarna: getCustomExchange({
+ Request: {
+ payment_method: "pay_later",
+ payment_method_type: "klarna",
+ payment_experience: "redirect_to_url",
+ payment_method_data: {
+ pay_later: {
+ klarna_redirect: {
+ billing_email: "[email protected]",
+ billing_country: "DE",
+ },
+ },
+ },
+ billing: {
+ email: "[email protected]",
+ address: {
+ line1: "123 Test St",
+ line2: "Apt 4B",
+ city: "Berlin",
+ zip: "10115",
+ country: "DE",
+ first_name: "Test",
+ last_name: "User",
+ },
+ },
+ shipping: {
+ address: {
+ line1: "123 Test St",
+ line2: "Apt 4B",
+ city: "Berlin",
+ zip: "10115",
+ country: "DE",
+ first_name: "Test",
+ last_name: "User",
+ },
+ },
+ order_details: [
+ {
+ product_name: "Test Product",
+ quantity: 1,
+ amount: 6000,
+ total_amount: 6000,
+ description: "Test Product Description",
+ product_img_link: "https://example.com/product.jpg",
+ },
+ ],
+ browser_info: {
+ java_enabled: false,
+ java_script_enabled: true,
+ language: "en-US",
+ color_depth: 24,
+ screen_width: 1920,
+ screen_height: 1080,
+ time_zone: 3600,
+ user_agent: "Mozilla/5.0",
+ accept_header: "text/html",
+ },
+ return_url: "https://example.com",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ }),
+ },
webhook: {
TransactionIdConfig: {
path: "sourceId",
type: "string",
},
RefundIdConfig: {
- // Airwallex refund webhooks use sourceId to carry the connector refund ID
path: "sourceId",
type: "string",
},
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Mollie.js b/cypress-tests/cypress/e2e/configs/Payment/Mollie.js
index 5a6e4d900d..78c9382be7 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Mollie.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Mollie.js
@@ -829,14 +829,108 @@ export const connectorDetails = {
},
},
},
+ pay_later_pm: {
+ AutoCapture: getCustomExchange({
+ Request: {
+ currency: "EUR",
+ capture_method: "automatic",
+ description: "Test Order",
+ return_url: "https://example.com",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ },
+ },
+ }),
+ ManualCapture: getCustomExchange({
+ Request: {
+ currency: "EUR",
+ capture_method: "manual",
+ description: "Test Order",
+ return_url: "https://example.com",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ },
+ },
+ }),
+ Klarna: {
+ Request: {
+ payment_method: "pay_later",
+ payment_method_type: "klarna",
+ payment_experience: "redirect_to_url",
+ description: "Test Order",
+ payment_method_data: {
+ pay_later: {
+ klarna_redirect: {
+ billing_email: "[email protected]",
+ billing_country: "NL",
+ },
+ },
+ },
+ billing: {
+ email: "[email protected]",
+ address: {
+ line1: "123 Test St",
+ line2: "Apt 4B",
+ city: "Amsterdam",
+ zip: "1012 WX",
+ country: "NL",
+ first_name: "Test",
+ last_name: "User",
+ },
+ },
+ shipping: {
+ address: {
+ line1: "123 Test St",
+ line2: "Apt 4B",
+ city: "Amsterdam",
+ zip: "1012 WX",
+ country: "NL",
+ first_name: "Test",
+ last_name: "User",
+ },
+ },
+ order_details: [
+ {
+ product_name: "Test Product",
+ quantity: 1,
+ amount: 6000,
+ total_amount: 6000,
+ description: "Test Product Description",
+ product_img_link: "https://example.com/product.jpg",
+ },
+ ],
+ browser_info: {
+ java_enabled: false,
+ java_script_enabled: true,
+ language: "en-US",
+ color_depth: 24,
+ screen_width: 1920,
+ screen_height: 1080,
+ time_zone: 3600,
+ user_agent: "Mozilla/5.0",
+ accept_header: "text/html",
+ },
+ return_url: "https://example.com",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ },
+ },
webhook: {
TransactionIdConfig: {
- // Defines how to locate and parse the payment reference ID from connector-specific webhook payloads
path: "id",
- // Type of payment reference ID
type: "string",
},
- // Mollie webhook handler uses serde_qs (form-encoded), not JSON
contentType: "application/x-www-form-urlencoded",
},
};
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
index 78c4c8cdd8..26fd136ca5 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
@@ -547,7 +547,7 @@ export const CONNECTOR_LISTS = {
PARTNER_MERCHANT_IDENTIFIER: ["adyen", "checkout"],
EXTEND_AUTHORIZATION: ["adyen", "paypal"],
GIFT_CARD: ["adyen"],
- PAY_LATER: ["klarna", "adyen", "aci", "stripe"],
+ PAY_LATER: ["klarna", "adyen", "aci", "stripe", "airwallex", "mollie"],
AUTH_SERVICE_ELIGIBILITY: ["stripe", "cybersource"],
PARTIAL_AUTH: ["nuvei", "checkout", "worldpay", "worldpayvantiv"],
USE_BILLING_AS_PAYMENT_METHOD_BILLING: ["bankofamerica"],
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 9e80d5b6db..0e9586b56b 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/43-PayLater.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/43-PayLater.cy.js
@@ -1,14 +1,35 @@
import * as fixtures from "../../../fixtures/imports";
import State from "../../../utils/State";
-import getConnectorDetails, * as utils from "../../configs/Payment/Utils";
+import getConnectorDetails, {
+ CONNECTOR_LISTS,
+ shouldIncludeConnector,
+} from "../../configs/Payment/Utils";
+import * as utils from "../../configs/Payment/Utils";
let globalState;
describe("PayLater tests", () => {
- 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);
+
+ if (
+ shouldIncludeConnector(
+ globalState.get("connectorId"),
+ CONNECTOR_LISTS.INCLUDE.PAY_LATER
+ )
+ ) {
+ skip = true;
+ }
+ })
+ .then(() => {
+ if (skip) {
+ this.skip();
+ }
+ });
});
afterEach("flush global state", () => {
diff --git a/cypress-tests/cypress/support/redirectionHandler.js b/cypress-tests/cypress/support/redirectionHandler.js
index 1ac6c140ce..8d0218c3ad 100644
--- a/cypress-tests/cypress/support/redirectionHandler.js
+++ b/cypress-tests/cypress/support/redirectionHandler.js
@@ -241,6 +241,117 @@ function payLaterRedirection(
verifyUrl = false;
break;
+ case "mollie":
+ // Mollie Klarna PayLater - complete the payment flow
+ cy.log(
+ `Handling Mollie ${paymentMethodType} pay_later flow - completing payment`
+ );
+
+ // Wait for the Mollie test page to load
+ cy.get("body", { timeout: constants.TIMEOUT }).should("exist");
+
+ // Mollie test mode shows radio buttons to select payment status
+ cy.get("body").then(($body) => {
+ const paidSelector = 'input[type="radio"][value="paid"]';
+ const authorizedSelector =
+ 'input[type="radio"][value="authorized"]';
+
+ if ($body.find(paidSelector).length) {
+ cy.get(paidSelector, { timeout: constants.WAIT_TIME })
+ .click()
+ .log("Selected: Paid");
+ } else if ($body.find(authorizedSelector).length) {
+ cy.get(authorizedSelector, { timeout: constants.WAIT_TIME })
+ .click()
+ .log("Selected: Authorized");
+ } else {
+ cy.log(
+ "No payment status selector found, page may auto-redirect"
+ );
+ }
+ });
+
+ // Click the Continue/Submit button to complete payment
+ cy.get("body").then(($body) => {
+ if ($body.find('button[type="submit"]').length > 0) {
+ cy.get('button[type="submit"]', {
+ timeout: constants.WAIT_TIME,
+ })
+ .should("be.visible")
+ .click()
+ .log("Clicked submit button");
+ } else if ($body.find("button:contains('Continue')").length > 0) {
+ cy.contains("button", "Continue", {
+ timeout: constants.WAIT_TIME,
+ })
+ .should("be.visible")
+ .click()
+ .log("Clicked Continue button");
+ } else if ($body.find('input[type="submit"]').length > 0) {
+ cy.get('input[type="submit"]', {
+ timeout: constants.WAIT_TIME,
+ })
+ .should("be.visible")
+ .click()
+ .log("Clicked input submit");
+ } else {
+ cy.log("No submit button found - may auto-submit");
+ }
+ });
+
+ verifyUrl = true; // Complete payment and verify return URL
+ break;
+
+ case "airwallex":
+ // Airwallex Klarna PayLater - follows similar pattern to other Klarna flows
+ cy.log(`Handling Airwallex ${paymentMethodType} pay_later flow`);
+
+ // Wait for the page to load
+ cy.get("body", { timeout: constants.TIMEOUT }).should("exist");
+
+ // Airwallex Klarna redirects to standard Klarna playground
+ // Verify we landed on a Klarna page
+ cy.get("body", { timeout: constants.TIMEOUT }).then(($body) => {
+ const bodyText = $body.text();
+ const klarnaIndicators = [
+ /klarna/i,
+ /playground/i,
+ /buy now.*pay later/i,
+ /continue.*klarna/i,
+ /smoooth/i,
+ ];
+
+ const hasKlarnaIndicator = klarnaIndicators.some((pattern) =>
+ pattern.test(bodyText)
+ );
+
+ if (hasKlarnaIndicator) {
+ cy.log(
+ "Successfully navigated to Klarna page - verified redirection"
+ );
+ } else {
+ // Check URL as fallback
+ cy.url().then((url) => {
+ if (
+ url.includes("klarna") ||
+ url.includes("playground") ||
+ url.includes("airwallex")
+ ) {
+ cy.log(
+ "URL indicates Klarna redirect - verified navigation"
+ );
+ } else {
+ cy.log(
+ `Warning: URL (${url}) does not contain expected Klarna indicators`
+ );
+ }
+ });
+ }
+ });
+
+ verifyUrl = false; // Don't complete payment, just verify navigation
+ break;
+
default:
cy.log(
`Generic pay_later handling for ${connectorId}/${paymentMethodType}`