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): add refactoring of refunds and bank redirects tests (#11312)

CHALLA NISHANTH BABU1b15bb3150d0
diff --git a/cypress-tests/cypress/e2e/spec/Payment/00009-RefundPayment.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00009-RefundPayment.cy.js
index 610893b2db..9f4e4e2dde 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/00009-RefundPayment.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/00009-RefundPayment.cy.js
@@ -16,754 +16,1018 @@ describe("Card - Refund flow - No 3DS", () => {
});
context("Card - Full Refund flow test for No-3DS", () => {
- 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 -> Refund Payment -> Sync Refund Payment", () => {
+ let shouldContinue = true;
- 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-call-test", () => {
- 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("refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["Refund"];
+ 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.refundCallTest(fixtures.refundBody, data, 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"
+ ]["No3DSAutoCapture"];
+ cy.confirmCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
- it("sync-refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["SyncRefund"];
+ 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.syncRefundCallTest(data, globalState);
+ cy.step("Refund Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Refund Payment");
+ return;
+ }
+ const refundData = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["Refund"];
+ cy.refundCallTest(fixtures.refundBody, refundData, globalState);
+ if (!utils.should_continue_further(refundData)) {
+ shouldContinue = false;
+ }
+ });
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
+ 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"];
+ cy.syncRefundCallTest(syncRefundData, globalState);
+ });
});
});
context("Card - Partial Refund flow test for No-3DS", () => {
- 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-call-test", () => {
- 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("Create Payment Intent -> Payment Methods Call -> Confirm Payment Intent -> Retrieve Payment after Confirmation -> Partial Refund Payment -> Partial Refund Payment - 2nd Attempt -> Sync Refund Payment", () => {
+ let shouldContinue = true;
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["No3DSAutoCapture"];
-
- cy.retrievePaymentCallTest({ globalState, data });
- });
-
- it("refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PartialRefund"];
-
- cy.refundCallTest(fixtures.refundBody, data, globalState);
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
+ 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;
+ }
+ });
- it("refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PartialRefund"];
+ cy.step("Payment Methods Call", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Payment Methods Call");
+ return;
+ }
+ cy.paymentMethodsCallTest(globalState);
+ });
- cy.refundCallTest(fixtures.refundBody, data, 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;
+ }
+ });
- 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"
+ ]["No3DSAutoCapture"];
+ cy.retrievePaymentCallTest({ globalState, data: confirmData });
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
- it("sync-refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["SyncRefund"];
+ cy.step("Partial Refund Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Partial Refund Payment");
+ return;
+ }
+ const partialRefundData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["PartialRefund"];
+ cy.refundCallTest(fixtures.refundBody, partialRefundData, globalState);
+ if (!utils.should_continue_further(partialRefundData)) {
+ shouldContinue = false;
+ }
+ });
- cy.syncRefundCallTest(data, globalState);
+ cy.step("Partial Refund Payment - 2nd Attempt", () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Partial Refund Payment - 2nd Attempt"
+ );
+ return;
+ }
+ const partialRefundData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["PartialRefund"];
+ cy.refundCallTest(fixtures.refundBody, partialRefundData, globalState);
+ if (!utils.should_continue_further(partialRefundData)) {
+ shouldContinue = false;
+ }
+ });
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
+ 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"];
+ cy.syncRefundCallTest(syncRefundData, globalState);
+ });
});
});
context(
"Fully Refund Card-NoThreeDS payment flow test Create+Confirm",
() => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
+ it("Create and Confirm Payment -> Retrieve Payment after Confirmation -> Refund Payment -> 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 Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Refund Payment");
+ return;
+ }
+ const refundData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["Refund"];
+ cy.refundCallTest(fixtures.refundBody, refundData, globalState);
+ if (!utils.should_continue_further(refundData)) {
+ 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"];
+ cy.syncRefundCallTest(syncRefundData, globalState);
+ });
+ });
+ }
+ );
- beforeEach(function () {
- if (!shouldContinue) {
- this.skip();
- }
+ context(
+ "Partially Refund Card-NoThreeDS payment flow test Create+Confirm",
+ () => {
+ it("Create and Confirm Payment -> Retrieve Payment after Confirmation -> Partial Refund Payment -> Partial Refund Payment - 2nd Attempt -> 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("Partial Refund Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Partial Refund Payment");
+ return;
+ }
+ const partialRefundData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["PartialRefund"];
+ cy.refundCallTest(
+ fixtures.refundBody,
+ partialRefundData,
+ globalState
+ );
+ if (!utils.should_continue_further(partialRefundData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Partial Refund Payment - 2nd Attempt", () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Partial Refund Payment - 2nd Attempt"
+ );
+ return;
+ }
+ const partialRefundData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["PartialRefund"];
+ cy.refundCallTest(
+ fixtures.refundBody,
+ partialRefundData,
+ globalState
+ );
+ if (!utils.should_continue_further(partialRefundData)) {
+ 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.refundCallTest(fixtures.refundBody, newData, globalState);
+ });
});
+ }
+ );
+
+ context("Card - Full Refund for fully captured No-3DS payment", () => {
+ it("Create Payment Intent -> Payment Methods Call -> Confirm Payment Intent -> Retrieve Payment after Confirmation -> Capture Payment -> Retrieve Payment after Capture -> Refund Payment -> Sync Refund Payment", () => {
+ let shouldContinue = true;
- it("create+confirm-payment-call-test", () => {
+ cy.step("Create Payment Intent", () => {
const data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
- ]["No3DSAutoCapture"];
-
- cy.createConfirmPaymentTest(
- fixtures.createConfirmPaymentBody,
+ ]["PaymentIntent"];
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
data,
"no_three_ds",
- "automatic",
+ "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("retrieve-payment-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"
- ]["No3DSAutoCapture"];
-
- cy.retrievePaymentCallTest({ globalState, data });
+ ]["No3DSManualCapture"];
+ cy.confirmCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
});
- it("refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
+ 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"
- ]["Refund"];
-
- cy.refundCallTest(fixtures.refundBody, data, globalState);
-
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
+ ]["No3DSManualCapture"];
+ cy.retrievePaymentCallTest({ globalState, data: confirmData });
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
});
- it("sync-refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
+ cy.step("Capture Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Capture Payment");
+ return;
+ }
+ const captureData = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
- ]["SyncRefund"];
-
- cy.syncRefundCallTest(data, globalState);
+ ]["Capture"];
+ cy.captureCallTest(fixtures.captureBody, captureData, globalState);
+ if (!utils.should_continue_further(captureData)) {
+ shouldContinue = false;
+ }
+ });
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
+ 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"];
+ cy.retrievePaymentCallTest({ globalState, data: captureData });
+ if (!utils.should_continue_further(captureData)) {
+ shouldContinue = false;
+ }
});
- }
- );
- context(
- "Partially Refund Card-NoThreeDS payment flow test Create+Confirm",
- () => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
+ cy.step("Refund Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Refund Payment");
+ return;
+ }
+ const refundData = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["manualPaymentRefund"];
+ const newRefundData = {
+ ...refundData,
+ Response: refundData.ResponseCustom || refundData.Response,
+ };
+ cy.refundCallTest(fixtures.refundBody, newRefundData, globalState);
+ if (!utils.should_continue_further(refundData)) {
+ shouldContinue = false;
+ }
+ });
- beforeEach(function () {
+ cy.step("Sync Refund Payment", () => {
if (!shouldContinue) {
- this.skip();
+ cy.task("cli_log", "Skipping step: Sync Refund Payment");
+ return;
}
+ const syncRefundData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["SyncRefund"];
+ cy.syncRefundCallTest(syncRefundData, globalState);
});
+ });
+ });
+
+ context("Card - Partial Refund for fully captured No-3DS payment", () => {
+ it("Create Payment Intent -> Payment Methods Call -> Confirm Payment Intent -> Retrieve Payment after Confirmation -> Capture Payment -> Retrieve Payment after Capture -> Partial Refund Payment -> Partial Refund Payment - 2nd Attempt -> Sync Refund Payment -> List Refunds", () => {
+ let shouldContinue = true;
- it("create+confirm-payment-call-test", () => {
+ cy.step("Create Payment Intent", () => {
const data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
- ]["No3DSAutoCapture"];
-
- cy.createConfirmPaymentTest(
- fixtures.createConfirmPaymentBody,
+ ]["PaymentIntent"];
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
data,
"no_three_ds",
- "automatic",
+ "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("retrieve-payment-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"
- ]["No3DSAutoCapture"];
-
- cy.retrievePaymentCallTest({ globalState, data });
+ ]["No3DSManualCapture"];
+ cy.confirmCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
});
- it("refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
+ 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"
- ]["PartialRefund"];
-
- cy.refundCallTest(fixtures.refundBody, data, globalState);
-
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
+ ]["No3DSManualCapture"];
+ cy.retrievePaymentCallTest({ globalState, data: confirmData });
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
});
- it("refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
+ cy.step("Capture Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Capture Payment");
+ return;
+ }
+ const captureData = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
- ]["PartialRefund"];
-
- cy.refundCallTest(fixtures.refundBody, data, globalState);
-
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
+ ]["Capture"];
+ cy.captureCallTest(fixtures.captureBody, captureData, globalState);
+ if (!utils.should_continue_further(captureData)) {
+ shouldContinue = false;
+ }
});
- it("sync-refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
+ 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"
- ]["SyncRefund"];
+ ]["Capture"];
+ cy.retrievePaymentCallTest({ globalState, data: captureData });
+ if (!utils.should_continue_further(captureData)) {
+ shouldContinue = false;
+ }
+ });
- const newData = {
- ...data,
- Response: data.ResponseCustom || data.Response,
+ cy.step("Partial Refund Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Partial Refund Payment");
+ return;
+ }
+ const partialRefundData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["manualPaymentPartialRefund"];
+ const newPartialRefundData = {
+ ...partialRefundData,
+ Response:
+ partialRefundData.ResponseCustom || partialRefundData.Response,
};
+ cy.refundCallTest(
+ fixtures.refundBody,
+ newPartialRefundData,
+ globalState
+ );
+ if (!utils.should_continue_further(partialRefundData)) {
+ shouldContinue = false;
+ }
+ });
- cy.refundCallTest(fixtures.refundBody, newData, globalState);
-
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
+ cy.step("Partial Refund Payment - 2nd Attempt", () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Partial Refund Payment - 2nd Attempt"
+ );
+ return;
+ }
+ const partialRefundData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["manualPaymentPartialRefund"];
+ const newPartialRefundData = {
+ ...partialRefundData,
+ Response:
+ partialRefundData.ResponseCustom || partialRefundData.Response,
+ };
+ cy.refundCallTest(
+ fixtures.refundBody,
+ newPartialRefundData,
+ globalState
+ );
+ if (!utils.should_continue_further(partialRefundData)) {
+ shouldContinue = false;
+ }
});
- }
- );
- context("Card - Full Refund for fully captured No-3DS payment", () => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
+ 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"];
+ cy.syncRefundCallTest(syncRefundData, globalState);
+ if (!utils.should_continue_further(syncRefundData)) {
+ shouldContinue = false;
+ }
+ });
- beforeEach(function () {
- if (!shouldContinue) {
- this.skip();
- }
+ cy.step("List Refunds", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: List Refunds");
+ return;
+ }
+ cy.listRefundCallTest(fixtures.listRefundCall, globalState);
+ });
});
+ });
- 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);
- });
+ context("Card - Full Refund for partially captured No-3DS payment", () => {
+ it("Create Payment Intent -> Payment Methods Call -> Confirm Payment Intent -> Retrieve Payment after Confirmation -> Partial Capture Payment -> Retrieve Payment after Partial Capture -> Refund Payment -> Sync Refund Payment", () => {
+ let shouldContinue = true;
- it("payment_methods-call-test", () => {
- cy.paymentMethodsCallTest(globalState);
- });
+ 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;
+ }
+ });
- it("confirm-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["No3DSManualCapture"];
+ 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"
+ ]["No3DSManualCapture"];
+ cy.confirmCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["No3DSManualCapture"];
-
- cy.retrievePaymentCallTest({ globalState, data });
- });
-
- it("capture-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["Capture"];
-
- cy.captureCallTest(fixtures.captureBody, data, globalState);
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["Capture"];
-
- cy.retrievePaymentCallTest({ globalState, data });
- });
-
- it("refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["manualPaymentRefund"];
-
- const newData = {
- ...data,
- Response: data.ResponseCustom || data.Response,
- };
-
- cy.refundCallTest(fixtures.refundBody, newData, globalState);
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("sync-refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["SyncRefund"];
-
- cy.syncRefundCallTest(data, globalState);
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
- });
-
- context("Card - Partial Refund for fully captured No-3DS payment", () => {
- 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, true, globalState);
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["No3DSManualCapture"];
-
- cy.retrievePaymentCallTest({ globalState, data });
- });
-
- it("capture-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["Capture"];
-
- cy.captureCallTest(fixtures.captureBody, data, globalState);
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["Capture"];
-
- cy.retrievePaymentCallTest({ globalState, data });
- });
-
- it("refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["manualPaymentPartialRefund"];
-
- const newData = {
- ...data,
- Response: data.ResponseCustom || data.Response,
- };
-
- cy.refundCallTest(fixtures.refundBody, newData, globalState);
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
- it("refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["manualPaymentPartialRefund"];
-
- const newData = {
- ...data,
- Response: data.ResponseCustom || data.Response,
- };
-
- cy.refundCallTest(fixtures.refundBody, newData, globalState);
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("sync-refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["SyncRefund"];
-
- cy.syncRefundCallTest(data, globalState);
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
- it("list-refund-call-test", () => {
- cy.listRefundCallTest(fixtures.listRefundCall, globalState);
- });
- });
-
- context("Card - Full Refund for partially captured No-3DS payment", () => {
- 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, true, globalState);
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["No3DSManualCapture"];
-
- cy.retrievePaymentCallTest({ globalState, data });
- });
-
- it("capture-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PartialCapture"];
-
- cy.captureCallTest(fixtures.captureBody, data, globalState);
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PartialCapture"];
-
- cy.retrievePaymentCallTest({ globalState, data });
- });
-
- it("refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["manualPaymentPartialRefund"];
-
- const newData = {
- ...data,
- Response: data.ResponseCustom || data.Response,
- };
-
- cy.refundCallTest(fixtures.refundBody, newData, globalState);
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("sync-refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["SyncRefund"];
-
- cy.syncRefundCallTest(data, globalState);
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
- });
-
- context("Card - partial Refund for partially captured No-3DS payment", () => {
- 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, true, globalState);
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["No3DSManualCapture"];
-
- cy.retrievePaymentCallTest({ globalState, data });
- });
-
- it("capture-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PartialCapture"];
-
- cy.captureCallTest(fixtures.captureBody, data, globalState);
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PartialCapture"];
-
- cy.retrievePaymentCallTest({ globalState, data });
- });
-
- it("refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["manualPaymentPartialRefund"];
-
- const newData = {
- ...data,
- Response: data.ResponseCustom || data.Response,
- };
-
- cy.refundCallTest(fixtures.refundBody, newData, globalState);
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("sync-refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["SyncRefund"];
-
- cy.syncRefundCallTest(data, globalState);
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
- });
-
- context(
- "Card - Full Refund for Create + Confirm Automatic CIT and MIT payment flow test",
- () => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
+ 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: confirmData });
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
- beforeEach(function () {
+ cy.step("Partial Capture Payment", () => {
if (!shouldContinue) {
- this.skip();
+ cy.task("cli_log", "Skipping step: Partial Capture Payment");
+ return;
+ }
+ const partialCaptureData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["PartialCapture"];
+ cy.captureCallTest(
+ fixtures.captureBody,
+ partialCaptureData,
+ globalState
+ );
+ if (!utils.should_continue_further(partialCaptureData)) {
+ shouldContinue = false;
}
});
- it("Confirm No 3DS CIT", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["MandateMultiUseNo3DSAutoCapture"];
+ 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: partialCaptureData });
+ if (!utils.should_continue_further(partialCaptureData)) {
+ shouldContinue = false;
+ }
+ });
- cy.citForMandatesCallTest(
- fixtures.citConfirmBody,
- data,
- 6000,
- true,
- "automatic",
- "new_mandate",
+ cy.step("Refund Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Refund Payment");
+ return;
+ }
+ const partialRefundData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["manualPaymentPartialRefund"];
+ const newPartialRefundData = {
+ ...partialRefundData,
+ Response:
+ partialRefundData.ResponseCustom || partialRefundData.Response,
+ };
+ cy.refundCallTest(
+ fixtures.refundBody,
+ newPartialRefundData,
globalState
);
+ if (!utils.should_continue_further(partialRefundData)) {
+ shouldContinue = false;
+ }
+ });
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
+ 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"];
+ cy.syncRefundCallTest(syncRefundData, globalState);
});
+ });
+ });
+
+ context("Card - Partial Refund for partially captured No-3DS payment", () => {
+ it("Create Payment Intent -> Payment Methods Call -> Confirm Payment Intent -> Retrieve Payment after Confirmation -> Partial Capture Payment -> Retrieve Payment after Partial Capture -> Refund Payment -> Sync Refund Payment", () => {
+ let shouldContinue = true;
- it("Confirm No 3DS MIT", () => {
+ cy.step("Create Payment Intent", () => {
const data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
- ]["MITAutoCapture"];
-
- cy.mitForMandatesCallTest(
- fixtures.mitConfirmBody,
+ ]["PaymentIntent"];
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
data,
- 6000,
- true,
- "automatic",
+ "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("Confirm No 3DS MIT", () => {
- 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"
- ]["MITAutoCapture"];
-
- cy.mitForMandatesCallTest(
- fixtures.mitConfirmBody,
- data,
- 6000,
+ ]["No3DSManualCapture"];
+ cy.confirmCallTest(
+ fixtures.confirmBody,
+ confirmData,
true,
- "automatic",
globalState
);
-
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
});
- it("refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
+ 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"
- ]["Refund"];
+ ]["No3DSManualCapture"];
+ cy.retrievePaymentCallTest({ globalState, data: confirmData });
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
- cy.refundCallTest(fixtures.refundBody, data, globalState);
+ 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,
+ partialCaptureData,
+ globalState
+ );
+ if (!utils.should_continue_further(partialCaptureData)) {
+ shouldContinue = false;
+ }
+ });
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
+ 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: partialCaptureData });
+ if (!utils.should_continue_further(partialCaptureData)) {
+ shouldContinue = false;
+ }
});
- it("sync-refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["SyncRefund"];
+ cy.step("Refund Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Refund Payment");
+ return;
+ }
+ const partialRefundData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["manualPaymentPartialRefund"];
+ const newPartialRefundData = {
+ ...partialRefundData,
+ Response:
+ partialRefundData.ResponseCustom || partialRefundData.Response,
+ };
+ cy.refundCallTest(
+ fixtures.refundBody,
+ newPartialRefundData,
+ globalState
+ );
+ if (!utils.should_continue_further(partialRefundData)) {
+ shouldContinue = false;
+ }
+ });
- cy.syncRefundCallTest(data, globalState);
+ 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"];
+ cy.syncRefundCallTest(syncRefundData, globalState);
+ });
+ });
+ });
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
+ context(
+ "Card - Full Refund for Create + Confirm Automatic CIT and MIT payment flow test",
+ () => {
+ it("CIT for Mandates Call -> MIT for Mandates Call -> MIT for Mandates Call - 2nd Attempt -> Refund Payment -> Sync Refund Payment", () => {
+ let shouldContinue = true;
+
+ cy.step("CIT for Mandates Call", () => {
+ const citData = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["MandateMultiUseNo3DSAutoCapture"];
+ cy.citForMandatesCallTest(
+ fixtures.citConfirmBody,
+ citData,
+ 6000,
+ true,
+ "automatic",
+ "new_mandate",
+ globalState
+ );
+ if (!utils.should_continue_further(citData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("MIT for Mandates Call", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: MIT for Mandates Call");
+ return;
+ }
+ const mitData = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["MITAutoCapture"];
+ cy.mitForMandatesCallTest(
+ fixtures.mitConfirmBody,
+ mitData,
+ 6000,
+ true,
+ "automatic",
+ globalState
+ );
+ if (!utils.should_continue_further(mitData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("MIT for Mandates Call - 2nd Attempt", () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: MIT for Mandates Call - 2nd Attempt"
+ );
+ return;
+ }
+ const mitData = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["MITAutoCapture"];
+ cy.mitForMandatesCallTest(
+ fixtures.mitConfirmBody,
+ mitData,
+ 6000,
+ true,
+ "automatic",
+ globalState
+ );
+ if (!utils.should_continue_further(mitData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Refund Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Refund Payment");
+ return;
+ }
+ const refundData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["Refund"];
+ cy.refundCallTest(fixtures.refundBody, refundData, globalState);
+ if (!utils.should_continue_further(refundData)) {
+ 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"];
+ cy.syncRefundCallTest(syncRefundData, globalState);
+ });
});
}
);
@@ -781,236 +1045,230 @@ describe("Card - Refund flow - 3DS", () => {
});
context("Card - Full Refund flow test for 3DS", () => {
- 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 -> Confirm Payment Intent -> Handle Redirection -> Retrieve Payment after Confirmation -> Refund Payment -> Sync Refund Payment", () => {
+ let shouldContinue = true;
- it("create-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PaymentIntent"];
-
- cy.createPaymentIntentTest(
- fixtures.createPaymentBody,
- data,
- "three_ds",
- "automatic",
- globalState
- );
+ cy.step("Create Payment Intent", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentIntent"];
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "three_ds",
+ "automatic",
+ 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"
+ ]["3DSAutoCapture"];
+ cy.confirmCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
- it("Confirm 3DS", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["3DSAutoCapture"];
+ 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.confirmCallTest(fixtures.confirmBody, data, true, globalState);
+ 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"
+ ]["3DSAutoCapture"];
+ cy.retrievePaymentCallTest({ globalState, data: confirmData });
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
+ cy.step("Refund Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Refund Payment");
+ return;
+ }
+ const refundData = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["Refund"];
+ cy.refundCallTest(fixtures.refundBody, refundData, globalState);
+ if (!utils.should_continue_further(refundData)) {
+ shouldContinue = false;
+ }
+ });
- it("Handle redirection", () => {
- const expected_redirection = fixtures.confirmBody["return_url"];
- cy.handleRedirection(globalState, expected_redirection);
+ 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"];
+ cy.syncRefundCallTest(syncRefundData, globalState);
+ });
});
+ });
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["3DSAutoCapture"];
+ context("Card - Partial Refund flow test for 3DS", () => {
+ it("Create Payment Intent -> Payment Methods Call -> Confirm Payment Intent -> Handle Redirection -> Retrieve Payment after Confirmation -> Partial Refund Payment -> Partial Refund Payment - 2nd Attempt -> Sync Refund Payment", () => {
+ let shouldContinue = true;
- cy.retrievePaymentCallTest({ globalState, data });
- });
-
- it("refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["Refund"];
-
- cy.refundCallTest(fixtures.refundBody, data, globalState);
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("sync-refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["SyncRefund"];
-
- cy.syncRefundCallTest(data, globalState);
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
- });
-
- context("Card - Partial Refund flow test for 3DS", () => {
- 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,
- "three_ds",
- "automatic",
- globalState
- );
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("payment_methods-call-test", () => {
- cy.paymentMethodsCallTest(globalState);
- });
-
- it("Confirm 3DS", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["3DSAutoCapture"];
-
- cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("Handle redirection", () => {
- 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"
- ]["3DSAutoCapture"];
-
- cy.retrievePaymentCallTest({ globalState, data });
- });
-
- it("refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PartialRefund"];
-
- cy.refundCallTest(fixtures.refundBody, data, globalState);
+ cy.step("Create Payment Intent", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentIntent"];
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "three_ds",
+ "automatic",
+ 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("refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PartialRefund"];
+ 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"];
+ cy.confirmCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
- cy.refundCallTest(fixtures.refundBody, data, globalState);
+ 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);
+ });
- 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"
+ ]["3DSAutoCapture"];
+ cy.retrievePaymentCallTest({ globalState, data: confirmData });
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
- it("sync-refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["SyncRefund"];
+ cy.step("Partial Refund Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Partial Refund Payment");
+ return;
+ }
+ const partialRefundData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["PartialRefund"];
+ cy.refundCallTest(fixtures.refundBody, partialRefundData, globalState);
+ if (!utils.should_continue_further(partialRefundData)) {
+ shouldContinue = false;
+ }
+ });
- cy.syncRefundCallTest(data, globalState);
+ cy.step("Partial Refund Payment - 2nd Attempt", () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Partial Refund Payment - 2nd Attempt"
+ );
+ return;
+ }
+ const partialRefundData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["PartialRefund"];
+ cy.refundCallTest(fixtures.refundBody, partialRefundData, globalState);
+ if (!utils.should_continue_further(partialRefundData)) {
+ shouldContinue = false;
+ }
+ });
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
+ 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"];
+ cy.syncRefundCallTest(syncRefundData, globalState);
+ });
});
});
context("Fully Refund Card-ThreeDS 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"
- ]["3DSAutoCapture"];
-
- cy.createConfirmPaymentTest(
- fixtures.createConfirmPaymentBody,
- data,
- "three_ds",
- "automatic",
- globalState
- );
+ it("Create and Confirm Payment -> Handle Redirection -> Retrieve Payment after Confirmation -> Refund Payment -> Sync Refund Payment", () => {
+ let shouldContinue = true;
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("Handle redirection", () => {
- 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"
- ]["3DSAutoCapture"];
-
- cy.retrievePaymentCallTest({ globalState, data });
- });
-
- it("refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["Refund"];
-
- cy.refundCallTest(fixtures.refundBody, data, globalState);
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("sync-refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["SyncRefund"];
-
- cy.syncRefundCallTest(data, globalState);
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
- });
-
- context(
- "Partially Refund Card-ThreeDS 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", () => {
+ cy.step("Create and Confirm Payment", () => {
const data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["3DSAutoCapture"];
-
cy.createConfirmPaymentTest(
fixtures.createConfirmPaymentBody,
data,
@@ -1018,434 +1276,713 @@ describe("Card - Refund flow - 3DS", () => {
"automatic",
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.confirmBody["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"
]["3DSAutoCapture"];
-
cy.retrievePaymentCallTest({ globalState, data });
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
});
- it("refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
+ cy.step("Refund Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Refund Payment");
+ return;
+ }
+ const refundData = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
- ]["PartialRefund"];
-
- cy.refundCallTest(fixtures.refundBody, data, globalState);
-
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
+ ]["Refund"];
+ cy.refundCallTest(fixtures.refundBody, refundData, globalState);
+ if (!utils.should_continue_further(refundData)) {
+ shouldContinue = false;
+ }
});
- it("refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PartialRefund"];
-
- cy.refundCallTest(fixtures.refundBody, data, globalState);
-
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
+ 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"];
+ cy.syncRefundCallTest(syncRefundData, globalState);
});
+ });
+ });
- it("sync-refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["SyncRefund"];
-
- cy.syncRefundCallTest(data, globalState);
-
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
+ context(
+ "Partially Refund Card-ThreeDS payment flow test Create+Confirm",
+ () => {
+ it("Create and Confirm Payment -> Handle Redirection -> Retrieve Payment after Confirmation -> Partial Refund Payment -> Partial Refund Payment - 2nd Attempt -> Sync Refund Payment", () => {
+ let shouldContinue = true;
+
+ cy.step("Create and Confirm Payment", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["3DSAutoCapture"];
+ cy.createConfirmPaymentTest(
+ fixtures.createConfirmPaymentBody,
+ data,
+ "three_ds",
+ "automatic",
+ globalState
+ );
+ if (!utils.should_continue_further(data)) {
+ 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);
+ });
+
+ 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"
+ ]["3DSAutoCapture"];
+ cy.retrievePaymentCallTest({ globalState, data });
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Partial Refund Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Partial Refund Payment");
+ return;
+ }
+ const partialRefundData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["PartialRefund"];
+ cy.refundCallTest(
+ fixtures.refundBody,
+ partialRefundData,
+ globalState
+ );
+ if (!utils.should_continue_further(partialRefundData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Partial Refund Payment - 2nd Attempt", () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Partial Refund Payment - 2nd Attempt"
+ );
+ return;
+ }
+ const partialRefundData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["PartialRefund"];
+ cy.refundCallTest(
+ fixtures.refundBody,
+ partialRefundData,
+ globalState
+ );
+ if (!utils.should_continue_further(partialRefundData)) {
+ 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"];
+ cy.syncRefundCallTest(syncRefundData, globalState);
+ });
});
}
);
context("Card - Full Refund for fully captured 3DS payment", () => {
- 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,
- "three_ds",
- "manual",
- globalState
- );
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("payment_methods-call-test", () => {
- cy.paymentMethodsCallTest(globalState);
- });
-
- it("Confirm 3DS", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["3DSManualCapture"];
-
- cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);
+ it("Create Payment Intent -> Payment Methods Call -> Confirm Payment Intent -> Handle Redirection -> Retrieve Payment after Confirmation -> Capture Payment -> Retrieve Payment after Capture -> Refund Payment -> Sync Refund Payment", () => {
+ let shouldContinue = true;
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("Handle redirection", () => {
- 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.retrievePaymentCallTest({ globalState, data });
- });
-
- it("capture-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["Capture"];
-
- cy.captureCallTest(fixtures.captureBody, data, globalState);
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
+ cy.step("Create Payment Intent", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentIntent"];
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "three_ds",
+ "manual",
+ globalState
+ );
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["Capture"];
+ cy.step("Payment Methods Call", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Payment Methods Call");
+ return;
+ }
+ cy.paymentMethodsCallTest(globalState);
+ });
- cy.retrievePaymentCallTest({ globalState, 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
+ );
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
- it("refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["manualPaymentRefund"];
+ 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.refundCallTest(fixtures.refundBody, data, globalState);
+ 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: confirmData });
+ 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"];
+ cy.captureCallTest(fixtures.captureBody, captureData, globalState);
+ if (!utils.should_continue_further(captureData)) {
+ shouldContinue = false;
+ }
+ });
- it("sync-refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["SyncRefund"];
+ 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"];
+ cy.retrievePaymentCallTest({ globalState, data: captureData });
+ if (!utils.should_continue_further(captureData)) {
+ shouldContinue = false;
+ }
+ });
- cy.syncRefundCallTest(data, globalState);
+ cy.step("Refund Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Refund Payment");
+ return;
+ }
+ const refundData = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["manualPaymentRefund"];
+ cy.refundCallTest(fixtures.refundBody, refundData, globalState);
+ if (!utils.should_continue_further(refundData)) {
+ shouldContinue = false;
+ }
+ });
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
+ 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"];
+ cy.syncRefundCallTest(syncRefundData, globalState);
+ });
});
});
context("Card - Partial Refund for fully captured 3DS payment", () => {
- 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,
- "three_ds",
- "manual",
- globalState
- );
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
+ it("Create Payment Intent -> Payment Methods Call -> Confirm Payment Intent -> Handle Redirection -> Retrieve Payment after Confirmation -> Capture Payment -> Retrieve Payment after Capture -> Partial Refund Payment -> Partial Refund Payment - 2nd Attempt -> Sync Refund Payment", () => {
+ let shouldContinue = true;
- it("payment_methods-call-test", () => {
- cy.paymentMethodsCallTest(globalState);
- });
-
- it("Confirm 3DS", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["3DSManualCapture"];
-
- cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("Handle redirection", () => {
- 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.retrievePaymentCallTest({ globalState, data });
- });
-
- it("capture-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["Capture"];
-
- cy.captureCallTest(fixtures.captureBody, data, globalState);
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["Capture"];
+ cy.step("Create Payment Intent", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentIntent"];
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "three_ds",
+ "manual",
+ globalState
+ );
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
- cy.retrievePaymentCallTest({ globalState, data });
- });
+ cy.step("Payment Methods Call", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Payment Methods Call");
+ return;
+ }
+ cy.paymentMethodsCallTest(globalState);
+ });
- it("refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["manualPaymentPartialRefund"];
+ 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 (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
- cy.refundCallTest(fixtures.refundBody, data, globalState);
+ 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);
+ });
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
- it("refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["manualPaymentPartialRefund"];
+ 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: confirmData });
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
- cy.refundCallTest(fixtures.refundBody, data, globalState);
+ cy.step("Capture Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Capture Payment");
+ return;
+ }
+ const captureData = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["Capture"];
+ cy.captureCallTest(fixtures.captureBody, captureData, globalState);
+ if (!utils.should_continue_further(captureData)) {
+ shouldContinue = false;
+ }
+ });
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
+ 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"];
+ cy.retrievePaymentCallTest({ globalState, data: captureData });
+ if (!utils.should_continue_further(captureData)) {
+ shouldContinue = false;
+ }
+ });
- it("sync-refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["SyncRefund"];
+ cy.step("Partial Refund Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Partial Refund Payment");
+ return;
+ }
+ const partialRefundData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["manualPaymentPartialRefund"];
+ cy.refundCallTest(fixtures.refundBody, partialRefundData, globalState);
+ if (!utils.should_continue_further(partialRefundData)) {
+ shouldContinue = false;
+ }
+ });
- cy.syncRefundCallTest(data, globalState);
+ cy.step("Partial Refund Payment - 2nd Attempt", () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Partial Refund Payment - 2nd Attempt"
+ );
+ return;
+ }
+ const partialRefundData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["manualPaymentPartialRefund"];
+ cy.refundCallTest(fixtures.refundBody, partialRefundData, globalState);
+ if (!utils.should_continue_further(partialRefundData)) {
+ shouldContinue = false;
+ }
+ });
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
+ 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"];
+ cy.syncRefundCallTest(syncRefundData, globalState);
+ });
});
});
context("Card - Full Refund for partially captured 3DS payment", () => {
- 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,
- "three_ds",
- "manual",
- globalState
- );
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("payment_methods-call-test", () => {
- cy.paymentMethodsCallTest(globalState);
- });
-
- it("Confirm 3DS", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["3DSManualCapture"];
-
- cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);
+ it("Create Payment Intent -> Payment Methods Call -> Confirm Payment Intent -> Handle Redirection -> Retrieve Payment after Confirmation -> Partial Capture Payment -> Retrieve Payment after Partial Capture -> Refund Payment -> Sync Refund Payment", () => {
+ let shouldContinue = true;
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("Handle redirection", () => {
- 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.retrievePaymentCallTest({ globalState, data });
- });
-
- it("capture-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PartialCapture"];
-
- cy.captureCallTest(fixtures.captureBody, data, globalState);
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
+ cy.step("Create Payment Intent", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentIntent"];
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "three_ds",
+ "manual",
+ globalState
+ );
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PartialCapture"];
+ cy.step("Payment Methods Call", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Payment Methods Call");
+ return;
+ }
+ cy.paymentMethodsCallTest(globalState);
+ });
- cy.retrievePaymentCallTest({ globalState, 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
+ );
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
- it("refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["manualPaymentPartialRefund"];
+ 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.refundCallTest(fixtures.refundBody, data, globalState);
+ 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: confirmData });
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
+ 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,
+ partialCaptureData,
+ globalState
+ );
+ if (!utils.should_continue_further(partialCaptureData)) {
+ shouldContinue = false;
+ }
+ });
- it("sync-refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["SyncRefund"];
+ 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: partialCaptureData });
+ if (!utils.should_continue_further(partialCaptureData)) {
+ shouldContinue = false;
+ }
+ });
- cy.syncRefundCallTest(data, globalState);
+ cy.step("Refund Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Refund Payment");
+ return;
+ }
+ const partialRefundData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["manualPaymentPartialRefund"];
+ cy.refundCallTest(fixtures.refundBody, partialRefundData, globalState);
+ if (!utils.should_continue_further(partialRefundData)) {
+ shouldContinue = false;
+ }
+ });
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
+ 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"];
+ cy.syncRefundCallTest(syncRefundData, globalState);
+ });
});
});
- context("Card - partial Refund for partially captured 3DS payment", () => {
- 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,
- "three_ds",
- "manual",
- globalState
- );
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("payment_methods-call-test", () => {
- cy.paymentMethodsCallTest(globalState);
- });
-
- it("Confirm 3DS", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["3DSManualCapture"];
-
- cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("Handle redirection", () => {
- 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.retrievePaymentCallTest({ globalState, data });
- });
-
- it("capture-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PartialCapture"];
-
- cy.captureCallTest(fixtures.captureBody, data, globalState);
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
+ context("Card - Partial Refund for partially captured 3DS payment", () => {
+ it("Create Payment Intent -> Payment Methods Call -> Confirm Payment Intent -> Handle Redirection -> Retrieve Payment after Confirmation -> Partial Capture Payment -> Retrieve Payment after Partial Capture -> Partial Refund Payment -> Sync Refund Payment", () => {
+ let shouldContinue = true;
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PartialCapture"];
+ cy.step("Create Payment Intent", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentIntent"];
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "three_ds",
+ "manual",
+ globalState
+ );
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
- cy.retrievePaymentCallTest({ globalState, data });
- });
+ cy.step("Payment Methods Call", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Payment Methods Call");
+ return;
+ }
+ cy.paymentMethodsCallTest(globalState);
+ });
- it("refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["manualPaymentPartialRefund"];
+ 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 (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
- const newData = {
- ...data,
- Request: { amount: data.Request.amount / 2 },
- };
+ 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.refundCallTest(fixtures.refundBody, newData, globalState);
+ 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: confirmData });
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
+ 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,
+ partialCaptureData,
+ globalState
+ );
+ if (!utils.should_continue_further(partialCaptureData)) {
+ shouldContinue = false;
+ }
+ });
- it("sync-refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["SyncRefund"];
+ 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: partialCaptureData });
+ if (!utils.should_continue_further(partialCaptureData)) {
+ shouldContinue = false;
+ }
+ });
- cy.syncRefundCallTest(data, globalState);
+ cy.step("Partial Refund Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Partial Refund Payment");
+ return;
+ }
+ const partialRefundData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["manualPaymentPartialRefund"];
+ const newPartialRefundData = {
+ ...partialRefundData,
+ Request: { amount: partialRefundData.Request.amount / 2 },
+ };
+ cy.refundCallTest(
+ fixtures.refundBody,
+ newPartialRefundData,
+ globalState
+ );
+ if (!utils.should_continue_further(partialRefundData)) {
+ shouldContinue = false;
+ }
+ });
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
+ 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"];
+ cy.syncRefundCallTest(syncRefundData, globalState);
+ });
});
});
});
diff --git a/cypress-tests/cypress/e2e/spec/Payment/00010-SyncRefund.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00010-SyncRefund.cy.js
index 1a322adfb6..b6771f4708 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/00010-SyncRefund.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/00010-SyncRefund.cy.js
@@ -5,14 +5,6 @@ import getConnectorDetails, * as utils from "../../configs/Payment/Utils";
let globalState;
describe("Card - Sync Refund 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,61 +15,94 @@ describe("Card - Sync Refund flow test", () => {
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);
- });
-
- it("confirm-call-test", () => {
- 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("refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "Refund"
- ];
-
- cy.refundCallTest(fixtures.refundBody, data, globalState);
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("sync-refund-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "SyncRefund"
- ];
-
- cy.syncRefundCallTest(data, globalState);
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
+ context("Card - Sync Refund flow test", () => {
+ it("Create Payment Intent -> Payment Methods Call -> Confirm Payment Intent -> Retrieve Payment after Confirmation -> Refund Payment -> Sync Refund", () => {
+ 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 Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Refund Payment");
+ return;
+ }
+ const refundData = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["Refund"];
+ cy.refundCallTest(fixtures.refundBody, refundData, globalState);
+ if (!utils.should_continue_further(refundData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Sync Refund", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Sync Refund");
+ return;
+ }
+ const syncRefundData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["SyncRefund"];
+ cy.syncRefundCallTest(syncRefundData, globalState);
+ });
+ });
});
});
diff --git a/cypress-tests/cypress/e2e/spec/Payment/00014-SaveCardFlow.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00014-SaveCardFlow.cy.js
index d02d311d10..227095fb72 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/00014-SaveCardFlow.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/00014-SaveCardFlow.cy.js
@@ -4,7 +4,6 @@ import State from "../../../utils/State";
import getConnectorDetails, * as utils from "../../configs/Payment/Utils";
let globalState;
-let saveCardBody;
describe("Card - SaveCard payment flow test", () => {
before("seed global state", () => {
@@ -20,75 +19,92 @@ describe("Card - SaveCard payment flow test", () => {
context(
"Save card for NoThreeDS automatic capture payment- Create+Confirm [on_session]",
() => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
-
- beforeEach(function () {
- saveCardBody = Cypress._.cloneDeep(fixtures.saveCardConfirmBody);
- if (!shouldContinue) {
- this.skip();
- }
- });
-
- it("customer-create-call-test", () => {
- cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
- });
-
- it("create+confirm-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["SaveCardUseNo3DSAutoCapture"];
-
- 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"
- ]["SaveCardUseNo3DSAutoCapture"];
-
- cy.retrievePaymentCallTest({ globalState, data });
- });
-
- it("retrieve-customerPM-call-test", () => {
- cy.listCustomerPMCallTest(globalState);
- });
-
- 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("confirm-save-card-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["SaveCardUseNo3DSAutoCapture"];
-
- cy.saveCardConfirmCallTest(saveCardBody, data, globalState);
-
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
+ it("Create Customer -> Create and Confirm Payment -> Retrieve Payment after Confirm -> List Customer Payment Methods -> Create Payment Intent -> Save Card Confirm Call", () => {
+ let shouldContinue = true;
+
+ cy.step("Create Customer", () => {
+ cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
+ });
+
+ cy.step("Create and Confirm Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Create and Confirm Payment");
+ return;
+ }
+ const createConfirmData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["SaveCardUseNo3DSAutoCapture"];
+ cy.createConfirmPaymentTest(
+ fixtures.createConfirmPaymentBody,
+ createConfirmData,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+ if (!utils.should_continue_further(createConfirmData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Retrieve Payment after Confirm", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Retrieve Payment after Confirm");
+ return;
+ }
+ const createConfirmData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["SaveCardUseNo3DSAutoCapture"];
+ cy.retrievePaymentCallTest({ globalState, data: createConfirmData });
+ if (!utils.should_continue_further(createConfirmData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("List Customer Payment Methods", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: List Customer Payment Methods");
+ return;
+ }
+ cy.listCustomerPMCallTest(globalState);
+ });
+
+ cy.step("Create Payment Intent", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Create Payment Intent");
+ return;
+ }
+ const paymentIntentData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["PaymentIntent"];
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ paymentIntentData,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+ if (!utils.should_continue_further(paymentIntentData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Save Card Confirm Call", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Save Card Confirm Call");
+ return;
+ }
+ const saveCardBody = Cypress._.cloneDeep(
+ fixtures.saveCardConfirmBody
+ );
+ const saveCardConfirmData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["SaveCardUseNo3DSAutoCapture"];
+ cy.saveCardConfirmCallTest(
+ saveCardBody,
+ saveCardConfirmData,
+ globalState
+ );
+ });
});
}
);
@@ -96,101 +112,140 @@ describe("Card - SaveCard payment flow test", () => {
context(
"Save card for NoThreeDS manual full capture payment- Create+Confirm [on_session]",
() => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
-
- beforeEach(function () {
- saveCardBody = Cypress._.cloneDeep(fixtures.saveCardConfirmBody);
- if (!shouldContinue) {
- this.skip();
- }
- });
-
- it("customer-create-call-test", () => {
- cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
- });
-
- it("create+confirm-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["SaveCardUseNo3DSAutoCapture"];
-
- 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"
- ]["SaveCardUseNo3DSAutoCapture"];
-
- cy.retrievePaymentCallTest({ globalState, data });
- });
-
- it("retrieve-customerPM-call-test", () => {
- cy.listCustomerPMCallTest(globalState);
- });
-
- 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("confirm-save-card-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["SaveCardUseNo3DSManualCapture"];
-
- cy.saveCardConfirmCallTest(saveCardBody, data, globalState);
-
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
- });
-
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["SaveCardUseNo3DSManualCapture"];
-
- cy.retrievePaymentCallTest({ globalState, data });
- });
-
- it("capture-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["Capture"];
-
- cy.captureCallTest(fixtures.captureBody, data, globalState);
-
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
- });
-
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["Capture"];
-
- cy.retrievePaymentCallTest({ globalState, data });
+ it("Create Customer -> Create and Confirm Payment -> Retrieve Payment after Confirm -> List Customer Payment Methods -> Create Payment Intent -> Save Card Confirm Call -> Retrieve Payment after Save Card Confirm -> Capture Payment -> Retrieve Payment after Capture", () => {
+ let shouldContinue = true;
+
+ cy.step("Create Customer", () => {
+ cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
+ });
+
+ cy.step("Create and Confirm Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Create and Confirm Payment");
+ return;
+ }
+ const createConfirmData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["SaveCardUseNo3DSAutoCapture"];
+ cy.createConfirmPaymentTest(
+ fixtures.createConfirmPaymentBody,
+ createConfirmData,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+ if (!utils.should_continue_further(createConfirmData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Retrieve Payment after Confirm", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Retrieve Payment after Confirm");
+ return;
+ }
+ const createConfirmData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["SaveCardUseNo3DSAutoCapture"];
+ cy.retrievePaymentCallTest({ globalState, data: createConfirmData });
+ if (!utils.should_continue_further(createConfirmData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("List Customer Payment Methods", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: List Customer Payment Methods");
+ return;
+ }
+ cy.listCustomerPMCallTest(globalState);
+ });
+
+ cy.step("Create Payment Intent", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Create Payment Intent");
+ return;
+ }
+ const paymentIntentData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["PaymentIntent"];
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ paymentIntentData,
+ "no_three_ds",
+ "manual",
+ globalState
+ );
+ if (!utils.should_continue_further(paymentIntentData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Save Card Confirm Call", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Save Card Confirm Call");
+ return;
+ }
+ const saveCardBody = Cypress._.cloneDeep(
+ fixtures.saveCardConfirmBody
+ );
+ const saveCardConfirmData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["SaveCardUseNo3DSManualCapture"];
+ cy.saveCardConfirmCallTest(
+ saveCardBody,
+ saveCardConfirmData,
+ globalState
+ );
+ if (!utils.should_continue_further(saveCardConfirmData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Retrieve Payment after Save Card Confirm", () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Retrieve Payment after Save Card Confirm"
+ );
+ return;
+ }
+ const saveCardConfirmData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["SaveCardUseNo3DSManualCapture"];
+ cy.retrievePaymentCallTest({
+ globalState,
+ data: saveCardConfirmData,
+ });
+ if (!utils.should_continue_further(saveCardConfirmData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Capture Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Capture Payment");
+ return;
+ }
+ const captureData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["Capture"];
+ cy.captureCallTest(fixtures.captureBody, captureData, globalState);
+ if (!utils.should_continue_further(captureData)) {
+ shouldContinue = false;
+ }
+ });
+
+ 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"];
+ cy.retrievePaymentCallTest({ globalState, data: captureData });
+ });
});
}
);
@@ -198,100 +253,150 @@ describe("Card - SaveCard payment flow test", () => {
context(
"Save card for NoThreeDS manual partial capture payment- Create + Confirm [on_session]",
() => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
-
- beforeEach(function () {
- saveCardBody = Cypress._.cloneDeep(fixtures.saveCardConfirmBody);
- if (!shouldContinue) {
- this.skip();
- }
- });
-
- it("customer-create-call-test", () => {
- cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
- });
-
- it("create+confirm-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["SaveCardUseNo3DSAutoCapture"];
-
- 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"
- ]["SaveCardUseNo3DSAutoCapture"];
-
- cy.retrievePaymentCallTest({ globalState, data });
- });
-
- it("retrieve-customerPM-call-test", () => {
- cy.listCustomerPMCallTest(globalState);
- });
-
- 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("confirm-save-card-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["SaveCardUseNo3DSManualCapture"];
-
- cy.saveCardConfirmCallTest(saveCardBody, data, globalState);
-
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
- });
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["SaveCardUseNo3DSManualCapture"];
-
- cy.retrievePaymentCallTest({ globalState, data });
- });
-
- it("capture-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PartialCapture"];
-
- cy.captureCallTest(fixtures.captureBody, data, globalState);
-
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
- });
-
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PartialCapture"];
-
- cy.retrievePaymentCallTest({ globalState, data });
+ it("Create Customer -> Create and Confirm Payment -> Retrieve Payment after Confirm -> List Customer Payment Methods -> Create Payment Intent -> Save Card Confirm Call -> Retrieve Payment after Save Card Confirm -> Partial Capture Payment -> Retrieve Payment after Partial Capture", () => {
+ let shouldContinue = true;
+
+ cy.step("Create Customer", () => {
+ cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
+ });
+
+ cy.step("Create and Confirm Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Create and Confirm Payment");
+ return;
+ }
+ const createConfirmData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["SaveCardUseNo3DSAutoCapture"];
+ cy.createConfirmPaymentTest(
+ fixtures.createConfirmPaymentBody,
+ createConfirmData,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+ if (!utils.should_continue_further(createConfirmData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Retrieve Payment after Confirm", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Retrieve Payment after Confirm");
+ return;
+ }
+ const createConfirmData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["SaveCardUseNo3DSAutoCapture"];
+ cy.retrievePaymentCallTest({ globalState, data: createConfirmData });
+ if (!utils.should_continue_further(createConfirmData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("List Customer Payment Methods", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: List Customer Payment Methods");
+ return;
+ }
+ cy.listCustomerPMCallTest(globalState);
+ });
+
+ cy.step("Create Payment Intent", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Create Payment Intent");
+ return;
+ }
+ const paymentIntentData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["PaymentIntent"];
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ paymentIntentData,
+ "no_three_ds",
+ "manual",
+ globalState
+ );
+ if (!utils.should_continue_further(paymentIntentData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Save Card Confirm Call", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Save Card Confirm Call");
+ return;
+ }
+ const saveCardBody = Cypress._.cloneDeep(
+ fixtures.saveCardConfirmBody
+ );
+ const saveCardConfirmData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["SaveCardUseNo3DSManualCapture"];
+ cy.saveCardConfirmCallTest(
+ saveCardBody,
+ saveCardConfirmData,
+ globalState
+ );
+ if (!utils.should_continue_further(saveCardConfirmData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Retrieve Payment after Save Card Confirm", () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Retrieve Payment after Save Card Confirm"
+ );
+ return;
+ }
+ const saveCardConfirmData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["SaveCardUseNo3DSManualCapture"];
+ cy.retrievePaymentCallTest({
+ globalState,
+ data: saveCardConfirmData,
+ });
+ if (!utils.should_continue_further(saveCardConfirmData)) {
+ shouldContinue = false;
+ }
+ });
+
+ 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,
+ partialCaptureData,
+ globalState
+ );
+ if (!utils.should_continue_further(partialCaptureData)) {
+ shouldContinue = false;
+ }
+ });
+
+ 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: partialCaptureData,
+ });
+ });
});
}
);
@@ -299,74 +404,92 @@ describe("Card - SaveCard payment flow test", () => {
context(
"Save card for NoThreeDS automatic capture payment [off_session]",
() => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
-
- beforeEach(function () {
- saveCardBody = Cypress._.cloneDeep(fixtures.saveCardConfirmBody);
- if (!shouldContinue) {
- this.skip();
- }
- });
-
- it("customer-create-call-test", () => {
- cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
- });
-
- it("create+confirm-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["SaveCardUseNo3DSAutoCaptureOffSession"];
-
- 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"
- ]["SaveCardUseNo3DSAutoCaptureOffSession"];
-
- cy.retrievePaymentCallTest({ globalState, data });
- });
-
- it("retrieve-customerPM-call-test", () => {
- cy.listCustomerPMCallTest(globalState);
- });
-
- it("create-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PaymentIntentOffSession"];
-
- cy.createPaymentIntentTest(
- fixtures.createPaymentBody,
- data,
- "no_three_ds",
- "automatic",
- globalState
- );
-
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
- });
-
- it("confirm-save-card-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["SaveCardConfirmAutoCaptureOffSession"];
-
- cy.saveCardConfirmCallTest(saveCardBody, data, globalState);
-
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
+ it("Create Customer -> Create and Confirm Payment -> Retrieve Payment after Confirm -> List Customer Payment Methods -> Create Payment Intent -> Save Card Confirm Call", () => {
+ let shouldContinue = true;
+
+ cy.step("Create Customer", () => {
+ cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
+ });
+
+ cy.step("Create and Confirm Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Create and Confirm Payment");
+ return;
+ }
+ const createConfirmData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["SaveCardUseNo3DSAutoCaptureOffSession"];
+ cy.createConfirmPaymentTest(
+ fixtures.createConfirmPaymentBody,
+ createConfirmData,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+ if (!utils.should_continue_further(createConfirmData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Retrieve Payment after Confirm", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Retrieve Payment after Confirm");
+ return;
+ }
+ const createConfirmData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["SaveCardUseNo3DSAutoCaptureOffSession"];
+ cy.retrievePaymentCallTest({ globalState, data: createConfirmData });
+ if (!utils.should_continue_further(createConfirmData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("List Customer Payment Methods", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: List Customer Payment Methods");
+ return;
+ }
+ cy.listCustomerPMCallTest(globalState);
+ });
+
+ cy.step("Create Payment Intent", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Create Payment Intent");
+ return;
+ }
+ const paymentIntentData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["PaymentIntentOffSession"];
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ paymentIntentData,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+ if (!utils.should_continue_further(paymentIntentData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Save Card Confirm Call", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Save Card Confirm Call");
+ return;
+ }
+ const saveCardBody = Cypress._.cloneDeep(
+ fixtures.saveCardConfirmBody
+ );
+ const saveCardConfirmData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["SaveCardConfirmAutoCaptureOffSession"];
+ cy.saveCardConfirmCallTest(
+ saveCardBody,
+ saveCardConfirmData,
+ globalState
+ );
+ });
});
}
);
@@ -374,119 +497,168 @@ describe("Card - SaveCard payment flow test", () => {
context(
"Save card for NoThreeDS manual capture payment- Create+Confirm [off_session]",
() => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
-
- beforeEach(function () {
- if (!shouldContinue) {
- this.skip();
- }
- saveCardBody = Cypress._.cloneDeep(fixtures.saveCardConfirmBody);
- });
-
- it("customer-create-call-test", () => {
- cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
- });
-
- it("create+confirm-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["SaveCardUseNo3DSManualCaptureOffSession"];
-
- cy.createConfirmPaymentTest(
- fixtures.createConfirmPaymentBody,
- data,
- "no_three_ds",
- "manual",
- globalState
- );
-
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
- });
-
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["SaveCardUseNo3DSManualCaptureOffSession"];
-
- cy.retrievePaymentCallTest({ globalState, data });
- });
- it("capture-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["Capture"];
-
- cy.captureCallTest(fixtures.captureBody, data, globalState);
-
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
- });
-
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["Capture"];
-
- cy.retrievePaymentCallTest({ globalState, data });
- });
-
- it("retrieve-customerPM-call-test", () => {
- cy.listCustomerPMCallTest(globalState);
- });
-
- it("create-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PaymentIntentOffSession"];
-
- cy.createPaymentIntentTest(
- fixtures.createPaymentBody,
- data,
- "no_three_ds",
- "manual",
- globalState
- );
-
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
- });
-
- it("confirm-save-card-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["SaveCardConfirmManualCaptureOffSession"];
-
- cy.saveCardConfirmCallTest(saveCardBody, data, globalState);
-
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
- });
-
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["SaveCardConfirmManualCaptureOffSession"];
-
- cy.retrievePaymentCallTest({ globalState, data });
- });
-
- it("capture-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["Capture"];
-
- cy.captureCallTest(fixtures.captureBody, data, globalState);
-
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
- });
-
- it("retrieve-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["Capture"];
-
- cy.retrievePaymentCallTest({ globalState, data });
+ it("Create Customer -> Create and Confirm Payment -> Retrieve Payment after Confirm -> Capture Payment -> Retrieve Payment after Capture -> List Customer Payment Methods -> Create Payment Intent -> Save Card Confirm Call -> Retrieve Payment after Save Card Confirm -> Capture Payment -> Retrieve Payment after Capture", () => {
+ let shouldContinue = true;
+
+ cy.step("Create Customer", () => {
+ cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
+ });
+
+ cy.step("Create and Confirm Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Create and Confirm Payment");
+ return;
+ }
+ const createConfirmData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["SaveCardUseNo3DSManualCaptureOffSession"];
+ cy.createConfirmPaymentTest(
+ fixtures.createConfirmPaymentBody,
+ createConfirmData,
+ "no_three_ds",
+ "manual",
+ globalState
+ );
+ if (!utils.should_continue_further(createConfirmData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Retrieve Payment after Confirm", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Retrieve Payment after Confirm");
+ return;
+ }
+ const createConfirmData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["SaveCardUseNo3DSManualCaptureOffSession"];
+ cy.retrievePaymentCallTest({ globalState, data: createConfirmData });
+ if (!utils.should_continue_further(createConfirmData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Capture Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Capture Payment");
+ return;
+ }
+ const captureData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["Capture"];
+ cy.captureCallTest(fixtures.captureBody, captureData, globalState);
+ if (!utils.should_continue_further(captureData)) {
+ shouldContinue = false;
+ }
+ });
+
+ 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"];
+ cy.retrievePaymentCallTest({ globalState, data: captureData });
+ if (!utils.should_continue_further(captureData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("List Customer Payment Methods", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: List Customer Payment Methods");
+ return;
+ }
+ cy.listCustomerPMCallTest(globalState);
+ });
+
+ cy.step("Create Payment Intent", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Create Payment Intent");
+ return;
+ }
+ const paymentIntentData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["PaymentIntentOffSession"];
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ paymentIntentData,
+ "no_three_ds",
+ "manual",
+ globalState
+ );
+ if (!utils.should_continue_further(paymentIntentData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Save Card Confirm Call", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Save Card Confirm Call");
+ return;
+ }
+ const saveCardBody = Cypress._.cloneDeep(
+ fixtures.saveCardConfirmBody
+ );
+ const saveCardConfirmData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["SaveCardConfirmManualCaptureOffSession"];
+ cy.saveCardConfirmCallTest(
+ saveCardBody,
+ saveCardConfirmData,
+ globalState
+ );
+ if (!utils.should_continue_further(saveCardConfirmData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Retrieve Payment after Save Card Confirm", () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Retrieve Payment after Save Card Confirm"
+ );
+ return;
+ }
+ const saveCardConfirmData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["SaveCardConfirmManualCaptureOffSession"];
+ cy.retrievePaymentCallTest({
+ globalState,
+ data: saveCardConfirmData,
+ });
+ if (!utils.should_continue_further(saveCardConfirmData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Capture Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Capture Payment");
+ return;
+ }
+ const captureData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["Capture"];
+ cy.captureCallTest(fixtures.captureBody, captureData, globalState);
+ if (!utils.should_continue_further(captureData)) {
+ shouldContinue = false;
+ }
+ });
+
+ 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"];
+ cy.retrievePaymentCallTest({ globalState, data: captureData });
+ });
});
}
);
@@ -494,246 +666,315 @@ describe("Card - SaveCard payment flow test", () => {
context(
"Save card for NoThreeDS automatic capture payment - create and confirm [off_session]",
() => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
-
- beforeEach(function () {
- saveCardBody = Cypress._.cloneDeep(fixtures.saveCardConfirmBody);
- if (!shouldContinue) {
- this.skip();
- }
- });
-
- it("customer-create-call-test", () => {
- cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
- });
-
- it("create-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PaymentIntentOffSession"];
-
- cy.createPaymentIntentTest(
- fixtures.createPaymentBody,
- data,
- "no_three_ds",
- "automatic",
- globalState
- );
-
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
- });
-
- it("confirm-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["SaveCardUseNo3DSAutoCaptureOffSession"];
-
- 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"
- ]["SaveCardUseNo3DSAutoCaptureOffSession"];
-
- cy.retrievePaymentCallTest({ globalState, data });
- });
-
- it("retrieve-customerPM-call-test", () => {
- cy.listCustomerPMCallTest(globalState);
- });
-
- it("create-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PaymentIntentOffSession"];
-
- cy.createPaymentIntentTest(
- fixtures.createPaymentBody,
- data,
- "no_three_ds",
- "automatic",
- globalState
- );
-
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
- });
-
- it("confirm-save-card-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["SaveCardConfirmAutoCaptureOffSession"];
-
- cy.saveCardConfirmCallTest(saveCardBody, data, globalState);
-
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
+ it("Create Customer -> Create Payment Intent -> Confirm Payment -> Retrieve Payment after Confirm -> List Customer Payment Methods -> Create Payment Intent for Subsequent Payment -> Save Card Confirm Call for Subsequent Payment", () => {
+ let shouldContinue = true;
+
+ cy.step("Create Customer", () => {
+ cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
+ });
+
+ cy.step("Create Payment Intent", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Create Payment Intent");
+ return;
+ }
+ const paymentIntentData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["PaymentIntentOffSession"];
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ paymentIntentData,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+ if (!utils.should_continue_further(paymentIntentData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Confirm Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Confirm Payment");
+ return;
+ }
+ const confirmData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["SaveCardUseNo3DSAutoCaptureOffSession"];
+ cy.confirmCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Retrieve Payment after Confirm", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Retrieve Payment after Confirm");
+ return;
+ }
+ const confirmData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["SaveCardUseNo3DSAutoCaptureOffSession"];
+ cy.retrievePaymentCallTest({ globalState, data: confirmData });
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("List Customer Payment Methods", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: List Customer Payment Methods");
+ return;
+ }
+ cy.listCustomerPMCallTest(globalState);
+ });
+
+ cy.step("Create Payment Intent for Subsequent Payment", () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Create Payment Intent for Subsequent Payment"
+ );
+ return;
+ }
+ const paymentIntentData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["PaymentIntentOffSession"];
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ paymentIntentData,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+ if (!utils.should_continue_further(paymentIntentData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Save Card Confirm Call for Subsequent Payment", () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Save Card Confirm Call for Subsequent Payment"
+ );
+ return;
+ }
+ const saveCardBody = Cypress._.cloneDeep(
+ fixtures.saveCardConfirmBody
+ );
+ const saveCardConfirmData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["SaveCardConfirmAutoCaptureOffSession"];
+ cy.saveCardConfirmCallTest(
+ saveCardBody,
+ saveCardConfirmData,
+ globalState
+ );
+ });
});
}
);
+
context(
- "Use billing address from payment method during subsequent payment[off_session]",
+ "Use billing address from payment method during subsequent payment [off_session]",
() => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
-
- beforeEach(function () {
- saveCardBody = Cypress._.cloneDeep(fixtures.saveCardConfirmBody);
- if (!shouldContinue) {
- this.skip();
- }
- });
-
- it("customer-create-call-test", () => {
- cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
- });
-
- it("create-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PaymentIntentOffSession"];
-
- cy.createPaymentIntentTest(
- fixtures.createPaymentBody,
- data,
- "no_three_ds",
- "automatic",
- globalState
- );
-
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
- });
-
- it("confirm-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["SaveCardUseNo3DSAutoCaptureOffSession"];
-
- cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);
-
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
- });
-
- it("retrieve-customerPM-call-test", () => {
- cy.listCustomerPMCallTest(globalState);
- });
-
- it("create-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["PaymentIntentOffSession"];
-
- cy.createPaymentIntentTest(
- fixtures.createPaymentBody,
- data,
- "no_three_ds",
- "automatic",
- globalState
+ it("Create Customer -> Create Payment Intent -> Confirm Payment -> list Customer Payment Methods -> Create Payment Intent for Subsequent Payment -> Save Card Confirm Call for Subsequent Payment without Billing Address", () => {
+ let shouldContinue = true;
+
+ cy.step("Create Customer", () => {
+ cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
+ });
+
+ cy.step("Create Payment Intent", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Create Payment Intent");
+ return;
+ }
+ const paymentIntentData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["PaymentIntentOffSession"];
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ paymentIntentData,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+ if (!utils.should_continue_further(paymentIntentData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Confirm Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Confirm Payment");
+ return;
+ }
+ const confirmData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["SaveCardUseNo3DSAutoCaptureOffSession"];
+ cy.confirmCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("list Customer Payment Methods", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: list Customer Payment Methods");
+ return;
+ }
+ cy.listCustomerPMCallTest(globalState);
+ });
+
+ cy.step("Create Payment Intent for Subsequent Payment", () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Create Payment Intent for Subsequent Payment"
+ );
+ return;
+ }
+ const paymentIntentData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["PaymentIntentOffSession"];
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ paymentIntentData,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+ if (!utils.should_continue_further(paymentIntentData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step(
+ "Save Card Confirm Call for Subsequent Payment without Billing Address",
+ () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Save Card Confirm Call for Subsequent Payment without Billing Address"
+ );
+ return;
+ }
+ const saveCardBody = Cypress._.cloneDeep(
+ fixtures.saveCardConfirmBody
+ );
+ const saveCardConfirmData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["SaveCardConfirmAutoCaptureOffSessionWithoutBilling"];
+ cy.saveCardConfirmCallTest(
+ saveCardBody,
+ saveCardConfirmData,
+ globalState
+ );
+ }
);
-
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
- });
-
- it("confirm-save-card-payment-call-test-without-billing", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["SaveCardConfirmAutoCaptureOffSessionWithoutBilling"];
-
- cy.saveCardConfirmCallTest(saveCardBody, data, globalState);
-
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
});
}
);
+
context(
"Check if card fields are populated when saving card again after a metadata update",
() => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
-
- beforeEach(function () {
- saveCardBody = Cypress._.cloneDeep(fixtures.saveCardConfirmBody);
- if (!shouldContinue) {
- this.skip();
- }
- });
-
- it("customer-create-call-test", () => {
- cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
- });
-
- it("create+confirm-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["SaveCardUseNo3DSAutoCapture"];
-
- cy.createConfirmPaymentTest(
- fixtures.createConfirmPaymentBody,
- data,
- "no_three_ds",
- "automatic",
- globalState
- );
-
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
- });
-
- it("retrieve-customerPM-call-test", () => {
- cy.listCustomerPMCallTest(globalState);
- });
-
- it("create+confirm-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "card_pm"
- ]["SaveCardUseNo3DSAutoCapture"];
-
- // generates random name (first name and last name)
- const card_holder_name = generateRandomName();
- // Create a new configuration object 'newData' based on the original 'data'.
- // This uses the spread operator (...) to create copies at each level,
- // ensuring the original 'data' object remains unchanged (immutability).
- const newData = {
- // Copy all top-level properties from the original 'data'.
- ...data,
- // Override the 'Request' object with a new one.
- Request: {
- // Copy all properties from the original 'data.Request'.
- ...data.Request,
- // Override the 'payment_method_data' object within the Request.
- payment_method_data: {
- // Override the 'card' object within payment_method_data.
- card: {
- // Copy all properties from the original card details.
- ...data.Request.payment_method_data.card,
- // Set the desired modifications for this specific test case.
- card_holder_name: card_holder_name, // Update card holder name.
+ it("Create Customer -> Create and Confirm Payment -> Retrieve Payment after Confirm -> Create and Confirm Payment again with updated card holder name in metadata -> Retrieve Customer Payment Methods", () => {
+ let shouldContinue = true;
+
+ cy.step("Create Customer", () => {
+ cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
+ });
+
+ cy.step("Create and Confirm Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Create and Confirm Payment");
+ return;
+ }
+ const createConfirmData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["SaveCardUseNo3DSAutoCapture"];
+ cy.createConfirmPaymentTest(
+ fixtures.createConfirmPaymentBody,
+ createConfirmData,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+ if (!utils.should_continue_further(createConfirmData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Retrieve Payment after Confirm", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Retrieve Payment after Confirm");
+ return;
+ }
+ cy.listCustomerPMCallTest(globalState);
+ });
+
+ cy.step(
+ "Create and Confirm Payment again with updated card holder name in metadata",
+ () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Create and Confirm Payment again with updated card holder name in metadata"
+ );
+ return;
+ }
+ const createConfirmData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["card_pm"]["SaveCardUseNo3DSAutoCapture"];
+ const card_holder_name = generateRandomName();
+ const newData = {
+ ...createConfirmData,
+ Request: {
+ ...createConfirmData.Request,
+ payment_method_data: {
+ card: {
+ ...createConfirmData.Request.payment_method_data.card,
+ card_holder_name: card_holder_name,
+ },
+ },
},
- },
- },
- };
-
- cy.createConfirmPaymentTest(
- fixtures.createConfirmPaymentBody,
- newData,
- "no_three_ds",
- "automatic",
- globalState
+ };
+ cy.createConfirmPaymentTest(
+ fixtures.createConfirmPaymentBody,
+ newData,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+ if (!utils.should_continue_further(createConfirmData)) {
+ shouldContinue = false;
+ }
+ }
);
- if (shouldContinue)
- shouldContinue = utils.should_continue_further(data);
- });
-
- it("retrieve-customerPM-call-test", () => {
- cy.listCustomerPMCallTest(globalState);
+ cy.step("Retrieve Customer Payment Methods", () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Retrieve Customer Payment Methods"
+ );
+ return;
+ }
+ cy.listCustomerPMCallTest(globalState);
+ });
});
}
);
diff --git a/cypress-tests/cypress/e2e/spec/Payment/00017-BankTransfers.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00017-BankTransfers.cy.js
index 6fb154214c..a4f4b7a164 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/00017-BankTransfers.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/00017-BankTransfers.cy.js
@@ -16,227 +16,267 @@ describe("Bank Transfers", () => {
});
context("Bank transfer - Pix forward flow", () => {
- 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"))[
- "bank_transfer_pm"
- ]["PaymentIntent"]("Pix");
-
- cy.createPaymentIntentTest(
- fixtures.createPaymentBody,
- data,
- "three_ds",
- "automatic",
- globalState
- );
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("payment_methods-call-test", () => {
- cy.paymentMethodsCallTest(globalState);
- });
-
- it("Confirm bank transfer", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "bank_transfer_pm"
- ]["Pix"];
-
- cy.confirmBankTransferCallTest(
- fixtures.confirmBody,
- data,
- true,
- globalState
- );
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("Handle bank transfer redirection", () => {
- const expected_redirection = fixtures.confirmBody["return_url"];
- const payment_method_type = globalState.get("paymentMethodType");
-
- cy.handleBankTransferRedirection(
- globalState,
- payment_method_type,
- expected_redirection
- );
+ it("Create Payment Intent for Pix -> List Merchant Payment Methods -> Confirm Bank Transfer for Pix -> Handle Bank Transfer Redirection for Pix", () => {
+ let shouldContinue = true;
+
+ cy.step("Create Payment Intent for Pix", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_transfer_pm"
+ ]["PaymentIntent"]("Pix");
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "three_ds",
+ "automatic",
+ globalState
+ );
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("List Merchant Payment Methods", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: List Merchant Payment Methods");
+ return;
+ }
+ cy.paymentMethodsCallTest(globalState);
+ });
+
+ cy.step("Confirm Bank Transfer for Pix", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Confirm Bank Transfer for Pix");
+ return;
+ }
+ const confirmData = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_transfer_pm"
+ ]["Pix"];
+ cy.confirmBankTransferCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Handle Bank Transfer Redirection for Pix", () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Handle Bank Transfer Redirection for Pix"
+ );
+ return;
+ }
+ const expected_redirection = fixtures.confirmBody["return_url"];
+ const payment_method_type = globalState.get("paymentMethodType");
+ cy.handleBankTransferRedirection(
+ globalState,
+ payment_method_type,
+ expected_redirection
+ );
+ });
});
});
context("Bank transfer - Instant Bank Transfer Finland forward flow", () => {
- 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"))[
- "bank_transfer_pm"
- ]["PaymentIntent"]("InstantBankTransferFinland");
-
- cy.createPaymentIntentTest(
- fixtures.createPaymentBody,
- data,
- "three_ds",
- "automatic",
- globalState
- );
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("payment_methods-call-test", () => {
- cy.paymentMethodsCallTest(globalState);
- });
-
- it("Confirm bank transfer", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "bank_transfer_pm"
- ]["InstantBankTransferFinland"];
-
- cy.confirmBankTransferCallTest(
- fixtures.confirmBody,
- data,
- true,
- globalState
- );
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("Handle bank transfer redirection", () => {
- const expected_redirection = fixtures.confirmBody["return_url"];
- const payment_method_type = globalState.get("paymentMethodType");
-
- cy.handleBankTransferRedirection(
- globalState,
- payment_method_type,
- expected_redirection
- );
+ it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Bank Transfer -> Handle Bank Transfer Redirection ", () => {
+ let shouldContinue = true;
+
+ cy.step("Create Payment Intent ", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_transfer_pm"
+ ]["PaymentIntent"]("InstantBankTransferFinland");
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "three_ds",
+ "automatic",
+ globalState
+ );
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("List Merchant Payment Methods", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: List Merchant Payment Methods");
+ return;
+ }
+ cy.paymentMethodsCallTest(globalState);
+ });
+
+ cy.step("Confirm Bank Transfer ", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Confirm Bank Transfer ");
+ return;
+ }
+ const confirmData = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_transfer_pm"
+ ]["InstantBankTransferFinland"];
+ cy.confirmBankTransferCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Handle Bank Transfer Redirection ", () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Handle Bank Transfer Redirection "
+ );
+ return;
+ }
+ const expected_redirection = fixtures.confirmBody["return_url"];
+ const payment_method_type = globalState.get("paymentMethodType");
+ cy.handleBankTransferRedirection(
+ globalState,
+ payment_method_type,
+ expected_redirection
+ );
+ });
});
});
context("Bank transfer - Instant Bank Transfer Poland forward flow", () => {
- 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"))[
- "bank_transfer_pm"
- ]["PaymentIntent"]("InstantBankTransferPoland");
-
- cy.createPaymentIntentTest(
- fixtures.createPaymentBody,
- data,
- "three_ds",
- "automatic",
- globalState
- );
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("payment_methods-call-test", () => {
- cy.paymentMethodsCallTest(globalState);
- });
-
- it("Confirm bank transfer", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "bank_transfer_pm"
- ]["InstantBankTransferPoland"];
-
- cy.confirmBankTransferCallTest(
- fixtures.confirmBody,
- data,
- true,
- globalState
- );
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("Handle bank transfer redirection", () => {
- const expected_redirection = fixtures.confirmBody["return_url"];
- const payment_method_type = globalState.get("paymentMethodType");
-
- cy.handleBankTransferRedirection(
- globalState,
- payment_method_type,
- expected_redirection
- );
+ it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Bank Transfer -> Handle Bank Transfer Redirection ", () => {
+ let shouldContinue = true;
+
+ cy.step("Create Payment Intent ", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_transfer_pm"
+ ]["PaymentIntent"]("InstantBankTransferPoland");
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "three_ds",
+ "automatic",
+ globalState
+ );
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("List Merchant Payment Methods", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: List Merchant Payment Methods");
+ return;
+ }
+ cy.paymentMethodsCallTest(globalState);
+ });
+
+ cy.step("Confirm Bank Transfer ", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Confirm Bank Transfer ");
+ return;
+ }
+ const confirmData = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_transfer_pm"
+ ]["InstantBankTransferPoland"];
+ cy.confirmBankTransferCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Handle Bank Transfer Redirection ", () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Handle Bank Transfer Redirection "
+ );
+ return;
+ }
+ const expected_redirection = fixtures.confirmBody["return_url"];
+ const payment_method_type = globalState.get("paymentMethodType");
+ cy.handleBankTransferRedirection(
+ globalState,
+ payment_method_type,
+ expected_redirection
+ );
+ });
});
});
context("Bank transfer - Ach flow", () => {
- 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"))[
- "bank_transfer_pm"
- ]["PaymentIntent"]("Ach");
-
- cy.createPaymentIntentTest(
- fixtures.createPaymentBody,
- data,
- "three_ds",
- "automatic",
- globalState
- );
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("payment_methods-call-test", () => {
- cy.paymentMethodsCallTest(globalState);
- });
-
- it("Confirm bank transfer", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "bank_transfer_pm"
- ]["Ach"];
-
- cy.confirmBankTransferCallTest(
- fixtures.confirmBody,
- data,
- true,
- globalState
- );
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("Handle bank transfer redirection", () => {
- const expected_redirection = fixtures.confirmBody["return_url"];
- const payment_method_type = globalState.get("paymentMethodType");
+ it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Bank Transfer -> Handle Bank Transfer Redirection ", () => {
+ let shouldContinue = true;
+
+ cy.step("Create Payment Intent ", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_transfer_pm"
+ ]["PaymentIntent"]("Ach");
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "three_ds",
+ "automatic",
+ globalState
+ );
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("List Merchant Payment Methods", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: List Merchant Payment Methods");
+ return;
+ }
+ cy.paymentMethodsCallTest(globalState);
+ });
+
+ cy.step("Confirm Bank Transfer ", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Confirm Bank Transfer ");
+ return;
+ }
+ const confirmData = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_transfer_pm"
+ ]["Ach"];
+ cy.confirmBankTransferCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
if (globalState.get("connectorId") != "checkbook") {
- cy.handleBankTransferRedirection(
- globalState,
- payment_method_type,
- expected_redirection
- );
+ cy.step("Handle Bank Transfer Redirection ", () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Handle Bank Transfer Redirection "
+ );
+ return;
+ }
+ const expected_redirection = fixtures.confirmBody["return_url"];
+ const payment_method_type = globalState.get("paymentMethodType");
+ cy.handleBankTransferRedirection(
+ globalState,
+ payment_method_type,
+ expected_redirection
+ );
+ });
}
});
});
diff --git a/cypress-tests/cypress/e2e/spec/Payment/00018-BankRedirect.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00018-BankRedirect.cy.js
index 8a6cbe5343..14ff7adc3a 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/00018-BankRedirect.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/00018-BankRedirect.cy.js
@@ -5,500 +5,533 @@ import getConnectorDetails, * as utils from "../../configs/Payment/Utils";
let globalState;
describe("Bank Redirect tests", () => {
+ before("seed global state", () => {
+ cy.task("getGlobalState").then((state) => {
+ globalState = new State(state);
+ });
+ });
+
afterEach("flush global state", () => {
cy.task("setGlobalState", globalState.data);
});
context("Blik Create and Confirm flow test", () => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
-
- before("seed global state", () => {
- cy.task("getGlobalState").then((state) => {
- globalState = new State(state);
+ it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Payment", () => {
+ let shouldContinue = true;
+
+ cy.step("Create Payment Intent", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_redirect_pm"
+ ]["PaymentIntent"]("Blik");
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "three_ds",
+ "automatic",
+ globalState
+ );
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
});
- });
-
- beforeEach(function () {
- if (!shouldContinue) {
- this.skip();
- }
- });
- it("create-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "bank_redirect_pm"
- ]["PaymentIntent"]("Blik");
-
- cy.createPaymentIntentTest(
- fixtures.createPaymentBody,
- data,
- "three_ds",
- "automatic",
- globalState
- );
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("payment_methods-call-test", () => {
- cy.paymentMethodsCallTest(globalState);
- });
-
- it("Confirm bank redirect", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "bank_redirect_pm"
- ]["Blik"];
-
- cy.confirmBankRedirectCallTest(
- fixtures.confirmBody,
- data,
- true,
- globalState
- );
+ cy.step("List Merchant Payment Methods", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: List Merchant Payment Methods");
+ return;
+ }
+ cy.paymentMethodsCallTest(globalState);
+ });
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
+ cy.step("Confirm Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Confirm Payment");
+ return;
+ }
+ const confirmData = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_redirect_pm"
+ ]["Blik"];
+ cy.confirmBankRedirectCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
+ });
});
});
context("EPS Create and Confirm flow test", () => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
-
- before("seed global state", () => {
- cy.task("getGlobalState").then((state) => {
- globalState = new State(state);
+ it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Payment -> Handle Bank Redirect Redirection", () => {
+ let shouldContinue = true;
+
+ cy.step("Create Payment Intent", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_redirect_pm"
+ ]["PaymentIntent"]("Eps");
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "three_ds",
+ "automatic",
+ globalState
+ );
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
});
- });
-
- beforeEach(function () {
- if (!shouldContinue) {
- this.skip();
- }
- });
-
- it("create-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "bank_redirect_pm"
- ]["PaymentIntent"]("Eps");
-
- cy.createPaymentIntentTest(
- fixtures.createPaymentBody,
- data,
- "three_ds",
- "automatic",
- globalState
- );
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("payment_methods-call-test", () => {
- cy.paymentMethodsCallTest(globalState);
- });
-
- it("Confirm bank redirect", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "bank_redirect_pm"
- ]["Eps"];
- cy.confirmBankRedirectCallTest(
- fixtures.confirmBody,
- data,
- true,
- globalState
- );
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
+ cy.step("List Merchant Payment Methods", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: List Merchant Payment Methods");
+ return;
+ }
+ cy.paymentMethodsCallTest(globalState);
+ });
- it("Handle bank redirect redirection", () => {
- // return_url is a static url (https://example.com) taken from confirm-body fixture and is not updated
- const expected_redirection = fixtures.confirmBody["return_url"];
- const payment_method_type = globalState.get("paymentMethodType");
+ cy.step("Confirm Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Confirm Payment");
+ return;
+ }
+ const confirmData = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_redirect_pm"
+ ]["Eps"];
+ cy.confirmBankRedirectCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
- cy.handleBankRedirectRedirection(
- globalState,
- payment_method_type,
- expected_redirection
- );
+ cy.step("Handle Bank Redirect Redirection", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Handle Bank Redirect Redirection");
+ return;
+ }
+ const expected_redirection = fixtures.confirmBody["return_url"];
+ const payment_method_type = globalState.get("paymentMethodType");
+ cy.handleBankRedirectRedirection(
+ globalState,
+ payment_method_type,
+ expected_redirection
+ );
+ });
});
});
context("iDEAL Create and Confirm flow test", () => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
-
- before("seed global state", () => {
- cy.task("getGlobalState").then((state) => {
- globalState = new State(state);
+ it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Payment -> Handle Bank Redirect Redirection", () => {
+ let shouldContinue = true;
+
+ cy.step("Create Payment Intent", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_redirect_pm"
+ ]["PaymentIntent"]("Ideal");
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "three_ds",
+ "automatic",
+ globalState
+ );
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
});
- });
-
- beforeEach(function () {
- if (!shouldContinue) {
- this.skip();
- }
- });
-
- it("create-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "bank_redirect_pm"
- ]["PaymentIntent"]("Ideal");
-
- cy.createPaymentIntentTest(
- fixtures.createPaymentBody,
- data,
- "three_ds",
- "automatic",
- globalState
- );
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("payment_methods-call-test", () => {
- cy.paymentMethodsCallTest(globalState);
- });
-
- it("Confirm bank redirect", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "bank_redirect_pm"
- ]["Ideal"];
- cy.confirmBankRedirectCallTest(
- fixtures.confirmBody,
- data,
- true,
- globalState
- );
+ cy.step("List Merchant Payment Methods", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: List Merchant Payment Methods");
+ return;
+ }
+ cy.paymentMethodsCallTest(globalState);
+ });
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
+ cy.step("Confirm Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Confirm Payment");
+ return;
+ }
+ const confirmData = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_redirect_pm"
+ ]["Ideal"];
+ cy.confirmBankRedirectCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
- it("Handle bank redirect redirection", () => {
- // return_url is a static url (https://example.com) taken from confirm-body fixture and is not updated
- const expected_redirection = fixtures.confirmBody["return_url"];
- const payment_method_type = globalState.get("paymentMethodType");
- cy.handleBankRedirectRedirection(
- globalState,
- payment_method_type,
- expected_redirection
- );
+ cy.step("Handle Bank Redirect Redirection", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Handle Bank Redirect Redirection");
+ return;
+ }
+ const expected_redirection = fixtures.confirmBody["return_url"];
+ const payment_method_type = globalState.get("paymentMethodType");
+ cy.handleBankRedirectRedirection(
+ globalState,
+ payment_method_type,
+ expected_redirection
+ );
+ });
});
});
context("Sofort Create and Confirm flow test", () => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
-
- before("seed global state", () => {
- cy.task("getGlobalState").then((state) => {
- globalState = new State(state);
+ it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Payment -> Handle Bank Redirect Redirection", () => {
+ let shouldContinue = true;
+
+ cy.step("Create Payment Intent", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_redirect_pm"
+ ]["PaymentIntent"]("Sofort");
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "three_ds",
+ "automatic",
+ globalState
+ );
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
});
- });
-
- beforeEach(function () {
- if (!shouldContinue) {
- this.skip();
- }
- });
- it("create-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "bank_redirect_pm"
- ]["PaymentIntent"]("Sofort");
-
- cy.createPaymentIntentTest(
- fixtures.createPaymentBody,
- data,
- "three_ds",
- "automatic",
- globalState
- );
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("payment_methods-call-test", () => {
- cy.paymentMethodsCallTest(globalState);
- });
-
- it("Confirm bank redirect", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "bank_redirect_pm"
- ]["Sofort"];
- cy.confirmBankRedirectCallTest(
- fixtures.confirmBody,
- data,
- true,
- globalState
- );
+ cy.step("List Merchant Payment Methods", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: List Merchant Payment Methods");
+ return;
+ }
+ cy.paymentMethodsCallTest(globalState);
+ });
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
+ cy.step("Confirm Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Confirm Payment");
+ return;
+ }
+ const confirmData = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_redirect_pm"
+ ]["Sofort"];
+ cy.confirmBankRedirectCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
- it("Handle bank redirect redirection", () => {
- // return_url is a static url (https://example.com) taken from confirm-body fixture and is not updated
- const expected_redirection = fixtures.confirmBody["return_url"];
- const payment_method_type = globalState.get("paymentMethodType");
- cy.handleBankRedirectRedirection(
- globalState,
- payment_method_type,
- expected_redirection
- );
+ cy.step("Handle Bank Redirect Redirection", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Handle Bank Redirect Redirection");
+ return;
+ }
+ const expected_redirection = fixtures.confirmBody["return_url"];
+ const payment_method_type = globalState.get("paymentMethodType");
+ cy.handleBankRedirectRedirection(
+ globalState,
+ payment_method_type,
+ expected_redirection
+ );
+ });
});
});
context("Przelewy24 Create and Confirm flow test", () => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
-
- before("seed global state", () => {
- cy.task("getGlobalState").then((state) => {
- globalState = new State(state);
+ it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Payment -> Handle Bank Redirect Redirection", () => {
+ let shouldContinue = true;
+
+ cy.step("Create Payment Intent", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_redirect_pm"
+ ]["PaymentIntent"]("Przelewy24");
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "three_ds",
+ "automatic",
+ globalState
+ );
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
});
- });
- beforeEach(function () {
- if (!shouldContinue) {
- this.skip();
- }
- });
- it("create-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "bank_redirect_pm"
- ]["PaymentIntent"]("Przelewy24");
-
- cy.createPaymentIntentTest(
- fixtures.createPaymentBody,
- data,
- "three_ds",
- "automatic",
- globalState
- );
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("payment_methods-call-test", () => {
- cy.paymentMethodsCallTest(globalState);
- });
-
- it("Confirm bank redirect", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "bank_redirect_pm"
- ]["Przelewy24"];
-
- cy.confirmBankRedirectCallTest(
- fixtures.confirmBody,
- data,
- true,
- globalState
- );
+ cy.step("List Merchant Payment Methods", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: List Merchant Payment Methods");
+ return;
+ }
+ cy.paymentMethodsCallTest(globalState);
+ });
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
+ cy.step("Confirm Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Confirm Payment");
+ return;
+ }
+ const confirmData = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_redirect_pm"
+ ]["Przelewy24"];
+ cy.confirmBankRedirectCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
- it("Handle bank redirect redirection", () => {
- const expected_redirection = fixtures.confirmBody["return_url"];
- const payment_method_type = globalState.get("paymentMethodType");
- cy.handleBankRedirectRedirection(
- globalState,
- payment_method_type,
- expected_redirection
- );
+ cy.step("Handle Bank Redirect Redirection", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Handle Bank Redirect Redirection");
+ return;
+ }
+ const expected_redirection = fixtures.confirmBody["return_url"];
+ const payment_method_type = globalState.get("paymentMethodType");
+ cy.handleBankRedirectRedirection(
+ globalState,
+ payment_method_type,
+ expected_redirection
+ );
+ });
});
});
context("OpenBankingUk Create and Confirm flow test", () => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
-
- before("seed global state", () => {
- cy.task("getGlobalState").then((state) => {
- globalState = new State(state);
+ it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Payment -> Handle Bank Redirect Redirection -> Retrieve Payment", () => {
+ let shouldContinue = true;
+
+ cy.step("Create Payment Intent", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_redirect_pm"
+ ]["PaymentIntent"]("OpenBankingUk");
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "three_ds",
+ "automatic",
+ globalState
+ );
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
});
- });
-
- beforeEach(function () {
- if (!shouldContinue) {
- this.skip();
- }
- });
- it("create-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "bank_redirect_pm"
- ]["PaymentIntent"]("OpenBankingUk");
- cy.createPaymentIntentTest(
- fixtures.createPaymentBody,
- data,
- "three_ds",
- "automatic",
- globalState
- );
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("payment_methods-call-test", () => {
- cy.paymentMethodsCallTest(globalState);
- });
-
- it("Confirm bank redirect", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "bank_redirect_pm"
- ]["OpenBankingUk"];
- cy.confirmBankRedirectCallTest(
- fixtures.confirmBody,
- data,
- true,
- globalState
- );
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
+ cy.step("List Merchant Payment Methods", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: List Merchant Payment Methods");
+ return;
+ }
+ cy.paymentMethodsCallTest(globalState);
+ });
- it("Handle bank redirect redirection", () => {
- const expected_redirection = fixtures.confirmBody["return_url"];
- const payment_method_type = globalState.get("paymentMethodType");
- cy.handleBankRedirectRedirection(
- globalState,
- payment_method_type,
- expected_redirection
- );
- });
+ cy.step("Confirm Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Confirm Payment");
+ return;
+ }
+ const confirmData = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_redirect_pm"
+ ]["OpenBankingUk"];
+ cy.confirmBankRedirectCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
- it("Sync payment status", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "bank_redirect_pm"
- ]["OpenBankingUk"];
+ cy.step("Handle Bank Redirect Redirection", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Handle Bank Redirect Redirection");
+ return;
+ }
+ const expected_redirection = fixtures.confirmBody["return_url"];
+ const payment_method_type = globalState.get("paymentMethodType");
+ cy.handleBankRedirectRedirection(
+ globalState,
+ payment_method_type,
+ expected_redirection
+ );
+ });
- cy.retrievePaymentCallTest({ globalState, data });
+ cy.step("Retrieve Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Retrieve Payment");
+ return;
+ }
+ const confirmData = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_redirect_pm"
+ ]["OpenBankingUk"];
+ cy.retrievePaymentCallTest({ globalState, data: confirmData });
+ });
});
});
context("OnlineBankingFpx Create and Confirm flow test", () => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
-
- before("seed global state", () => {
- cy.task("getGlobalState").then((state) => {
- globalState = new State(state);
+ it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Payment -> Handle Bank Redirect Redirection -> Retrieve Payment", () => {
+ let shouldContinue = true;
+
+ cy.step("Create Payment Intent", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_redirect_pm"
+ ]["PaymentIntent"]("OnlineBankingFpx");
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "three_ds",
+ "automatic",
+ globalState
+ );
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
});
- });
-
- beforeEach(function () {
- if (!shouldContinue) {
- this.skip();
- }
- });
- it("create-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "bank_redirect_pm"
- ]["PaymentIntent"]("OnlineBankingFpx");
-
- cy.createPaymentIntentTest(
- fixtures.createPaymentBody,
- data,
- "three_ds",
- "automatic",
- globalState
- );
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("payment_methods-call-test", () => {
- cy.paymentMethodsCallTest(globalState);
- });
-
- it("Confirm bank redirect", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "bank_redirect_pm"
- ]["OnlineBankingFpx"];
-
- cy.confirmBankRedirectCallTest(
- fixtures.confirmBody,
- data,
- true,
- globalState
- );
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
+ cy.step("List Merchant Payment Methods", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: List Merchant Payment Methods");
+ return;
+ }
+ cy.paymentMethodsCallTest(globalState);
+ });
- it("Handle bank redirect redirection", () => {
- const expected_redirection = fixtures.confirmBody["return_url"];
- const payment_method_type = globalState.get("paymentMethodType");
- cy.handleBankRedirectRedirection(
- globalState,
- payment_method_type,
- expected_redirection
- );
- });
+ cy.step("Confirm Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Confirm Payment");
+ return;
+ }
+ const confirmData = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_redirect_pm"
+ ]["OnlineBankingFpx"];
+ cy.confirmBankRedirectCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
- it("Sync payment status", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "bank_redirect_pm"
- ]["OnlineBankingFpx"];
+ cy.step("Handle Bank Redirect Redirection", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Handle Bank Redirect Redirection");
+ return;
+ }
+ const expected_redirection = fixtures.confirmBody["return_url"];
+ const payment_method_type = globalState.get("paymentMethodType");
+ cy.handleBankRedirectRedirection(
+ globalState,
+ payment_method_type,
+ expected_redirection
+ );
+ });
- cy.retrievePaymentCallTest({ globalState, data });
+ cy.step("Retrieve Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Retrieve Payment");
+ return;
+ }
+ const confirmData = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_redirect_pm"
+ ]["OnlineBankingFpx"];
+ cy.retrievePaymentCallTest({ globalState, data: confirmData });
+ });
});
});
context("Interac Create and Confirm flow test", () => {
- let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
-
- before("seed global state", () => {
- cy.task("getGlobalState").then((state) => {
- globalState = new State(state);
+ it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Payment -> Handle Bank Redirect Redirection -> Retrieve Payment", () => {
+ let shouldContinue = true;
+
+ cy.step("Create Payment Intent", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_redirect_pm"
+ ]["PaymentIntent"]("Interac");
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "three_ds",
+ "automatic",
+ globalState
+ );
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
});
- });
- beforeEach(function () {
- if (!shouldContinue) {
- this.skip();
- }
- });
- it("create-payment-call-test", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "bank_redirect_pm"
- ]["PaymentIntent"]("Interac");
-
- cy.createPaymentIntentTest(
- fixtures.createPaymentBody,
- data,
- "three_ds",
- "automatic",
- globalState
- );
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
-
- it("payment_methods-call-test", () => {
- cy.paymentMethodsCallTest(globalState);
- });
-
- it("Confirm bank redirect", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "bank_redirect_pm"
- ]["Interac"];
-
- cy.confirmBankRedirectCallTest(
- fixtures.confirmBody,
- data,
- true,
- globalState
- );
-
- if (shouldContinue) shouldContinue = utils.should_continue_further(data);
- });
+ cy.step("List Merchant Payment Methods", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: List Merchant Payment Methods");
+ return;
+ }
+ cy.paymentMethodsCallTest(globalState);
+ });
- it("Handle bank redirect redirection", () => {
- // return_url is a static url (https://example.com) taken from confirm-body fixture and is not updated
- const expected_redirection = fixtures.confirmBody["return_url"];
- const payment_method_type = globalState.get("paymentMethodType");
- cy.handleBankRedirectRedirection(
- globalState,
- payment_method_type,
- expected_redirection
- );
- });
+ cy.step("Confirm Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Confirm Payment");
+ return;
+ }
+ const confirmData = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_redirect_pm"
+ ]["Interac"];
+ cy.confirmBankRedirectCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
- it("Sync payment status", () => {
- const data = getConnectorDetails(globalState.get("connectorId"))[
- "bank_redirect_pm"
- ]["Interac"];
+ cy.step("Handle Bank Redirect Redirection", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Handle Bank Redirect Redirection");
+ return;
+ }
+ const expected_redirection = fixtures.confirmBody["return_url"];
+ const payment_method_type = globalState.get("paymentMethodType");
+ cy.handleBankRedirectRedirection(
+ globalState,
+ payment_method_type,
+ expected_redirection
+ );
+ });
- cy.retrievePaymentCallTest({ globalState, data });
+ cy.step("Retrieve Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Retrieve Payment");
+ return;
+ }
+ const confirmData = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_redirect_pm"
+ ]["Interac"];
+ cy.retrievePaymentCallTest({ globalState, data: confirmData });
+ });
});
});
});