From d061ad6d93343d0dc0799567739fad385476dc43 Mon Sep 17 00:00:00 2001 From: PiX <69745008+pixincreate@users.noreply.github.com> Date: Mon, 25 Nov 2024 16:59:22 +0530 Subject: [PATCH] refactor: directly pass `data` instead of splitting in `.cy.js` files --- .../00000-PaymentMethodListTests.cy.js | 77 +- .../00004-NoThreeDSAutoCapture.cy.js | 39 +- .../00005-ThreeDSAutoCapture.cy.js | 29 +- .../00006-NoThreeDSManualCapture.cy.js | 138 +-- .../e2e/PaymentTest/00007-VoidPayment.cy.js | 109 +- .../e2e/PaymentTest/00008-SyncPayment.cy.js | 29 +- .../e2e/PaymentTest/00009-RefundPayment.cy.js | 968 ++++-------------- .../e2e/PaymentTest/00010-SyncRefund.cy.js | 53 +- .../00011-CreateSingleuseMandate.cy.js | 81 +- .../00012-CreateMultiuseMandate.cy.js | 96 +- .../00013-ListAndRevokeMandate.cy.js | 12 +- .../e2e/PaymentTest/00014-SaveCardFlow.cy.js | 356 ++----- .../PaymentTest/00015-ZeroAuthMandate.cy.js | 75 +- .../00016-ThreeDSManualCapture.cy.js | 138 +-- .../e2e/PaymentTest/00017-BankTransfers.cy.js | 24 +- .../e2e/PaymentTest/00018-BankRedirect.cy.js | 125 +-- .../PaymentTest/00019-MandatesUsingPMID.cy.js | 171 +--- .../cypress/e2e/PaymentTest/00020-UPI.cy.js | 70 +- .../e2e/PaymentTest/00021-Variations.cy.js | 363 ++----- .../PaymentTest/00022-PaymentMethods.cy.js | 37 +- .../PaymentTest/00023-ConnectorAgnostic.cy.js | 79 +- .../cypress/e2e/PaymentUtils/Commons.js | 19 +- .../cypress/e2e/PaymentUtils/Paybox.js | 17 +- .../cypress/e2e/PaymentUtils/Utils.js | 17 +- .../e2e/PayoutTest/00003-CardTest.cy.js | 23 +- .../e2e/PayoutTest/00004-BankTransfer.cy.js | 22 +- .../e2e/PayoutTest/00005-SavePayout.cy.js | 70 +- .../RoutingTest/00000-PriorityRouting.cy.js | 59 +- .../00001-VolumeBasedRouting.cy.js | 68 +- .../RoutingTest/00002-RuleBasedRouting.cy.js | 134 +-- .../e2e/RoutingTest/00003-Retries.cy.js | 145 +-- .../cypress/e2e/RoutingUtils/Utils.js | 10 +- cypress-tests/cypress/support/commands.js | 476 +++++---- 33 files changed, 1104 insertions(+), 3025 deletions(-) diff --git a/cypress-tests/cypress/e2e/PaymentMethodListTest/00000-PaymentMethodListTests.cy.js b/cypress-tests/cypress/e2e/PaymentMethodListTest/00000-PaymentMethodListTests.cy.js index af1f16195c60..8fbc91a02ecc 100644 --- a/cypress-tests/cypress/e2e/PaymentMethodListTest/00000-PaymentMethodListTests.cy.js +++ b/cypress-tests/cypress/e2e/PaymentMethodListTest/00000-PaymentMethodListTests.cy.js @@ -68,13 +68,16 @@ describe("Payment Method list using Constraint Graph flow tests", () => { // creating payment with currency as EUR and no billing address it("create-payment-call-test", () => { let data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"]; - let req_data = data["RequestCurrencyEUR"]; - let res_data = data["Response"]; + + const newData = { + ...data, + Request: data.RequestCurrencyEUR, + RequestCurrencyEUR: undefined, // we do not need this anymore + }; cy.createPaymentIntentTest( create_payment_body_with_currency("EUR"), - req_data, - res_data, + newData, "no_three_ds", "automatic", globalState @@ -148,13 +151,16 @@ describe("Payment Method list using Constraint Graph flow tests", () => { // creating payment with currency as INR and no billing address it("create-payment-call-test", () => { let data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"]; - let req_data = data["RequestCurrencyINR"]; - let res_data = data["Response"]; + + const newData = { + ...data, + Request: data.RequestCurrencyINR, + RequestCurrencyINR: undefined, // we do not need this anymore + }; cy.createPaymentIntentTest( create_payment_body_with_currency("INR"), - req_data, - res_data, + newData, "no_three_ds", "automatic", globalState @@ -228,13 +234,16 @@ describe("Payment Method list using Constraint Graph flow tests", () => { // creating payment with currency as USD and billing address as US it("create-payment-call-test", () => { let data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"]; - let req_data = data["RequestCurrencyUSD"]; - let res_data = data["Response"]; + + const newData = { + ...data, + Request: data.RequestCurrencyUSD, + RequestCurrencyUSD: undefined, // we do not need this anymore + }; cy.createPaymentIntentTest( create_payment_body_with_currency("USD"), - req_data, - res_data, + newData, "no_three_ds", "automatic", globalState @@ -308,13 +317,16 @@ describe("Payment Method list using Constraint Graph flow tests", () => { // creating payment with currency as EUR and billing address as US it("create-payment-call-test", () => { let data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"]; - let req_data = data["RequestCurrencyEUR"]; - let res_data = data["Response"]; + + const newData = { + ...data, + Request: data.RequestCurrencyEUR, + RequestCurrencyEUR: undefined, // we do not need this anymore + }; cy.createPaymentIntentTest( create_payment_body_with_currency_country("EUR", "US", "US"), - req_data, - res_data, + newData, "no_three_ds", "automatic", globalState @@ -390,13 +402,16 @@ describe("Payment Method list using Constraint Graph flow tests", () => { // creating payment with currency as USD and billing address as IN it("create-payment-call-test", () => { let data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"]; - let req_data = data["RequestCurrencyUSD"]; - let res_data = data["Response"]; + + const newData = { + ...data, + Request: data.RequestCurrencyUSD, + RequestCurrencyUSD: undefined, // we do not need this anymore + }; cy.createPaymentIntentTest( create_payment_body_with_currency_country("USD", "IN", "IN"), - req_data, - res_data, + newData, "no_three_ds", "automatic", globalState @@ -471,13 +486,16 @@ describe("Payment Method list using Constraint Graph flow tests", () => { // creating payment with currency as USD and billing address as IN it("create-payment-call-test", () => { let data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"]; - let req_data = data["RequestCurrencyUSD"]; - let res_data = data["Response"]; + + const newData = { + ...data, + Request: data.RequestCurrencyUSD, + RequestCurrencyUSD: undefined, // we do not need this anymore + }; cy.createPaymentIntentTest( create_payment_body_with_currency("USD"), - req_data, - res_data, + newData, "no_three_ds", "automatic", globalState @@ -551,13 +569,16 @@ describe("Payment Method list using Constraint Graph flow tests", () => { // creating payment with currency as EUR and no billing address it("create-payment-call-test", () => { let data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"]; - let req_data = data["RequestCurrencyEUR"]; - let res_data = data["Response"]; + + const newData = { + ...data, + Request: data.RequestCurrencyEUR, + RequestCurrencyEUR: undefined, // we do not need this anymore + }; cy.createPaymentIntentTest( create_payment_body_with_currency_country("EUR", "NL", "US"), - req_data, - res_data, + newData, "no_three_ds", "automatic", globalState diff --git a/cypress-tests/cypress/e2e/PaymentTest/00004-NoThreeDSAutoCapture.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00004-NoThreeDSAutoCapture.cy.js index c7352cacd6f0..459a3bd8771a 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00004-NoThreeDSAutoCapture.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00004-NoThreeDSAutoCapture.cy.js @@ -30,22 +30,16 @@ describe("Card - NoThreeDS payment flow test", () => { "PaymentIntent" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -57,21 +51,10 @@ describe("Card - NoThreeDS payment flow test", () => { "No3DSAutoCapture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState, - configs - ); + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -99,22 +82,16 @@ describe("Card - NoThreeDS payment flow test", () => { "No3DSAutoCapture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createConfirmPaymentTest( fixtures.createConfirmPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { diff --git a/cypress-tests/cypress/e2e/PaymentTest/00005-ThreeDSAutoCapture.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00005-ThreeDSAutoCapture.cy.js index 6b2610f94311..24f8db1f4cf7 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00005-ThreeDSAutoCapture.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00005-ThreeDSAutoCapture.cy.js @@ -29,22 +29,15 @@ describe("Card - ThreeDS payment flow test", () => { "PaymentIntent" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "three_ds", "automatic", - globalState, - configs + globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + if (should_continue) should_continue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -56,21 +49,9 @@ describe("Card - ThreeDS payment flow test", () => { "3DSAutoCapture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState, - configs - ); + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + if (should_continue) should_continue = utils.should_continue_further(data); }); it("Handle redirection", () => { diff --git a/cypress-tests/cypress/e2e/PaymentTest/00006-NoThreeDSManualCapture.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00006-NoThreeDSManualCapture.cy.js index 61fb1cc085e6..f62c47b28532 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00006-NoThreeDSManualCapture.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00006-NoThreeDSManualCapture.cy.js @@ -31,22 +31,16 @@ describe("Card - NoThreeDS Manual payment flow test", () => { "card_pm" ]["PaymentIntent"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "manual", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -58,21 +52,10 @@ describe("Card - NoThreeDS Manual payment flow test", () => { "card_pm" ]["No3DSManualCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState, - configs - ); + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -90,21 +73,10 @@ describe("Card - NoThreeDS Manual payment flow test", () => { "card_pm" ]["Capture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState, - configs - ); + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -132,22 +104,16 @@ describe("Card - NoThreeDS Manual payment flow test", () => { "card_pm" ]["No3DSManualCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createConfirmPaymentTest( fixtures.createConfirmPaymentBody, - req_data, - res_data, + data, "no_three_ds", "manual", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -165,21 +131,10 @@ describe("Card - NoThreeDS Manual payment flow test", () => { "card_pm" ]["Capture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState, - configs - ); + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -211,22 +166,16 @@ describe("Card - NoThreeDS Manual payment flow test", () => { "card_pm" ]["PaymentIntent"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "manual", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -238,21 +187,10 @@ describe("Card - NoThreeDS Manual payment flow test", () => { "card_pm" ]["No3DSManualCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState, - configs - ); + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -270,21 +208,10 @@ describe("Card - NoThreeDS Manual payment flow test", () => { "card_pm" ]["PartialCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 100, - globalState, - configs - ); + cy.captureCallTest(fixtures.captureBody, data, 100, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -312,22 +239,16 @@ describe("Card - NoThreeDS Manual payment flow test", () => { "card_pm" ]["No3DSManualCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createConfirmPaymentTest( fixtures.createConfirmPaymentBody, - req_data, - res_data, + data, "no_three_ds", "manual", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -345,21 +266,10 @@ describe("Card - NoThreeDS Manual payment flow test", () => { "card_pm" ]["PartialCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 100, - globalState, - configs - ); + cy.captureCallTest(fixtures.captureBody, data, 100, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { diff --git a/cypress-tests/cypress/e2e/PaymentTest/00007-VoidPayment.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00007-VoidPayment.cy.js index 7133f208afb5..105288b7a1d1 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00007-VoidPayment.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00007-VoidPayment.cy.js @@ -1,6 +1,5 @@ import * as fixtures from "../../fixtures/imports"; import State from "../../utils/State"; -import { validateConfig } from "../../utils/featureFlags"; import getConnectorDetails, * as utils from "../PaymentUtils/Utils"; let globalState; @@ -30,22 +29,16 @@ describe("Card - NoThreeDS Manual payment flow test", () => { "PaymentIntent" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "manual", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -57,21 +50,10 @@ describe("Card - NoThreeDS Manual payment flow test", () => { "No3DSManualCapture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState, - configs - ); + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("void-call-test", () => { @@ -79,20 +61,10 @@ describe("Card - NoThreeDS Manual payment flow test", () => { "VoidAfterConfirm" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.voidCallTest( - fixtures.voidBody, - req_data, - res_data, - globalState, - configs - ); + cy.voidCallTest(fixtures.voidBody, data, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); }); @@ -112,22 +84,16 @@ describe("Card - NoThreeDS Manual payment flow test", () => { "card_pm" ]["PaymentIntent"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "manual", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -139,20 +105,10 @@ describe("Card - NoThreeDS Manual payment flow test", () => { "card_pm" ]["Void"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.voidCallTest( - fixtures.voidBody, - req_data, - res_data, - globalState, - configs - ); + cy.voidCallTest(fixtures.voidBody, data, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); } ); @@ -171,22 +127,16 @@ describe("Card - NoThreeDS Manual payment flow test", () => { "PaymentIntent" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "manual", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -198,21 +148,10 @@ describe("Card - NoThreeDS Manual payment flow test", () => { "No3DSManualCapture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - false, - globalState, - configs - ); + cy.confirmCallTest(fixtures.confirmBody, data, false, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("void-call-test", () => { @@ -220,20 +159,10 @@ describe("Card - NoThreeDS Manual payment flow test", () => { "VoidAfterConfirm" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.voidCallTest( - fixtures.voidBody, - req_data, - res_data, - globalState, - configs - ); + cy.voidCallTest(fixtures.voidBody, data, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); }); }); diff --git a/cypress-tests/cypress/e2e/PaymentTest/00008-SyncPayment.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00008-SyncPayment.cy.js index 17802122af71..519af9aada63 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00008-SyncPayment.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00008-SyncPayment.cy.js @@ -28,22 +28,15 @@ describe("Card - Sync payment flow test", () => { "PaymentIntent" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", - globalState, - configs + globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + if (should_continue) should_continue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -55,21 +48,9 @@ describe("Card - Sync payment flow test", () => { "No3DSAutoCapture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState, - configs - ); + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + if (should_continue) should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { diff --git a/cypress-tests/cypress/e2e/PaymentTest/00009-RefundPayment.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00009-RefundPayment.cy.js index 3c18042b90b5..b18e05ada47a 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00009-RefundPayment.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00009-RefundPayment.cy.js @@ -30,22 +30,16 @@ describe("Card - Refund flow - No 3DS", () => { "PaymentIntent" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -57,21 +51,10 @@ describe("Card - Refund flow - No 3DS", () => { "No3DSAutoCapture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState, - configs - ); + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -89,21 +72,10 @@ describe("Card - Refund flow - No 3DS", () => { "Refund" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 6500, - globalState, - configs - ); + cy.refundCallTest(fixtures.refundBody, data, 6500, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { @@ -111,13 +83,10 @@ describe("Card - Refund flow - No 3DS", () => { "SyncRefund" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.syncRefundCallTest(req_data, res_data, globalState); + cy.syncRefundCallTest(data, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); }); @@ -135,22 +104,16 @@ describe("Card - Refund flow - No 3DS", () => { "PaymentIntent" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -162,21 +125,10 @@ describe("Card - Refund flow - No 3DS", () => { "No3DSAutoCapture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState, - configs - ); + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -194,21 +146,10 @@ describe("Card - Refund flow - No 3DS", () => { "PartialRefund" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 1200, - globalState, - configs - ); + cy.refundCallTest(fixtures.refundBody, data, 1200, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("refund-call-test", () => { @@ -216,21 +157,10 @@ describe("Card - Refund flow - No 3DS", () => { "PartialRefund" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 1200, - globalState, - configs - ); + cy.refundCallTest(fixtures.refundBody, data, 1200, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { @@ -238,13 +168,10 @@ describe("Card - Refund flow - No 3DS", () => { "SyncRefund" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.syncRefundCallTest(req_data, res_data, globalState); + cy.syncRefundCallTest(data, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); }); @@ -264,22 +191,16 @@ describe("Card - Refund flow - No 3DS", () => { "card_pm" ]["No3DSAutoCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createConfirmPaymentTest( fixtures.createConfirmPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -297,21 +218,10 @@ describe("Card - Refund flow - No 3DS", () => { "card_pm" ]["Refund"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 6500, - globalState, - configs - ); + cy.refundCallTest(fixtures.refundBody, data, 6500, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { @@ -319,13 +229,10 @@ describe("Card - Refund flow - No 3DS", () => { "card_pm" ]["SyncRefund"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.syncRefundCallTest(req_data, res_data, globalState); + cy.syncRefundCallTest(data, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); } ); @@ -346,22 +253,16 @@ describe("Card - Refund flow - No 3DS", () => { "card_pm" ]["No3DSAutoCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createConfirmPaymentTest( fixtures.createConfirmPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -379,21 +280,10 @@ describe("Card - Refund flow - No 3DS", () => { "card_pm" ]["PartialRefund"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 3000, - globalState, - configs - ); + cy.refundCallTest(fixtures.refundBody, data, 3000, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("refund-call-test", () => { @@ -401,21 +291,10 @@ describe("Card - Refund flow - No 3DS", () => { "card_pm" ]["PartialRefund"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 3000, - globalState, - configs - ); + cy.refundCallTest(fixtures.refundBody, data, 3000, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { @@ -423,13 +302,10 @@ describe("Card - Refund flow - No 3DS", () => { "card_pm" ]["SyncRefund"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.syncRefundCallTest(req_data, res_data, globalState); + cy.syncRefundCallTest(data, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); } ); @@ -448,22 +324,16 @@ describe("Card - Refund flow - No 3DS", () => { "PaymentIntent" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "manual", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -475,21 +345,10 @@ describe("Card - Refund flow - No 3DS", () => { "No3DSManualCapture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState, - configs - ); + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -507,21 +366,10 @@ describe("Card - Refund flow - No 3DS", () => { "Capture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState, - configs - ); + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -539,21 +387,10 @@ describe("Card - Refund flow - No 3DS", () => { "manualPaymentRefund" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 6500, - globalState, - configs - ); + cy.refundCallTest(fixtures.refundBody, data, 6500, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { @@ -561,13 +398,10 @@ describe("Card - Refund flow - No 3DS", () => { "SyncRefund" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.syncRefundCallTest(req_data, res_data, globalState); + cy.syncRefundCallTest(data, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); }); @@ -585,22 +419,16 @@ describe("Card - Refund flow - No 3DS", () => { "PaymentIntent" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "manual", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -612,21 +440,10 @@ describe("Card - Refund flow - No 3DS", () => { "No3DSManualCapture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState, - configs - ); + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -644,21 +461,10 @@ describe("Card - Refund flow - No 3DS", () => { "Capture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState, - configs - ); + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -676,42 +482,20 @@ describe("Card - Refund flow - No 3DS", () => { "manualPaymentPartialRefund" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 3000, - globalState, - configs - ); + cy.refundCallTest(fixtures.refundBody, data, 3000, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("refund-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ "manualPaymentPartialRefund" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 3000, - globalState, - configs - ); + cy.refundCallTest(fixtures.refundBody, data, 3000, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { @@ -719,13 +503,10 @@ describe("Card - Refund flow - No 3DS", () => { "SyncRefund" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.syncRefundCallTest(req_data, res_data, globalState); + cy.syncRefundCallTest(data, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); it("list-refund-call-test", () => { cy.listRefundCallTest(fixtures.listRefundCall, globalState); @@ -746,22 +527,16 @@ describe("Card - Refund flow - No 3DS", () => { "PaymentIntent" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "manual", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -773,21 +548,10 @@ describe("Card - Refund flow - No 3DS", () => { "No3DSManualCapture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState, - configs - ); + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -805,21 +569,10 @@ describe("Card - Refund flow - No 3DS", () => { "PartialCapture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 100, - globalState, - configs - ); + cy.captureCallTest(fixtures.captureBody, data, 100, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -837,21 +590,10 @@ describe("Card - Refund flow - No 3DS", () => { "manualPaymentRefund" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 100, - globalState, - configs - ); + cy.refundCallTest(fixtures.refundBody, data, 100, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { @@ -859,13 +601,10 @@ describe("Card - Refund flow - No 3DS", () => { "SyncRefund" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.syncRefundCallTest(req_data, res_data, globalState); + cy.syncRefundCallTest(data, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); }); @@ -883,22 +622,16 @@ describe("Card - Refund flow - No 3DS", () => { "PaymentIntent" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "manual", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -910,21 +643,10 @@ describe("Card - Refund flow - No 3DS", () => { "No3DSManualCapture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState, - configs - ); + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -942,21 +664,10 @@ describe("Card - Refund flow - No 3DS", () => { "PartialCapture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 100, - globalState, - configs - ); + cy.captureCallTest(fixtures.captureBody, data, 100, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -974,21 +685,10 @@ describe("Card - Refund flow - No 3DS", () => { "manualPaymentPartialRefund" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 100, - globalState, - configs - ); + cy.refundCallTest(fixtures.refundBody, data, 100, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { @@ -996,13 +696,10 @@ describe("Card - Refund flow - No 3DS", () => { "SyncRefund" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.syncRefundCallTest(req_data, res_data, globalState); + cy.syncRefundCallTest(data, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); }); @@ -1022,24 +719,18 @@ describe("Card - Refund flow - No 3DS", () => { "card_pm" ]["MandateMultiUseNo3DSAutoCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.citForMandatesCallTest( fixtures.citConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", "new_mandate", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Confirm No 3DS MIT", () => { @@ -1081,21 +772,10 @@ describe("Card - Refund flow - No 3DS", () => { "card_pm" ]["Refund"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 7000, - globalState, - configs - ); + cy.refundCallTest(fixtures.refundBody, data, 7000, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { @@ -1103,13 +783,10 @@ describe("Card - Refund flow - No 3DS", () => { "card_pm" ]["SyncRefund"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.syncRefundCallTest(req_data, res_data, globalState); + cy.syncRefundCallTest(data, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); } ); @@ -1140,22 +817,16 @@ describe("Card - Refund flow - 3DS", () => { "PaymentIntent" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -1167,21 +838,10 @@ describe("Card - Refund flow - 3DS", () => { "3DSAutoCapture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState, - configs - ); + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Handle redirection", () => { @@ -1204,21 +864,10 @@ describe("Card - Refund flow - 3DS", () => { "Refund" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 6500, - globalState, - configs - ); + cy.refundCallTest(fixtures.refundBody, data, 6500, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { @@ -1226,13 +875,10 @@ describe("Card - Refund flow - 3DS", () => { "SyncRefund" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.syncRefundCallTest(req_data, res_data, globalState); + cy.syncRefundCallTest(data, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); }); @@ -1250,22 +896,16 @@ describe("Card - Refund flow - 3DS", () => { "PaymentIntent" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -1277,21 +917,10 @@ describe("Card - Refund flow - 3DS", () => { "3DSAutoCapture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState, - configs - ); + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Handle redirection", () => { @@ -1314,21 +943,10 @@ describe("Card - Refund flow - 3DS", () => { "PartialRefund" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 1200, - globalState, - configs - ); + cy.refundCallTest(fixtures.refundBody, data, 1200, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("refund-call-test", () => { @@ -1336,21 +954,10 @@ describe("Card - Refund flow - 3DS", () => { "PartialRefund" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 1200, - globalState, - configs - ); + cy.refundCallTest(fixtures.refundBody, data, 1200, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { @@ -1358,13 +965,10 @@ describe("Card - Refund flow - 3DS", () => { "SyncRefund" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.syncRefundCallTest(req_data, res_data, globalState); + cy.syncRefundCallTest(data, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); }); @@ -1382,22 +986,16 @@ describe("Card - Refund flow - 3DS", () => { "3DSAutoCapture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createConfirmPaymentTest( fixtures.createConfirmPaymentBody, - req_data, - res_data, + data, "three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Handle redirection", () => { @@ -1420,21 +1018,10 @@ describe("Card - Refund flow - 3DS", () => { "Refund" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 6500, - globalState, - configs - ); + cy.refundCallTest(fixtures.refundBody, data, 6500, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { @@ -1442,13 +1029,10 @@ describe("Card - Refund flow - 3DS", () => { "SyncRefund" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.syncRefundCallTest(req_data, res_data, globalState); + cy.syncRefundCallTest(data, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); }); @@ -1468,22 +1052,16 @@ describe("Card - Refund flow - 3DS", () => { "card_pm" ]["3DSAutoCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createConfirmPaymentTest( fixtures.createConfirmPaymentBody, - req_data, - res_data, + data, "three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Handle redirection", () => { @@ -1506,21 +1084,10 @@ describe("Card - Refund flow - 3DS", () => { "card_pm" ]["PartialRefund"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 3000, - globalState, - configs - ); + cy.refundCallTest(fixtures.refundBody, data, 3000, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("refund-call-test", () => { @@ -1528,21 +1095,10 @@ describe("Card - Refund flow - 3DS", () => { "card_pm" ]["PartialRefund"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 3000, - globalState, - configs - ); + cy.refundCallTest(fixtures.refundBody, data, 3000, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { @@ -1550,13 +1106,10 @@ describe("Card - Refund flow - 3DS", () => { "card_pm" ]["SyncRefund"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.syncRefundCallTest(req_data, res_data, globalState); + cy.syncRefundCallTest(data, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); } ); @@ -1575,22 +1128,16 @@ describe("Card - Refund flow - 3DS", () => { "PaymentIntent" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "three_ds", "manual", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -1602,21 +1149,10 @@ describe("Card - Refund flow - 3DS", () => { "3DSManualCapture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState, - configs - ); + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Handle redirection", () => { @@ -1639,21 +1175,10 @@ describe("Card - Refund flow - 3DS", () => { "Capture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState, - configs - ); + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -1671,21 +1196,10 @@ describe("Card - Refund flow - 3DS", () => { "manualPaymentRefund" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 6500, - globalState, - configs - ); + cy.refundCallTest(fixtures.refundBody, data, 6500, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { @@ -1693,13 +1207,10 @@ describe("Card - Refund flow - 3DS", () => { "SyncRefund" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.syncRefundCallTest(req_data, res_data, globalState); + cy.syncRefundCallTest(data, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); }); @@ -1717,22 +1228,16 @@ describe("Card - Refund flow - 3DS", () => { "PaymentIntent" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "three_ds", "manual", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -1744,21 +1249,10 @@ describe("Card - Refund flow - 3DS", () => { "3DSManualCapture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState, - configs - ); + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Handle redirection", () => { @@ -1781,21 +1275,10 @@ describe("Card - Refund flow - 3DS", () => { "Capture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState, - configs - ); + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -1813,42 +1296,20 @@ describe("Card - Refund flow - 3DS", () => { "manualPaymentPartialRefund" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 5000, - globalState, - configs - ); + cy.refundCallTest(fixtures.refundBody, data, 5000, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("refund-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ "manualPaymentPartialRefund" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 1500, - globalState, - configs - ); + cy.refundCallTest(fixtures.refundBody, data, 1500, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { @@ -1856,13 +1317,10 @@ describe("Card - Refund flow - 3DS", () => { "SyncRefund" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.syncRefundCallTest(req_data, res_data, globalState); + cy.syncRefundCallTest(data, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); }); @@ -1880,22 +1338,16 @@ describe("Card - Refund flow - 3DS", () => { "PaymentIntent" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "three_ds", "manual", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -1907,21 +1359,10 @@ describe("Card - Refund flow - 3DS", () => { "3DSManualCapture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState, - configs - ); + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Handle redirection", () => { @@ -1944,21 +1385,10 @@ describe("Card - Refund flow - 3DS", () => { "PartialCapture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 100, - globalState, - configs - ); + cy.captureCallTest(fixtures.captureBody, data, 100, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -1976,21 +1406,10 @@ describe("Card - Refund flow - 3DS", () => { "manualPaymentRefund" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 100, - globalState, - configs - ); + cy.refundCallTest(fixtures.refundBody, data, 100, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { @@ -1998,13 +1417,10 @@ describe("Card - Refund flow - 3DS", () => { "SyncRefund" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.syncRefundCallTest(req_data, res_data, globalState); + cy.syncRefundCallTest(data, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); }); @@ -2022,22 +1438,16 @@ describe("Card - Refund flow - 3DS", () => { "PaymentIntent" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "three_ds", "manual", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -2049,21 +1459,10 @@ describe("Card - Refund flow - 3DS", () => { "3DSManualCapture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState, - configs - ); + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Handle redirection", () => { @@ -2086,21 +1485,10 @@ describe("Card - Refund flow - 3DS", () => { "PartialCapture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 100, - globalState, - configs - ); + cy.captureCallTest(fixtures.captureBody, data, 100, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -2118,21 +1506,10 @@ describe("Card - Refund flow - 3DS", () => { "manualPaymentRefund" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 50, - globalState, - configs - ); + cy.refundCallTest(fixtures.refundBody, data, 50, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { @@ -2140,13 +1517,10 @@ describe("Card - Refund flow - 3DS", () => { "SyncRefund" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.syncRefundCallTest(req_data, res_data, globalState); + cy.syncRefundCallTest(data, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); }); }); diff --git a/cypress-tests/cypress/e2e/PaymentTest/00010-SyncRefund.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00010-SyncRefund.cy.js index 79f04367d8bf..114bbfc6f416 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00010-SyncRefund.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00010-SyncRefund.cy.js @@ -29,22 +29,15 @@ describe("Card - Sync Refund flow test", () => { "PaymentIntent" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", - globalState, - configs + globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + if (should_continue) should_continue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -56,21 +49,9 @@ describe("Card - Sync Refund flow test", () => { "No3DSAutoCapture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState, - configs - ); + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + if (should_continue) should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -88,21 +69,9 @@ describe("Card - Sync Refund flow test", () => { "Refund" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 6500, - globalState, - configs - ); + cy.refundCallTest(fixtures.refundBody, data, 6500, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + if (should_continue) should_continue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { @@ -110,12 +79,8 @@ describe("Card - Sync Refund flow test", () => { "SyncRefund" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.syncRefundCallTest(req_data, res_data, globalState); + cy.syncRefundCallTest(data, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + if (should_continue) should_continue = utils.should_continue_further(data); }); }); diff --git a/cypress-tests/cypress/e2e/PaymentTest/00011-CreateSingleuseMandate.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00011-CreateSingleuseMandate.cy.js index b1dbebc64b81..e7c88f4b1e4d 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00011-CreateSingleuseMandate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00011-CreateSingleuseMandate.cy.js @@ -32,24 +32,18 @@ describe("Card - SingleUse Mandates flow test", () => { "card_pm" ]["MandateSingleUseNo3DSAutoCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.citForMandatesCallTest( fixtures.citConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", "new_mandate", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Confirm No 3DS MIT", () => { @@ -87,24 +81,18 @@ describe("Card - SingleUse Mandates flow test", () => { "card_pm" ]["MandateSingleUseNo3DSManualCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.citForMandatesCallTest( fixtures.citConfirmBody, - req_data, - res_data, + data, 6500, true, "manual", "new_mandate", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("cit-capture-call-test", () => { @@ -112,21 +100,10 @@ describe("Card - SingleUse Mandates flow test", () => { "card_pm" ]["Capture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState, - configs - ); + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Confirm No 3DS MIT", () => { @@ -151,21 +128,10 @@ describe("Card - SingleUse Mandates flow test", () => { "card_pm" ]["Capture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState, - configs - ); + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("list-mandate-call-test", () => { @@ -190,24 +156,18 @@ describe("Card - SingleUse Mandates flow test", () => { "card_pm" ]["MandateSingleUseNo3DSManualCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.citForMandatesCallTest( fixtures.citConfirmBody, - req_data, - res_data, + data, 6500, true, "manual", "new_mandate", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("cit-capture-call-test", () => { @@ -215,21 +175,10 @@ describe("Card - SingleUse Mandates flow test", () => { "card_pm" ]["Capture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState, - configs - ); + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Confirm No 3DS MIT", () => { diff --git a/cypress-tests/cypress/e2e/PaymentTest/00012-CreateMultiuseMandate.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00012-CreateMultiuseMandate.cy.js index 312a67d34b4f..b016bc110861 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00012-CreateMultiuseMandate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00012-CreateMultiuseMandate.cy.js @@ -32,24 +32,18 @@ describe("Card - MultiUse Mandates flow test", () => { "card_pm" ]["MandateMultiUseNo3DSAutoCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.citForMandatesCallTest( fixtures.citConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", "new_mandate", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Confirm No 3DS MIT", () => { @@ -103,24 +97,18 @@ describe("Card - MultiUse Mandates flow test", () => { "card_pm" ]["MandateMultiUseNo3DSManualCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.citForMandatesCallTest( fixtures.citConfirmBody, - req_data, - res_data, + data, 6500, true, "manual", "new_mandate", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("cit-capture-call-test", () => { @@ -128,21 +116,10 @@ describe("Card - MultiUse Mandates flow test", () => { "card_pm" ]["Capture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState, - configs - ); + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Confirm No 3DS MIT 1", () => { @@ -167,21 +144,10 @@ describe("Card - MultiUse Mandates flow test", () => { "card_pm" ]["Capture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState, - configs - ); + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Confirm No 3DS MIT 2", () => { @@ -206,21 +172,10 @@ describe("Card - MultiUse Mandates flow test", () => { "card_pm" ]["Capture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState, - configs - ); + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); } ); @@ -241,24 +196,18 @@ describe("Card - MultiUse Mandates flow test", () => { "card_pm" ]["MandateMultiUseNo3DSManualCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.citForMandatesCallTest( fixtures.citConfirmBody, - req_data, - res_data, + data, 6500, true, "manual", "new_mandate", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("cit-capture-call-test", () => { @@ -266,21 +215,10 @@ describe("Card - MultiUse Mandates flow test", () => { "card_pm" ]["Capture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState, - configs - ); + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Confirm No 3DS MIT", () => { diff --git a/cypress-tests/cypress/e2e/PaymentTest/00013-ListAndRevokeMandate.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00013-ListAndRevokeMandate.cy.js index c3bdbb060f3c..4e87798875f2 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00013-ListAndRevokeMandate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00013-ListAndRevokeMandate.cy.js @@ -32,24 +32,18 @@ describe("Card - SingleUse Mandates flow test", () => { "card_pm" ]["MandateSingleUseNo3DSAutoCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.citForMandatesCallTest( fixtures.citConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", "new_mandate", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Confirm No 3DS MIT", () => { diff --git a/cypress-tests/cypress/e2e/PaymentTest/00014-SaveCardFlow.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00014-SaveCardFlow.cy.js index 1307db127a02..c5cf7508fd77 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00014-SaveCardFlow.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00014-SaveCardFlow.cy.js @@ -38,22 +38,16 @@ describe("Card - SaveCard payment flow test", () => { "card_pm" ]["SaveCardUseNo3DSAutoCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createConfirmPaymentTest( fixtures.createConfirmPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) { - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); } }); @@ -76,22 +70,16 @@ describe("Card - SaveCard payment flow test", () => { "card_pm" ]["PaymentIntent"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("confirm-save-card-payment-call-test", () => { @@ -99,20 +87,10 @@ describe("Card - SaveCard payment flow test", () => { "card_pm" ]["SaveCardUseNo3DSAutoCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.saveCardConfirmCallTest( - saveCardBody, - req_data, - res_data, - globalState, - configs - ); + cy.saveCardConfirmCallTest(saveCardBody, data, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); } ); @@ -138,22 +116,16 @@ describe("Card - SaveCard payment flow test", () => { "card_pm" ]["SaveCardUseNo3DSAutoCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createConfirmPaymentTest( fixtures.createConfirmPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -175,22 +147,16 @@ describe("Card - SaveCard payment flow test", () => { "card_pm" ]["PaymentIntent"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "manual", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("confirm-save-card-payment-call-test", () => { @@ -198,20 +164,10 @@ describe("Card - SaveCard payment flow test", () => { "card_pm" ]["SaveCardUseNo3DSManualCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.saveCardConfirmCallTest( - saveCardBody, - req_data, - res_data, - globalState, - configs - ); + cy.saveCardConfirmCallTest(saveCardBody, data, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -229,21 +185,10 @@ describe("Card - SaveCard payment flow test", () => { "card_pm" ]["Capture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState, - configs - ); + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); } ); @@ -269,22 +214,16 @@ describe("Card - SaveCard payment flow test", () => { "card_pm" ]["SaveCardUseNo3DSAutoCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createConfirmPaymentTest( fixtures.createConfirmPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -306,22 +245,16 @@ describe("Card - SaveCard payment flow test", () => { "card_pm" ]["PaymentIntent"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "manual", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("confirm-save-card-payment-call-test", () => { @@ -329,20 +262,10 @@ describe("Card - SaveCard payment flow test", () => { "card_pm" ]["SaveCardUseNo3DSManualCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.saveCardConfirmCallTest( - saveCardBody, - req_data, - res_data, - globalState, - configs - ); + cy.saveCardConfirmCallTest(saveCardBody, data, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))[ @@ -359,21 +282,10 @@ describe("Card - SaveCard payment flow test", () => { "card_pm" ]["PartialCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 100, - globalState, - configs - ); + cy.captureCallTest(fixtures.captureBody, data, 100, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); } ); @@ -399,22 +311,16 @@ describe("Card - SaveCard payment flow test", () => { "card_pm" ]["SaveCardUseNo3DSAutoCaptureOffSession"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createConfirmPaymentTest( fixtures.createConfirmPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -436,22 +342,16 @@ describe("Card - SaveCard payment flow test", () => { "card_pm" ]["PaymentIntentOffSession"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("confirm-save-card-payment-call-test", () => { @@ -459,20 +359,10 @@ describe("Card - SaveCard payment flow test", () => { "card_pm" ]["SaveCardConfirmAutoCaptureOffSession"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.saveCardConfirmCallTest( - saveCardBody, - req_data, - res_data, - globalState, - configs - ); + cy.saveCardConfirmCallTest(saveCardBody, data, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); } ); @@ -498,22 +388,16 @@ describe("Card - SaveCard payment flow test", () => { "card_pm" ]["SaveCardUseNo3DSManualCaptureOffSession"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createConfirmPaymentTest( fixtures.createConfirmPaymentBody, - req_data, - res_data, + data, "no_three_ds", "manual", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -530,21 +414,10 @@ describe("Card - SaveCard payment flow test", () => { "card_pm" ]["Capture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState, - configs - ); + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-customerPM-call-test", () => { @@ -556,22 +429,16 @@ describe("Card - SaveCard payment flow test", () => { "card_pm" ]["PaymentIntentOffSession"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "manual", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("confirm-save-card-payment-call-test", () => { @@ -579,20 +446,10 @@ describe("Card - SaveCard payment flow test", () => { "card_pm" ]["SaveCardConfirmManualCaptureOffSession"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.saveCardConfirmCallTest( - saveCardBody, - req_data, - res_data, - globalState, - configs - ); + cy.saveCardConfirmCallTest(saveCardBody, data, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -610,21 +467,10 @@ describe("Card - SaveCard payment flow test", () => { "card_pm" ]["Capture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState, - configs - ); + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -660,22 +506,16 @@ describe("Card - SaveCard payment flow test", () => { "card_pm" ]["PaymentIntentOffSession"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("confirm-payment-call-test", () => { @@ -683,21 +523,10 @@ describe("Card - SaveCard payment flow test", () => { "card_pm" ]["SaveCardUseNo3DSAutoCaptureOffSession"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState, - configs - ); + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -719,22 +548,16 @@ describe("Card - SaveCard payment flow test", () => { "card_pm" ]["PaymentIntentOffSession"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("confirm-save-card-payment-call-test", () => { @@ -742,20 +565,10 @@ describe("Card - SaveCard payment flow test", () => { "card_pm" ]["SaveCardConfirmAutoCaptureOffSession"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.saveCardConfirmCallTest( - saveCardBody, - req_data, - res_data, - globalState, - configs - ); + cy.saveCardConfirmCallTest(saveCardBody, data, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); } ); @@ -780,22 +593,16 @@ describe("Card - SaveCard payment flow test", () => { "card_pm" ]["PaymentIntentOffSession"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("confirm-payment-call-test", () => { @@ -803,21 +610,10 @@ describe("Card - SaveCard payment flow test", () => { "card_pm" ]["SaveCardUseNo3DSAutoCaptureOffSession"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState, - configs - ); + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-customerPM-call-test", () => { @@ -829,22 +625,16 @@ describe("Card - SaveCard payment flow test", () => { "card_pm" ]["PaymentIntentOffSession"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("confirm-save-card-payment-call-test-without-billing", () => { @@ -852,20 +642,10 @@ describe("Card - SaveCard payment flow test", () => { "card_pm" ]["SaveCardConfirmAutoCaptureOffSessionWithoutBilling"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.saveCardConfirmCallTest( - saveCardBody, - req_data, - res_data, - globalState, - configs - ); + cy.saveCardConfirmCallTest(saveCardBody, data, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); } ); diff --git a/cypress-tests/cypress/e2e/PaymentTest/00015-ZeroAuthMandate.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00015-ZeroAuthMandate.cy.js index 127cc0dd6df6..0688d05d777c 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00015-ZeroAuthMandate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00015-ZeroAuthMandate.cy.js @@ -32,24 +32,18 @@ describe("Card - SingleUse Mandates flow test", () => { "card_pm" ]["ZeroAuthMandate"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.citForMandatesCallTest( fixtures.citConfirmBody, - req_data, - res_data, + data, 0, true, "automatic", "setup_mandate", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Confirm No 3DS MIT", () => { @@ -86,24 +80,18 @@ describe("Card - SingleUse Mandates flow test", () => { "card_pm" ]["ZeroAuthMandate"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.citForMandatesCallTest( fixtures.citConfirmBody, - req_data, - res_data, + data, 0, true, "automatic", "setup_mandate", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Confirm No 3DS MIT", () => { @@ -155,22 +143,16 @@ describe("Card - SingleUse Mandates flow test", () => { "ZeroAuthPaymentIntent" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Confirm No 3DS payment", () => { @@ -178,21 +160,10 @@ describe("Card - SingleUse Mandates flow test", () => { "ZeroAuthConfirmPayment" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState, - configs - ); + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Retrieve Payment Call Test", () => { @@ -214,22 +185,16 @@ describe("Card - SingleUse Mandates flow test", () => { "PaymentIntentOffSession" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Confirm Recurring Payment", () => { @@ -237,20 +202,14 @@ describe("Card - SingleUse Mandates flow test", () => { "SaveCardConfirmAutoCaptureOffSession" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.saveCardConfirmCallTest( fixtures.saveCardConfirmBody, - req_data, - res_data, - globalState, - configs + data, + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); }); }); diff --git a/cypress-tests/cypress/e2e/PaymentTest/00016-ThreeDSManualCapture.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00016-ThreeDSManualCapture.cy.js index 3b4ee483b1fb..086c00a14a9d 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00016-ThreeDSManualCapture.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00016-ThreeDSManualCapture.cy.js @@ -40,22 +40,16 @@ describe("Card - ThreeDS Manual payment flow test", () => { "card_pm" ]["PaymentIntent"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "three_ds", "manual", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -67,21 +61,10 @@ describe("Card - ThreeDS Manual payment flow test", () => { "card_pm" ]["3DSManualCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState, - configs - ); + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Handle redirection", () => { @@ -104,21 +87,10 @@ describe("Card - ThreeDS Manual payment flow test", () => { "card_pm" ]["Capture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - captureBody, - req_data, - res_data, - 6500, - globalState, - configs - ); + cy.captureCallTest(captureBody, data, 6500, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -146,22 +118,16 @@ describe("Card - ThreeDS Manual payment flow test", () => { "card_pm" ]["3DSManualCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createConfirmPaymentTest( fixtures.createConfirmPaymentBody, - req_data, - res_data, + data, "three_ds", "manual", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Handle redirection", () => { @@ -185,21 +151,10 @@ describe("Card - ThreeDS Manual payment flow test", () => { "card_pm" ]["Capture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - captureBody, - req_data, - res_data, - 6500, - globalState, - configs - ); + cy.captureCallTest(captureBody, data, 6500, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -231,22 +186,16 @@ describe("Card - ThreeDS Manual payment flow test", () => { "card_pm" ]["PaymentIntent"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "three_ds", "manual", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -258,21 +207,10 @@ describe("Card - ThreeDS Manual payment flow test", () => { "card_pm" ]["3DSManualCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState, - configs - ); + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Handle redirection", () => { @@ -295,21 +233,10 @@ describe("Card - ThreeDS Manual payment flow test", () => { "card_pm" ]["PartialCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - captureBody, - req_data, - res_data, - 100, - globalState, - configs - ); + cy.captureCallTest(captureBody, data, 100, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -337,22 +264,16 @@ describe("Card - ThreeDS Manual payment flow test", () => { "card_pm" ]["3DSManualCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createConfirmPaymentTest( fixtures.createConfirmPaymentBody, - req_data, - res_data, + data, "three_ds", "manual", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Handle redirection", () => { @@ -376,21 +297,10 @@ describe("Card - ThreeDS Manual payment flow test", () => { "card_pm" ]["PartialCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - captureBody, - req_data, - res_data, - 100, - globalState, - configs - ); + cy.captureCallTest(captureBody, data, 100, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { diff --git a/cypress-tests/cypress/e2e/PaymentTest/00017-BankTransfers.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00017-BankTransfers.cy.js index 28129098bc24..1662ffa9610c 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00017-BankTransfers.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00017-BankTransfers.cy.js @@ -30,22 +30,16 @@ describe("Bank Transfers", () => { "bank_transfer_pm" ]["PaymentIntent"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -57,21 +51,15 @@ describe("Bank Transfers", () => { "bank_transfer_pm" ]["Pix"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.confirmBankTransferCallTest( fixtures.confirmBody, - req_data, - res_data, + data, true, - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Handle bank transfer redirection", () => { diff --git a/cypress-tests/cypress/e2e/PaymentTest/00018-BankRedirect.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00018-BankRedirect.cy.js index cf3b9a4295f8..4e1ed0cbc0d2 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00018-BankRedirect.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00018-BankRedirect.cy.js @@ -30,21 +30,15 @@ describe("Bank Redirect tests", () => { "bank_redirect_pm" ]["BlikPaymentIntent"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -56,20 +50,15 @@ describe("Bank Redirect tests", () => { "bank_redirect_pm" ]["Blik"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.confirmBankRedirectCallTest( fixtures.confirmBody, - req_data, - res_data, + data, true, - globalState, - configs + globalState ); + if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); }); @@ -93,21 +82,15 @@ describe("Bank Redirect tests", () => { "bank_redirect_pm" ]["PaymentIntent"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -119,20 +102,15 @@ describe("Bank Redirect tests", () => { "bank_redirect_pm" ]["Eps"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.confirmBankRedirectCallTest( fixtures.confirmBody, - req_data, - res_data, + data, true, - globalState, - configs + globalState ); + if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Handle bank redirect redirection", () => { @@ -168,21 +146,15 @@ describe("Bank Redirect tests", () => { "bank_redirect_pm" ]["PaymentIntent"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -194,20 +166,15 @@ describe("Bank Redirect tests", () => { "bank_redirect_pm" ]["Ideal"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.confirmBankRedirectCallTest( fixtures.confirmBody, - req_data, - res_data, + data, true, - globalState, - configs + globalState ); + if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Handle bank redirect redirection", () => { @@ -241,21 +208,15 @@ describe("Bank Redirect tests", () => { "bank_redirect_pm" ]["PaymentIntent"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -267,20 +228,15 @@ describe("Bank Redirect tests", () => { "bank_redirect_pm" ]["Sofort"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.confirmBankRedirectCallTest( fixtures.confirmBody, - req_data, - res_data, + data, true, - globalState, - configs + globalState ); + if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Handle bank redirect redirection", () => { @@ -314,21 +270,15 @@ describe("Bank Redirect tests", () => { "bank_redirect_pm" ]["PaymentIntent"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -340,20 +290,15 @@ describe("Bank Redirect tests", () => { "bank_redirect_pm" ]["Przelewy24"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.confirmBankRedirectCallTest( fixtures.confirmBody, - req_data, - res_data, + data, true, - globalState, - configs + globalState ); + if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Handle bank redirect redirection", () => { diff --git a/cypress-tests/cypress/e2e/PaymentTest/00019-MandatesUsingPMID.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00019-MandatesUsingPMID.cy.js index 83bac87cf0d3..c6c841466237 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00019-MandatesUsingPMID.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00019-MandatesUsingPMID.cy.js @@ -32,22 +32,16 @@ describe("Card - Mandates using Payment Method Id flow test", () => { "card_pm" ]["PaymentIntent"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Confirm No 3DS CIT", () => { @@ -55,24 +49,18 @@ describe("Card - Mandates using Payment Method Id flow test", () => { "card_pm" ]["PaymentMethodIdMandateNo3DSAutoCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.citForMandatesCallTest( fixtures.citConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", "new_mandate", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Confirm No 3DS MIT", () => { @@ -110,22 +98,16 @@ describe("Card - Mandates using Payment Method Id flow test", () => { "card_pm" ]["PaymentIntent"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "manual", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Confirm No 3DS CIT", () => { @@ -133,24 +115,18 @@ describe("Card - Mandates using Payment Method Id flow test", () => { "card_pm" ]["PaymentMethodIdMandateNo3DSManualCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.citForMandatesCallTest( fixtures.citConfirmBody, - req_data, - res_data, + data, 6500, true, "manual", "new_mandate", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("cit-capture-call-test", () => { @@ -158,21 +134,10 @@ describe("Card - Mandates using Payment Method Id flow test", () => { "card_pm" ]["Capture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState, - configs - ); + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Confirm No 3DS MIT", () => { @@ -210,24 +175,18 @@ describe("Card - Mandates using Payment Method Id flow test", () => { "card_pm" ]["PaymentMethodIdMandateNo3DSAutoCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.citForMandatesCallTest( fixtures.citConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", "new_mandate", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Confirm No 3DS MIT", () => { @@ -281,24 +240,18 @@ describe("Card - Mandates using Payment Method Id flow test", () => { "card_pm" ]["PaymentMethodIdMandateNo3DSManualCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.citForMandatesCallTest( fixtures.citConfirmBody, - req_data, - res_data, + data, 6500, true, "manual", "new_mandate", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("cit-capture-call-test", () => { @@ -306,21 +259,10 @@ describe("Card - Mandates using Payment Method Id flow test", () => { "card_pm" ]["Capture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState, - configs - ); + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Confirm No 3DS MIT 1", () => { @@ -345,21 +287,10 @@ describe("Card - Mandates using Payment Method Id flow test", () => { "card_pm" ]["Capture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState, - configs - ); + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Confirm No 3DS MIT 2", () => { @@ -384,21 +315,10 @@ describe("Card - Mandates using Payment Method Id flow test", () => { "card_pm" ]["Capture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState, - configs - ); + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); } ); @@ -419,24 +339,18 @@ describe("Card - Mandates using Payment Method Id flow test", () => { "card_pm" ]["PaymentMethodIdMandate3DSAutoCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.citForMandatesCallTest( fixtures.citConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", "new_mandate", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Handle redirection", () => { @@ -495,24 +409,18 @@ describe("Card - Mandates using Payment Method Id flow test", () => { "card_pm" ]["PaymentMethodIdMandate3DSManualCapture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.citForMandatesCallTest( fixtures.citConfirmBody, - req_data, - res_data, + data, 6500, true, "manual", "new_mandate", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Handle redirection", () => { @@ -525,21 +433,10 @@ describe("Card - Mandates using Payment Method Id flow test", () => { "card_pm" ]["Capture"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState, - configs - ); + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Confirm No 3DS MIT", () => { diff --git a/cypress-tests/cypress/e2e/PaymentTest/00020-UPI.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00020-UPI.cy.js index f3566846ee30..e3e8e90489c9 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00020-UPI.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00020-UPI.cy.js @@ -29,23 +29,16 @@ describe("UPI Payments - Hyperswitch", () => { let data = getConnectorDetails(globalState.get("connectorId"))["upi_pm"][ "PaymentIntent" ]; - - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("List Merchant payment methods", () => { @@ -57,21 +50,10 @@ describe("UPI Payments - Hyperswitch", () => { "UpiCollect" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.confirmUpiCall( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState, - configs - ); + cy.confirmUpiCall(fixtures.confirmBody, data, true, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Handle UPI Redirection", () => { @@ -100,21 +82,10 @@ describe("UPI Payments - Hyperswitch", () => { "Refund" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 6500, - globalState, - configs - ); + cy.refundCallTest(fixtures.refundBody, data, 6500, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); }); @@ -143,22 +114,16 @@ describe("UPI Payments - Hyperswitch", () => { "PaymentIntent" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("List Merchant payment methods", () => { @@ -170,21 +135,10 @@ describe("UPI Payments - Hyperswitch", () => { "UpiIntent" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.confirmUpiCall( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState, - configs - ); + cy.confirmUpiCall(fixtures.confirmBody, data, true, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Handle UPI Redirection", () => { diff --git a/cypress-tests/cypress/e2e/PaymentTest/00021-Variations.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00021-Variations.cy.js index 53a2099d64b6..2bdaf2501bf2 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00021-Variations.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00021-Variations.cy.js @@ -32,18 +32,12 @@ describe("Corner cases", () => { "InvalidCardNumber" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createConfirmPaymentTest( paymentIntentBody, - req_data, - res_data, + data, "three_ds", "automatic", - globalState, - configs + globalState ); }); @@ -52,18 +46,12 @@ describe("Corner cases", () => { "InvalidExpiryMonth" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createConfirmPaymentTest( paymentIntentBody, - req_data, - res_data, + data, "three_ds", "automatic", - globalState, - configs + globalState ); }); @@ -72,18 +60,12 @@ describe("Corner cases", () => { "InvalidExpiryYear" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createConfirmPaymentTest( paymentIntentBody, - req_data, - res_data, + data, "three_ds", "automatic", - globalState, - configs + globalState ); }); @@ -92,18 +74,12 @@ describe("Corner cases", () => { "InvalidCardCvv" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createConfirmPaymentTest( paymentIntentBody, - req_data, - res_data, + data, "three_ds", "automatic", - globalState, - configs + globalState ); }); @@ -112,18 +88,12 @@ describe("Corner cases", () => { "InvalidCurrency" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createConfirmPaymentTest( paymentIntentBody, - req_data, - res_data, + data, "three_ds", "automatic", - globalState, - configs + globalState ); }); @@ -132,18 +102,12 @@ describe("Corner cases", () => { "InvalidCaptureMethod" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createConfirmPaymentTest( paymentIntentBody, - req_data, - res_data, + data, "three_ds", "automatic", - globalState, - configs + globalState ); }); @@ -152,18 +116,12 @@ describe("Corner cases", () => { "InvalidPaymentMethod" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createConfirmPaymentTest( paymentIntentBody, - req_data, - res_data, + data, "three_ds", "automatic", - globalState, - configs + globalState ); }); @@ -172,18 +130,12 @@ describe("Corner cases", () => { "InvalidAmountToCapture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createConfirmPaymentTest( paymentIntentBody, - req_data, - res_data, + data, "three_ds", "automatic", - globalState, - configs + globalState ); }); @@ -192,18 +144,12 @@ describe("Corner cases", () => { "MissingRequiredParam" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createConfirmPaymentTest( paymentIntentBody, - req_data, - res_data, + data, "three_ds", "automatic", - globalState, - configs + globalState ); }); }); @@ -224,18 +170,12 @@ describe("Corner cases", () => { "PaymentIntent" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( paymentIntentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", - globalState, - configs + globalState ); }); @@ -244,18 +184,7 @@ describe("Corner cases", () => { "PaymentIntentErrored" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState, - configs - ); + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); }); }); @@ -283,22 +212,16 @@ describe("Corner cases", () => { "No3DSManualCapture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createConfirmPaymentTest( paymentCreateConfirmBody, - req_data, - res_data, + data, "no_three_ds", "manual", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Capture call", () => { @@ -306,21 +229,10 @@ describe("Corner cases", () => { "CaptureGreaterAmount" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 65000, - globalState, - configs - ); + cy.captureCallTest(fixtures.captureBody, data, 65000, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); }); @@ -348,22 +260,16 @@ describe("Corner cases", () => { "No3DSAutoCapture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createConfirmPaymentTest( paymentCreateConfirmBody, - req_data, - res_data, + data, "no_three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Retrieve payment", () => { @@ -381,21 +287,10 @@ describe("Corner cases", () => { "CaptureCapturedAmount" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 65000, - globalState, - configs - ); + cy.captureCallTest(fixtures.captureBody, data, 65000, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); }); @@ -423,22 +318,16 @@ describe("Corner cases", () => { "No3DSAutoCapture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createConfirmPaymentTest( paymentCreateConfirmBody, - req_data, - res_data, + data, "no_three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Retrieve payment", () => { @@ -456,21 +345,10 @@ describe("Corner cases", () => { "ConfirmSuccessfulPayment" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState, - configs - ); + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); }); @@ -498,22 +376,16 @@ describe("Corner cases", () => { "No3DSAutoCapture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createConfirmPaymentTest( paymentCreateConfirmBody, - req_data, - res_data, + data, "no_three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Retrieve payment", () => { @@ -534,23 +406,19 @@ describe("Corner cases", () => { "card_pm" ]["Void"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = utils.getConnectorFlowDetails( - data, - commonData, - "ResponseCustom" - ); - cy.voidCallTest( - fixtures.voidBody, - req_data, - res_data, - globalState, - configs - ); + const newData = { + ...data, + Response: utils.getConnectorFlowDetails( + data, + commonData, + "ResponseCustom" + ), + }; + + cy.voidCallTest(fixtures.voidBody, newData, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); }); @@ -578,22 +446,16 @@ describe("Corner cases", () => { "3DSManualCapture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createConfirmPaymentTest( paymentCreateConfirmBody, - req_data, - res_data, + data, "three_ds", "manual", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Retrieve payment", () => { @@ -626,21 +488,10 @@ describe("Corner cases", () => { "CaptureGreaterAmount" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 65000, - globalState, - configs - ); + cy.captureCallTest(fixtures.captureBody, data, 65000, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); }); @@ -668,22 +519,16 @@ describe("Corner cases", () => { "No3DSAutoCapture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createConfirmPaymentTest( paymentCreateConfirmBody, - req_data, - res_data, + data, "no_three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Retrieve payment", () => { @@ -704,23 +549,18 @@ describe("Corner cases", () => { "card_pm" ]["Refund"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = utils.getConnectorFlowDetails( - data, - commonData, - "ResponseCustom" - ); - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 65000, - globalState, - configs - ); + const newData = { + ...data, + Response: utils.getConnectorFlowDetails( + data, + commonData, + "ResponseCustom" + ), + }; + + cy.refundCallTest(fixtures.refundBody, newData, 65000, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); }); @@ -748,22 +588,16 @@ describe("Corner cases", () => { "No3DSAutoCapture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createConfirmPaymentTest( paymentCreateConfirmBody, - req_data, - res_data, + data, "no_three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Retrieve payment", () => { @@ -784,25 +618,19 @@ describe("Corner cases", () => { "card_pm" ]["Refund"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = utils.getConnectorFlowDetails( - data, - commonData, - "ResponseCustom" - ); + const newData = { + ...data, + Response: utils.getConnectorFlowDetails( + data, + commonData, + "ResponseCustom" + ), + }; - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 65000, - globalState, - configs - ); + cy.refundCallTest(fixtures.refundBody, newData, 65000, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); }); @@ -830,23 +658,17 @@ describe("Corner cases", () => { "MandateSingleUseNo3DSManualCapture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.citForMandatesCallTest( fixtures.citConfirmBody, - req_data, - res_data, + data, 6500, true, "manual", "new_mandate", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("cit-capture-call-test", () => { @@ -854,20 +676,9 @@ describe("Corner cases", () => { "Capture" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState, - configs - ); + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Retrieve payment", () => { diff --git a/cypress-tests/cypress/e2e/PaymentTest/00022-PaymentMethods.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00022-PaymentMethods.cy.js index 3516e1eeac36..0ab970e20be2 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00022-PaymentMethods.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00022-PaymentMethods.cy.js @@ -34,10 +34,7 @@ describe("Payment Methods Tests", () => { it("Create Payment Method", () => { let data = getConnectorDetails("commons")["card_pm"]["PaymentMethod"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.createPaymentMethodTest(globalState, req_data, res_data); + cy.createPaymentMethodTest(globalState, data); }); it("List PM for customer", () => { @@ -61,10 +58,7 @@ describe("Payment Methods Tests", () => { it("Create Payment Method", () => { let data = getConnectorDetails("commons")["card_pm"]["PaymentMethod"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.createPaymentMethodTest(globalState, req_data, res_data); + cy.createPaymentMethodTest(globalState, data); }); it("create-payment-call-test", () => { @@ -72,21 +66,15 @@ describe("Payment Methods Tests", () => { "PaymentIntentOffSession" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("confirm-payment-call-test", () => { @@ -94,20 +82,9 @@ describe("Payment Methods Tests", () => { "SaveCardUseNo3DSAutoCaptureOffSession" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState, - configs - ); + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("List PM for customer", () => { diff --git a/cypress-tests/cypress/e2e/PaymentTest/00023-ConnectorAgnostic.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00023-ConnectorAgnostic.cy.js index c9bd469cf1da..2d789b4a58c9 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00023-ConnectorAgnostic.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00023-ConnectorAgnostic.cy.js @@ -1,6 +1,5 @@ import * as fixtures from "../../fixtures/imports"; import State from "../../utils/State"; -import { validateConfig } from "../../utils/featureFlags"; import { payment_methods_enabled } from "../PaymentUtils/Commons"; import getConnectorDetails, * as utils from "../PaymentUtils/Utils"; @@ -52,22 +51,16 @@ describe("Connector Agnostic Tests", () => { "card_pm" ]["PaymentIntentOffSession"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Confirm Payment", () => { @@ -75,21 +68,10 @@ describe("Connector Agnostic Tests", () => { "card_pm" ]["SaveCardUseNo3DSAutoCaptureOffSession"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState, - configs - ); + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("List Payment Method for Customer using Client Secret", () => { @@ -125,22 +107,16 @@ describe("Connector Agnostic Tests", () => { "card_pm" ]["PaymentIntentOffSession"]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("List Payment Method for Customer", () => { @@ -188,22 +164,16 @@ describe("Connector Agnostic Tests", () => { "PaymentIntentOffSession" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("Confirm Payment", () => { @@ -211,21 +181,10 @@ describe("Connector Agnostic Tests", () => { "SaveCardUseNo3DSAutoCaptureOffSession" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState, - configs - ); + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("List Payment Method for Customer using Client Secret", () => { @@ -258,22 +217,16 @@ describe("Connector Agnostic Tests", () => { "PaymentIntentOffSession" ]; - let configs = validateConfig(data["Configs"]); - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", - globalState, - configs + globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data, configs); + should_continue = utils.should_continue_further(data); }); it("List Payment Method for Customer", () => { diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Commons.js b/cypress-tests/cypress/e2e/PaymentUtils/Commons.js index 2e6790ab0f99..54fe75d0fc47 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/Commons.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/Commons.js @@ -18,7 +18,7 @@ function normalize(input) { paypal: "Paypal", wellsfargo: "Wellsfargo", fiuu: "Fiuu", - noon: "Noon" + noon: "Noon", // Add more known exceptions here }; @@ -1075,7 +1075,7 @@ export const connectorDetails = { error: { error_type: "invalid_request", message: "Json deserialize error: invalid card number length", - code: "IR_06" + code: "IR_06", }, }, }, @@ -1182,8 +1182,9 @@ export const connectorDetails = { body: { error: { error_type: "invalid_request", - message: "Json deserialize error: unknown variant `United`, expected one of `AED`, `AFN`, `ALL`, `AMD`, `ANG`, `AOA`, `ARS`, `AUD`, `AWG`, `AZN`, `BAM`, `BBD`, `BDT`, `BGN`, `BHD`, `BIF`, `BMD`, `BND`, `BOB`, `BRL`, `BSD`, `BTN`, `BWP`, `BYN`, `BZD`, `CAD`, `CDF`, `CHF`, `CLP`, `CNY`, `COP`, `CRC`, `CUP`, `CVE`, `CZK`, `DJF`, `DKK`, `DOP`, `DZD`, `EGP`, `ERN`, `ETB`, `EUR`, `FJD`, `FKP`, `GBP`, `GEL`, `GHS`, `GIP`, `GMD`, `GNF`, `GTQ`, `GYD`, `HKD`, `HNL`, `HRK`, `HTG`, `HUF`, `IDR`, `ILS`, `INR`, `IQD`, `IRR`, `ISK`, `JMD`, `JOD`, `JPY`, `KES`, `KGS`, `KHR`, `KMF`, `KPW`, `KRW`, `KWD`, `KYD`, `KZT`, `LAK`, `LBP`, `LKR`, `LRD`, `LSL`, `LYD`, `MAD`, `MDL`, `MGA`, `MKD`, `MMK`, `MNT`, `MOP`, `MRU`, `MUR`, `MVR`, `MWK`, `MXN`, `MYR`, `MZN`, `NAD`, `NGN`, `NIO`, `NOK`, `NPR`, `NZD`, `OMR`, `PAB`, `PEN`, `PGK`, `PHP`, `PKR`, `PLN`, `PYG`, `QAR`, `RON`, `RSD`, `RUB`, `RWF`, `SAR`, `SBD`, `SCR`, `SDG`, `SEK`, `SGD`, `SHP`, `SLE`, `SLL`, `SOS`, `SRD`, `SSP`, `STN`, `SVC`, `SYP`, `SZL`, `THB`, `TJS`, `TMT`, `TND`, `TOP`, `TRY`, `TTD`, `TWD`, `TZS`, `UAH`, `UGX`, `USD`, `UYU`, `UZS`, `VES`, `VND`, `VUV`, `WST`, `XAF`, `XCD`, `XOF`, `XPF`, `YER`, `ZAR`, `ZMW`, `ZWL`", - code: "IR_06" + message: + "Json deserialize error: unknown variant `United`, expected one of `AED`, `AFN`, `ALL`, `AMD`, `ANG`, `AOA`, `ARS`, `AUD`, `AWG`, `AZN`, `BAM`, `BBD`, `BDT`, `BGN`, `BHD`, `BIF`, `BMD`, `BND`, `BOB`, `BRL`, `BSD`, `BTN`, `BWP`, `BYN`, `BZD`, `CAD`, `CDF`, `CHF`, `CLP`, `CNY`, `COP`, `CRC`, `CUP`, `CVE`, `CZK`, `DJF`, `DKK`, `DOP`, `DZD`, `EGP`, `ERN`, `ETB`, `EUR`, `FJD`, `FKP`, `GBP`, `GEL`, `GHS`, `GIP`, `GMD`, `GNF`, `GTQ`, `GYD`, `HKD`, `HNL`, `HRK`, `HTG`, `HUF`, `IDR`, `ILS`, `INR`, `IQD`, `IRR`, `ISK`, `JMD`, `JOD`, `JPY`, `KES`, `KGS`, `KHR`, `KMF`, `KPW`, `KRW`, `KWD`, `KYD`, `KZT`, `LAK`, `LBP`, `LKR`, `LRD`, `LSL`, `LYD`, `MAD`, `MDL`, `MGA`, `MKD`, `MMK`, `MNT`, `MOP`, `MRU`, `MUR`, `MVR`, `MWK`, `MXN`, `MYR`, `MZN`, `NAD`, `NGN`, `NIO`, `NOK`, `NPR`, `NZD`, `OMR`, `PAB`, `PEN`, `PGK`, `PHP`, `PKR`, `PLN`, `PYG`, `QAR`, `RON`, `RSD`, `RUB`, `RWF`, `SAR`, `SBD`, `SCR`, `SDG`, `SEK`, `SGD`, `SHP`, `SLE`, `SLL`, `SOS`, `SRD`, `SSP`, `STN`, `SVC`, `SYP`, `SZL`, `THB`, `TJS`, `TMT`, `TND`, `TOP`, `TRY`, `TTD`, `TWD`, `TZS`, `UAH`, `UGX`, `USD`, `UYU`, `UZS`, `VES`, `VND`, `VUV`, `WST`, `XAF`, `XCD`, `XOF`, `XPF`, `YER`, `ZAR`, `ZMW`, `ZWL`", + code: "IR_06", }, }, }, @@ -1210,8 +1211,9 @@ export const connectorDetails = { body: { error: { error_type: "invalid_request", - message: "Json deserialize error: unknown variant `auto`, expected one of `automatic`, `manual`, `manual_multiple`, `scheduled`", - code: "IR_06" + message: + "Json deserialize error: unknown variant `auto`, expected one of `automatic`, `manual`, `manual_multiple`, `scheduled`", + code: "IR_06", }, }, }, @@ -1237,8 +1239,9 @@ export const connectorDetails = { body: { error: { error_type: "invalid_request", - message: "Json deserialize error: unknown variant `this_supposed_to_be_a_card`, expected one of `card`, `card_redirect`, `pay_later`, `wallet`, `bank_redirect`, `bank_transfer`, `crypto`, `bank_debit`, `reward`, `real_time_payment`, `upi`, `voucher`, `gift_card`, `open_banking`, `mobile_payment`", - code: "IR_06" + message: + "Json deserialize error: unknown variant `this_supposed_to_be_a_card`, expected one of `card`, `card_redirect`, `pay_later`, `wallet`, `bank_redirect`, `bank_transfer`, `crypto`, `bank_debit`, `reward`, `real_time_payment`, `upi`, `voucher`, `gift_card`, `open_banking`, `mobile_payment`", + code: "IR_06", }, }, }, diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Paybox.js b/cypress-tests/cypress/e2e/PaymentUtils/Paybox.js index d1eb91692daa..871c127e5efa 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/Paybox.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/Paybox.js @@ -154,7 +154,7 @@ export const connectorDetails = { error: { error_type: "invalid_request", message: "Json deserialize error: invalid card number length", - code: "IR_06" + code: "IR_06", }, }, }, @@ -261,8 +261,9 @@ export const connectorDetails = { body: { error: { error_type: "invalid_request", - message: "Json deserialize error: unknown variant `United`, expected one of `AED`, `AFN`, `ALL`, `AMD`, `ANG`, `AOA`, `ARS`, `AUD`, `AWG`, `AZN`, `BAM`, `BBD`, `BDT`, `BGN`, `BHD`, `BIF`, `BMD`, `BND`, `BOB`, `BRL`, `BSD`, `BTN`, `BWP`, `BYN`, `BZD`, `CAD`, `CDF`, `CHF`, `CLP`, `CNY`, `COP`, `CRC`, `CUP`, `CVE`, `CZK`, `DJF`, `DKK`, `DOP`, `DZD`, `EGP`, `ERN`, `ETB`, `EUR`, `FJD`, `FKP`, `GBP`, `GEL`, `GHS`, `GIP`, `GMD`, `GNF`, `GTQ`, `GYD`, `HKD`, `HNL`, `HRK`, `HTG`, `HUF`, `IDR`, `ILS`, `INR`, `IQD`, `IRR`, `ISK`, `JMD`, `JOD`, `JPY`, `KES`, `KGS`, `KHR`, `KMF`, `KPW`, `KRW`, `KWD`, `KYD`, `KZT`, `LAK`, `LBP`, `LKR`, `LRD`, `LSL`, `LYD`, `MAD`, `MDL`, `MGA`, `MKD`, `MMK`, `MNT`, `MOP`, `MRU`, `MUR`, `MVR`, `MWK`, `MXN`, `MYR`, `MZN`, `NAD`, `NGN`, `NIO`, `NOK`, `NPR`, `NZD`, `OMR`, `PAB`, `PEN`, `PGK`, `PHP`, `PKR`, `PLN`, `PYG`, `QAR`, `RON`, `RSD`, `RUB`, `RWF`, `SAR`, `SBD`, `SCR`, `SDG`, `SEK`, `SGD`, `SHP`, `SLE`, `SLL`, `SOS`, `SRD`, `SSP`, `STN`, `SVC`, `SYP`, `SZL`, `THB`, `TJS`, `TMT`, `TND`, `TOP`, `TRY`, `TTD`, `TWD`, `TZS`, `UAH`, `UGX`, `USD`, `UYU`, `UZS`, `VES`, `VND`, `VUV`, `WST`, `XAF`, `XCD`, `XOF`, `XPF`, `YER`, `ZAR`, `ZMW`, `ZWL`", - code: "IR_06" + message: + "Json deserialize error: unknown variant `United`, expected one of `AED`, `AFN`, `ALL`, `AMD`, `ANG`, `AOA`, `ARS`, `AUD`, `AWG`, `AZN`, `BAM`, `BBD`, `BDT`, `BGN`, `BHD`, `BIF`, `BMD`, `BND`, `BOB`, `BRL`, `BSD`, `BTN`, `BWP`, `BYN`, `BZD`, `CAD`, `CDF`, `CHF`, `CLP`, `CNY`, `COP`, `CRC`, `CUP`, `CVE`, `CZK`, `DJF`, `DKK`, `DOP`, `DZD`, `EGP`, `ERN`, `ETB`, `EUR`, `FJD`, `FKP`, `GBP`, `GEL`, `GHS`, `GIP`, `GMD`, `GNF`, `GTQ`, `GYD`, `HKD`, `HNL`, `HRK`, `HTG`, `HUF`, `IDR`, `ILS`, `INR`, `IQD`, `IRR`, `ISK`, `JMD`, `JOD`, `JPY`, `KES`, `KGS`, `KHR`, `KMF`, `KPW`, `KRW`, `KWD`, `KYD`, `KZT`, `LAK`, `LBP`, `LKR`, `LRD`, `LSL`, `LYD`, `MAD`, `MDL`, `MGA`, `MKD`, `MMK`, `MNT`, `MOP`, `MRU`, `MUR`, `MVR`, `MWK`, `MXN`, `MYR`, `MZN`, `NAD`, `NGN`, `NIO`, `NOK`, `NPR`, `NZD`, `OMR`, `PAB`, `PEN`, `PGK`, `PHP`, `PKR`, `PLN`, `PYG`, `QAR`, `RON`, `RSD`, `RUB`, `RWF`, `SAR`, `SBD`, `SCR`, `SDG`, `SEK`, `SGD`, `SHP`, `SLE`, `SLL`, `SOS`, `SRD`, `SSP`, `STN`, `SVC`, `SYP`, `SZL`, `THB`, `TJS`, `TMT`, `TND`, `TOP`, `TRY`, `TTD`, `TWD`, `TZS`, `UAH`, `UGX`, `USD`, `UYU`, `UZS`, `VES`, `VND`, `VUV`, `WST`, `XAF`, `XCD`, `XOF`, `XPF`, `YER`, `ZAR`, `ZMW`, `ZWL`", + code: "IR_06", }, }, }, @@ -289,8 +290,9 @@ export const connectorDetails = { body: { error: { error_type: "invalid_request", - message: "Json deserialize error: unknown variant `auto`, expected one of `automatic`, `manual`, `manual_multiple`, `scheduled`", - code: "IR_06" + message: + "Json deserialize error: unknown variant `auto`, expected one of `automatic`, `manual`, `manual_multiple`, `scheduled`", + code: "IR_06", }, }, }, @@ -316,8 +318,9 @@ export const connectorDetails = { body: { error: { error_type: "invalid_request", - message: "Json deserialize error: unknown variant `this_supposed_to_be_a_card`, expected one of `card`, `card_redirect`, `pay_later`, `wallet`, `bank_redirect`, `bank_transfer`, `crypto`, `bank_debit`, `reward`, `real_time_payment`, `upi`, `voucher`, `gift_card`, `open_banking`, `mobile_payment`", - code: "IR_06" + message: + "Json deserialize error: unknown variant `this_supposed_to_be_a_card`, expected one of `card`, `card_redirect`, `pay_later`, `wallet`, `bank_redirect`, `bank_transfer`, `crypto`, `bank_debit`, `reward`, `real_time_payment`, `upi`, `voucher`, `gift_card`, `open_banking`, `mobile_payment`", + code: "IR_06", }, }, }, diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Utils.js b/cypress-tests/cypress/e2e/PaymentUtils/Utils.js index b989af97fb5b..76d7025ed27c 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/Utils.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/Utils.js @@ -1,3 +1,5 @@ +import { validateConfig } from "../../utils/featureFlags.js"; + import { connectorDetails as adyenConnectorDetails } from "./Adyen.js"; import { connectorDetails as bankOfAmericaConnectorDetails } from "./BankOfAmerica.js"; import { connectorDetails as bluesnapConnectorDetails } from "./Bluesnap.js"; @@ -124,15 +126,18 @@ export function getValueByKey(jsonObject, key) { } } -export const should_continue_further = (res_data, config_data) => { - if (config_data?.TRIGGER_SKIP !== undefined) { - return !config_data.TRIGGER_SKIP; +export const should_continue_further = (data) => { + const resData = data.Response || {}; + const configData = validateConfig(data.Configs) || {}; + + if (typeof configData?.TRIGGER_SKIP !== "undefined") { + return !configData.TRIGGER_SKIP; } if ( - res_data.body.error !== undefined || - res_data.body.error_code !== undefined || - res_data.body.error_message !== undefined + typeof resData.body.error !== "undefined" || + typeof resData.body.error_code !== "undefined" || + typeof resData.body.error_message !== "undefined" ) { return false; } else { diff --git a/cypress-tests/cypress/e2e/PayoutTest/00003-CardTest.cy.js b/cypress-tests/cypress/e2e/PayoutTest/00003-CardTest.cy.js index 2caa6030c536..c1b69af6b8a2 100644 --- a/cypress-tests/cypress/e2e/PayoutTest/00003-CardTest.cy.js +++ b/cypress-tests/cypress/e2e/PayoutTest/00003-CardTest.cy.js @@ -41,19 +41,17 @@ describe("[Payout] Cards", () => { let data = utils.getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["Fulfill"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createConfirmPayoutTest( fixtures.createPayoutBody, - req_data, - res_data, + data, true, true, globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); it("retrieve-payout-call-test", () => { @@ -74,29 +72,26 @@ describe("[Payout] Cards", () => { let data = utils.getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["Confirm"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createConfirmPayoutTest( fixtures.createPayoutBody, - req_data, - res_data, + data, true, false, globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); it("fulfill-payout-call-test", () => { let data = utils.getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["Fulfill"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.fulfillPayoutCallTest({}, req_data, res_data, globalState); + + cy.fulfillPayoutCallTest({}, data, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); it("retrieve-payout-call-test", () => { diff --git a/cypress-tests/cypress/e2e/PayoutTest/00004-BankTransfer.cy.js b/cypress-tests/cypress/e2e/PayoutTest/00004-BankTransfer.cy.js index 887152c3a6f5..3b14ed516a14 100644 --- a/cypress-tests/cypress/e2e/PayoutTest/00004-BankTransfer.cy.js +++ b/cypress-tests/cypress/e2e/PayoutTest/00004-BankTransfer.cy.js @@ -94,18 +94,15 @@ describe("[Payout] [Bank Transfer - SEPA]", () => { "bank_transfer_pm" ]["sepa"]["Fulfill"]; - let req_data = data["Request"]; - let res_data = data["Response"]; cy.createConfirmPayoutTest( fixtures.createPayoutBody, - req_data, - res_data, + data, true, true, globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); it("retrieve-payout-call-test", () => { @@ -126,29 +123,26 @@ describe("[Payout] [Bank Transfer - SEPA]", () => { let data = utils.getConnectorDetails(globalState.get("connectorId"))[ "bank_transfer_pm" ]["sepa"]["Confirm"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createConfirmPayoutTest( fixtures.createPayoutBody, - req_data, - res_data, + data, true, false, globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); it("fulfill-payout-call-test", () => { let data = utils.getConnectorDetails(globalState.get("connectorId"))[ "bank_transfer_pm" ]["sepa"]["Fulfill"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.fulfillPayoutCallTest({}, req_data, res_data, globalState); + + cy.fulfillPayoutCallTest({}, data, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); it("retrieve-payout-call-test", () => { diff --git a/cypress-tests/cypress/e2e/PayoutTest/00005-SavePayout.cy.js b/cypress-tests/cypress/e2e/PayoutTest/00005-SavePayout.cy.js index edcb89d06fd4..bb8d35b16c49 100644 --- a/cypress-tests/cypress/e2e/PayoutTest/00005-SavePayout.cy.js +++ b/cypress-tests/cypress/e2e/PayoutTest/00005-SavePayout.cy.js @@ -45,9 +45,8 @@ describe("[Payout] Saved Card", () => { let data = utils.getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["SavePayoutMethod"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentMethodTest(globalState, req_data, res_data); + + cy.createPaymentMethodTest(globalState, data); }); it("list customer payment methods", () => { @@ -58,19 +57,17 @@ describe("[Payout] Saved Card", () => { let data = utils.getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["Token"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createConfirmWithTokenPayoutTest( payoutBody, - req_data, - res_data, + data, true, true, globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); it("retrieve-payout-call-test", () => { @@ -97,19 +94,11 @@ describe("[Payout] Saved Card", () => { let data = utils.getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["Fulfill"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createConfirmPayoutTest( - payoutBody, - req_data, - res_data, - true, - true, - globalState - ); + + cy.createConfirmPayoutTest(payoutBody, data, true, true, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); it("list customer payment methods", () => { @@ -120,19 +109,17 @@ describe("[Payout] Saved Card", () => { let data = utils.getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["Token"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createConfirmWithTokenPayoutTest( payoutBody, - req_data, - res_data, + data, true, true, globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); it("retrieve-payout-call-test", () => { @@ -182,9 +169,8 @@ describe("[Payout] Saved Bank transfer", () => { let data = utils.getConnectorDetails(globalState.get("connectorId"))[ "bank_transfer_pm" ]["sepa"]["SavePayoutMethod"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentMethodTest(globalState, req_data, res_data); + + cy.createPaymentMethodTest(globalState, data); }); it("list customer payment methods", () => { @@ -195,19 +181,17 @@ describe("[Payout] Saved Bank transfer", () => { let data = utils.getConnectorDetails(globalState.get("connectorId"))[ "bank_transfer_pm" ]["sepa"]["Token"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createConfirmWithTokenPayoutTest( payoutBody, - req_data, - res_data, + data, true, true, globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); it("retrieve-payout-call-test", () => { @@ -235,19 +219,11 @@ describe("[Payout] Saved Bank transfer", () => { let data = utils.getConnectorDetails(globalState.get("connectorId"))[ "bank_transfer_pm" ]["sepa"]["Fulfill"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createConfirmPayoutTest( - payoutBody, - req_data, - res_data, - true, - true, - globalState - ); + + cy.createConfirmPayoutTest(payoutBody, data, true, true, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); it("list customer payment methods", () => { @@ -258,19 +234,17 @@ describe("[Payout] Saved Bank transfer", () => { let data = utils.getConnectorDetails(globalState.get("connectorId"))[ "bank_transfer_pm" ]["sepa"]["Token"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createConfirmWithTokenPayoutTest( payoutBody, - req_data, - res_data, + data, true, true, globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); it("retrieve-payout-call-test", () => { diff --git a/cypress-tests/cypress/e2e/RoutingTest/00000-PriorityRouting.cy.js b/cypress-tests/cypress/e2e/RoutingTest/00000-PriorityRouting.cy.js index 37693a39310f..ffb329156f71 100644 --- a/cypress-tests/cypress/e2e/RoutingTest/00000-PriorityRouting.cy.js +++ b/cypress-tests/cypress/e2e/RoutingTest/00000-PriorityRouting.cy.js @@ -53,9 +53,6 @@ describe("Priority Based Routing Test", () => { it("add-routing-config", () => { let data = utils.getConnectorDetails("common")["priorityRouting"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - let routing_data = [ { connector: "stripe", @@ -68,51 +65,45 @@ describe("Priority Based Routing Test", () => { ]; cy.addRoutingConfig( fixtures.routingConfigBody, - req_data, - res_data, + data, "priority", routing_data, globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); it("retrieve-routing-call-test", () => { let data = utils.getConnectorDetails("common")["priorityRouting"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.retrieveRoutingConfig(req_data, res_data, globalState); + + cy.retrieveRoutingConfig(data, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); it("activate-routing-call-test", () => { let data = utils.getConnectorDetails("common")["priorityRouting"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.activateRoutingConfig(req_data, res_data, globalState); + + cy.activateRoutingConfig(data, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); it("payment-routing-test", () => { let data = utils.getConnectorDetails("stripe")["card_pm"]["No3DSAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; cy.createConfirmPaymentTest( fixtures.createConfirmPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { @@ -144,9 +135,6 @@ describe("Priority Based Routing Test", () => { it("add-routing-config", () => { let data = utils.getConnectorDetails("common")["priorityRouting"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - let routing_data = [ { connector: "adyen", @@ -159,49 +147,44 @@ describe("Priority Based Routing Test", () => { ]; cy.addRoutingConfig( fixtures.routingConfigBody, - req_data, - res_data, + data, "priority", routing_data, globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); it("retrieve-routing-call-test", () => { let data = utils.getConnectorDetails("common")["priorityRouting"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.retrieveRoutingConfig(req_data, res_data, globalState); + + cy.retrieveRoutingConfig(data, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); it("activate-routing-call-test", () => { let data = utils.getConnectorDetails("common")["priorityRouting"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.activateRoutingConfig(req_data, res_data, globalState); + + cy.activateRoutingConfig(data, globalState); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); it("payment-routing-test", () => { let data = utils.getConnectorDetails("adyen")["card_pm"]["No3DSAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createConfirmPaymentTest( fixtures.createConfirmPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState ); if (should_continue) - should_continue = utils.should_continue_further(res_data); + should_continue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { diff --git a/cypress-tests/cypress/e2e/RoutingTest/00001-VolumeBasedRouting.cy.js b/cypress-tests/cypress/e2e/RoutingTest/00001-VolumeBasedRouting.cy.js index d4fc60763e8f..540a31b6fdff 100644 --- a/cypress-tests/cypress/e2e/RoutingTest/00001-VolumeBasedRouting.cy.js +++ b/cypress-tests/cypress/e2e/RoutingTest/00001-VolumeBasedRouting.cy.js @@ -52,9 +52,6 @@ describe("Volume Based Routing Test", () => { it("add-routing-config", () => { let data = utils.getConnectorDetails("common")["volumeBasedRouting"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - let routing_data = [ { connector: { @@ -67,8 +64,7 @@ describe("Volume Based Routing Test", () => { cy.addRoutingConfig( fixtures.routingConfigBody, - req_data, - res_data, + data, "volume_split", routing_data, globalState @@ -77,27 +73,23 @@ describe("Volume Based Routing Test", () => { it("retrieve-routing-call-test", () => { let data = utils.getConnectorDetails("common")["volumeBasedRouting"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.retrieveRoutingConfig(req_data, res_data, globalState); + + cy.retrieveRoutingConfig(data, globalState); }); it("activate-routing-call-test", () => { let data = utils.getConnectorDetails("common")["volumeBasedRouting"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.activateRoutingConfig(req_data, res_data, globalState); + + cy.activateRoutingConfig(data, globalState); }); it("payment-routing-test", () => { let data = utils.getConnectorDetails("stripe")["card_pm"]["No3DSAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createConfirmPaymentTest( fixtures.createConfirmPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState @@ -113,12 +105,10 @@ describe("Volume Based Routing Test", () => { utils.getConnectorDetails("stripe")["bank_redirect_pm"][ "PaymentIntent" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "three_ds", "automatic", globalState @@ -131,12 +121,10 @@ describe("Volume Based Routing Test", () => { it("Confirm bank redirect", () => { let data = utils.getConnectorDetails("stripe")["bank_redirect_pm"]["eps"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.confirmBankRedirectCallTest( fixtures.confirmBody, - req_data, - res_data, + data, true, globalState ); @@ -178,9 +166,6 @@ describe("Volume Based Routing Test", () => { it("add-routing-config", () => { let data = utils.getConnectorDetails("common")["volumeBasedRouting"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - let routing_data = [ { connector: { @@ -193,8 +178,7 @@ describe("Volume Based Routing Test", () => { cy.addRoutingConfig( fixtures.routingConfigBody, - req_data, - res_data, + data, "volume_split", routing_data, globalState @@ -203,27 +187,23 @@ describe("Volume Based Routing Test", () => { it("retrieve-routing-call-test", () => { let data = utils.getConnectorDetails("common")["volumeBasedRouting"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.retrieveRoutingConfig(req_data, res_data, globalState); + + cy.retrieveRoutingConfig(data, globalState); }); it("activate-routing-call-test", () => { let data = utils.getConnectorDetails("common")["volumeBasedRouting"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.activateRoutingConfig(req_data, res_data, globalState); + + cy.activateRoutingConfig(data, globalState); }); it("payment-routing-test-for-card", () => { let data = utils.getConnectorDetails("adyen")["card_pm"]["No3DSAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createConfirmPaymentTest( fixtures.createConfirmPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState @@ -237,12 +217,10 @@ describe("Volume Based Routing Test", () => { it("create-payment-call-test-for-eps", () => { let data = utils.getConnectorDetails("adyen")["bank_redirect_pm"]["PaymentIntent"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "three_ds", "automatic", globalState @@ -255,12 +233,10 @@ describe("Volume Based Routing Test", () => { it("Confirm bank redirect", () => { let data = utils.getConnectorDetails("adyen")["bank_redirect_pm"]["eps"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.confirmBankRedirectCallTest( fixtures.confirmBody, - req_data, - res_data, + data, true, globalState ); diff --git a/cypress-tests/cypress/e2e/RoutingTest/00002-RuleBasedRouting.cy.js b/cypress-tests/cypress/e2e/RoutingTest/00002-RuleBasedRouting.cy.js index bd451a7428f7..4fb35920d8ea 100644 --- a/cypress-tests/cypress/e2e/RoutingTest/00002-RuleBasedRouting.cy.js +++ b/cypress-tests/cypress/e2e/RoutingTest/00002-RuleBasedRouting.cy.js @@ -52,9 +52,6 @@ describe("Rule Based Routing Test", () => { it("add-routing-config", () => { let data = utils.getConnectorDetails("common")["ruleBasedRouting"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - let routing_data = { defaultSelection: { type: "priority", @@ -121,8 +118,7 @@ describe("Rule Based Routing Test", () => { cy.addRoutingConfig( fixtures.routingConfigBody, - req_data, - res_data, + data, "advanced", routing_data, globalState @@ -131,27 +127,23 @@ describe("Rule Based Routing Test", () => { it("retrieve-routing-call-test", () => { let data = utils.getConnectorDetails("common")["volumeBasedRouting"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.retrieveRoutingConfig(req_data, res_data, globalState); + + cy.retrieveRoutingConfig(data, globalState); }); it("activate-routing-call-test", () => { let data = utils.getConnectorDetails("common")["ruleBasedRouting"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.activateRoutingConfig(req_data, res_data, globalState); + + cy.activateRoutingConfig(data, globalState); }); it("payment-routing-test for card", () => { let data = utils.getConnectorDetails("stripe")["card_pm"]["No3DSAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createConfirmPaymentTest( fixtures.createConfirmPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState @@ -165,12 +157,10 @@ describe("Rule Based Routing Test", () => { it("create-payment-routing-test for bank redirect", () => { let data = utils.getConnectorDetails("adyen")["bank_redirect_pm"]["PaymentIntent"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "three_ds", "automatic", globalState @@ -180,12 +170,10 @@ describe("Rule Based Routing Test", () => { it("Confirm bank redirect", () => { let data = utils.getConnectorDetails("adyen")["bank_redirect_pm"]["ideal"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.confirmBankRedirectCallTest( fixtures.confirmBody, - req_data, - res_data, + data, true, globalState ); @@ -228,9 +216,6 @@ describe("Rule Based Routing Test", () => { it("add-routing-config", () => { let data = utils.getConnectorDetails("common")["ruleBasedRouting"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - let routing_data = { defaultSelection: { type: "priority", @@ -275,8 +260,7 @@ describe("Rule Based Routing Test", () => { cy.addRoutingConfig( fixtures.routingConfigBody, - req_data, - res_data, + data, "advanced", routing_data, globalState @@ -285,27 +269,23 @@ describe("Rule Based Routing Test", () => { it("retrieve-routing-call-test", () => { let data = utils.getConnectorDetails("common")["volumeBasedRouting"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.retrieveRoutingConfig(req_data, res_data, globalState); + + cy.retrieveRoutingConfig(data, globalState); }); it("activate-routing-call-test", () => { let data = utils.getConnectorDetails("common")["ruleBasedRouting"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.activateRoutingConfig(req_data, res_data, globalState); + + cy.activateRoutingConfig(data, globalState); }); it("create-payment-call-test-with-USD", () => { let data = utils.getConnectorDetails("stripe")["card_pm"]["PaymentIntent"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState @@ -315,15 +295,8 @@ describe("Rule Based Routing Test", () => { it("Confirm No 3DS", () => { let data = utils.getConnectorDetails("stripe")["card_pm"]["No3DSAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); + + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); }); it("retrieve-payment-call-test", () => { @@ -332,12 +305,10 @@ describe("Rule Based Routing Test", () => { it("create-payment-call-test-with-EUR", () => { let data = utils.getConnectorDetails("adyen")["card_pm"]["PaymentIntent"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState @@ -347,15 +318,8 @@ describe("Rule Based Routing Test", () => { it("Confirm No 3DS", () => { let data = utils.getConnectorDetails("adyen")["card_pm"]["No3DSAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); + + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); }); it("retrieve-payment-call-test", () => { @@ -390,9 +354,6 @@ describe("Rule Based Routing Test", () => { it("add-routing-config", () => { let data = utils.getConnectorDetails("common")["ruleBasedRouting"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - let routing_data = { defaultSelection: { type: "priority", @@ -453,8 +414,7 @@ describe("Rule Based Routing Test", () => { cy.addRoutingConfig( fixtures.routingConfigBody, - req_data, - res_data, + data, "advanced", routing_data, globalState @@ -463,27 +423,23 @@ describe("Rule Based Routing Test", () => { it("retrieve-routing-call-test", () => { let data = utils.getConnectorDetails("common")["volumeBasedRouting"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.retrieveRoutingConfig(req_data, res_data, globalState); + + cy.retrieveRoutingConfig(data, globalState); }); it("activate-routing-call-test", () => { let data = utils.getConnectorDetails("common")["ruleBasedRouting"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.activateRoutingConfig(req_data, res_data, globalState); + + cy.activateRoutingConfig(data, globalState); }); it("create-payment-call-test-with-amount-10", () => { let data = utils.getConnectorDetails("stripe")["card_pm"]["PaymentIntent"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState @@ -493,15 +449,8 @@ describe("Rule Based Routing Test", () => { it("Confirm No 3DS", () => { let data = utils.getConnectorDetails("stripe")["card_pm"]["No3DSAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); + + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); }); it("retrieve-payment-call-test", () => { @@ -511,12 +460,10 @@ describe("Rule Based Routing Test", () => { it("create-payment-call-test-with-amount-9", () => { let data = utils.getConnectorDetails("adyen")["card_pm"]["PaymentIntent"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState @@ -526,15 +473,8 @@ describe("Rule Based Routing Test", () => { it("Confirm No 3DS", () => { let data = utils.getConnectorDetails("adyen")["card_pm"]["No3DSAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); + + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); it("retrieve-payment-call-test", () => { cy.retrievePaymentCallTest(globalState, null); diff --git a/cypress-tests/cypress/e2e/RoutingTest/00003-Retries.cy.js b/cypress-tests/cypress/e2e/RoutingTest/00003-Retries.cy.js index 90c6fbabc6d8..388bc2e37161 100644 --- a/cypress-tests/cypress/e2e/RoutingTest/00003-Retries.cy.js +++ b/cypress-tests/cypress/e2e/RoutingTest/00003-Retries.cy.js @@ -60,9 +60,6 @@ describe("Auto Retries & Step Up 3DS", () => { it("Add routing config", () => { let data = utils.getConnectorDetails("common")["priorityRouting"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - let routing_data = [ { connector: "adyen", @@ -79,8 +76,7 @@ describe("Auto Retries & Step Up 3DS", () => { ]; cy.addRoutingConfig( fixtures.routingConfigBody, - req_data, - res_data, + data, "priority", routing_data, globalState @@ -89,9 +85,8 @@ describe("Auto Retries & Step Up 3DS", () => { it("Activate routing config", () => { let data = utils.getConnectorDetails("common")["priorityRouting"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.activateRoutingConfig(req_data, res_data, globalState); + + cy.activateRoutingConfig(data, globalState); }); }); @@ -112,12 +107,10 @@ describe("Auto Retries & Step Up 3DS", () => { utils.getConnectorDetails("autoretries")["card_pm"][ "PaymentIntent" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState @@ -129,12 +122,10 @@ describe("Auto Retries & Step Up 3DS", () => { utils.getConnectorDetails("autoretries")["card_pm"][ "BluesnapConfirm" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.confirmCallTest( fixtures.confirmBody, - req_data, - res_data, + data, true, globalState ); @@ -168,12 +159,10 @@ describe("Auto Retries & Step Up 3DS", () => { utils.getConnectorDetails("autoretries")["card_pm"][ "PaymentIntent" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState @@ -185,12 +174,10 @@ describe("Auto Retries & Step Up 3DS", () => { utils.getConnectorDetails("autoretries")["card_pm"][ "StripeConfirmSuccess" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.confirmCallTest( fixtures.confirmBody, - req_data, - res_data, + data, true, globalState ); @@ -223,12 +210,10 @@ describe("Auto Retries & Step Up 3DS", () => { utils.getConnectorDetails("autoretries")["card_pm"][ "PaymentIntent" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState @@ -240,12 +225,10 @@ describe("Auto Retries & Step Up 3DS", () => { utils.getConnectorDetails("autoretries")["card_pm"][ "AdyenConfirmFail" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.confirmCallTest( fixtures.confirmBody, - req_data, - res_data, + data, true, globalState ); @@ -277,9 +260,6 @@ describe("Auto Retries & Step Up 3DS", () => { it("Add routing config", () => { let data = utils.getConnectorDetails("common")["priorityRouting"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - let routing_data = [ { connector: "stripe", @@ -296,8 +276,7 @@ describe("Auto Retries & Step Up 3DS", () => { ]; cy.addRoutingConfig( fixtures.routingConfigBody, - req_data, - res_data, + data, "priority", routing_data, globalState @@ -306,9 +285,8 @@ describe("Auto Retries & Step Up 3DS", () => { it("Activate routing config", () => { let data = utils.getConnectorDetails("common")["priorityRouting"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.activateRoutingConfig(req_data, res_data, globalState); + + cy.activateRoutingConfig(data, globalState); }); }); @@ -329,12 +307,10 @@ describe("Auto Retries & Step Up 3DS", () => { utils.getConnectorDetails("autoretries")["card_pm"][ "PaymentIntent" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState @@ -346,12 +322,10 @@ describe("Auto Retries & Step Up 3DS", () => { utils.getConnectorDetails("autoretries")["card_pm"][ "BluesnapConfirm" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.confirmCallTest( fixtures.confirmBody, - req_data, - res_data, + data, true, globalState ); @@ -385,12 +359,10 @@ describe("Auto Retries & Step Up 3DS", () => { utils.getConnectorDetails("autoretries")["card_pm"][ "PaymentIntent" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState @@ -402,12 +374,10 @@ describe("Auto Retries & Step Up 3DS", () => { utils.getConnectorDetails("autoretries")["card_pm"][ "AdyenConfirm" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.confirmCallTest( fixtures.confirmBody, - req_data, - res_data, + data, true, globalState ); @@ -441,12 +411,10 @@ describe("Auto Retries & Step Up 3DS", () => { utils.getConnectorDetails("autoretries")["card_pm"][ "PaymentIntent" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState @@ -458,12 +426,10 @@ describe("Auto Retries & Step Up 3DS", () => { utils.getConnectorDetails("autoretries")["card_pm"][ "StripeConfirmFail" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.confirmCallTest( fixtures.confirmBody, - req_data, - res_data, + data, true, globalState ); @@ -514,12 +480,10 @@ describe("Auto Retries & Step Up 3DS", () => { utils.getConnectorDetails("autoretries")["card_pm"][ "PaymentIntent" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState @@ -531,15 +495,8 @@ describe("Auto Retries & Step Up 3DS", () => { utils.getConnectorDetails("autoretries")["card_pm"][ "StripeConfirm3DS" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); + + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); }); it("Payment retrieve call", () => { @@ -575,12 +532,10 @@ describe("Auto Retries & Step Up 3DS", () => { utils.getConnectorDetails("autoretries")["card_pm"][ "PaymentIntent" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState @@ -592,15 +547,8 @@ describe("Auto Retries & Step Up 3DS", () => { utils.getConnectorDetails("autoretries")["card_pm"][ "StripeConfirmFail" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); + + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); }); it("Payment retrieve call", () => { @@ -614,12 +562,10 @@ describe("Auto Retries & Step Up 3DS", () => { utils.getConnectorDetails("autoretries")["card_pm"][ "PaymentIntent" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState @@ -631,15 +577,8 @@ describe("Auto Retries & Step Up 3DS", () => { utils.getConnectorDetails("autoretries")["card_pm"][ "StripeConfirmSuccess" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); + + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); }); it("Payment retrieve call", () => { diff --git a/cypress-tests/cypress/e2e/RoutingUtils/Utils.js b/cypress-tests/cypress/e2e/RoutingUtils/Utils.js index ad92999c2874..791d732b1b1b 100644 --- a/cypress-tests/cypress/e2e/RoutingUtils/Utils.js +++ b/cypress-tests/cypress/e2e/RoutingUtils/Utils.js @@ -26,11 +26,13 @@ function getValueByKey(jsonObject, key) { } } -export const should_continue_further = (res_data) => { +export const should_continue_further = (data) => { + const resData = data.Response || {}; + if ( - res_data.body.error !== undefined || - res_data.body.error_code !== undefined || - res_data.body.error_message !== undefined + typeof resData.body.error !== "undefined" || + typeof resData.body.error_code !== "undefined" || + typeof resData.body.error_message !== "undefined" ) { return false; } else { diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js index 6778fb058899..a26e8ef4205d 100644 --- a/cypress-tests/cypress/support/commands.js +++ b/cypress-tests/cypress/support/commands.js @@ -26,7 +26,7 @@ // commands.js or your custom support file import { defaultErrorHandler, getValueByKey } from "../e2e/PaymentUtils/Utils"; -import { execConfig } from "../utils/featureFlags"; +import { execConfig, validateConfig } from "../utils/featureFlags"; import * as RequestBodyUtils from "../utils/RequestBodyUtils"; import { handleRedirection } from "./redirectionHandler"; @@ -894,13 +894,17 @@ Cypress.Commands.add( "createPaymentIntentTest", ( createPaymentBody, - req_data, - res_data, + data, authentication_type, capture_method, - globalState, - configs = null + globalState ) => { + const { + Configs: configs = {}, + Request: req_data, + Response: res_data, + } = data || {}; + if ( !createPaymentBody || typeof createPaymentBody !== "object" || @@ -911,7 +915,7 @@ Cypress.Commands.add( ); } - const config_info = execConfig(configs); + const config_info = execConfig(validateConfig(configs)); const profile_id = globalState.get(config_info.profile_id); for (const key in req_data) { @@ -1038,50 +1042,53 @@ Cypress.Commands.add("paymentMethodsCallTest", (globalState) => { }); }); -Cypress.Commands.add( - "createPaymentMethodTest", - (globalState, req_data, res_data) => { - req_data.customer_id = globalState.get("customerId"); - const merchant_id = globalState.get("merchantId"); +Cypress.Commands.add("createPaymentMethodTest", (globalState, data) => { + const { + Configs: configs = {}, + Request: req_data, + Response: res_data, + } = data || {}; - cy.request({ - method: "POST", - url: `${globalState.get("baseUrl")}/payment_methods`, - headers: { - "Content-Type": "application/json", - Accept: "application/json", - "api-key": globalState.get("apiKey"), - }, - body: req_data, - failOnStatusCode: false, - }).then((response) => { - logRequestId(response.headers["x-request-id"]); + req_data.customer_id = globalState.get("customerId"); + const merchant_id = globalState.get("merchantId"); - expect(response.headers["content-type"]).to.include("application/json"); - if (response.status === 200) { - expect(response.body.client_secret, "client_secret").to.include( - "_secret_" - ).and.to.not.be.null; - expect(response.body.payment_method_id, "payment_method_id").to.not.be - .null; - expect(response.body.merchant_id, "merchant_id").to.equal(merchant_id); - expect(req_data.payment_method_type, "payment_method_type").to.equal( - response.body.payment_method_type - ); - expect(req_data.payment_method, "payment_method").to.equal( - response.body.payment_method - ); - expect(response.body.last_used_at, "last_used_at").to.not.be.null; - expect(req_data.customer_id, "customer_id").to.equal( - response.body.customer_id - ); - globalState.set("paymentMethodId", response.body.payment_method_id); - } else { - defaultErrorHandler(response, res_data); - } - }); - } -); + cy.request({ + method: "POST", + url: `${globalState.get("baseUrl")}/payment_methods`, + headers: { + "Content-Type": "application/json", + Accept: "application/json", + "api-key": globalState.get("apiKey"), + }, + body: req_data, + failOnStatusCode: false, + }).then((response) => { + logRequestId(response.headers["x-request-id"]); + + expect(response.headers["content-type"]).to.include("application/json"); + if (response.status === 200) { + expect(response.body.client_secret, "client_secret").to.include( + "_secret_" + ).and.to.not.be.null; + expect(response.body.payment_method_id, "payment_method_id").to.not.be + .null; + expect(response.body.merchant_id, "merchant_id").to.equal(merchant_id); + expect(req_data.payment_method_type, "payment_method_type").to.equal( + response.body.payment_method_type + ); + expect(req_data.payment_method, "payment_method").to.equal( + response.body.payment_method + ); + expect(response.body.last_used_at, "last_used_at").to.not.be.null; + expect(req_data.customer_id, "customer_id").to.equal( + response.body.customer_id + ); + globalState.set("paymentMethodId", response.body.payment_method_id); + } else { + defaultErrorHandler(response, res_data); + } + }); +}); Cypress.Commands.add("deletePaymentMethodTest", (globalState, res_data) => { const payment_method_id = globalState.get("paymentMethodId"); @@ -1133,8 +1140,14 @@ Cypress.Commands.add("setDefaultPaymentMethodTest", (globalState) => { Cypress.Commands.add( "confirmCallTest", - (confirmBody, req_data, res_data, confirm, globalState, configs = null) => { - const config_info = execConfig(configs); + (confirmBody, data, confirm, globalState) => { + const { + Configs: configs = {}, + Request: req_data, + Response: res_data, + } = data || {}; + + const config_info = execConfig(validateConfig(configs)); const merchant_connector_id = globalState.get( config_info.merchant_connector_id ); @@ -1244,8 +1257,14 @@ Cypress.Commands.add( Cypress.Commands.add( "confirmBankRedirectCallTest", - (confirmBody, req_data, res_data, confirm, globalState, configs = null) => { - const config_info = execConfig(configs); + (confirmBody, data, confirm, globalState) => { + const { + Configs: configs = {}, + Request: req_data, + Response: res_data, + } = data || {}; + + const config_info = execConfig(validateConfig(configs)); const connectorId = globalState.get("connectorId"); const paymentIntentId = globalState.get("paymentID"); const profile_id = globalState.get(config_info.profile_id); @@ -1342,8 +1361,14 @@ Cypress.Commands.add( Cypress.Commands.add( "confirmBankTransferCallTest", - (confirmBody, req_data, res_data, confirm, globalState, configs = null) => { - const config_info = execConfig(configs); + (confirmBody, data, confirm, globalState) => { + const { + Configs: configs = {}, + Request: req_data, + Response: res_data, + } = data || {}; + + const config_info = execConfig(validateConfig(configs)); const paymentIntentID = globalState.get("paymentID"); const profile_id = globalState.get(config_info.profile_id); @@ -1417,8 +1442,14 @@ Cypress.Commands.add( Cypress.Commands.add( "confirmUpiCall", - (confirmBody, req_data, res_data, confirm, globalState, configs = null) => { - const config_info = execConfig(configs); + (confirmBody, data, confirm, globalState) => { + const { + Configs: configs = {}, + Request: req_data, + Response: res_data, + } = data || {}; + + const config_info = execConfig(validateConfig(configs)); const paymentId = globalState.get("paymentID"); const profile_id = globalState.get(config_info.profile_id); @@ -1481,14 +1512,18 @@ Cypress.Commands.add( "createConfirmPaymentTest", ( createConfirmPaymentBody, - req_data, - res_data, + data, authentication_type, capture_method, - globalState, - configs = null + globalState ) => { - const config_info = execConfig(configs); + const { + Configs: configs = {}, + Request: req_data, + Response: res_data, + } = data || {}; + + const config_info = execConfig(validateConfig(configs)); const merchant_connector_id = globalState.get( config_info.merchant_connector_id ); @@ -1598,8 +1633,14 @@ Cypress.Commands.add( // This is consequent saved card payment confirm call test(Using payment token) Cypress.Commands.add( "saveCardConfirmCallTest", - (saveCardConfirmBody, req_data, res_data, globalState, configs = null) => { - const config_info = execConfig(configs); + (saveCardConfirmBody, data, globalState) => { + const { + Configs: configs = {}, + Request: req_data, + Response: res_data, + } = data || {}; + + const config_info = execConfig(validateConfig(configs)); const merchant_connector_id = globalState.get( config_info.merchant_connector_id ); @@ -1703,15 +1744,14 @@ Cypress.Commands.add( Cypress.Commands.add( "captureCallTest", - ( - requestBody, - req_data, - res_data, - amount_to_capture, - globalState, - configs = null - ) => { - const config_info = execConfig(configs); + (requestBody, data, amount_to_capture, globalState) => { + const { + Configs: configs = {}, + Request: req_data, + Response: res_data, + } = data || {}; + + const config_info = execConfig(validateConfig(configs)); const payment_id = globalState.get("paymentID"); const profile_id = globalState.get(config_info.profile_id); @@ -1743,43 +1783,46 @@ Cypress.Commands.add( } ); -Cypress.Commands.add( - "voidCallTest", - (requestBody, req_data, res_data, globalState, configs = null) => { - const config_info = execConfig(configs); - const payment_id = globalState.get("paymentID"); - const profile_id = globalState.get(config_info.profile_id); +Cypress.Commands.add("voidCallTest", (requestBody, data, globalState) => { + const { + Configs: configs = {}, + Request: req_data, + Response: res_data, + } = data || {}; - requestBody.profile_id = profile_id; + const config_info = execConfig(validateConfig(configs)); + const payment_id = globalState.get("paymentID"); + const profile_id = globalState.get(config_info.profile_id); - cy.request({ - method: "POST", - url: `${globalState.get("baseUrl")}/payments/${payment_id}/cancel`, - headers: { - "Content-Type": "application/json", - "api-key": globalState.get("apiKey"), - }, - failOnStatusCode: false, - body: requestBody, - }).then((response) => { - logRequestId(response.headers["x-request-id"]); + requestBody.profile_id = profile_id; - expect(response.headers["content-type"]).to.include("application/json"); - if (response.status === 200) { - for (const key in res_data.body) { - expect(res_data.body[key]).to.equal(response.body[key]); - } - } else { - defaultErrorHandler(response, res_data); + cy.request({ + method: "POST", + url: `${globalState.get("baseUrl")}/payments/${payment_id}/cancel`, + headers: { + "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"); + if (response.status === 200) { + for (const key in res_data.body) { + expect(res_data.body[key]).to.equal(response.body[key]); } - }); - } -); + } else { + defaultErrorHandler(response, res_data); + } + }); +}); Cypress.Commands.add( "retrievePaymentCallTest", (globalState, configs, autoretries = false, attempt = 1) => { - const config_info = execConfig(configs); + const config_info = execConfig(validateConfig(configs)); const payment_id = globalState.get("paymentID"); const merchant_connector_id = globalState.get( config_info.merchant_connector_id @@ -1851,11 +1894,17 @@ Cypress.Commands.add( Cypress.Commands.add( "refundCallTest", - (requestBody, req_data, res_data, refund_amount, globalState, configs) => { + (requestBody, data, refund_amount, globalState) => { + const { + Configs: configs = {}, + Request: req_data, + Response: res_data, + } = data || {}; + const payment_id = globalState.get("paymentID"); // we only need this to set the delay. We don't need the return value - let _ = execConfig(configs); + let _ = execConfig(validateConfig(configs)); requestBody.amount = refund_amount; requestBody.payment_id = payment_id; @@ -1886,44 +1935,51 @@ Cypress.Commands.add( } ); -Cypress.Commands.add( - "syncRefundCallTest", - (req_data, res_data, globalState) => { - const refundId = globalState.get("refundId"); +Cypress.Commands.add("syncRefundCallTest", (data, globalState) => { + const { + Configs: configs = {}, + Request: req_data, + Response: res_data, + } = data || {}; - cy.request({ - method: "GET", - url: `${globalState.get("baseUrl")}/refunds/${refundId}`, - headers: { - "Content-Type": "application/json", - "api-key": globalState.get("apiKey"), - }, - failOnStatusCode: false, - }).then((response) => { - logRequestId(response.headers["x-request-id"]); + const refundId = globalState.get("refundId"); - expect(response.headers["content-type"]).to.include("application/json"); - for (const key in res_data.body) { - expect(res_data.body[key]).to.equal(response.body[key]); - } - }); - } -); + cy.request({ + method: "GET", + url: `${globalState.get("baseUrl")}/refunds/${refundId}`, + headers: { + "Content-Type": "application/json", + "api-key": globalState.get("apiKey"), + }, + failOnStatusCode: false, + }).then((response) => { + logRequestId(response.headers["x-request-id"]); + + expect(response.headers["content-type"]).to.include("application/json"); + for (const key in res_data.body) { + expect(res_data.body[key]).to.equal(response.body[key]); + } + }); +}); Cypress.Commands.add( "citForMandatesCallTest", ( requestBody, - req_data, - res_data, + data, amount, confirm, capture_method, payment_type, - globalState, - configs = null + globalState ) => { - const config_info = execConfig(configs); + const { + Configs: configs = {}, + Request: req_data, + Response: res_data, + } = data || {}; + + const config_info = execConfig(validateConfig(configs)); const profile_id = globalState.get(config_info.profile_id); const merchant_connector_id = globalState.get( config_info.merchant_connector_id @@ -2039,7 +2095,7 @@ Cypress.Commands.add( Cypress.Commands.add( "mitForMandatesCallTest", (requestBody, amount, confirm, capture_method, globalState, configs) => { - const config_info = execConfig(configs); + const config_info = execConfig(validateConfig(configs)); const profile_id = globalState.get(config_info.profile_id); const merchant_connector_id = globalState.get( config_info.merchant_connector_id @@ -2142,7 +2198,7 @@ Cypress.Commands.add( Cypress.Commands.add( "mitUsingPMId", (requestBody, amount, confirm, capture_method, globalState, configs) => { - const config_info = execConfig(configs); + const config_info = execConfig(validateConfig(configs)); const profile_id = globalState.get(config_info.profile_id); requestBody.amount = amount; @@ -2427,14 +2483,13 @@ Cypress.Commands.add("listRefundCallTest", (requestBody, globalState) => { Cypress.Commands.add( "createConfirmPayoutTest", - ( - createConfirmPayoutBody, - req_data, - res_data, - confirm, - auto_fulfill, - globalState - ) => { + (createConfirmPayoutBody, data, confirm, auto_fulfill, globalState) => { + const { + Configs: configs = {}, + Request: req_data, + Response: res_data, + } = data || {}; + for (const key in req_data) { createConfirmPayoutBody[key] = req_data[key]; } @@ -2470,14 +2525,13 @@ Cypress.Commands.add( Cypress.Commands.add( "createConfirmWithTokenPayoutTest", - ( - createConfirmPayoutBody, - req_data, - res_data, - confirm, - auto_fulfill, - globalState - ) => { + (createConfirmPayoutBody, data, confirm, auto_fulfill, globalState) => { + const { + Configs: configs = {}, + Request: req_data, + Response: res_data, + } = data || {}; + for (const key in req_data) { createConfirmPayoutBody[key] = req_data[key]; } @@ -2514,7 +2568,13 @@ Cypress.Commands.add( Cypress.Commands.add( "fulfillPayoutCallTest", - (payoutFulfillBody, req_data, res_data, globalState) => { + (payoutFulfillBody, data, globalState) => { + const { + Configs: configs = {}, + Request: req_data, + Response: res_data, + } = data || {}; + payoutFulfillBody.payout_id = globalState.get("payoutID"); cy.request({ @@ -2717,14 +2777,20 @@ Cypress.Commands.add("ListMcaByMid", (globalState) => { Cypress.Commands.add( "addRoutingConfig", - (routingBody, req_data, res_data, type, data, globalState) => { + (routingBody, data, type, routing_data, globalState) => { + const { + Configs: configs = {}, + Request: req_data, + Response: res_data, + } = data || {}; + for (const key in req_data) { routingBody[key] = req_data[key]; } // set profile id from env routingBody.profile_id = globalState.get("profileId"); routingBody.algorithm.type = type; - routingBody.algorithm.data = data; + routingBody.algorithm.data = routing_data; cy.request({ method: "POST", @@ -2753,63 +2819,69 @@ Cypress.Commands.add( } ); -Cypress.Commands.add( - "activateRoutingConfig", - (req_data, res_data, globalState) => { - let routing_config_id = globalState.get("routingConfigId"); - cy.request({ - method: "POST", - url: `${globalState.get("baseUrl")}/routing/${routing_config_id}/activate`, - headers: { - Authorization: `Bearer ${globalState.get("userInfoToken")}`, - "Content-Type": "application/json", - Cookie: `${globalState.get("cookie")}`, - }, - failOnStatusCode: false, - }).then((response) => { - logRequestId(response.headers["x-request-id"]); - expect(response.headers["content-type"]).to.include("application/json"); +Cypress.Commands.add("activateRoutingConfig", (data, globalState) => { + const { + Configs: configs = {}, + Request: req_data, + Response: res_data, + } = data || {}; - if (response.status === 200) { - expect(response.body.id).to.equal(routing_config_id); - for (const key in res_data.body) { - expect(res_data.body[key]).to.equal(response.body[key]); - } - } else { - defaultErrorHandler(response, res_data); + let routing_config_id = globalState.get("routingConfigId"); + cy.request({ + method: "POST", + url: `${globalState.get("baseUrl")}/routing/${routing_config_id}/activate`, + headers: { + Authorization: `Bearer ${globalState.get("userInfoToken")}`, + "Content-Type": "application/json", + Cookie: `${globalState.get("cookie")}`, + }, + failOnStatusCode: false, + }).then((response) => { + logRequestId(response.headers["x-request-id"]); + expect(response.headers["content-type"]).to.include("application/json"); + + if (response.status === 200) { + expect(response.body.id).to.equal(routing_config_id); + for (const key in res_data.body) { + expect(res_data.body[key]).to.equal(response.body[key]); } - }); - } -); + } else { + defaultErrorHandler(response, res_data); + } + }); +}); -Cypress.Commands.add( - "retrieveRoutingConfig", - (req_data, res_data, globalState) => { - let routing_config_id = globalState.get("routingConfigId"); - cy.request({ - method: "GET", - url: `${globalState.get("baseUrl")}/routing/${routing_config_id}`, - headers: { - Authorization: `Bearer ${globalState.get("userInfoToken")}`, - "Content-Type": "application/json", - Cookie: `${globalState.get("cookie")}`, - }, - failOnStatusCode: false, - }).then((response) => { - logRequestId(response.headers["x-request-id"]); - expect(response.headers["content-type"]).to.include("application/json"); +Cypress.Commands.add("retrieveRoutingConfig", (data, globalState) => { + const { + Configs: configs = {}, + Request: req_data, + Response: res_data, + } = data || {}; - if (response.status === 200) { - expect(response.body.id).to.equal(routing_config_id); - for (const key in res_data.body) { - expect(res_data.body[key]).to.equal(response.body[key]); - } - } else { - defaultErrorHandler(response, res_data); + let routing_config_id = globalState.get("routingConfigId"); + cy.request({ + method: "GET", + url: `${globalState.get("baseUrl")}/routing/${routing_config_id}`, + headers: { + Authorization: `Bearer ${globalState.get("userInfoToken")}`, + "Content-Type": "application/json", + Cookie: `${globalState.get("cookie")}`, + }, + failOnStatusCode: false, + }).then((response) => { + logRequestId(response.headers["x-request-id"]); + expect(response.headers["content-type"]).to.include("application/json"); + + if (response.status === 200) { + expect(response.body.id).to.equal(routing_config_id); + for (const key in res_data.body) { + expect(res_data.body[key]).to.equal(response.body[key]); } - }); - } -); + } else { + defaultErrorHandler(response, res_data); + } + }); +}); Cypress.Commands.add( "updateGsmConfig",