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): PartnerMerchantIdentifier for adyen and checkout (#11928)

HS-QUALIBOT79b5f196d396
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Adyen.js b/cypress-tests/cypress/e2e/configs/Payment/Adyen.js
index 1d92d2c7be..9e72e34802 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Adyen.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Adyen.js
@@ -854,6 +854,70 @@ export const connectorDetails = {
},
},
},
+ PartnerMerchantIdentifier: {
+ Request: {
+ currency: "USD",
+ customer_acceptance: null,
+ setup_future_usage: "on_session",
+ billing: {
+ address: {
+ line1: "1467",
+ line2: "Harrison Street",
+ line3: "Harrison Street",
+ city: "San Francisco",
+ state: "California",
+ zip: "94122",
+ country: "US",
+ first_name: "joseph",
+ last_name: "Doe",
+ },
+ },
+ partner_merchant_identifier_details: {
+ partner_details: {
+ name: "TestPartner",
+ version: "1.0.0",
+ integrator: "TestIntegrator123",
+ },
+ merchant_details: {
+ name: "TestMerchantApp",
+ version: "2.0.0",
+ },
+ },
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ partner_merchant_identifier_details: {
+ partner_details: {
+ name: "TestPartner",
+ version: "1.0.0",
+ integrator: "TestIntegrator123",
+ },
+ merchant_details: {
+ name: "TestMerchantApp",
+ version: "2.0.0",
+ },
+ },
+ },
+ },
+ },
+ PartnerMerchantIdentifierConfirm: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ customer_acceptance: null,
+ setup_future_usage: "on_session",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ },
+ },
+ },
},
bank_transfer_pm: {
Pix: {
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Checkout.js b/cypress-tests/cypress/e2e/configs/Payment/Checkout.js
index 14b1488a36..f90bf3721a 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Checkout.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Checkout.js
@@ -713,5 +713,69 @@ export const connectorDetails = {
},
},
},
+ PartnerMerchantIdentifier: {
+ Request: {
+ currency: "USD",
+ customer_acceptance: null,
+ setup_future_usage: "on_session",
+ billing: {
+ address: {
+ line1: "1467",
+ line2: "Harrison Street",
+ line3: "Harrison Street",
+ city: "San Francisco",
+ state: "California",
+ zip: "94122",
+ country: "US",
+ first_name: "joseph",
+ last_name: "Doe",
+ },
+ },
+ partner_merchant_identifier_details: {
+ partner_details: {
+ name: "TestPartner",
+ version: "1.0.0",
+ integrator: "TestIntegrator123",
+ },
+ merchant_details: {
+ name: "TestMerchantApp",
+ version: "2.0.0",
+ },
+ },
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ partner_merchant_identifier_details: {
+ partner_details: {
+ name: "TestPartner",
+ version: "1.0.0",
+ integrator: "TestIntegrator123",
+ },
+ merchant_details: {
+ name: "TestMerchantApp",
+ version: "2.0.0",
+ },
+ },
+ },
+ },
+ },
+ PartnerMerchantIdentifierConfirm: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ customer_acceptance: null,
+ setup_future_usage: "on_session",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ },
+ },
+ },
},
};
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Commons.js b/cypress-tests/cypress/e2e/configs/Payment/Commons.js
index ffdd521a9a..e67833a7ad 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Commons.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Commons.js
@@ -1932,6 +1932,43 @@ export const connectorDetails = {
},
},
}),
+ PartnerMerchantIdentifier: getCustomExchange({
+ Request: {
+ currency: "USD",
+ customer_acceptance: null,
+ setup_future_usage: "on_session",
+ billing: {
+ address: {
+ line1: "1467",
+ line2: "Harrison Street",
+ line3: "Harrison Street",
+ city: "San Francisco",
+ state: "California",
+ zip: "94122",
+ country: "US",
+ first_name: "joseph",
+ last_name: "Doe",
+ },
+ },
+ partner_merchant_identifier_details: {
+ partner_details: {
+ name: "TestPartner",
+ version: "1.0.0",
+ integrator: "TestIntegrator123",
+ },
+ merchant_details: {
+ name: "TestMerchantApp",
+ version: "2.0.0",
+ },
+ },
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ },
+ },
+ }),
PaymentWithoutBilling: {
Request: {
currency: "USD",
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
index 354cf95a83..5fc3e4bc3b 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
@@ -541,6 +541,7 @@ export const CONNECTOR_LISTS = {
],
EXTERNAL_THREE_DS: ["stripe"],
BANK_DEBIT: ["novalnet"],
+ PARTNER_MERCHANT_IDENTIFIER: ["adyen", "checkout"],
// Add more inclusion lists
},
};
diff --git a/cypress-tests/cypress/e2e/spec/Payment/43-PartnerMerchantIdentifier.cy.js b/cypress-tests/cypress/e2e/spec/Payment/43-PartnerMerchantIdentifier.cy.js
new file mode 100644
index 0000000000..d81f7d2180
--- /dev/null
+++ b/cypress-tests/cypress/e2e/spec/Payment/43-PartnerMerchantIdentifier.cy.js
@@ -0,0 +1,290 @@
+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;
+let connector;
+
+describe("Partner Merchant Identifier Tests", () => {
+ before("seed global state", function () {
+ let skip = false;
+
+ cy.task("getGlobalState")
+ .then((state) => {
+ globalState = new State(state);
+ connector = globalState.get("connectorId");
+
+ if (
+ shouldIncludeConnector(
+ connector,
+ CONNECTOR_LISTS.INCLUDE.PARTNER_MERCHANT_IDENTIFIER
+ )
+ ) {
+ skip = true;
+ return;
+ }
+ })
+ .then(() => {
+ if (skip) {
+ this.skip();
+ }
+ });
+ });
+
+ after("flush global state", () => {
+ cy.task("setGlobalState", globalState.data);
+ });
+
+ context("Partner Merchant Identifier - Happy Path", () => {
+ it("Create Payment Intent -> Confirm Payment -> Retrieve Payment", () => {
+ let shouldContinue = true;
+
+ cy.step("Create Payment Intent with Partner Merchant Identifier", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PartnerMerchantIdentifier"];
+
+ const requestBody = { ...fixtures.createPaymentBody };
+ cy.createPaymentIntentTest(
+ requestBody,
+ data,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Confirm Payment with Partner Merchant Identifier", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Confirm Payment with PMI");
+ return;
+ }
+
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PartnerMerchantIdentifierConfirm"];
+
+ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);
+
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step(
+ "Retrieve Payment to verify persisted Partner Merchant Identifier",
+ () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Retrieve Payment to verify persisted PMI"
+ );
+ return;
+ }
+
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PartnerMerchantIdentifier"];
+
+ cy.retrievePaymentCallTest({ globalState, data });
+ }
+ );
+ });
+ });
+
+ context("Partner Merchant Identifier - Negative Cases", () => {
+ it("Create Payment Intent -> Confirm Payment -> Retrieve Payment (without PMI)", () => {
+ let shouldContinue = true;
+
+ cy.step(
+ "Create Payment Intent without Partner Merchant Identifier",
+ () => {
+ const baseData = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentIntent"];
+
+ const data = {
+ ...baseData,
+ Request: {
+ ...baseData.Request,
+ billing: {
+ address: {
+ line1: "1467",
+ line2: "Harrison Street",
+ line3: "Harrison Street",
+ city: "San Francisco",
+ state: "California",
+ zip: "94122",
+ country: "US",
+ first_name: "joseph",
+ last_name: "Doe",
+ },
+ },
+ },
+ };
+
+ const requestBody = { ...fixtures.createPaymentBody };
+ cy.createPaymentIntentTest(
+ requestBody,
+ data,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ }
+ );
+
+ cy.step("Confirm Payment without Partner Merchant Identifier", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Confirm Payment without PMI");
+ return;
+ }
+
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PartnerMerchantIdentifierConfirm"];
+
+ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);
+ });
+
+ cy.step(
+ "Retrieve Payment to verify no Partner Merchant Identifier present",
+ () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Retrieve Payment to verify no PMI present"
+ );
+ return;
+ }
+
+ const baseData = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentIntent"];
+
+ const data = {
+ ...baseData,
+ Request: {
+ ...baseData.Request,
+ billing: {
+ address: {
+ line1: "1467",
+ line2: "Harrison Street",
+ line3: "Harrison Street",
+ city: "San Francisco",
+ state: "California",
+ zip: "94122",
+ country: "US",
+ first_name: "joseph",
+ last_name: "Doe",
+ },
+ },
+ },
+ };
+
+ cy.retrievePaymentCallTest({ globalState, data });
+ }
+ );
+ });
+ });
+
+ context("Partner Merchant Identifier - Edge Cases", () => {
+ it("Create Payment Intent -> Confirm Payment -> Retrieve Payment (with empty PMI)", () => {
+ let shouldContinue = true;
+
+ cy.step(
+ "Create Payment Intent with empty partner merchant identifier details",
+ () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PartnerMerchantIdentifier"];
+
+ const modifiedData = {
+ ...data,
+ Request: {
+ ...data.Request,
+ partner_merchant_identifier_details: {},
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ },
+ },
+ };
+
+ const requestBody = { ...fixtures.createPaymentBody };
+ cy.createPaymentIntentTest(
+ requestBody,
+ modifiedData,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+
+ if (!utils.should_continue_further(modifiedData)) {
+ shouldContinue = false;
+ }
+ }
+ );
+
+ cy.step(
+ "Confirm Payment with empty partner merchant identifier details",
+ () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Confirm Payment with empty PMI");
+ return;
+ }
+
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PartnerMerchantIdentifierConfirm"];
+
+ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);
+ }
+ );
+
+ cy.step(
+ "Verify empty partner_merchant_identifier_details returns nulls",
+ () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Verify empty PMI returns nulls");
+ return;
+ }
+
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PartnerMerchantIdentifier"];
+
+ const modifiedData = {
+ ...data,
+ Request: {
+ ...data.Request,
+ partner_merchant_identifier_details: {},
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ },
+ },
+ };
+
+ cy.retrievePaymentCallTest({ globalState, data: modifiedData });
+ }
+ );
+ });
+ });
+});
diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js
index 23a99b72ac..ae83fd3e09 100644
--- a/cypress-tests/cypress/support/commands.js
+++ b/cypress-tests/cypress/support/commands.js
@@ -1971,10 +1971,20 @@ Cypress.Commands.add(
);
cy.log(clientSecret);
for (const key in resData.body) {
- expect(resData.body[key]).to.equal(
- response.body[key],
- `Expected ${resData.body[key]} but got ${response.body[key]}`
- );
+ if (
+ typeof resData.body[key] === "object" &&
+ resData.body[key] !== null
+ ) {
+ expect(
+ response.body[key],
+ `Expected ${key} to deep equal`
+ ).to.deep.eq(resData.body[key]);
+ } else {
+ expect(resData.body[key]).to.equal(
+ response.body[key],
+ `Expected ${resData.body[key]} but got ${response.body[key]}`
+ );
+ }
}
expect(response.body.payment_id, "payment_id").to.not.be.null;
expect(response.body.merchant_id, "merchant_id").to.not.be.null;