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
test(cypress): add zero auth mandate coverage for manual capture (#13795)
HS-QUALIBOTc05c01f8f580
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Commons.js b/cypress-tests/cypress/e2e/configs/Payment/Commons.jsindex df28e0ac6b..123a9d5ddf 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Commons.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Commons.js@@ -2938,6 +2938,17 @@ export const connectorDetails = {customer_acceptance: customerAcceptance,},}),+ ZeroAuthConfirmPaymentManual: getCustomExchange({+ Request: {+ payment_type: "setup_mandate",+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ mandate_data: null,+ customer_acceptance: customerAcceptance,+ },+ }),SaveCardUseNo3DSAutoCapture: getCustomExchange({Request: {payment_method: "card",diff --git a/cypress-tests/cypress/e2e/configs/Payment/Peachpayments.js b/cypress-tests/cypress/e2e/configs/Payment/Peachpayments.jsindex 75d87f7505..558c1b1504 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Peachpayments.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Peachpayments.js@@ -358,6 +358,48 @@ export const connectorDetails = {},},},+ ZeroAuthConfirmPaymentManual: {+ Request: {+ payment_type: "setup_mandate",+ payment_method: "card",+ payment_method_type: "credit",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ mandate_data: null,+ customer_acceptance: customerAcceptance,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ setup_future_usage: "off_session",+ },+ },+ },+ MITManualCapture: {+ // Peach sandbox rejects the generic fixture card (4242424242424242) for+ // NTID MIT with "Server couldn't find that" / acquirer timeout; the+ // registered peach test card (same as the CIT card) succeeds and the+ // network_transaction_id is injected at runtime by mitUsingNTID.+ Request: {+ recurring_details: {+ type: "network_transaction_id_and_card_details",+ data: {+ card_number: "5200000000000015",+ card_exp_month: "01",+ card_exp_year: "28",+ card_holder_name: "John",+ },+ },+ },+ Response: {+ status: 200,+ body: {+ status: "requires_capture",+ },+ },+ },SaveCardUseNo3DSAutoCapture: {Configs: {TRIGGER_SKIP: true,diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.jsindex 8df29abe63..0b5d1be08d 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js@@ -828,6 +828,7 @@ export const CONNECTOR_LISTS = {CLIENT_SESSION_VALIDATION: ["stripe"],WEBHOOK_CONFIG: ["stripe"],REQUIRES_CVV: ["bankofamerica"],+ ZERO_AUTH_MANDATE: ["peachpayments"],BLOCK_IMPLICIT_CUSTOMER_CREATION: ["adyen"],// Add more inclusion lists},diff --git a/cypress-tests/cypress/e2e/spec/Payment/15-ZeroAuthMandate.cy.js b/cypress-tests/cypress/e2e/spec/Payment/15-ZeroAuthMandate.cy.jsindex 0f03a54b43..d84208f95e 100644--- a/cypress-tests/cypress/e2e/spec/Payment/15-ZeroAuthMandate.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/15-ZeroAuthMandate.cy.js@@ -288,4 +288,136 @@ describe("Card - SingleUse Mandates flow test", () => {cy.retrievePaymentCallTest({ globalState, data });});});++ context(+ "Card - Zero auth Mandate flow with Manual Capture Using NTID and Card Details (create + confirm)",+ () => {+ let shouldContinue = true;++ beforeEach(function () {+ if (!shouldContinue) {+ this.skip();+ }+ });++ it("Create Customer", function () {+ if (+ utils.shouldIncludeConnector(+ globalState.get("connectorId"),+ utils.CONNECTOR_LISTS.INCLUDE.ZERO_AUTH_MANDATE+ )+ ) {+ this.skip();+ }++ cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);+ });++ it("Confirm No 3DS CIT", function () {+ if (+ utils.shouldIncludeConnector(+ globalState.get("connectorId"),+ utils.CONNECTOR_LISTS.INCLUDE.ZERO_AUTH_MANDATE+ )+ ) {+ this.skip();+ }++ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["ZeroAuthConfirmPaymentManual"];++ cy.citForMandatesCallTest(+ fixtures.citConfirmBody,+ data,+ 0,+ true,+ "manual",+ "setup_mandate",+ globalState+ );++ if (shouldContinue)+ shouldContinue = utils.should_continue_further(data);+ });++ it("retrieve-payment-call-test", function () {+ if (+ utils.shouldIncludeConnector(+ globalState.get("connectorId"),+ utils.CONNECTOR_LISTS.INCLUDE.ZERO_AUTH_MANDATE+ )+ ) {+ this.skip();+ }++ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["ZeroAuthMandate"];++ cy.retrievePaymentCallTest({ globalState, data });+ });++ it("Confirm No 3DS MIT", function () {+ if (+ utils.shouldIncludeConnector(+ globalState.get("connectorId"),+ utils.CONNECTOR_LISTS.INCLUDE.ZERO_AUTH_MANDATE+ )+ ) {+ this.skip();+ }++ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["MITManualCapture"];++ cy.mitUsingNTID(+ fixtures.ntidConfirmBody,+ data,+ 6000,+ true,+ "manual",+ globalState+ );++ if (shouldContinue)+ shouldContinue = utils.should_continue_further(data);+ });++ it("mit-capture-call-test", function () {+ if (+ utils.shouldIncludeConnector(+ globalState.get("connectorId"),+ utils.CONNECTOR_LISTS.INCLUDE.ZERO_AUTH_MANDATE+ )+ ) {+ this.skip();+ }++ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["Capture"];++ cy.captureCallTest(fixtures.captureBody, data, globalState);+ });++ it("retrieve-payment-call-test", function () {+ if (+ utils.shouldIncludeConnector(+ globalState.get("connectorId"),+ utils.CONNECTOR_LISTS.INCLUDE.ZERO_AUTH_MANDATE+ )+ ) {+ this.skip();+ }++ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["Capture"];++ cy.retrievePaymentCallTest({ globalState, data });+ });+ }+ );});diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.jsindex 6a229e8e91..e489ebf156 100644--- a/cypress-tests/cypress/support/commands.js+++ b/cypress-tests/cypress/support/commands.js@@ -5553,7 +5553,9 @@ Cypress.Commands.add(response.body.setup_future_usage === "off_session" &&response.body.mandate_id === null &&response.body.status === "succeeded" &&- globalState.get("connectorId") !== "tsys_transit"+ globalState.get("connectorId") !== "peachpayments" &&+ globalState.get("connectorId") !== "tsys_transit" &&+ requestBody.mandate_data !== null) {expect(response.body.connector_mandate_id,@@ -6028,11 +6030,26 @@ Cypress.Commands.add(requestBody[key] = reqData[key];}+ const ntidFromCit = globalState.get("networkTransactionId");+ if (+ ntidFromCit &&+ requestBody.recurring_details?.type ===+ "network_transaction_id_and_card_details" &&+ typeof requestBody.recurring_details?.data === "object" &&+ requestBody.recurring_details.data !== null+ ) {+ requestBody.recurring_details.data.network_transaction_id = ntidFromCit;+ }+requestBody.amount = amount;requestBody.confirm = confirm;requestBody.capture_method = capture_method;requestBody.profile_id = profileId;+ // Keep paymentAmount in sync so retrievePaymentCallTest's amount assertion+ // matches the MIT payment (mirrors mitUsingPMId).+ globalState.set("paymentAmount", requestBody.amount);+const apiKey = globalState.get("apiKey");const baseUrl = globalState.get("baseUrl");const url = `${baseUrl}/payments`;