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 Oxxo Voucher Payment coverage for dlocal (#12578)

HS-QUALIBOTa3aa9be4962b
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Dlocal.js b/cypress-tests/cypress/e2e/configs/Payment/Dlocal.js
index 5748805b4a..9ff3566e0f 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Dlocal.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Dlocal.js
@@ -3,6 +3,7 @@ import {
multiUseMandateData,
singleUseMandateData,
} from "./Commons";
+// import { getCustomExchange } from "./Modifiers";
const mockBillingDetails = {
address: {
line1: "Servidao B-1",
@@ -90,6 +91,95 @@ const payment_method_data_3ds_address = {
billing: mockBillingDetails,
};
export const connectorDetails = {
+ voucher_pm: {
+ PaymentIntent: () => {
+ return {
+ Request: {
+ currency: "MXN",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ },
+ },
+ };
+ },
+ Oxxo: {
+ Request: {
+ payment_method: "voucher",
+ payment_method_type: "oxxo",
+ payment_method_data: {
+ voucher: "oxxo",
+ },
+ billing: {
+ address: {
+ line1: "123 Test Street",
+ city: "Mexico City",
+ state: "CDMX",
+ zip: "01000",
+ country: "MX",
+ first_name: "Test",
+ last_name: "Customer",
+ },
+ email: "[email protected]",
+ },
+ customer: {
+ document_details: {
+ document_type: "cnpj",
+ document_number: "12345678000195",
+ },
+ },
+ currency: "MXN",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ payment_method: "voucher",
+ payment_method_type: "oxxo",
+ },
+ },
+ },
+ OxxoInvalidFormat: {
+ Request: {
+ payment_method: "voucher",
+ payment_method_type: "oxxo",
+ payment_method_data: {
+ voucher: "invalid_oxxo_value",
+ },
+ billing: {
+ address: {
+ line1: "123 Test Street",
+ city: "Mexico City",
+ state: "CDMX",
+ zip: "01000",
+ country: "MX",
+ first_name: "Test",
+ last_name: "Customer",
+ },
+ email: "[email protected]",
+ },
+ customer: {
+ document_details: {
+ document_type: "cnpj",
+ document_number: "12345678000195",
+ },
+ },
+ currency: "MXN",
+ },
+ Response: {
+ status: 400,
+ body: {
+ error: {
+ message:
+ "Json deserialize error: unknown variant `invalid_oxxo_value`, expected one of `boleto`, `efecty`, `pago_efectivo`, `red_compra`, `red_pagos`, `alfamart`, `indomaret`, `oxxo`, `seven_eleven`, `lawson`, `mini_stop`, `family_mart`, `seicomart`, `pay_easy`",
+ code: "IR_06",
+ },
+ },
+ },
+ },
+ },
card_pm: {
No3DSFailPayment: {
Request: {
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
index 7173de8617..fe86e404fc 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
@@ -588,7 +588,7 @@ export const CONNECTOR_LISTS = {
AFFIRM_PAY_LATER: ["affirm"],
EXTEND_AUTHORIZATION: ["adyen", "paypal"],
GIFT_CARD: ["adyen"],
- VOUCHER: ["adyen"],
+ VOUCHER: ["adyen", "dlocal"],
RELAY_OPERATIONS: ["bankofamerica"],
PAY_LATER: [
"klarna",
diff --git a/cypress-tests/cypress/e2e/spec/Payment/52-VoucherPayment.cy.js b/cypress-tests/cypress/e2e/spec/Payment/52-VoucherPayment.cy.js
index 76c5912cfa..aa11601ca2 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/52-VoucherPayment.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/52-VoucherPayment.cy.js
@@ -185,7 +185,7 @@ describe("Voucher Payment tests", () => {
});
});
- it("OXXO invalid voucher data format (string instead of null) should error", () => {
+ it("OXXO invalid voucher value should return deserialization error", () => {
const data = getConnectorDetails(globalState.get("connectorId"))[
"voucher_pm"
]["OxxoInvalidFormat"];
diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js
index 9a7e264f8f..164eb7047c 100644
--- a/cypress-tests/cypress/support/commands.js
+++ b/cypress-tests/cypress/support/commands.js
@@ -5512,10 +5512,15 @@ Cypress.Commands.add(
Cypress.Commands.add(
"handleVoucherRedirection",
(globalState, paymentMethodType, expectedRedirection) => {
- const DISPLAY_ONLY_VOUCHERS = ["boleto", "oxxo", "alfamart", "indomaret"];
- if (DISPLAY_ONLY_VOUCHERS.includes(paymentMethodType)) {
+ const connectorId = globalState.get("connectorId");
+ const DISPLAY_ONLY_VOUCHERS = {
+ adyen: ["boleto", "oxxo", "alfamart", "indomaret"],
+ dlocal: ["boleto", "alfamart", "indomaret"],
+ };
+ const connectorDisplayOnly = DISPLAY_ONLY_VOUCHERS[connectorId] || [];
+ if (connectorDisplayOnly.includes(paymentMethodType)) {
cy.log(
- `Skipping cy.visit() for display-only voucher: ${paymentMethodType}`
+ `Skipping cy.visit() for display-only voucher: ${paymentMethodType} (connector: ${connectorId})`
);
return;
}
@@ -5540,7 +5545,6 @@ Cypress.Commands.add(
return;
}
- const connectorId = globalState.get("connectorId");
const expectedUrl = new URL(expectedRedirection);
const redirectionUrl = new URL(nextActionUrl);
diff --git a/cypress-tests/cypress/support/redirectionHandler.js b/cypress-tests/cypress/support/redirectionHandler.js
index a342dc639f..45adc598ec 100644
--- a/cypress-tests/cypress/support/redirectionHandler.js
+++ b/cypress-tests/cypress/support/redirectionHandler.js
@@ -2610,6 +2610,82 @@ function voucherRedirection(
verifyUrl = false;
}
break;
+ case "dlocal":
+ switch (paymentMethodType) {
+ case "oxxo":
+ // Dlocal Oxxo returns a redirect URL via ticket.image_url.
+ // Visit the page, inspect for interactive elements,
+ // and attempt to complete payment.
+ cy.log(`Dlocal Oxxo voucher — visiting redirect URL`);
+
+ // Suppress potential JS errors from sandbox/test pages
+ cy.on("uncaught:exception", () => false);
+
+ cy.get("body", { timeout: constants.TIMEOUT })
+ .should("exist")
+ .then(($body) => {
+ const bodyText = $body.text().toLowerCase();
+
+ // Determine if this is an interactive payment page
+ const hasPayButton =
+ $body.find('button:visible, input[type="submit"]:visible')
+ .length > 0;
+ const hasInteractiveElements = [
+ /pay/i,
+ /confirm/i,
+ /continue/i,
+ /submit/i,
+ ].some((pat) => pat.test(bodyText));
+
+ if (hasPayButton || hasInteractiveElements) {
+ cy.log(
+ `Interactive Oxxo page detected — attempting to complete payment`
+ );
+
+ // Generic button click strategy
+ cy.get("body").then(($b) => {
+ const buttons = $b.find("button:visible");
+ for (let i = 0; i < buttons.length; i++) {
+ const btnText = buttons[i].innerText.toLowerCase();
+ if (
+ /pay|confirm|continue|submit|complete/i.test(
+ btnText
+ )
+ ) {
+ cy.wrap(buttons[i]).click({ force: true });
+ cy.log(`Clicked payment button: ${btnText}`);
+ break;
+ }
+ }
+ });
+
+ // If there's a form, try to fill any visible inputs
+ cy.get("body").then(($b) => {
+ const inputs = $b.find(
+ "input:visible:not([type='hidden'])"
+ );
+ if (inputs.length > 0) {
+ cy.log(
+ `Found ${inputs.length} visible input(s) on Oxxo page`
+ );
+ }
+ });
+
+ verifyUrl = true;
+ } else {
+ // No interactive elements — display-only page (e.g. static barcode/image)
+ cy.log(
+ `Dlocal Oxxo page has no clickable payment buttons — display-only voucher`
+ );
+ verifyUrl = false;
+ }
+ });
+ break;
+ default:
+ cy.log(`Unhandled dlocal voucher type: ${paymentMethodType}`);
+ verifyUrl = false;
+ }
+ break;
default:
cy.log(
`Generic voucher handling for ${connectorId}/${paymentMethodType}`