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 use_billing_as_payment_method_billing coverage for bankofamerica (#12051)

HS-QUALIBOT963802f2a2de
diff --git a/cypress-tests/cypress/e2e/configs/Payment/BankOfAmerica.js b/cypress-tests/cypress/e2e/configs/Payment/BankOfAmerica.js
index 17766cb214..975f2b4b54 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/BankOfAmerica.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/BankOfAmerica.js
@@ -748,6 +748,37 @@ export const connectorDetails = {
},
},
},
+ UseBillingAsPaymentMethodBilling: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ },
+ },
+ },
+ UseBillingAsPaymentMethodBillingDisabled: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "failed",
+ error_code: "MISSING_FIELD",
+ },
+ },
+ },
PaymentIntentWithFeatureMetadata: {
Request: {
currency: "USD",
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Commons.js b/cypress-tests/cypress/e2e/configs/Payment/Commons.js
index 70e2b27508..31ad14768a 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Commons.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Commons.js
@@ -2481,6 +2481,24 @@ export const connectorDetails = {
},
},
}),
+ UseBillingAsPaymentMethodBilling: getCustomExchange({
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ },
+ }),
+ UseBillingAsPaymentMethodBillingDisabled: getCustomExchange({
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ },
+ }),
},
upi_pm: {
PaymentIntent: getCustomExchange({
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
index 1ac275af0c..c88cfe6a54 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
@@ -549,6 +549,7 @@ export const CONNECTOR_LISTS = {
PAY_LATER: ["klarna", "adyen", "aci", "stripe"],
AUTH_SERVICE_ELIGIBILITY: ["stripe", "cybersource"],
PARTIAL_AUTH: ["nuvei", "checkout", "worldpay", "worldpayvantiv"],
+ USE_BILLING_AS_PAYMENT_METHOD_BILLING: ["bankofamerica"],
MIT_WITH_LIMITED_CARD_DATA: ["peachpayments"],
// Add more inclusion lists
},
diff --git a/cypress-tests/cypress/e2e/spec/Payment/47-UseBillingAsPaymentMethodBilling.cy.js b/cypress-tests/cypress/e2e/spec/Payment/47-UseBillingAsPaymentMethodBilling.cy.js
new file mode 100644
index 0000000000..578e0975aa
--- /dev/null
+++ b/cypress-tests/cypress/e2e/spec/Payment/47-UseBillingAsPaymentMethodBilling.cy.js
@@ -0,0 +1,133 @@
+import * as fixtures from "../../../fixtures/imports";
+import State from "../../../utils/State";
+import getConnectorDetails, {
+ CONNECTOR_LISTS,
+ shouldIncludeConnector,
+} from "../../configs/Payment/Utils";
+import * as utils from "../../configs/Payment/Utils";
+
+let globalState;
+
+describe("Card - Use Billing As Payment Method Billing", () => {
+ 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.USE_BILLING_AS_PAYMENT_METHOD_BILLING
+ )
+ ) {
+ skip = true;
+ return;
+ }
+ })
+ .then(() => {
+ if (skip) {
+ this.skip();
+ }
+ });
+ });
+
+ afterEach("flush global state", () => {
+ cy.task("setGlobalState", globalState.data);
+ });
+
+ context(
+ "Enable use_billing_as_payment_method_billing and create payment",
+ () => {
+ let shouldContinue = true;
+
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+
+ it("enable-use-billing-as-payment-method-billing", () => {
+ cy.UpdateBusinessProfileTest(
+ fixtures.businessProfile.bpUpdate,
+ false,
+ false,
+ false,
+ false,
+ false,
+ globalState,
+ "profile",
+ true
+ );
+ });
+
+ it("create-confirm-payment-with-billing-flag-enabled", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["UseBillingAsPaymentMethodBilling"];
+
+ cy.createConfirmPaymentTest(
+ fixtures.createConfirmPaymentBody,
+ data,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+
+ if (shouldContinue)
+ shouldContinue = utils.should_continue_further(data);
+ });
+
+ it("retrieve-payment-call-test", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["UseBillingAsPaymentMethodBilling"];
+
+ cy.retrievePaymentCallTest({ globalState, data });
+ });
+ }
+ );
+
+ context(
+ "Disable use_billing_as_payment_method_billing and create payment",
+ () => {
+ const shouldContinue = true;
+
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+
+ it("disable-use-billing-as-payment-method-billing", () => {
+ cy.UpdateBusinessProfileTest(
+ fixtures.businessProfile.bpUpdate,
+ false,
+ false,
+ false,
+ false,
+ false,
+ globalState,
+ "profile",
+ false
+ );
+ });
+
+ it("create-confirm-payment-with-billing-flag-disabled", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["UseBillingAsPaymentMethodBillingDisabled"];
+
+ cy.createConfirmPaymentTest(
+ fixtures.createConfirmPaymentBody,
+ data,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+ });
+ }
+ );
+});
diff --git a/cypress-tests/cypress/e2e/spec/Payment/47-DynamicFields.cy.js b/cypress-tests/cypress/e2e/spec/Payment/48-DynamicFields.cy.js
similarity index 100%
rename from cypress-tests/cypress/e2e/spec/Payment/47-DynamicFields.cy.js
rename to cypress-tests/cypress/e2e/spec/Payment/48-DynamicFields.cy.js
diff --git a/cypress-tests/cypress/e2e/spec/Payment/48-PaymentWebhook.cy.js b/cypress-tests/cypress/e2e/spec/Payment/49-PaymentWebhook.cy.js
similarity index 100%
rename from cypress-tests/cypress/e2e/spec/Payment/48-PaymentWebhook.cy.js
rename to cypress-tests/cypress/e2e/spec/Payment/49-PaymentWebhook.cy.js
diff --git a/cypress-tests/cypress/e2e/spec/Payment/49-RefundWebhook.cy.js b/cypress-tests/cypress/e2e/spec/Payment/50-RefundWebhook.cy.js
similarity index 100%
rename from cypress-tests/cypress/e2e/spec/Payment/49-RefundWebhook.cy.js
rename to cypress-tests/cypress/e2e/spec/Payment/50-RefundWebhook.cy.js
diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js
index 5d573c7861..b535875a0c 100644
--- a/cypress-tests/cypress/support/commands.js
+++ b/cypress-tests/cypress/support/commands.js
@@ -764,7 +764,8 @@ Cypress.Commands.add(
always_collect_billing_details_from_wallet_connector,
always_collect_shipping_details_from_wallet_connector,
globalState,
- profilePrefix = "profile"
+ profilePrefix = "profile",
+ use_billing_as_payment_method_billing = undefined
) => {
updateBusinessProfileBody.is_connector_agnostic_mit_enabled =
is_connector_agnostic_mit_enabled;
@@ -777,6 +778,11 @@ Cypress.Commands.add(
updateBusinessProfileBody.always_collect_shipping_details_from_wallet_connector =
always_collect_shipping_details_from_wallet_connector;
+ if (typeof use_billing_as_payment_method_billing !== "undefined") {
+ updateBusinessProfileBody.use_billing_as_payment_method_billing =
+ use_billing_as_payment_method_billing;
+ }
+
const apiKey = globalState.get("apiKey");
const merchantId = globalState.get("merchantId");
const profileId = globalState.get(`${profilePrefix}Id`);
@@ -812,6 +818,10 @@ Cypress.Commands.add(
"alwaysCollectShippingDetails",
response.body.always_collect_shipping_details_from_wallet_connector
);
+ globalState.set(
+ "useBillingAsPaymentMethodBilling",
+ response.body.use_billing_as_payment_method_billing
+ );
}
});
});