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

refactor(cypress): refactor auto and manual capture for payments(part1) (#11297)

CHALLA NISHANTH BABUc436d727e77a
diff --git a/cypress-tests/cypress/e2e/spec/Payment/00004-NoThreeDSAutoCapture.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00004-NoThreeDSAutoCapture.cy.js
index 78c23f4fe5..3ebee653cc 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/00004-NoThreeDSAutoCapture.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/00004-NoThreeDSAutoCapture.cy.js
@@ -16,132 +16,174 @@ describe("Card - NoThreeDS payment flow test", () => {
});
context("Card-NoThreeDS payment flow test Create and confirm", () => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
-
- beforeEach(function () {
- if (!shouldContinue) {
- this.skip();
- }
- });
-
- it("create-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PaymentIntent"];
-
- cy.createPaymentIntentTest(
- fixtures.createPaymentBody,
- data,
- "no_three_ds",
- "automatic",
- globalState
- );
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("payment_methods-call-test", () => {
- cy.paymentMethodsCallTest(globalState);
- });
-
- it("Confirm No 3DS", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["No3DSAutoCapture"];
-
- cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["No3DSAutoCapture"];
-
- cy.retrievePaymentCallTest({ globalState, data });
+ it("Create Payment Intent -> Payment Methods Call -> Confirm Payment -> Retrieve 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", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Confirm Payment");
+ 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", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Retrieve Payment");
+ return;
+ }
+ const confirmData = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["No3DSAutoCapture"];
+
+ cy.retrievePaymentCallTest({ globalState, data: confirmData });
+ });
});
});
context("Card-NoThreeDS payment flow test Create+Confirm", () => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
-
- beforeEach(function () {
- if (!shouldContinue) {
- this.skip();
- }
- });
-
- it("create+confirm-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["No3DSAutoCapture"];
-
- cy.createConfirmPaymentTest(
- fixtures.createConfirmPaymentBody,
- data,
- "no_three_ds",
- "automatic",
- globalState
- );
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["No3DSAutoCapture"];
-
- cy.retrievePaymentCallTest({ globalState, data });
+ it("Create and Confirm Payment -> Retrieve 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", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Retrieve Payment");
+ return;
+ }
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["No3DSAutoCapture"];
+
+ cy.retrievePaymentCallTest({ globalState, data });
+ });
});
});
context("Card-NoThreeDS payment with shipping cost", () => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
-
- beforeEach(function () {
- if (!shouldContinue) {
- this.skip();
- }
- });
-
- it("create-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PaymentIntentWithShippingCost"];
-
- cy.createPaymentIntentTest(
- fixtures.createPaymentBody,
- data,
- "no_three_ds",
- "automatic",
- globalState
- );
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("payment_methods-call-test", () => {
- cy.paymentMethodsCallTest(globalState);
- });
-
- it("Confirm No 3DS", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PaymentConfirmWithShippingCost"];
-
- cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PaymentConfirmWithShippingCost"];
-
- cy.retrievePaymentCallTest({ globalState, data });
+ it("Create Payment Intent with shipping cost -> Payment Methods Call -> Confirm Payment with shipping cost -> Retrieve Payment with shipping cost", () => {
+ let shouldContinue = true;
+
+ cy.step("Create Payment Intent with shipping cost", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentIntentWithShippingCost"];
+
+ 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 with shipping cost", () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Confirm Payment with shipping cost"
+ );
+ return;
+ }
+ const confirmData = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentConfirmWithShippingCost"];
+
+ cy.confirmCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
+
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Retrieve Payment with shipping cost", () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Retrieve Payment with shipping cost"
+ );
+ return;
+ }
+ const confirmData = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentConfirmWithShippingCost"];
+
+ cy.retrievePaymentCallTest({ globalState, data: confirmData });
+ });
});
});
});
diff --git a/cypress-tests/cypress/e2e/spec/Payment/00005-ThreeDSAutoCapture.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00005-ThreeDSAutoCapture.cy.js
index 715d423867..1a15ce2b37 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/00005-ThreeDSAutoCapture.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/00005-ThreeDSAutoCapture.cy.js
@@ -5,14 +5,6 @@ import getConnectorDetails, * as utils from "../../configs/Payment/Utils";
let globalState;
describe("Card - ThreeDS payment flow test", () => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
-
- beforeEach(function () {
- if (!shouldContinue) {
- this.skip();
- }
- });
-
before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);
@@ -23,38 +15,65 @@ describe("Card - ThreeDS payment flow test", () => {
cy.task("setGlobalState", globalState.data);
});
- it("create-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "PaymentIntent"
- ];
+ context("Card-ThreeDS payment flow test Create and Confirm", () => {
+ it("create payment intent -> payment methods call -> confirm payment intent -> handle redirection", () => {
+ let shouldContinue = true;
- cy.createPaymentIntentTest(
- fixtures.createPaymentBody,
- data,
- "three_ds",
- "automatic",
- globalState
- );
+ cy.step("create payment intent", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentIntent"];
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "three_ds",
+ "automatic",
+ globalState
+ );
- it("payment_methods-call-test", () => {
- cy.paymentMethodsCallTest(globalState);
- });
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
- it("Confirm 3DS", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "3DSAutoCapture"
- ];
+ cy.step("payment methods call", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: payment methods call");
+ return;
+ }
+ cy.paymentMethodsCallTest(globalState);
+ });
- cy.confirmCallTest(fixtures.confirmBody, data, true, 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"
+ ]["3DSAutoCapture"];
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
+ cy.confirmCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
- it("Handle redirection", () => {
- const expected_redirection = fixtures.confirmBody["return_url"];
- cy.handleRedirection(globalState, expected_redirection);
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("handle redirection", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: handle redirection");
+ return;
+ }
+ const expected_redirection = fixtures.confirmBody["return_url"];
+ cy.handleRedirection(globalState, expected_redirection);
+ });
+ });
});
});
diff --git a/cypress-tests/cypress/e2e/spec/Payment/00006-NoThreeDSManualCapture.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00006-NoThreeDSManualCapture.cy.js
index 7db395953b..1b181657c2 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/00006-NoThreeDSManualCapture.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/00006-NoThreeDSManualCapture.cy.js
@@ -15,144 +15,190 @@ describe("Card - NoThreeDS Manual payment flow test", () => {
cy.task("setGlobalState", globalState.data);
});
- context("Card - NoThreeDS Manual Full Capture payment flow test", () => {
- context("payment Create and Confirm", () => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
-
- beforeEach(function () {
- if (!shouldContinue) {
- this.skip();
- }
- });
+ context(
+ "Card - NoThreeDS Manual Full Capture payment flow test - Create and Confirm",
+ () => {
+ it("Create Payment Intent -> Payment Methods Call -> Confirm Payment Intent -> Retrieve Payment after Confirmation -> Capture Payment -> Retrieve Payment after Capture", () => {
+ let shouldContinue = true;
- it("create-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PaymentIntent"];
-
- cy.createPaymentIntentTest(
- fixtures.createPaymentBody,
- data,
- "no_three_ds",
- "manual",
- globalState
- );
-
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
- });
+ cy.step("Create Payment Intent", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentIntent"];
- it("payment_methods-call-test", () => {
- cy.paymentMethodsCallTest(globalState);
- });
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "no_three_ds",
+ "manual",
+ globalState
+ );
- it("confirm-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["No3DSManualCapture"];
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
- cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);
+ cy.step("Payment Methods Call", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Payment Methods Call");
+ return;
+ }
+ cy.paymentMethodsCallTest(globalState);
+ });
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
- });
+ 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"]["No3DSManualCapture"];
+
+ cy.confirmCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["No3DSManualCapture"];
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
- cy.retrievePaymentCallTest({ globalState, data });
- });
+ 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"]["No3DSManualCapture"];
- it("capture-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["Capture"];
+ cy.retrievePaymentCallTest({ globalState, data: confirmData });
- cy.captureCallTest(fixtures.captureBody, data, globalState);
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
- });
+ cy.step("Capture Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Capture Payment");
+ return;
+ }
+ const captureData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["Capture"];
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["Capture"];
+ cy.captureCallTest(fixtures.captureBody, captureData, globalState);
- cy.retrievePaymentCallTest({ globalState, data });
- });
- });
+ if (!utils.should_continue_further(captureData)) {
+ shouldContinue = false;
+ }
+ });
- context("Payment Create+Confirm", () => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
+ cy.step("Retrieve Payment after Capture", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Retrieve Payment after Capture");
+ return;
+ }
+ const captureData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["Capture"];
- beforeEach(function () {
- if (!shouldContinue) {
- this.skip();
- }
+ cy.retrievePaymentCallTest({ globalState, data: captureData });
+ });
});
+ }
+ );
- it("create+confirm-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["No3DSManualCapture"];
-
- cy.createConfirmPaymentTest(
- fixtures.createConfirmPaymentBody,
- data,
- "no_three_ds",
- "manual",
- globalState
- );
-
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
- });
+ context(
+ "Card - NoThreeDS Manual Full Capture payment flow test - Create+Confirm",
+ () => {
+ it("Create and Confirm Payment Intent -> Retrieve Payment after Confirmation -> Capture Payment -> Retrieve Payment after Capture", () => {
+ let shouldContinue = true;
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["No3DSManualCapture"];
+ cy.step("Create and Confirm Payment Intent", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["No3DSManualCapture"];
- cy.retrievePaymentCallTest({ globalState, data });
- });
+ cy.createConfirmPaymentTest(
+ fixtures.createConfirmPaymentBody,
+ data,
+ "no_three_ds",
+ "manual",
+ globalState
+ );
- it("capture-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["Capture"];
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
- cy.captureCallTest(fixtures.captureBody, data, globalState);
+ 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"
+ ]["No3DSManualCapture"];
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
- });
+ cy.retrievePaymentCallTest({ globalState, data });
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["Capture"];
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
- cy.retrievePaymentCallTest({ globalState, data });
- });
- });
- });
+ cy.step("Capture Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Capture Payment");
+ return;
+ }
+ const captureData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["Capture"];
- context(
- "Card - NoThreeDS Manual Partial Capture payment flow test - Create and Confirm",
- () => {
- context("payment Create and Payment Confirm", () => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
+ cy.captureCallTest(fixtures.captureBody, captureData, globalState);
- beforeEach(function () {
+ if (!utils.should_continue_further(captureData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Retrieve Payment after Capture", () => {
if (!shouldContinue) {
- this.skip();
+ cy.task("cli_log", "Skipping step: Retrieve Payment after Capture");
+ return;
}
+ const captureData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["Capture"];
+
+ cy.retrievePaymentCallTest({ globalState, data: captureData });
});
+ });
+ }
+ );
- it("create-payment-call-test", () => {
+ context(
+ "Card - NoThreeDS Manual Partial Capture payment flow test - Create and Confirm",
+ () => {
+ it("Create Payment Intent -> Payment Methods Call -> Confirm Payment Intent -> Retrieve Payment after Confirmation -> Partial Capture Payment -> Retrieve Payment after Partial Capture", () => {
+ let shouldContinue = true;
+
+ cy.step("Create Payment Intent", () => {
const data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["PaymentIntent"];
@@ -165,63 +211,104 @@ describe("Card - NoThreeDS Manual payment flow test", () => {
globalState
);
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
});
- it("payment_methods-call-test", () => {
+ cy.step("Payment Methods Call", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Payment Methods Call");
+ return;
+ }
cy.paymentMethodsCallTest(globalState);
});
- it("confirm-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["No3DSManualCapture"];
-
- cy.confirmCallTest(fixtures.confirmBody, data, true, 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"]["No3DSManualCapture"];
+
+ cy.confirmCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
});
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["No3DSManualCapture"];
+ 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"]["No3DSManualCapture"];
- cy.retrievePaymentCallTest({ globalState, data });
+ cy.retrievePaymentCallTest({ globalState, data: confirmData });
+
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
});
- it("capture-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PartialCapture"];
+ cy.step("Partial Capture Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Partial Capture Payment");
+ return;
+ }
+ const partialCaptureData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["PartialCapture"];
- cy.captureCallTest(fixtures.captureBody, data, globalState);
+ cy.captureCallTest(
+ fixtures.captureBody,
+ partialCaptureData,
+ globalState
+ );
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
+ if (!utils.should_continue_further(partialCaptureData)) {
+ shouldContinue = false;
+ }
});
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PartialCapture"];
+ cy.step("Retrieve Payment after Partial Capture", () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Retrieve Payment after Partial Capture"
+ );
+ return;
+ }
+ const partialCaptureData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["PartialCapture"];
- cy.retrievePaymentCallTest({ globalState, data });
+ cy.retrievePaymentCallTest({ globalState, data: partialCaptureData });
});
});
+ }
+ );
- context("payment + Confirm", () => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
-
- beforeEach(function () {
- if (!shouldContinue) {
- this.skip();
- }
- });
+ context(
+ "Card - NoThreeDS Manual Partial Capture payment flow test - Create+Confirm",
+ () => {
+ it("Create and Confirm Payment Intent -> Retrieve Payment after Confirmation -> Partial Capture Payment -> Retrieve Payment after Partial Capture", () => {
+ let shouldContinue = true;
- it("create+confirm-payment-call-test", () => {
+ cy.step("Create and Confirm Payment Intent", () => {
const data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["No3DSManualCapture"];
@@ -234,35 +321,63 @@ describe("Card - NoThreeDS Manual payment flow test", () => {
globalState
);
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
});
- it("retrieve-payment-call-test", () => {
+ 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"
]["No3DSManualCapture"];
cy.retrievePaymentCallTest({ globalState, data });
+
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
});
- it("capture-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PartialCapture"];
+ cy.step("Partial Capture Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Partial Capture Payment");
+ return;
+ }
+ const partialCaptureData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["PartialCapture"];
- cy.captureCallTest(fixtures.captureBody, data, globalState);
+ cy.captureCallTest(
+ fixtures.captureBody,
+ partialCaptureData,
+ globalState
+ );
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
+ if (!utils.should_continue_further(partialCaptureData)) {
+ shouldContinue = false;
+ }
});
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PartialCapture"];
+ cy.step("Retrieve Payment after Partial Capture", () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Retrieve Payment after Partial Capture"
+ );
+ return;
+ }
+ const partialCaptureData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["PartialCapture"];
- cy.retrievePaymentCallTest({ globalState, data });
+ cy.retrievePaymentCallTest({ globalState, data: partialCaptureData });
});
});
}
diff --git a/cypress-tests/cypress/e2e/spec/Payment/00007-VoidPayment.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00007-VoidPayment.cy.js
index bf5f8d1ed0..2b9442dd96 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/00007-VoidPayment.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/00007-VoidPayment.cy.js
@@ -16,74 +16,144 @@ describe("Card - NoThreeDS Manual payment flow test", () => {
});
context("Card - void payment in Requires_capture state flow test", () => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
+ it("Create Payment Intent -> Payment Methods Call -> Confirm Payment Intent -> Retrieve Payment after Confirmation -> Void Payment without Capture", () => {
+ let shouldContinue = true;
- beforeEach(function () {
- if (!shouldContinue) {
- this.skip();
- }
- });
+ cy.step("Create Payment Intent", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentIntent"];
- it("create-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PaymentIntent"];
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "no_three_ds",
+ "manual",
+ globalState
+ );
- cy.createPaymentIntentTest(
- fixtures.createPaymentBody,
- data,
- "no_three_ds",
- "manual",
- globalState
- );
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
+ cy.step("Payment Methods Call", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Payment Methods Call");
+ return;
+ }
+ cy.paymentMethodsCallTest(globalState);
+ });
- it("payment_methods-call-test", () => {
- 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"
+ ]["No3DSManualCapture"];
- it("confirm-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["No3DSManualCapture"];
+ cy.confirmCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
- cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
+ 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"
+ ]["No3DSManualCapture"];
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["No3DSManualCapture"];
+ cy.retrievePaymentCallTest({ globalState, data: confirmData });
- cy.retrievePaymentCallTest({ globalState, data });
- });
- it("void-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["VoidAfterConfirm"];
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
- cy.voidCallTest(fixtures.voidBody, data, globalState);
+ cy.step("Void Payment without Capture", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Void Payment without Capture");
+ return;
+ }
+ const voidData = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["VoidAfterConfirm"];
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
+ cy.voidCallTest(fixtures.voidBody, voidData, globalState);
+ });
});
});
context(
"Card - void payment in Requires_payment_method state flow test",
() => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
-
- beforeEach(function () {
- if (!shouldContinue) {
- this.skip();
- }
+ it("Create Payment Intent -> Payment Methods Call -> Void Payment without Confirmation", () => {
+ 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",
+ "manual",
+ 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("Void Payment without Confirmation", () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Void Payment without Confirmation"
+ );
+ return;
+ }
+ const voidData = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["Void"];
+
+ cy.voidCallTest(fixtures.voidBody, voidData, globalState);
+ });
});
+ }
+ );
+
+ context("Card - void payment in success state flow test", () => {
+ it("Create Payment Intent -> Payment Methods Call -> Confirm Payment Intent -> Retrieve Payment after Confirmation -> Void Payment after Confirmation", () => {
+ let shouldContinue = true;
- it("create-payment-call-test", () => {
+ cy.step("Create Payment Intent", () => {
const data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["PaymentIntent"];
@@ -96,81 +166,70 @@ describe("Card - NoThreeDS Manual payment flow test", () => {
globalState
);
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
});
- it("payment_methods-call-test", () => {
+ cy.step("Payment Methods Call", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Payment Methods Call");
+ return;
+ }
cy.paymentMethodsCallTest(globalState);
});
- it("void-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
+ 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"
- ]["Void"];
+ ]["No3DSManualCapture"];
- cy.voidCallTest(fixtures.voidBody, data, globalState);
+ cy.confirmCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ false,
+ globalState
+ );
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
});
- }
- );
-
- context("Card - void payment in success state flow test", () => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
-
- beforeEach(function () {
- if (!shouldContinue) {
- this.skip();
- }
- });
- it("create-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PaymentIntent"];
-
- cy.createPaymentIntentTest(
- fixtures.createPaymentBody,
- data,
- "no_three_ds",
- "manual",
- globalState
- );
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("payment_methods-call-test", () => {
- cy.paymentMethodsCallTest(globalState);
- });
-
- it("confirm-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["No3DSManualCapture"];
-
- cy.confirmCallTest(fixtures.confirmBody, data, false, globalState);
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
+ 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"
+ ]["No3DSManualCapture"];
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["No3DSManualCapture"];
+ cy.retrievePaymentCallTest({ globalState, data: confirmData });
- cy.retrievePaymentCallTest({ globalState, data });
- });
- it("void-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["VoidAfterConfirm"];
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
- cy.voidCallTest(fixtures.voidBody, data, globalState);
+ cy.step("Void Payment after Confirmation", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Void Payment after Confirmation");
+ return;
+ }
+ const voidData = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["VoidAfterConfirm"];
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
+ cy.voidCallTest(fixtures.voidBody, voidData, globalState);
+ });
});
});
});
diff --git a/cypress-tests/cypress/e2e/spec/Payment/00008-SyncPayment.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00008-SyncPayment.cy.js
index cb531871b7..8a72e725fb 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/00008-SyncPayment.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/00008-SyncPayment.cy.js
@@ -5,14 +5,6 @@ import getConnectorDetails, * as utils from "../../configs/Payment/Utils";
let globalState;
describe("Card - Sync payment flow test", () => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
-
- beforeEach(function () {
- if (!shouldContinue) {
- this.skip();
- }
- });
-
before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);
@@ -22,40 +14,72 @@ describe("Card - Sync payment flow test", () => {
after("flush global state", () => {
cy.task("setGlobalState", globalState.data);
});
- it("create-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "PaymentIntent"
- ];
-
- cy.createPaymentIntentTest(
- fixtures.createPaymentBody,
- data,
- "no_three_ds",
- "automatic",
- globalState
- );
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
- it("payment_methods-call-test", () => {
- cy.paymentMethodsCallTest(globalState);
- });
+ context("Card - Sync payment flow test", () => {
+ it("Create Payment Intent -> Payment Methods Call -> Confirm Payment Intent -> Retrieve Payment after Confirmation", () => {
+ let shouldContinue = true;
- it("confirm-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "No3DSAutoCapture"
- ];
+ cy.step("Create Payment Intent", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentIntent"];
- cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "No3DSAutoCapture"
- ];
- cy.retrievePaymentCallTest({ globalState, data });
+ 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 });
+ });
+ });
});
});
diff --git a/cypress-tests/cypress/e2e/spec/Payment/00016-ThreeDSManualCapture.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00016-ThreeDSManualCapture.cy.js
index e907bd6245..77080ed820 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/00016-ThreeDSManualCapture.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/00016-ThreeDSManualCapture.cy.js
@@ -15,155 +15,206 @@ describe("Card - ThreeDS Manual payment flow test", () => {
cy.task("setGlobalState", globalState.data);
});
- context("Card - ThreeDS Manual Full Capture payment flow test", () => {
- context("payment Create and Confirm", () => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
-
- beforeEach(function () {
- if (!shouldContinue) {
- this.skip();
- }
- });
+ context(
+ "Card - ThreeDS Manual Full Capture payment flow test - Create and Confirm",
+ () => {
+ it("Create Payment Intent -> Payment Methods Call -> Confirm Payment Intent -> handle redirection -> Retrieve Payment after Confirmation -> Capture Payment -> Retrieve Payment after Capture", () => {
+ let shouldContinue = true;
- it("create-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PaymentIntent"];
-
- cy.createPaymentIntentTest(
- fixtures.createPaymentBody,
- data,
- "three_ds",
- "manual",
- globalState
- );
-
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
- });
+ cy.step("Create Payment Intent", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentIntent"];
- it("payment_methods-call-test", () => {
- cy.paymentMethodsCallTest(globalState);
- });
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "three_ds",
+ "manual",
+ globalState
+ );
- it("confirm-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["3DSManualCapture"];
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
- cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);
+ cy.step("Payment Methods Call", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Payment Methods Call");
+ return;
+ }
+ cy.paymentMethodsCallTest(globalState);
+ });
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
- });
+ 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"]["3DSManualCapture"];
+
+ cy.confirmCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
- it("Handle redirection", () => {
- const expected_redirection = fixtures.confirmBody["return_url"];
- cy.handleRedirection(globalState, expected_redirection);
- });
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["3DSManualCapture"];
+ cy.step("handle redirection", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: handle redirection");
+ return;
+ }
+ const expected_redirection = fixtures.confirmBody["return_url"];
+ cy.handleRedirection(globalState, expected_redirection);
+ });
- cy.retrievePaymentCallTest({ globalState, data });
- });
+ 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"]["3DSManualCapture"];
- it("capture-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["Capture"];
+ cy.retrievePaymentCallTest({ globalState, data: confirmData });
- cy.captureCallTest(fixtures.captureBody, data, globalState);
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
- });
+ cy.step("Capture Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Capture Payment");
+ return;
+ }
+ const captureData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["Capture"];
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["Capture"];
+ cy.captureCallTest(fixtures.captureBody, captureData, globalState);
- cy.retrievePaymentCallTest({ globalState, data });
- });
- });
+ if (!utils.should_continue_further(captureData)) {
+ shouldContinue = false;
+ }
+ });
- context("Payment Create+Confirm", () => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
+ cy.step("Retrieve Payment after Capture", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Retrieve Payment after Capture");
+ return;
+ }
+ const captureData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["Capture"];
- beforeEach(function () {
- if (!shouldContinue) {
- this.skip();
- }
+ cy.retrievePaymentCallTest({ globalState, data: captureData });
+ });
});
+ }
+ );
- it("create+confirm-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["3DSManualCapture"];
-
- cy.createConfirmPaymentTest(
- fixtures.createConfirmPaymentBody,
- data,
- "three_ds",
- "manual",
- globalState
- );
-
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
- });
+ context(
+ "Card - ThreeDS Manual Full Capture payment flow test - Create+Confirm",
+ () => {
+ it("Create and Confirm Payment -> Handle Redirection -> Retrieve Payment -> Capture Payment -> Retrieve Payment after Capture", () => {
+ let shouldContinue = true;
- it("Handle redirection", () => {
- const expected_redirection =
- fixtures.createConfirmPaymentBody["return_url"];
- cy.handleRedirection(globalState, expected_redirection);
- });
+ cy.step("Create and Confirm Payment", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["3DSManualCapture"];
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["3DSManualCapture"];
+ cy.createConfirmPaymentTest(
+ fixtures.createConfirmPaymentBody,
+ data,
+ "three_ds",
+ "manual",
+ globalState
+ );
- cy.retrievePaymentCallTest({ globalState, data });
- });
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
- it("capture-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["Capture"];
+ cy.step("Handle Redirection", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Handle Redirection");
+ return;
+ }
+ const expected_redirection =
+ fixtures.createConfirmPaymentBody["return_url"];
+ cy.handleRedirection(globalState, expected_redirection);
+ });
- cy.captureCallTest(fixtures.captureBody, data, globalState);
+ cy.step("Retrieve Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Retrieve Payment");
+ return;
+ }
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["3DSManualCapture"];
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
- });
+ cy.retrievePaymentCallTest({ globalState, data });
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["Capture"];
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
- cy.retrievePaymentCallTest({ globalState, data });
- });
- });
- });
+ cy.step("Capture Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Capture Payment");
+ return;
+ }
+ const captureData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["Capture"];
- context(
- "Card - ThreeDS Manual Partial Capture payment flow test - Create and Confirm",
- () => {
- context("payment Create and Payment Confirm", () => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
+ cy.captureCallTest(fixtures.captureBody, captureData, globalState);
- beforeEach(function () {
+ if (!utils.should_continue_further(captureData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Retrieve Payment after Capture", () => {
if (!shouldContinue) {
- this.skip();
+ cy.task("cli_log", "Skipping step: Retrieve Payment after Capture");
+ return;
}
+ const captureData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["Capture"];
+
+ cy.retrievePaymentCallTest({ globalState, data: captureData });
});
+ });
+ }
+ );
- it("create-payment-call-test", () => {
+ context(
+ "Card - ThreeDS Manual Partial Capture payment flow test - Create and Confirm",
+ () => {
+ it("Create Payment Intent -> Payment Methods Call -> Confirm Payment Intent -> handle redirection -> Retrieve Payment after Confirmation -> Partial Capture Payment -> Retrieve Payment after Partial Capture", () => {
+ let shouldContinue = true;
+
+ cy.step("Create Payment Intent", () => {
const data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["PaymentIntent"];
@@ -176,68 +227,113 @@ describe("Card - ThreeDS Manual payment flow test", () => {
globalState
);
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
});
- it("payment_methods-call-test", () => {
+ cy.step("Payment Methods Call", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Payment Methods Call");
+ return;
+ }
cy.paymentMethodsCallTest(globalState);
});
- it("confirm-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["3DSManualCapture"];
-
- cy.confirmCallTest(fixtures.confirmBody, data, true, 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"]["3DSManualCapture"];
+
+ cy.confirmCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
});
- it("Handle redirection", () => {
+ cy.step("handle redirection", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: handle redirection");
+ return;
+ }
const expected_redirection = fixtures.confirmBody["return_url"];
cy.handleRedirection(globalState, expected_redirection);
});
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["3DSManualCapture"];
+ 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"]["3DSManualCapture"];
- cy.retrievePaymentCallTest({ globalState, data });
+ cy.retrievePaymentCallTest({ globalState, data: confirmData });
+
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
});
- it("capture-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PartialCapture"];
+ cy.step("Partial Capture Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Partial Capture Payment");
+ return;
+ }
+ const partialCaptureData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["PartialCapture"];
- cy.captureCallTest(fixtures.captureBody, data, globalState);
+ cy.captureCallTest(
+ fixtures.captureBody,
+ partialCaptureData,
+ globalState
+ );
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
+ if (!utils.should_continue_further(partialCaptureData)) {
+ shouldContinue = false;
+ }
});
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PartialCapture"];
+ cy.step("Retrieve Payment after Partial Capture", () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Retrieve Payment after Partial Capture"
+ );
+ return;
+ }
+ const partialCaptureData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["PartialCapture"];
- cy.retrievePaymentCallTest({ globalState, data });
+ cy.retrievePaymentCallTest({ globalState, data: partialCaptureData });
});
});
+ }
+ );
- context("payment + Confirm", () => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
-
- beforeEach(function () {
- if (!shouldContinue) {
- this.skip();
- }
- });
+ context(
+ "Card - ThreeDS Manual Partial Capture payment flow test - Create+Confirm",
+ () => {
+ it("Create and Confirm Payment -> handle redirection -> Retrieve Payment after Confirmation -> Partial Capture Payment -> Retrieve Payment after Partial Capture", () => {
+ let shouldContinue = true;
- it("create+confirm-payment-call-test", () => {
+ cy.step("Create and Confirm Payment", () => {
const data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["3DSManualCapture"];
@@ -250,41 +346,73 @@ describe("Card - ThreeDS Manual payment flow test", () => {
globalState
);
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
});
- it("Handle redirection", () => {
+ cy.step("handle redirection", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: handle redirection");
+ return;
+ }
const expected_redirection =
fixtures.createConfirmPaymentBody["return_url"];
cy.handleRedirection(globalState, expected_redirection);
});
- it("retrieve-payment-call-test", () => {
+ 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"
]["3DSManualCapture"];
cy.retrievePaymentCallTest({ globalState, data });
+
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
});
- it("capture-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PartialCapture"];
+ cy.step("Partial Capture Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Partial Capture Payment");
+ return;
+ }
+ const partialCaptureData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["PartialCapture"];
- cy.captureCallTest(fixtures.captureBody, data, globalState);
+ cy.captureCallTest(
+ fixtures.captureBody,
+ partialCaptureData,
+ globalState
+ );
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
+ if (!utils.should_continue_further(partialCaptureData)) {
+ shouldContinue = false;
+ }
});
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PartialCapture"];
+ cy.step("Retrieve Payment after Partial Capture", () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Retrieve Payment after Partial Capture"
+ );
+ return;
+ }
+ const partialCaptureData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["PartialCapture"];
- cy.retrievePaymentCallTest({ globalState, data });
+ cy.retrievePaymentCallTest({ globalState, data: partialCaptureData });
});
});
}
diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js
index ec545be93d..52c08172ba 100644
--- a/cypress-tests/cypress/support/commands.js
+++ b/cypress-tests/cypress/support/commands.js
@@ -5210,3 +5210,34 @@ Cypress.Commands.add("IncomingWebhookTest", (globalState, webhookPayload) => {
});
});
});
+
+Cypress.Commands.add("step", (stepName, fn) => {
+ cy.task("cli_log", `\nSTEP: ${stepName}`);
+
+ const log = Cypress.log({
+ name: "step",
+ displayName: "⬡ STEP",
+ message: `**${stepName}**`,
+ groupStart: true,
+ consoleProps: () => ({ Step: stepName }),
+ });
+
+ let failed = false;
+
+ try {
+ fn();
+ } catch (err) {
+ failed = true;
+ Cypress.log({ groupEnd: true, emitOnly: true });
+ throw err;
+ }
+
+ cy.then(() => {
+ if (failed) {
+ log.set({ displayName: "✗ STEP", message: stepName });
+ } else {
+ log.set({ displayName: "✓ STEP", message: stepName, collapsed: true });
+ }
+ Cypress.log({ groupEnd: true, emitOnly: true });
+ });
+});