diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00003-NoThreeDSAutoCapture.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00003-NoThreeDSAutoCapture.cy.js index e25b074bc1ed..4dc3f2a3e78f 100644 --- a/cypress-tests/cypress/e2e/ConnectorTest/00003-NoThreeDSAutoCapture.cy.js +++ b/cypress-tests/cypress/e2e/ConnectorTest/00003-NoThreeDSAutoCapture.cy.js @@ -3,6 +3,7 @@ import createConfirmPaymentBody from "../../fixtures/create-confirm-body.json"; import createPaymentBody from "../../fixtures/create-payment-body.json"; import State from "../../utils/State"; import getConnectorDetails from "../ConnectorUtils/utils"; +import * as utils from "../ConnectorUtils/utils"; let globalState; @@ -22,10 +23,20 @@ describe("Card - NoThreeDS payment flow test", () => { }) context("Card-NoThreeDS payment flow test Create and confirm", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "automatic", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PaymentIntent"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest(createPaymentBody, req_data, res_data, "no_three_ds", "automatic", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("payment_methods-call-test", () => { @@ -33,8 +44,11 @@ describe("Card - NoThreeDS payment flow test", () => { }); it("Confirm No 3DS", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.confirmCallTest(confirmBody, det, true, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DSAutoCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("retrieve-payment-call-test", () => { @@ -44,11 +58,21 @@ describe("Card - NoThreeDS payment flow test", () => { }); context("Card-NoThreeDS payment flow test Create+Confirm", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); it("create+confirm-payment-call-test", () => { console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.createConfirmPaymentTest(createConfirmPaymentBody, det, "no_three_ds", "automatic", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DSAutoCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createConfirmPaymentTest(createConfirmPaymentBody, req_data, res_data, "no_three_ds", "automatic", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("retrieve-payment-call-test", () => { @@ -57,4 +81,4 @@ describe("Card - NoThreeDS payment flow test", () => { }); -}); \ No newline at end of file +}); diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00004-ThreeDSAutoCapture.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00004-ThreeDSAutoCapture.cy.js index 662739e51969..c970d9716eff 100644 --- a/cypress-tests/cypress/e2e/ConnectorTest/00004-ThreeDSAutoCapture.cy.js +++ b/cypress-tests/cypress/e2e/ConnectorTest/00004-ThreeDSAutoCapture.cy.js @@ -2,10 +2,18 @@ import confirmBody from "../../fixtures/confirm-body.json"; import createPaymentBody from "../../fixtures/create-payment-body.json"; import State from "../../utils/State"; import getConnectorDetails from "../ConnectorUtils/utils"; +import * as utils from "../ConnectorUtils/utils"; let globalState; describe("Card - ThreeDS payment flow test", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); before("seed global state", () => { @@ -25,8 +33,11 @@ describe("Card - ThreeDS payment flow test", () => { it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "three_ds", "automatic", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PaymentIntent"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest(createPaymentBody, req_data, res_data, "three_ds", "automatic", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("payment_methods-call-test", () => { @@ -35,9 +46,12 @@ describe("Card - ThreeDS payment flow test", () => { }); it("Confirm 3DS", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DSAutoCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; cy.task('cli_log', "GLOBAL STATE -> " + JSON.stringify(globalState.data)); - cy.confirmCallTest(confirmBody, det, true, globalState); + cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("Handle redirection", () => { @@ -45,4 +59,4 @@ describe("Card - ThreeDS payment flow test", () => { cy.handleRedirection(globalState, expected_redirection); }) -}); \ No newline at end of file +}); diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00005-NoThreeDSManualCapture.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00005-NoThreeDSManualCapture.cy.js index a0af6897befb..48a22f5a5c03 100644 --- a/cypress-tests/cypress/e2e/ConnectorTest/00005-NoThreeDSManualCapture.cy.js +++ b/cypress-tests/cypress/e2e/ConnectorTest/00005-NoThreeDSManualCapture.cy.js @@ -4,6 +4,7 @@ import createConfirmPaymentBody from "../../fixtures/create-confirm-body.json"; import createPaymentBody from "../../fixtures/create-payment-body.json"; import State from "../../utils/State"; import getConnectorDetails from "../ConnectorUtils/utils"; +import * as utils from "../ConnectorUtils/utils"; let globalState; @@ -25,10 +26,20 @@ describe("Card - NoThreeDS Manual payment flow test", () => { context("Card - NoThreeDS Manual Full Capture payment flow test", () => { context("payment Create and Confirm", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "manual", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PaymentIntent"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest(createPaymentBody, req_data, res_data, "no_three_ds", "manual", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("payment_methods-call-test", () => { @@ -37,9 +48,12 @@ describe("Card - NoThreeDS Manual payment flow test", () => { it("confirm-call-test", () => { console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - console.log("det -> " + det.card); - cy.confirmCallTest(confirmBody, det, true, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DSManualCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("retrieve-payment-call-test", () => { @@ -47,9 +61,12 @@ describe("Card - NoThreeDS Manual payment flow test", () => { }); it("capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - console.log("det -> " + det.card); - cy.captureCallTest(captureBody, 6500, det.paymentSuccessfulStatus, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["Capture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("retrieve-payment-call-test", () => { @@ -59,11 +76,22 @@ describe("Card - NoThreeDS Manual payment flow test", () => { }); context("Payment Create+Confirm", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); + it("create+confirm-payment-call-test", () => { console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - console.log("det -> " + det.card); - cy.createConfirmPaymentTest(createConfirmPaymentBody, det, "no_three_ds", "manual", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DSManualCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.createConfirmPaymentTest(createConfirmPaymentBody, req_data, res_data, "no_three_ds", "manual", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("retrieve-payment-call-test", () => { @@ -71,9 +99,12 @@ describe("Card - NoThreeDS Manual payment flow test", () => { }); it("capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - console.log("det -> " + det.card); - cy.captureCallTest(captureBody, 6540, det.paymentSuccessfulStatus, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["Capture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("retrieve-payment-call-test", () => { @@ -87,10 +118,20 @@ describe("Card - NoThreeDS Manual payment flow test", () => { context("Card - NoThreeDS Manual Partial Capture payment flow test - Create and Confirm", () => { context("payment Create and Payment Confirm", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "manual", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PaymentIntent"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest(createPaymentBody, req_data, res_data, "no_three_ds", "manual", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("payment_methods-call-test", () => { @@ -99,9 +140,12 @@ describe("Card - NoThreeDS Manual payment flow test", () => { it("confirm-call-test", () => { console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - console.log("det -> " + det.card); - cy.confirmCallTest(confirmBody, det, true, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DSManualCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("retrieve-payment-call-test", () => { @@ -109,8 +153,11 @@ describe("Card - NoThreeDS Manual payment flow test", () => { }); it("capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.captureCallTest(captureBody, 100, det.paymentSuccessfulStatus, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PartialCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.captureCallTest(captureBody, req_data, res_data, 100, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("retrieve-payment-call-test", () => { @@ -119,11 +166,22 @@ describe("Card - NoThreeDS Manual payment flow test", () => { }); context("payment + Confirm", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); + it("create+confirm-payment-call-test", () => { console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - console.log("det -> " + det.card); - cy.createConfirmPaymentTest(createConfirmPaymentBody, det, "no_three_ds", "manual", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DSManualCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.createConfirmPaymentTest(createConfirmPaymentBody, req_data, res_data, "no_three_ds", "manual", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("retrieve-payment-call-test", () => { @@ -131,9 +189,12 @@ describe("Card - NoThreeDS Manual payment flow test", () => { }); it("capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - console.log("det -> " + det.card); - cy.captureCallTest(captureBody, 5000, det.paymentSuccessfulStatus, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PartialCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.captureCallTest(captureBody, req_data, res_data, 100, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("retrieve-payment-call-test", () => { @@ -144,4 +205,4 @@ describe("Card - NoThreeDS Manual payment flow test", () => { }); -}); \ No newline at end of file +}); diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00006-VoidPayment.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00006-VoidPayment.cy.js index 61a27763134b..15f2e0e7930a 100644 --- a/cypress-tests/cypress/e2e/ConnectorTest/00006-VoidPayment.cy.js +++ b/cypress-tests/cypress/e2e/ConnectorTest/00006-VoidPayment.cy.js @@ -3,6 +3,7 @@ import createPaymentBody from "../../fixtures/create-payment-body.json"; import voidBody from "../../fixtures/void-payment-body.json"; import State from "../../utils/State"; import getConnectorDetails from "../ConnectorUtils/utils"; +import * as utils from "../ConnectorUtils/utils"; let globalState; @@ -22,9 +23,20 @@ describe("Card - NoThreeDS Manual payment flow test", () => { }) context("Card - void payment in Requires_capture state flow test", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); + it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "manual", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PaymentIntent"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest(createPaymentBody, req_data, res_data, "no_three_ds", "manual", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("payment_methods-call-test", () => { @@ -33,20 +45,38 @@ describe("Card - NoThreeDS Manual payment flow test", () => { it("confirm-call-test", () => { console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - console.log("det -> " + det.card); - cy.confirmCallTest(confirmBody, det, true, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DSManualCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("void-call-test", () => { - cy.voidCallTest(voidBody, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["Void"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.voidCallTest(voidBody, req_data, res_data, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); }); context("Card - void payment in Requires_payment_method state flow test", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); + it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "manual", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PaymentIntent"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest(createPaymentBody, req_data, res_data, "no_three_ds", "manual", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("payment_methods-call-test", () => { @@ -54,14 +84,28 @@ describe("Card - NoThreeDS Manual payment flow test", () => { }); it("void-call-test", () => { - cy.voidCallTest(voidBody, globalState); - }); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["Void"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.voidCallTest(voidBody, req_data, res_data, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); }); context("Card - void payment in Requires_payment_method state flow test", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); + it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "manual", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PaymentIntent"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest(createPaymentBody, req_data, res_data, "no_three_ds", "manual", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("payment_methods-call-test", () => { @@ -70,13 +114,19 @@ describe("Card - NoThreeDS Manual payment flow test", () => { it("confirm-call-test", () => { console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - console.log("det -> " + det.card); - cy.confirmCallTest(confirmBody, det, false, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DSManualCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.confirmCallTest(confirmBody, req_data, res_data, false, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("void-call-test", () => { - cy.voidCallTest(voidBody, globalState); - }); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["Void"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.voidCallTest(voidBody, req_data, res_data, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); }); -}); \ No newline at end of file +}); diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00007-SyncPayment.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00007-SyncPayment.cy.js index efdeeb8da2d4..10c16f7ff6e9 100644 --- a/cypress-tests/cypress/e2e/ConnectorTest/00007-SyncPayment.cy.js +++ b/cypress-tests/cypress/e2e/ConnectorTest/00007-SyncPayment.cy.js @@ -2,10 +2,18 @@ import confirmBody from "../../fixtures/confirm-body.json"; import createPaymentBody from "../../fixtures/create-payment-body.json"; import State from "../../utils/State"; import getConnectorDetails from "../ConnectorUtils/utils"; +import * as utils from "../ConnectorUtils/utils"; let globalState; describe("Card - Sync payment flow test", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); before("seed global state", () => { @@ -20,8 +28,11 @@ describe("Card - Sync payment flow test", () => { cy.task('setGlobalState', globalState.data); }) it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "automatic", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PaymentIntent"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest(createPaymentBody, req_data, res_data, "no_three_ds", "automatic", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("payment_methods-call-test", () => { @@ -30,13 +41,16 @@ describe("Card - Sync payment flow test", () => { it("confirm-call-test", () => { console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - console.log("det -> " + det.card); - cy.confirmCallTest(confirmBody, det, true, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DSAutoCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("retrieve-payment-call-test", () => { cy.retrievePaymentCallTest(globalState); }); -}); \ No newline at end of file +}); diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00008-RefundPayment.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00008-RefundPayment.cy.js index 68ce768b417e..dfdd0df21d17 100644 --- a/cypress-tests/cypress/e2e/ConnectorTest/00008-RefundPayment.cy.js +++ b/cypress-tests/cypress/e2e/ConnectorTest/00008-RefundPayment.cy.js @@ -8,6 +8,7 @@ import refundBody from "../../fixtures/refund-flow-body.json"; import listRefundCall from "../../fixtures/list-refund-call-body.json"; import State from "../../utils/State"; import getConnectorDetails from "../ConnectorUtils/utils"; +import * as utils from "../ConnectorUtils/utils"; let globalState; @@ -27,10 +28,20 @@ describe("Card - Refund flow test", () => { }) context("Card - Full Refund flow test for No-3DS", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "automatic", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PaymentIntent"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest(createPaymentBody, req_data, res_data, "no_three_ds", "automatic", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("payment_methods-call-test", () => { @@ -39,26 +50,43 @@ describe("Card - Refund flow test", () => { it("confirm-call-test", () => { console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - console.log("det -> " + det.card); - cy.confirmCallTest(confirmBody, det, true, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DSAutoCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("retrieve-payment-call-test", () => { + cy.retrievePaymentCallTest(globalState); }); it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.refundCallTest(refundBody, 6500, det, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["Refund"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.refundCallTest(refundBody, req_data, res_data, 6500, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); }); context("Card - Partial Refund flow test for No-3DS", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "automatic", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PaymentIntent"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest(createPaymentBody, req_data, res_data, "no_three_ds", "automatic", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("payment_methods-call-test", () => { @@ -67,9 +95,12 @@ describe("Card - Refund flow test", () => { it("confirm-call-test", () => { console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - console.log("det -> " + det.card); - cy.confirmCallTest(confirmBody, det, true, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DSAutoCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("retrieve-payment-call-test", () => { @@ -77,22 +108,38 @@ describe("Card - Refund flow test", () => { }); it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.refundCallTest(refundBody, 1200, det, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PartialRefund"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.refundCallTest(refundBody, req_data, res_data, 1200, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.refundCallTest(refundBody, 1200, det, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PartialRefund"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.refundCallTest(refundBody, req_data, res_data, 1200, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); }); context("Fully Refund Card-NoThreeDS payment flow test Create+Confirm", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); it("create+confirm-payment-call-test", () => { console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.createConfirmPaymentTest( createConfirmPaymentBody, det,"no_three_ds", "automatic", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DSAutoCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createConfirmPaymentTest( createConfirmPaymentBody, req_data, res_data,"no_three_ds", "automatic", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("retrieve-payment-call-test", () => { @@ -100,18 +147,31 @@ describe("Card - Refund flow test", () => { }); it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.refundCallTest(refundBody, 6540, det, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["Refund"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.refundCallTest(refundBody, req_data, res_data, 6500, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); }); context("Partially Refund Card-NoThreeDS payment flow test Create+Confirm", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); it("create+confirm-payment-call-test", () => { console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.createConfirmPaymentTest( createConfirmPaymentBody, det,"no_three_ds", "automatic", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DSAutoCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createConfirmPaymentTest( createConfirmPaymentBody, req_data, res_data,"no_three_ds", "automatic", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("retrieve-payment-call-test", () => { @@ -119,27 +179,45 @@ describe("Card - Refund flow test", () => { }); it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.refundCallTest(refundBody, 3000, det, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PartialRefund"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.refundCallTest(refundBody, req_data, res_data, 3000, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.refundCallTest(refundBody, 3000, det, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PartialRefund"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.refundCallTest(refundBody, req_data, res_data, 3000, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("sync-refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.syncRefundCallTest(det, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["SyncRefund"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.syncRefundCallTest(req_data, res_data, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); - }); - + context("Card - Full Refund for fully captured No-3DS payment", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "manual", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PaymentIntent"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest(createPaymentBody, req_data, res_data, "no_three_ds", "manual", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("payment_methods-call-test", () => { @@ -148,9 +226,12 @@ describe("Card - Refund flow test", () => { it("confirm-call-test", () => { console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - console.log("det -> " + det.card); - cy.confirmCallTest(confirmBody, det, true, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DSManualCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("retrieve-payment-call-test", () => { @@ -158,9 +239,12 @@ describe("Card - Refund flow test", () => { }); it("capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - console.log("det -> " + det.card); - cy.captureCallTest(captureBody, 6500, det.paymentSuccessfulStatus, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["Capture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("retrieve-payment-call-test", () => { @@ -168,21 +252,37 @@ describe("Card - Refund flow test", () => { }); it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.refundCallTest(refundBody, 6500, det, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["Refund"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.refundCallTest(refundBody, req_data, res_data, 6500, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("sync-refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.syncRefundCallTest(det, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["SyncRefund"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.syncRefundCallTest(req_data, res_data, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); }); context("Card - Partial Refund for fully captured No-3DS payment", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "manual", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PaymentIntent"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest(createPaymentBody, req_data, res_data, "no_three_ds", "manual", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("payment_methods-call-test", () => { @@ -191,9 +291,12 @@ describe("Card - Refund flow test", () => { it("confirm-call-test", () => { console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - console.log("det -> " + det.card); - cy.confirmCallTest(confirmBody, det, true, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DSManualCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("retrieve-payment-call-test", () => { @@ -201,9 +304,12 @@ describe("Card - Refund flow test", () => { }); it("capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - console.log("det -> " + det.card); - cy.captureCallTest(captureBody, 6500, det.paymentSuccessfulStatus, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["Capture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("retrieve-payment-call-test", () => { @@ -211,17 +317,26 @@ describe("Card - Refund flow test", () => { }); it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.refundCallTest(refundBody, 5000, det, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PartialRefund"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.refundCallTest(refundBody, req_data, res_data, 3000, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.refundCallTest(refundBody, 500, det, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PartialRefund"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.refundCallTest(refundBody, req_data, res_data, 3000, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("sync-refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.syncRefundCallTest(det, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["SyncRefund"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.syncRefundCallTest(req_data, res_data, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("list-refund-call-test", () => { cy.listRefundCallTest(listRefundCall, globalState); @@ -229,10 +344,20 @@ describe("Card - Refund flow test", () => { }); context("Card - Full Refund for partially captured No-3DS payment", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "manual", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PaymentIntent"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest(createPaymentBody, req_data, res_data, "no_three_ds", "manual", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("payment_methods-call-test", () => { @@ -241,9 +366,12 @@ describe("Card - Refund flow test", () => { it("confirm-call-test", () => { console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - console.log("det -> " + det.card); - cy.confirmCallTest(confirmBody, det, true, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DSManualCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("retrieve-payment-call-test", () => { @@ -251,9 +379,12 @@ describe("Card - Refund flow test", () => { }); it("capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - console.log("det -> " + det.card); - cy.captureCallTest(captureBody, 4000, det.paymentSuccessfulStatus, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PartialCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.captureCallTest(captureBody, req_data, res_data, 100, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("retrieve-payment-call-test", () => { @@ -261,21 +392,38 @@ describe("Card - Refund flow test", () => { }); it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.refundCallTest(refundBody, 4000, det, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["Refund"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.refundCallTest(refundBody, req_data, res_data, 100, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); + }); it("sync-refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.syncRefundCallTest(det, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["SyncRefund"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.syncRefundCallTest(req_data, res_data, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); }); context("Card - partial Refund for partially captured No-3DS payment", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "manual", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PaymentIntent"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest(createPaymentBody, req_data, res_data, "no_three_ds", "manual", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("payment_methods-call-test", () => { @@ -284,9 +432,12 @@ describe("Card - Refund flow test", () => { it("confirm-call-test", () => { console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - console.log("det -> " + det.card); - cy.confirmCallTest(confirmBody, det, true, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DSManualCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("retrieve-payment-call-test", () => { @@ -294,9 +445,12 @@ describe("Card - Refund flow test", () => { }); it("capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - console.log("det -> " + det.card); - cy.captureCallTest(captureBody, 4000, det.paymentSuccessfulStatus, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PartialCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.captureCallTest(captureBody, req_data, res_data, 100, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("retrieve-payment-call-test", () => { @@ -304,22 +458,38 @@ describe("Card - Refund flow test", () => { }); it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.refundCallTest(refundBody, 3000, det, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PartialRefund"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.refundCallTest(refundBody, req_data, res_data, 100, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("sync-refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.syncRefundCallTest(det, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["SyncRefund"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.syncRefundCallTest(req_data, res_data, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); }); context("Card - Full Refund for Create + Confirm Automatic CIT and MIT payment flow test", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); it("Confirm No 3DS CIT", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["MandateMultiUseNo3DS"]; - console.log("det -> " + det.card); - cy.citForMandatesCallTest(citConfirmBody, 7000, det, true, "automatic", "new_mandate", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["MandateMultiUseNo3DSAutoCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + req_data.card); + cy.citForMandatesCallTest(citConfirmBody, req_data, res_data, 7000, true, "automatic", "new_mandate", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("Confirm No 3DS MIT", () => { @@ -331,24 +501,41 @@ describe("Card - Refund flow test", () => { }); it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["MandateMultiUseNo3DS"]; - cy.refundCallTest(refundBody, 7000, det, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["Refund"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.refundCallTest(refundBody, req_data, res_data, 7000, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("sync-refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["MandateMultiUseNo3DS"]; - cy.syncRefundCallTest(det, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["SyncRefund"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.syncRefundCallTest(req_data, res_data, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); }); }); - context("Card - Full Refund flow test for 3DS", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); + it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "three_ds", "automatic", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PaymentIntent"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest(createPaymentBody, req_data, res_data, "three_ds", "automatic", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); + }); it("payment_methods-call-test", () => { @@ -356,9 +543,12 @@ describe("Card - Refund flow test", () => { }); it("Confirm 3DS", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.task('cli_log', "GLOBAL STATE -> " + JSON.stringify(globalState.data)); - cy.confirmCallTest(confirmBody, det, true, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DSAutoCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("Handle redirection", () => { @@ -371,16 +561,30 @@ describe("Card - Refund flow test", () => { }); it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.refundCallTest(refundBody, 6500, det, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["Refund"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.refundCallTest(refundBody, req_data, res_data, 6500, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); }); context("Card - Partial Refund flow test for 3DS", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); + it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "three_ds", "automatic", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PaymentIntent"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest(createPaymentBody, req_data, res_data, "three_ds", "automatic", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("payment_methods-call-test", () => { @@ -388,9 +592,12 @@ describe("Card - Refund flow test", () => { }); it("Confirm 3DS", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.task('cli_log', "GLOBAL STATE -> " + JSON.stringify(globalState.data)); - cy.confirmCallTest(confirmBody, det, true, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DSAutoCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("Handle redirection", () => { @@ -403,22 +610,38 @@ describe("Card - Refund flow test", () => { }); it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.refundCallTest(refundBody, 1200, det, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PartialRefund"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.refundCallTest(refundBody, req_data, res_data, 1200, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.refundCallTest(refundBody, 1200, det, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PartialRefund"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.refundCallTest(refundBody, req_data, res_data, 1200, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); }); context("Fully Refund Card-ThreeDS payment flow test Create+Confirm", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); + it("create+confirm-payment-call-test", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.createConfirmPaymentTest( createConfirmPaymentBody, det,"three_ds", "automatic", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DSAutoCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createConfirmPaymentTest(createConfirmPaymentBody, req_data, res_data, "three_ds", "automatic", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("Handle redirection", () => { @@ -431,17 +654,31 @@ describe("Card - Refund flow test", () => { }); it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.refundCallTest(refundBody, 6540, det, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["Refund"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.refundCallTest(refundBody, req_data, res_data, 6500, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); }); context("Partially Refund Card-ThreeDS payment flow test Create+Confirm", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); + it("create+confirm-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.createConfirmPaymentTest( createConfirmPaymentBody, det,"three_ds", "automatic", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DSAutoCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createConfirmPaymentTest(createConfirmPaymentBody, req_data, res_data, "three_ds", "automatic", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("Handle redirection", () => { @@ -454,38 +691,61 @@ describe("Card - Refund flow test", () => { }); it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.refundCallTest(refundBody, 3000, det, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PartialRefund"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.refundCallTest(refundBody, req_data, res_data, 3000, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.refundCallTest(refundBody, 3000, det, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PartialRefund"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.refundCallTest(refundBody, req_data, res_data, 3000, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("sync-refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.syncRefundCallTest(det, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["SyncRefund"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.syncRefundCallTest(req_data, res_data, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); }); context("Card - Full Refund for fully captured 3DS payment", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); + it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "three_ds", "manual", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PaymentIntent"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest(createPaymentBody, req_data, res_data, "three_ds", "manual", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("payment_methods-call-test", () => { cy.paymentMethodsCallTest(globalState); }); - - it("confirm-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.confirmCallTest(confirmBody, det, true, globalState); - }); + it("Confirm 3DS", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DSManualCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); + }); it("Handle redirection", () => { let expected_redirection = confirmBody["return_url"]; @@ -498,8 +758,12 @@ describe("Card - Refund flow test", () => { }); it("capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.captureCallTest(captureBody, 6500, det.paymentSuccessfulStatus, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["Capture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); + }); it("retrieve-payment-call-test", () => { @@ -507,44 +771,63 @@ describe("Card - Refund flow test", () => { }); it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.refundCallTest(refundBody, 6500, det, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["Refund"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.refundCallTest(refundBody, req_data, res_data, 6500, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); - it("sync-refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.syncRefundCallTest(det, globalState); - }); }); context("Card - Partial Refund for fully captured 3DS payment", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); + it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "three_ds", "manual", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PaymentIntent"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest(createPaymentBody, req_data, res_data, "three_ds", "manual", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("payment_methods-call-test", () => { cy.paymentMethodsCallTest(globalState); }); - it("confirm-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.confirmCallTest(confirmBody, det, true, globalState); - }); + it("Confirm 3DS", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DSManualCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); + }); it("Handle redirection", () => { let expected_redirection = confirmBody["return_url"]; cy.handleRedirection(globalState, expected_redirection); }) + it("retrieve-payment-call-test", () => { cy.retrievePaymentCallTest(globalState); }); it("capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.captureCallTest(captureBody, 6500, det.paymentSuccessfulStatus, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["Capture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); + }); it("retrieve-payment-call-test", () => { @@ -552,49 +835,71 @@ describe("Card - Refund flow test", () => { }); it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.refundCallTest(refundBody, 5000, det, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["Refund"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.refundCallTest(refundBody, req_data, res_data, 5000, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.refundCallTest(refundBody, 500, det, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["Refund"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.refundCallTest(refundBody, req_data, res_data, 1500, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); - it("sync-refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.syncRefundCallTest(det, globalState); - }); }); context("Card - Full Refund for partially captured 3DS payment", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); + it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "three_ds", "manual", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PaymentIntent"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest(createPaymentBody, req_data, res_data, "three_ds", "manual", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("payment_methods-call-test", () => { cy.paymentMethodsCallTest(globalState); }); - it("confirm-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.confirmCallTest(confirmBody, det, true, globalState); - }); + it("Confirm 3DS", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DSManualCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); + }); it("Handle redirection", () => { let expected_redirection = confirmBody["return_url"]; cy.handleRedirection(globalState, expected_redirection); }) + it("retrieve-payment-call-test", () => { cy.retrievePaymentCallTest(globalState); }); it("capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.captureCallTest(captureBody, 4000, det.paymentSuccessfulStatus, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PartialCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.captureCallTest(captureBody, req_data, res_data, 100, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); + }); it("retrieve-payment-call-test", () => { @@ -602,58 +907,75 @@ describe("Card - Refund flow test", () => { }); it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.refundCallTest(refundBody, 4000, det, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["Refund"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.refundCallTest(refundBody, req_data, res_data, 100, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); - it("sync-refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.syncRefundCallTest(det, globalState); - }); + }); context("Card - partial Refund for partially captured 3DS payment", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); + it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "three_ds", "manual", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PaymentIntent"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest(createPaymentBody, req_data, res_data, "three_ds", "manual", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); - + it("payment_methods-call-test", () => { cy.paymentMethodsCallTest(globalState); }); - - it("confirm-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.confirmCallTest(confirmBody, det, true, globalState); - }); + + it("Confirm 3DS", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DSManualCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); + }); it("Handle redirection", () => { let expected_redirection = confirmBody["return_url"]; cy.handleRedirection(globalState, expected_redirection); }) - + + it("retrieve-payment-call-test", () => { cy.retrievePaymentCallTest(globalState); }); - + it("capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.captureCallTest(captureBody, 4000, det.paymentSuccessfulStatus, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PartialCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.captureCallTest(captureBody, req_data, res_data, 100, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); + }); - + it("retrieve-payment-call-test", () => { cy.retrievePaymentCallTest(globalState); }); - + it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.refundCallTest(refundBody, 3000, det, globalState); - }); - - it("sync-refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.syncRefundCallTest(det, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["Refund"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.refundCallTest(refundBody, req_data, res_data, 50 , globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); }); - diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00009-SyncRefund.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00009-SyncRefund.cy.js index 6bf9639da263..31e5e6855d6a 100644 --- a/cypress-tests/cypress/e2e/ConnectorTest/00009-SyncRefund.cy.js +++ b/cypress-tests/cypress/e2e/ConnectorTest/00009-SyncRefund.cy.js @@ -3,10 +3,18 @@ import createPaymentBody from "../../fixtures/create-payment-body.json"; import refundBody from "../../fixtures/refund-flow-body.json"; import State from "../../utils/State"; import getConnectorDetails from "../ConnectorUtils/utils"; +import * as utils from "../ConnectorUtils/utils"; let globalState; describe("Card - Sync Refund flow test", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); before("seed global state", () => { @@ -22,8 +30,11 @@ describe("Card - Sync Refund flow test", () => { }) it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "automatic", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PaymentIntent"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest(createPaymentBody, req_data, res_data, "no_three_ds", "automatic", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("payment_methods-call-test", () => { @@ -32,9 +43,12 @@ describe("Card - Sync Refund flow test", () => { it("confirm-call-test", () => { console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - console.log("det -> " + det.card); - cy.confirmCallTest(confirmBody, det, true, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DSAutoCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("retrieve-payment-call-test", () => { @@ -42,13 +56,19 @@ describe("Card - Sync Refund flow test", () => { }); it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.refundCallTest(refundBody, 6500, det, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["Refund"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.refundCallTest(refundBody, req_data, res_data, 6500, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("sync-refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; - cy.syncRefundCallTest(det, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["SyncRefund"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.syncRefundCallTest(req_data, res_data, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); -}); \ No newline at end of file +}); diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00010-CreateSingleuseMandate.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00010-CreateSingleuseMandate.cy.js index bd795d8a38b3..4ece0319324e 100644 --- a/cypress-tests/cypress/e2e/ConnectorTest/00010-CreateSingleuseMandate.cy.js +++ b/cypress-tests/cypress/e2e/ConnectorTest/00010-CreateSingleuseMandate.cy.js @@ -3,6 +3,7 @@ import citConfirmBody from "../../fixtures/create-mandate-cit.json"; import mitConfirmBody from "../../fixtures/create-mandate-mit.json"; import State from "../../utils/State"; import getConnectorDetails from "../ConnectorUtils/utils"; +import * as utils from "../ConnectorUtils/utils"; let globalState; @@ -22,12 +23,22 @@ describe("Card - SingleUse Mandates flow test", () => { }) context("Card - NoThreeDS Create + Confirm Automatic CIT and MIT payment flow test", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); it("Confirm No 3DS CIT", () => { console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["MandateSingleUseNo3DS"]; - console.log("det -> " + det.card); - cy.citForMandatesCallTest(citConfirmBody, 7000, det, true, "automatic", "new_mandate", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["MandateSingleUseNo3DSAutoCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.citForMandatesCallTest(citConfirmBody, req_data, res_data, 7000, true, "automatic", "new_mandate", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("Confirm No 3DS MIT", () => { @@ -36,28 +47,44 @@ describe("Card - SingleUse Mandates flow test", () => { }); context("Card - NoThreeDS Create + Confirm Manual CIT and MIT payment flow test", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); it("Confirm No 3DS CIT", () => { console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["MandateSingleUseNo3DS"]; - console.log("det -> " + det.card); - cy.citForMandatesCallTest(citConfirmBody, 7000, det, true, "manual", "new_mandate", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["MandateSingleUseNo3DSManualCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.citForMandatesCallTest(citConfirmBody, req_data, res_data, 6500, true, "manual", "new_mandate", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("cit-capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["MandateSingleUseNo3DS"]; - console.log("det -> " + det.card); - cy.captureCallTest(captureBody, 7000, det.paymentSuccessfulStatus, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["Capture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("Confirm No 3DS MIT", () => { - cy.mitForMandatesCallTest(mitConfirmBody, 7000, true, "manual", globalState); + cy.mitForMandatesCallTest(mitConfirmBody, 6500, true, "manual", globalState); }); it("mit-capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["MandateSingleUseNo3DS"]; - console.log("det -> " + det.card); - cy.captureCallTest(captureBody, 7000, det.paymentSuccessfulStatus, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["Capture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("list-mandate-call-test", () => { @@ -65,19 +92,32 @@ describe("Card - SingleUse Mandates flow test", () => { }); }); - context.skip("Card - ThreeDS Create + Confirm Manual CIT and MIT payment flow test", () => { + context("Card - ThreeDS Create + Confirm Manual CIT and MIT payment flow test", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails - it("Confirm No 3DS CIT", () => { + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); + + it("Create No 3DS CIT", () => { console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["MandateSingleUse3DS"]; - console.log("det -> " + det.card); - cy.citForMandatesCallTest(citConfirmBody, 6500, det, true, "automatic", "new_mandate", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["MandateSingleUseNo3DSManualCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.citForMandatesCallTest(citConfirmBody, req_data, res_data, 6500, true, "manual", "new_mandate", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("cit-capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["MandateSingleUse3DS"]; - console.log("det -> " + det.card); - cy.captureCallTest(captureBody, 6500, det.paymentSuccessfulStatus, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["Capture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("Confirm No 3DS MIT", () => { @@ -88,4 +128,4 @@ describe("Card - SingleUse Mandates flow test", () => { cy.listMandateCallTest(globalState); }); }); -}); \ No newline at end of file +}); diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00011-CreateMultiuseMandate.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00011-CreateMultiuseMandate.cy.js index 474024a1bcb7..898258c8d6a3 100644 --- a/cypress-tests/cypress/e2e/ConnectorTest/00011-CreateMultiuseMandate.cy.js +++ b/cypress-tests/cypress/e2e/ConnectorTest/00011-CreateMultiuseMandate.cy.js @@ -3,6 +3,7 @@ import citConfirmBody from "../../fixtures/create-mandate-cit.json"; import mitConfirmBody from "../../fixtures/create-mandate-mit.json"; import State from "../../utils/State"; import getConnectorDetails from "../ConnectorUtils/utils"; +import * as utils from "../ConnectorUtils/utils"; let globalState; @@ -23,12 +24,22 @@ describe("Card - MultiUse Mandates flow test", () => { context("Card - NoThreeDS Create + Confirm Automatic CIT and MIT payment flow test", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); it("Confirm No 3DS CIT", () => { console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["MandateMultiUseNo3DS"]; - console.log("det -> " + det.card); - cy.citForMandatesCallTest(citConfirmBody, 7000, det, true, "automatic", "new_mandate", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["MandateMultiUseNo3DSAutoCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.citForMandatesCallTest(citConfirmBody, req_data, res_data, 7000, true, "automatic", "new_mandate", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("Confirm No 3DS MIT", () => { @@ -40,58 +51,90 @@ describe("Card - MultiUse Mandates flow test", () => { }); context("Card - NoThreeDS Create + Confirm Manual CIT and MIT payment flow test", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); it("Confirm No 3DS CIT", () => { console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["MandateMultiUseNo3DS"]; - console.log("det -> " + det.card); - cy.citForMandatesCallTest(citConfirmBody, 7000, det, true, "manual", "new_mandate", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["MandateMultiUseNo3DSManualCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.citForMandatesCallTest(citConfirmBody, req_data, res_data, 6500, true, "manual", "new_mandate", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("cit-capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["MandateMultiUseNo3DS"]; - console.log("det -> " + det.card); - cy.captureCallTest(captureBody, 7000, det.paymentSuccessfulStatus, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["Capture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("Confirm No 3DS MIT 1", () => { - cy.mitForMandatesCallTest(mitConfirmBody, 7000, true, "manual", globalState); + cy.mitForMandatesCallTest(mitConfirmBody, 6500, true, "manual", globalState); }); it("mit-capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["MandateMultiUseNo3DS"]; - console.log("det -> " + det.card); - cy.captureCallTest(captureBody, 7000, det.paymentSuccessfulStatus, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["Capture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("Confirm No 3DS MIT 2", () => { - cy.mitForMandatesCallTest(mitConfirmBody, 7000, true, "manual", globalState); + cy.mitForMandatesCallTest(mitConfirmBody, 6500, true, "manual", globalState); }); it("mit-capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["MandateMultiUseNo3DS"]; - console.log("det -> " + det.card); - cy.captureCallTest(captureBody, 7000, det.paymentSuccessfulStatus, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["Capture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); }); - context.skip("Card - ThreeDS Create + Confirm Manual CIT and MIT payment flow test", () => { + context("Card - ThreeDS Create + Confirm Manual CIT and MIT payment flow test", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); it("Confirm No 3DS CIT", () => { console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["MandateMultiUse3DS"]; - console.log("det -> " + det.card); - cy.citForMandatesCallTest(citConfirmBody, 6500, det, true, "automatic", "new_mandate", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["MandateMultiUseNo3DSManualCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.citForMandatesCallTest(citConfirmBody, req_data, res_data, 6500, true, "manual", "new_mandate", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("cit-capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["MandateMultiUse3DS"]; - console.log("det -> " + det.card); - cy.captureCallTest(captureBody, 6500, det.paymentSuccessfulStatus, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["Capture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("Confirm No 3DS MIT", () => { - cy.mitForMandatesCallTest(mitConfirmBody, 7000, true, "automatic", globalState); + cy.mitForMandatesCallTest(mitConfirmBody, 6500, true, "automatic", globalState); }); }); -}); \ No newline at end of file +}); diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00012-ListAndRevokeMandate.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00012-ListAndRevokeMandate.cy.js index 8504f602cc5d..8de48fbf95a4 100644 --- a/cypress-tests/cypress/e2e/ConnectorTest/00012-ListAndRevokeMandate.cy.js +++ b/cypress-tests/cypress/e2e/ConnectorTest/00012-ListAndRevokeMandate.cy.js @@ -1,6 +1,7 @@ import citConfirmBody from "../../fixtures/create-mandate-cit.json"; import mitConfirmBody from "../../fixtures/create-mandate-mit.json"; import getConnectorDetails from "../ConnectorUtils/utils"; +import * as utils from "../ConnectorUtils/utils"; import State from "../../utils/State"; @@ -22,12 +23,22 @@ describe("Card - SingleUse Mandates flow test", () => { }) context("Card - NoThreeDS Create + Confirm Automatic CIT and MIT payment flow test", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); it("Confirm No 3DS CIT", () => { console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["MandateSingleUseNo3DS"]; - console.log("det -> " + det.card); - cy.citForMandatesCallTest(citConfirmBody, 7000, det, true, "automatic", "new_mandate", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["MandateSingleUseNo3DSAutoCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.citForMandatesCallTest(citConfirmBody, req_data, res_data, 7000, true, "automatic", "new_mandate", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("Confirm No 3DS MIT", () => { @@ -47,4 +58,4 @@ describe("Card - SingleUse Mandates flow test", () => { }); }); -}); \ No newline at end of file +}); diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00013-SaveCardFlow.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00013-SaveCardFlow.cy.js index eda63cc02f55..1168a5690893 100644 --- a/cypress-tests/cypress/e2e/ConnectorTest/00013-SaveCardFlow.cy.js +++ b/cypress-tests/cypress/e2e/ConnectorTest/00013-SaveCardFlow.cy.js @@ -3,8 +3,9 @@ import confirmBody from "../../fixtures/confirm-body.json"; import createPaymentBody from "../../fixtures/create-payment-body.json"; import createConfirmPaymentBody from "../../fixtures/create-confirm-body.json"; import customerCreateBody from "../../fixtures/create-customer-body.json"; -import saveCardConfirmBody from "../../fixtures/save-card-confirm-body.json"; +import SaveCardConfirmBody from "../../fixtures/save-card-confirm-body.json"; import getConnectorDetails from "../ConnectorUtils/utils"; +import * as utils from "../ConnectorUtils/utils"; import State from "../../utils/State"; let globalState; @@ -19,105 +20,169 @@ describe("Card - SaveCard payment flow test", () => { }) - context("Save card for NoThreeDS automatic capture payment- Create+Confirm", () => { + context("Save card for NoThreeDS automatic capture payment- Create+Confirm", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); + + it("customer-create-call-test", () => { + cy.createCustomerCallTest(customerCreateBody, globalState); + }); + + it("create+confirm-payment-call-test", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["SaveCardUseNo3DSAutoCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createConfirmPaymentTest( createConfirmPaymentBody, req_data, res_data,"no_three_ds", "automatic", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); + }); + + it("retrieve-payment-call-test", () => { + cy.retrievePaymentCallTest(globalState); + }); + + it("retrieve-customerPM-call-test", () => { + cy.listCustomerPMCallTest(globalState); + }); + + it("create-payment-call-test", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PaymentIntent"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest(createPaymentBody, req_data, res_data, "no_three_ds", "automatic", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); + }); + + it ("confirm-save-card-payment-call-test", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["SaveCardUseNo3DSAutoCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.saveCardConfirmCallTest(SaveCardConfirmBody, req_data, res_data, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); + }); + + }); + + context("Save card for NoThreeDS manual full capture payment- Create+Confirm", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); + it("customer-create-call-test", () => { cy.createCustomerCallTest(customerCreateBody, globalState); }); it("create+confirm-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["SaveCardUseNo3DS"]; - cy.createConfirmPaymentTest( createConfirmPaymentBody, det,"no_three_ds", "automatic", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["SaveCardUseNo3DSAutoCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createConfirmPaymentTest( createConfirmPaymentBody, req_data, res_data,"no_three_ds", "automatic", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("retrieve-payment-call-test", () => { cy.retrievePaymentCallTest(globalState); }); - + it("retrieve-customerPM-call-test", () => { cy.listCustomerPMCallTest(globalState); }); it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["SaveCardUseNo3DS"]; - cy.createPaymentIntentTest( createPaymentBody, det, "no_three_ds", "automatic", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PaymentIntent"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest( createPaymentBody, req_data, res_data, "no_three_ds", "manual", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); + it ("confirm-save-card-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["SaveCardUseNo3DS"]; - cy.saveCardConfirmCallTest(saveCardConfirmBody,det,globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["SaveCardUseNo3DSManualCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.saveCardConfirmCallTest(SaveCardConfirmBody, req_data, res_data, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); + }); + + it("retrieve-payment-call-test", () => { + cy.retrievePaymentCallTest(globalState); }); + it("capture-call-test", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["Capture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); + }); }); - context("Save card for NoThreeDS manual full capture payment- Create+Confirm", () => { - it("customer-create-call-test", () => { - cy.createCustomerCallTest(customerCreateBody, globalState); - }); - - it("create+confirm-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["SaveCardUseNo3DS"]; - cy.createConfirmPaymentTest( createConfirmPaymentBody, det,"no_three_ds", "automatic", globalState); - }); - - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); - - it("retrieve-customerPM-call-test", () => { - cy.listCustomerPMCallTest(globalState); - }); - - it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["SaveCardUseNo3DS"]; - cy.createPaymentIntentTest( createPaymentBody, det, "no_three_ds", "manual", globalState); - }); + context("Save card for NoThreeDS manual partial capture payment- Create + Confirm", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); + it("customer-create-call-test", () => { + cy.createCustomerCallTest(customerCreateBody, globalState); + }); + + it("create+confirm-payment-call-test", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["SaveCardUseNo3DSAutoCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createConfirmPaymentTest( createConfirmPaymentBody, req_data, res_data,"no_three_ds", "automatic", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); + }); - it ("confirm-save-card-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["SaveCardUseNo3DS"]; - cy.saveCardConfirmCallTest(saveCardConfirmBody,det,globalState); - }); - - it("capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["SaveCardUseNo3DS"]; - cy.captureCallTest(captureBody, 6500, det.paymentSuccessfulStatus, globalState); - }); + it("retrieve-payment-call-test", () => { + cy.retrievePaymentCallTest(globalState); + }); + + it("retrieve-customerPM-call-test", () => { + cy.listCustomerPMCallTest(globalState); + }); + it("create-payment-call-test", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PaymentIntent"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest( createPaymentBody, req_data, res_data, "no_three_ds", "manual", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); + }); - context("Save card for NoThreeDS manual partial capture payment- Create + Confirm", () => { - it("customer-create-call-test", () => { - cy.createCustomerCallTest(customerCreateBody, globalState); - }); - - it("create+confirm-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["SaveCardUseNo3DS"]; - cy.createConfirmPaymentTest( createConfirmPaymentBody, det,"no_three_ds", "automatic", globalState); - }); - - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); - - it("retrieve-customerPM-call-test", () => { - cy.listCustomerPMCallTest(globalState); - }); - - it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["SaveCardUseNo3DS"]; - cy.createPaymentIntentTest( createPaymentBody, det, "no_three_ds", "manual", globalState); - }); - - it ("confirm-save-card-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["SaveCardUseNo3DS"]; - cy.saveCardConfirmCallTest(saveCardConfirmBody,det,globalState); - }); - - it("capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["SaveCardUseNo3DS"]; - cy.captureCallTest(captureBody, 5500, det.paymentSuccessfulStatus, globalState); - }); + it ("confirm-save-card-payment-call-test", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["SaveCardUseNo3DSManualCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.saveCardConfirmCallTest(SaveCardConfirmBody,req_data, res_data,globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); + it("retrieve-payment-call-test", () => { + cy.retrievePaymentCallTest(globalState); + }); + + it("capture-call-test", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PartialCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.captureCallTest(captureBody, req_data, res_data, 100, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); + }); }); -}) \ No newline at end of file + +}); diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00014-ZeroAuthMandate.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00014-ZeroAuthMandate.cy.js index 23b9526f58b4..ee0edcb94ac2 100644 --- a/cypress-tests/cypress/e2e/ConnectorTest/00014-ZeroAuthMandate.cy.js +++ b/cypress-tests/cypress/e2e/ConnectorTest/00014-ZeroAuthMandate.cy.js @@ -2,6 +2,7 @@ import citConfirmBody from "../../fixtures/create-mandate-cit.json"; import mitConfirmBody from "../../fixtures/create-mandate-mit.json"; import State from "../../utils/State"; import getConnectorDetails from "../ConnectorUtils/utils"; +import * as utils from "../ConnectorUtils/utils"; let globalState; @@ -21,10 +22,20 @@ describe("Card - SingleUse Mandates flow test", () => { }) context("Card - NoThreeDS Create + Confirm Automatic CIT and Single use MIT payment flow test", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); it("Confirm No 3DS CIT", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["MandateSingleUseNo3DS"]; - cy.citForMandatesCallTest(citConfirmBody, 0, det, true, "automatic", "setup_mandate", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["ZeroAuthMandate"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.citForMandatesCallTest(citConfirmBody, req_data, res_data, 0, true, "automatic", "setup_mandate", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("Confirm No 3DS MIT", () => { @@ -32,10 +43,20 @@ describe("Card - SingleUse Mandates flow test", () => { }); }); context("Card - NoThreeDS Create + Confirm Automatic CIT and Multi use MIT payment flow test", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); it("Confirm No 3DS CIT", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["MandateSingleUseNo3DS"]; - cy.citForMandatesCallTest(citConfirmBody, 0, det, true, "automatic", "setup_mandate", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["ZeroAuthMandate"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.citForMandatesCallTest(citConfirmBody, req_data, res_data, 0, true, "automatic", "setup_mandate", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("Confirm No 3DS MIT", () => { @@ -46,4 +67,4 @@ describe("Card - SingleUse Mandates flow test", () => { }); }); -}); \ No newline at end of file +}); diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00015-ThreeDSManualCapture.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00015-ThreeDSManualCapture.cy.js index fb308c7fbec2..fa6de0092dc8 100644 --- a/cypress-tests/cypress/e2e/ConnectorTest/00015-ThreeDSManualCapture.cy.js +++ b/cypress-tests/cypress/e2e/ConnectorTest/00015-ThreeDSManualCapture.cy.js @@ -4,6 +4,7 @@ import confirmBody from "../../fixtures/confirm-body.json"; import getConnectorDetails from "../ConnectorUtils/utils"; import State from "../../utils/State"; import captureBody from "../../fixtures/capture-flow-body.json"; +import * as utils from "../ConnectorUtils/utils"; let globalState; @@ -23,9 +24,20 @@ describe("Card - ThreeDS Manual payment flow test", () => { context("Card - ThreeDS Manual Full Capture payment flow test", () => { context("payment Create and Confirm", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); + it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "three_ds", "manual", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PaymentIntent"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest(createPaymentBody, req_data, res_data, "three_ds", "manual", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("payment_methods-call-test", () => { @@ -33,8 +45,11 @@ describe("Card - ThreeDS Manual payment flow test", () => { }); it("confirm-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.confirmCallTest(confirmBody, det, true, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DSManualCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("Handle redirection", () => { @@ -47,8 +62,11 @@ describe("Card - ThreeDS Manual payment flow test", () => { }); it("capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.captureCallTest(captureBody, 6500, det.paymentSuccessfulStatus, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["Capture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("retrieve-payment-call-test", () => { @@ -58,9 +76,20 @@ describe("Card - ThreeDS Manual payment flow test", () => { }); context("Payment Create+Confirm", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); + it("create+confirm-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.createConfirmPaymentTest(createConfirmPaymentBody, det, "three_ds", "manual", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DSManualCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createConfirmPaymentTest(createConfirmPaymentBody, req_data, res_data, "three_ds", "manual", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("Handle redirection", () => { @@ -74,8 +103,11 @@ describe("Card - ThreeDS Manual payment flow test", () => { }); it("capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.captureCallTest(captureBody, 6540, det.paymentSuccessfulStatus, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["Capture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("retrieve-payment-call-test", () => { @@ -88,9 +120,20 @@ describe("Card - ThreeDS Manual payment flow test", () => { context("Card - ThreeDS Manual Partial Capture payment flow test - Create and Confirm", () => { context("payment Create and Payment Confirm", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); + it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "three_ds", "manual", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PaymentIntent"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest(createPaymentBody, req_data, res_data, "three_ds", "manual", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("payment_methods-call-test", () => { @@ -98,8 +141,11 @@ describe("Card - ThreeDS Manual payment flow test", () => { }); it("confirm-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.confirmCallTest(confirmBody, det, true, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DSManualCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("Handle redirection", () => { @@ -112,8 +158,11 @@ describe("Card - ThreeDS Manual payment flow test", () => { }); it("capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.captureCallTest(captureBody, 100, det.paymentSuccessfulStatus, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PartialCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.captureCallTest(captureBody, req_data, res_data, 100, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("retrieve-payment-call-test", () => { @@ -122,9 +171,20 @@ describe("Card - ThreeDS Manual payment flow test", () => { }); context("payment + Confirm", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + + beforeEach(function () { + if(!should_continue) { + this.skip(); + } + }); + it("create+confirm-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.createConfirmPaymentTest(createConfirmPaymentBody, det, "three_ds", "manual", globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DSManualCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createConfirmPaymentTest(createConfirmPaymentBody, req_data, res_data, "three_ds", "manual", globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("Handle redirection", () => { @@ -137,8 +197,11 @@ describe("Card - ThreeDS Manual payment flow test", () => { }); it("capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"]; - cy.captureCallTest(captureBody, 5000, det.paymentSuccessfulStatus, globalState); + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PartialCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.captureCallTest(captureBody, req_data, res_data, 100, globalState); + if(should_continue) should_continue = utils.should_continue_further(res_data); }); it("retrieve-payment-call-test", () => { @@ -149,4 +212,4 @@ describe("Card - ThreeDS Manual payment flow test", () => { }); -}); \ No newline at end of file +}); diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Adyen.js b/cypress-tests/cypress/e2e/ConnectorUtils/Adyen.js index 94ffe3009f68..1bbbbbd4b5b5 100644 --- a/cypress-tests/cypress/e2e/ConnectorUtils/Adyen.js +++ b/cypress-tests/cypress/e2e/ConnectorUtils/Adyen.js @@ -17,98 +17,366 @@ const successfulThreeDSTestCardDetails = { export const connectorDetails = { card_pm:{ - "3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "customer_acceptance": null, - "setup_future_usage": "on_session", - }, - "No3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "customer_acceptance": null, - "setup_future_usage": "on_session", - }, - "MandateSingleUse3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "processing", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "mandate_type": { - "single_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateSingleUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "mandate_type": { - "single_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateMultiUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "mandate_type": { - "multi_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateMultiUse3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "processing", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "mandate_type": { - "multi_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "SaveCardUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "setup_future_usage": "on_session", - "customer_acceptance": { - "acceptance_type": "offline", - "accepted_at": "1963-05-03T04:07:52.723Z", - "online": { - "ip_address": "127.0.0.1", - "user_agent": "amet irure esse" + "PaymentIntent": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "requires_payment_method" + } + } + }, + "3DSManualCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "processing" + } + } + }, + "3DSAutoCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded" + } + } + }, + "No3DSManualCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "requires_capture" + } + } + }, + "No3DSAutoCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded" + } + } + }, + "Capture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + }, + "Response": { + "status": 200, + "body":{ + "status": "processing", + "amount": 6500, + "amount_capturable": 6500, + "amount_received": 0, + + } + } + }, + + "PartialCapture": { + "Request": { + }, + "Response": { + "status": 200, + "body": { + "status": "processing", + "amount": 6500, + "amount_capturable": 6500, + "amount_received": 0, + } + + } + }, + "Void":{ + "Request": { + }, + "Response": { + "status": 200, + "body":{ + status: "processing" + + } + } + }, + "Refund": { + "Request": { + + "currency": "USD", + + }, + "Response": { + "status": 400, + "body": { + "status": "pending", } + + } + }, + "PartialRefund": { + "Request": { + + "currency": "USD", + + }, + "Response": { + "status": 200, + "body": { + "status": "pending", + } + + } + }, + "SyncRefund": { + "Request": { + + "currency": "USD", + }, + "Response": { + "status": 200, + "body": { + "status": "pending", + } + + } + }, + "MandateSingleUse3DSAutoCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded" + } + } + + }, + "MandateSingleUse3DSManualCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 200, + "body": { + "status": "requires_customer_action" + } + } + + }, + "MandateSingleUseNo3DSAutoCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded" + } + } + }, + "MandateSingleUseNo3DSManualCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 200, + "body": { + "status": "processing" + } + } + }, + "MandateMultiUseNo3DSAutoCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "multi_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded" + } + } + }, + "MandateMultiUseNo3DSManualCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "multi_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 200, + "body": { + "status": "requires_capture" + } + } + }, + "MandateMultiUse3DSAutoCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "mandate_type": { + "multi_use": { + "amount": 8000, + "currency": "USD" + } + }, + }, + "Response": { + "status": 200, + "body": { + "status": "requires_capture" + } + } + }, + "MandateMultiUse3DSManualCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "mandate_type": { + "multi_use": { + "amount": 8000, + "currency": "USD" + } + }, + }, + "Response": { + "status": 200, + "body": { + "status": "requires_capture" + } + } + }, + "ZeroAuthMandate": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded" + } + } + }, + "SaveCardUseNo3DSAutoCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "setup_future_usage": "on_session", + "customer_acceptance": { + "acceptance_type": "offline", + "accepted_at": "1963-05-03T04:07:52.723Z", + "online": { + "ip_address": "127.0.0.1", + "user_agent": "amet irure esse" + } + }, + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded" + } + } + }, + "SaveCardUseNo3DSManualCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "setup_future_usage": "on_session", + "customer_acceptance": { + "acceptance_type": "offline", + "accepted_at": "1963-05-03T04:07:52.723Z", + "online": { + "ip_address": "127.0.0.1", + "user_agent": "amet irure esse" + } + }, + }, + "Response": { + "status": 200, + "body": { + "status": "requires_capture" + } + } }, } }; \ No newline at end of file diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/BankOfAmerica.js b/cypress-tests/cypress/e2e/ConnectorUtils/BankOfAmerica.js index 92b5f50981ac..5b3df0efc5d8 100644 --- a/cypress-tests/cypress/e2e/ConnectorUtils/BankOfAmerica.js +++ b/cypress-tests/cypress/e2e/ConnectorUtils/BankOfAmerica.js @@ -14,101 +14,368 @@ const successfulThreeDSTestCardDetails = { "card_holder_name": "joseph Doe", "card_cvc": "123" }; - export const connectorDetails = { -card_pm:{ - "3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "customer_acceptance": null, - "setup_future_usage": "on_session", - }, - "No3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "customer_acceptance": null, - "setup_future_usage": "on_session", - }, - "MandateSingleUse3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "mandate_type": { - "single_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateSingleUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "mandate_type": { - "single_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateMultiUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "mandate_type": { - "multi_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateMultiUse3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "mandate_type": { - "multi_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "SaveCardUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "setup_future_usage": "on_session", - "customer_acceptance": { - "acceptance_type": "offline", - "accepted_at": "1963-05-03T04:07:52.723Z", - "online": { - "ip_address": "127.0.0.1", - "user_agent": "amet irure esse" - } - }, - }, -} -}; \ No newline at end of file + card_pm:{ + "PaymentIntent": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "requires_payment_method" + } + } + }, + "3DSManualCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "requires_capture" + } + } + }, + "3DSAutoCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded" + } + } + }, + "No3DSManualCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "requires_capture" + } + } + }, + "No3DSAutoCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded" + } + } + }, + "Capture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + }, + "Response": { + "status": 200, + "body":{ + "status": "succeeded", + "amount": 6500, + "amount_capturable": 0, + "amount_received": 6500, + + } + } + }, + "PartialCapture": { + "Request": { + + }, + "Response": { + "status": 200, + "body": { + "status": "partially_captured", + "amount": 6500, + "amount_capturable": 0, + "amount_received": 100, + } + + } + }, + "Void":{ + "Request": { + }, + "Response": { + "status": 200, + "body":{ + status: "cancelled" + + } + } + }, + "Refund": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + }, + "Response": { + "status": 200, + "body": { + "status": "pending", + } + + } + }, + "PartialRefund": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + }, + "Response": { + "status": 200, + "body": { + "status": "pending", + } + + } + }, + "SyncRefund": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + }, + "Response": { + "status": 200, + "body": { + "status": "pending", + } + + } + }, + "MandateSingleUse3DSAutoCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded" + } + } + + }, + "MandateSingleUse3DSManualCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 200, + "body": { + "status": "requires_customer_action" + } + } + + }, + "MandateSingleUseNo3DSAutoCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded" + } + } + }, + "MandateSingleUseNo3DSManualCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 200, + "body": { + "status": "requires_capture" + } + } + }, + "MandateMultiUseNo3DSAutoCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "multi_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded" + } + } + }, + "MandateMultiUseNo3DSManualCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "multi_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 200, + "body": { + "status": "requires_capture" + } + } + }, + "MandateMultiUse3DSAutoCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "mandate_type": { + "multi_use": { + "amount": 8000, + "currency": "USD" + } + }, + }, + "Response": { + "status": 200, + "body": { + "status": "requires_capture" + } + } + }, + "MandateMultiUse3DSManualCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "mandate_type": { + "multi_use": { + "amount": 8000, + "currency": "USD" + } + }, + }, + "Response": { + "status": 200, + "body": { + "status": "requires_capture" + } + } + }, + "ZeroAuthMandate": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded" + } + } + }, + "SaveCardUseNo3DSAutoCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "setup_future_usage": "on_session", + "customer_acceptance": { + "acceptance_type": "offline", + "accepted_at": "1963-05-03T04:07:52.723Z", + "online": { + "ip_address": "127.0.0.1", + "user_agent": "amet irure esse" + } + }, + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded" + } + } + }, + "SaveCardUseNo3DSManualCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "setup_future_usage": "on_session", + "customer_acceptance": { + "acceptance_type": "offline", + "accepted_at": "1963-05-03T04:07:52.723Z", + "online": { + "ip_address": "127.0.0.1", + "user_agent": "amet irure esse" + } + }, + }, + "Response": { + "status": 200, + "body": { + "status": "requires_capture" + } + } + }, + } + }; diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Bluesnap.js b/cypress-tests/cypress/e2e/ConnectorUtils/Bluesnap.js index 523e6003ae5d..17e040668adc 100644 --- a/cypress-tests/cypress/e2e/ConnectorUtils/Bluesnap.js +++ b/cypress-tests/cypress/e2e/ConnectorUtils/Bluesnap.js @@ -15,99 +15,411 @@ const successfulThreeDSTestCardDetails = { }; export const connectorDetails = { -card_pm:{ - "3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "customer_acceptance": null, - "setup_future_usage": "on_session", - }, - "No3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "customer_acceptance": null, - "setup_future_usage": "on_session", - }, - "MandateSingleUse3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "mandate_type": { - "single_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateSingleUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "mandate_type": { - "single_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateMultiUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "mandate_type": { - "multi_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateMultiUse3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "mandate_type": { - "multi_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "SaveCardUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "setup_future_usage": "on_session", - "customer_acceptance": { - "acceptance_type": "offline", - "accepted_at": "1963-05-03T04:07:52.723Z", - "online": { - "ip_address": "127.0.0.1", - "user_agent": "amet irure esse" - } - }, - }, - } -}; \ No newline at end of file + card_pm:{ + "PaymentIntent": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "requires_payment_method" + } + } + }, + "3DSManualCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "requires_capture" + } + } + }, + "3DSAutoCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded" + } + } + }, + "No3DSManualCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "requires_capture" + } + } + }, + "No3DSAutoCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded" + } + } + }, + "Capture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + }, + "Response": { + "status": 200, + "body":{ + "status": "succeeded", + "amount": 6500, + "amount_capturable": 0, + "amount_received": 6500, + + } + } + }, + "PartialCapture": { + "Request": { + + }, + "Response": { + "status": 200, + "body": { + "status": "partially_captured", + "amount": 6500, + "amount_capturable": 0, + "amount_received": 100, + } + + } + }, + "Void":{ + "Request": { + }, + "Response": { + "status": 200, + "body":{ + status: "cancelled" + + } + } + }, + "Refund": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded", + } + + } + }, + "PartialRefund": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded", + } + + } + }, + "SyncRefund": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded", + } + + } + }, + "MandateSingleUse3DSAutoCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 400, + "body":{ + "error": { + "type": "invalid_request", + "message": "Payment method type not supported", + "code": "HE_03", + "reason": "debit mandate payment is not supported by bluesnap" + } + } + } + + }, + "MandateSingleUse3DSManualCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 400, + "body":{ + "error": { + "type": "invalid_request", + "message": "Payment method type not supported", + "code": "HE_03", + "reason": "debit mandate payment is not supported by bluesnap" + } + } + } + + }, + "MandateSingleUseNo3DSAutoCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 400, + "body":{ + "error": { + "type": "invalid_request", + "message": "Payment method type not supported", + "code": "HE_03", + "reason": "debit mandate payment is not supported by bluesnap" + } + } + } + }, + "MandateSingleUseNo3DSManualCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 400, + "body":{ + "error": { + "type": "invalid_request", + "message": "Payment method type not supported", + "code": "HE_03", + "reason": "debit mandate payment is not supported by bluesnap" + } + } + } + }, + "MandateMultiUseNo3DSAutoCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "multi_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 400, + "body":{ + "error": { + "type": "invalid_request", + "message": "Payment method type not supported", + "code": "HE_03", + "reason": "debit mandate payment is not supported by bluesnap" + } + } + } + }, + "MandateMultiUseNo3DSManualCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "multi_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 400, + "body":{ + "error": { + "type": "invalid_request", + "message": "Payment method type not supported", + "code": "HE_03", + "reason": "debit mandate payment is not supported by bluesnap" + } + } + } + }, + "MandateMultiUse3DSAutoCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "mandate_type": { + "multi_use": { + "amount": 8000, + "currency": "USD" + } + }, + }, + "Response": { + "status": 400, + "body":{ + "error": { + "type": "invalid_request", + "message": "Payment method type not supported", + "code": "HE_03", + "reason": "debit mandate payment is not supported by bluesnap" + } + } + } + }, + "MandateMultiUse3DSManualCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "mandate_type": { + "multi_use": { + "amount": 8000, + "currency": "USD" + } + }, + }, + "Response": { + "status": 400, + "body":{ + "error": { + "type": "invalid_request", + "message": "Payment method type not supported", + "code": "HE_03", + "reason": "debit mandate payment is not supported by bluesnap" + } + } + } + }, + "ZeroAuthMandate": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 501, + "body": { + "error": { + "type": "invalid_request", + "message": "Setup Mandate flow for Bluesnap is not implemented", + "code": "IR_00", + } + } + } + }, + "SaveCardUseNo3DSAutoCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "setup_future_usage": "on_session", + "customer_acceptance": { + "acceptance_type": "offline", + "accepted_at": "1963-05-03T04:07:52.723Z", + "online": { + "ip_address": "127.0.0.1", + "user_agent": "amet irure esse" + } + }, + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded" + } + } + }, + "SaveCardUseNo3DSManualCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "setup_future_usage": "on_session", + "customer_acceptance": { + "acceptance_type": "offline", + "accepted_at": "1963-05-03T04:07:52.723Z", + "online": { + "ip_address": "127.0.0.1", + "user_agent": "amet irure esse" + } + }, + }, + "Response": { + "status": 200, + "body": { + "status": "requires_capture" + } + } + }, + } + }; \ No newline at end of file diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Cybersource.js b/cypress-tests/cypress/e2e/ConnectorUtils/Cybersource.js index c200adf64c53..67d2875df5c8 100644 --- a/cypress-tests/cypress/e2e/ConnectorUtils/Cybersource.js +++ b/cypress-tests/cypress/e2e/ConnectorUtils/Cybersource.js @@ -15,99 +15,367 @@ const successfulThreeDSTestCardDetails = { }; export const connectorDetails = { -card_pm:{ - "3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "customer_acceptance": null, - "setup_future_usage": "on_session", - }, - "No3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "customer_acceptance": null, - "setup_future_usage": "on_session", - }, - "MandateSingleUse3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "mandate_type": { - "single_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateSingleUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "mandate_type": { - "single_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateMultiUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "mandate_type": { - "multi_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateMultiUse3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "mandate_type": { - "multi_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "SaveCardUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "setup_future_usage": "on_session", - "customer_acceptance": { - "acceptance_type": "offline", - "accepted_at": "1963-05-03T04:07:52.723Z", - "online": { - "ip_address": "127.0.0.1", - "user_agent": "amet irure esse" - } - }, - }, - } -}; \ No newline at end of file + card_pm:{ + "PaymentIntent": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "requires_payment_method" + } + } + }, + "3DSManualCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "requires_capture" + } + } + }, + "3DSAutoCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded" + } + } + }, + "No3DSManualCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "requires_capture" + } + } + }, + "No3DSAutoCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded" + } + } + }, + "Capture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + }, + "Response": { + "status": 200, + "body":{ + "status": "succeeded", + "amount": 6500, + "amount_capturable": 0, + "amount_received": 6500, + + } + } + }, + "PartialCapture": { + "Request": { + + }, + "Response": { + "status": 200, + "body": { + "status": "partially_captured", + "amount": 6500, + "amount_capturable": 0, + "amount_received": 100, + } + + } + }, + "Void":{ + "Request": { + }, + "Response": { + "status": 200, + "body":{ + status: "cancelled" + + } + } + }, + "Refund": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + }, + "Response": { + "status": 200, + "body": { + "status": "pending", + } + + } + }, + "PartialRefund": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + }, + "Response": { + "status": 200, + "body": { + "status": "pending", + } + + } + }, + "SyncRefund": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + }, + "Response": { + "status": 200, + "body": { + "status": "pending", + } + + } + }, + "MandateSingleUse3DSAutoCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded" + } + } + + }, + "MandateSingleUse3DSManualCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 200, + "body": { + "status": "requires_customer_action" + } + } + + }, + "MandateSingleUseNo3DSAutoCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded" + } + } + }, + "MandateSingleUseNo3DSManualCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 200, + "body": { + "status": "requires_capture" + } + } + }, + "MandateMultiUseNo3DSAutoCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "multi_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded" + } + } + }, + "MandateMultiUseNo3DSManualCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "multi_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 200, + "body": { + "status": "requires_capture" + } + } + }, + "MandateMultiUse3DSAutoCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "mandate_type": { + "multi_use": { + "amount": 8000, + "currency": "USD" + } + }, + }, + "Response": { + "status": 200, + "body": { + "status": "requires_capture" + } + } + }, + "MandateMultiUse3DSManualCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "mandate_type": { + "multi_use": { + "amount": 8000, + "currency": "USD" + } + }, + }, + "Response": { + "status": 200, + "body": { + "status": "requires_capture" + } + } + }, + "ZeroAuthMandate": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded" + } + } + }, + "SaveCardUseNo3DSAutoCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "setup_future_usage": "on_session", + "customer_acceptance": { + "acceptance_type": "offline", + "accepted_at": "1963-05-03T04:07:52.723Z", + "online": { + "ip_address": "127.0.0.1", + "user_agent": "amet irure esse" + } + }, + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded" + } + } + }, + "SaveCardUseNo3DSManualCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "setup_future_usage": "on_session", + "customer_acceptance": { + "acceptance_type": "offline", + "accepted_at": "1963-05-03T04:07:52.723Z", + "online": { + "ip_address": "127.0.0.1", + "user_agent": "amet irure esse" + } + }, + }, + "Response": { + "status": 200, + "body": { + "status": "requires_capture" + } + } + }, + } + }; \ No newline at end of file diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Nmi.js b/cypress-tests/cypress/e2e/ConnectorUtils/Nmi.js index 55d25a8ecf9d..27caaa82dc83 100644 --- a/cypress-tests/cypress/e2e/ConnectorUtils/Nmi.js +++ b/cypress-tests/cypress/e2e/ConnectorUtils/Nmi.js @@ -15,100 +15,413 @@ const successfulThreeDSTestCardDetails = { }; export const connectorDetails = { -card_pm:{ - "3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "succeeded", - "customer_acceptance": null, - "setup_future_usage": "on_session", - - }, - "No3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "processing", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "succeeded", - "customer_acceptance": null, - "setup_future_usage": "on_session", - }, - "MandateSingleUse3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "processing", - "refundStatus": "pending", - "refundSyncStatus": "succeeded", - "mandate_type": { - "single_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateSingleUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "processing", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "succeeded", - "mandate_type": { - "single_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateMultiUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "processing", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "succeeded", - "mandate_type": { - "multi_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateMultiUse3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "succeeded", - "mandate_type": { - "multi_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "SaveCardUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "processing", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "succeeded", - "setup_future_usage": "on_session", - "customer_acceptance": { - "acceptance_type": "offline", - "accepted_at": "1963-05-03T04:07:52.723Z", - "online": { - "ip_address": "127.0.0.1", - "user_agent": "amet irure esse" - } - }, - }, - } -}; \ No newline at end of file + card_pm:{ + "PaymentIntent": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "requires_payment_method" + } + } + }, + "3DSManualCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "processing" + } + } + }, + "3DSAutoCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "processing" + } + } + }, + "No3DSManualCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "processing" + } + } + }, + "No3DSAutoCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "processing" + } + } + }, + "Capture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + }, + "Response": { + "status": 200, + "body":{ + "status": "processing", + "amount": 6500, + "amount_capturable": 6500, + + } + } + }, + "PartialCapture": { + "Request": { + + }, + "Response": { + "status": 200, + "body": { + "status": "processing", + "amount": 6500, + "amount_capturable": 6500, + } + + } + }, + "Void":{ + "Request": { + }, + "Response": { + "status": 400, + "body":{ + "error":{ + "code":"IR_16", + "message":"You cannot cancel this payment because it has status processing", + "type":"invalid_request", + } + + } + } + }, + "Refund": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + }, + "Response": { + "status": 200, + "body": { + "status": "pending", + } + + } + }, + "PartialRefund": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + }, + "Response": { + "status": 200, + "body": { + "status": "pending", + } + + } + }, + "SyncRefund": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded", + } + + } + }, + "MandateSingleUse3DSAutoCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 400, + "body":{ + "error": { + "type": "invalid_request", + "message": "Payment method type not supported", + "code": "HE_03", + "reason": "debit mandate payment is not supported by nmi" + } + } + } + + }, + "MandateSingleUse3DSManualCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 400, + "body":{ + "error": { + "type": "invalid_request", + "message": "Payment method type not supported", + "code": "HE_03", + "reason": "debit mandate payment is not supported by nmi" + } + } + } + + }, + "MandateSingleUseNo3DSAutoCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 400, + "body":{ + "error": { + "type": "invalid_request", + "message": "Payment method type not supported", + "code": "HE_03", + "reason": "debit mandate payment is not supported by nmi" + } + } + } + }, + "MandateSingleUseNo3DSManualCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 400, + "body":{ + "error": { + "type": "invalid_request", + "message": "Payment method type not supported", + "code": "HE_03", + "reason": "debit mandate payment is not supported by nmi" + } + } + } + }, + "MandateMultiUseNo3DSAutoCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "multi_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 400, + "body":{ + "error": { + "type": "invalid_request", + "message": "Payment method type not supported", + "code": "HE_03", + "reason": "debit mandate payment is not supported by nmi" + } + } + } + }, + "MandateMultiUseNo3DSManualCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "multi_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 400, + "body":{ + "error": { + "type": "invalid_request", + "message": "Payment method type not supported", + "code": "HE_03", + "reason": "debit mandate payment is not supported by nmi" + } + } + } + }, + "MandateMultiUse3DSAutoCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "mandate_type": { + "multi_use": { + "amount": 8000, + "currency": "USD" + } + }, + }, + "Response": { + "status": 400, + "body":{ + "error": { + "type": "invalid_request", + "message": "Payment method type not supported", + "code": "HE_03", + "reason": "debit mandate payment is not supported by nmi" + } + } + } + }, + "MandateMultiUse3DSManualCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "mandate_type": { + "multi_use": { + "amount": 8000, + "currency": "USD" + } + }, + }, + "Response": { + "status": 400, + "body":{ + "error": { + "type": "invalid_request", + "message": "Payment method type not supported", + "code": "HE_03", + "reason": "debit mandate payment is not supported by nmi" + } + } + } + }, + "ZeroAuthMandate": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 501, + "body": { + "error": { + "type": "invalid_request", + "message": "Setup Mandate flow for Nmi is not implemented", + "code": "IR_00", + } + } + } + }, + "SaveCardUseNo3DSAutoCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "setup_future_usage": "on_session", + "customer_acceptance": { + "acceptance_type": "offline", + "accepted_at": "1963-05-03T04:07:52.723Z", + "online": { + "ip_address": "127.0.0.1", + "user_agent": "amet irure esse" + } + }, + }, + "Response": { + "status": 200, + "body": { + "status": "processing" + } + } + }, + "SaveCardUseNo3DSManualCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "setup_future_usage": "on_session", + "customer_acceptance": { + "acceptance_type": "offline", + "accepted_at": "1963-05-03T04:07:52.723Z", + "online": { + "ip_address": "127.0.0.1", + "user_agent": "amet irure esse" + } + }, + }, + "Response": { + "status": 200, + "body": { + "status": "processing" + } + } + }, + } + }; \ No newline at end of file diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Paypal.js b/cypress-tests/cypress/e2e/ConnectorUtils/Paypal.js index b0e876a71278..056b4b5e8ac3 100644 --- a/cypress-tests/cypress/e2e/ConnectorUtils/Paypal.js +++ b/cypress-tests/cypress/e2e/ConnectorUtils/Paypal.js @@ -17,90 +17,424 @@ const successfulThreeDSTestCardDetails = { export const connectorDetails = { card_pm:{ - "3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "processing", - "customer_acceptance":null, - "setup_future_usage": "on_session", + "PaymentIntent": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "requires_payment_method" + } + } + }, + "3DSManualCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "requires_capture" + } + } + }, + "3DSAutoCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "processing" + } + } + }, + "No3DSManualCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "requires_capture" + } + } + }, + "No3DSAutoCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "processing" + } + } + }, + "Capture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + }, + "Response": { + "status": 200, + "body":{ + "status": "processing", + "amount": 6500, + "amount_capturable": 6500, + "amount_received": 0, + } + } }, - "No3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "processing", - "paymentSyncStatus": "processing", - "customer_acceptance":null, - "setup_future_usage": "on_session", + "PartialCapture": { + "Request": { + + }, + "Response": { + "status": 200, + "body": { + "status": "processing", + "amount": 6500, + "amount_capturable": 6500, + "amount_received": 0, + } + } }, - "MandateSingleUse3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "processing", - "mandate_type": { - "single_use": { - "amount": 8000, - "currency": "USD" + "Void":{ + "Request": { + }, + "Response": { + "status": 200, + "body":{ + status: "cancelled" + + } + } + }, + "Refund": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + }, + "Response": { + "status": 400, + "body": { + "error": { + "type": "invalid_request", + "message": "This Payment could not be refund because it has a status of processing. The expected state is succeeded, partially_captured", + "code" : "IR_14" + }, } + } }, - "MandateSingleUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "mandate_type": { - "single_use": { - "amount": 8000, - "currency": "USD" + "PartialRefund": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + }, + "Response": { + "status": 400, + "body": { + "error": { + "type": "invalid_request", + "message": "This Payment could not be refund because it has a status of processing. The expected state is succeeded, partially_captured", + "code" : "IR_14" + }, } + } }, - "MandateMultiUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "mandate_type": { - "multi_use": { - "amount": 8000, - "currency": "USD" + "SyncRefund": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + }, + "Response": { + "status": 400, + "body": { + "error": { + "type": "invalid_request", + "message": "This Payment could not be refund because it has a status of processing. The expected state is succeeded, partially_captured", + "code" : "IR_14" + }, } + } }, - "MandateMultiUse3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "processing", - "mandate_type": { - "multi_use": { - "amount": 8000, - "currency": "USD" + "MandateSingleUse3DSAutoCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 400, + "body":{ + "error": { + "type": "invalid_request", + "message": "Payment method type not supported", + "code": "HE_03", + "reason": "debit mandate payment is not supported by paypal" + } } } + }, - "SaveCardUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency":"USD", - "paymentSuccessfulStatus": "processing", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "setup_future_usage": "on_session", - "customer_acceptance": { - "acceptance_type": "offline", - "accepted_at": "1963-05-03T04:07:52.723Z", - "online": { - "ip_address": "127.0.0.1", - "user_agent": "amet irure esse" + "MandateSingleUse3DSManualCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } } }, + "Response": { + "status": 400, + "body":{ + "error": { + "type": "invalid_request", + "message": "Payment method type not supported", + "code": "HE_03", + "reason": "debit mandate payment is not supported by paypal" + } + } + } + }, - }, -}; + "MandateSingleUseNo3DSAutoCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 400, + "body":{ + "error": { + "type": "invalid_request", + "message": "Payment method type not supported", + "code": "HE_03", + "reason": "debit mandate payment is not supported by paypal" + } + } + } + }, + "MandateSingleUseNo3DSManualCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 400, + "body":{ + "error": { + "type": "invalid_request", + "message": "Payment method type not supported", + "code": "HE_03", + "reason": "debit mandate payment is not supported by paypal" + } + } + } + }, + "MandateMultiUseNo3DSAutoCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "multi_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 400, + "body":{ + "error": { + "type": "invalid_request", + "message": "Payment method type not supported", + "code": "HE_03", + "reason": "debit mandate payment is not supported by paypal" + } + } + } + }, + "MandateMultiUseNo3DSManualCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "multi_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 400, + "body":{ + "error": { + "type": "invalid_request", + "message": "Payment method type not supported", + "code": "HE_03", + "reason": "debit mandate payment is not supported by paypal" + } + } + } + }, + "MandateMultiUse3DSAutoCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "mandate_type": { + "multi_use": { + "amount": 8000, + "currency": "USD" + } + }, + }, + "Response": { + "status": 400, + "body":{ + "error": { + "type": "invalid_request", + "message": "Payment method type not supported", + "code": "HE_03", + "reason": "debit mandate payment is not supported by paypal" + } + } + } + }, + "MandateMultiUse3DSManualCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "mandate_type": { + "multi_use": { + "amount": 8000, + "currency": "USD" + } + }, + }, + "Response": { + "status": 400, + "body":{ + "error": { + "type": "invalid_request", + "message": "Payment method type not supported", + "code": "HE_03", + "reason": "debit mandate payment is not supported by paypal" + } + } + } + }, + "ZeroAuthMandate": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 501, + "body": { + "error": { + "type": "invalid_request", + "message": "Setup Mandate flow for Paypal is not implemented", + "code": "IR_00", + } + } + } + }, + "SaveCardUseNo3DSAutoCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "setup_future_usage": "on_session", + "customer_acceptance": { + "acceptance_type": "offline", + "accepted_at": "1963-05-03T04:07:52.723Z", + "online": { + "ip_address": "127.0.0.1", + "user_agent": "amet irure esse" + } + }, + }, + "Response": { + "status": 200, + "body": { + "status": "processing" + } + } + }, + "SaveCardUseNo3DSManualCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "setup_future_usage": "on_session", + "customer_acceptance": { + "acceptance_type": "offline", + "accepted_at": "1963-05-03T04:07:52.723Z", + "online": { + "ip_address": "127.0.0.1", + "user_agent": "amet irure esse" + } + }, + }, + "Response": { + "status": 200, + "body": { + "status": "requires_capture" + } + } + }, + } + }; diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Stripe.js b/cypress-tests/cypress/e2e/ConnectorUtils/Stripe.js index fb0683db2ad8..1003946dd736 100644 --- a/cypress-tests/cypress/e2e/ConnectorUtils/Stripe.js +++ b/cypress-tests/cypress/e2e/ConnectorUtils/Stripe.js @@ -1,7 +1,7 @@ const successfulTestCard = "4242424242424242"; const successful3DSCard = "4000002760003184"; -const successfulTestCardDetails = { +const successfulNo3DSCardDetails = { "card_number": "4242424242424242", "card_exp_month": "10", "card_exp_year": "25", @@ -19,98 +19,366 @@ const successfulThreeDSTestCardDetails = { export const connectorDetails = { card_pm:{ - "3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "customer_acceptance": null, - "setup_future_usage": "on_session" - }, - "No3DS": { - "card": successfulTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "customer_acceptance": null, - "setup_future_usage": "on_session" - }, - "MandateSingleUse3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "mandate_type": { - "single_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateSingleUseNo3DS": { - "card": successfulTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "mandate_type": { - "single_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateMultiUseNo3DS": { - "card": successfulTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "mandate_type": { - "multi_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateMultiUse3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "mandate_type": { - "multi_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "SaveCardUseNo3DS": { - "card": successfulTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "setup_future_usage": "on_session", - "customer_acceptance": { - "acceptance_type": "offline", - "accepted_at": "1963-05-03T04:07:52.723Z", - "online": { - "ip_address": "127.0.0.1", - "user_agent": "amet irure esse" + "PaymentIntent": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "requires_payment_method" + } + } + }, + "3DSManualCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "requires_capture" + } + } + }, + "3DSAutoCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded" + } + } + }, + "No3DSManualCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "requires_capture" + } + } + }, + "No3DSAutoCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded" + } + } + }, + "Capture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + }, + "Response": { + "status": 200, + "body":{ + "status": "succeeded", + "amount": 6500, + "amount_capturable": 0, + "amount_received": 6500, + + } + } + }, + "PartialCapture": { + "Request": { + + }, + "Response": { + "status": 200, + "body": { + "status": "partially_captured", + "amount": 6500, + "amount_capturable": 0, + "amount_received": 100, + } + + } + }, + "Void":{ + "Request": { + }, + "Response": { + "status": 200, + "body":{ + status: "cancelled" + + } + } + }, + "Refund": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded", + } + + } + }, + "PartialRefund": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded", + } + + } + }, + "SyncRefund": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded", + } + + } + }, + "MandateSingleUse3DSAutoCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded" + } + } + + }, + "MandateSingleUse3DSManualCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 200, + "body": { + "status": "requires_customer_action" + } + } + + }, + "MandateSingleUseNo3DSAutoCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } } }, + "Response": { + "status": 200, + "body": { + "status": "succeeded" + } + } + }, + "MandateSingleUseNo3DSManualCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 200, + "body": { + "status": "requires_capture" + } + } + }, + "MandateMultiUseNo3DSAutoCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "multi_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded" + } + } + }, + "MandateMultiUseNo3DSManualCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "multi_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 200, + "body": { + "status": "requires_capture" + } + } + }, + "MandateMultiUse3DSAutoCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "mandate_type": { + "multi_use": { + "amount": 8000, + "currency": "USD" + } + }, + }, + "Response": { + "status": 200, + "body": { + "status": "requires_capture" + } + } + }, + "MandateMultiUse3DSManualCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "mandate_type": { + "multi_use": { + "amount": 8000, + "currency": "USD" + } + }, + }, + "Response": { + "status": 200, + "body": { + "status": "requires_capture" + } + } + }, + "ZeroAuthMandate": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded" + } + } + }, + "SaveCardUseNo3DSAutoCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "setup_future_usage": "on_session", + "customer_acceptance": { + "acceptance_type": "offline", + "accepted_at": "1963-05-03T04:07:52.723Z", + "online": { + "ip_address": "127.0.0.1", + "user_agent": "amet irure esse" + } + }, + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded" + } + } + }, + "SaveCardUseNo3DSManualCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "setup_future_usage": "on_session", + "customer_acceptance": { + "acceptance_type": "offline", + "accepted_at": "1963-05-03T04:07:52.723Z", + "online": { + "ip_address": "127.0.0.1", + "user_agent": "amet irure esse" + } + }, + }, + "Response": { + "status": 200, + "body": { + "status": "requires_capture" + } + } }, } }; \ No newline at end of file diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Trustpay.js b/cypress-tests/cypress/e2e/ConnectorUtils/Trustpay.js index 71d0348c5eec..182d10857ece 100644 --- a/cypress-tests/cypress/e2e/ConnectorUtils/Trustpay.js +++ b/cypress-tests/cypress/e2e/ConnectorUtils/Trustpay.js @@ -16,98 +16,419 @@ const successfulThreeDSTestCardDetails = { export const connectorDetails = { card_pm:{ - "3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "customer_acceptance": null, - "setup_future_usage": "on_session", - }, - "No3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "customer_acceptance": null, - "setup_future_usage": "on_session", - }, - "MandateSingleUse3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "mandate_type": { - "single_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateSingleUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "mandate_type": { - "single_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateMultiUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "mandate_type": { - "multi_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateMultiUse3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "mandate_type": { - "multi_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "SaveCardUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "setup_future_usage": "on_session", - "customer_acceptance": { - "acceptance_type": "offline", - "accepted_at": "1963-05-03T04:07:52.723Z", - "online": { - "ip_address": "127.0.0.1", - "user_agent": "amet irure esse" + "PaymentIntent": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "requires_payment_method" } + } + }, + "3DSAutoCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded" + } + } + }, + "3DSManualCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" }, + "Response": { + "status": 400, + "body": { + "error": { + "type": "invalid_request", + "message": "Payment method type not supported", + "code": "HE_03", + "reason": "manual is not supported by trustpay" + } + } + } + }, + "No3DSAutoCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded" + } + } + }, + "No3DSManualCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + "setup_future_usage": "on_session" + }, + "Response": { + "status": 400, + "body": { + "error": { + "type": "invalid_request", + "message": "Payment method type not supported", + "code": "HE_03", + "reason": "manual is not supported by trustpay" + } + } + } + }, + "Capture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + }, + "Response": { + "status": 400, + "body": { + "error": { + "type": "invalid_request", + "message": "This Payment could not be captured because it has a payment.status of requires_payment_method. The expected state is requires_capture, partially_captured_and_capturable, processing", + "code": "IR_14", + } + } + } + }, + "PartialCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "paymentSuccessfulStatus": "succeeded", + "paymentSyncStatus": "succeeded", + "refundStatus": "succeeded", + "refundSyncStatus": "succeeded", + "customer_acceptance": null, + }, + "Response": { + "status": 400, + "body": { + "error": { + "type": "invalid_request", + "message": "This Payment could not be captured because it has a payment.status of requires_payment_method. The expected state is requires_capture, partially_captured_and_capturable, processing", + "code": "IR_14", + } + } + } + }, + "Void":{ + "Request": { + }, + "Response": { + "status": 200, + "body":{ + status: "cancelled" + + } + } + }, + "Refund": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded", + } + + } + }, + "PartialRefund": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + }, + "Response": { + "status": 200, + "body": { + "error_code": "1", + "error_message": "transaction declined (invalid amount)", + } + + } + }, + "SyncRefund": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "customer_acceptance": null, + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded", + } + + } + }, + "MandateSingleUse3DSAutoCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 400, + "body": { + "error": { + "type": "invalid_request", + "message": "Payment method type not supported", + "code": "HE_03", + } + } + } + + }, + "MandateSingleUse3DSManualCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 400, + "body": { + "error": { + "type": "invalid_request", + "message": "Payment method type not supported", + "code": "HE_03", + } + } + } + + }, + "MandateSingleUseNo3DSManualCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 400, + "body": { + "error": { + "type": "invalid_request", + "message": "Payment method type not supported", + "code": "HE_03", + } + } + } + }, + "MandateSingleUseNo3DSAutoCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 400, + "body": { + "error": { + "type": "invalid_request", + "message": "Payment method type not supported", + "code": "HE_03", + } + } + } + }, + "MandateMultiUseNo3DSAutoCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "multi_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 400, + "body": { + "error": { + "type": "invalid_request", + "message": "Payment method type not supported", + "code": "HE_03", + } + } + } + }, + "MandateMultiUseNo3DSManualCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "multi_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 400, + "body": { + "error": { + "type": "invalid_request", + "message": "Payment method type not supported", + "code": "HE_03", + } + } + } + }, + "MandateMultiUse3DSAutoCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "mandate_type": { + "multi_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded" + } + } + }, + "MandateMultiUse3DSManualCapture": { + "Request": { + "card": successfulThreeDSTestCardDetails, + "currency": "USD", + "mandate_type": { + "multi_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 400, + "body": { + "error": { + "type": "invalid_request", + "message": "Payment method type not supported", + "code": "HE_03", + } + } + } + }, + "ZeroAuthMandate": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "mandate_type": { + "single_use": { + "amount": 8000, + "currency": "USD" + } + } + }, + "Response": { + "status": 501, + "body": { + "error": { + "type": "invalid_request", + "message": "Setup Mandate flow for Trustpay is not implemented", + "code": "IR_00", + } + } + } + }, + "SaveCardUseNo3DSAutoCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "setup_future_usage": "on_session", + "customer_acceptance": { + "acceptance_type": "offline", + "accepted_at": "1963-05-03T04:07:52.723Z", + "online": { + "ip_address": "127.0.0.1", + "user_agent": "amet irure esse" + } + }, + }, + "Response": { + "status": 200, + "body": { + "status": "succeeded" + } + } + }, + "SaveCardUseNo3DSManualCapture": { + "Request": { + "card": successfulNo3DSCardDetails, + "currency": "USD", + "setup_future_usage": "on_session", + "customer_acceptance": { + "acceptance_type": "offline", + "accepted_at": "1963-05-03T04:07:52.723Z", + "online": { + "ip_address": "127.0.0.1", + "user_agent": "amet irure esse" + } + }, + }, + "Response": { + "status": 400, + "body": { + "error": { + "type": "invalid_request", + "message": "Payment method type not supported", + "code": "HE_03", + } + } + } }, } } \ No newline at end of file diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/utils.js b/cypress-tests/cypress/e2e/ConnectorUtils/utils.js index c667c402c564..960481a1252a 100644 --- a/cypress-tests/cypress/e2e/ConnectorUtils/utils.js +++ b/cypress-tests/cypress/e2e/ConnectorUtils/utils.js @@ -34,4 +34,13 @@ function getValueByKey(jsonObject, key) { } else { return null; } +} + +export const should_continue_further = (res_data) => { + if(res_data.body.error !== undefined || res_data.body.error_code !== undefined || res_data.body.error_message !== undefined){ + return false; + } + else { + return true; + } } \ No newline at end of file diff --git a/cypress-tests/cypress/fixtures/confirm-body.json b/cypress-tests/cypress/fixtures/confirm-body.json index 526d55e3fa84..32b9a7108be7 100644 --- a/cypress-tests/cypress/fixtures/confirm-body.json +++ b/cypress-tests/cypress/fixtures/confirm-body.json @@ -47,6 +47,7 @@ "screen_width": 1728, "time_zone": -330, "java_enabled": true, - "java_script_enabled": true + "java_script_enabled": true, + "ip_address": "127.0.0.1" } } diff --git a/cypress-tests/cypress/fixtures/create-confirm-body.json b/cypress-tests/cypress/fixtures/create-confirm-body.json index 1399f181342d..cf95e6f8c8fe 100644 --- a/cypress-tests/cypress/fixtures/create-confirm-body.json +++ b/cypress-tests/cypress/fixtures/create-confirm-body.json @@ -1,10 +1,10 @@ { - "amount": 6540, + "amount": 6500, "currency": "USD", "confirm": true, "capture_method": "automatic", "capture_on": "2022-09-10T10:11:12Z", - "amount_to_capture": 6540, + "amount_to_capture": 6500, "customer_id": "john123", "email": "guest@example.com", "name": "John Doe", diff --git a/cypress-tests/cypress/fixtures/save-card-confirm-body.json b/cypress-tests/cypress/fixtures/save-card-confirm-body.json index 9a39a3f64972..6ef086825f66 100644 --- a/cypress-tests/cypress/fixtures/save-card-confirm-body.json +++ b/cypress-tests/cypress/fixtures/save-card-confirm-body.json @@ -28,5 +28,17 @@ "first_name": "john", "last_name": "doe" } + }, + "browser_info": { + "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36", + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", + "language": "en-US", + "color_depth": 30, + "screen_height": 1117, + "screen_width": 1728, + "time_zone": -330, + "java_enabled": true, + "java_script_enabled": true, + "ip_address": "127.0.0.1" } } diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js index 3eeeb5a14549..b28619d788a6 100644 --- a/cypress-tests/cypress/support/commands.js +++ b/cypress-tests/cypress/support/commands.js @@ -126,21 +126,19 @@ Cypress.Commands.add("createCustomerCallTest", (customerCreateBody, globalState) }).then((response) => { logRequestId(response.headers['x-request-id']); - // Handle the response as needed - console.log(response); - globalState.set("customerId", response.body.customer_id); }); }); -Cypress.Commands.add("createPaymentIntentTest", (request, det, authentication_type, capture_method, globalState) => { - if (!request || typeof request !== "object" || !det.currency || !authentication_type) { +Cypress.Commands.add("createPaymentIntentTest", (request, req_data, res_data, authentication_type, capture_method, globalState) => { + if (!request || typeof request !== "object" || !req_data.currency || !authentication_type) { throw new Error("Invalid parameters provided to createPaymentIntentTest command"); } - request.currency = det.currency; + request.currency = req_data.currency; request.authentication_type = authentication_type; request.capture_method = capture_method; - request.setup_future_usage = det.setup_future_usage; + request.setup_future_usage = req_data.setup_future_usage; + request.customer_acceptance = req_data.customer_acceptance; request.customer_id = globalState.get("customerId"); globalState.set("paymentAmount", request.amount); cy.request({ @@ -151,20 +149,33 @@ Cypress.Commands.add("createPaymentIntentTest", (request, det, authentication_ty Accept: "application/json", "api-key": globalState.get("apiKey"), }, + failOnStatusCode: false, body: request, }).then((response) => { logRequestId(response.headers['x-request-id']); - console.log(response); + + expect(res_data.status).to.equal(response.status); expect(response.headers["content-type"]).to.include("application/json"); - expect(response.body).to.have.property("client_secret"); - const clientSecret = response.body.client_secret; - globalState.set("clientSecret", clientSecret); - globalState.set("paymentID", response.body.payment_id); - cy.log(clientSecret); - expect("requires_payment_method").to.equal(response.body.status); - expect(request.amount).to.equal(response.body.amount); - expect(null).to.equal(response.body.amount_received); - expect(request.amount).to.equal(response.body.amount_capturable); + + if(response.status === 200){ + expect(response.body).to.have.property("client_secret"); + const clientSecret = response.body.client_secret; + globalState.set("clientSecret", clientSecret); + globalState.set("paymentID", response.body.payment_id); + cy.log(clientSecret); + for(const key in res_data.body) { + expect(res_data.body[key]).to.equal(response.body[key]); + } + expect(request.amount).to.equal(response.body.amount); + expect(null).to.equal(response.body.amount_received); + expect(request.amount).to.equal(response.body.amount_capturable); + } + else { + expect(response.body).to.have.property("error"); + for(const key in res_data.body.error) { + expect(res_data.body.error[key]).to.equal(response.body.error[key]); + } + } }); }); @@ -182,7 +193,6 @@ Cypress.Commands.add("paymentMethodsCallTest", (globalState) => { }).then((response) => { logRequestId(response.headers['x-request-id']); - console.log(response); expect(response.headers["content-type"]).to.include("application/json"); expect(response.body).to.have.property("redirect_url"); expect(response.body).to.have.property("payment_methods"); @@ -191,12 +201,12 @@ Cypress.Commands.add("paymentMethodsCallTest", (globalState) => { }); }); -Cypress.Commands.add("confirmCallTest", (confirmBody, details, confirm, globalState) => { +Cypress.Commands.add("confirmCallTest", (confirmBody, req_data, res_data, confirm, globalState) => { const paymentIntentID = globalState.get("paymentID"); - confirmBody.payment_method_data.card = details.card; + confirmBody.payment_method_data.card = req_data.card; confirmBody.confirm = confirm; confirmBody.client_secret = globalState.get("clientSecret"); - confirmBody.customer_acceptance = details.customer_acceptance; + confirmBody.customer_acceptance = req_data.customer_acceptance; cy.request({ method: "POST", @@ -205,49 +215,60 @@ Cypress.Commands.add("confirmCallTest", (confirmBody, details, confirm, globalSt "Content-Type": "application/json", "api-key": globalState.get("publishableKey"), }, + failOnStatusCode: false, body: confirmBody, }).then((response) => { logRequestId(response.headers['x-request-id']); - console.log(response); + + expect(res_data.status).to.equal(response.status); expect(response.headers["content-type"]).to.include("application/json"); - globalState.set("paymentID", paymentIntentID); - if (response.body.capture_method === "automatic") { - if (response.body.authentication_type === "three_ds") { - expect(response.body).to.have.property("next_action") - .to.have.property("redirect_to_url"); - globalState.set("nextActionUrl", response.body.next_action.redirect_to_url); - } else if (response.body.authentication_type === "no_three_ds") { - expect(details.paymentSuccessfulStatus).to.equal(response.body.status); - } else { - // Handle other authentication types as needed - throw new Error(`Unsupported authentication type: ${authentication_type}`); - } - } else if (response.body.capture_method === "manual") { - if (response.body.authentication_type === "three_ds") { - expect(response.body).to.have.property("next_action") - .to.have.property("redirect_to_url") - globalState.set("nextActionUrl", response.body.next_action.redirect_to_url); - } - else if (response.body.authentication_type === "no_three_ds") { - expect("requires_capture").to.equal(response.body.status); - } else { - // Handle other authentication types as needed - throw new Error(`Unsupported authentication type: ${authentication_type}`); + if(response.status === 200){ + globalState.set("paymentID", paymentIntentID); + if (response.body.capture_method === "automatic") { + if (response.body.authentication_type === "three_ds") { + expect(response.body).to.have.property("next_action") + .to.have.property("redirect_to_url"); + globalState.set("nextActionUrl", response.body.next_action.redirect_to_url); + } else if (response.body.authentication_type === "no_three_ds") { + for(const key in res_data.body) { + expect(res_data.body[key]).to.equal(response.body[key]); + } + } else { + // Handle other authentication types as needed + throw new Error(`Unsupported authentication type: ${authentication_type}`); + } + } else if (response.body.capture_method === "manual") { + if (response.body.authentication_type === "three_ds") { + expect(response.body).to.have.property("next_action") + .to.have.property("redirect_to_url") + globalState.set("nextActionUrl", response.body.next_action.redirect_to_url); + } + else if (response.body.authentication_type === "no_three_ds") { + for(const key in res_data.body) { + expect(res_data.body[key]).to.equal(response.body[key]); + } } else { + // Handle other authentication types as needed + throw new Error(`Unsupported authentication type: ${authentication_type}`); + } } } else { - throw new Error(`Unsupported capture method: ${capture_method}`); + expect(response.body).to.have.property("error"); + for(const key in res_data.body.error) { + expect(res_data.body.error[key]).to.equal(response.body.error[key]); + } } + }); }); -Cypress.Commands.add("createConfirmPaymentTest", (createConfirmPaymentBody, details, authentication_type, capture_method, globalState) => { - createConfirmPaymentBody.payment_method_data.card = details.card; +Cypress.Commands.add("createConfirmPaymentTest", (createConfirmPaymentBody, req_data, res_data, authentication_type, capture_method, globalState) => { + createConfirmPaymentBody.payment_method_data.card = req_data.card; createConfirmPaymentBody.authentication_type = authentication_type; - createConfirmPaymentBody.currency = details.currency; + createConfirmPaymentBody.currency = req_data.currency; createConfirmPaymentBody.capture_method = capture_method; - createConfirmPaymentBody.customer_acceptance = details.customer_acceptance; - createConfirmPaymentBody.setup_future_usage = details.setup_future_usage; + createConfirmPaymentBody.customer_acceptance = req_data.customer_acceptance; + createConfirmPaymentBody.setup_future_usage = req_data.setup_future_usage; createConfirmPaymentBody.customer_id = globalState.get("customerId"); cy.request({ @@ -257,49 +278,66 @@ Cypress.Commands.add("createConfirmPaymentTest", (createConfirmPaymentBody, deta "Content-Type": "application/json", "api-key": globalState.get("apiKey"), }, + failOnStatusCode: false, body: createConfirmPaymentBody, }).then((response) => { logRequestId(response.headers['x-request-id']); - console.log(response); + + expect(res_data.status).to.equal(response.status); expect(response.headers["content-type"]).to.include("application/json"); - expect(response.body).to.have.property("status"); - globalState.set("paymentAmount", createConfirmPaymentBody.amount); - globalState.set("paymentID", response.body.payment_id); - if (response.body.capture_method === "automatic") { - if (response.body.authentication_type === "three_ds") { - expect(response.body).to.have.property("next_action") - .to.have.property("redirect_to_url") - globalState.set("nextActionUrl", response.body.next_action.redirect_to_url); + + if(response.status === 200){ + if (response.body.capture_method === "automatic") { + expect(response.body).to.have.property("status"); + globalState.set("paymentAmount", createConfirmPaymentBody.amount); + globalState.set("paymentID", response.body.payment_id); + if (response.body.authentication_type === "three_ds") { + expect(response.body).to.have.property("next_action") + .to.have.property("redirect_to_url") + globalState.set("nextActionUrl", response.body.next_action.redirect_to_url); + } + else if (response.body.authentication_type === "no_three_ds") { + for(const key in res_data.body) { + expect(res_data.body[key]).to.equal(response.body[key]); + } + } else { + // Handle other authentication types as needed + throw new Error(`Unsupported authentication type: ${authentication_type}`); + } } - else if (response.body.authentication_type === "no_three_ds") { - expect(details.paymentSuccessfulStatus).to.equal(response.body.status); - } else { - // Handle other authentication types as needed - throw new Error(`Unsupported authentication type: ${authentication_type}`); + else if (response.body.capture_method === "manual") { + expect(response.body).to.have.property("status"); + globalState.set("paymentAmount", createConfirmPaymentBody.amount); + globalState.set("paymentID", response.body.payment_id); + if (response.body.authentication_type === "three_ds") { + expect(response.body).to.have.property("next_action") + .to.have.property("redirect_to_url") + globalState.set("nextActionUrl", response.body.next_action.redirect_to_url); + } + else if (response.body.authentication_type === "no_three_ds") { + for(const key in res_data.body) { + expect(res_data.body[key]).to.equal(response.body[key]); + } } else { + // Handle other authentication types as needed + throw new Error(`Unsupported authentication type: ${authentication_type}`); + } } } - else if (response.body.capture_method === "manual") { - if (response.body.authentication_type === "three_ds") { - expect(response.body).to.have.property("next_action") - .to.have.property("redirect_to_url") - globalState.set("nextActionUrl", response.body.next_action.redirect_to_url); - } - else if (response.body.authentication_type === "no_three_ds") { - expect("requires_capture").to.equal(response.body.status); - } else { - // Handle other authentication types as needed - throw new Error(`Unsupported authentication type: ${authentication_type}`); + else{ + expect(response.body).to.have.property("error"); + for(const key in res_data.body.error) { + expect(res_data.body.error[key]).to.equal(response.body.error[key]); } } }); }); // This is consequent saved card payment confirm call test(Using payment token) -Cypress.Commands.add("saveCardConfirmCallTest", (saveCardConfirmBody,det,globalState) => { +Cypress.Commands.add("saveCardConfirmCallTest", (SaveCardConfirmBody, req_data, res_data,globalState) => { const paymentIntentID = globalState.get("paymentID"); - saveCardConfirmBody.card_cvc = det.card.card_cvc; - saveCardConfirmBody.payment_token = globalState.get("paymentToken"); - saveCardConfirmBody.client_secret = globalState.get("clientSecret"); + SaveCardConfirmBody.card_cvc = req_data.card.card_cvc; + SaveCardConfirmBody.payment_token = globalState.get("paymentToken"); + SaveCardConfirmBody.client_secret = globalState.get("clientSecret"); console.log("conf conn ->" + globalState.get("connectorId")); cy.request({ method: "POST", @@ -308,46 +346,55 @@ Cypress.Commands.add("saveCardConfirmCallTest", (saveCardConfirmBody,det,globalS "Content-Type": "application/json", "api-key": globalState.get("publishableKey"), }, - body: saveCardConfirmBody, - + failOnStatusCode: false, + body: SaveCardConfirmBody, }) .then((response) => { logRequestId(response.headers['x-request-id']); - console.log(response); + + expect(res_data.status).to.equal(response.status); expect(response.headers["content-type"]).to.include("application/json"); globalState.set("paymentID", paymentIntentID); - if (response.body.capture_method === "automatic") { - if (response.body.authentication_type === "three_ds") { - expect(response.body).to.have.property("next_action") - .to.have.property("redirect_to_url"); - const nextActionUrl = response.body.next_action.redirect_to_url; - } else if (response.body.authentication_type === "no_three_ds") { - expect(response.body.status).to.equal(det.paymentSuccessfulStatus); - expect(response.body.customer_id).to.equal(globalState.get("customerId")); - } else { - // Handle other authentication types as needed - throw new Error(`Unsupported authentication type: ${authentication_type}`); - } - } else if (response.body.capture_method === "manual") { - if (response.body.authentication_type === "three_ds") { - expect(response.body).to.have.property("next_action") - .to.have.property("redirect_to_url") - } - else if (response.body.authentication_type === "no_three_ds") { - expect(response.body.status).to.equal("requires_capture"); - expect(response.body.customer_id).to.equal(globalState.get("customerId")); - } else { - // Handle other authentication types as needed - throw new Error(`Unsupported authentication type: ${authentication_type}`); + if(response.status === 200){ + if (response.body.capture_method === "automatic") { + if (response.body.authentication_type === "three_ds") { + expect(response.body).to.have.property("next_action") + .to.have.property("redirect_to_url"); + const nextActionUrl = response.body.next_action.redirect_to_url; + } else if (response.body.authentication_type === "no_three_ds") { + for(const key in res_data.body) { + expect(res_data.body[key]).to.equal(response.body[key]); + } + expect(response.body.customer_id).to.equal(globalState.get("customerId")); + } else { + // Handle other authentication types as needed + throw new Error(`Unsupported authentication type: ${authentication_type}`); + } + } else if (response.body.capture_method === "manual") { + if (response.body.authentication_type === "three_ds") { + expect(response.body).to.have.property("next_action") + .to.have.property("redirect_to_url") + } + else if (response.body.authentication_type === "no_three_ds") { + for(const key in res_data.body) { + expect(res_data.body[key]).to.equal(response.body[key]); + } expect(response.body.customer_id).to.equal(globalState.get("customerId")); + } else { + // Handle other authentication types as needed + throw new Error(`Unsupported authentication type: ${authentication_type}`); + } } } else { - throw new Error(`Unsupported capture method: ${capture_method}`); + expect(response.body).to.have.property("error"); + for(const key in res_data.body.error) { + expect(res_data.body.error[key]).to.equal(response.body.error[key]); + } } }); }); -Cypress.Commands.add("captureCallTest", (requestBody, amount_to_capture, paymentSuccessfulStatus, globalState) => { +Cypress.Commands.add("captureCallTest", (requestBody, req_data, res_data, amount_to_capture, globalState) => { const payment_id = globalState.get("paymentID"); requestBody.amount_to_capture = amount_to_capture; let amount = globalState.get("paymentAmount"); @@ -358,33 +405,30 @@ Cypress.Commands.add("captureCallTest", (requestBody, amount_to_capture, payment "Content-Type": "application/json", "api-key": globalState.get("apiKey"), }, + failOnStatusCode: false, body: requestBody, }).then((response) => { logRequestId(response.headers['x-request-id']); + expect(res_data.status).to.equal(response.status); expect(response.headers["content-type"]).to.include("application/json"); - expect(response.body.payment_id).to.equal(payment_id); - if (amount_to_capture == amount && response.body.status == "succeeded") { - expect(response.body.amount).to.equal(amount_to_capture); - expect(response.body.amount_capturable).to.equal(0); - expect(response.body.amount_received).to.equal(amount); - expect(response.body.status).to.equal(paymentSuccessfulStatus); - } else if (response.body.status == "processing") { - expect(response.body.amount).to.equal(amount); - expect(response.body.amount_capturable).to.equal(amount); - expect(response.body.amount_received).to.equal(0); - expect(response.body.status).to.equal(paymentSuccessfulStatus); + if(response.body.capture_method !== undefined) { + expect(response.body.payment_id).to.equal(payment_id); + for(const key in res_data.body) { + expect(res_data.body[key]).to.equal(response.body[key]); + } } - else { - expect(response.body.amount).to.equal(amount); - expect(response.body.amount_capturable).to.equal(0); - expect(response.body.amount_received).to.equal(amount_to_capture); - expect(response.body.status).to.equal("partially_captured"); + else{ + expect(response.body).to.have.property("error"); + for(const key in res_data.body.error) { + expect(res_data.body.error[key]).to.equal(response.body.error[key]); + } } + }); }); -Cypress.Commands.add("voidCallTest", (requestBody, globalState) => { +Cypress.Commands.add("voidCallTest", (requestBody, req_data, res_data, globalState) => { const payment_id = globalState.get("paymentID"); cy.request({ method: "POST", @@ -393,16 +437,24 @@ Cypress.Commands.add("voidCallTest", (requestBody, globalState) => { "Content-Type": "application/json", "api-key": globalState.get("apiKey"), }, + failOnStatusCode: false, body: requestBody, }).then((response) => { logRequestId(response.headers['x-request-id']); + expect(res_data.status).to.equal(response.status); expect(response.headers["content-type"]).to.include("application/json"); - expect(response.body.payment_id).to.equal(payment_id); - expect(response.body.amount).to.equal(globalState.get("paymentAmount")); - // expect(response.body.amount_capturable).to.equal(0); - expect(response.body.amount_received).to.be.oneOf([0, null]); - expect(response.body.status).to.equal("cancelled"); + if(response.status === 200) { + for(const key in res_data.body) { + expect(res_data.body[key]).to.equal(response.body[key]); + } + } + else{ + expect(response.body).to.have.property("error"); + for(const key in res_data.body.error) { + expect(res_data.body.error[key]).to.equal(response.body.error[key]); + } + } }); }); @@ -416,6 +468,7 @@ Cypress.Commands.add("retrievePaymentCallTest", (globalState) => { "Content-Type": "application/json", "api-key": globalState.get("apiKey"), }, + failOnStatusCode: false, }).then((response) => { logRequestId(response.headers['x-request-id']); @@ -427,7 +480,7 @@ Cypress.Commands.add("retrievePaymentCallTest", (globalState) => { }); }); -Cypress.Commands.add("refundCallTest", (requestBody, refund_amount, det, globalState) => { +Cypress.Commands.add("refundCallTest", (requestBody, req_data, res_data, refund_amount, globalState) => { const payment_id = globalState.get("paymentID"); requestBody.payment_id = payment_id; requestBody.amount = refund_amount; @@ -438,19 +491,31 @@ Cypress.Commands.add("refundCallTest", (requestBody, refund_amount, det, globalS "Content-Type": "application/json", "api-key": globalState.get("apiKey"), }, + failOnStatusCode: false, body: requestBody }).then((response) => { logRequestId(response.headers['x-request-id']); - + expect(res_data.status).to.equal(response.status); expect(response.headers["content-type"]).to.include("application/json"); - globalState.set("refundId", response.body.refund_id); - expect(response.body.status).to.equal(det.refundStatus); - expect(response.body.amount).to.equal(refund_amount); - expect(response.body.payment_id).to.equal(payment_id); + + if(response.status === 200) { + globalState.set("refundId", response.body.refund_id); + for(const key in res_data.body) { + expect(res_data.body[key]).to.equal(response.body[key]); + } + expect(response.body.payment_id).to.equal(payment_id); + } + else{ + expect(response.body).to.have.property("error"); + for(const key in res_data.body.error) { + expect(res_data.body.error[key]).to.equal(response.body.error[key]); + } + } + }); }); -Cypress.Commands.add("syncRefundCallTest", (det, globalState) => { +Cypress.Commands.add("syncRefundCallTest", (req_data, res_data, globalState) => { const refundId = globalState.get("refundId"); cy.request({ method: "GET", @@ -459,22 +524,25 @@ Cypress.Commands.add("syncRefundCallTest", (det, globalState) => { "Content-Type": "application/json", "api-key": globalState.get("apiKey"), }, + failOnStatusCode: false, }).then((response) => { logRequestId(response.headers['x-request-id']); - + expect(res_data.status).to.equal(response.status); expect(response.headers["content-type"]).to.include("application/json"); - expect(response.body.status).to.equal(det.refundSyncStatus); + for(const key in res_data.body) { + expect(res_data.body[key]).to.equal(response.body[key]); + } }); }); -Cypress.Commands.add("citForMandatesCallTest", (requestBody, amount, details, confirm, capture_method, payment_type, globalState) => { - requestBody.payment_method_data.card = details.card; +Cypress.Commands.add("citForMandatesCallTest", (requestBody, req_data, res_data, amount, confirm, capture_method, payment_type, globalState) => { + requestBody.payment_method_data.card = req_data.card; requestBody.payment_type = payment_type; requestBody.confirm = confirm; requestBody.amount = amount; - requestBody.currency = details.currency; + requestBody.currency = req_data.currency; requestBody.capture_method = capture_method; - requestBody.mandate_data.mandate_type = details.mandate_type; + requestBody.mandate_data.mandate_type = req_data.mandate_type; requestBody.customer_id = globalState.get("customerId"); globalState.set("paymentAmount", requestBody.amount); cy.request({ @@ -484,41 +552,50 @@ Cypress.Commands.add("citForMandatesCallTest", (requestBody, amount, details, co "Content-Type": "application/json", "api-key": globalState.get("apiKey"), }, + failOnStatusCode: false, body: requestBody, }).then((response) => { logRequestId(response.headers['x-request-id']); - + expect(res_data.status).to.equal(response.status); expect(response.headers["content-type"]).to.include("application/json"); - expect(response.body).to.have.property("mandate_id"); globalState.set("mandateId", response.body.mandate_id); globalState.set("paymentID", response.body.payment_id); - if (response.body.capture_method === "automatic") { - if (response.body.authentication_type === "three_ds") { - expect(response.body).to.have.property("next_action") - .to.have.property("redirect_to_url"); - const nextActionUrl = response.body.next_action.redirect_to_url; - globalState.set("nextActionUrl", response.body.next_action.redirect_to_url); - cy.log(response.body); - cy.log(nextActionUrl); - } else if (response.body.authentication_type === "no_three_ds") { - expect(response.body.status).to.equal(details.paymentSuccessfulStatus); - } else { - // Handle other authentication types as needed - throw new Error(`Unsupported authentication type: ${authentication_type}`); + if(response.status === 200) { + if (response.body.capture_method === "automatic") { + expect(response.body).to.have.property("mandate_id"); + if (response.body.authentication_type === "three_ds") { + expect(response.body).to.have.property("next_action") + .to.have.property("redirect_to_url"); + const nextActionUrl = response.body.next_action.redirect_to_url; + globalState.set("nextActionUrl", response.body.next_action.redirect_to_url); + cy.log(response.body); + cy.log(nextActionUrl); + } else if (response.body.authentication_type === "no_three_ds") { + for(const key in res_data.body) { + expect(res_data.body[key]).to.equal(response.body[key]); + } + } + for(const key in res_data.body) { + expect(res_data.body[key]).to.equal(response.body[key]); + } } - } - else if (response.body.capture_method === "manual") { - if (response.body.authentication_type === "three_ds") { - expect(response.body).to.have.property("next_action") + else if (response.body.capture_method === "manual") { + expect(response.body).to.have.property("mandate_id"); + if (response.body.authentication_type === "three_ds") { + expect(response.body).to.have.property("next_action") + } + for(const key in res_data.body) { + expect(res_data.body[key]).to.equal(response.body[key]); + } } - else if (response.body.authentication_type === "no_three_ds") { - expect(response.body.status).to.equal("requires_capture"); - } else { - throw new Error(`Unsupported authentication type: ${authentication_type}`); + } + else{ + expect(response.body).to.have.property("error"); + for(const key in res_data.body.error) { + expect(res_data.body.error[key]).to.equal(response.body.error[key]); } } - }); }); @@ -537,10 +614,10 @@ Cypress.Commands.add("mitForMandatesCallTest", (requestBody, amount, confirm, ca "Content-Type": "application/json", "api-key": globalState.get("apiKey"), }, + failOnStatusCode: false, body: requestBody, }).then((response) => { logRequestId(response.headers['x-request-id']); - expect(response.headers["content-type"]).to.include("application/json"); globalState.set("paymentID", response.body.payment_id); console.log("mit statusss-> " + response.body.status); @@ -644,13 +721,13 @@ Cypress.Commands.add("handleRedirection", (globalState, expected_redirection) => }) } else if (globalState.get("connectorId") === "nmi" || globalState.get("connectorId") === "noon") { - cy.get('iframe', { timeout: 100000 }) + cy.get('iframe', { timeout: 150000 }) .its('0.contentDocument.body') .within((body) => { - cy.get('iframe', { timeout: 10000 }) + cy.get('iframe', { timeout: 20000 }) .its('0.contentDocument.body') .within((body) => { - cy.get('form[name="cardholderInput"]', { timeout: 10000 }).should('exist').then(form => { + cy.get('form[name="cardholderInput"]', { timeout: 20000 }).should('exist').then(form => { cy.get('input[name="challengeDataEntry"]').click().type("1234"); cy.get('input[value="SUBMIT"]').click(); }) diff --git a/cypress-tests/readme.md b/cypress-tests/readme.md index 9285066bfe60..511625cdbfb9 100644 --- a/cypress-tests/readme.md +++ b/cypress-tests/readme.md @@ -37,7 +37,7 @@ To run test cases, follow these steps: export CYPRESS_BASEURL="base_url" export DEBUG=cypress:cli export CYPRESS_ADMINAPIKEY="admin_api_key" - export CYPRESS_CONNECToR_AUtH_FILE_PATH="path/to/creds.json" + export CYPRESS_CONNECTOR_AUTH_FILE_PATH="path/to/creds.json" ``` 4. Run Cypress test cases