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 billing-name fallback coverage for worldpayxml (#14738)

HS-QUALIBOTac98239d521c
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
index 67ffe80333..b9bab1a955 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
@@ -613,6 +613,7 @@ export const CONNECTOR_LISTS = {
// "stripe",
],
DDC_RACE_CONDITION: ["worldpay"],
+ CARD_HOLDER_NAME_BILLING_FALLBACK: ["worldpayxml"],
VOID_PAYMENT_SYNC: ["zift"],
CONNECTOR_TESTING_DATA: ["adyen", "airwallex", "braintree", "noon"],
// ucs connectors
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Worldpayxml.js b/cypress-tests/cypress/e2e/configs/Payment/Worldpayxml.js
index 05ebd5f17f..f08753e745 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Worldpayxml.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Worldpayxml.js
@@ -20,6 +20,13 @@ const failedNo3DSCardDetails = {
card_holder_name: "REFUSED33",
};
+const noCardHolderNameCardDetails = {
+ card_number: successfulNo3DSCardDetails.card_number,
+ card_exp_month: successfulNo3DSCardDetails.card_exp_month,
+ card_exp_year: successfulNo3DSCardDetails.card_exp_year,
+ card_cvc: successfulNo3DSCardDetails.card_cvc,
+};
+
export const connectorDetails = {
card_pm: {
PaymentIntent: {
@@ -170,6 +177,79 @@ export const connectorDetails = {
},
},
},
+ CardHolderNameFallbackToBilling: {
+ Request: {
+ payment_method: "card",
+ payment_method_type: "debit",
+ amount: 6000,
+ payment_method_data: {
+ card: noCardHolderNameCardDetails,
+ },
+ billing: {
+ address: {
+ line1: "1467",
+ line2: "Harrison Street",
+ line3: "Harrison Street",
+ city: "San Fransico",
+ state: "California",
+ zip: "94122",
+ country: "US",
+ first_name: "Sakil",
+ last_name: "Mostak",
+ },
+ },
+ currency: "USD",
+ customer_acceptance: null,
+ setup_future_usage: "on_session",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ amount_received: 6000,
+ },
+ },
+ },
+ // Negative counterpart to CardHolderNameFallbackToBilling: with no
+ // card_holder_name AND no billing name to fall back to, the connector
+ // errors instead of silently sending a nameless card. This is what
+ // actually distinguishes "fallback to billing name worked" from "the
+ // connector accepts a missing cardholder name anyway" in the success
+ // case above, since that success alone can't tell the two apart.
+ CardHolderNameMissingBoth: {
+ Request: {
+ payment_method: "card",
+ payment_method_type: "debit",
+ amount: 6000,
+ payment_method_data: {
+ card: noCardHolderNameCardDetails,
+ },
+ billing: {
+ address: {
+ line1: "1467",
+ line2: "Harrison Street",
+ line3: "Harrison Street",
+ city: "San Fransico",
+ state: "California",
+ zip: "94122",
+ country: "US",
+ },
+ },
+ currency: "USD",
+ customer_acceptance: null,
+ setup_future_usage: "on_session",
+ },
+ Response: {
+ status: 400,
+ body: {
+ error: {
+ type: "invalid_request",
+ message: "Missing required param: card_holder_name",
+ code: "IR_04",
+ },
+ },
+ },
+ },
Capture: {
Request: {
amount_to_capture: 6000,
diff --git a/cypress-tests/cypress/e2e/spec/Payment/54-CardHolderNameBillingFallback.cy.js b/cypress-tests/cypress/e2e/spec/Payment/54-CardHolderNameBillingFallback.cy.js
new file mode 100644
index 0000000000..786f242557
--- /dev/null
+++ b/cypress-tests/cypress/e2e/spec/Payment/54-CardHolderNameBillingFallback.cy.js
@@ -0,0 +1,90 @@
+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 - Fall back to billing name when cardholder name is absent", () => {
+ 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.CARD_HOLDER_NAME_BILLING_FALLBACK
+ )
+ ) {
+ skip = true;
+ return;
+ }
+ })
+ .then(() => {
+ if (skip) {
+ this.skip();
+ }
+ });
+ });
+
+ afterEach("flush global state", () => {
+ cy.task("setGlobalState", globalState.data);
+ });
+
+ context(
+ "Card-NoThreeDS payment without card_holder_name falls back to billing name",
+ () => {
+ it("create-confirm-payment-without-card-holder-name", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["CardHolderNameFallbackToBilling"];
+
+ cy.createConfirmPaymentTest(
+ fixtures.createConfirmPaymentBody,
+ data,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+
+ utils.should_continue_further(data);
+ });
+
+ it("retrieve-payment-call-test", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["CardHolderNameFallbackToBilling"];
+
+ cy.retrievePaymentCallTest({ globalState, data });
+ });
+ }
+ );
+
+ context(
+ "Card-NoThreeDS payment without card_holder_name and without a billing name to fall back to fails",
+ () => {
+ it("create-confirm-payment-without-any-cardholder-name", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["CardHolderNameMissingBoth"];
+
+ cy.createConfirmPaymentTest(
+ fixtures.createConfirmPaymentBody,
+ data,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+
+ utils.should_continue_further(data);
+ });
+ }
+ );
+});
diff --git a/cypress-tests/cypress/utils/specSelection/config.js b/cypress-tests/cypress/utils/specSelection/config.js
index bf5f2b5a04..9407b43837 100644
--- a/cypress-tests/cypress/utils/specSelection/config.js
+++ b/cypress-tests/cypress/utils/specSelection/config.js
@@ -179,6 +179,7 @@ const PAYMENT_SPEC_METHODS = Object.freeze({
"56-VaultTokenizationDisable.cy.js": ["card"],
"54-OfferEngine.cy.js": ["card"],
"54-ConnectorAgnosticMandates.cy.js": ["card"],
+ "54-CardHolderNameBillingFallback.cy.js": ["card"],
});
/**