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 clear pan retry coverage for bankofamerica (#12422)

HS-QUALIBOTe940938b8d1c
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
index bb6ceff1d0..ccaea8a99f 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
@@ -589,6 +589,7 @@ export const CONNECTOR_LISTS = {
"trustpay",
],
CARD_TESTING_GUARD: ["bankofamerica"],
+ CLEAR_PAN_RETRY: ["bankofamerica"],
L2L3DATA: ["checkout", "nuvei", "worldpayvantiv"],
REFUND_MANUAL_UPDATE: ["bankofamerica", "cybersource"],
MANUAL_PAYMENT_UPDATE: ["stripe"],
diff --git a/cypress-tests/cypress/e2e/spec/Payment/54-ClearPanRetry.cy.js b/cypress-tests/cypress/e2e/spec/Payment/54-ClearPanRetry.cy.js
new file mode 100644
index 0000000000..916671bd2a
--- /dev/null
+++ b/cypress-tests/cypress/e2e/spec/Payment/54-ClearPanRetry.cy.js
@@ -0,0 +1,231 @@
+import * as fixtures from "../../../fixtures/imports";
+import State from "../../../utils/State";
+import getConnectorDetails, * as utils from "../../configs/Payment/Utils";
+
+let globalState;
+
+describe("Clear PAN Retry Tests", function () {
+ before(function () {
+ let skip = false;
+
+ cy.task("getGlobalState")
+ .then((state) => {
+ globalState = new State(state);
+ const connectorId = globalState.get("connectorId");
+
+ if (
+ utils.shouldIncludeConnector(
+ connectorId,
+ utils.CONNECTOR_LISTS.INCLUDE.CLEAR_PAN_RETRY
+ )
+ ) {
+ skip = true;
+ }
+ })
+ .then(() => {
+ if (skip) {
+ this.skip();
+ }
+ });
+ });
+
+ afterEach("flush global state", () => {
+ cy.task("setGlobalState", globalState.data);
+ });
+
+ context("clear-pan-retries-enabled", () => {
+ it("Enable Clear PAN Retry -> Create Payment Intent -> Confirm Payment -> Retrieve Payment", () => {
+ let shouldContinue = true;
+
+ cy.step("Update Business Profile to enable clear PAN retries", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Update Business Profile");
+ return;
+ }
+
+ const updateBusinessProfileBody = {
+ is_auto_retries_enabled: true,
+ is_network_tokenization_enabled: true,
+ max_auto_retries_enabled: 2,
+ is_clear_pan_retries_enabled: true,
+ };
+
+ cy.UpdateBusinessProfileTest(
+ updateBusinessProfileBody,
+ /* is_connector_agnostic_mit_enabled */ false,
+ /* collect_billing_details_from_wallet_connector */ false,
+ /* collect_shipping_details_from_wallet_connector */ false,
+ /* always_collect_billing_details_from_wallet_connector */ false,
+ /* always_collect_shipping_details_from_wallet_connector */ false,
+ globalState
+ );
+
+ globalState.set("max_auto_retries_enabled", 2);
+ });
+
+ cy.step("Create Payment Intent", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Create Payment Intent");
+ return;
+ }
+
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentIntent"];
+
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Confirm Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Confirm Payment");
+ return;
+ }
+
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["No3DSAutoCapture"];
+
+ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);
+
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Retrieve Payment and verify attempts", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Retrieve Payment");
+ return;
+ }
+
+ // NOTE: skipRetryAssertion=true because the sandbox lacks a connector that supports
+ // PaymentMethodData::NetworkToken, so the attempts.length > 1 assertion is skipped.
+ // This step only verifies the payment has attempts with valid attempt_id/connector fields.
+ // When a sandbox connector supports clear PAN retry, remove skipRetryAssertion and run the full assertion.
+ cy.retrievePaymentCallClearPanRetryTest({
+ globalState,
+ isClearPanRetryEnabled: true,
+ skipRetryAssertion: true,
+ });
+ });
+ });
+ });
+
+ context("clear-pan-retries-disabled", () => {
+ it("Disable Clear PAN Retry -> Create Payment Intent -> Confirm Payment -> Retrieve Payment", () => {
+ let shouldContinue = true;
+
+ cy.step("Update Business Profile to disable clear PAN retries", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Update Business Profile");
+ return;
+ }
+
+ const updateBusinessProfileBody = {
+ is_auto_retries_enabled: true,
+ is_network_tokenization_enabled: true,
+ max_auto_retries_enabled: 2,
+ is_clear_pan_retries_enabled: false,
+ };
+
+ cy.UpdateBusinessProfileTest(
+ updateBusinessProfileBody,
+ /* is_connector_agnostic_mit_enabled */ false,
+ /* collect_billing_details_from_wallet_connector */ false,
+ /* collect_shipping_details_from_wallet_connector */ false,
+ /* always_collect_billing_details_from_wallet_connector */ false,
+ /* always_collect_shipping_details_from_wallet_connector */ false,
+ globalState
+ );
+
+ globalState.set("max_auto_retries_enabled", 2);
+ });
+
+ cy.step("Create Payment Intent", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Create Payment Intent");
+ return;
+ }
+
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentIntent"];
+
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Confirm Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Confirm Payment");
+ return;
+ }
+
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["No3DSAutoCapture"];
+
+ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);
+
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Retrieve Payment and verify attempts", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Retrieve Payment");
+ return;
+ }
+
+ cy.retrievePaymentCallClearPanRetryTest({
+ globalState,
+ isClearPanRetryEnabled: false,
+ });
+ });
+ });
+ });
+
+ context("reset-business-profile", () => {
+ it("Reset business profile to disable clear PAN retries", () => {
+ cy.step("Reset business profile flags", () => {
+ const updateBusinessProfileBody = {
+ is_auto_retries_enabled: false,
+ is_network_tokenization_enabled: false,
+ max_auto_retries_enabled: 0,
+ is_clear_pan_retries_enabled: false,
+ };
+
+ cy.UpdateBusinessProfileTest(
+ updateBusinessProfileBody,
+ /* is_connector_agnostic_mit_enabled */ false,
+ /* collect_billing_details_from_wallet_connector */ false,
+ /* collect_shipping_details_from_wallet_connector */ false,
+ /* always_collect_billing_details_from_wallet_connector */ false,
+ /* always_collect_shipping_details_from_wallet_connector */ false,
+ globalState
+ );
+ });
+ });
+ });
+});
diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js
index 95a4ea1cef..356546916e 100644
--- a/cypress-tests/cypress/support/commands.js
+++ b/cypress-tests/cypress/support/commands.js
@@ -4029,6 +4029,61 @@ Cypress.Commands.add(
}
);
+Cypress.Commands.add(
+ "retrievePaymentCallClearPanRetryTest",
+ ({ globalState, isClearPanRetryEnabled, skipRetryAssertion = false }) => {
+ const paymentId = globalState.get("paymentID");
+ const baseUrl = globalState.get("baseUrl");
+ const apiKey = globalState.get("apiKey");
+
+ const url = `${baseUrl}/payments/${paymentId}?force_sync=true&expand_attempts=true`;
+
+ cy.request({
+ method: "GET",
+ url: url,
+ headers: {
+ "Content-Type": "application/json",
+ "api-key": apiKey,
+ },
+ failOnStatusCode: false,
+ }).then((response) => {
+ logRequestId(response.headers["x-request-id"]);
+ storeRequestId(response.headers["x-request-id"], globalState);
+
+ expect(response.status).to.equal(200);
+ expect(response.headers["content-type"]).to.include("application/json");
+ expect(response.body.payment_id).to.equal(paymentId);
+ expect(response.body.profile_id).to.not.be.null;
+
+ if (response.body.attempts && response.body.attempts.length > 0) {
+ response.body.attempts.forEach((attemptObj) => {
+ expect(attemptObj.attempt_id).to.include(paymentId);
+ expect(attemptObj.connector).to.not.be.null;
+ });
+
+ if (isClearPanRetryEnabled) {
+ if (skipRetryAssertion) {
+ cy.task(
+ "cli_log",
+ "Sandbox limitation: attempts.length > 1 assertion skipped — no sandbox connector supports PaymentMethodData::NetworkToken required for clear PAN retry"
+ );
+ } else {
+ expect(
+ response.body.attempts.length,
+ "Clear PAN retry enabled should have more than 1 attempt"
+ ).to.be.greaterThan(1);
+ }
+ } else {
+ expect(
+ response.body.attempts.length,
+ "Clear PAN retry disabled should have exactly 1 attempt"
+ ).to.equal(1);
+ }
+ }
+ });
+ }
+);
+
Cypress.Commands.add(
"refundCallTest",
(requestBody, data, globalState, connectedMerchantId) => {