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
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
ci(cypress): Add MIT With Limited Card Data test suite for peachpayments (#11885)
HS-QUALIBOTe13bfa562fbe
diff --git a/cypress-tests-v2/package.json b/cypress-tests-v2/package.jsonindex 37a51db93c..03c2163808 100644--- a/cypress-tests-v2/package.json+++ b/cypress-tests-v2/package.json@@ -9,7 +9,8 @@"cypress:payments": "cypress run --headless --spec 'cypress/e2e/spec/Payment/**/*'","cypress:payouts": "cypress run --headless --spec 'cypress/e2e/spec/Payout/**/*'","cypress:payment-method-list": "cypress run --headless --spec 'cypress/e2e/spec/PaymentMethodList/**/*'",- "cypress:routing": "cypress run --headless --spec 'cypress/e2e/spec/Routing/**/*'"+ "cypress:routing": "cypress run --headless --spec 'cypress/e2e/spec/Routing/**/*'",+ "cypress:platform": "echo 'Platform specs not yet migrated to cypress-tests-v2; skipping'"},"author": "Hyperswitch Team","license": "ISC",diff --git a/cypress-tests/cypress/e2e/configs/Payment/Commons.js b/cypress-tests/cypress/e2e/configs/Payment/Commons.jsindex 83382588a2..642fbc991f 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Commons.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Commons.js@@ -1959,6 +1959,15 @@ export const connectorDetails = {},},}),+ MITWithLimitedCardData: getCustomExchange({+ Request: {},+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ }),PartnerMerchantIdentifier: getCustomExchange({Request: {currency: "USD",diff --git a/cypress-tests/cypress/e2e/configs/Payment/Peachpayments.js b/cypress-tests/cypress/e2e/configs/Payment/Peachpayments.jsindex b225804fd6..1ca1e162ff 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Peachpayments.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Peachpayments.js@@ -562,6 +562,15 @@ export const connectorDetails = {},},},+ MITWithLimitedCardData: {+ Request: {},+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },PaymentMethodIdMandateNo3DSAutoCapture: {Configs: {TRIGGER_SKIP: true,diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.jsindex 503f4511d3..2652ffa5ae 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js@@ -545,6 +545,7 @@ export const CONNECTOR_LISTS = {GIFT_CARD: ["adyen"],AUTH_SERVICE_ELIGIBILITY: ["stripe", "cybersource"],PARTIAL_AUTH: ["nuvei", "checkout", "worldpay", "worldpayvantiv"],+ MIT_WITH_LIMITED_CARD_DATA: ["peachpayments"],// Add more inclusion lists},};diff --git a/cypress-tests/cypress/e2e/spec/Payment/48-MITWithLimitedCardData.cy.js b/cypress-tests/cypress/e2e/spec/Payment/48-MITWithLimitedCardData.cy.jsnew file mode 100644index 0000000000..dfc5b92b1c--- /dev/null+++ b/cypress-tests/cypress/e2e/spec/Payment/48-MITWithLimitedCardData.cy.js@@ -0,0 +1,48 @@+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import getConnectorDetails, * as utils from "../../configs/Payment/Utils";++let globalState;+let connector;++describe("MIT with Limited Card Data", () => {+ before(function () {+ let skip = false;++ cy.task("getGlobalState")+ .then((state) => {+ globalState = new State(state);+ connector = globalState.get("connectorId");+ if (+ utils.shouldIncludeConnector(+ connector,+ utils.CONNECTOR_LISTS.INCLUDE.MIT_WITH_LIMITED_CARD_DATA+ )+ ) {+ skip = true;+ }+ })+ .then(() => {+ if (skip) {+ this.skip();+ }+ });+ });++ afterEach("flush global state", () => {+ cy.task("setGlobalState", globalState.data);+ });++ context("MIT with Limited Card Data - Auto Capture", () => {+ it("mit-card-limited-data-test", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["MITWithLimitedCardData"];+ cy.mitUsingCardWithLimitedData(+ fixtures.cardLimitedDataMITBody,+ data,+ globalState+ );+ });+ });+});diff --git a/cypress-tests/cypress/fixtures/create-card-limited-data-mit.json b/cypress-tests/cypress/fixtures/create-card-limited-data-mit.jsonnew file mode 100644index 0000000000..602d84f801--- /dev/null+++ b/cypress-tests/cypress/fixtures/create-card-limited-data-mit.json@@ -0,0 +1,29 @@+{+ "amount": 999,+ "currency": "USD",+ "confirm": true,+ "return_url": "https://example.com",+ "recurring_details": {+ "type": "card_with_limited_data",+ "data": {+ "card_number": "4242424242424242",+ "card_exp_month": "11",+ "card_exp_year": "2050",+ "card_holder_name": "John Doe",+ "eci": null+ }+ },+ "off_session": true,+ "billing": {+ "address": {+ "first_name": "John",+ "last_name": "Doe",+ "line1": "1467",+ "line2": "Harrison Street",+ "city": "San Fransico",+ "state": "California",+ "zip": "94122",+ "country": "US"+ }+ }+}diff --git a/cypress-tests/cypress/fixtures/imports.js b/cypress-tests/cypress/fixtures/imports.jsindex dd1d70fe27..c9639e0e3b 100644--- a/cypress-tests/cypress/fixtures/imports.js+++ b/cypress-tests/cypress/fixtures/imports.js@@ -26,6 +26,7 @@ import voidBody from "./void-payment-body.json";import ntidConfirmBody from "./create-ntid-mit.json";import blocklistCreateBody from "./blocklist-create-body.json";import disputeEvidenceBody from "./dispute-evidence-body.json";+import cardLimitedDataMITBody from "./create-card-limited-data-mit.json";import eligibilityCheckBody from "./eligibility-check-body.json";import * as IncomingWebhookBody from "./webhooks/import";import customerCreate from "./modularPmService/modularPmServiceCustomerCreate.json";@@ -41,6 +42,7 @@ export {blocklistCreateBody,businessProfile,captureBody,+ cardLimitedDataMITBody,citConfirmBody,configs,confirmBody,diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.jsindex 216e331d01..4f2a29d839 100644--- a/cypress-tests/cypress/support/commands.js+++ b/cypress-tests/cypress/support/commands.js@@ -7068,6 +7068,55 @@ Cypress.Commands.add("blocklistToggle", (status, globalState) => {});});+Cypress.Commands.add(+ "mitUsingCardWithLimitedData",+ (requestBody, data, globalState) => {+ const {+ Configs: configs = {},+ Request: reqData,+ Response: resData,+ } = data || {};+ const configInfo = execConfig(validateConfig(configs));+ const profileId = globalState.get(`${configInfo.profilePrefix}Id`);++ for (const key in reqData) {+ requestBody[key] = reqData[key];+ }++ requestBody.profile_id = profileId;++ const apiKey = globalState.get("apiKey");+ const baseUrl = globalState.get("baseUrl");++ cy.request({+ method: "POST",+ url: `${baseUrl}/payments`,+ headers: {+ "Content-Type": "application/json",+ "api-key": apiKey,+ },+ failOnStatusCode: false,+ body: requestBody,+ }).then((response) => {+ logRequestId(response.headers["x-request-id"]);++ cy.wrap(response).then(() => {+ if (response.status === 200) {+ expect(response.headers["content-type"]).to.include(+ "application/json"+ );+ globalState.set("paymentID", response.body.payment_id);+ for (const key in resData.body) {+ expect(resData.body[key], [key]).to.equal(response.body[key]);+ }+ } else {+ defaultErrorHandler(response, resData);+ }+ });+ });+ }+);+Cypress.Commands.add("assertNetworkTransactionId",(globalState, shouldExist = true) => {