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 Refund Type coverage for stripe (#12533)

HS-QUALIBOT6b38224a2ce5
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Adyen.js b/cypress-tests/cypress/e2e/configs/Payment/Adyen.js
index 313ca88b1f..10f487ed27 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Adyen.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Adyen.js
@@ -417,6 +417,38 @@ export const connectorDetails = {
},
},
},
+ SyncRefundScheduled: {
+ Response: {
+ status: 200,
+ body: {
+ status: "pending",
+ },
+ },
+ },
+ RefundInstant: {
+ Request: {
+ amount: 6000,
+ refund_type: "instant",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "pending",
+ },
+ },
+ },
+ RefundScheduled: {
+ Request: {
+ amount: 6000,
+ refund_type: "scheduled",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "pending",
+ },
+ },
+ },
ExtendAuthorizationNo3DSManual: {
Request: {
extended_authorization_days: 7,
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Checkout.js b/cypress-tests/cypress/e2e/configs/Payment/Checkout.js
index 76779859fa..efada18edc 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Checkout.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Checkout.js
@@ -379,6 +379,14 @@ export const connectorDetails = {
},
},
},
+ SyncRefundScheduled: {
+ Response: {
+ status: 200,
+ body: {
+ status: "pending",
+ },
+ },
+ },
ZeroAuthMandate: {
Response: {
status: 200,
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Commons.js b/cypress-tests/cypress/e2e/configs/Payment/Commons.js
index ee553c5cda..e6bff72c64 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Commons.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Commons.js
@@ -1622,6 +1622,7 @@ export const connectorDetails = {
},
}),
SyncRefund: getCustomExchange({}),
+ SyncRefundScheduled: getCustomExchange({}),
},
real_time_payment_pm: {
PaymentIntent: getCustomExchange({
@@ -2085,6 +2086,31 @@ export const connectorDetails = {
},
}),
SyncRefund: getCustomExchange({}),
+ SyncRefundScheduled: getCustomExchange({}),
+ RefundInstant: getCustomExchange({
+ Request: {
+ amount: 6000,
+ refund_type: "instant",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ },
+ },
+ }),
+ RefundScheduled: getCustomExchange({
+ Request: {
+ amount: 6000,
+ refund_type: "scheduled",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "pending",
+ },
+ },
+ }),
PartialAuth: getCustomExchange({
Request: {
enable_partial_authorization: true,
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Stripe.js b/cypress-tests/cypress/e2e/configs/Payment/Stripe.js
index 20070e5a3b..4047fd1a2d 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Stripe.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Stripe.js
@@ -398,6 +398,14 @@ export const connectorDetails = {
},
},
},
+ SyncRefundScheduled: {
+ Response: {
+ status: 200,
+ body: {
+ status: "pending",
+ },
+ },
+ },
// IncrementalAuth: { // commenting out due to credentials issue
// Request: {
// amount: 8000,
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
index f798740a9b..3f256762a5 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
@@ -623,6 +623,7 @@ export const CONNECTOR_LISTS = {
CLEAR_PAN_RETRY: ["bankofamerica"],
L2L3DATA: ["checkout", "nuvei", "worldpayvantiv"],
REFUND_MANUAL_UPDATE: ["bankofamerica", "cybersource"],
+ REFUND_TYPE: ["stripe", "adyen", "checkout"],
MANUAL_PAYMENT_UPDATE: ["stripe"],
STEP_UP_RETRY: [
"cybersource",
diff --git a/cypress-tests/cypress/e2e/spec/Payment/54-RefundType.cy.js b/cypress-tests/cypress/e2e/spec/Payment/54-RefundType.cy.js
new file mode 100644
index 0000000000..d1c084bade
--- /dev/null
+++ b/cypress-tests/cypress/e2e/spec/Payment/54-RefundType.cy.js
@@ -0,0 +1,380 @@
+import * as fixtures from "../../../fixtures/imports";
+import State from "../../../utils/State";
+import getConnectorDetails, * as utils from "../../configs/Payment/Utils";
+
+let globalState;
+
+describe("Card - Refund Type (instant/scheduled) flow - No 3DS", () => {
+ let shouldContinue = true;
+
+ before("seed global state", () => {
+ cy.task("getGlobalState").then((state) => {
+ globalState = new State(state);
+ if (
+ !utils.CONNECTOR_LISTS.INCLUDE.REFUND_TYPE.includes(
+ globalState.get("connectorId")
+ )
+ ) {
+ shouldContinue = false;
+ }
+ });
+ });
+
+ afterEach("flush global state", () => {
+ cy.task("setGlobalState", globalState.data);
+ });
+
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+
+ context("Card - Instant Refund Type flow test for No-3DS", () => {
+ it("Create Payment Intent -> Payment Methods Call -> Confirm Payment Intent -> Retrieve Payment after Confirmation -> Refund with Instant Type -> Sync Refund Payment", () => {
+ let shouldContinue = true;
+
+ cy.step("Create Payment Intent", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentIntent"];
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Payment Methods Call", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Payment Methods Call");
+ return;
+ }
+ cy.paymentMethodsCallTest(globalState);
+ });
+
+ cy.step("Confirm Payment Intent", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Confirm Payment Intent");
+ return;
+ }
+ const confirmData = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["No3DSAutoCapture"];
+ cy.confirmCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Retrieve Payment after Confirmation", () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Retrieve Payment after Confirmation"
+ );
+ return;
+ }
+ const confirmData = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["No3DSAutoCapture"];
+ cy.retrievePaymentCallTest({ globalState, data: confirmData });
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Refund with Instant Type", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Refund with Instant Type");
+ return;
+ }
+ const refundData = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["RefundInstant"];
+ const newRefundData = {
+ ...refundData,
+ Response: refundData.ResponseCustom || refundData.Response,
+ };
+ cy.refundCallTest(fixtures.refundBody, newRefundData, globalState);
+ if (!utils.should_continue_further(newRefundData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Sync Refund Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Sync Refund Payment");
+ return;
+ }
+ const syncRefundData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["SyncRefund"];
+ const newData = {
+ ...syncRefundData,
+ Response: syncRefundData.ResponseCustom || syncRefundData.Response,
+ };
+ cy.syncRefundCallTest(newData, globalState);
+ });
+ });
+ });
+
+ context("Card - Scheduled Refund Type flow test for No-3DS", () => {
+ it("Create Payment Intent -> Payment Methods Call -> Confirm Payment Intent -> Retrieve Payment after Confirmation -> Refund with Scheduled Type -> Sync Refund Payment", () => {
+ let shouldContinue = true;
+
+ cy.step("Create Payment Intent", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentIntent"];
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Payment Methods Call", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Payment Methods Call");
+ return;
+ }
+ cy.paymentMethodsCallTest(globalState);
+ });
+
+ cy.step("Confirm Payment Intent", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Confirm Payment Intent");
+ return;
+ }
+ const confirmData = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["No3DSAutoCapture"];
+ cy.confirmCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Retrieve Payment after Confirmation", () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Retrieve Payment after Confirmation"
+ );
+ return;
+ }
+ const confirmData = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["No3DSAutoCapture"];
+ cy.retrievePaymentCallTest({ globalState, data: confirmData });
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Refund with Scheduled Type", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Refund with Scheduled Type");
+ return;
+ }
+ const refundData = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["RefundScheduled"];
+ const newRefundData = {
+ ...refundData,
+ Response: refundData.ResponseCustom || refundData.Response,
+ };
+ cy.refundCallTest(fixtures.refundBody, newRefundData, globalState);
+ if (!utils.should_continue_further(newRefundData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Sync Refund Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Sync Refund Payment");
+ return;
+ }
+ const syncRefundData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["SyncRefundScheduled"];
+ const newData = {
+ ...syncRefundData,
+ Response: syncRefundData.ResponseCustom || syncRefundData.Response,
+ };
+ cy.syncRefundCallTest(newData, globalState);
+ });
+ });
+ });
+
+ context(
+ "Card - Instant Refund Type flow test Create+Confirm for No-3DS",
+ () => {
+ it("Create and Confirm Payment -> Retrieve Payment after Confirmation -> Refund with Instant Type -> Sync Refund Payment", () => {
+ let shouldContinue = true;
+
+ cy.step("Create and Confirm Payment", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["No3DSAutoCapture"];
+ cy.createConfirmPaymentTest(
+ fixtures.createConfirmPaymentBody,
+ data,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Retrieve Payment after Confirmation", () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Retrieve Payment after Confirmation"
+ );
+ return;
+ }
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["No3DSAutoCapture"];
+ cy.retrievePaymentCallTest({ globalState, data });
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Refund with Instant Type", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Refund with Instant Type");
+ return;
+ }
+ const refundData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["RefundInstant"];
+ const newRefundData = {
+ ...refundData,
+ Response: refundData.ResponseCustom || refundData.Response,
+ };
+ cy.refundCallTest(fixtures.refundBody, newRefundData, globalState);
+ if (!utils.should_continue_further(newRefundData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Sync Refund Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Sync Refund Payment");
+ return;
+ }
+ const syncRefundData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["SyncRefund"];
+ const newData = {
+ ...syncRefundData,
+ Response: syncRefundData.ResponseCustom || syncRefundData.Response,
+ };
+ cy.syncRefundCallTest(newData, globalState);
+ });
+ });
+ }
+ );
+
+ context(
+ "Card - Scheduled Refund Type flow test Create+Confirm for No-3DS",
+ () => {
+ it("Create and Confirm Payment -> Retrieve Payment after Confirmation -> Refund with Scheduled Type -> Sync Refund Payment", () => {
+ let shouldContinue = true;
+
+ cy.step("Create and Confirm Payment", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["No3DSAutoCapture"];
+ cy.createConfirmPaymentTest(
+ fixtures.createConfirmPaymentBody,
+ data,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Retrieve Payment after Confirmation", () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Retrieve Payment after Confirmation"
+ );
+ return;
+ }
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["No3DSAutoCapture"];
+ cy.retrievePaymentCallTest({ globalState, data });
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Refund with Scheduled Type", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Refund with Scheduled Type");
+ return;
+ }
+ const refundData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["RefundScheduled"];
+ const newRefundData = {
+ ...refundData,
+ Response: refundData.ResponseCustom || refundData.Response,
+ };
+ cy.refundCallTest(fixtures.refundBody, newRefundData, globalState);
+ if (!utils.should_continue_further(newRefundData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Sync Refund Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Sync Refund Payment");
+ return;
+ }
+ const syncRefundData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["SyncRefundScheduled"];
+ const newData = {
+ ...syncRefundData,
+ Response: syncRefundData.ResponseCustom || syncRefundData.Response,
+ };
+ cy.syncRefundCallTest(newData, globalState);
+ });
+ });
+ }
+ );
+});
diff --git a/cypress-tests/cypress/e2e/spec/Payment/54-DynamicFields.cy.js b/cypress-tests/cypress/e2e/spec/Payment/55-DynamicFields.cy.js
similarity index 100%
rename from cypress-tests/cypress/e2e/spec/Payment/54-DynamicFields.cy.js
rename to cypress-tests/cypress/e2e/spec/Payment/55-DynamicFields.cy.js