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 stripe error_on_requires_action coverage for MIT payments (#14495)

Vasanth35f1405fa57e
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Stripe.js b/cypress-tests/cypress/e2e/configs/Payment/Stripe.js
index 1387ce5e62..f572c733f1 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Stripe.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Stripe.js
@@ -808,6 +808,26 @@ export const connectorDetails = {
},
...commonConnectorDetails.card_pm.MITAutoCaptureWithCustomerAcceptance,
}),
+ // MIT payment with `error_on_requires_action` passed through
+ // connector_metadata. With a no-3DS saved card the payment succeeds
+ // normally; the flag only changes behaviour when the card would
+ // otherwise return `requires_action` (fail outright instead).
+ MITAutoCaptureWithErrorOnRequiresAction: {
+ Request: {
+ amount: 6000,
+ connector_metadata: {
+ stripe: {
+ error_on_requires_action: true,
+ },
+ },
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ },
+ },
+ },
MITManualCapture: {
Request: { amount: 6000 },
Response: {
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
index 5478e8148e..c665313a99 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
@@ -833,6 +833,7 @@ export const CONNECTOR_LISTS = {
AUTH_CODE: ["checkout", "worldpayxml"],
ZERO_AUTH_MANDATE: ["peachpayments"],
BLOCK_IMPLICIT_CUSTOMER_CREATION: ["adyen"],
+ ERROR_ON_REQUIRES_ACTION: ["stripe"],
// Add more inclusion lists
},
};
diff --git a/cypress-tests/cypress/e2e/spec/Payment/20-MandatesUsingPMID.cy.js b/cypress-tests/cypress/e2e/spec/Payment/20-MandatesUsingPMID.cy.js
index 0362d9e820..5c114c9c47 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/20-MandatesUsingPMID.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/20-MandatesUsingPMID.cy.js
@@ -874,4 +874,98 @@ describe("Card - Mandates using Payment Method Id flow test", () => {
});
}
);
+
+ context(
+ "Card - NoThreeDS CIT and MIT with error_on_requires_action (connector_metadata.stripe)",
+ function () {
+ before("skip connectors other than Stripe", function () {
+ // `connector_metadata.stripe.error_on_requires_action` is honoured
+ // only by the Stripe connector, so this context runs only for Stripe.
+ if (
+ utils.shouldIncludeConnector(
+ globalState.get("connectorId"),
+ utils.CONNECTOR_LISTS.INCLUDE.ERROR_ON_REQUIRES_ACTION
+ )
+ ) {
+ this.skip();
+ }
+ });
+
+ it("Confirm No 3DS CIT -> retrieve-payment-call-test -> Confirm MIT with error_on_requires_action -> retrieve-payment-call-test", () => {
+ let shouldContinue = true;
+
+ cy.step("Confirm No 3DS CIT", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentMethodIdMandateNo3DSAutoCapture"];
+
+ cy.citForMandatesCallTest(
+ fixtures.citConfirmBody,
+ data,
+ true,
+ "automatic",
+ "new_mandate",
+ globalState
+ );
+
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("retrieve-payment-call-test", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: retrieve-payment-call-test");
+ return;
+ }
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentMethodIdMandateNo3DSAutoCapture"];
+
+ cy.retrievePaymentCallTest({ globalState, data });
+
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Confirm MIT with error_on_requires_action", () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Confirm MIT with error_on_requires_action"
+ );
+ return;
+ }
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["MITAutoCaptureWithErrorOnRequiresAction"];
+
+ cy.mitUsingPMId(
+ fixtures.pmIdConfirmBody,
+ data,
+ true,
+ "automatic",
+ globalState
+ );
+
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("retrieve-payment-call-test", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: retrieve-payment-call-test");
+ return;
+ }
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["MITAutoCaptureWithErrorOnRequiresAction"];
+
+ cy.retrievePaymentCallTest({ globalState, data });
+ });
+ });
+ }
+ );
});