From 64383915bda5693df1cecf6cc5683e8b9aaef99b Mon Sep 17 00:00:00 2001 From: Pa1NarK <69745008+pixincreate@users.noreply.github.com> Date: Tue, 3 Dec 2024 16:18:29 +0530 Subject: [PATCH] feat(cypress): add multiple creds and flags support (#6588) Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> --- .github/workflows/cypress-tests-runner.yml | 61 +- cypress-tests/.gitignore | 1 + cypress-tests/.prettierrc | 9 + cypress-tests/.prettierrc.json | 6 - cypress-tests/cypress.config.js | 14 +- cypress-tests/cypress.env.json | 1 - .../00000-PaymentMethodListTests.cy.js | 105 +- .../e2e/PaymentMethodListUtils/Commons.js | 9 - .../e2e/PaymentMethodListUtils/Stripe.js | 8 - .../e2e/PaymentMethodListUtils/Utils.js | 10 +- .../e2e/PaymentTest/00001-AccountCreate.cy.js | 2 +- .../PaymentTest/00003-ConnectorCreate.cy.js | 28 + .../00004-NoThreeDSAutoCapture.cy.js | 74 +- .../00005-ThreeDSAutoCapture.cy.js | 35 +- .../00006-NoThreeDSManualCapture.cy.js | 235 ++- .../e2e/PaymentTest/00007-VoidPayment.cy.js | 145 +- .../e2e/PaymentTest/00008-SyncPayment.cy.js | 40 +- .../e2e/PaymentTest/00009-RefundPayment.cy.js | 1656 +++++++---------- .../e2e/PaymentTest/00010-SyncRefund.cy.js | 69 +- .../00011-CreateSingleuseMandate.cy.js | 138 +- .../00012-CreateMultiuseMandate.cy.js | 173 +- .../00013-ListAndRevokeMandate.cy.js | 59 +- .../e2e/PaymentTest/00014-SaveCardFlow.cy.js | 494 +++-- .../PaymentTest/00015-ZeroAuthMandate.cy.js | 136 +- .../00016-ThreeDSManualCapture.cy.js | 216 +-- .../e2e/PaymentTest/00017-BankTransfers.cy.js | 33 +- .../e2e/PaymentTest/00018-BankRedirect.cy.js | 152 +- .../PaymentTest/00019-MandatesUsingPMID.cy.js | 309 ++- .../PaymentTest/00020-MandatesUsingNTID.cy.js | 130 +- .../cypress/e2e/PaymentTest/00021-UPI.cy.js | 120 +- .../e2e/PaymentTest/00022-Variations.cy.js | 487 ++--- .../PaymentTest/00023-PaymentMethods.cy.js | 63 +- .../PaymentTest/00024-ConnectorAgnostic.cy.js | 107 +- .../e2e/PaymentTest/00025-ConfigTest.cy.js | 112 +- .../PaymentTest/00026-IncrementalAuth.cy.js | 139 ++ .../cypress/e2e/PaymentUtils/Bluesnap.js | 8 +- .../cypress/e2e/PaymentUtils/Commons.js | 24 +- .../cypress/e2e/PaymentUtils/Cybersource.js | 191 ++ .../cypress/e2e/PaymentUtils/Elavon.js | 1069 +++++------ .../cypress/e2e/PaymentUtils/Fiuu.js | 20 +- .../cypress/e2e/PaymentUtils/Nexixpay.js | 10 - cypress-tests/cypress/e2e/PaymentUtils/Nmi.js | 11 +- .../cypress/e2e/PaymentUtils/Noon.js | 24 - .../cypress/e2e/PaymentUtils/Novalnet.js | 8 - .../cypress/e2e/PaymentUtils/Paybox.js | 113 +- .../cypress/e2e/PaymentUtils/Paypal.js | 8 +- .../cypress/e2e/PaymentUtils/Trustpay.js | 56 +- .../cypress/e2e/PaymentUtils/Utils.js | 60 +- .../cypress/e2e/PaymentUtils/WellsFargo.js | 28 +- .../cypress/e2e/PaymentUtils/WorldPay.js | 104 +- .../e2e/PayoutTest/00003-CardTest.cy.js | 46 +- .../e2e/PayoutTest/00004-BankTransfer.cy.js | 57 +- .../e2e/PayoutTest/00005-SavePayout.cy.js | 121 +- .../cypress/e2e/PayoutUtils/Commons.js | 3 - .../cypress/e2e/PayoutUtils/Utils.js | 44 +- .../RoutingTest/00000-PriorityRouting.cy.js | 95 +- .../00001-VolumeBasedRouting.cy.js | 110 +- .../RoutingTest/00002-RuleBasedRouting.cy.js | 195 +- .../e2e/RoutingTest/00003-Retries.cy.js | 271 +-- .../cypress/e2e/RoutingUtils/Commons.js | 7 - .../cypress/e2e/RoutingUtils/Utils.js | 12 +- .../cypress/fixtures/create-ntid-mit.json | 89 +- cypress-tests/cypress/support/commands.js | 1118 ++++++----- .../cypress/support/redirectionHandler.js | 35 +- cypress-tests/cypress/utils/featureFlags.js | 156 ++ cypress-tests/eslint.config.js | 36 + cypress-tests/package-lock.json | 1052 +++++++++-- cypress-tests/package.json | 16 +- 68 files changed, 5618 insertions(+), 4955 deletions(-) create mode 100644 cypress-tests/.prettierrc delete mode 100644 cypress-tests/.prettierrc.json delete mode 100644 cypress-tests/cypress.env.json create mode 100644 cypress-tests/cypress/e2e/PaymentTest/00026-IncrementalAuth.cy.js create mode 100644 cypress-tests/cypress/utils/featureFlags.js create mode 100644 cypress-tests/eslint.config.js diff --git a/.github/workflows/cypress-tests-runner.yml b/.github/workflows/cypress-tests-runner.yml index 11a38c7c789b..93e8b34eb08c 100644 --- a/.github/workflows/cypress-tests-runner.yml +++ b/.github/workflows/cypress-tests-runner.yml @@ -21,6 +21,65 @@ env: RUST_MIN_STACK: 10485760 jobs: + formatter: + name: Run formatter on Cypress tests and address lints + if: ${{ github.event_name == 'pull_request' }} + runs-on: ubuntu-latest + steps: + - name: Generate a token + if: ${{ github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }} + id: generate_token + uses: actions/create-github-app-token@v1 + with: + app-id: ${{ secrets.HYPERSWITCH_BOT_APP_ID }} + private-key: ${{ secrets.HYPERSWITCH_BOT_APP_PRIVATE_KEY }} + + - name: Checkout repository with token + if: ${{ github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }} + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.ref }} + token: ${{ steps.generate_token.outputs.token }} + + - name: Checkout repository for fork + if: ${{ github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name }} + uses: actions/checkout@v4 + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install Cypress and dependencies + run: | + npm ci --prefix ./cypress-tests + + - name: Check formatting for forked pull requests + if: ${{ github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name }} + shell: bash + run: | + npm run format:check --prefix cypress-tests + npm run lint --prefix cypress-tests + + - name: Check formatting + if: ${{ github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }} + shell: bash + run: | + npm run format --prefix cypress-tests + npm run lint --prefix cypress-tests -- --fix + + if ! git diff --exit-code --quiet -- cypress-tests; then + echo "::notice::Cypress formatting and lint check failed" + + git config --local user.name 'hyperswitch-bot[bot]' + git config --local user.email '148525504+hyperswitch-bot[bot]@users.noreply.github.com' + + git add cypress-tests + git commit --message 'chore(cypress): run formatter and address lints' + git push + fi + runner: name: Run Cypress tests runs-on: ubuntu-latest @@ -68,7 +127,7 @@ jobs: CONNECTOR_AUTH_PASSPHRASE: ${{ secrets.CONNECTOR_AUTH_PASSPHRASE }} CONNECTOR_CREDS_S3_BUCKET_URI: ${{ secrets.CONNECTOR_CREDS_S3_BUCKET_URI}} DESTINATION_FILE_NAME: "creds.json.gpg" - S3_SOURCE_FILE_NAME: "5a3f7679-445e-4621-86c5-39bd8d26b7c5.json.gpg" + S3_SOURCE_FILE_NAME: "c5701d35-aede-4d85-a866-0da4721acf30.json.gpg" shell: bash run: | mkdir -p ".github/secrets" ".github/test" diff --git a/cypress-tests/.gitignore b/cypress-tests/.gitignore index 69b344a1d968..663fbaa3f4df 100644 --- a/cypress-tests/.gitignore +++ b/cypress-tests/.gitignore @@ -1,3 +1,4 @@ +.DS_Store creds.json reports run_all.sh diff --git a/cypress-tests/.prettierrc b/cypress-tests/.prettierrc new file mode 100644 index 000000000000..729684105779 --- /dev/null +++ b/cypress-tests/.prettierrc @@ -0,0 +1,9 @@ +{ + "bracketSpacing": true, + "endOfLine": "auto", + "printWidth": 80, + "semi": true, + "singleQuote": false, + "tabWidth": 2, + "trailingComma": "es5" +} diff --git a/cypress-tests/.prettierrc.json b/cypress-tests/.prettierrc.json deleted file mode 100644 index f0eb61e0f7c6..000000000000 --- a/cypress-tests/.prettierrc.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "trailingComma": "es5", - "tabWidth": 2, - "semi": true, - "singleQuote": false -} diff --git a/cypress-tests/cypress.config.js b/cypress-tests/cypress.config.js index ab71597f7fa7..56f6887761a7 100644 --- a/cypress-tests/cypress.config.js +++ b/cypress-tests/cypress.config.js @@ -1,18 +1,16 @@ -const { defineConfig } = require("cypress"); -const fs = require("fs-extra"); -const path = require("path"); +import { defineConfig } from "cypress"; +import "cypress-mochawesome-reporter/plugin.js"; let globalState; + // Fetch from environment variable const connectorId = process.env.CYPRESS_CONNECTOR || "service"; const screenshotsFolderName = `screenshots/${connectorId}`; const reportName = process.env.REPORT_NAME || `${connectorId}_report`; -module.exports = defineConfig({ +export default defineConfig({ e2e: { - setupNodeEvents(on, config) { - require("cypress-mochawesome-reporter/plugin")(on); - + setupNodeEvents(on) { on("task", { setGlobalState: (val) => { return (globalState = val || {}); @@ -21,7 +19,9 @@ module.exports = defineConfig({ return globalState || {}; }, cli_log: (message) => { + // eslint-disable-next-line no-console console.log("Logging console message from task"); + // eslint-disable-next-line no-console console.log(message); return null; }, diff --git a/cypress-tests/cypress.env.json b/cypress-tests/cypress.env.json deleted file mode 100644 index 0967ef424bce..000000000000 --- a/cypress-tests/cypress.env.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/cypress-tests/cypress/e2e/PaymentMethodListTest/00000-PaymentMethodListTests.cy.js b/cypress-tests/cypress/e2e/PaymentMethodListTest/00000-PaymentMethodListTests.cy.js index af1f16195c60..7005a308cb48 100644 --- a/cypress-tests/cypress/e2e/PaymentMethodListTest/00000-PaymentMethodListTests.cy.js +++ b/cypress-tests/cypress/e2e/PaymentMethodListTest/00000-PaymentMethodListTests.cy.js @@ -67,14 +67,17 @@ 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 data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"]; + + 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 @@ -83,7 +86,7 @@ describe("Payment Method list using Constraint Graph flow tests", () => { // payment method list which should only have ideal with stripe it("payment-method-list-call-test", () => { - let data = + const data = getConnectorDetails("stripe")["pm_list"]["PmListResponse"][ "PmListWithStripeForIdeal" ]; @@ -147,14 +150,17 @@ 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 data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"]; + + 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 @@ -163,7 +169,7 @@ describe("Payment Method list using Constraint Graph flow tests", () => { // payment method list which should only have ideal with stripe it("payment-method-list-call-test", () => { - let data = + const data = getConnectorDetails("stripe")["pm_list"]["PmListResponse"][ "PmListNull" ]; @@ -227,14 +233,17 @@ 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 data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"]; + + 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 @@ -243,7 +252,7 @@ describe("Payment Method list using Constraint Graph flow tests", () => { // payment method list which should only have credit with Stripe and Cybersource it("payment-method-list-call-test", () => { - let data = + const data = getConnectorDetails("stripe")["pm_list"]["PmListResponse"][ "PmListWithCreditTwoConnector" ]; @@ -307,14 +316,17 @@ 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 data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"]; + + 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 @@ -323,7 +335,7 @@ describe("Payment Method list using Constraint Graph flow tests", () => { // payment method list which shouldn't have anything it("payment-method-list-call-test", () => { - let data = + const data = getConnectorDetails("stripe")["pm_list"]["PmListResponse"][ "PmListNull" ]; @@ -389,14 +401,17 @@ 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 data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"]; + + 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 @@ -405,7 +420,7 @@ describe("Payment Method list using Constraint Graph flow tests", () => { // payment method list which should have credit with stripe and cybersource and no ideal it("payment-method-list-call-test", () => { - let data = + const data = getConnectorDetails("stripe")["pm_list"]["PmListResponse"][ "PmListWithCreditTwoConnector" ]; @@ -470,14 +485,17 @@ 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 data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"]; + + 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 @@ -486,7 +504,7 @@ describe("Payment Method list using Constraint Graph flow tests", () => { // payment method list which should have credit with stripe and cybersource and no ideal it("payment-method-list-call-test", () => { - let data = + const data = getConnectorDetails("stripe")["pm_list"]["PmListResponse"][ "PmListWithCreditTwoConnector" ]; @@ -550,14 +568,17 @@ 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 data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"]; + + 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 @@ -566,7 +587,7 @@ describe("Payment Method list using Constraint Graph flow tests", () => { // payment method list which should only have ideal with stripe it("payment-method-list-call-test", () => { - let data = + const data = getConnectorDetails("stripe")["pm_list"]["PmListResponse"][ "PmListWithStripeForIdeal" ]; diff --git a/cypress-tests/cypress/e2e/PaymentMethodListUtils/Commons.js b/cypress-tests/cypress/e2e/PaymentMethodListUtils/Commons.js index a36b4ae1d187..7119a9aabc97 100644 --- a/cypress-tests/cypress/e2e/PaymentMethodListUtils/Commons.js +++ b/cypress-tests/cypress/e2e/PaymentMethodListUtils/Commons.js @@ -1,12 +1,3 @@ -import State from "../../utils/State"; - -const globalState = new State({ - connectorId: Cypress.env("CONNECTOR"), - baseUrl: Cypress.env("BASEURL"), - adminApiKey: Cypress.env("ADMINAPIKEY"), - connectorAuthFilePath: Cypress.env("CONNECTOR_AUTH_FILE_PATH"), -}); - export const card_credit_enabled = [ { payment_method: "card", diff --git a/cypress-tests/cypress/e2e/PaymentMethodListUtils/Stripe.js b/cypress-tests/cypress/e2e/PaymentMethodListUtils/Stripe.js index 32d138fdc1f2..aee9aa0f5361 100644 --- a/cypress-tests/cypress/e2e/PaymentMethodListUtils/Stripe.js +++ b/cypress-tests/cypress/e2e/PaymentMethodListUtils/Stripe.js @@ -1,11 +1,3 @@ -const successfulNo3DSCardDetails = { - card_number: "4242424242424242", - card_exp_month: "10", - card_exp_year: "50", - card_holder_name: "morino", - card_cvc: "737", -}; - export const connectorDetails = { pm_list: { PaymentIntent: { diff --git a/cypress-tests/cypress/e2e/PaymentMethodListUtils/Utils.js b/cypress-tests/cypress/e2e/PaymentMethodListUtils/Utils.js index 9a1d35583c42..f7d199164fd4 100644 --- a/cypress-tests/cypress/e2e/PaymentMethodListUtils/Utils.js +++ b/cypress-tests/cypress/e2e/PaymentMethodListUtils/Utils.js @@ -7,7 +7,7 @@ const connectorDetails = { }; export default function getConnectorDetails(connectorId) { - let x = mergeDetails(connectorId); + const x = mergeDetails(connectorId); return x; } @@ -28,11 +28,11 @@ function getValueByKey(jsonObject, key) { } } -export const should_continue_further = (res_data) => { +export const should_continue_further = (resData) => { 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/PaymentTest/00001-AccountCreate.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00001-AccountCreate.cy.js index 5753421a7458..1788a369faf6 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00001-AccountCreate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00001-AccountCreate.cy.js @@ -1,5 +1,5 @@ -import State from "../../utils/State"; import * as fixtures from "../../fixtures/imports"; +import State from "../../utils/State"; let globalState; describe("Account Create flow test", () => { diff --git a/cypress-tests/cypress/e2e/PaymentTest/00003-ConnectorCreate.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00003-ConnectorCreate.cy.js index 7a8b7b633024..9c9e757598b3 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00003-ConnectorCreate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00003-ConnectorCreate.cy.js @@ -22,4 +22,32 @@ describe("Connector Account Create flow test", () => { globalState ); }); + + it("check and create multiple connectors", () => { + const multiple_connectors = Cypress.env("MULTIPLE_CONNECTORS"); + // multiple_connectors will be undefined if not set in the env + if (multiple_connectors?.status) { + // Create multiple connectors based on the count + // The first connector is already created when creating merchant account, so start from 1 + for (let i = 1; i < multiple_connectors.count; i++) { + cy.createBusinessProfileTest( + fixtures.businessProfile.bpCreate, + globalState, + "profile" + i + ); + cy.createConnectorCallTest( + "payment_processor", + fixtures.createConnectorBody, + payment_methods_enabled, + globalState, + `profile${i}`, + `merchantConnector${i}` + ); + } + } else { + cy.log( + "Multiple connectors not enabled. Skipping creation of multiple profiles and respective MCAs" + ); + } + }); }); diff --git a/cypress-tests/cypress/e2e/PaymentTest/00004-NoThreeDSAutoCapture.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00004-NoThreeDSAutoCapture.cy.js index e8c719cebc74..62f4af2338c3 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00004-NoThreeDSAutoCapture.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00004-NoThreeDSAutoCapture.cy.js @@ -16,30 +16,28 @@ describe("Card - NoThreeDS payment flow test", () => { }); context("Card-NoThreeDS payment flow test Create and confirm", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PaymentIntent" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PaymentIntent"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -47,57 +45,55 @@ describe("Card - NoThreeDS payment flow test", () => { }); it("Confirm No 3DS", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "No3DSAutoCapture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["No3DSAutoCapture"]; + + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["No3DSAutoCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); }); context("Card-NoThreeDS payment flow test Create+Confirm", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("create+confirm-payment-call-test", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "No3DSAutoCapture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["No3DSAutoCapture"]; + 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); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["No3DSAutoCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); }); }); diff --git a/cypress-tests/cypress/e2e/PaymentTest/00005-ThreeDSAutoCapture.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00005-ThreeDSAutoCapture.cy.js index 91dc2b1c382c..3a0b635f79a2 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00005-ThreeDSAutoCapture.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00005-ThreeDSAutoCapture.cy.js @@ -5,10 +5,10 @@ import getConnectorDetails, * as utils from "../PaymentUtils/Utils"; let globalState; describe("Card - ThreeDS payment flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); @@ -24,21 +24,19 @@ describe("Card - ThreeDS payment flow test", () => { }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + const data = getConnectorDetails(globalState.get("connectorId"))["card_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 ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -46,24 +44,17 @@ describe("Card - ThreeDS payment flow test", () => { }); it("Confirm 3DS", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + const data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ "3DSAutoCapture" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("Handle redirection", () => { - let expected_redirection = fixtures.confirmBody["return_url"]; + const expected_redirection = fixtures.confirmBody["return_url"]; cy.handleRedirection(globalState, expected_redirection); }); }); diff --git a/cypress-tests/cypress/e2e/PaymentTest/00006-NoThreeDSManualCapture.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00006-NoThreeDSManualCapture.cy.js index 6a74e6fb910a..d9769daab4b6 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00006-NoThreeDSManualCapture.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00006-NoThreeDSManualCapture.cy.js @@ -17,30 +17,29 @@ describe("Card - NoThreeDS Manual payment flow test", () => { context("Card - NoThreeDS Manual Full Capture payment flow test", () => { context("payment Create and Confirm", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "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", "manual", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -48,104 +47,95 @@ describe("Card - NoThreeDS Manual payment flow test", () => { }); it("confirm-call-test", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["No3DSManualCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["No3DSManualCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["Capture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["Capture"]; + + cy.retrievePaymentCallTest(globalState, data); }); }); context("Payment Create+Confirm", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("create+confirm-payment-call-test", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["No3DSManualCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); + cy.createConfirmPaymentTest( fixtures.createConfirmPaymentBody, - req_data, - res_data, + data, "no_three_ds", "manual", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["No3DSManualCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["Capture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["Capture"]; + + cy.retrievePaymentCallTest(globalState, data); }); }); }); @@ -154,30 +144,29 @@ describe("Card - NoThreeDS Manual payment flow test", () => { "Card - NoThreeDS Manual Partial Capture payment flow test - Create and Confirm", () => { context("payment Create and Payment Confirm", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "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", "manual", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -185,103 +174,95 @@ describe("Card - NoThreeDS Manual payment flow test", () => { }); it("confirm-call-test", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["No3DSManualCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["No3DSManualCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["PartialCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 100, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.captureCallTest(fixtures.captureBody, data, 100, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PartialCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); }); context("payment + Confirm", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("create+confirm-payment-call-test", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["No3DSManualCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); + cy.createConfirmPaymentTest( fixtures.createConfirmPaymentBody, - req_data, - res_data, + data, "no_three_ds", "manual", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["No3DSManualCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["PartialCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 100, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.captureCallTest(fixtures.captureBody, data, 100, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PartialCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); }); } diff --git a/cypress-tests/cypress/e2e/PaymentTest/00007-VoidPayment.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00007-VoidPayment.cy.js index 2b1295fd07cc..0050aa39bfc1 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00007-VoidPayment.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00007-VoidPayment.cy.js @@ -16,30 +16,28 @@ describe("Card - NoThreeDS Manual payment flow test", () => { }); context("Card - void payment in Requires_capture state flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PaymentIntent" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PaymentIntent"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "manual", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -47,63 +45,52 @@ describe("Card - NoThreeDS Manual payment flow test", () => { }); it("confirm-call-test", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "No3DSManualCapture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["No3DSManualCapture"]; + + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("void-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "VoidAfterConfirm" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.voidCallTest(fixtures.voidBody, req_data, res_data, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["VoidAfterConfirm"]; + + cy.voidCallTest(fixtures.voidBody, data, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); }); context( "Card - void payment in Requires_payment_method state flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "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", "manual", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -111,43 +98,41 @@ describe("Card - NoThreeDS Manual payment flow test", () => { }); it("void-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["Void"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.voidCallTest(fixtures.voidBody, req_data, res_data, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.voidCallTest(fixtures.voidBody, data, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); } ); context("Card - void payment in success state flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PaymentIntent" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PaymentIntent"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "manual", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -155,33 +140,23 @@ describe("Card - NoThreeDS Manual payment flow test", () => { }); it("confirm-call-test", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "No3DSManualCapture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - false, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["No3DSManualCapture"]; + + cy.confirmCallTest(fixtures.confirmBody, data, false, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("void-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "VoidAfterConfirm" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.voidCallTest(fixtures.voidBody, req_data, res_data, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["VoidAfterConfirm"]; + + cy.voidCallTest(fixtures.voidBody, data, globalState); + + if (shouldContinue) shouldContinue = 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 95d86a62278a..370d811ed628 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00008-SyncPayment.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00008-SyncPayment.cy.js @@ -5,10 +5,10 @@ import getConnectorDetails, * as utils from "../PaymentUtils/Utils"; let globalState; describe("Card - Sync payment flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); @@ -23,21 +23,19 @@ describe("Card - Sync payment flow test", () => { cy.task("setGlobalState", globalState.data); }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + const data = getConnectorDetails(globalState.get("connectorId"))["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 ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -45,25 +43,19 @@ describe("Card - Sync payment flow test", () => { }); it("confirm-call-test", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + const data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ "No3DSAutoCapture" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + "No3DSAutoCapture" + ]; + cy.retrievePaymentCallTest(globalState, data); }); }); diff --git a/cypress-tests/cypress/e2e/PaymentTest/00009-RefundPayment.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00009-RefundPayment.cy.js index 4eef1ac87371..4d534127ada2 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00009-RefundPayment.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00009-RefundPayment.cy.js @@ -16,30 +16,28 @@ describe("Card - Refund flow - No 3DS", () => { }); context("Card - Full Refund flow test for No-3DS", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PaymentIntent" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PaymentIntent"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -47,82 +45,67 @@ describe("Card - Refund flow - No 3DS", () => { }); it("confirm-call-test", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "No3DSAutoCapture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["No3DSAutoCapture"]; + + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["No3DSAutoCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "Refund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 6500, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["Refund"]; + + cy.refundCallTest(fixtures.refundBody, data, 6500, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "SyncRefund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.syncRefundCallTest(req_data, res_data, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["SyncRefund"]; + + cy.syncRefundCallTest(data, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); }); context("Card - Partial Refund flow test for No-3DS", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PaymentIntent" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PaymentIntent"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -130,134 +113,110 @@ describe("Card - Refund flow - No 3DS", () => { }); it("confirm-call-test", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "No3DSAutoCapture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["No3DSAutoCapture"]; + + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["No3DSAutoCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PartialRefund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 1200, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PartialRefund"]; + + cy.refundCallTest(fixtures.refundBody, data, 1200, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PartialRefund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 1200, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PartialRefund"]; + + cy.refundCallTest(fixtures.refundBody, data, 1200, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "SyncRefund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.syncRefundCallTest(req_data, res_data, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["SyncRefund"]; + + cy.syncRefundCallTest(data, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); }); context( "Fully Refund Card-NoThreeDS payment flow test Create+Confirm", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("create+confirm-payment-call-test", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "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); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["No3DSAutoCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["Refund"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 6500, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.refundCallTest(fixtures.refundBody, data, 6500, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["SyncRefund"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.syncRefundCallTest(req_data, res_data, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.syncRefundCallTest(data, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); } ); @@ -265,109 +224,97 @@ describe("Card - Refund flow - No 3DS", () => { context( "Partially Refund Card-NoThreeDS payment flow test Create+Confirm", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("create+confirm-payment-call-test", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "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); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["No3DSAutoCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["PartialRefund"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 3000, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.refundCallTest(fixtures.refundBody, data, 3000, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["PartialRefund"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 3000, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.refundCallTest(fixtures.refundBody, data, 3000, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["SyncRefund"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.syncRefundCallTest(req_data, res_data, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.syncRefundCallTest(data, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); } ); context("Card - Full Refund for fully captured No-3DS payment", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PaymentIntent" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PaymentIntent"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "manual", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -375,104 +322,85 @@ describe("Card - Refund flow - No 3DS", () => { }); it("confirm-call-test", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "No3DSManualCapture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["No3DSManualCapture"]; + + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["No3DSManualCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "Capture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["Capture"]; + + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["Capture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "manualPaymentRefund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 6500, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["manualPaymentRefund"]; + + cy.refundCallTest(fixtures.refundBody, data, 6500, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "SyncRefund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.syncRefundCallTest(req_data, res_data, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["SyncRefund"]; + + cy.syncRefundCallTest(data, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); }); context("Card - Partial Refund for fully captured No-3DS payment", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PaymentIntent" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PaymentIntent"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "manual", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -480,92 +408,68 @@ describe("Card - Refund flow - No 3DS", () => { }); it("confirm-call-test", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "No3DSManualCapture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["No3DSManualCapture"]; + + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["No3DSManualCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "Capture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["Capture"]; + + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["Capture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "manualPaymentPartialRefund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 3000, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["manualPaymentPartialRefund"]; + + cy.refundCallTest(fixtures.refundBody, data, 3000, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "manualPaymentPartialRefund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 3000, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["manualPaymentPartialRefund"]; + + cy.refundCallTest(fixtures.refundBody, data, 3000, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "SyncRefund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.syncRefundCallTest(req_data, res_data, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["SyncRefund"]; + + cy.syncRefundCallTest(data, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("list-refund-call-test", () => { cy.listRefundCallTest(fixtures.listRefundCall, globalState); @@ -573,30 +477,28 @@ describe("Card - Refund flow - No 3DS", () => { }); context("Card - Full Refund for partially captured No-3DS payment", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PaymentIntent" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PaymentIntent"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "manual", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -604,104 +506,85 @@ describe("Card - Refund flow - No 3DS", () => { }); it("confirm-call-test", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "No3DSManualCapture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["No3DSManualCapture"]; + + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["No3DSManualCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PartialCapture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 100, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PartialCapture"]; + + cy.captureCallTest(fixtures.captureBody, data, 100, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PartialCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "manualPaymentRefund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 100, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["manualPaymentRefund"]; + + cy.refundCallTest(fixtures.refundBody, data, 100, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "SyncRefund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.syncRefundCallTest(req_data, res_data, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["SyncRefund"]; + + cy.syncRefundCallTest(data, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); }); context("Card - partial Refund for partially captured No-3DS payment", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PaymentIntent" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PaymentIntent"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "manual", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -709,121 +592,100 @@ describe("Card - Refund flow - No 3DS", () => { }); it("confirm-call-test", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "No3DSManualCapture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["No3DSManualCapture"]; + + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["No3DSManualCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PartialCapture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 100, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PartialCapture"]; + + cy.captureCallTest(fixtures.captureBody, data, 100, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PartialCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "manualPaymentPartialRefund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 100, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["manualPaymentPartialRefund"]; + + cy.refundCallTest(fixtures.refundBody, data, 100, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "SyncRefund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.syncRefundCallTest(req_data, res_data, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["SyncRefund"]; + + cy.syncRefundCallTest(data, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); }); context( "Card - Full Refund for Create + Confirm Automatic CIT and MIT payment flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("Confirm No 3DS CIT", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MandateMultiUseNo3DSAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + req_data.card); + cy.citForMandatesCallTest( fixtures.citConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", "new_mandate", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("Confirm No 3DS MIT", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MITAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.mitForMandatesCallTest( fixtures.mitConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", @@ -832,15 +694,13 @@ describe("Card - Refund flow - No 3DS", () => { }); it("Confirm No 3DS MIT", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MITAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.mitForMandatesCallTest( fixtures.mitConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", @@ -849,31 +709,25 @@ describe("Card - Refund flow - No 3DS", () => { }); it("refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["Refund"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 7000, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.refundCallTest(fixtures.refundBody, data, 7000, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["SyncRefund"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.syncRefundCallTest(req_data, res_data, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.syncRefundCallTest(data, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); } ); @@ -891,30 +745,28 @@ describe("Card - Refund flow - 3DS", () => { }); context("Card - Full Refund flow test for 3DS", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PaymentIntent" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PaymentIntent"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "three_ds", "automatic", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -922,85 +774,72 @@ describe("Card - Refund flow - 3DS", () => { }); it("Confirm 3DS", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "3DSAutoCapture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["3DSAutoCapture"]; + + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("Handle redirection", () => { - let expected_redirection = fixtures.confirmBody["return_url"]; + const expected_redirection = fixtures.confirmBody["return_url"]; cy.handleRedirection(globalState, expected_redirection); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["3DSAutoCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "Refund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 6500, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["Refund"]; + + cy.refundCallTest(fixtures.refundBody, data, 6500, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "SyncRefund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.syncRefundCallTest(req_data, res_data, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["SyncRefund"]; + + cy.syncRefundCallTest(data, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); }); context("Card - Partial Refund flow test for 3DS", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PaymentIntent" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PaymentIntent"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "three_ds", "automatic", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -1008,253 +847,217 @@ describe("Card - Refund flow - 3DS", () => { }); it("Confirm 3DS", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "3DSAutoCapture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["3DSAutoCapture"]; + + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("Handle redirection", () => { - let expected_redirection = fixtures.confirmBody["return_url"]; + const expected_redirection = fixtures.confirmBody["return_url"]; cy.handleRedirection(globalState, expected_redirection); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["3DSAutoCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PartialRefund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 1200, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PartialRefund"]; + + cy.refundCallTest(fixtures.refundBody, data, 1200, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PartialRefund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 1200, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PartialRefund"]; + + cy.refundCallTest(fixtures.refundBody, data, 1200, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "SyncRefund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.syncRefundCallTest(req_data, res_data, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["SyncRefund"]; + + cy.syncRefundCallTest(data, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); }); context("Fully Refund Card-ThreeDS payment flow test Create+Confirm", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("create+confirm-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "3DSAutoCapture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["3DSAutoCapture"]; + cy.createConfirmPaymentTest( fixtures.createConfirmPaymentBody, - req_data, - res_data, + data, "three_ds", "automatic", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("Handle redirection", () => { - let expected_redirection = fixtures.confirmBody["return_url"]; + const expected_redirection = fixtures.confirmBody["return_url"]; cy.handleRedirection(globalState, expected_redirection); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["3DSAutoCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "Refund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 6500, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["Refund"]; + + cy.refundCallTest(fixtures.refundBody, data, 6500, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "SyncRefund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.syncRefundCallTest(req_data, res_data, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["SyncRefund"]; + + cy.syncRefundCallTest(data, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); }); context( "Partially Refund Card-ThreeDS payment flow test Create+Confirm", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("create+confirm-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["3DSAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createConfirmPaymentTest( fixtures.createConfirmPaymentBody, - req_data, - res_data, + data, "three_ds", "automatic", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("Handle redirection", () => { - let expected_redirection = fixtures.confirmBody["return_url"]; + const expected_redirection = fixtures.confirmBody["return_url"]; cy.handleRedirection(globalState, expected_redirection); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["3DSAutoCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["PartialRefund"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 3000, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.refundCallTest(fixtures.refundBody, data, 3000, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["PartialRefund"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 3000, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.refundCallTest(fixtures.refundBody, data, 3000, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["SyncRefund"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.syncRefundCallTest(req_data, res_data, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.syncRefundCallTest(data, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); } ); context("Card - Full Refund for fully captured 3DS payment", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PaymentIntent" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PaymentIntent"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "three_ds", "manual", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -1262,107 +1065,90 @@ describe("Card - Refund flow - 3DS", () => { }); it("Confirm 3DS", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "3DSManualCapture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["3DSManualCapture"]; + + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("Handle redirection", () => { - let expected_redirection = fixtures.confirmBody["return_url"]; + const expected_redirection = fixtures.confirmBody["return_url"]; cy.handleRedirection(globalState, expected_redirection); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["3DSManualCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "Capture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["Capture"]; + + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["Capture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "manualPaymentRefund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 6500, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["manualPaymentRefund"]; + + cy.refundCallTest(fixtures.refundBody, data, 6500, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "SyncRefund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.syncRefundCallTest(req_data, res_data, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["SyncRefund"]; + + cy.syncRefundCallTest(data, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); }); context("Card - Partial Refund for fully captured 3DS payment", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PaymentIntent" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PaymentIntent"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "three_ds", "manual", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -1370,123 +1156,99 @@ describe("Card - Refund flow - 3DS", () => { }); it("Confirm 3DS", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "3DSManualCapture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["3DSManualCapture"]; + + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("Handle redirection", () => { - let expected_redirection = fixtures.confirmBody["return_url"]; + const expected_redirection = fixtures.confirmBody["return_url"]; cy.handleRedirection(globalState, expected_redirection); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["3DSManualCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "Capture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["Capture"]; + + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["Capture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "manualPaymentPartialRefund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 5000, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["manualPaymentPartialRefund"]; + + cy.refundCallTest(fixtures.refundBody, data, 5000, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "manualPaymentPartialRefund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 1500, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["manualPaymentPartialRefund"]; + + cy.refundCallTest(fixtures.refundBody, data, 1500, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "SyncRefund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.syncRefundCallTest(req_data, res_data, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["SyncRefund"]; + + cy.syncRefundCallTest(data, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); }); context("Card - Full Refund for partially captured 3DS payment", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PaymentIntent" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PaymentIntent"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "three_ds", "manual", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -1494,107 +1256,90 @@ describe("Card - Refund flow - 3DS", () => { }); it("Confirm 3DS", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "3DSManualCapture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["3DSManualCapture"]; + + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("Handle redirection", () => { - let expected_redirection = fixtures.confirmBody["return_url"]; + const expected_redirection = fixtures.confirmBody["return_url"]; cy.handleRedirection(globalState, expected_redirection); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["3DSManualCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PartialCapture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 100, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PartialCapture"]; + + cy.captureCallTest(fixtures.captureBody, data, 100, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PartialCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "manualPaymentRefund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 100, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["manualPaymentRefund"]; + + cy.refundCallTest(fixtures.refundBody, data, 100, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "SyncRefund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.syncRefundCallTest(req_data, res_data, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["SyncRefund"]; + + cy.syncRefundCallTest(data, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); }); context("Card - partial Refund for partially captured 3DS payment", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PaymentIntent" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PaymentIntent"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "three_ds", "manual", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -1602,79 +1347,64 @@ describe("Card - Refund flow - 3DS", () => { }); it("Confirm 3DS", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "3DSManualCapture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["3DSManualCapture"]; + + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("Handle redirection", () => { - let expected_redirection = fixtures.confirmBody["return_url"]; + const expected_redirection = fixtures.confirmBody["return_url"]; cy.handleRedirection(globalState, expected_redirection); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["3DSManualCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PartialCapture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 100, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PartialCapture"]; + + cy.captureCallTest(fixtures.captureBody, data, 100, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PartialCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "manualPaymentRefund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 50, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["manualPaymentRefund"]; + + cy.refundCallTest(fixtures.refundBody, data, 50, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "SyncRefund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.syncRefundCallTest(req_data, res_data, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["SyncRefund"]; + + cy.syncRefundCallTest(data, globalState); + + if (shouldContinue) shouldContinue = 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 617a0e721b94..dc7386211666 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00010-SyncRefund.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00010-SyncRefund.cy.js @@ -5,10 +5,10 @@ import getConnectorDetails, * as utils from "../PaymentUtils/Utils"; let globalState; describe("Card - Sync Refund flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); @@ -24,21 +24,19 @@ describe("Card - Sync Refund flow test", () => { }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + const data = getConnectorDetails(globalState.get("connectorId"))["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 ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -46,53 +44,40 @@ describe("Card - Sync Refund flow test", () => { }); it("confirm-call-test", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + const data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ "No3DSAutoCapture" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + "No3DSAutoCapture" + ]; + + cy.retrievePaymentCallTest(globalState, data); }); it("refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + const data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ "Refund" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 6500, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.refundCallTest(fixtures.refundBody, data, 6500, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("sync-refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + const data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ "SyncRefund" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.syncRefundCallTest(req_data, res_data, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.syncRefundCallTest(data, globalState); + + if (shouldContinue) shouldContinue = 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 bace2a780183..da2123d64623 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00011-CreateSingleuseMandate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00011-CreateSingleuseMandate.cy.js @@ -18,46 +18,41 @@ describe("Card - SingleUse Mandates flow test", () => { context( "Card - NoThreeDS Create + Confirm Automatic CIT and MIT payment flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("Confirm No 3DS CIT", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MandateSingleUseNo3DSAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); + cy.citForMandatesCallTest( fixtures.citConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", "new_mandate", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("Confirm No 3DS MIT", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MITAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.mitForMandatesCallTest( fixtures.mitConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", @@ -70,64 +65,52 @@ describe("Card - SingleUse Mandates flow test", () => { context( "Card - NoThreeDS Create + Confirm Manual CIT and MIT payment flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("Confirm No 3DS CIT", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MandateSingleUseNo3DSManualCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); + cy.citForMandatesCallTest( fixtures.citConfirmBody, - req_data, - res_data, + data, 6500, true, "manual", "new_mandate", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("cit-capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["Capture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("Confirm No 3DS MIT", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MITManualCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.mitForMandatesCallTest( fixtures.mitConfirmBody, - req_data, - res_data, + data, 6500, true, "manual", @@ -136,21 +119,14 @@ describe("Card - SingleUse Mandates flow test", () => { }); it("mit-capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["Capture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("list-mandate-call-test", () => { @@ -162,64 +138,52 @@ describe("Card - SingleUse Mandates flow test", () => { context( "Card - No threeDS Create + Confirm Manual CIT and MIT payment flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("Create No 3DS CIT", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MandateSingleUseNo3DSManualCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); + cy.citForMandatesCallTest( fixtures.citConfirmBody, - req_data, - res_data, + data, 6500, true, "manual", "new_mandate", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("cit-capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["Capture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("Confirm No 3DS MIT", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MITAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.mitForMandatesCallTest( fixtures.mitConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", diff --git a/cypress-tests/cypress/e2e/PaymentTest/00012-CreateMultiuseMandate.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00012-CreateMultiuseMandate.cy.js index 312c74c23c08..000d69c45e68 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00012-CreateMultiuseMandate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00012-CreateMultiuseMandate.cy.js @@ -18,46 +18,41 @@ describe("Card - MultiUse Mandates flow test", () => { context( "Card - NoThreeDS Create + Confirm Automatic CIT and MIT payment flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("Confirm No 3DS CIT", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MandateMultiUseNo3DSAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); + cy.citForMandatesCallTest( fixtures.citConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", "new_mandate", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("Confirm No 3DS MIT", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MITAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.mitForMandatesCallTest( fixtures.mitConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", @@ -65,15 +60,13 @@ describe("Card - MultiUse Mandates flow test", () => { ); }); it("Confirm No 3DS MIT", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MITAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.mitForMandatesCallTest( fixtures.mitConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", @@ -86,64 +79,52 @@ describe("Card - MultiUse Mandates flow test", () => { context( "Card - NoThreeDS Create + Confirm Manual CIT and MIT payment flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("Confirm No 3DS CIT", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MandateMultiUseNo3DSManualCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); + cy.citForMandatesCallTest( fixtures.citConfirmBody, - req_data, - res_data, + data, 6500, true, "manual", "new_mandate", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("cit-capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["Capture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("Confirm No 3DS MIT 1", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MITManualCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.mitForMandatesCallTest( fixtures.mitConfirmBody, - req_data, - res_data, + data, 6500, true, "manual", @@ -152,33 +133,24 @@ describe("Card - MultiUse Mandates flow test", () => { }); it("mit-capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["Capture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("Confirm No 3DS MIT 2", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MITManualCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.mitForMandatesCallTest( fixtures.mitConfirmBody, - req_data, - res_data, + data, 6500, true, "manual", @@ -187,21 +159,14 @@ describe("Card - MultiUse Mandates flow test", () => { }); it("mit-capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["Capture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); } ); @@ -209,64 +174,52 @@ describe("Card - MultiUse Mandates flow test", () => { context( "Card - ThreeDS Create + Confirm Manual CIT and MIT payment flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("Confirm No 3DS CIT", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MandateMultiUseNo3DSManualCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); + cy.citForMandatesCallTest( fixtures.citConfirmBody, - req_data, - res_data, + data, 6500, true, "manual", "new_mandate", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("cit-capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["Capture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("Confirm No 3DS MIT", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MITAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.mitForMandatesCallTest( fixtures.mitConfirmBody, - req_data, - res_data, + data, 6500, true, "automatic", diff --git a/cypress-tests/cypress/e2e/PaymentTest/00013-ListAndRevokeMandate.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00013-ListAndRevokeMandate.cy.js index cad829ba3107..b8d0a51879de 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00013-ListAndRevokeMandate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00013-ListAndRevokeMandate.cy.js @@ -18,46 +18,41 @@ describe("Card - List and revoke Mandates flow test", () => { context( "Card - NoThreeDS Create + Confirm Automatic CIT and MIT payment flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("Confirm No 3DS CIT", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MandateSingleUseNo3DSAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); + cy.citForMandatesCallTest( fixtures.citConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", "new_mandate", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("Confirm No 3DS MIT", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MITAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.mitForMandatesCallTest( fixtures.mitConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", @@ -79,32 +74,30 @@ describe("Card - List and revoke Mandates flow test", () => { } ); context("Card - Zero auth CIT and MIT payment flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("Confirm No 3DS CIT", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "ZeroAuthMandate" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["ZeroAuthMandate"]; + cy.citForMandatesCallTest( fixtures.citConfirmBody, - req_data, - res_data, + data, 0, true, "automatic", "setup_mandate", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("list-mandate-call-test", () => { @@ -112,15 +105,13 @@ describe("Card - List and revoke Mandates flow test", () => { }); it("Confirm No 3DS MIT", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "MITAutoCapture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["MITAutoCapture"]; + cy.mitForMandatesCallTest( fixtures.mitConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", diff --git a/cypress-tests/cypress/e2e/PaymentTest/00014-SaveCardFlow.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00014-SaveCardFlow.cy.js index ae8e276c8d4c..bab24076f550 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00014-SaveCardFlow.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00014-SaveCardFlow.cy.js @@ -19,11 +19,11 @@ describe("Card - SaveCard payment flow test", () => { context( "Save card for NoThreeDS automatic capture payment- Create+Confirm [on_session]", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { saveCardBody = Cypress._.cloneDeep(fixtures.saveCardConfirmBody); - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); @@ -33,26 +33,29 @@ describe("Card - SaveCard payment flow test", () => { }); it("create+confirm-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["SaveCardUseNo3DSAutoCapture"]; - 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); + + if (shouldContinue) { + shouldContinue = utils.should_continue_further(data); } }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["SaveCardUseNo3DSAutoCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("retrieve-customerPM-call-test", () => { @@ -60,37 +63,31 @@ describe("Card - SaveCard payment flow test", () => { }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "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 ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("confirm-save-card-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["SaveCardUseNo3DSAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.saveCardConfirmCallTest( - saveCardBody, - req_data, - res_data, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.saveCardConfirmCallTest(saveCardBody, data, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); } ); @@ -98,11 +95,11 @@ describe("Card - SaveCard payment flow test", () => { context( "Save card for NoThreeDS manual full capture payment- Create+Confirm [on_session]", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { saveCardBody = Cypress._.cloneDeep(fixtures.saveCardConfirmBody); - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); @@ -112,25 +109,28 @@ describe("Card - SaveCard payment flow test", () => { }); it("create+confirm-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["SaveCardUseNo3DSAutoCapture"]; - 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); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["SaveCardUseNo3DSAutoCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("retrieve-customerPM-call-test", () => { @@ -138,58 +138,50 @@ describe("Card - SaveCard payment flow test", () => { }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "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", "manual", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("confirm-save-card-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["SaveCardUseNo3DSManualCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.saveCardConfirmCallTest( - saveCardBody, - req_data, - res_data, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.saveCardConfirmCallTest(saveCardBody, data, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["SaveCardUseNo3DSManualCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["Capture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); } ); @@ -197,11 +189,11 @@ describe("Card - SaveCard payment flow test", () => { context( "Save card for NoThreeDS manual partial capture payment- Create + Confirm [on_session]", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { saveCardBody = Cypress._.cloneDeep(fixtures.saveCardConfirmBody); - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); @@ -211,25 +203,28 @@ describe("Card - SaveCard payment flow test", () => { }); it("create+confirm-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["SaveCardUseNo3DSAutoCapture"]; - 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); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["SaveCardUseNo3DSAutoCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("retrieve-customerPM-call-test", () => { @@ -237,57 +232,49 @@ describe("Card - SaveCard payment flow test", () => { }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "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", "manual", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("confirm-save-card-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["SaveCardUseNo3DSManualCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.saveCardConfirmCallTest( - saveCardBody, - req_data, - res_data, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.saveCardConfirmCallTest(saveCardBody, data, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["SaveCardUseNo3DSManualCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["PartialCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 100, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.captureCallTest(fixtures.captureBody, data, 100, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); } ); @@ -295,11 +282,11 @@ describe("Card - SaveCard payment flow test", () => { context( "Save card for NoThreeDS automatic capture payment [off_session]", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { saveCardBody = Cypress._.cloneDeep(fixtures.saveCardConfirmBody); - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); @@ -309,25 +296,28 @@ describe("Card - SaveCard payment flow test", () => { }); it("create+confirm-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["SaveCardUseNo3DSAutoCaptureOffSession"]; - 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); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["SaveCardUseNo3DSAutoCaptureOffSession"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("retrieve-customerPM-call-test", () => { @@ -335,38 +325,31 @@ describe("Card - SaveCard payment flow test", () => { }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["PaymentIntentOffSession"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("confirm-save-card-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["SaveCardConfirmAutoCaptureOffSession"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.saveCardConfirmCallTest( - saveCardBody, - req_data, - res_data, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + cy.saveCardConfirmCallTest(saveCardBody, data, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); } ); @@ -374,10 +357,10 @@ describe("Card - SaveCard payment flow test", () => { context( "Save card for NoThreeDS manual capture payment- Create+Confirm [off_session]", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } saveCardBody = Cypress._.cloneDeep(fixtures.saveCardConfirmBody); @@ -388,41 +371,38 @@ describe("Card - SaveCard payment flow test", () => { }); it("create+confirm-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["SaveCardUseNo3DSManualCaptureOffSession"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createConfirmPaymentTest( fixtures.createConfirmPaymentBody, - req_data, - res_data, + data, "no_three_ds", "manual", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["SaveCardUseNo3DSManualCaptureOffSession"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["Capture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("retrieve-customerPM-call-test", () => { @@ -430,62 +410,58 @@ describe("Card - SaveCard payment flow test", () => { }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["PaymentIntentOffSession"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "manual", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("confirm-save-card-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["SaveCardConfirmManualCaptureOffSession"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.saveCardConfirmCallTest( - saveCardBody, - req_data, - res_data, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.saveCardConfirmCallTest(saveCardBody, data, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["SaveCardConfirmManualCaptureOffSession"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["Capture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["Capture"]; + + cy.retrievePaymentCallTest(globalState, data); }); } ); @@ -493,11 +469,11 @@ describe("Card - SaveCard payment flow test", () => { context( "Save card for NoThreeDS automatic capture payment - create and confirm [off_session]", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { saveCardBody = Cypress._.cloneDeep(fixtures.saveCardConfirmBody); - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); @@ -507,42 +483,39 @@ describe("Card - SaveCard payment flow test", () => { }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["PaymentIntentOffSession"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("confirm-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["SaveCardUseNo3DSAutoCaptureOffSession"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["SaveCardUseNo3DSAutoCaptureOffSession"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("retrieve-customerPM-call-test", () => { @@ -550,49 +523,42 @@ describe("Card - SaveCard payment flow test", () => { }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["PaymentIntentOffSession"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("confirm-save-card-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["SaveCardConfirmAutoCaptureOffSession"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.saveCardConfirmCallTest( - saveCardBody, - req_data, - res_data, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + cy.saveCardConfirmCallTest(saveCardBody, data, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); } ); context( "Use billing address from payment method during subsequent payment[off_session]", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { saveCardBody = Cypress._.cloneDeep(fixtures.saveCardConfirmBody); - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); @@ -602,38 +568,31 @@ describe("Card - SaveCard payment flow test", () => { }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["PaymentIntentOffSession"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("confirm-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["SaveCardUseNo3DSAutoCaptureOffSession"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("retrieve-customerPM-call-test", () => { @@ -641,38 +600,31 @@ describe("Card - SaveCard payment flow test", () => { }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["PaymentIntentOffSession"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("confirm-save-card-payment-call-test-without-billing", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["SaveCardConfirmAutoCaptureOffSessionWithoutBilling"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.saveCardConfirmCallTest( - saveCardBody, - req_data, - res_data, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + cy.saveCardConfirmCallTest(saveCardBody, data, globalState); + + if (shouldContinue) + shouldContinue = 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 15e7597286a3..0cc1be503189 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00015-ZeroAuthMandate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00015-ZeroAuthMandate.cy.js @@ -18,44 +18,41 @@ describe("Card - SingleUse Mandates flow test", () => { context( "Card - NoThreeDS Create + Confirm Automatic CIT and Single use MIT payment flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("Confirm No 3DS CIT", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["ZeroAuthMandate"]; - 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 ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("Confirm No 3DS MIT", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MITAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.mitForMandatesCallTest( fixtures.mitConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", @@ -67,44 +64,41 @@ describe("Card - SingleUse Mandates flow test", () => { context( "Card - NoThreeDS Create + Confirm Automatic CIT and Multi use MIT payment flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("Confirm No 3DS CIT", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["ZeroAuthMandate"]; - 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 ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("Confirm No 3DS MIT", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MITAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.mitForMandatesCallTest( fixtures.mitConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", @@ -112,15 +106,13 @@ describe("Card - SingleUse Mandates flow test", () => { ); }); it("Confirm No 3DS MIT", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MITAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.mitForMandatesCallTest( fixtures.mitConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", @@ -131,51 +123,46 @@ describe("Card - SingleUse Mandates flow test", () => { ); context("Card - Zero Auth Payment", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("Create No 3DS Payment Intent", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "ZeroAuthPaymentIntent" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["ZeroAuthPaymentIntent"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("Confirm No 3DS payment", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "ZeroAuthConfirmPayment" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["ZeroAuthConfirmPayment"]; + + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("Retrieve Payment Call Test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["ZeroAuthConfirmPayment"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("Retrieve CustomerPM Call Test", () => { @@ -183,38 +170,33 @@ describe("Card - SingleUse Mandates flow test", () => { }); it("Create Recurring Payment Intent", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PaymentIntentOffSession" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PaymentIntentOffSession"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("Confirm Recurring Payment", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "SaveCardConfirmAutoCaptureOffSession" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["SaveCardConfirmAutoCaptureOffSession"]; cy.saveCardConfirmCallTest( fixtures.saveCardConfirmBody, - req_data, - res_data, + data, globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) shouldContinue = 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 3d236af7a910..0426d17013ce 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00016-ThreeDSManualCapture.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00016-ThreeDSManualCapture.cy.js @@ -6,14 +6,6 @@ import getConnectorDetails, * as utils from "../PaymentUtils/Utils"; let globalState; describe("Card - ThreeDS Manual payment flow test", () => { - let should_continue = true; - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - before("seed global state", () => { cy.task("getGlobalState").then((state) => { globalState = new State(state); @@ -26,30 +18,29 @@ describe("Card - ThreeDS Manual payment flow test", () => { context("Card - ThreeDS Manual Full Capture payment flow test", () => { context("payment Create and Confirm", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["PaymentIntent"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "three_ds", "manual", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -57,97 +48,106 @@ describe("Card - ThreeDS Manual payment flow test", () => { }); it("confirm-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["3DSManualCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("Handle redirection", () => { - let expected_redirection = fixtures.confirmBody["return_url"]; + const expected_redirection = fixtures.confirmBody["return_url"]; cy.handleRedirection(globalState, expected_redirection); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["3DSManualCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["Capture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.captureCallTest(captureBody, data, 6500, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["Capture"]; + + cy.retrievePaymentCallTest(globalState, data); }); }); context("Payment Create+Confirm", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("create+confirm-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["3DSManualCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createConfirmPaymentTest( fixtures.createConfirmPaymentBody, - req_data, - res_data, + data, "three_ds", "manual", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("Handle redirection", () => { - let expected_redirection = + const expected_redirection = fixtures.createConfirmPaymentBody["return_url"]; cy.handleRedirection(globalState, expected_redirection); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["3DSManualCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["Capture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.captureCallTest(captureBody, data, 6500, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["Capture"]; + + cy.retrievePaymentCallTest(globalState, data); }); }); }); @@ -156,30 +156,29 @@ describe("Card - ThreeDS Manual payment flow test", () => { "Card - ThreeDS Manual Partial Capture payment flow test - Create and Confirm", () => { context("payment Create and Payment Confirm", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["PaymentIntent"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "three_ds", "manual", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -187,97 +186,106 @@ describe("Card - ThreeDS Manual payment flow test", () => { }); it("confirm-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["3DSManualCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("Handle redirection", () => { - let expected_redirection = fixtures.confirmBody["return_url"]; + const expected_redirection = fixtures.confirmBody["return_url"]; cy.handleRedirection(globalState, expected_redirection); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["3DSManualCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["PartialCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.captureCallTest(captureBody, req_data, res_data, 100, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.captureCallTest(captureBody, data, 100, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PartialCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); }); context("payment + Confirm", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("create+confirm-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["3DSManualCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createConfirmPaymentTest( fixtures.createConfirmPaymentBody, - req_data, - res_data, + data, "three_ds", "manual", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("Handle redirection", () => { - let expected_redirection = + const expected_redirection = fixtures.createConfirmPaymentBody["return_url"]; cy.handleRedirection(globalState, expected_redirection); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["3DSManualCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["PartialCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.captureCallTest(captureBody, req_data, res_data, 100, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.captureCallTest(captureBody, data, 100, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PartialCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); }); } diff --git a/cypress-tests/cypress/e2e/PaymentTest/00017-BankTransfers.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00017-BankTransfers.cy.js index ee83f1aa4485..913dd91ea8be 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00017-BankTransfers.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00017-BankTransfers.cy.js @@ -16,30 +16,28 @@ describe("Bank Transfers", () => { }); context("Bank transfer - Pix forward flow", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "bank_transfer_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 ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -47,25 +45,24 @@ describe("Bank Transfers", () => { }); it("Confirm bank transfer", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "bank_transfer_pm" ]["Pix"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.confirmBankTransferCallTest( fixtures.confirmBody, - req_data, - res_data, + data, true, globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("Handle bank transfer redirection", () => { - let expected_redirection = fixtures.confirmBody["return_url"]; - let payment_method_type = globalState.get("paymentMethodType"); + const expected_redirection = fixtures.confirmBody["return_url"]; + const payment_method_type = globalState.get("paymentMethodType"); + cy.handleBankTransferRedirection( globalState, payment_method_type, diff --git a/cypress-tests/cypress/e2e/PaymentTest/00018-BankRedirect.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00018-BankRedirect.cy.js index f3c81c16ab2d..cc3b8dbaec76 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00018-BankRedirect.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00018-BankRedirect.cy.js @@ -10,7 +10,7 @@ describe("Bank Redirect tests", () => { }); context("Blik Create and Confirm flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails before("seed global state", () => { cy.task("getGlobalState").then((state) => { @@ -19,27 +19,24 @@ describe("Bank Redirect tests", () => { }); beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "bank_redirect_pm" ]["BlikPaymentIntent"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "three_ds", "automatic", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -47,25 +44,23 @@ describe("Bank Redirect tests", () => { }); it("Confirm bank redirect", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "bank_redirect_pm" ]["Blik"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.confirmBankRedirectCallTest( fixtures.confirmBody, - req_data, - res_data, + data, true, globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); }); context("EPS Create and Confirm flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails before("seed global state", () => { cy.task("getGlobalState").then((state) => { @@ -74,27 +69,24 @@ describe("Bank Redirect tests", () => { }); beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "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 ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -102,26 +94,25 @@ describe("Bank Redirect tests", () => { }); it("Confirm bank redirect", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "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 ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("Handle bank redirect redirection", () => { // return_url is a static url (https://hyperswitch.io) taken from confirm-body fixture and is not updated - let expected_redirection = fixtures.confirmBody["return_url"]; - let payment_method_type = globalState.get("paymentMethodType"); + const expected_redirection = fixtures.confirmBody["return_url"]; + const payment_method_type = globalState.get("paymentMethodType"); + cy.handleBankRedirectRedirection( globalState, payment_method_type, @@ -131,7 +122,7 @@ describe("Bank Redirect tests", () => { }); context("iDEAL Create and Confirm flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails before("seed global state", () => { cy.task("getGlobalState").then((state) => { @@ -140,27 +131,24 @@ describe("Bank Redirect tests", () => { }); beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "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 ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -168,26 +156,24 @@ describe("Bank Redirect tests", () => { }); it("Confirm bank redirect", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "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 ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("Handle bank redirect redirection", () => { // return_url is a static url (https://hyperswitch.io) taken from confirm-body fixture and is not updated - let expected_redirection = fixtures.confirmBody["return_url"]; - let payment_method_type = globalState.get("paymentMethodType"); + const expected_redirection = fixtures.confirmBody["return_url"]; + const payment_method_type = globalState.get("paymentMethodType"); cy.handleBankRedirectRedirection( globalState, payment_method_type, @@ -197,7 +183,7 @@ describe("Bank Redirect tests", () => { }); context("Sofort Create and Confirm flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails before("seed global state", () => { cy.task("getGlobalState").then((state) => { @@ -206,26 +192,23 @@ describe("Bank Redirect tests", () => { }); beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "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 ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -233,26 +216,24 @@ describe("Bank Redirect tests", () => { }); it("Confirm bank redirect", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "bank_redirect_pm" ]["Sofort"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.confirmBankRedirectCallTest( fixtures.confirmBody, - req_data, - res_data, + data, true, globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("Handle bank redirect redirection", () => { // return_url is a static url (https://hyperswitch.io) taken from confirm-body fixture and is not updated - let expected_redirection = fixtures.confirmBody["return_url"]; - let payment_method_type = globalState.get("paymentMethodType"); + const expected_redirection = fixtures.confirmBody["return_url"]; + const payment_method_type = globalState.get("paymentMethodType"); cy.handleBankRedirectRedirection( globalState, payment_method_type, @@ -262,7 +243,7 @@ describe("Bank Redirect tests", () => { }); context("Przelewy24 Create and Confirm flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails before("seed global state", () => { cy.task("getGlobalState").then((state) => { @@ -271,26 +252,23 @@ describe("Bank Redirect tests", () => { }); beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "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 ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -298,25 +276,23 @@ describe("Bank Redirect tests", () => { }); it("Confirm bank redirect", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "bank_redirect_pm" ]["Przelewy24"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.confirmBankRedirectCallTest( fixtures.confirmBody, - req_data, - res_data, + data, true, globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("Handle bank redirect redirection", () => { - let expected_redirection = fixtures.confirmBody["return_url"]; - let payment_method_type = globalState.get("paymentMethodType"); + const expected_redirection = fixtures.confirmBody["return_url"]; + const payment_method_type = globalState.get("paymentMethodType"); cy.handleBankRedirectRedirection( globalState, payment_method_type, diff --git a/cypress-tests/cypress/e2e/PaymentTest/00019-MandatesUsingPMID.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00019-MandatesUsingPMID.cy.js index 401f662c67e2..1a2dff1b5da3 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00019-MandatesUsingPMID.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00019-MandatesUsingPMID.cy.js @@ -18,64 +18,58 @@ describe("Card - Mandates using Payment Method Id flow test", () => { context( "Card - NoThreeDS Create and Confirm Automatic CIT and MIT payment flow test", () => { - let should_continue = true; + let shouldContinue = true; beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("Create No 3DS Payment Intent", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "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 ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("Confirm No 3DS CIT", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["PaymentMethodIdMandateNo3DSAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); + cy.citForMandatesCallTest( fixtures.citConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", "new_mandate", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("Confirm No 3DS MIT", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MITAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.mitUsingPMId( fixtures.pmIdConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", @@ -88,82 +82,69 @@ describe("Card - Mandates using Payment Method Id flow test", () => { context( "Card - NoThreeDS Create and Confirm Manual CIT and MIT payment flow test", () => { - let should_continue = true; + let shouldContinue = true; beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("Create No 3DS Payment Intent", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "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", "manual", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("Confirm No 3DS CIT", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["PaymentMethodIdMandateNo3DSManualCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); + cy.citForMandatesCallTest( fixtures.citConfirmBody, - req_data, - res_data, + data, 6500, true, "manual", "new_mandate", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("cit-capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["Capture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("Confirm No 3DS MIT", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MITAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.mitUsingPMId( fixtures.pmIdConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", @@ -176,46 +157,41 @@ describe("Card - Mandates using Payment Method Id flow test", () => { context( "Card - NoThreeDS Create + Confirm Automatic CIT and MIT payment flow test", () => { - let should_continue = true; + let shouldContinue = true; beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("Confirm No 3DS CIT", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["PaymentMethodIdMandateNo3DSAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); + cy.citForMandatesCallTest( fixtures.citConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", "new_mandate", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("Confirm No 3DS MIT", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MITAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.mitUsingPMId( fixtures.pmIdConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", @@ -223,15 +199,13 @@ describe("Card - Mandates using Payment Method Id flow test", () => { ); }); it("Confirm No 3DS MIT", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MITAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.mitUsingPMId( fixtures.pmIdConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", @@ -244,64 +218,52 @@ describe("Card - Mandates using Payment Method Id flow test", () => { context( "Card - NoThreeDS Create + Confirm Manual CIT and MIT payment flow test", () => { - let should_continue = true; + let shouldContinue = true; beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("Confirm No 3DS CIT", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["PaymentMethodIdMandateNo3DSManualCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); + cy.citForMandatesCallTest( fixtures.citConfirmBody, - req_data, - res_data, + data, 6500, true, "manual", "new_mandate", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("cit-capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["Capture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("Confirm No 3DS MIT 1", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MITManualCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.mitUsingPMId( fixtures.pmIdConfirmBody, - req_data, - res_data, + data, 6500, true, "manual", @@ -310,33 +272,24 @@ describe("Card - Mandates using Payment Method Id flow test", () => { }); it("mit-capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["Capture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("Confirm No 3DS MIT 2", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MITManualCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.mitUsingPMId( fixtures.pmIdConfirmBody, - req_data, - res_data, + data, 6500, true, "manual", @@ -345,21 +298,14 @@ describe("Card - Mandates using Payment Method Id flow test", () => { }); it("mit-capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["Capture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); } ); @@ -367,51 +313,46 @@ describe("Card - Mandates using Payment Method Id flow test", () => { context( "Card - ThreeDS Create + Confirm Automatic CIT and MIT payment flow test", () => { - let should_continue = true; + let shouldContinue = true; beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("Confirm 3DS CIT", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["PaymentMethodIdMandate3DSAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); + cy.citForMandatesCallTest( fixtures.citConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", "new_mandate", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("Handle redirection", () => { - let expected_redirection = fixtures.citConfirmBody["return_url"]; + const expected_redirection = fixtures.citConfirmBody["return_url"]; cy.handleRedirection(globalState, expected_redirection); }); it("Confirm No 3DS MIT", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MITAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.mitUsingPMId( fixtures.pmIdConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", @@ -419,15 +360,13 @@ describe("Card - Mandates using Payment Method Id flow test", () => { ); }); it("Confirm No 3DS MIT", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MITAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.mitUsingPMId( fixtures.pmIdConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", @@ -440,69 +379,57 @@ describe("Card - Mandates using Payment Method Id flow test", () => { context( "Card - ThreeDS Create + Confirm Manual CIT and MIT payment flow", () => { - let should_continue = true; + let shouldContinue = true; beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("Confirm 3DS CIT", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["PaymentMethodIdMandate3DSManualCapture"]; - 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 ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("Handle redirection", () => { - let expected_redirection = fixtures.citConfirmBody["return_url"]; + const expected_redirection = fixtures.citConfirmBody["return_url"]; cy.handleRedirection(globalState, expected_redirection); }); it("cit-capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["Capture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("Confirm No 3DS MIT", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MITAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.mitUsingPMId( fixtures.pmIdConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", diff --git a/cypress-tests/cypress/e2e/PaymentTest/00020-MandatesUsingNTID.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00020-MandatesUsingNTID.cy.js index dcccfd390bf1..e3080d39878e 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00020-MandatesUsingNTID.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00020-MandatesUsingNTID.cy.js @@ -20,24 +20,20 @@ describe("Card - Mandates using Network Transaction Id flow test", () => { context( "Card - NoThreeDS Create and Confirm Automatic MIT payment flow test", () => { - let should_continue = true; - beforeEach(function () { - if (!should_continue || connector !== "cybersource") { + if (connector !== "cybersource") { this.skip(); } }); it("Confirm No 3DS MIT", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MITAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.mitUsingNTID( fixtures.ntidConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", @@ -50,24 +46,20 @@ describe("Card - Mandates using Network Transaction Id flow test", () => { context( "Card - NoThreeDS Create and Confirm Manual MIT payment flow test", () => { - let should_continue = true; - beforeEach(function () { - if (!should_continue || connector !== "cybersource") { + if (connector !== "cybersource") { this.skip(); } }); it("Confirm No 3DS MIT", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MITManualCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.mitUsingNTID( fixtures.ntidConfirmBody, - req_data, - res_data, + data, 7000, true, "manual", @@ -80,24 +72,20 @@ describe("Card - Mandates using Network Transaction Id flow test", () => { context( "Card - NoThreeDS Create and Confirm Automatic multiple MITs payment flow test", () => { - let should_continue = true; - beforeEach(function () { - if (!should_continue || connector !== "cybersource") { + if (connector !== "cybersource") { this.skip(); } }); it("Confirm No 3DS MIT", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MITAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.mitUsingNTID( fixtures.ntidConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", @@ -105,15 +93,13 @@ describe("Card - Mandates using Network Transaction Id flow test", () => { ); }); it("Confirm No 3DS MIT", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MITAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.mitUsingNTID( fixtures.ntidConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", @@ -126,24 +112,22 @@ describe("Card - Mandates using Network Transaction Id flow test", () => { context( "Card - NoThreeDS Create and Confirm Manual multiple MITs payment flow test", () => { - let should_continue = true; + let shouldContinue = true; beforeEach(function () { - if (!should_continue || connector !== "cybersource") { + if (connector !== "cybersource") { this.skip(); } }); it("Confirm No 3DS MIT 1", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MITManualCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.mitUsingNTID( fixtures.ntidConfirmBody, - req_data, - res_data, + data, 6500, true, "manual", @@ -152,33 +136,24 @@ describe("Card - Mandates using Network Transaction Id flow test", () => { }); it("mit-capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["Capture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("Confirm No 3DS MIT 2", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MITManualCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.mitUsingNTID( fixtures.ntidConfirmBody, - req_data, - res_data, + data, 6500, true, "manual", @@ -187,21 +162,14 @@ describe("Card - Mandates using Network Transaction Id flow test", () => { }); it("mit-capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["Capture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); } ); @@ -209,24 +177,20 @@ describe("Card - Mandates using Network Transaction Id flow test", () => { context( "Card - ThreeDS Create and Confirm Automatic multiple MITs payment flow test", () => { - let should_continue = true; - beforeEach(function () { - if (!should_continue || connector !== "cybersource") { + if (connector !== "cybersource") { this.skip(); } }); it("Confirm No 3DS MIT", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MITAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.mitUsingNTID( fixtures.ntidConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", @@ -234,15 +198,13 @@ describe("Card - Mandates using Network Transaction Id flow test", () => { ); }); it("Confirm No 3DS MIT", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MITAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.mitUsingNTID( fixtures.ntidConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", @@ -255,24 +217,20 @@ describe("Card - Mandates using Network Transaction Id flow test", () => { context( "Card - ThreeDS Create and Confirm Manual multiple MITs payment flow", () => { - let should_continue = true; - beforeEach(function () { - if (!should_continue || connector !== "cybersource") { + if (connector !== "cybersource") { this.skip(); } }); it("Confirm No 3DS MIT", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MITAutoCapture"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.mitUsingNTID( fixtures.ntidConfirmBody, - req_data, - res_data, + data, 7000, true, "automatic", diff --git a/cypress-tests/cypress/e2e/PaymentTest/00021-UPI.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00021-UPI.cy.js index 72c99d2d19d1..e7a06c622489 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00021-UPI.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00021-UPI.cy.js @@ -5,7 +5,7 @@ import getConnectorDetails, * as utils from "../PaymentUtils/Utils"; let globalState; describe("UPI Payments - Hyperswitch", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails context("[Payment] [UPI - UPI Collect] Create & Confirm + Refund", () => { before("seed global state", () => { @@ -19,29 +19,25 @@ describe("UPI Payments - Hyperswitch", () => { }); beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("Create payment intent", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["upi_pm"][ - "PaymentIntent" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "upi_pm" + ]["PaymentIntent"]; cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "three_ds", "automatic", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("List Merchant payment methods", () => { @@ -49,27 +45,19 @@ describe("UPI Payments - Hyperswitch", () => { }); it("Confirm payment", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["upi_pm"][ - "UpiCollect" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.confirmUpiCall( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "upi_pm" + ]["UpiCollect"]; - if (should_continue) - should_continue = utils.should_continue_further(res_data); + cy.confirmUpiCall(fixtures.confirmBody, data, true, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("Handle UPI Redirection", () => { - let expected_redirection = fixtures.confirmBody["return_url"]; - let payment_method_type = globalState.get("paymentMethodType"); + const expected_redirection = fixtures.confirmBody["return_url"]; + const payment_method_type = globalState.get("paymentMethodType"); + cy.handleUpiRedirection( globalState, payment_method_type, @@ -78,31 +66,27 @@ describe("UPI Payments - Hyperswitch", () => { }); it("Retrieve payment", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "upi_pm" + ]["UpiCollect"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("Refund payment", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["upi_pm"][ - "Refund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 6500, - globalState - ); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "upi_pm" + ]["Refund"]; - if (should_continue) - should_continue = utils.should_continue_further(res_data); + cy.refundCallTest(fixtures.refundBody, data, 6500, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); }); // Skipping UPI Intent intentionally as connector is throwing 5xx during redirection context.skip("[Payment] [UPI - UPI Intent] Create & Confirm", () => { - should_continue = true; // variable that will be used to skip tests if a previous test fails + shouldContinue = true; // variable that will be used to skip tests if a previous test fails before("seed global state", () => { cy.task("getGlobalState").then((state) => { @@ -115,29 +99,25 @@ describe("UPI Payments - Hyperswitch", () => { }); beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("Create payment intent", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["upi_pm"][ - "PaymentIntent" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "upi_pm" + ]["PaymentIntent"]; cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "three_ds", "automatic", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("List Merchant payment methods", () => { @@ -145,27 +125,19 @@ describe("UPI Payments - Hyperswitch", () => { }); it("Confirm payment", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["upi_pm"][ - "UpiIntent" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.confirmUpiCall( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "upi_pm" + ]["UpiIntent"]; - if (should_continue) - should_continue = utils.should_continue_further(res_data); + cy.confirmUpiCall(fixtures.confirmBody, data, true, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("Handle UPI Redirection", () => { - let expected_redirection = fixtures.confirmBody["return_url"]; - let payment_method_type = globalState.get("paymentMethodType"); + const expected_redirection = fixtures.confirmBody["return_url"]; + const payment_method_type = globalState.get("paymentMethodType"); + cy.handleUpiRedirection( globalState, payment_method_type, @@ -174,7 +146,11 @@ describe("UPI Payments - Hyperswitch", () => { }); it("Retrieve payment", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "upi_pm" + ]["UpiIntent"]; + + cy.retrievePaymentCallTest(globalState, data); }); }); }); diff --git a/cypress-tests/cypress/e2e/PaymentTest/00022-Variations.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00022-Variations.cy.js index 035b7da97abc..b3c220bc178b 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00022-Variations.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00022-Variations.cy.js @@ -27,16 +27,13 @@ describe("Corner cases", () => { }); it("[Payment] Invalid card number", () => { - let data = getConnectorDetails(globalState.get("commons"))["card_pm"][ + const data = getConnectorDetails(globalState.get("commons"))["card_pm"][ "InvalidCardNumber" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; cy.createConfirmPaymentTest( paymentIntentBody, - req_data, - res_data, + data, "three_ds", "automatic", globalState @@ -44,16 +41,13 @@ describe("Corner cases", () => { }); it("[Payment] Invalid expiry month", () => { - let data = getConnectorDetails(globalState.get("commons"))["card_pm"][ + const data = getConnectorDetails(globalState.get("commons"))["card_pm"][ "InvalidExpiryMonth" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; cy.createConfirmPaymentTest( paymentIntentBody, - req_data, - res_data, + data, "three_ds", "automatic", globalState @@ -61,16 +55,13 @@ describe("Corner cases", () => { }); it("[Payment] Invalid expiry year", () => { - let data = getConnectorDetails(globalState.get("commons"))["card_pm"][ + const data = getConnectorDetails(globalState.get("commons"))["card_pm"][ "InvalidExpiryYear" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; cy.createConfirmPaymentTest( paymentIntentBody, - req_data, - res_data, + data, "three_ds", "automatic", globalState @@ -78,16 +69,13 @@ describe("Corner cases", () => { }); it("[Payment] Invalid card CVV", () => { - let data = getConnectorDetails(globalState.get("commons"))["card_pm"][ + const data = getConnectorDetails(globalState.get("commons"))["card_pm"][ "InvalidCardCvv" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; cy.createConfirmPaymentTest( paymentIntentBody, - req_data, - res_data, + data, "three_ds", "automatic", globalState @@ -95,16 +83,13 @@ describe("Corner cases", () => { }); it("[Payment] Invalid currency", () => { - let data = getConnectorDetails(globalState.get("commons"))["card_pm"][ + const data = getConnectorDetails(globalState.get("commons"))["card_pm"][ "InvalidCurrency" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; cy.createConfirmPaymentTest( paymentIntentBody, - req_data, - res_data, + data, "three_ds", "automatic", globalState @@ -112,16 +97,13 @@ describe("Corner cases", () => { }); it("[Payment] Invalid capture method", () => { - let data = getConnectorDetails(globalState.get("commons"))["card_pm"][ + const data = getConnectorDetails(globalState.get("commons"))["card_pm"][ "InvalidCaptureMethod" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; cy.createConfirmPaymentTest( paymentIntentBody, - req_data, - res_data, + data, "three_ds", "automatic", globalState @@ -129,16 +111,13 @@ describe("Corner cases", () => { }); it("[Payment] Invalid payment method", () => { - let data = getConnectorDetails(globalState.get("commons"))["card_pm"][ + const data = getConnectorDetails(globalState.get("commons"))["card_pm"][ "InvalidPaymentMethod" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; cy.createConfirmPaymentTest( paymentIntentBody, - req_data, - res_data, + data, "three_ds", "automatic", globalState @@ -146,16 +125,13 @@ describe("Corner cases", () => { }); it("[Payment] Invalid `amount_to_capture`", () => { - let data = getConnectorDetails(globalState.get("commons"))["card_pm"][ + const data = getConnectorDetails(globalState.get("commons"))["card_pm"][ "InvalidAmountToCapture" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; cy.createConfirmPaymentTest( paymentIntentBody, - req_data, - res_data, + data, "three_ds", "automatic", globalState @@ -163,16 +139,13 @@ describe("Corner cases", () => { }); it("[Payment] Missing required params", () => { - let data = getConnectorDetails(globalState.get("commons"))["card_pm"][ + const data = getConnectorDetails(globalState.get("commons"))["card_pm"][ "MissingRequiredParam" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; cy.createConfirmPaymentTest( paymentIntentBody, - req_data, - res_data, + data, "three_ds", "automatic", globalState @@ -192,16 +165,13 @@ describe("Corner cases", () => { }); it("Create payment intent", () => { - let data = getConnectorDetails(globalState.get("commons"))["card_pm"][ + const data = getConnectorDetails(globalState.get("commons"))["card_pm"][ "PaymentIntent" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; cy.createPaymentIntentTest( paymentIntentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState @@ -209,24 +179,16 @@ describe("Corner cases", () => { }); it("Confirm payment intent", () => { - let data = getConnectorDetails(globalState.get("commons"))["card_pm"][ + const data = getConnectorDetails(globalState.get("commons"))["card_pm"][ "PaymentIntentErrored" ]; - 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); }); }); context("[Payment] Capture greater amount", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails before("seed global state", () => { cy.task("getGlobalState").then((state) => { @@ -239,55 +201,40 @@ describe("Corner cases", () => { }); beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("Create payment intent and confirm", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "No3DSManualCapture" - ]; - - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["No3DSManualCapture"]; cy.createConfirmPaymentTest( paymentCreateConfirmBody, - req_data, - res_data, + data, "no_three_ds", "manual", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("Capture call", () => { - let data = getConnectorDetails(globalState.get("commons"))["card_pm"][ + const data = getConnectorDetails(globalState.get("commons"))["card_pm"][ "CaptureGreaterAmount" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 65000, - globalState - ); + cy.captureCallTest(fixtures.captureBody, data, 65000, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); }); context("[Payment] Capture successful payment", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails before("seed global state", () => { cy.task("getGlobalState").then((state) => { @@ -300,59 +247,48 @@ describe("Corner cases", () => { }); beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("Create payment intent and confirm", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "No3DSAutoCapture" - ]; - - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["No3DSAutoCapture"]; cy.createConfirmPaymentTest( paymentCreateConfirmBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("Retrieve payment", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["No3DSAutoCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("Capture call", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "CaptureCapturedAmount" - ]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["CaptureCapturedAmount"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.captureCallTest(fixtures.captureBody, data, 65000, globalState); - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 65000, - globalState - ); - - if (should_continue) - should_continue = utils.should_continue_further(res_data); + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); }); context("[Payment] Confirm successful payment", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails before("seed global state", () => { cy.task("getGlobalState").then((state) => { @@ -365,58 +301,48 @@ describe("Corner cases", () => { }); beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("Create payment intent and confirm", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "No3DSAutoCapture" - ]; - - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["No3DSAutoCapture"]; cy.createConfirmPaymentTest( paymentCreateConfirmBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("Retrieve payment", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["No3DSAutoCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("Confirm call", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "ConfirmSuccessfulPayment" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["ConfirmSuccessfulPayment"]; - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); }); context("[Payment] Void successful payment", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails before("seed global state", () => { cy.task("getGlobalState").then((state) => { @@ -429,58 +355,60 @@ describe("Corner cases", () => { }); beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("Create payment intent and confirm", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "No3DSAutoCapture" - ]; - - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["No3DSAutoCapture"]; cy.createConfirmPaymentTest( paymentCreateConfirmBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("Retrieve payment", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["No3DSAutoCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("Void call", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "Void" - ]; - let commonData = getConnectorDetails(globalState.get("commons"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["Void"]; - let req_data = data["Request"]; - let res_data = utils.getConnectorFlowDetails( - data, - commonData, - "ResponseCustom" - ); - cy.voidCallTest(fixtures.voidBody, req_data, res_data, globalState); + const commonData = getConnectorDetails(globalState.get("commons"))[ + "card_pm" + ]["Void"]; + + const newData = { + ...data, + Response: utils.getConnectorFlowDetails( + data, + commonData, + "ResponseCustom" + ), + }; - if (should_continue) - should_continue = utils.should_continue_further(res_data); + cy.voidCallTest(fixtures.voidBody, newData, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); }); context("[Payment] 3DS with greater capture", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails before("seed global state", () => { cy.task("getGlobalState").then((state) => { @@ -493,68 +421,61 @@ describe("Corner cases", () => { }); beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("Create payment intent and confirm", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "3DSManualCapture" - ]; - - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["3DSManualCapture"]; cy.createConfirmPaymentTest( paymentCreateConfirmBody, - req_data, - res_data, + data, "three_ds", "manual", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("Retrieve payment", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["3DSManualCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("Handle redirection", () => { - let expected_redirection = fixtures.confirmBody["return_url"]; + const expected_redirection = fixtures.confirmBody["return_url"]; cy.handleRedirection(globalState, expected_redirection); }); it("Retrieve payment", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["3DSManualCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("Capture call", () => { - let data = getConnectorDetails(globalState.get("commons"))["card_pm"][ + const data = getConnectorDetails(globalState.get("commons"))["card_pm"][ "CaptureGreaterAmount" ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.captureCallTest(fixtures.captureBody, data, 65000, globalState); - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 65000, - globalState - ); - - if (should_continue) - should_continue = utils.should_continue_further(res_data); + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); }); context("[Payment] Refund exceeds captured Amount", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails before("seed global state", () => { cy.task("getGlobalState").then((state) => { @@ -567,63 +488,59 @@ describe("Corner cases", () => { }); beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("Create payment intent and confirm", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "No3DSAutoCapture" - ]; - - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["No3DSAutoCapture"]; cy.createConfirmPaymentTest( paymentCreateConfirmBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("Retrieve payment", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["No3DSAutoCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("Refund call", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "Refund" - ]; - let commonData = getConnectorDetails(globalState.get("commons"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["Refund"]; - let req_data = data["Request"]; - let res_data = utils.getConnectorFlowDetails( - data, - commonData, - "ResponseCustom" - ); - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 65000, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const commonData = getConnectorDetails(globalState.get("commons"))[ + "card_pm" + ]["Refund"]; + + const newData = { + ...data, + Response: utils.getConnectorFlowDetails( + data, + commonData, + "ResponseCustom" + ), + }; + + cy.refundCallTest(fixtures.refundBody, newData, 65000, globalState); + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); }); context("[Payment] Refund unsuccessful payment", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails before("seed global state", () => { cy.task("getGlobalState").then((state) => { @@ -636,63 +553,60 @@ describe("Corner cases", () => { }); beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("Create payment intent and confirm", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "No3DSAutoCapture" - ]; - - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["No3DSAutoCapture"]; cy.createConfirmPaymentTest( paymentCreateConfirmBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("Retrieve payment", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["No3DSAutoCapture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("Refund call", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "Refund" - ]; - let commonData = getConnectorDetails(globalState.get("commons"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["Refund"]; - let req_data = data["Request"]; - let res_data = utils.getConnectorFlowDetails( - data, - commonData, - "ResponseCustom" - ); - cy.refundCallTest( - fixtures.refundBody, - req_data, - res_data, - 65000, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const commonData = getConnectorDetails(globalState.get("commons"))[ + "card_pm" + ]["Refund"]; + + const newData = { + ...data, + Response: utils.getConnectorFlowDetails( + data, + commonData, + "ResponseCustom" + ), + }; + + cy.refundCallTest(fixtures.refundBody, newData, 65000, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); }); context("[Payment] Recurring mandate with greater mandate amount", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails before("seed global state", () => { cy.task("getGlobalState").then((state) => { @@ -705,62 +619,53 @@ describe("Corner cases", () => { }); beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("No 3DS CIT", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "MandateSingleUseNo3DSManualCapture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["MandateSingleUseNo3DSManualCapture"]; + cy.citForMandatesCallTest( fixtures.citConfirmBody, - req_data, - res_data, + data, 6500, true, "manual", "new_mandate", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("cit-capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "Capture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.captureCallTest( - fixtures.captureBody, - req_data, - res_data, - 6500, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["Capture"]; + + cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("Retrieve payment", () => { - cy.retrievePaymentCallTest(globalState); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["Capture"]; + + cy.retrievePaymentCallTest(globalState, data); }); it("Confirm No 3DS MIT", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "MITAutoCapture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["MITAutoCapture"]; + cy.mitForMandatesCallTest( fixtures.mitConfirmBody, - req_data, - res_data, + data, 65000, true, "manual", diff --git a/cypress-tests/cypress/e2e/PaymentTest/00023-PaymentMethods.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00023-PaymentMethods.cy.js index c27604a07d6c..9dc73f6223e6 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00023-PaymentMethods.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00023-PaymentMethods.cy.js @@ -5,8 +5,6 @@ import getConnectorDetails, * as utils from "../PaymentUtils/Utils"; let globalState; describe("Payment Methods Tests", () => { - let should_continue = true; - before("seed global state", () => { cy.task("getGlobalState").then((state) => { globalState = new State(state); @@ -18,23 +16,14 @@ describe("Payment Methods Tests", () => { }); context("Create payment method for customer", () => { - let should_continue = true; - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - it("Create customer", () => { cy.createCustomerCallTest(fixtures.customerCreateBody, globalState); }); 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); + const data = getConnectorDetails("commons")["card_pm"]["PaymentMethod"]; + + cy.createPaymentMethodTest(globalState, data); }); it("List PM for customer", () => { @@ -43,10 +32,10 @@ describe("Payment Methods Tests", () => { }); context("Set default payment method", () => { - let should_continue = true; + let shouldContinue = true; beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); @@ -56,45 +45,33 @@ 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); + const data = getConnectorDetails("commons")["card_pm"]["PaymentMethod"]; + + cy.createPaymentMethodTest(globalState, data); }); it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PaymentIntentOffSession" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PaymentIntentOffSession"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("confirm-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "SaveCardUseNo3DSAutoCaptureOffSession" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["SaveCardUseNo3DSAutoCaptureOffSession"]; + + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("List PM for customer", () => { diff --git a/cypress-tests/cypress/e2e/PaymentTest/00024-ConnectorAgnostic.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00024-ConnectorAgnostic.cy.js index 29b0097253df..c5fddfdd5bf1 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00024-ConnectorAgnostic.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00024-ConnectorAgnostic.cy.js @@ -2,7 +2,9 @@ import * as fixtures from "../../fixtures/imports"; import State from "../../utils/State"; import { payment_methods_enabled } from "../PaymentUtils/Commons"; import getConnectorDetails, * as utils from "../PaymentUtils/Utils"; + let globalState; + describe("Connector Agnostic Tests", () => { before("seed global state", () => { cy.task("getGlobalState").then((state) => { @@ -16,10 +18,10 @@ describe("Connector Agnostic Tests", () => { context( "Connector Agnostic Disabled for Profile 1 and Enabled for Profile 2", () => { - let should_continue = true; + let shouldContinue = true; beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); @@ -45,38 +47,31 @@ describe("Connector Agnostic Tests", () => { }); it("Create Payment Intent", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["PaymentIntentOffSession"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("Confirm Payment", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["SaveCardUseNo3DSAutoCaptureOffSession"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("List Payment Method for Customer using Client Secret", () => { @@ -112,21 +107,20 @@ describe("Connector Agnostic Tests", () => { }); it("Create Payment Intent", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["PaymentIntentOffSession"]; - let req_data = data["Request"]; - let res_data = data["Response"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("List Payment Method for Customer", () => { @@ -136,10 +130,10 @@ describe("Connector Agnostic Tests", () => { ); context("Connector Agnostic Enabled for Profile 1 and Profile 2", () => { - let should_continue = true; + let shouldContinue = true; beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); @@ -177,38 +171,29 @@ describe("Connector Agnostic Tests", () => { }); it("Create Payment Intent", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PaymentIntentOffSession" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PaymentIntentOffSession"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("Confirm Payment", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "SaveCardUseNo3DSAutoCaptureOffSession" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.confirmCallTest( - fixtures.confirmBody, - req_data, - res_data, - true, - globalState - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["SaveCardUseNo3DSAutoCaptureOffSession"]; + + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("List Payment Method for Customer using Client Secret", () => { @@ -244,21 +229,19 @@ describe("Connector Agnostic Tests", () => { }); it("Create Payment Intent", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PaymentIntentOffSession" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PaymentIntentOffSession"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("List Payment Method for Customer", () => { diff --git a/cypress-tests/cypress/e2e/PaymentTest/00025-ConfigTest.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00025-ConfigTest.cy.js index 724233852c78..b1ccc55ccb34 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00025-ConfigTest.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00025-ConfigTest.cy.js @@ -19,10 +19,10 @@ describe("Config Tests", () => { context( "Update collect_billing_details_from_wallet_connector to true and verifying in payment method list, this config should be true", () => { - let should_continue = true; + let shouldContinue = true; beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); @@ -60,24 +60,20 @@ describe("Config Tests", () => { }); it("Create Payment Intent", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["PaymentIntentOffSession"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -89,10 +85,10 @@ describe("Config Tests", () => { context( "Update collect_shipping_details_from_wallet_connector to true and verifying in payment method list, this config should be true", () => { - let should_continue = true; + let shouldContinue = true; beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); @@ -110,24 +106,20 @@ describe("Config Tests", () => { }); it("Create Payment Intent", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["PaymentIntentOffSession"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -139,10 +131,10 @@ describe("Config Tests", () => { context( "Update always_collect_billing_details_from_wallet_connector to true and verifying in payment method list, this config should be true", () => { - let should_continue = true; + let shouldContinue = true; beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); @@ -160,24 +152,20 @@ describe("Config Tests", () => { }); it("Create Payment Intent", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["PaymentIntentOffSession"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -189,10 +177,10 @@ describe("Config Tests", () => { context( "Update always_collect_shipping_details_from_wallet_connector to true and verifying in payment method list, this config should be true", () => { - let should_continue = true; + let shouldContinue = true; beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); @@ -210,24 +198,20 @@ describe("Config Tests", () => { }); it("Create Payment Intent", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["PaymentIntentOffSession"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -239,10 +223,10 @@ describe("Config Tests", () => { context( "Update always_collect_shipping_details_from_wallet_connector & collect_shipping_details_from_wallet_connector to true and verifying in payment method list, this config should be true", () => { - let should_continue = true; + let shouldContinue = true; beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); @@ -260,24 +244,20 @@ describe("Config Tests", () => { }); it("Create Payment Intent", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["PaymentIntentOffSession"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -288,10 +268,10 @@ describe("Config Tests", () => { context( "Update always_collect_billing_details_from_wallet_connector & to collect_billing_details_from_wallet_connector to true and verifying in payment method list, this config should be true", () => { - let should_continue = true; + let shouldContinue = true; beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); @@ -309,24 +289,20 @@ describe("Config Tests", () => { }); it("Create Payment Intent", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["PaymentIntentOffSession"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { @@ -338,10 +314,10 @@ describe("Config Tests", () => { context( "Update all config(Collect address config) to false and verifying in payment method list, both config should be false", () => { - let should_continue = true; + let shouldContinue = true; beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); @@ -379,24 +355,20 @@ describe("Config Tests", () => { }); it("Create Payment Intent", () => { - let data = getConnectorDetails(globalState.get("connectorId"))[ + const data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["PaymentIntentOffSession"]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("payment_methods-call-test", () => { diff --git a/cypress-tests/cypress/e2e/PaymentTest/00026-IncrementalAuth.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00026-IncrementalAuth.cy.js new file mode 100644 index 000000000000..e281fc0a2f7a --- /dev/null +++ b/cypress-tests/cypress/e2e/PaymentTest/00026-IncrementalAuth.cy.js @@ -0,0 +1,139 @@ +import * as fixtures from "../../fixtures/imports"; +import State from "../../utils/State"; +import getConnectorDetails, * as utils from "../PaymentUtils/Utils"; + +let connector; +let globalState; + +describe.skip("[Payment] Incremental Auth", () => { + before("seed global state", () => { + cy.task("getGlobalState").then((state) => { + globalState = new State(state); + connector = globalState.get("connectorId"); + }); + }); + + after("flush global state", () => { + cy.task("setGlobalState", globalState.data); + }); + + context("[Payment] Incremental Pre-Auth", () => { + let shouldContinue = true; + + beforeEach(function () { + if (!shouldContinue || connector !== "cybersource") { + this.skip(); + } + }); + + it("[Payment] Create Payment Intent", () => { + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PaymentIntentOffSession"]; + + const newData = { + ...data, + Request: { + ...data.Request, + request_incremental_authorization: true, + }, + }; + + cy.createPaymentIntentTest( + fixtures.createPaymentBody, + newData, + "no_three_ds", + "manual", + globalState + ); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); + }); + it("[Payment] Confirm Payment Intent", () => { + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["SaveCardUseNo3DSManualCaptureOffSession"]; + + cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); + }); + it("[Payment] Incremental Authorization", () => { + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["IncrementalAuth"]; + cy.incrementalAuth(globalState, data); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); + }); + it("[Payment] Capture Payment Intent", () => { + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["Capture"]; + + cy.captureCallTest(fixtures.captureBody, data, 7000, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); + }); + }); + + context("[Payment] [Saved Card] Incremental Pre-Auth", () => { + let shouldContinue = true; + + beforeEach(function () { + if (!shouldContinue || connector !== "cybersource") { + this.skip(); + } + }); + + it("[Payment] List customer payment methods", () => { + cy.listCustomerPMCallTest(globalState); + }); + it("[Payment] Create Payment Intent", () => { + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PaymentIntentOffSession"]; + + cy.createPaymentIntentTest( + fixtures.createPaymentBody, + data, + "no_three_ds", + "manual", + globalState + ); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); + }); + it("[Payment] Confirm Payment Intent", () => { + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["SaveCardUseNo3DSManualCaptureOffSession"]; + + cy.saveCardConfirmCallTest( + fixtures.saveCardConfirmBody, + data, + globalState + ); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); + }); + it("[Payment] Incremental Authorization", () => { + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["IncrementalAuth"]; + + cy.incrementalAuth(globalState, data); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); + }); + it("[Payment] Capture Payment Intent", () => { + const data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["Capture"]; + + cy.captureCallTest(fixtures.captureBody, data, 7000, globalState); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); + }); + }); +}); diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Bluesnap.js b/cypress-tests/cypress/e2e/PaymentUtils/Bluesnap.js index 6dfe0131bc3d..708a8660d520 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/Bluesnap.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/Bluesnap.js @@ -30,6 +30,9 @@ export const connectorDetails = { }, }, "3DSManualCapture": { + Configs: { + TRIGGER_SKIP: true, + }, Request: { payment_method: "card", payment_method_data: { @@ -41,13 +44,15 @@ export const connectorDetails = { }, Response: { status: 200, - trigger_skip: true, body: { status: "requires_customer_action", }, }, }, "3DSAutoCapture": { + Configs: { + TRIGGER_SKIP: true, + }, Request: { payment_method: "card", payment_method_data: { @@ -59,7 +64,6 @@ export const connectorDetails = { }, Response: { status: 200, - trigger_skip: true, body: { status: "requires_customer_action", }, diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Commons.js b/cypress-tests/cypress/e2e/PaymentUtils/Commons.js index a0eb936152b2..144b43fee7cd 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/Commons.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/Commons.js @@ -8,9 +8,9 @@ const globalState = new State({ connectorAuthFilePath: Cypress.env("CONNECTOR_AUTH_FILE_PATH"), }); -const connectorName = normalise(globalState.get("connectorId")); +const connectorName = normalize(globalState.get("connectorId")); -function normalise(input) { +function normalize(input) { const exceptions = { bankofamerica: "Bank of America", cybersource: "Cybersource", @@ -18,7 +18,7 @@ function normalise(input) { paypal: "Paypal", wellsfargo: "Wellsfargo", fiuu: "Fiuu", - noon: "Noon" + noon: "Noon", // Add more known exceptions here }; @@ -143,6 +143,7 @@ export const getCustomExchange = (overrides) => { return { ...defaultExchange, + ...(overrides.Configs ? { Configs: overrides.Configs } : {}), Request: { ...defaultExchange.Request, ...(overrides.Request || {}), @@ -1075,7 +1076,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 +1183,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 +1212,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 +1240,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/Cybersource.js b/cypress-tests/cypress/e2e/PaymentUtils/Cybersource.js index c0fcfdd1b53a..d2782d450cd4 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/Cybersource.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/Cybersource.js @@ -107,6 +107,12 @@ export const connectorDetails = { }, }, PaymentIntentOffSession: { + Configs: { + CONNECTOR_CREDENTIAL: { + specName: ["incrementalAuth"], + value: "connector_2", + }, + }, Request: { currency: "USD", amount: 6500, @@ -123,6 +129,11 @@ export const connectorDetails = { }, }, "3DSManualCapture": { + Configs: { + CONNECTOR_CREDENTIAL: { + value: "connector_1", + }, + }, Request: { payment_method: "card", payment_method_data: { @@ -142,6 +153,11 @@ export const connectorDetails = { }, }, "3DSAutoCapture": { + Configs: { + CONNECTOR_CREDENTIAL: { + value: "connector_1", + }, + }, Request: { payment_method: "card", payment_method_data: { @@ -161,6 +177,11 @@ export const connectorDetails = { }, }, No3DSManualCapture: { + Configs: { + CONNECTOR_CREDENTIAL: { + value: "connector_1", + }, + }, Request: { payment_method: "card", payment_method_data: { @@ -181,6 +202,11 @@ export const connectorDetails = { }, }, No3DSAutoCapture: { + Configs: { + CONNECTOR_CREDENTIAL: { + value: "connector_1", + }, + }, Request: { payment_method: "card", payment_method_data: { @@ -201,6 +227,11 @@ export const connectorDetails = { }, }, Capture: { + Configs: { + CONNECTOR_CREDENTIAL: { + value: "connector_1", + }, + }, Request: { payment_method: "card", payment_method_data: { @@ -220,6 +251,11 @@ export const connectorDetails = { }, }, PartialCapture: { + Configs: { + CONNECTOR_CREDENTIAL: { + value: "connector_1", + }, + }, Request: {}, Response: { status: 200, @@ -232,6 +268,11 @@ export const connectorDetails = { }, }, Void: { + Configs: { + CONNECTOR_CREDENTIAL: { + value: "connector_1", + }, + }, Request: {}, Response: { status: 200, @@ -241,6 +282,11 @@ export const connectorDetails = { }, }, Refund: { + Configs: { + CONNECTOR_CREDENTIAL: { + value: "connector_1", + }, + }, Request: { payment_method: "card", payment_method_data: { @@ -257,6 +303,11 @@ export const connectorDetails = { }, }, manualPaymentRefund: { + Configs: { + CONNECTOR_CREDENTIAL: { + value: "connector_1", + }, + }, Request: { payment_method: "card", payment_method_data: { @@ -278,6 +329,11 @@ export const connectorDetails = { }, }, manualPaymentPartialRefund: { + Configs: { + CONNECTOR_CREDENTIAL: { + value: "connector_1", + }, + }, Request: { payment_method: "card", payment_method_data: { @@ -299,6 +355,11 @@ export const connectorDetails = { }, }, PartialRefund: { + Configs: { + CONNECTOR_CREDENTIAL: { + value: "connector_1", + }, + }, Request: { payment_method: "card", payment_method_data: { @@ -315,6 +376,11 @@ export const connectorDetails = { }, }, SyncRefund: { + Configs: { + CONNECTOR_CREDENTIAL: { + value: "connector_1", + }, + }, Request: { payment_method: "card", payment_method_data: { @@ -330,7 +396,26 @@ export const connectorDetails = { }, }, }, + IncrementalAuth: { + Request: { + amount: 7000, + }, + Response: { + status: 200, + body: { + status: "requires_capture", + amount: 7000, + amount_capturable: 7000, + amount_received: null, + }, + }, + }, MandateSingleUse3DSAutoCapture: { + Configs: { + CONNECTOR_CREDENTIAL: { + value: "connector_1", + }, + }, Request: { payment_method: "card", payment_method_data: { @@ -347,6 +432,11 @@ export const connectorDetails = { }, }, MandateSingleUse3DSManualCapture: { + Configs: { + CONNECTOR_CREDENTIAL: { + value: "connector_1", + }, + }, Request: { payment_method: "card", payment_method_data: { @@ -363,6 +453,11 @@ export const connectorDetails = { }, }, MandateSingleUseNo3DSAutoCapture: { + Configs: { + CONNECTOR_CREDENTIAL: { + value: "connector_1", + }, + }, Request: { payment_method: "card", payment_method_data: { @@ -379,6 +474,11 @@ export const connectorDetails = { }, }, MandateSingleUseNo3DSManualCapture: { + Configs: { + CONNECTOR_CREDENTIAL: { + value: "connector_1", + }, + }, Request: { payment_method: "card", payment_method_data: { @@ -395,6 +495,11 @@ export const connectorDetails = { }, }, MandateMultiUseNo3DSAutoCapture: { + Configs: { + CONNECTOR_CREDENTIAL: { + value: "connector_1", + }, + }, Request: { payment_method: "card", payment_method_data: { @@ -411,6 +516,11 @@ export const connectorDetails = { }, }, MandateMultiUseNo3DSManualCapture: { + Configs: { + CONNECTOR_CREDENTIAL: { + value: "connector_1", + }, + }, Request: { payment_method: "card", payment_method_data: { @@ -427,6 +537,11 @@ export const connectorDetails = { }, }, MandateMultiUse3DSAutoCapture: { + Configs: { + CONNECTOR_CREDENTIAL: { + value: "connector_1", + }, + }, Request: { payment_method: "card", payment_method_data: { @@ -443,6 +558,11 @@ export const connectorDetails = { }, }, MandateMultiUse3DSManualCapture: { + Configs: { + CONNECTOR_CREDENTIAL: { + value: "connector_1", + }, + }, Request: { payment_method: "card", payment_method_data: { @@ -459,6 +579,11 @@ export const connectorDetails = { }, }, MITAutoCapture: { + Configs: { + CONNECTOR_CREDENTIAL: { + value: "connector_1", + }, + }, Request: {}, Response: { status: 200, @@ -468,6 +593,11 @@ export const connectorDetails = { }, }, MITManualCapture: { + Configs: { + CONNECTOR_CREDENTIAL: { + value: "connector_1", + }, + }, Request: {}, Response: { status: 200, @@ -477,6 +607,11 @@ export const connectorDetails = { }, }, ZeroAuthMandate: { + Configs: { + CONNECTOR_CREDENTIAL: { + value: "connector_1", + }, + }, Request: { payment_method: "card", payment_method_data: { @@ -507,6 +642,11 @@ export const connectorDetails = { }, }, ZeroAuthConfirmPayment: { + Configs: { + CONNECTOR_CREDENTIAL: { + value: "connector_1", + }, + }, Request: { payment_type: "setup_mandate", payment_method: "card", @@ -524,6 +664,11 @@ export const connectorDetails = { }, }, SaveCardUseNo3DSAutoCapture: { + Configs: { + CONNECTOR_CREDENTIAL: { + value: "connector_1", + }, + }, Request: { payment_method: "card", payment_method_type: "debit", @@ -549,6 +694,11 @@ export const connectorDetails = { }, }, SaveCardUseNo3DSAutoCaptureOffSession: { + Configs: { + CONNECTOR_CREDENTIAL: { + value: "connector_1", + }, + }, Request: { payment_method: "card", payment_method_type: "debit", @@ -573,6 +723,12 @@ export const connectorDetails = { }, }, SaveCardUseNo3DSManualCaptureOffSession: { + Configs: { + CONNECTOR_CREDENTIAL: { + specName: ["incrementalAuth"], + value: "connector_2", + }, + }, Request: { payment_method: "card", payment_method_type: "debit", @@ -597,6 +753,11 @@ export const connectorDetails = { }, }, SaveCardConfirmAutoCaptureOffSession: { + Configs: { + CONNECTOR_CREDENTIAL: { + value: "connector_1", + }, + }, Request: { setup_future_usage: "off_session", }, @@ -608,6 +769,11 @@ export const connectorDetails = { }, }, SaveCardConfirmManualCaptureOffSession: { + Configs: { + CONNECTOR_CREDENTIAL: { + value: "connector_1", + }, + }, Request: { setup_future_usage: "off_session", }, @@ -619,6 +785,11 @@ export const connectorDetails = { }, }, SaveCardUseNo3DSManualCapture: { + Configs: { + CONNECTOR_CREDENTIAL: { + value: "connector_1", + }, + }, Request: { payment_method: "card", payment_method_data: { @@ -643,6 +814,11 @@ export const connectorDetails = { }, }, PaymentMethodIdMandateNo3DSAutoCapture: { + Configs: { + CONNECTOR_CREDENTIAL: { + value: "connector_1", + }, + }, Request: { payment_method: "card", payment_method_data: { @@ -667,6 +843,11 @@ export const connectorDetails = { }, }, PaymentMethodIdMandateNo3DSManualCapture: { + Configs: { + CONNECTOR_CREDENTIAL: { + value: "connector_1", + }, + }, Request: { payment_method: "card", payment_method_data: { @@ -691,6 +872,11 @@ export const connectorDetails = { }, }, PaymentMethodIdMandate3DSAutoCapture: { + Configs: { + CONNECTOR_CREDENTIAL: { + value: "connector_1", + }, + }, Request: { payment_method: "card", payment_method_data: { @@ -716,6 +902,11 @@ export const connectorDetails = { }, }, PaymentMethodIdMandate3DSManualCapture: { + Configs: { + CONNECTOR_CREDENTIAL: { + value: "connector_1", + }, + }, Request: { payment_method: "card", payment_method_data: { diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Elavon.js b/cypress-tests/cypress/e2e/PaymentUtils/Elavon.js index bb34e805a5a3..6755dd16e700 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/Elavon.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/Elavon.js @@ -1,571 +1,572 @@ const successfulNo3DSCardDetails = { - card_number: "4111111111111111", - card_exp_month: "06", - card_exp_year: "50", - card_holder_name: "joseph Doe", - card_cvc: "123", + card_number: "4111111111111111", + card_exp_month: "06", + card_exp_year: "50", + card_holder_name: "joseph Doe", + card_cvc: "123", }; + const singleUseMandateData = { - customer_acceptance: { - acceptance_type: "offline", - accepted_at: "1963-05-03T04:07:52.723Z", - online: { - ip_address: "125.0.0.1", - user_agent: "amet irure esse", - }, + customer_acceptance: { + acceptance_type: "offline", + accepted_at: "1963-05-03T04:07:52.723Z", + online: { + ip_address: "125.0.0.1", + user_agent: "amet irure esse", }, - mandate_type: { - single_use: { - amount: 8000, - currency: "USD", - }, + }, + mandate_type: { + single_use: { + amount: 8000, + currency: "USD", }, + }, }; const multiUseMandateData = { - customer_acceptance: { - acceptance_type: "offline", - accepted_at: "1963-05-03T04:07:52.723Z", - online: { - ip_address: "125.0.0.1", + customer_acceptance: { + acceptance_type: "offline", + accepted_at: "1963-05-03T04:07:52.723Z", + online: { + ip_address: "125.0.0.1", + user_agent: "amet irure esse", + }, + }, + mandate_type: { + multi_use: { + amount: 8000, + currency: "USD", + }, + }, +}; +export const connectorDetails = { + card_pm: { + PaymentIntent: { + Request: { + currency: "USD", + customer_acceptance: null, + setup_future_usage: "on_session", + billing: { + address: { + line1: "1467", + line2: "CA", + line3: "CA", + city: "Florence", + state: "Tuscany", + zip: "12345", + country: "IT", + first_name: "Max", + last_name: "Mustermann", + }, + email: "mauro.morandi@nexi.it", + phone: { + number: "9123456789", + country_code: "+91", + }, + }, + }, + Response: { + status: 200, + body: { + status: "requires_payment_method", + }, + }, + }, + No3DSManualCapture: { + Request: { + payment_method: "card", + payment_method_data: { + card: successfulNo3DSCardDetails, + billing: { + email: "mauro.morandi@nexi.it", + }, + }, + billing: { + email: "mauro.morandi@nexi.it", + }, + currency: "USD", + customer_acceptance: null, + setup_future_usage: "on_session", + }, + Response: { + status: 200, + body: { + status: "requires_capture", + }, + }, + }, + No3DSAutoCapture: { + Request: { + payment_method: "card", + payment_method_data: { + card: successfulNo3DSCardDetails, + billing: { + email: "mauro.morandi@nexi.it", + }, + }, + billing: { + email: "mauro.morandi@nexi.it", + }, + currency: "USD", + customer_acceptance: null, + setup_future_usage: "on_session", + }, + Response: { + status: 200, + body: { + status: "succeeded", + }, + }, + }, + manualPaymentPartialRefund: { + Request: { + payment_method: "card", + payment_method_data: { + card: successfulNo3DSCardDetails, + }, + currency: "USD", + customer_acceptance: null, + }, + Response: { + status: 200, + body: { + status: "succeeded", + }, + }, + }, + manualPaymentRefund: { + Request: { + payment_method: "card", + payment_method_data: { + card: successfulNo3DSCardDetails, + }, + currency: "USD", + customer_acceptance: null, + }, + Response: { + status: 200, + body: { + status: "succeeded", + }, + }, + }, + MandateMultiUseNo3DSAutoCapture: { + Request: { + payment_method: "card", + payment_method_data: { + card: successfulNo3DSCardDetails, + billing: { + address: { + line1: "1467", + line2: "Harrison Street", + line3: "Harrison Street", + city: "San Fransico", + state: "California", + zip: "94122", + country: "NL", + first_name: "joseph", + last_name: "Doe", + }, + email: "johndoe@gmail.com", + }, + }, + currency: "USD", + mandate_data: multiUseMandateData, + }, + Response: { + status: 200, + body: { + status: "succeeded", + }, + }, + }, + MandateMultiUseNo3DSManualCapture: { + Request: { + payment_method: "card", + payment_method_data: { + card: successfulNo3DSCardDetails, + billing: { + address: { + line1: "1467", + line2: "Harrison Street", + line3: "Harrison Street", + city: "San Fransico", + state: "California", + zip: "94122", + country: "NL", + first_name: "joseph", + last_name: "Doe", + }, + email: "johndoe@gmail.com", + }, + }, + currency: "USD", + mandate_data: multiUseMandateData, + }, + Response: { + status: 200, + body: { + status: "requires_capture", + }, + }, + }, + SaveCardUseNo3DSAutoCapture: { + Request: { + payment_method: "card", + payment_method_data: { + card: successfulNo3DSCardDetails, + billing: { + email: "mauro.morandi@nexi.it", + }, + }, + currency: "USD", + setup_future_usage: "on_session", + customer_acceptance: { + acceptance_type: "offline", + accepted_at: "1963-05-03T04:07:52.723Z", + online: { + ip_address: "127.0.0.1", user_agent: "amet irure esse", + }, + }, + }, + Response: { + status: 200, + body: { + status: "succeeded", }, + }, }, - mandate_type: { - multi_use: { - amount: 8000, - currency: "USD", + SaveCardUseNo3DSAutoCaptureOffSession: { + Request: { + payment_method: "card", + payment_method_type: "debit", + payment_method_data: { + card: successfulNo3DSCardDetails, + billing: { + address: { + line1: "1467", + line2: "Harrison Street", + line3: "Harrison Street", + city: "San Fransico", + state: "California", + zip: "94122", + country: "NL", + first_name: "joseph", + last_name: "Doe", + }, + phone: { + number: "9123456789", + country_code: "+91", + }, + email: "mauro.morandi@nexi.it", + }, }, + setup_future_usage: "off_session", + customer_acceptance: { + acceptance_type: "offline", + accepted_at: "1963-05-03T04:07:52.723Z", + online: { + ip_address: "127.0.0.1", + user_agent: "amet irure esse", + }, + }, + }, + Response: { + status: 200, + body: { + status: "succeeded", + }, + }, }, -}; -export const connectorDetails = { - card_pm: { - PaymentIntent: { - Request: { - currency: "USD", - customer_acceptance: null, - setup_future_usage: "on_session", - billing: { - address: { - line1: "1467", - line2: "CA", - line3: "CA", - city: "Florence", - state: "Tuscany", - zip: "12345", - country: "IT", - first_name: "Max", - last_name: "Mustermann", - }, - email: "mauro.morandi@nexi.it", - phone: { - number: "9123456789", - country_code: "+91", - }, - }, - }, - Response: { - status: 200, - body: { - status: "requires_payment_method", - }, - }, + SaveCardUseNo3DSManualCaptureOffSession: { + Request: { + payment_method: "card", + payment_method_data: { + card: successfulNo3DSCardDetails, + billing: { + address: { + line1: "1467", + line2: "Harrison Street", + line3: "Harrison Street", + city: "San Fransico", + state: "California", + zip: "94122", + country: "NL", + first_name: "joseph", + last_name: "Doe", + }, + phone: { + number: "9123456789", + country_code: "+91", + }, + email: "mauro.morandi@nexi.it", + }, }, - No3DSManualCapture: { - Request: { - payment_method: "card", - payment_method_data: { - card: successfulNo3DSCardDetails, - billing: { - email: "mauro.morandi@nexi.it", - }, - }, - billing: { - email: "mauro.morandi@nexi.it", - }, - currency: "USD", - customer_acceptance: null, - setup_future_usage: "on_session", - }, - Response: { - status: 200, - body: { - status: "requires_capture", - }, - }, + setup_future_usage: "off_session", + customer_acceptance: { + acceptance_type: "offline", + accepted_at: "1963-05-03T04:07:52.723Z", + online: { + ip_address: "127.0.0.1", + user_agent: "amet irure esse", + }, }, - No3DSAutoCapture: { - Request: { - payment_method: "card", - payment_method_data: { - card: successfulNo3DSCardDetails, - billing: { - email: "mauro.morandi@nexi.it", - }, - }, - billing: { - email: "mauro.morandi@nexi.it", - }, - currency: "USD", - customer_acceptance: null, - setup_future_usage: "on_session", - }, - Response: { - status: 200, - body: { - status: "succeeded", - }, - }, - }, manualPaymentPartialRefund: { - Request: { - payment_method: "card", - payment_method_data: { - card: successfulNo3DSCardDetails, - }, - currency: "USD", - customer_acceptance: null, - }, - Response: { - status: 200, - body: { - status: "succeeded", - }, - }, + }, + Response: { + status: 200, + body: { + status: "requires_capture", }, - manualPaymentRefund: { - Request: { - payment_method: "card", - payment_method_data: { - card: successfulNo3DSCardDetails, - }, - currency: "USD", - customer_acceptance: null, - }, - Response: { - status: 200, - body: { - status: "succeeded", - }, - }, + }, + }, + SaveCardConfirmAutoCaptureOffSession: { + Request: { + setup_future_usage: "off_session", + }, + Response: { + status: 200, + body: { + status: "succeeded", }, - MandateMultiUseNo3DSAutoCapture: { - Request: { - payment_method: "card", - payment_method_data: { - card: successfulNo3DSCardDetails, - billing: { - address: { - line1: "1467", - line2: "Harrison Street", - line3: "Harrison Street", - city: "San Fransico", - state: "California", - zip: "94122", - country: "NL", - first_name: "joseph", - last_name: "Doe", - }, - email: "johndoe@gmail.com" - }, - }, - currency: "USD", - mandate_data: multiUseMandateData, - }, - Response: { - status: 200, - body: { - status: "succeeded", - }, - }, + }, + }, + SaveCardConfirmManualCaptureOffSession: { + Request: { + setup_future_usage: "off_session", + }, + Response: { + status: 200, + body: { + status: "requires_capture", }, - MandateMultiUseNo3DSManualCapture: { - Request: { - payment_method: "card", - payment_method_data: { - card: successfulNo3DSCardDetails, - billing: { - address: { - line1: "1467", - line2: "Harrison Street", - line3: "Harrison Street", - city: "San Fransico", - state: "California", - zip: "94122", - country: "NL", - first_name: "joseph", - last_name: "Doe", - }, - email: "johndoe@gmail.com" - }, - }, - currency: "USD", - mandate_data: multiUseMandateData, - }, - Response: { - status: 200, - body: { - status: "requires_capture", - }, - }, + }, + }, + SaveCardUseNo3DSManualCapture: { + Request: { + payment_method: "card", + payment_method_data: { + card: successfulNo3DSCardDetails, + billing: { + address: { + line1: "1467", + line2: "Harrison Street", + line3: "Harrison Street", + city: "San Fransico", + state: "California", + zip: "94122", + country: "NL", + first_name: "joseph", + last_name: "Doe", + }, + phone: { + number: "9123456789", + country_code: "+91", + }, + email: "mauro.morandi@nexi.it", + }, }, - SaveCardUseNo3DSAutoCapture: { - Request: { - payment_method: "card", - payment_method_data: { - card: successfulNo3DSCardDetails, - billing: { - email: "mauro.morandi@nexi.it", - - }, - }, - currency: "USD", - setup_future_usage: "on_session", - customer_acceptance: { - acceptance_type: "offline", - accepted_at: "1963-05-03T04:07:52.723Z", - online: { - ip_address: "127.0.0.1", - user_agent: "amet irure esse", - }, - }, - }, - Response: { - status: 200, - body: { - status: "succeeded", - }, - }, + currency: "USD", + setup_future_usage: "on_session", + customer_acceptance: { + acceptance_type: "offline", + accepted_at: "1963-05-03T04:07:52.723Z", + online: { + ip_address: "127.0.0.1", + user_agent: "amet irure esse", + }, }, - SaveCardUseNo3DSAutoCaptureOffSession: { - Request: { - payment_method: "card", - payment_method_type: "debit", - payment_method_data: { - card: successfulNo3DSCardDetails, - billing: { - address: { - line1: "1467", - line2: "Harrison Street", - line3: "Harrison Street", - city: "San Fransico", - state: "California", - zip: "94122", - country: "NL", - first_name: "joseph", - last_name: "Doe", - }, - phone: { - number: "9123456789", - country_code: "+91", - }, - email: "mauro.morandi@nexi.it", - }, - }, - setup_future_usage: "off_session", - customer_acceptance: { - acceptance_type: "offline", - accepted_at: "1963-05-03T04:07:52.723Z", - online: { - ip_address: "127.0.0.1", - user_agent: "amet irure esse", - }, - }, - }, - Response: { - status: 200, - body: { - status: "succeeded", - }, - }, + }, + Response: { + status: 200, + body: { + status: "requires_capture", }, - SaveCardUseNo3DSManualCaptureOffSession: { - Request: { - payment_method: "card", - payment_method_data: { - card: successfulNo3DSCardDetails, - billing: { - address: { - line1: "1467", - line2: "Harrison Street", - line3: "Harrison Street", - city: "San Fransico", - state: "California", - zip: "94122", - country: "NL", - first_name: "joseph", - last_name: "Doe", - }, - phone: { - number: "9123456789", - country_code: "+91", - }, - email: "mauro.morandi@nexi.it", - }, - }, - setup_future_usage: "off_session", - customer_acceptance: { - acceptance_type: "offline", - accepted_at: "1963-05-03T04:07:52.723Z", - online: { - ip_address: "127.0.0.1", - user_agent: "amet irure esse", - }, - }, - }, - Response: { - status: 200, - body: { - status: "requires_capture", - }, - }, + }, + }, + MandateSingleUseNo3DSAutoCapture: { + Request: { + payment_method: "card", + payment_method_data: { + card: successfulNo3DSCardDetails, + billing: { + email: "mauro.morandi@nexi.it", + }, }, - SaveCardConfirmAutoCaptureOffSession: { - Request: { - setup_future_usage: "off_session", - }, - Response: { - status: 200, - body: { - status: "succeeded", - }, - }, + currency: "USD", + mandate_data: singleUseMandateData, + }, + Response: { + status: 200, + body: { + status: "succeeded", }, - SaveCardConfirmManualCaptureOffSession: { - Request: { - setup_future_usage: "off_session", - }, - Response: { - status: 200, - body: { - status: "requires_capture", - }, - }, + }, + }, + MandateSingleUseNo3DSManualCapture: { + Request: { + payment_method: "card", + payment_method_data: { + card: successfulNo3DSCardDetails, + billing: { + email: "mauro.morandi@nexi.it", + }, }, - SaveCardUseNo3DSManualCapture: { - Request: { - payment_method: "card", - payment_method_data: { - card: successfulNo3DSCardDetails, - billing: { - address: { - line1: "1467", - line2: "Harrison Street", - line3: "Harrison Street", - city: "San Fransico", - state: "California", - zip: "94122", - country: "NL", - first_name: "joseph", - last_name: "Doe", - }, - phone: { - number: "9123456789", - country_code: "+91", - }, - email: "mauro.morandi@nexi.it", - }, - }, - currency: "USD", - setup_future_usage: "on_session", - customer_acceptance: { - acceptance_type: "offline", - accepted_at: "1963-05-03T04:07:52.723Z", - online: { - ip_address: "127.0.0.1", - user_agent: "amet irure esse", - }, - }, - }, - Response: { - status: 200, - body: { - status: "requires_capture", - }, - }, + currency: "USD", + mandate_data: singleUseMandateData, + }, + Response: { + status: 200, + body: { + status: "requires_capture", }, - MandateSingleUseNo3DSAutoCapture: { - Request: { - payment_method: "card", - payment_method_data: { - card: successfulNo3DSCardDetails, - billing: { - email: "mauro.morandi@nexi.it", - }, - }, - currency: "USD", - mandate_data: singleUseMandateData, - }, - Response: { - status: 200, - body: { - status: "succeeded", - }, - }, + }, + }, + Capture: { + Request: { + payment_method: "card", + payment_method_data: { + card: successfulNo3DSCardDetails, }, - MandateSingleUseNo3DSManualCapture: { - Request: { - payment_method: "card", - payment_method_data: { - card: successfulNo3DSCardDetails, - billing: { - email: "mauro.morandi@nexi.it", - }, - }, - currency: "USD", - mandate_data: singleUseMandateData, - }, - Response: { - status: 200, - body: { - status: "requires_capture", - }, - }, + currency: "USD", + customer_acceptance: null, + }, + Response: { + status: 200, + body: { + status: "succeeded", + amount: 6500, + amount_capturable: 0, + amount_received: 6500, }, - Capture: { - Request: { - payment_method: "card", - payment_method_data: { - card: successfulNo3DSCardDetails, - }, - currency: "USD", - customer_acceptance: null, - }, - Response: { - status: 200, - body: { - status: "succeeded", - amount: 6500, - amount_capturable: 0, - amount_received: 6500, - }, - }, + }, + }, + PartialCapture: { + Request: {}, + Response: { + status: 200, + body: { + status: "partially_captured", + amount: 6500, + amount_capturable: 0, + amount_received: 100, }, - PartialCapture: { - Request: {}, - Response: { - status: 200, - body: { - status: "partially_captured", - amount: 6500, - amount_capturable: 0, - amount_received: 100, - }, - }, + }, + }, + Refund: { + Request: { + payment_method: "card", + payment_method_data: { + card: successfulNo3DSCardDetails, }, - Refund: { - Request: { - payment_method: "card", - payment_method_data: { - card: successfulNo3DSCardDetails, - }, - currency: "USD", - customer_acceptance: null, - }, - Response: { - status: 200, - body: { - status: "succeeded", - }, - }, + currency: "USD", + customer_acceptance: null, + }, + Response: { + status: 200, + body: { + status: "succeeded", }, - VoidAfterConfirm: { - Request: {}, - Response: { - status: 501, - body: { - error: { - type: "invalid_request", - message: "Cancel/Void flow is not implemented", - code: "IR_00" - } - } - }, + }, + }, + VoidAfterConfirm: { + Request: {}, + Response: { + status: 501, + body: { + error: { + type: "invalid_request", + message: "Cancel/Void flow is not implemented", + code: "IR_00", + }, }, - PartialRefund: { - Request: { - payment_method: "card", - payment_method_data: { - card: successfulNo3DSCardDetails, - }, - currency: "USD", - customer_acceptance: null, - }, - Response: { - status: 200, - body: { - status: "succeeded", - }, - }, + }, + }, + PartialRefund: { + Request: { + payment_method: "card", + payment_method_data: { + card: successfulNo3DSCardDetails, }, - SyncRefund: { - Request: { - payment_method: "card", - payment_method_data: { - card: successfulNo3DSCardDetails, - }, - currency: "USD", - customer_acceptance: null, - }, - Response: { - status: 200, - body: { - status: "succeeded", - }, - }, + currency: "USD", + customer_acceptance: null, + }, + Response: { + status: 200, + body: { + status: "succeeded", }, - PaymentMethodIdMandateNo3DSAutoCapture: { - Request: { - payment_method: "card", - payment_method_data: { - card: successfulNo3DSCardDetails, - }, - currency: "USD", - billing: { - email: "mauro.morandi@nexi.it", - }, - mandate_data: null, - customer_acceptance: { - acceptance_type: "offline", - accepted_at: "1963-05-03T04:07:52.723Z", - online: { - ip_address: "125.0.0.1", - user_agent: "amet irure esse", - }, - }, - }, - Response: { - status: 200, - body: { - status: "succeeded", - }, - }, + }, + }, + SyncRefund: { + Request: { + payment_method: "card", + payment_method_data: { + card: successfulNo3DSCardDetails, }, - PaymentMethodIdMandateNo3DSManualCapture: { - Request: { - payment_method: "card", - payment_method_data: { - card: successfulNo3DSCardDetails, - }, - billing: { - email: "mauro.morandi@nexi.it", - }, - currency: "USD", - mandate_data: null, - customer_acceptance: { - acceptance_type: "offline", - accepted_at: "1963-05-03T04:07:52.723Z", - online: { - ip_address: "125.0.0.1", - user_agent: "amet irure esse", - }, - }, - }, - Response: { - status: 200, - body: { - status: "requires_capture", - }, - }, + currency: "USD", + customer_acceptance: null, + }, + Response: { + status: 200, + body: { + status: "succeeded", + }, + }, + }, + PaymentMethodIdMandateNo3DSAutoCapture: { + Request: { + payment_method: "card", + payment_method_data: { + card: successfulNo3DSCardDetails, + }, + currency: "USD", + billing: { + email: "mauro.morandi@nexi.it", + }, + mandate_data: null, + customer_acceptance: { + acceptance_type: "offline", + accepted_at: "1963-05-03T04:07:52.723Z", + online: { + ip_address: "125.0.0.1", + user_agent: "amet irure esse", + }, + }, + }, + Response: { + status: 200, + body: { + status: "succeeded", + }, + }, + }, + PaymentMethodIdMandateNo3DSManualCapture: { + Request: { + payment_method: "card", + payment_method_data: { + card: successfulNo3DSCardDetails, + }, + billing: { + email: "mauro.morandi@nexi.it", + }, + currency: "USD", + mandate_data: null, + customer_acceptance: { + acceptance_type: "offline", + accepted_at: "1963-05-03T04:07:52.723Z", + online: { + ip_address: "125.0.0.1", + user_agent: "amet irure esse", + }, + }, + }, + Response: { + status: 200, + body: { + status: "requires_capture", }, + }, }, + }, }; diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Fiuu.js b/cypress-tests/cypress/e2e/PaymentUtils/Fiuu.js index d82a5f128d68..996356117ab0 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/Fiuu.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/Fiuu.js @@ -299,7 +299,7 @@ export const connectorDetails = { first_name: "joseph", last_name: "Doe", }, - email: "johndoe@gmail.com" + email: "johndoe@gmail.com", }, }, currency: "USD", @@ -399,9 +399,9 @@ export const connectorDetails = { first_name: "joseph", last_name: "Doe", }, - email: "johndoe@gmail.com" + email: "johndoe@gmail.com", }, - }, + }, currency: "USD", mandate_data: null, customer_acceptance: { @@ -437,7 +437,7 @@ export const connectorDetails = { first_name: "joseph", last_name: "Doe", }, - email: "johndoe@gmail.com" + email: "johndoe@gmail.com", }, }, currency: "USD", @@ -475,7 +475,7 @@ export const connectorDetails = { first_name: "joseph", last_name: "Doe", }, - email: "johndoe@gmail.com" + email: "johndoe@gmail.com", }, }, currency: "USD", @@ -513,7 +513,7 @@ export const connectorDetails = { first_name: "joseph", last_name: "Doe", }, - email: "johndoe@gmail.com" + email: "johndoe@gmail.com", }, }, setup_future_usage: "off_session", @@ -550,7 +550,7 @@ export const connectorDetails = { first_name: "joseph", last_name: "Doe", }, - email: "johndoe@gmail.com" + email: "johndoe@gmail.com", }, }, setup_future_usage: "off_session", @@ -609,7 +609,7 @@ export const connectorDetails = { first_name: "joseph", last_name: "Doe", }, - email: "johndoe@gmail.com" + email: "johndoe@gmail.com", }, }, currency: "USD", @@ -647,7 +647,7 @@ export const connectorDetails = { first_name: "joseph", last_name: "Doe", }, - email: "johndoe@gmail.com" + email: "johndoe@gmail.com", }, }, currency: "USD", @@ -686,7 +686,7 @@ export const connectorDetails = { first_name: "joseph", last_name: "Doe", }, - email: "johndoe@gmail.com" + email: "johndoe@gmail.com", }, }, mandate_data: null, diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Nexixpay.js b/cypress-tests/cypress/e2e/PaymentUtils/Nexixpay.js index 7f4927d347f6..3489dbb2371a 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/Nexixpay.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/Nexixpay.js @@ -1,13 +1,3 @@ -import { getCustomExchange } from "./Commons"; - -const successfulNo3DSCardDetails = { - card_number: "4012000033330026", - card_exp_month: "01", - card_exp_year: "50", - card_holder_name: "joseph Doe", - card_cvc: "123", -}; - const successfulThreeDSTestCardDetails = { card_number: "4349940199004549", card_exp_month: "12", diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Nmi.js b/cypress-tests/cypress/e2e/PaymentUtils/Nmi.js index 2206c516de54..2ece2615b4c1 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/Nmi.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/Nmi.js @@ -307,6 +307,10 @@ export const connectorDetails = { }, }, PaymentMethodIdMandate3DSAutoCapture: { + Configs: { + // Skipping redirection here for mandate 3ds auto capture as it requires changes from the core + TRIGGER_SKIP: true, + }, Request: { payment_method: "card", payment_method_data: { @@ -317,8 +321,6 @@ export const connectorDetails = { customer_acceptance: customerAcceptance, }, Response: { - // Skipping redirection here for mandate 3ds auto capture as it requires changes from the core - trigger_skip: true, status: 200, body: { status: "requires_customer_action", @@ -326,6 +328,9 @@ export const connectorDetails = { }, }, PaymentMethodIdMandate3DSManualCapture: { + Configs: { + TRIGGER_SKIP: true, + }, Request: { payment_method_data: { card: successfulThreeDSTestCardDetails, @@ -335,8 +340,6 @@ export const connectorDetails = { customer_acceptance: customerAcceptance, }, Response: { - trigger_skip: true, - status: 200, body: { status: "requires_customer_action", diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Noon.js b/cypress-tests/cypress/e2e/PaymentUtils/Noon.js index 38b0c0c1117a..6d2a3926972e 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/Noon.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/Noon.js @@ -63,30 +63,6 @@ const multiUseMandateData = { }, }; -const payment_method_data_no3ds = { - card: { - last4: "4242", - card_type: "CREDIT", - card_network: "Visa", - card_issuer: "STRIPE PAYMENTS UK LIMITED", - card_issuing_country: "UNITEDKINGDOM", - card_isin: "424242", - card_extended_bin: null, - card_exp_month: "01", - card_exp_year: "30", - card_holder_name: null, - payment_checks: { - avs_response: { - code: "Y", - codeRaw: "Y", - }, - card_verification: null, - }, - authentication_data: null, - }, - billing: null, -}; - const payment_method_data_3ds = { card: { last4: "1091", diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Novalnet.js b/cypress-tests/cypress/e2e/PaymentUtils/Novalnet.js index 0b3b2820aa51..0a8235141dcc 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/Novalnet.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/Novalnet.js @@ -1,11 +1,3 @@ -const successfulNo3DSCardDetails = { - card_number: "4200000000000000", - card_exp_month: "12", - card_exp_year: "50", - card_holder_name: "Max Mustermann", - card_cvc: "123", -}; - const successfulThreeDSTestCardDetails = { card_number: "4000000000001091", card_exp_month: "12", diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Paybox.js b/cypress-tests/cypress/e2e/PaymentUtils/Paybox.js index a7a4afc07beb..7a4a47f9c312 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/Paybox.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/Paybox.js @@ -14,15 +14,17 @@ const successfulThreeDSTestCardDetails = { card_cvc: "123", }; -const singleUseMandateData = { - customer_acceptance: { - acceptance_type: "offline", - accepted_at: "1963-05-03T04:07:52.723Z", - online: { - ip_address: "125.0.0.1", - user_agent: "amet irure esse", - }, +const customerAcceptance = { + acceptance_type: "offline", + accepted_at: "1963-05-03T04:07:52.723Z", + online: { + ip_address: "125.0.0.1", + user_agent: "amet irure esse", }, +}; + +const singleUseMandateData = { + customer_acceptance: customerAcceptance, mandate_type: { single_use: { amount: 7000, @@ -32,14 +34,7 @@ const singleUseMandateData = { }; const multiUseMandateData = { - customer_acceptance: { - acceptance_type: "offline", - accepted_at: "1963-05-03T04:07:52.723Z", - online: { - ip_address: "125.0.0.1", - user_agent: "amet irure esse", - }, - }, + customer_acceptance: customerAcceptance, mandate_type: { multi_use: { amount: 6500, @@ -48,13 +43,12 @@ const multiUseMandateData = { }, }; -const customerAcceptance = { - acceptance_type: "offline", - accepted_at: "1963-05-03T04:07:52.723Z", - online: { - ip_address: "125.0.0.1", - user_agent: "amet irure esse", - }, +const captureNotSupported = { + type: "invalid_request", + message: "Payment method type not supported", + code: "IR_19", + reason: + "Capture Not allowed in case of Creating the Subscriber is not supported by Paybox", }; export const connectorDetails = { @@ -260,13 +254,7 @@ export const connectorDetails = { Response: { status: 400, body: { - error: { - type: "invalid_request", - message: "Payment method type not supported", - code: "IR_19", - reason: - "Capture Not allowed in case of Creating the Subscriber is not supported by Paybox", - }, + error: captureNotSupported, }, }, }, @@ -298,13 +286,7 @@ export const connectorDetails = { Response: { status: 400, body: { - error: { - type: "invalid_request", - message: "Payment method type not supported", - code: "IR_19", - reason: - "Capture Not allowed in case of Creating the Subscriber is not supported by Paybox", - }, + error: captureNotSupported, }, }, }, @@ -336,13 +318,7 @@ export const connectorDetails = { Response: { status: 200, body: { - error: { - type: "invalid_request", - message: "Payment method type not supported", - code: "IR_19", - reason: - "Capture Not allowed in case of Creating the Subscriber is not supported by Paybox", - }, + error: captureNotSupported, }, }, }, @@ -374,13 +350,7 @@ export const connectorDetails = { Response: { status: 400, body: { - error: { - type: "invalid_request", - message: "Payment method type not supported", - code: "IR_19", - reason: - "Capture Not allowed in case of Creating the Subscriber is not supported by Paybox", - }, + error: captureNotSupported, }, }, }, @@ -436,13 +406,7 @@ export const connectorDetails = { Response: { status: 400, body: { - error: { - type: "invalid_request", - message: "Payment method type not supported", - code: "IR_19", - reason: - "Capture Not allowed in case of Creating the Subscriber is not supported by Paybox", - }, + error: captureNotSupported, }, }, }, @@ -477,13 +441,7 @@ export const connectorDetails = { Response: { status: 400, body: { - error: { - type: "invalid_request", - message: "Payment method type not supported", - code: "IR_19", - reason: - "Capture Not allowed in case of Creating the Subscriber is not supported by Paybox", - }, + error: captureNotSupported, }, }, }, @@ -581,13 +539,7 @@ export const connectorDetails = { Response: { status: 400, body: { - error: { - type: "invalid_request", - message: "Payment method type not supported", - code: "IR_19", - reason: - "Capture Not allowed in case of Creating the Subscriber is not supported by Paybox", - }, + error: captureNotSupported, }, }, }, @@ -669,7 +621,7 @@ export const connectorDetails = { error: { error_type: "invalid_request", message: "Json deserialize error: invalid card number length", - code: "IR_06" + code: "IR_06", }, }, }, @@ -776,8 +728,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", }, }, }, @@ -804,8 +757,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", }, }, }, @@ -831,8 +785,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/Paypal.js b/cypress-tests/cypress/e2e/PaymentUtils/Paypal.js index 715bfae395cf..a551ed859593 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/Paypal.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/Paypal.js @@ -49,6 +49,9 @@ export const connectorDetails = { }, }, "3DSManualCapture": { + Configs: { + TRIGGER_SKIP: true, + }, Request: { payment_method: "card", payment_method_data: { @@ -60,13 +63,15 @@ export const connectorDetails = { }, Response: { status: 200, - trigger_skip: true, body: { status: "requires_customer_action", }, }, }, "3DSAutoCapture": { + Configs: { + TRIGGER_SKIP: true, + }, Request: { payment_method: "card", payment_method_data: { @@ -78,7 +83,6 @@ export const connectorDetails = { }, Response: { status: 200, - trigger_skip: true, body: { status: "requires_customer_action", }, diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Trustpay.js b/cypress-tests/cypress/e2e/PaymentUtils/Trustpay.js index 21975b4dea39..76351c6c4548 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/Trustpay.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/Trustpay.js @@ -36,6 +36,12 @@ const multiUseMandateData = { export const connectorDetails = { card_pm: { PaymentIntent: getCustomExchange({ + Configs: { + CONNECTOR_CREDENTIAL: { + specName: ["refundPayment", "syncRefund"], + value: "connector_2", + }, + }, Request: { currency: "USD", customer_acceptance: null, @@ -49,6 +55,12 @@ export const connectorDetails = { }, }), "3DSAutoCapture": { + Configs: { + CONNECTOR_CREDENTIAL: { + specName: ["refundPayment", "syncRefund"], + value: "connector_2", + }, + }, Request: { payment_method: "card", payment_method_data: { @@ -66,6 +78,12 @@ export const connectorDetails = { }, }, No3DSAutoCapture: { + Configs: { + CONNECTOR_CREDENTIAL: { + specName: ["refundPayment", "syncRefund"], + value: "connector_2", + }, + }, Request: { payment_method: "card", payment_method_data: { @@ -83,6 +101,12 @@ export const connectorDetails = { }, }, Capture: { + Configs: { + CONNECTOR_CREDENTIAL: { + specName: ["refundPayment", "syncRefund"], + value: "connector_2", + }, + }, Request: { payment_method: "card", payment_method_data: { @@ -104,6 +128,16 @@ export const connectorDetails = { }, }, PartialCapture: { + Configs: { + CONNECTOR_CREDENTIAL: { + specName: ["refundPayment", "syncRefund"], + value: "connector_2", + }, + DELAY: { + STATUS: true, + TIMEOUT: 15000, + }, + }, Request: { payment_method: "card", payment_method_data: { @@ -138,6 +172,12 @@ export const connectorDetails = { }, }, Refund: { + Configs: { + DELAY: { + STATUS: true, + TIMEOUT: 15000, + }, + }, Request: { payment_method: "card", payment_method_data: { @@ -154,6 +194,12 @@ export const connectorDetails = { }, }, PartialRefund: { + Configs: { + DELAY: { + STATUS: true, + TIMEOUT: 15000, + }, + }, Request: { payment_method: "card", payment_method_data: { @@ -165,12 +211,18 @@ export const connectorDetails = { Response: { status: 200, body: { - error_code: "1", - error_message: "transaction declined (invalid amount)", + reason: "FRAUD", + status: "succeeded", }, }, }, SyncRefund: { + Configs: { + DELAY: { + STATUS: true, + TIMEOUT: 15000, + }, + }, Request: { payment_method: "card", payment_method_data: { diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Utils.js b/cypress-tests/cypress/e2e/PaymentUtils/Utils.js index 39d8ab6c8af7..e432c37717bf 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/Utils.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/Utils.js @@ -1,13 +1,18 @@ +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"; +import { connectorDetails as checkoutConnectorDetails } from "./Checkout.js"; import { connectorDetails as CommonConnectorDetails, updateDefaultStatusCode, } from "./Commons.js"; import { connectorDetails as cybersourceConnectorDetails } from "./Cybersource.js"; import { connectorDetails as datatransConnectorDetails } from "./Datatrans.js"; +import { connectorDetails as elavonConnectorDetails } from "./Elavon.js"; import { connectorDetails as fiservemeaConnectorDetails } from "./Fiservemea.js"; +import { connectorDetails as fiuuConnectorDetails } from "./Fiuu.js"; import { connectorDetails as iatapayConnectorDetails } from "./Iatapay.js"; import { connectorDetails as itaubankConnectorDetails } from "./ItauBank.js"; import { connectorDetails as nexixpayConnectorDetails } from "./Nexixpay.js"; @@ -19,10 +24,7 @@ import { connectorDetails as paypalConnectorDetails } from "./Paypal.js"; import { connectorDetails as stripeConnectorDetails } from "./Stripe.js"; import { connectorDetails as trustpayConnectorDetails } from "./Trustpay.js"; import { connectorDetails as wellsfargoConnectorDetails } from "./WellsFargo.js"; -import { connectorDetails as fiuuConnectorDetails } from "./Fiuu.js"; import { connectorDetails as worldpayConnectorDetails } from "./WorldPay.js"; -import { connectorDetails as checkoutConnectorDetails } from "./Checkout.js"; -import { connectorDetails as elavonConnectorDetails } from "./Elavon.js"; const connectorDetails = { adyen: adyenConnectorDetails, @@ -50,12 +52,13 @@ const connectorDetails = { }; export default function getConnectorDetails(connectorId) { - let x = mergeDetails(connectorId); + const x = mergeDetails(connectorId); return x; } export function getConnectorFlowDetails(connectorData, commonData, key) { - let data = connectorData[key] === undefined ? commonData[key] : connectorData[key]; + const data = + connectorData[key] === undefined ? commonData[key] : connectorData[key]; return data; } @@ -99,21 +102,47 @@ export function getValueByKey(jsonObject, key) { typeof jsonObject === "string" ? JSON.parse(jsonObject) : jsonObject; if (data && typeof data === "object" && key in data) { + // Connector object has multiple keys + if (typeof data[key].connector_account_details === "undefined") { + const keys = Object.keys(data[key]); + + for (let i = 0; i < keys.length; i++) { + const currentItem = data[key][keys[i]]; + + if ( + Object.prototype.hasOwnProperty.call( + currentItem, + "connector_account_details" + ) + ) { + Cypress.env("MULTIPLE_CONNECTORS", { + status: true, + count: keys.length, + }); + + return currentItem; + } + } + } + return data[key]; } else { return null; } } -export const should_continue_further = (res_data) => { - if (res_data.trigger_skip !== undefined) { - return !res_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 { @@ -139,9 +168,12 @@ export function defaultErrorHandler(response, response_data) { if (typeof response.body.error === "object") { for (const key in response_data.body.error) { // Check if the error message is a Json deserialize error - let apiResponseContent = response.body.error[key]; - let expectedContent = response_data.body.error[key]; - if (typeof apiResponseContent === "string" && apiResponseContent.includes("Json deserialize error")) { + const apiResponseContent = response.body.error[key]; + const expectedContent = response_data.body.error[key]; + if ( + typeof apiResponseContent === "string" && + apiResponseContent.includes("Json deserialize error") + ) { expect(apiResponseContent).to.include(expectedContent); } else { expect(apiResponseContent).to.equal(expectedContent); diff --git a/cypress-tests/cypress/e2e/PaymentUtils/WellsFargo.js b/cypress-tests/cypress/e2e/PaymentUtils/WellsFargo.js index 56f3caba8fac..38a5b637040a 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/WellsFargo.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/WellsFargo.js @@ -68,6 +68,9 @@ export const connectorDetails = { }, }, "3DSManualCapture": { + Configs: { + TRIGGER_SKIP: true, + }, Request: { payment_method: "card", payment_method_data: { @@ -79,13 +82,15 @@ export const connectorDetails = { }, Response: { status: 200, - trigger_skip: true, body: { status: "requires_capture", }, }, }, "3DSAutoCapture": { + Configs: { + TRIGGER_SKIP: true, + }, Request: { payment_method: "card", payment_method_data: { @@ -97,7 +102,6 @@ export const connectorDetails = { }, Response: { status: 200, - trigger_skip: true, body: { status: "requires_customer_action", @@ -227,6 +231,9 @@ export const connectorDetails = { }, }, MandateSingleUse3DSAutoCapture: { + Configs: { + TRIGGER_SKIP: true, + }, Request: { payment_method: "card", payment_method_data: { @@ -237,7 +244,6 @@ export const connectorDetails = { }, Response: { status: 200, - trigger_skip: true, body: { status: "succeeded", @@ -245,6 +251,9 @@ export const connectorDetails = { }, }, MandateSingleUse3DSManualCapture: { + Configs: { + TRIGGER_SKIP: true, + }, Request: { payment_method: "card", payment_method_data: { @@ -255,7 +264,6 @@ export const connectorDetails = { }, Response: { status: 200, - trigger_skip: true, body: { status: "requires_customer_action", @@ -327,6 +335,9 @@ export const connectorDetails = { }, }, MandateMultiUse3DSAutoCapture: { + Configs: { + TRIGGER_SKIP: true, + }, Request: { payment_method: "card", payment_method_data: { @@ -337,7 +348,6 @@ export const connectorDetails = { }, Response: { status: 200, - trigger_skip: true, body: { status: "requires_capture", @@ -345,6 +355,9 @@ export const connectorDetails = { }, }, MandateMultiUse3DSManualCapture: { + Configs: { + TRIGGER_SKIP: true, + }, Request: { payment_method: "card", payment_method_data: { @@ -355,7 +368,6 @@ export const connectorDetails = { }, Response: { status: 200, - trigger_skip: true, body: { status: "requires_capture", @@ -493,6 +505,9 @@ export const connectorDetails = { }, }, PaymentMethodIdMandate3DSAutoCapture: { + Configs: { + TRIGGER_SKIP: true, + }, Request: { payment_method: "card", payment_method_data: { @@ -512,7 +527,6 @@ export const connectorDetails = { }, Response: { status: 200, - trigger_skip: true, body: { status: "requires_customer_action", }, diff --git a/cypress-tests/cypress/e2e/PaymentUtils/WorldPay.js b/cypress-tests/cypress/e2e/PaymentUtils/WorldPay.js index d45458369c59..557e4b23ee43 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/WorldPay.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/WorldPay.js @@ -1,4 +1,3 @@ - const billing = { address: { line1: "1467", @@ -9,21 +8,23 @@ const billing = { zip: "94122", country: "US", first_name: "John", - last_name: "Doe" - } + last_name: "Doe", + }, }; const browser_info = { - "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36", - "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", - "language": "nl-NL", - "color_depth": 24, - "screen_height": 723, - "screen_width": 1536, - "time_zone": 0, - "java_enabled": true, - "java_script_enabled": true, - "ip_address": "127.0.0.1" + user_agent: + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36", + accept_header: + "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", + language: "nl-NL", + color_depth: 24, + screen_height: 723, + screen_width: 1536, + time_zone: 0, + java_enabled: true, + java_script_enabled: true, + ip_address: "127.0.0.1", }; const successfulNoThreeDsCardDetailsRequest = { @@ -55,9 +56,9 @@ const paymentMethodDataNoThreeDsResponse = { card_exp_year: "30", card_holder_name: null, payment_checks: null, - authentication_data: null + authentication_data: null, }, - billing: null + billing: null, }; const payment_method_data_3ds = { @@ -73,12 +74,12 @@ const payment_method_data_3ds = { card_exp_year: "30", card_holder_name: null, payment_checks: null, - authentication_data: null + authentication_data: null, }, - billing: null + billing: null, }; -const offileCustomerAcceptance = { +const customerAcceptance = { acceptance_type: "offline", accepted_at: "1963-05-03T04:07:52.723Z", online: { @@ -88,7 +89,7 @@ const offileCustomerAcceptance = { }; const singleUseMandateData = { - customer_acceptance: offileCustomerAcceptance, + customer_acceptance: customerAcceptance, mandate_type: { single_use: { amount: 8000, @@ -205,10 +206,11 @@ export const connectorDetails = { ResponseCustom: { body: { type: "invalid_request", - message: "You cannot cancel this payment because it has status processing", + message: + "You cannot cancel this payment because it has status processing", code: "IR_16", - } - } + }, + }, }, VoidAfterConfirm: { Request: {}, @@ -227,7 +229,7 @@ export const connectorDetails = { }, currency: "USD", setup_future_usage: "on_session", - customer_acceptance: offileCustomerAcceptance, + customer_acceptance: customerAcceptance, }, Response: { body: { @@ -242,7 +244,7 @@ export const connectorDetails = { card: successfulNoThreeDsCardDetailsRequest, }, setup_future_usage: "off_session", - customer_acceptance: offileCustomerAcceptance, + customer_acceptance: customerAcceptance, }, Response: { status: 200, @@ -271,14 +273,14 @@ export const connectorDetails = { currency: "USD", setup_future_usage: "on_session", browser_info, - customer_acceptance: offileCustomerAcceptance, + customer_acceptance: customerAcceptance, }, Response: { status: 200, body: { - status: "succeeded" + status: "succeeded", }, - } + }, }, SaveCardUseNo3DSAutoCaptureOffSession: { Request: { @@ -288,7 +290,7 @@ export const connectorDetails = { card: successfulNoThreeDsCardDetailsRequest, }, setup_future_usage: "off_session", - customer_acceptance: offileCustomerAcceptance, + customer_acceptance: customerAcceptance, }, Response: { status: 200, @@ -396,7 +398,7 @@ export const connectorDetails = { Request: {}, Response: { body: { - status: "succeeded" + status: "succeeded", }, }, }, @@ -404,9 +406,9 @@ export const connectorDetails = { Request: {}, Response: { body: { - status: "succeeded" - } - } + status: "succeeded", + }, + }, }, manualPaymentRefund: { Request: { @@ -418,9 +420,9 @@ export const connectorDetails = { }, Response: { body: { - status: "succeeded" - } - } + status: "succeeded", + }, + }, }, manualPaymentPartialRefund: { Request: { @@ -432,17 +434,17 @@ export const connectorDetails = { }, Response: { body: { - status: "succeeded" - } - } + status: "succeeded", + }, + }, }, SyncRefund: { Request: {}, Response: { body: { - status: "succeeded" - } - } + status: "succeeded", + }, + }, }, MandateSingleUseNo3DSAutoCapture: { Request: { @@ -522,9 +524,10 @@ export const connectorDetails = { status: 200, body: { error_code: "internalErrorOccurred", - error_message: "We cannot currently process your request. Please contact support.", + error_message: + "We cannot currently process your request. Please contact support.", status: "failed", - payment_method_id: null + payment_method_id: null, }, }, }, @@ -556,9 +559,10 @@ export const connectorDetails = { status: 200, body: { error_code: "internalErrorOccurred", - error_message: "We cannot currently process your request. Please contact support.", + error_message: + "We cannot currently process your request. Please contact support.", status: "failed", - payment_method_id: null + payment_method_id: null, }, }, }, @@ -570,7 +574,7 @@ export const connectorDetails = { }, currency: "USD", mandate_data: null, - customer_acceptance: offileCustomerAcceptance, + customer_acceptance: customerAcceptance, }, Response: { status: 200, @@ -587,7 +591,7 @@ export const connectorDetails = { }, currency: "USD", mandate_data: null, - customer_acceptance: offileCustomerAcceptance, + customer_acceptance: customerAcceptance, }, Response: { status: 200, @@ -605,7 +609,7 @@ export const connectorDetails = { currency: "USD", mandate_data: null, authentication_type: "three_ds", - customer_acceptance: offileCustomerAcceptance, + customer_acceptance: customerAcceptance, }, Response: { status: 200, @@ -622,7 +626,7 @@ export const connectorDetails = { }, mandate_data: null, authentication_type: "three_ds", - customer_acceptance: offileCustomerAcceptance, + customer_acceptance: customerAcceptance, }, Response: { status: 200, @@ -632,4 +636,4 @@ export const connectorDetails = { }, }, }, -} \ No newline at end of file +}; diff --git a/cypress-tests/cypress/e2e/PayoutTest/00003-CardTest.cy.js b/cypress-tests/cypress/e2e/PayoutTest/00003-CardTest.cy.js index 2caa6030c536..fd9b9d9f6e27 100644 --- a/cypress-tests/cypress/e2e/PayoutTest/00003-CardTest.cy.js +++ b/cypress-tests/cypress/e2e/PayoutTest/00003-CardTest.cy.js @@ -5,7 +5,7 @@ import * as utils from "../PayoutUtils/Utils"; let globalState; describe("[Payout] Cards", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails before("seed global state", () => { cy.task("getGlobalState").then((state) => { @@ -13,7 +13,7 @@ describe("[Payout] Cards", () => { // Check if the connector supports card payouts (based on the connector configuration in creds) if (!globalState.get("payoutsExecution")) { - should_continue = false; + shouldContinue = false; } }); }); @@ -23,37 +23,34 @@ describe("[Payout] Cards", () => { }); beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); context("Payout Card with Auto Fulfill", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("confirm-payout-call-with-auto-fulfill-test", () => { - let data = utils.getConnectorDetails(globalState.get("connectorId"))[ + const 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); + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("retrieve-payout-call-test", () => { @@ -62,41 +59,36 @@ describe("[Payout] Cards", () => { }); context("Payout Card with Manual Fulfill - Create Confirm", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("confirm-payout-call-with-manual-fulfill-test", () => { - let data = utils.getConnectorDetails(globalState.get("connectorId"))[ + const 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); + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("fulfill-payout-call-test", () => { - let data = utils.getConnectorDetails(globalState.get("connectorId"))[ + const 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); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.fulfillPayoutCallTest({}, data, globalState); + if (shouldContinue) shouldContinue = 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..0cb4508ded82 100644 --- a/cypress-tests/cypress/e2e/PayoutTest/00004-BankTransfer.cy.js +++ b/cypress-tests/cypress/e2e/PayoutTest/00004-BankTransfer.cy.js @@ -6,7 +6,7 @@ let globalState; // TODO: Add test for Bank Transfer - ACH describe.skip("[Payout] [Bank Transfer - ACH]", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails before("seed global state", () => { cy.task("getGlobalState").then((state) => { @@ -14,7 +14,7 @@ describe.skip("[Payout] [Bank Transfer - ACH]", () => { // Check if the connector supports card payouts (based on the connector configuration in creds) if (!globalState.get("payoutsExecution")) { - should_continue = false; + shouldContinue = false; } }); }); @@ -24,7 +24,7 @@ describe.skip("[Payout] [Bank Transfer - ACH]", () => { }); beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); @@ -32,7 +32,7 @@ describe.skip("[Payout] [Bank Transfer - ACH]", () => { // TODO: Add test for Bank Transfer - BACS describe.skip("[Payout] [Bank Transfer - BACS]", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails before("seed global state", () => { cy.task("getGlobalState").then((state) => { @@ -40,7 +40,7 @@ describe.skip("[Payout] [Bank Transfer - BACS]", () => { // Check if the connector supports card payouts (based on the connector configuration in creds) if (!globalState.get("payoutsExecution")) { - should_continue = false; + shouldContinue = false; } }); }); @@ -50,14 +50,14 @@ describe.skip("[Payout] [Bank Transfer - BACS]", () => { }); beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); }); describe("[Payout] [Bank Transfer - SEPA]", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails before("seed global state", () => { cy.task("getGlobalState").then((state) => { @@ -65,7 +65,7 @@ describe("[Payout] [Bank Transfer - SEPA]", () => { // Check if the connector supports card payouts (based on the connector configuration in creds) if (!globalState.get("payoutsExecution")) { - should_continue = false; + shouldContinue = false; } }); }); @@ -75,37 +75,33 @@ describe("[Payout] [Bank Transfer - SEPA]", () => { }); beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); context("[Payout] [Bank transfer - SEPA] Auto Fulfill", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("confirm-payout-call-with-auto-fulfill-test", () => { - let data = utils.getConnectorDetails(globalState.get("connectorId"))[ + const data = utils.getConnectorDetails(globalState.get("connectorId"))[ "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); + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("retrieve-payout-call-test", () => { @@ -114,41 +110,36 @@ describe("[Payout] [Bank Transfer - SEPA]", () => { }); context("[Payout] [Bank transfer - SEPA] Manual Fulfill", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); it("confirm-payout-call-with-manual-fulfill-test", () => { - let data = utils.getConnectorDetails(globalState.get("connectorId"))[ + const 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); + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("fulfill-payout-call-test", () => { - let data = utils.getConnectorDetails(globalState.get("connectorId"))[ + const 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); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + + cy.fulfillPayoutCallTest({}, data, globalState); + if (shouldContinue) shouldContinue = 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..37dc1c2cdf0f 100644 --- a/cypress-tests/cypress/e2e/PayoutTest/00005-SavePayout.cy.js +++ b/cypress-tests/cypress/e2e/PayoutTest/00005-SavePayout.cy.js @@ -6,7 +6,7 @@ let globalState; let payoutBody; describe("[Payout] Saved Card", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails before("seed global state", () => { cy.task("getGlobalState").then((state) => { @@ -14,7 +14,7 @@ describe("[Payout] Saved Card", () => { // Check if the connector supports card payouts (based on the connector configuration in creds) if (!globalState.get("payoutsExecution")) { - should_continue = false; + shouldContinue = false; } }); }); @@ -24,13 +24,13 @@ describe("[Payout] Saved Card", () => { }); beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); context("[Payout] [Card] Onboard customer prior to transaction", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails // This is needed to get customer payment methods beforeEach("seed global state", () => { @@ -42,12 +42,11 @@ describe("[Payout] Saved Card", () => { }); it("create payment method", () => { - let data = utils.getConnectorDetails(globalState.get("connectorId"))[ + const 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", () => { @@ -55,22 +54,19 @@ describe("[Payout] Saved Card", () => { }); it("confirm-payout-call-with-auto-fulfill-test", () => { - let data = utils.getConnectorDetails(globalState.get("connectorId"))[ + const 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); + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("retrieve-payout-call-test", () => { @@ -81,10 +77,10 @@ describe("[Payout] Saved Card", () => { context( "[Payout] [Card] Save payment method after successful transaction", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); @@ -94,22 +90,14 @@ describe("[Payout] Saved Card", () => { }); it("confirm-payout-call-with-auto-fulfill-test", () => { - let data = utils.getConnectorDetails(globalState.get("connectorId"))[ + const 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 - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + cy.createConfirmPayoutTest(payoutBody, data, true, true, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("list customer payment methods", () => { @@ -117,22 +105,20 @@ describe("[Payout] Saved Card", () => { }); it("confirm-payout-call-with-auto-fulfill-test", () => { - let data = utils.getConnectorDetails(globalState.get("connectorId"))[ + const 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); + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("retrieve-payout-call-test", () => { @@ -143,7 +129,7 @@ describe("[Payout] Saved Card", () => { }); describe("[Payout] Saved Bank transfer", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails before("seed global state", () => { cy.task("getGlobalState").then((state) => { @@ -151,7 +137,7 @@ describe("[Payout] Saved Bank transfer", () => { // Check if the connector supports card payouts (based on the connector configuration in creds) if (!globalState.get("payoutsExecution")) { - should_continue = false; + shouldContinue = false; } }); }); @@ -161,7 +147,7 @@ describe("[Payout] Saved Bank transfer", () => { }); beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); @@ -169,7 +155,7 @@ describe("[Payout] Saved Bank transfer", () => { context( "[Payout] [Bank Transfer] Onboard Customer Prior to Transaction", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach("reset payoutBody", () => { payoutBody = Cypress._.cloneDeep(fixtures.createPayoutBody); }); @@ -179,12 +165,11 @@ describe("[Payout] Saved Bank transfer", () => { }); it("create payment method", () => { - let data = utils.getConnectorDetails(globalState.get("connectorId"))[ + const 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", () => { @@ -192,22 +177,20 @@ describe("[Payout] Saved Bank transfer", () => { }); it("[Payout] [Bank transfer] [SEPA] Fulfill using Token", () => { - let data = utils.getConnectorDetails(globalState.get("connectorId"))[ + const 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); + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("retrieve-payout-call-test", () => { @@ -219,10 +202,10 @@ describe("[Payout] Saved Bank transfer", () => { context( "[Payout] [Bank Transfer] Save payment method after successful transaction", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + let shouldContinue = true; // variable that will be used to skip tests if a previous test fails beforeEach(function () { - if (!should_continue) { + if (!shouldContinue) { this.skip(); } }); @@ -232,22 +215,14 @@ describe("[Payout] Saved Bank transfer", () => { }); it("confirm-payout-call-with-auto-fulfill-test", () => { - let data = utils.getConnectorDetails(globalState.get("connectorId"))[ + const 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 - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + cy.createConfirmPayoutTest(payoutBody, data, true, true, globalState); + + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("list customer payment methods", () => { @@ -255,22 +230,20 @@ describe("[Payout] Saved Bank transfer", () => { }); it("[Payout] [Bank transfer] [SEPA] Fulfill using Token", () => { - let data = utils.getConnectorDetails(globalState.get("connectorId"))[ + const 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); + if (shouldContinue) + shouldContinue = utils.should_continue_further(data); }); it("retrieve-payout-call-test", () => { diff --git a/cypress-tests/cypress/e2e/PayoutUtils/Commons.js b/cypress-tests/cypress/e2e/PayoutUtils/Commons.js index 5f8a580731e0..ecd85b051511 100644 --- a/cypress-tests/cypress/e2e/PayoutUtils/Commons.js +++ b/cypress-tests/cypress/e2e/PayoutUtils/Commons.js @@ -118,7 +118,6 @@ export const connectorDetails = { card: card_data, }, currency: "EUR", - payout_type: "card", }, Response: { status: 200, @@ -135,7 +134,6 @@ export const connectorDetails = { card: card_data, }, currency: "EUR", - payout_type: "card", }, Response: { status: 200, @@ -152,7 +150,6 @@ export const connectorDetails = { card: card_data, }, currency: "EUR", - payout_type: "card", }, }), SavePayoutMethod: getCustomExchange({ diff --git a/cypress-tests/cypress/e2e/PayoutUtils/Utils.js b/cypress-tests/cypress/e2e/PayoutUtils/Utils.js index d57aac2290d1..4cd122782f21 100644 --- a/cypress-tests/cypress/e2e/PayoutUtils/Utils.js +++ b/cypress-tests/cypress/e2e/PayoutUtils/Utils.js @@ -1,3 +1,5 @@ +import { validateConfig } from "../../utils/featureFlags.js"; + import { connectorDetails as adyenConnectorDetails } from "./Adyen.js"; import { connectorDetails as adyenPlatformConnectorDetails } from "./AdyenPlatform.js"; import { connectorDetails as CommonConnectorDetails } from "./Commons.js"; @@ -11,7 +13,7 @@ const connectorDetails = { }; export function getConnectorDetails(connectorId) { - let x = mergeDetails(connectorId); + const x = mergeDetails(connectorId); return x; } @@ -50,22 +52,52 @@ function mergeConnectorDetails(source, fallback) { return merged; } -function getValueByKey(jsonObject, key) { +export function getValueByKey(jsonObject, key) { const data = typeof jsonObject === "string" ? JSON.parse(jsonObject) : jsonObject; if (data && typeof data === "object" && key in data) { + // Connector object has multiple keys + if (typeof data[key].connector_account_details === "undefined") { + const keys = Object.keys(data[key]); + + for (let i = 0; i < keys.length; i++) { + const currentItem = data[key][keys[i]]; + + if ( + Object.prototype.hasOwnProperty.call( + currentItem, + "connector_account_details" + ) + ) { + Cypress.env("MULTIPLE_CONNECTORS", { + status: true, + count: keys.length, + }); + + return currentItem; + } + } + } + return data[key]; } else { return null; } } -export const should_continue_further = (res_data) => { +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/RoutingTest/00000-PriorityRouting.cy.js b/cypress-tests/cypress/e2e/RoutingTest/00000-PriorityRouting.cy.js index 3037a6eb99ec..22e4b3783af1 100644 --- a/cypress-tests/cypress/e2e/RoutingTest/00000-PriorityRouting.cy.js +++ b/cypress-tests/cypress/e2e/RoutingTest/00000-PriorityRouting.cy.js @@ -5,7 +5,7 @@ import * as utils from "../RoutingUtils/Utils"; let globalState; describe("Priority Based Routing Test", () => { - let should_continue = true; + let shouldContinue = true; context("Login", () => { before("seed global state", () => { @@ -52,11 +52,8 @@ 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 = [ + const data = utils.getConnectorDetails("common")["priorityRouting"]; + const routing_data = [ { connector: "stripe", merchant_connector_id: globalState.get("stripeMcaId"), @@ -68,53 +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); + if (shouldContinue) shouldContinue = 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); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = utils.getConnectorDetails("common")["priorityRouting"]; + + cy.retrieveRoutingConfig(data, globalState); + if (shouldContinue) shouldContinue = 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); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = utils.getConnectorDetails("common")["priorityRouting"]; + + cy.activateRoutingConfig(data, globalState); + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("payment-routing-test", () => { - let data = + const 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); + + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + cy.retrievePaymentCallTest(globalState, null); }); }); @@ -141,11 +130,8 @@ 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 = [ + const data = utils.getConnectorDetails("common")["priorityRouting"]; + const routing_data = [ { connector: "adyen", merchant_connector_id: globalState.get("adyenMcaId"), @@ -157,53 +143,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); + if (shouldContinue) shouldContinue = 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); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = utils.getConnectorDetails("common")["priorityRouting"]; + + cy.retrieveRoutingConfig(data, globalState); + if (shouldContinue) shouldContinue = 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); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + const data = utils.getConnectorDetails("common")["priorityRouting"]; + + cy.activateRoutingConfig(data, globalState); + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("payment-routing-test", () => { - let data = + const 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); + if (shouldContinue) shouldContinue = utils.should_continue_further(data); }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + cy.retrievePaymentCallTest(globalState, null); }); }); }); diff --git a/cypress-tests/cypress/e2e/RoutingTest/00001-VolumeBasedRouting.cy.js b/cypress-tests/cypress/e2e/RoutingTest/00001-VolumeBasedRouting.cy.js index 665afc97581e..7d7f75e3519b 100644 --- a/cypress-tests/cypress/e2e/RoutingTest/00001-VolumeBasedRouting.cy.js +++ b/cypress-tests/cypress/e2e/RoutingTest/00001-VolumeBasedRouting.cy.js @@ -51,11 +51,8 @@ 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 = [ + const data = utils.getConnectorDetails("common")["volumeBasedRouting"]; + const routing_data = [ { connector: { connector: "stripe", @@ -67,8 +64,7 @@ describe("Volume Based Routing Test", () => { cy.addRoutingConfig( fixtures.routingConfigBody, - req_data, - res_data, + data, "volume_split", routing_data, globalState @@ -76,28 +72,24 @@ 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); + const data = utils.getConnectorDetails("common")["volumeBasedRouting"]; + + 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); + const data = utils.getConnectorDetails("common")["volumeBasedRouting"]; + + cy.activateRoutingConfig(data, globalState); }); it("payment-routing-test", () => { - let data = + const 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 @@ -105,20 +97,18 @@ describe("Volume Based Routing Test", () => { }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + cy.retrievePaymentCallTest(globalState, null); }); it("create-payment-call-test-for-eps", () => { - let data = + const data = 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 @@ -130,13 +120,12 @@ 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"]; + const data = + utils.getConnectorDetails("stripe")["bank_redirect_pm"]["eps"]; + cy.confirmBankRedirectCallTest( fixtures.confirmBody, - req_data, - res_data, + data, true, globalState ); @@ -144,8 +133,8 @@ describe("Volume Based Routing Test", () => { it("Handle bank redirect redirection", () => { // return_url is a static url (https://hyperswitch.io) taken from confirm-body fixture and is not updated - let expected_redirection = fixtures.confirmBody["return_url"]; - let payment_method_type = globalState.get("paymentMethodType"); + const expected_redirection = fixtures.confirmBody["return_url"]; + const payment_method_type = globalState.get("paymentMethodType"); cy.handleBankRedirectRedirection( globalState, payment_method_type, @@ -177,11 +166,8 @@ 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 = [ + const data = utils.getConnectorDetails("common")["volumeBasedRouting"]; + const routing_data = [ { connector: { connector: "adyen", @@ -193,8 +179,7 @@ describe("Volume Based Routing Test", () => { cy.addRoutingConfig( fixtures.routingConfigBody, - req_data, - res_data, + data, "volume_split", routing_data, globalState @@ -202,28 +187,24 @@ 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); + const data = utils.getConnectorDetails("common")["volumeBasedRouting"]; + + 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); + const data = utils.getConnectorDetails("common")["volumeBasedRouting"]; + + cy.activateRoutingConfig(data, globalState); }); it("payment-routing-test-for-card", () => { - let data = + const 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 @@ -231,18 +212,16 @@ describe("Volume Based Routing Test", () => { }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + cy.retrievePaymentCallTest(globalState, null); }); it("create-payment-call-test-for-eps", () => { - let data = + const 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 @@ -254,13 +233,12 @@ 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"]; + const data = + utils.getConnectorDetails("adyen")["bank_redirect_pm"]["eps"]; + cy.confirmBankRedirectCallTest( fixtures.confirmBody, - req_data, - res_data, + data, true, globalState ); @@ -268,8 +246,8 @@ describe("Volume Based Routing Test", () => { it("Handle bank redirect redirection", () => { // return_url is a static url (https://hyperswitch.io) taken from confirm-body fixture and is not updated - let expected_redirection = fixtures.confirmBody["return_url"]; - let payment_method_type = globalState.get("paymentMethodType"); + const expected_redirection = fixtures.confirmBody["return_url"]; + const payment_method_type = globalState.get("paymentMethodType"); cy.handleBankRedirectRedirection( globalState, payment_method_type, diff --git a/cypress-tests/cypress/e2e/RoutingTest/00002-RuleBasedRouting.cy.js b/cypress-tests/cypress/e2e/RoutingTest/00002-RuleBasedRouting.cy.js index c98f34a55bb5..304668752cd1 100644 --- a/cypress-tests/cypress/e2e/RoutingTest/00002-RuleBasedRouting.cy.js +++ b/cypress-tests/cypress/e2e/RoutingTest/00002-RuleBasedRouting.cy.js @@ -51,11 +51,8 @@ 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 = { + const data = utils.getConnectorDetails("common")["ruleBasedRouting"]; + const routing_data = { defaultSelection: { type: "priority", data: [], @@ -121,8 +118,7 @@ describe("Rule Based Routing Test", () => { cy.addRoutingConfig( fixtures.routingConfigBody, - req_data, - res_data, + data, "advanced", routing_data, globalState @@ -130,28 +126,24 @@ 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); + const data = utils.getConnectorDetails("common")["volumeBasedRouting"]; + + 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); + const data = utils.getConnectorDetails("common")["ruleBasedRouting"]; + + cy.activateRoutingConfig(data, globalState); }); it("payment-routing-test for card", () => { - let data = + const 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 @@ -159,18 +151,16 @@ describe("Rule Based Routing Test", () => { }); it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); + cy.retrievePaymentCallTest(globalState, null); }); it("create-payment-routing-test for bank redirect", () => { - let data = + const 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 @@ -178,14 +168,12 @@ describe("Rule Based Routing Test", () => { }); it("Confirm bank redirect", () => { - let data = + const 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 ); @@ -193,8 +181,8 @@ describe("Rule Based Routing Test", () => { it("Handle bank redirect redirection", () => { // return_url is a static url (https://hyperswitch.io) taken from confirm-body fixture and is not updated - let expected_redirection = fixtures.confirmBody["return_url"]; - let payment_method_type = globalState.get("paymentMethodType"); + const expected_redirection = fixtures.confirmBody["return_url"]; + const payment_method_type = globalState.get("paymentMethodType"); cy.handleBankRedirectRedirection( globalState, payment_method_type, @@ -227,11 +215,8 @@ 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 = { + const data = utils.getConnectorDetails("common")["ruleBasedRouting"]; + const routing_data = { defaultSelection: { type: "priority", data: [ @@ -275,8 +260,7 @@ describe("Rule Based Routing Test", () => { cy.addRoutingConfig( fixtures.routingConfigBody, - req_data, - res_data, + data, "advanced", routing_data, globalState @@ -284,28 +268,24 @@ 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); + const data = utils.getConnectorDetails("common")["volumeBasedRouting"]; + + 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); + const data = utils.getConnectorDetails("common")["ruleBasedRouting"]; + + cy.activateRoutingConfig(data, globalState); }); it("create-payment-call-test-with-USD", () => { - let data = + const 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 @@ -313,31 +293,23 @@ describe("Rule Based Routing Test", () => { }); it("Confirm No 3DS", () => { - let data = + const 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", () => { - cy.retrievePaymentCallTest(globalState); + cy.retrievePaymentCallTest(globalState, null); }); 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"]; + const data = + utils.getConnectorDetails("adyen")["card_pm"]["PaymentIntent"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, - req_data, - res_data, + data, "no_three_ds", "automatic", globalState @@ -345,21 +317,14 @@ describe("Rule Based Routing Test", () => { }); it("Confirm No 3DS", () => { - let data = + const 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); + cy.retrievePaymentCallTest(globalState, null); }); }); @@ -389,11 +354,8 @@ 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 = { + const data = utils.getConnectorDetails("common")["ruleBasedRouting"]; + const routing_data = { defaultSelection: { type: "priority", data: [], @@ -453,8 +415,7 @@ describe("Rule Based Routing Test", () => { cy.addRoutingConfig( fixtures.routingConfigBody, - req_data, - res_data, + data, "advanced", routing_data, globalState @@ -462,28 +423,24 @@ 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); + const data = utils.getConnectorDetails("common")["volumeBasedRouting"]; + + 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); + const data = utils.getConnectorDetails("common")["ruleBasedRouting"]; + + cy.activateRoutingConfig(data, globalState); }); it("create-payment-call-test-with-amount-10", () => { - let data = + const 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 @@ -491,32 +448,23 @@ describe("Rule Based Routing Test", () => { }); it("Confirm No 3DS", () => { - let data = + const 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", () => { - cy.retrievePaymentCallTest(globalState); + cy.retrievePaymentCallTest(globalState, null); }); it("create-payment-call-test-with-amount-9", () => { - let data = + const 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 @@ -524,20 +472,13 @@ describe("Rule Based Routing Test", () => { }); it("Confirm No 3DS", () => { - let data = + const 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); + 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 79b3d3cba7c4..74c02d7ac9fd 100644 --- a/cypress-tests/cypress/e2e/RoutingTest/00003-Retries.cy.js +++ b/cypress-tests/cypress/e2e/RoutingTest/00003-Retries.cy.js @@ -42,7 +42,7 @@ describe("Auto Retries & Step Up 3DS", () => { context("Auto Retries", () => { context("[Config: enable] Auto retries", () => { it("Enable auto retries", () => { - cy.updateConfig('autoRetry', fixtures.configs.gsm, globalState, "true"); + cy.updateConfig("autoRetry", globalState, "true"); }); context("Max auto retries", () => { @@ -59,11 +59,9 @@ 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 = [ + const data = + utils.getConnectorDetails("common")["priorityRouting"]; + const routing_data = [ { connector: "adyen", merchant_connector_id: globalState.get("adyenMcaId"), @@ -79,8 +77,7 @@ describe("Auto Retries & Step Up 3DS", () => { ]; cy.addRoutingConfig( fixtures.routingConfigBody, - req_data, - res_data, + data, "priority", routing_data, globalState @@ -88,36 +85,29 @@ 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); + const data = + utils.getConnectorDetails("common")["priorityRouting"]; + + cy.activateRoutingConfig(data, globalState); }); }); context("Max auto retries = 2", () => { const max_auto_retries = 2; it("Update max auto retries", () => { - cy.updateConfig( - 'maxRetries', - fixtures.configs.max_auto_retries, - globalState, - `${max_auto_retries}` - ); + cy.updateConfig("maxRetries", globalState, `${max_auto_retries}`); }); context("Make payment", () => { it("Payment create call", () => { - let data = + const data = 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 @@ -125,16 +115,14 @@ describe("Auto Retries & Step Up 3DS", () => { }); it("Payment confirm call", () => { - let data = + const data = 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 ); @@ -143,6 +131,7 @@ describe("Auto Retries & Step Up 3DS", () => { it("Payment retrieve call", () => { cy.retrievePaymentCallTest( globalState, + null, true, max_auto_retries + 1 ); @@ -153,26 +142,19 @@ describe("Auto Retries & Step Up 3DS", () => { context("Max auto retries = 1", () => { const max_auto_retries = 1; it("Update max auto retries", () => { - cy.updateConfig( - 'maxRetries', - fixtures.configs.max_auto_retries, - globalState, - `${max_auto_retries}` - ); + cy.updateConfig("maxRetries", globalState, `${max_auto_retries}`); }); context("Make payment", () => { it("Payment create call", () => { - let data = + const data = 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 @@ -180,16 +162,14 @@ describe("Auto Retries & Step Up 3DS", () => { }); it("Payment confirm call", () => { - let data = + const data = 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 ); @@ -198,6 +178,7 @@ describe("Auto Retries & Step Up 3DS", () => { it("Payment retrieve call", () => { cy.retrievePaymentCallTest( globalState, + null, true, max_auto_retries + 1 ); @@ -207,26 +188,19 @@ describe("Auto Retries & Step Up 3DS", () => { context("Max auto retries = 0", () => { const max_auto_retries = 0; it("Update max auto retries", () => { - cy.updateConfig( - 'maxRetries', - fixtures.configs.max_auto_retries, - globalState, - `${max_auto_retries}` - ); + cy.updateConfig("maxRetries", globalState, `${max_auto_retries}`); }); context("Make payment", () => { it("Payment create call", () => { - let data = + const data = 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 @@ -234,16 +208,14 @@ describe("Auto Retries & Step Up 3DS", () => { }); it("Payment confirm call", () => { - let data = + const data = 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 ); @@ -252,6 +224,7 @@ describe("Auto Retries & Step Up 3DS", () => { it("Payment retrieve call", () => { cy.retrievePaymentCallTest( globalState, + null, true, max_auto_retries + 1 ); @@ -273,11 +246,9 @@ 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 = [ + const data = + utils.getConnectorDetails("common")["priorityRouting"]; + const routing_data = [ { connector: "stripe", merchant_connector_id: globalState.get("stripeMcaId"), @@ -293,8 +264,7 @@ describe("Auto Retries & Step Up 3DS", () => { ]; cy.addRoutingConfig( fixtures.routingConfigBody, - req_data, - res_data, + data, "priority", routing_data, globalState @@ -302,36 +272,29 @@ 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); + const data = + utils.getConnectorDetails("common")["priorityRouting"]; + + cy.activateRoutingConfig(data, globalState); }); }); context("Max auto retries = 2", () => { const max_auto_retries = 2; it("Update max auto retries", () => { - cy.updateConfig( - 'maxRetries', - fixtures.configs.max_auto_retries, - globalState, - `${max_auto_retries}` - ); + cy.updateConfig("maxRetries", globalState, `${max_auto_retries}`); }); context("Make payment", () => { it("Payment create call", () => { - let data = + const data = 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 @@ -339,16 +302,14 @@ describe("Auto Retries & Step Up 3DS", () => { }); it("Payment confirm call", () => { - let data = + const data = 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 ); @@ -357,6 +318,7 @@ describe("Auto Retries & Step Up 3DS", () => { it("Payment retrieve call", () => { cy.retrievePaymentCallTest( globalState, + null, true, max_auto_retries + 1 ); @@ -367,26 +329,19 @@ describe("Auto Retries & Step Up 3DS", () => { context("Max auto retries = 1", () => { const max_auto_retries = 1; it("Update max auto retries", () => { - cy.updateConfig( - 'maxRetries', - fixtures.configs.max_auto_retries, - globalState, - `${max_auto_retries}` - ); + cy.updateConfig("maxRetries", globalState, `${max_auto_retries}`); }); context("Make payment", () => { it("Payment create call", () => { - let data = + const data = 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 @@ -394,16 +349,14 @@ describe("Auto Retries & Step Up 3DS", () => { }); it("Payment confirm call", () => { - let data = + const data = 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 ); @@ -412,6 +365,7 @@ describe("Auto Retries & Step Up 3DS", () => { it("Payment retrieve call", () => { cy.retrievePaymentCallTest( globalState, + null, true, max_auto_retries + 1 ); @@ -422,26 +376,19 @@ describe("Auto Retries & Step Up 3DS", () => { context("Max auto retries = 0", () => { const max_auto_retries = 0; it("Update max auto retries", () => { - cy.updateConfig( - 'maxRetries', - fixtures.configs.max_auto_retries, - globalState, - `${max_auto_retries}` - ); + cy.updateConfig("maxRetries", globalState, `${max_auto_retries}`); }); context("Make payment", () => { it("Payment create call", () => { - let data = + const data = 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 @@ -449,16 +396,14 @@ describe("Auto Retries & Step Up 3DS", () => { }); it("Payment confirm call", () => { - let data = + const data = 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 ); @@ -467,6 +412,7 @@ describe("Auto Retries & Step Up 3DS", () => { it("Payment retrieve call", () => { cy.retrievePaymentCallTest( globalState, + null, true, max_auto_retries + 1 ); @@ -483,32 +429,25 @@ describe("Auto Retries & Step Up 3DS", () => { }); it("[Config: enable] Step up for Stripe", () => { - cy.updateConfig('stepUp',fixtures.configs.step_up, globalState, '["stripe"]'); + cy.updateConfig("stepUp", globalState, '["stripe"]'); }); }); context("Make Payment", () => { const max_auto_retries = 1; it("Update max auto retries", () => { - cy.updateConfig( - 'maxRetries', - fixtures.configs.max_auto_retries, - globalState, - `${max_auto_retries}` - ); + cy.updateConfig("maxRetries", globalState, `${max_auto_retries}`); }); it("Payment create call", () => { - let data = + const data = 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 @@ -516,23 +455,21 @@ describe("Auto Retries & Step Up 3DS", () => { }); it("Payment confirm call", () => { - let data = + const data = 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", () => { - cy.retrievePaymentCallTest(globalState, true, max_auto_retries + 1); + cy.retrievePaymentCallTest( + globalState, + null, + true, + max_auto_retries + 1 + ); }); }); }); @@ -540,8 +477,8 @@ describe("Auto Retries & Step Up 3DS", () => { context("[Config: disable] Auto retries", () => { it("[Config: disable] Auto retries", () => { - cy.updateConfig('autoRetry', fixtures.configs.gsm, globalState, "false"); - }); + cy.updateConfig("autoRetry", globalState, "false"); + }); it("[Config: disable] Step up GSM", () => { cy.updateGsmConfig(fixtures.gsmBody.gsm_update, globalState, false); @@ -550,16 +487,14 @@ describe("Auto Retries & Step Up 3DS", () => { context("Make payment", () => { context("[Failed] Make payment", () => { it("Payment create call", () => { - let data = + const data = 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 @@ -567,38 +502,29 @@ describe("Auto Retries & Step Up 3DS", () => { }); it("Payment confirm call", () => { - let data = + const data = 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", () => { - cy.retrievePaymentCallTest(globalState, true); + cy.retrievePaymentCallTest(globalState, null, true); }); }); context("[Succeeded] Make payment", () => { it("Payment create call", () => { - let data = + const data = 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 @@ -606,23 +532,16 @@ describe("Auto Retries & Step Up 3DS", () => { }); it("Payment confirm call", () => { - let data = + const data = 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", () => { - cy.retrievePaymentCallTest(globalState, true); + cy.retrievePaymentCallTest(globalState, null, true); }); }); }); diff --git a/cypress-tests/cypress/e2e/RoutingUtils/Commons.js b/cypress-tests/cypress/e2e/RoutingUtils/Commons.js index 7723ec7749b3..1131f5e671ee 100644 --- a/cypress-tests/cypress/e2e/RoutingUtils/Commons.js +++ b/cypress-tests/cypress/e2e/RoutingUtils/Commons.js @@ -51,11 +51,4 @@ export const connectorDetails = { body: {}, }, }, - jwt: { - Request: {}, - Response: { - status: 200, - body: {}, - }, - }, }; diff --git a/cypress-tests/cypress/e2e/RoutingUtils/Utils.js b/cypress-tests/cypress/e2e/RoutingUtils/Utils.js index ad92999c2874..a661c5d49924 100644 --- a/cypress-tests/cypress/e2e/RoutingUtils/Utils.js +++ b/cypress-tests/cypress/e2e/RoutingUtils/Utils.js @@ -11,7 +11,7 @@ const connectorDetails = { }; export const getConnectorDetails = (connectorId) => { - let x = getValueByKey(connectorDetails, connectorId); + const x = getValueByKey(connectorDetails, connectorId); return x; }; @@ -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/fixtures/create-ntid-mit.json b/cypress-tests/cypress/fixtures/create-ntid-mit.json index 61e86828338b..0673220b54d4 100644 --- a/cypress-tests/cypress/fixtures/create-ntid-mit.json +++ b/cypress-tests/cypress/fixtures/create-ntid-mit.json @@ -1,49 +1,48 @@ { - "amount": 999, - "currency": "USD", - "confirm": true, - "payment_method": "card", - "return_url": "https://hyperswitch.io", - "email": "example@email.com", - "recurring_details": { - "type": "network_transaction_id_and_card_details", - "data": { - "card_number": "4242424242424242", - "card_exp_month": "11", - "card_exp_year": "2050", - "card_holder_name": "joseph Doe", - "network_transaction_id": "MCC5ZRGMI0925" - } - }, - "off_session": true, - "billing": { - "address": { - "first_name": "John", - "last_name": "Doe", - "line1": "1467", - "line2": "Harrison Street", - "line3": "Harrison Street", - "city": "San Fransico", - "state": "California", - "zip": "94122", - "country": "US" - }, - "phone": { - "number": "9123456789", - "country_code": "+91" - } + "amount": 999, + "currency": "USD", + "confirm": true, + "payment_method": "card", + "return_url": "https://hyperswitch.io", + "email": "example@email.com", + "recurring_details": { + "type": "network_transaction_id_and_card_details", + "data": { + "card_number": "4242424242424242", + "card_exp_month": "11", + "card_exp_year": "2050", + "card_holder_name": "joseph Doe", + "network_transaction_id": "MCC5ZRGMI0925" + } + }, + "off_session": true, + "billing": { + "address": { + "first_name": "John", + "last_name": "Doe", + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US" }, - "browser_info": { - "ip_address": "129.0.0.1", - "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36", - "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", - "language": "en-US", - "color_depth": 30, - "screen_height": 1117, - "screen_width": 1728, - "time_zone": -330, - "java_enabled": true, - "java_script_enabled": true + "phone": { + "number": "9123456789", + "country_code": "+91" } + }, + "browser_info": { + "ip_address": "129.0.0.1", + "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36", + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", + "language": "en-US", + "color_depth": 30, + "screen_height": 1117, + "screen_width": 1728, + "time_zone": -330, + "java_enabled": true, + "java_script_enabled": true } - \ No newline at end of file +} diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js index 5a6e1b4783e4..95b981bc6001 100644 --- a/cypress-tests/cypress/support/commands.js +++ b/cypress-tests/cypress/support/commands.js @@ -26,6 +26,7 @@ // commands.js or your custom support file import { defaultErrorHandler, getValueByKey } from "../e2e/PaymentUtils/Utils"; +import { execConfig, validateConfig } from "../utils/featureFlags"; import * as RequestBodyUtils from "../utils/RequestBodyUtils"; import { handleRedirection } from "./redirectionHandler"; @@ -166,23 +167,30 @@ Cypress.Commands.add( Cypress.Commands.add( "createBusinessProfileTest", - (createBusinessProfile, globalState) => { + (createBusinessProfile, globalState, profile_prefix = "profile") => { + const api_key = globalState.get("adminApiKey"); + const base_url = globalState.get("baseUrl"); + const connector_id = globalState.get("connectorId"); const merchant_id = globalState.get("merchantId"); - const randomProfileName = `profile_${Math.random().toString(36).substring(7)}`; - createBusinessProfile.profile_name = randomProfileName; + const profile_name = `${connector_id}_${profile_prefix}_${Math.random().toString(36).substring(7)}`; + const url = `${base_url}/account/${merchant_id}/business_profile`; + + createBusinessProfile.profile_name = profile_name; + cy.request({ method: "POST", - url: `${globalState.get("baseUrl")}/account/${merchant_id}/business_profile`, + url: url, headers: { Accept: "application/json", "Content-Type": "application/json", - "api-key": globalState.get("adminApiKey"), + "api-key": api_key, }, body: createBusinessProfile, failOnStatusCode: false, }).then((response) => { logRequestId(response.headers["x-request-id"]); - globalState.set("profileId", response.body.profile_id); + globalState.set(`${profile_prefix}Id`, response.body.profile_id); + if (response.status === 200) { expect(response.body.profile_id).to.not.to.be.null; } else { @@ -379,9 +387,14 @@ Cypress.Commands.add( payment_methods_enabled, globalState, connectorName, - connectorLabel + connectorLabel, + profile_prefix = "profile", + mca_prefix = "merchantConnector" ) => { const merchantId = globalState.get("merchantId"); + const profile_id = globalState.get(`${profile_prefix}Id`); + + createConnectorBody.profile_id = profile_id; createConnectorBody.connector_type = connectorType; createConnectorBody.connector_name = connectorName; createConnectorBody.connector_label = connectorLabel; @@ -412,7 +425,7 @@ Cypress.Commands.add( if (response.status === 200) { expect(connectorName).to.equal(response.body.connector_name); globalState.set( - "merchantConnectorId", + `${mca_prefix}Id`, response.body.merchant_connector_id ); } else { @@ -437,21 +450,31 @@ Cypress.Commands.add( connectorType, createConnectorBody, payment_methods_enabled, - globalState + globalState, + profile_prefix = "profile", + mca_prefix = "merchantConnector" ) => { - const merchantId = globalState.get("merchantId"); + const api_key = globalState.get("adminApiKey"); + const base_url = globalState.get("baseUrl"); + const connector_id = globalState.get("connectorId"); + const merchant_id = globalState.get("merchantId"); + const profile_id = globalState.get(`${profile_prefix}Id`); + const url = `${base_url}/account/${merchant_id}/connectors`; + createConnectorBody.connector_type = connectorType; - createConnectorBody.profile_id = globalState.get("profileId"); - createConnectorBody.connector_name = globalState.get("connectorId"); + createConnectorBody.profile_id = profile_id; + createConnectorBody.connector_name = connector_id; createConnectorBody.payment_methods_enabled = payment_methods_enabled; + // readFile is used to read the contents of the file and it always returns a promise ([Object Object]) due to its asynchronous nature // it is best to use then() to handle the response within the same block of code cy.readFile(globalState.get("connectorAuthFilePath")).then( (jsonContent) => { const authDetails = getValueByKey( JSON.stringify(jsonContent), - globalState.get("connectorId") + connector_id ); + createConnectorBody.connector_account_details = authDetails.connector_account_details; @@ -464,11 +487,11 @@ Cypress.Commands.add( cy.request({ method: "POST", - url: `${globalState.get("baseUrl")}/account/${merchantId}/connectors`, + url: url, headers: { - "Content-Type": "application/json", Accept: "application/json", - "api-key": globalState.get("adminApiKey"), + "Content-Type": "application/json", + "api-key": api_key, }, body: createConnectorBody, failOnStatusCode: false, @@ -479,9 +502,8 @@ Cypress.Commands.add( expect(globalState.get("connectorId")).to.equal( response.body.connector_name ); - globalState.set("profileId", response.body.profile_id); globalState.set( - "merchantConnectorId", + `${mca_prefix}Id`, response.body.merchant_connector_id ); } else { @@ -504,7 +526,7 @@ Cypress.Commands.add( "createPayoutConnectorCallTest", (connectorType, createConnectorBody, globalState) => { const merchantId = globalState.get("merchantId"); - let connectorName = globalState.get("connectorId"); + const connectorName = globalState.get("connectorId"); createConnectorBody.connector_type = connectorType; createConnectorBody.connector_name = connectorName; createConnectorBody.connector_type = "payout_processor"; @@ -514,7 +536,7 @@ Cypress.Commands.add( // it is best to use then() to handle the response within the same block of code cy.readFile(globalState.get("connectorAuthFilePath")).then( (jsonContent) => { - let authDetails = getValueByKey( + const authDetails = getValueByKey( JSON.stringify(jsonContent), `${connectorName}_payout` ); @@ -621,18 +643,22 @@ Cypress.Commands.add("connectorDeleteCall", (globalState) => { Cypress.Commands.add( "connectorUpdateCall", (connectorType, updateConnectorBody, globalState) => { - const merchant_id = globalState.get("merchantId"); + const api_key = globalState.get("adminApiKey"); + const base_url = globalState.get("baseUrl"); const connector_id = globalState.get("connectorId"); + const merchant_id = globalState.get("merchantId"); const merchant_connector_id = globalState.get("merchantConnectorId"); + const url = `${base_url}/account/${merchant_id}/connectors/${merchant_connector_id}`; + updateConnectorBody.connector_type = connectorType; cy.request({ method: "POST", - url: `${globalState.get("baseUrl")}/account/${merchant_id}/connectors/${merchant_connector_id}`, + url: url, headers: { Accept: "application/json", "Content-Type": "application/json", - "api-key": globalState.get("adminApiKey"), + "api-key": api_key, "x-merchant-id": merchant_id, }, body: updateConnectorBody, @@ -804,7 +830,7 @@ Cypress.Commands.add("customerDeleteCall", (globalState) => { Cypress.Commands.add( "paymentMethodListTestLessThanEqualToOnePaymentMethod", - (res_data, globalState) => { + (resData, globalState) => { cy.request({ method: "GET", url: `${globalState.get("baseUrl")}/account/payment_methods?client_secret=${globalState.get("clientSecret")}`, @@ -819,20 +845,20 @@ Cypress.Commands.add( expect(response.headers["content-type"]).to.include("application/json"); if (response.status === 200) { expect(response.body).to.have.property("currency"); - if (res_data["payment_methods"].length == 1) { + if (resData["payment_methods"].length == 1) { function getPaymentMethodType(obj) { return obj["payment_methods"][0]["payment_method_types"][0][ "payment_method_type" ]; } - expect(getPaymentMethodType(res_data)).to.equal( + expect(getPaymentMethodType(resData)).to.equal( getPaymentMethodType(response.body) ); } else { expect(0).to.equal(response.body["payment_methods"].length); } } else { - defaultErrorHandler(response, res_data); + defaultErrorHandler(response, resData); } }); } @@ -840,7 +866,7 @@ Cypress.Commands.add( Cypress.Commands.add( "paymentMethodListTestTwoConnectorsForOnePaymentMethodCredit", - (res_data, globalState) => { + (resData, globalState) => { cy.request({ method: "GET", url: `${globalState.get("baseUrl")}/account/payment_methods?client_secret=${globalState.get("clientSecret")}`, @@ -855,7 +881,7 @@ Cypress.Commands.add( expect(response.headers["content-type"]).to.include("application/json"); if (response.status === 200) { expect(response.body).to.have.property("currency"); - if (res_data["payment_methods"].length > 0) { + if (resData["payment_methods"].length > 0) { function getPaymentMethodType(obj) { return obj["payment_methods"][0]["payment_method_types"][0][ "card_networks" @@ -863,8 +889,8 @@ Cypress.Commands.add( .slice() .sort(); } - let config_payment_method_type = getPaymentMethodType(res_data); - let response_payment_method_type = getPaymentMethodType( + const config_payment_method_type = getPaymentMethodType(resData); + const response_payment_method_type = getPaymentMethodType( response.body ); for (let i = 0; i < response_payment_method_type.length; i++) { @@ -876,13 +902,13 @@ Cypress.Commands.add( expect(0).to.equal(response.body["payment_methods"].length); } } else { - defaultErrorHandler(response, res_data); + defaultErrorHandler(response, resData); } }); } ); -Cypress.Commands.add("sessionTokenCall", (apiKeyCreateBody, globalState) => { +Cypress.Commands.add("sessionTokenCall", (globalState, sessionTokenBody) => { cy.request({ method: "POST", url: `${globalState.get("baseUrl")}/payments/session_tokens`, @@ -902,30 +928,40 @@ Cypress.Commands.add( "createPaymentIntentTest", ( createPaymentBody, - req_data, - res_data, + data, authentication_type, capture_method, globalState ) => { + const { + Configs: configs = {}, + Request: reqData, + Response: resData, + } = data || {}; + if ( !createPaymentBody || typeof createPaymentBody !== "object" || - !req_data.currency + !reqData.currency ) { throw new Error( "Invalid parameters provided to createPaymentIntentTest command" ); } - for (const key in req_data) { - createPaymentBody[key] = req_data[key]; + const config_info = execConfig(validateConfig(configs)); + const profile_id = globalState.get(config_info.profile_id); + + for (const key in reqData) { + createPaymentBody[key] = reqData[key]; } createPaymentBody.authentication_type = authentication_type; createPaymentBody.capture_method = capture_method; createPaymentBody.customer_id = globalState.get("customerId"); - createPaymentBody.profile_id = globalState.get("profileId"); + createPaymentBody.profile_id = profile_id; + globalState.set("paymentAmount", createPaymentBody.amount); + cy.request({ method: "POST", url: `${globalState.get("baseUrl")}/payments`, @@ -941,16 +977,16 @@ Cypress.Commands.add( expect(response.headers["content-type"]).to.include("application/json"); - if (res_data.status === 200) { + if (resData.status === 200) { expect(response.body).to.have.property("client_secret"); const clientSecret = response.body.client_secret; globalState.set("clientSecret", clientSecret); globalState.set("paymentID", response.body.payment_id); cy.log(clientSecret); - for (const key in res_data.body) { - expect(res_data.body[key]).to.equal( + for (const key in resData.body) { + expect(resData.body[key]).to.equal( response.body[key], - `Expected ${res_data.body[key]} but got ${response.body[key]}` + `Expected ${resData.body[key]} but got ${response.body[key]}` ); } expect(response.body.payment_id, "payment_id").to.not.be.null; @@ -1012,7 +1048,7 @@ Cypress.Commands.add( expect(response.body.connector_mandate_id, "connector_mandate_id").to.be .null; } else { - defaultErrorHandler(response, res_data); + defaultErrorHandler(response, resData); } }); } @@ -1067,52 +1103,51 @@ 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 { Request: reqData, Response: resData } = 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"]); + reqData.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: reqData, + failOnStatusCode: false, + }).then((response) => { + logRequestId(response.headers["x-request-id"]); -Cypress.Commands.add("deletePaymentMethodTest", (globalState, res_data) => { + 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(reqData.payment_method_type, "payment_method_type").to.equal( + response.body.payment_method_type + ); + expect(reqData.payment_method, "payment_method").to.equal( + response.body.payment_method + ); + expect(response.body.last_used_at, "last_used_at").to.not.be.null; + expect(reqData.customer_id, "customer_id").to.equal( + response.body.customer_id + ); + globalState.set("paymentMethodId", response.body.payment_method_id); + } else { + defaultErrorHandler(response, resData); + } + }); +}); + +Cypress.Commands.add("deletePaymentMethodTest", (globalState, resData) => { const payment_method_id = globalState.get("paymentMethodId"); cy.request({ method: "DELETE", @@ -1130,7 +1165,7 @@ Cypress.Commands.add("deletePaymentMethodTest", (globalState, res_data) => { expect(response.body.payment_method_id).to.equal(payment_method_id); expect(response.body.deleted).to.be.true; } else { - defaultErrorHandler(response, res_data); + defaultErrorHandler(response, resData); } }); }); @@ -1162,19 +1197,37 @@ Cypress.Commands.add("setDefaultPaymentMethodTest", (globalState) => { Cypress.Commands.add( "confirmCallTest", - (confirmBody, req_data, res_data, confirm, globalState) => { + (confirmBody, data, confirm, globalState) => { + const { + Configs: configs = {}, + Request: reqData, + Response: resData, + } = data || {}; + + const apiKey = globalState.get("publishableKey"); + const baseUrl = globalState.get("baseUrl"); + const configInfo = execConfig(validateConfig(configs)); + const merchantConnectorId = globalState.get( + configInfo.merchant_connector_id + ); const paymentIntentID = globalState.get("paymentID"); - confirmBody.confirm = confirm; + const profileId = globalState.get(configInfo.profile_id); + const url = `${baseUrl}/payments/${paymentIntentID}/confirm`; + confirmBody.client_secret = globalState.get("clientSecret"); - for (const key in req_data) { - confirmBody[key] = req_data[key]; + confirmBody.confirm = confirm; + confirmBody.profile_id = profileId; + + for (const key in reqData) { + confirmBody[key] = reqData[key]; } + cy.request({ method: "POST", - url: `${globalState.get("baseUrl")}/payments/${paymentIntentID}/confirm`, + url: url, headers: { "Content-Type": "application/json", - "api-key": globalState.get("publishableKey"), + "api-key": apiKey, }, failOnStatusCode: false, body: confirmBody, @@ -1192,12 +1245,13 @@ Cypress.Commands.add( ); expect(response.body.payment_method_data, "payment_method_data").to.not .be.empty; - expect(globalState.get("merchantConnectorId"), "connector_id").to.equal( + expect(merchantConnectorId, "connector_id").to.equal( response.body.merchant_connector_id ); expect(response.body.customer, "customer").to.not.be.empty; expect(response.body.billing, "billing_address").to.not.be.empty; - expect(response.body.profile_id, "profile_id").to.not.be.null; + expect(response.body.profile_id, "profile_id").to.equal(profileId).and + .to.not.be.null; if (response.body.capture_method === "automatic") { if (response.body.authentication_type === "three_ds") { @@ -1208,14 +1262,14 @@ Cypress.Commands.add( "nextActionUrl", response.body.next_action.redirect_to_url ); - for (const key in res_data.body) { - expect(res_data.body[key], [key]).to.deep.equal( + for (const key in resData.body) { + expect(resData.body[key], [key]).to.deep.equal( response.body[key] ); } } else if (response.body.authentication_type === "no_three_ds") { - for (const key in res_data.body) { - expect(res_data.body[key], [key]).to.deep.equal( + for (const key in resData.body) { + expect(resData.body[key], [key]).to.deep.equal( response.body[key] ); } @@ -1233,14 +1287,14 @@ Cypress.Commands.add( "nextActionUrl", response.body.next_action.redirect_to_url ); - for (const key in res_data.body) { - expect(res_data.body[key], [key]).to.deep.equal( + for (const key in resData.body) { + expect(resData.body[key], [key]).to.deep.equal( response.body[key] ); } } else if (response.body.authentication_type === "no_three_ds") { - for (const key in res_data.body) { - expect(res_data.body[key], [key]).to.deep.equal( + for (const key in resData.body) { + expect(resData.body[key], [key]).to.deep.equal( response.body[key] ); } @@ -1255,7 +1309,7 @@ Cypress.Commands.add( ); } } else { - defaultErrorHandler(response, res_data); + defaultErrorHandler(response, resData); } }); } @@ -1263,14 +1317,24 @@ Cypress.Commands.add( Cypress.Commands.add( "confirmBankRedirectCallTest", - (confirmBody, req_data, res_data, confirm, globalState) => { - const paymentIntentId = globalState.get("paymentID"); + (confirmBody, data, confirm, globalState) => { + const { + Configs: configs = {}, + Request: reqData, + Response: resData, + } = data || {}; + + const config_info = execConfig(validateConfig(configs)); const connectorId = globalState.get("connectorId"); - for (const key in req_data) { - confirmBody[key] = req_data[key]; + const paymentIntentId = globalState.get("paymentID"); + const profile_id = globalState.get(config_info.profile_id); + + for (const key in reqData) { + confirmBody[key] = reqData[key]; } - confirmBody.confirm = confirm; confirmBody.client_secret = globalState.get("clientSecret"); + confirmBody.confirm = confirm; + confirmBody.profile_id = profile_id; cy.request({ method: "POST", @@ -1316,7 +1380,7 @@ Cypress.Commands.add( } } else if (response.body.status === "failed") { expect(response.body.error_code).to.equal( - res_data.body.error_code + resData.body.error_code ); } } else { @@ -1349,7 +1413,7 @@ Cypress.Commands.add( ); } } else { - defaultErrorHandler(response, res_data); + defaultErrorHandler(response, resData); } }); } @@ -1357,13 +1421,24 @@ Cypress.Commands.add( Cypress.Commands.add( "confirmBankTransferCallTest", - (confirmBody, req_data, res_data, confirm, globalState) => { + (confirmBody, data, confirm, globalState) => { + const { + Configs: configs = {}, + Request: reqData, + Response: resData, + } = data || {}; + + const config_info = execConfig(validateConfig(configs)); const paymentIntentID = globalState.get("paymentID"); - for (const key in req_data) { - confirmBody[key] = req_data[key]; + const profile_id = globalState.get(config_info.profile_id); + + for (const key in reqData) { + confirmBody[key] = reqData[key]; } - confirmBody.confirm = confirm; confirmBody.client_secret = globalState.get("clientSecret"); + confirmBody.confirm = confirm; + confirmBody.profile_id = globalState.get(profile_id); + globalState.set("paymentMethodType", confirmBody.payment_method_type); cy.request({ @@ -1419,7 +1494,7 @@ Cypress.Commands.add( ); } } else { - defaultErrorHandler(response, res_data); + defaultErrorHandler(response, resData); } }); } @@ -1427,13 +1502,24 @@ Cypress.Commands.add( Cypress.Commands.add( "confirmUpiCall", - (confirmBody, req_data, res_data, confirm, globalState) => { + (confirmBody, data, confirm, globalState) => { + const { + Configs: configs = {}, + Request: reqData, + Response: resData, + } = data || {}; + + const config_info = execConfig(validateConfig(configs)); const paymentId = globalState.get("paymentID"); - for (const key in req_data) { - confirmBody[key] = req_data[key]; + const profile_id = globalState.get(config_info.profile_id); + + for (const key in reqData) { + confirmBody[key] = reqData[key]; } - confirmBody.confirm = confirm; confirmBody.client_secret = globalState.get("clientSecret"); + confirmBody.confirm = confirm; + confirmBody.profile_id = profile_id; + globalState.set("paymentMethodType", confirmBody.payment_method_type); cy.request({ @@ -1476,7 +1562,7 @@ Cypress.Commands.add( ); } } else { - defaultErrorHandler(response, res_data); + defaultErrorHandler(response, resData); } }); } @@ -1486,19 +1572,31 @@ Cypress.Commands.add( "createConfirmPaymentTest", ( createConfirmPaymentBody, - req_data, - res_data, + data, authentication_type, capture_method, globalState ) => { + const { + Configs: configs = {}, + Request: reqData, + Response: resData, + } = data || {}; + + const config_info = execConfig(validateConfig(configs)); + const merchant_connector_id = globalState.get( + config_info.merchant_connector_id + ); + const profile_id = globalState.get(config_info.profile_id); + createConfirmPaymentBody.authentication_type = authentication_type; createConfirmPaymentBody.capture_method = capture_method; createConfirmPaymentBody.customer_id = globalState.get("customerId"); - createConfirmPaymentBody.profile_id = globalState.get("profileId"); - for (const key in req_data) { - createConfirmPaymentBody[key] = req_data[key]; + createConfirmPaymentBody.profile_id = profile_id; + for (const key in reqData) { + createConfirmPaymentBody[key] = reqData[key]; } + cy.request({ method: "POST", url: `${globalState.get("baseUrl")}/payments`, @@ -1510,8 +1608,11 @@ Cypress.Commands.add( body: createConfirmPaymentBody, }).then((response) => { logRequestId(response.headers["x-request-id"]); + globalState.set("clientSecret", response.body.client_secret); + expect(response.headers["content-type"]).to.include("application/json"); + if (response.status === 200) { globalState.set("paymentAmount", createConfirmPaymentBody.amount); globalState.set("paymentID", response.body.payment_id); @@ -1524,12 +1625,13 @@ Cypress.Commands.add( expect(response.body.payment_method_data, "payment_method_data").to.not .be.empty; expect(response.body.merchant_connector_id, "connector_id").to.equal( - globalState.get("merchantConnectorId") + merchant_connector_id ); expect(response.body.customer, "customer").to.not.be.empty; expect(response.body.billing, "billing_address").to.not.be.empty; expect(response.body.profile_id, "profile_id").to.not.be.null; expect(response.body).to.have.property("status"); + if (response.body.capture_method === "automatic") { if (response.body.authentication_type === "three_ds") { expect(response.body) @@ -1539,14 +1641,14 @@ Cypress.Commands.add( "nextActionUrl", response.body.next_action.redirect_to_url ); - for (const key in res_data.body) { - expect(res_data.body[key], [key]).to.deep.equal( + for (const key in resData.body) { + expect(resData.body[key], [key]).to.deep.equal( response.body[key] ); } } else if (response.body.authentication_type === "no_three_ds") { - for (const key in res_data.body) { - expect(res_data.body[key], [key]).to.deep.equal( + for (const key in resData.body) { + expect(resData.body[key], [key]).to.deep.equal( response.body[key] ); } @@ -1564,14 +1666,14 @@ Cypress.Commands.add( "nextActionUrl", response.body.next_action.redirect_to_url ); - for (const key in res_data.body) { - expect(res_data.body[key], [key]).to.deep.equal( + for (const key in resData.body) { + expect(resData.body[key], [key]).to.deep.equal( response.body[key] ); } } else if (response.body.authentication_type === "no_three_ds") { - for (const key in res_data.body) { - expect(res_data.body[key], [key]).to.deep.equal( + for (const key in resData.body) { + expect(resData.body[key], [key]).to.deep.equal( response.body[key] ); } @@ -1582,7 +1684,7 @@ Cypress.Commands.add( } } } else { - defaultErrorHandler(response, res_data); + defaultErrorHandler(response, resData); } }); } @@ -1591,16 +1693,30 @@ 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) => { + (saveCardConfirmBody, data, globalState) => { + const { + Configs: configs = {}, + Request: reqData, + Response: resData, + } = data || {}; + + const config_info = execConfig(validateConfig(configs)); + const merchant_connector_id = globalState.get( + config_info.merchant_connector_id + ); const paymentIntentID = globalState.get("paymentID"); - if (req_data.setup_future_usage === "on_session") { - saveCardConfirmBody.card_cvc = req_data.payment_method_data.card.card_cvc; + const profile_id = globalState.get(config_info.profile_id); + + if (reqData.setup_future_usage === "on_session") { + saveCardConfirmBody.card_cvc = reqData.payment_method_data.card.card_cvc; } - saveCardConfirmBody.payment_token = globalState.get("paymentToken"); saveCardConfirmBody.client_secret = globalState.get("clientSecret"); - for (const key in req_data) { - saveCardConfirmBody[key] = req_data[key]; + saveCardConfirmBody.payment_token = globalState.get("paymentToken"); + saveCardConfirmBody.profile_id = profile_id; + for (const key in reqData) { + saveCardConfirmBody[key] = reqData[key]; } + cy.request({ method: "POST", url: `${globalState.get("baseUrl")}/payments/${paymentIntentID}/confirm`, @@ -1627,11 +1743,11 @@ Cypress.Commands.add( ); expect(response.body.payment_method_data, "payment_method_data").to.not .be.empty; - expect(globalState.get("merchantConnectorId"), "connector_id").to.equal( + expect(merchant_connector_id, "connector_id").to.equal( response.body.merchant_connector_id ); expect(response.body.customer, "customer").to.not.be.empty; - if (req_data.billing !== null) { + if (reqData.billing !== null) { expect(response.body.billing, "billing_address").to.not.be.empty; } expect(response.body.profile_id, "profile_id").to.not.be.null; @@ -1642,10 +1758,9 @@ Cypress.Commands.add( expect(response.body) .to.have.property("next_action") .to.have.property("redirect_to_url"); - const nextActionUrl = response.body.next_action.redirect_to_url; } else if (response.body.authentication_type === "no_three_ds") { - for (const key in res_data.body) { - expect(res_data.body[key]).to.equal(response.body[key]); + for (const key in resData.body) { + expect(resData.body[key]).to.equal(response.body[key]); } expect(response.body.customer_id).to.equal( globalState.get("customerId") @@ -1662,8 +1777,8 @@ Cypress.Commands.add( .to.have.property("next_action") .to.have.property("redirect_to_url"); } else if (response.body.authentication_type === "no_three_ds") { - for (const key in res_data.body) { - expect(res_data.body[key]).to.equal(response.body[key]); + for (const key in resData.body) { + expect(resData.body[key]).to.equal(response.body[key]); } expect(response.body.customer_id).to.equal( globalState.get("customerId") @@ -1681,7 +1796,7 @@ Cypress.Commands.add( ); } } else { - defaultErrorHandler(response, res_data); + defaultErrorHandler(response, resData); } }); } @@ -1689,9 +1804,16 @@ Cypress.Commands.add( Cypress.Commands.add( "captureCallTest", - (requestBody, req_data, res_data, amount_to_capture, globalState) => { + (requestBody, data, amount_to_capture, globalState) => { + const { Configs: configs = {}, Response: resData } = data || {}; + + const config_info = execConfig(validateConfig(configs)); const payment_id = globalState.get("paymentID"); + const profile_id = globalState.get(config_info.profile_id); + requestBody.amount_to_capture = amount_to_capture; + requestBody.profile_id = profile_id; + cy.request({ method: "POST", url: `${globalState.get("baseUrl")}/payments/${payment_id}/capture`, @@ -1707,48 +1829,59 @@ Cypress.Commands.add( expect(response.headers["content-type"]).to.include("application/json"); if (response.body.capture_method !== undefined) { expect(response.body.payment_id).to.equal(payment_id); - for (const key in res_data.body) { - expect(res_data.body[key]).to.equal(response.body[key]); + for (const key in resData.body) { + expect(resData.body[key]).to.equal(response.body[key]); } } else { - defaultErrorHandler(response, res_data); + defaultErrorHandler(response, resData); } }); } ); -Cypress.Commands.add( - "voidCallTest", - (requestBody, req_data, res_data, globalState) => { - const payment_id = globalState.get("paymentID"); - 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"]); +Cypress.Commands.add("voidCallTest", (requestBody, data, globalState) => { + const { Configs: configs = {}, Response: resData } = data || {}; - 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); + const config_info = execConfig(validateConfig(configs)); + const payment_id = globalState.get("paymentID"); + const profile_id = globalState.get(config_info.profile_id); + + requestBody.profile_id = 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"]); + + expect(response.headers["content-type"]).to.include("application/json"); + if (response.status === 200) { + for (const key in resData.body) { + expect(resData.body[key]).to.equal(response.body[key]); } - }); - } -); + } else { + defaultErrorHandler(response, resData); + } + }); +}); Cypress.Commands.add( "retrievePaymentCallTest", - (globalState, autoretries = false, attempt = 1) => { + (globalState, data, autoretries = false, attempt = 1) => { + const { Configs: configs = {} } = data || {}; + + const config_info = execConfig(validateConfig(configs)); + const merchant_connector_id = globalState.get( + config_info.merchant_connector_id + ); const payment_id = globalState.get("paymentID"); + cy.request({ method: "GET", url: `${globalState.get("baseUrl")}/payments/${payment_id}?force_sync=true&expand_attempts=true`, @@ -1759,7 +1892,6 @@ Cypress.Commands.add( failOnStatusCode: false, }).then((response) => { logRequestId(response.headers["x-request-id"]); - globalState.set("paymentID", response.body.payment_id); expect(response.headers["content-type"]).to.include("application/json"); expect(response.body.payment_id).to.equal(payment_id); @@ -1779,7 +1911,7 @@ Cypress.Commands.add( .be.empty; expect(response.body.payment_method, "payment_method").to.not.be.null; expect(response.body.merchant_connector_id, "connector_id").to.equal( - globalState.get("merchantConnectorId") + merchant_connector_id ); } @@ -1793,13 +1925,13 @@ Cypress.Commands.add( for (const key in response.body.attempts) { if ( response.body.attempts[key].attempt_id === - `${payment_id}_${attempt}` && + `${payment_id}_${attempt}` && response.body.status === "succeeded" ) { expect(response.body.attempts[key].status).to.equal("charged"); } else if ( response.body.attempts[key].attempt_id === - `${payment_id}_${attempt}` && + `${payment_id}_${attempt}` && response.body.status === "requires_customer_action" ) { expect(response.body.attempts[key].status).to.equal( @@ -1816,10 +1948,17 @@ Cypress.Commands.add( Cypress.Commands.add( "refundCallTest", - (requestBody, req_data, res_data, refund_amount, globalState) => { + (requestBody, data, refund_amount, globalState) => { + const { Configs: configs = {}, Response: resData } = data || {}; + const payment_id = globalState.get("paymentID"); - requestBody.payment_id = payment_id; + + // we only need this to set the delay. We don't need the return value + execConfig(validateConfig(configs)); + requestBody.amount = refund_amount; + requestBody.payment_id = payment_id; + cy.request({ method: "POST", url: `${globalState.get("baseUrl")}/refunds`, @@ -1835,61 +1974,75 @@ Cypress.Commands.add( if (response.status === 200) { globalState.set("refundId", response.body.refund_id); - for (const key in res_data.body) { - expect(res_data.body[key]).to.equal(response.body[key]); + for (const key in resData.body) { + expect(resData.body[key]).to.equal(response.body[key]); } expect(response.body.payment_id).to.equal(payment_id); } else { - defaultErrorHandler(response, res_data); + defaultErrorHandler(response, resData); } }); } ); -Cypress.Commands.add( - "syncRefundCallTest", - (req_data, res_data, globalState) => { - const refundId = globalState.get("refundId"); - 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"]); +Cypress.Commands.add("syncRefundCallTest", (data, globalState) => { + const { Response: resData } = data || {}; - 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]); - } - }); - } -); + const refundId = globalState.get("refundId"); + + 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 resData.body) { + expect(resData.body[key]).to.equal(response.body[key]); + } + }); +}); Cypress.Commands.add( "citForMandatesCallTest", ( requestBody, - req_data, - res_data, + data, amount, confirm, capture_method, payment_type, globalState ) => { - for (const key in req_data) { - requestBody[key] = req_data[key]; + const { + Configs: configs = {}, + Request: reqData, + Response: resData, + } = 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 + ); + + for (const key in reqData) { + requestBody[key] = reqData[key]; } - requestBody.payment_type = payment_type; - requestBody.confirm = confirm; requestBody.amount = amount; requestBody.capture_method = capture_method; + requestBody.confirm = confirm; requestBody.customer_id = globalState.get("customerId"); + requestBody.payment_type = payment_type; + requestBody.profile_id = profile_id; + globalState.set("paymentAmount", requestBody.amount); + cy.request({ method: "POST", url: `${globalState.get("baseUrl")}/payments`, @@ -1910,7 +2063,7 @@ Cypress.Commands.add( expect(response.body.connector, "connector").to.equal( globalState.get("connectorId") ); - expect(globalState.get("merchantConnectorId"), "connector_id").to.equal( + expect(merchant_connector_id, "connector_id").to.equal( response.body.merchant_connector_id ); expect(response.body.customer, "customer").to.not.be.empty; @@ -1940,12 +2093,12 @@ Cypress.Commands.add( response.body.next_action.redirect_to_url ); cy.log(nextActionUrl); - for (const key in res_data.body) { - expect(res_data.body[key]).to.equal(response.body[key]); + for (const key in resData.body) { + expect(resData.body[key]).to.equal(response.body[key]); } } else if (response.body.authentication_type === "no_three_ds") { - for (const key in res_data.body) { - expect(res_data.body[key]).to.equal(response.body[key]); + for (const key in resData.body) { + expect(resData.body[key]).to.equal(response.body[key]); } } else { throw new Error( @@ -1963,12 +2116,12 @@ Cypress.Commands.add( response.body.next_action.redirect_to_url ); cy.log(nextActionUrl); - for (const key in res_data.body) { - expect(res_data.body[key]).to.equal(response.body[key]); + for (const key in resData.body) { + expect(resData.body[key]).to.equal(response.body[key]); } } else if (response.body.authentication_type === "no_three_ds") { - for (const key in res_data.body) { - expect(res_data.body[key]).to.equal(response.body[key]); + for (const key in resData.body) { + expect(resData.body[key]).to.equal(response.body[key]); } } else { throw new Error( @@ -1981,7 +2134,7 @@ Cypress.Commands.add( ); } } else { - defaultErrorHandler(response, res_data); + defaultErrorHandler(response, resData); } }); } @@ -1989,23 +2142,30 @@ Cypress.Commands.add( Cypress.Commands.add( "mitForMandatesCallTest", - ( - requestBody, - req_data, - res_data, - amount, - confirm, - capture_method, - globalState - ) => { - for (const key in req_data) { - requestBody[key] = req_data[key]; + (requestBody, data, amount, confirm, capture_method, globalState) => { + const { + Configs: configs = {}, + Request: reqData, + Response: resData, + } = data || {}; + const config_info = execConfig(validateConfig(configs)); + const profile_id = globalState.get(config_info.profile_id); + + for (const key in reqData) { + requestBody[key] = reqData[key]; } + + const merchant_connector_id = globalState.get( + config_info.merchant_connector_id + ); + requestBody.amount = amount; requestBody.confirm = confirm; requestBody.capture_method = capture_method; - requestBody.mandate_id = globalState.get("mandateId"); requestBody.customer_id = globalState.get("customerId"); + requestBody.mandate_id = globalState.get("mandateId"); + requestBody.profile_id = profile_id; + globalState.set("paymentAmount", requestBody.amount); cy.request({ method: "POST", @@ -2026,7 +2186,7 @@ Cypress.Commands.add( expect(response.body.connector, "connector").to.equal( globalState.get("connectorId") ); - expect(globalState.get("merchantConnectorId"), "connector_id").to.equal( + expect(merchant_connector_id, "connector_id").to.equal( response.body.merchant_connector_id ); expect(response.body.customer, "customer").to.not.be.empty; @@ -2040,12 +2200,12 @@ Cypress.Commands.add( .to.have.property("redirect_to_url"); const nextActionUrl = response.body.next_action.redirect_to_url; cy.log(nextActionUrl); - for (const key in res_data.body) { - expect(res_data.body[key], [key]).to.equal(response.body[key]); + for (const key in resData.body) { + expect(resData.body[key], [key]).to.equal(response.body[key]); } } else if (response.body.authentication_type === "no_three_ds") { - for (const key in res_data.body) { - expect(res_data.body[key], [key]).to.equal(response.body[key]); + for (const key in resData.body) { + expect(resData.body[key], [key]).to.equal(response.body[key]); } } else { throw new Error( @@ -2059,12 +2219,12 @@ Cypress.Commands.add( .to.have.property("redirect_to_url"); const nextActionUrl = response.body.next_action.redirect_to_url; cy.log(nextActionUrl); - for (const key in res_data.body) { - expect(res_data.body[key], [key]).to.equal(response.body[key]); + for (const key in resData.body) { + expect(resData.body[key], [key]).to.equal(response.body[key]); } } else if (response.body.authentication_type === "no_three_ds") { - for (const key in res_data.body) { - expect(res_data.body[key], [key]).to.equal(response.body[key]); + for (const key in resData.body) { + expect(resData.body[key], [key]).to.equal(response.body[key]); } } else { throw new Error( @@ -2087,7 +2247,7 @@ Cypress.Commands.add( ); } } else { - defaultErrorHandler(response, res_data); + defaultErrorHandler(response, resData); } }); } @@ -2095,23 +2255,27 @@ Cypress.Commands.add( Cypress.Commands.add( "mitUsingPMId", - ( - requestBody, - req_data, - res_data, - amount, - confirm, - capture_method, - globalState - ) => { - for (const key in req_data) { - requestBody[key] = req_data[key]; + (requestBody, data, amount, confirm, capture_method, globalState) => { + const { + Configs: configs = {}, + Request: reqData, + Response: resData, + } = data || {}; + + for (const key in reqData) { + requestBody[key] = reqData[key]; } + + const configInfo = execConfig(validateConfig(configs)); + const profileId = globalState.get(configInfo.profile_id); + requestBody.amount = amount; - requestBody.confirm = confirm; requestBody.capture_method = capture_method; - requestBody.recurring_details.data = globalState.get("paymentMethodId"); + requestBody.confirm = confirm; requestBody.customer_id = globalState.get("customerId"); + requestBody.profile_id = profileId; + requestBody.recurring_details.data = globalState.get("paymentMethodId"); + cy.request({ method: "POST", url: `${globalState.get("baseUrl")}/payments`, @@ -2133,12 +2297,12 @@ Cypress.Commands.add( .to.have.property("redirect_to_url"); const nextActionUrl = response.body.next_action.redirect_to_url; cy.log(nextActionUrl); - for (const key in res_data.body) { - expect(res_data.body[key], [key]).to.equal(response.body[key]); + for (const key in resData.body) { + expect(resData.body[key], [key]).to.equal(response.body[key]); } } else if (response.body.authentication_type === "no_three_ds") { - for (const key in res_data.body) { - expect(res_data.body[key], [key]).to.equal(response.body[key]); + for (const key in resData.body) { + expect(resData.body[key], [key]).to.equal(response.body[key]); } } else { throw new Error( @@ -2152,12 +2316,12 @@ Cypress.Commands.add( .to.have.property("redirect_to_url"); const nextActionUrl = response.body.next_action.redirect_to_url; cy.log(nextActionUrl); - for (const key in res_data.body) { - expect(res_data.body[key], [key]).to.equal(response.body[key]); + for (const key in resData.body) { + expect(resData.body[key], [key]).to.equal(response.body[key]); } } else if (response.body.authentication_type === "no_three_ds") { - for (const key in res_data.body) { - expect(res_data.body[key], [key]).to.equal(response.body[key]); + for (const key in resData.body) { + expect(resData.body[key], [key]).to.equal(response.body[key]); } } else { throw new Error( @@ -2170,7 +2334,7 @@ Cypress.Commands.add( ); } } else { - defaultErrorHandler(response, res_data); + defaultErrorHandler(response, resData); } }); } @@ -2178,25 +2342,23 @@ Cypress.Commands.add( Cypress.Commands.add( "mitUsingNTID", - ( - requestBody, - req_data, - res_data, - amount, - confirm, - capture_method, - globalState - ) => { - for (const key in req_data) { - requestBody[key] = req_data[key]; + (requestBody, data, amount, confirm, capture_method, globalState) => { + const { + Configs: configs = {}, + Request: reqData, + Response: resData, + } = data || {}; + const configInfo = execConfig(validateConfig(configs)); + const profileId = globalState.get(configInfo.profile_id); + + for (const key in reqData) { + requestBody[key] = reqData[key]; } + requestBody.amount = amount; requestBody.confirm = confirm; requestBody.capture_method = capture_method; - - if (globalState.get("connectorId") !== "cybersource") { - return; - } + requestBody.profile_id = profileId; const apiKey = globalState.get("apiKey"); const baseUrl = globalState.get("baseUrl"); @@ -2226,12 +2388,12 @@ Cypress.Commands.add( .to.have.property("redirect_to_url"); const nextActionUrl = response.body.next_action.redirect_to_url; cy.log(nextActionUrl); - for (const key in res_data.body) { - expect(res_data.body[key], [key]).to.equal(response.body[key]); + for (const key in resData.body) { + expect(resData.body[key], [key]).to.equal(response.body[key]); } } else if (response.body.authentication_type === "no_three_ds") { - for (const key in res_data.body) { - expect(res_data.body[key], [key]).to.equal(response.body[key]); + for (const key in resData.body) { + expect(resData.body[key], [key]).to.equal(response.body[key]); } } else { throw new Error( @@ -2245,12 +2407,12 @@ Cypress.Commands.add( .to.have.property("redirect_to_url"); const nextActionUrl = response.body.next_action.redirect_to_url; cy.log(nextActionUrl); - for (const key in res_data.body) { - expect(res_data.body[key], [key]).to.equal(response.body[key]); + for (const key in resData.body) { + expect(resData.body[key], [key]).to.equal(response.body[key]); } } else if (response.body.authentication_type === "no_three_ds") { - for (const key in res_data.body) { - expect(res_data.body[key], [key]).to.equal(response.body[key]); + for (const key in resData.body) { + expect(resData.body[key], [key]).to.equal(response.body[key]); } } else { throw new Error( @@ -2263,7 +2425,7 @@ Cypress.Commands.add( ); } } else { - defaultErrorHandler(response, res_data); + defaultErrorHandler(response, resData); } }); } @@ -2317,9 +2479,9 @@ Cypress.Commands.add("revokeMandateCallTest", (globalState) => { Cypress.Commands.add( "handleRedirection", (globalState, expected_redirection) => { - let connectorId = globalState.get("connectorId"); - let expected_url = new URL(expected_redirection); - let redirection_url = new URL(globalState.get("nextActionUrl")); + const connectorId = globalState.get("connectorId"); + const expected_url = new URL(expected_redirection); + const redirection_url = new URL(globalState.get("nextActionUrl")); handleRedirection( "three_ds", { redirection_url, expected_url }, @@ -2332,9 +2494,10 @@ Cypress.Commands.add( Cypress.Commands.add( "handleBankRedirectRedirection", (globalState, payment_method_type, expected_redirection) => { - let connectorId = globalState.get("connectorId"); - let expected_url = new URL(expected_redirection); - let redirection_url = new URL(globalState.get("nextActionUrl")); + const connectorId = globalState.get("connectorId"); + const expected_url = new URL(expected_redirection); + const redirection_url = new URL(globalState.get("nextActionUrl")); + // explicitly restricting `sofort` payment method by adyen from running as it stops other tests from running // trying to handle that specific case results in stripe 3ds tests to fail if (!(connectorId == "adyen" && payment_method_type == "sofort")) { @@ -2351,10 +2514,11 @@ Cypress.Commands.add( Cypress.Commands.add( "handleBankTransferRedirection", (globalState, payment_method_type, expected_redirection) => { - let connectorId = globalState.get("connectorId"); - let expected_url = new URL(expected_redirection); - let redirection_url = new URL(globalState.get("nextActionUrl")); - let next_action_type = globalState.get("nextActionType"); + const connectorId = globalState.get("connectorId"); + const expected_url = new URL(expected_redirection); + const redirection_url = new URL(globalState.get("nextActionUrl")); + const next_action_type = globalState.get("nextActionType"); + cy.log(payment_method_type); handleRedirection( "bank_transfer", @@ -2371,9 +2535,10 @@ Cypress.Commands.add( Cypress.Commands.add( "handleUpiRedirection", (globalState, payment_method_type, expected_redirection) => { - let connectorId = globalState.get("connectorId"); - let expected_url = new URL(expected_redirection); - let redirection_url = new URL(globalState.get("nextActionUrl")); + const connectorId = globalState.get("connectorId"); + const expected_url = new URL(expected_redirection); + const redirection_url = new URL(globalState.get("nextActionUrl")); + handleRedirection( "upi", { redirection_url, expected_url }, @@ -2480,16 +2645,11 @@ Cypress.Commands.add("listRefundCallTest", (requestBody, globalState) => { Cypress.Commands.add( "createConfirmPayoutTest", - ( - createConfirmPayoutBody, - req_data, - res_data, - confirm, - auto_fulfill, - globalState - ) => { - for (const key in req_data) { - createConfirmPayoutBody[key] = req_data[key]; + (createConfirmPayoutBody, data, confirm, auto_fulfill, globalState) => { + const { Request: reqData, Response: resData } = data || {}; + + for (const key in reqData) { + createConfirmPayoutBody[key] = reqData[key]; } createConfirmPayoutBody.auto_fulfill = auto_fulfill; createConfirmPayoutBody.confirm = confirm; @@ -2511,11 +2671,11 @@ Cypress.Commands.add( if (response.status === 200) { globalState.set("payoutAmount", createConfirmPayoutBody.amount); globalState.set("payoutID", response.body.payout_id); - for (const key in res_data.body) { - expect(res_data.body[key]).to.equal(response.body[key]); + for (const key in resData.body) { + expect(resData.body[key]).to.equal(response.body[key]); } } else { - defaultErrorHandler(response, res_data); + defaultErrorHandler(response, resData); } }); } @@ -2523,16 +2683,11 @@ Cypress.Commands.add( Cypress.Commands.add( "createConfirmWithTokenPayoutTest", - ( - createConfirmPayoutBody, - req_data, - res_data, - confirm, - auto_fulfill, - globalState - ) => { - for (const key in req_data) { - createConfirmPayoutBody[key] = req_data[key]; + (createConfirmPayoutBody, data, confirm, auto_fulfill, globalState) => { + const { Request: reqData, Response: resData } = data || {}; + + for (const key in reqData) { + createConfirmPayoutBody[key] = reqData[key]; } createConfirmPayoutBody.customer_id = globalState.get("customerId"); createConfirmPayoutBody.payout_token = globalState.get("paymentToken"); @@ -2555,11 +2710,11 @@ Cypress.Commands.add( if (response.status === 200) { globalState.set("payoutAmount", createConfirmPayoutBody.amount); globalState.set("payoutID", response.body.payout_id); - for (const key in res_data.body) { - expect(res_data.body[key]).to.equal(response.body[key]); + for (const key in resData.body) { + expect(resData.body[key]).to.equal(response.body[key]); } } else { - defaultErrorHandler(response, res_data); + defaultErrorHandler(response, resData); } }); } @@ -2567,7 +2722,9 @@ Cypress.Commands.add( Cypress.Commands.add( "fulfillPayoutCallTest", - (payoutFulfillBody, req_data, res_data, globalState) => { + (payoutFulfillBody, data, globalState) => { + const { Response: resData } = data || {}; + payoutFulfillBody.payout_id = globalState.get("payoutID"); cy.request({ @@ -2584,11 +2741,11 @@ Cypress.Commands.add( 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]); + for (const key in resData.body) { + expect(resData.body[key]).to.equal(response.body[key]); } } else { - defaultErrorHandler(response, res_data); + defaultErrorHandler(response, resData); } }); } @@ -2596,7 +2753,9 @@ Cypress.Commands.add( Cypress.Commands.add( "updatePayoutCallTest", - (payoutConfirmBody, req_data, res_data, auto_fulfill, globalState) => { + (payoutConfirmBody, data, auto_fulfill, globalState) => { + const { Response: resData } = data || {}; + payoutConfirmBody.confirm = true; payoutConfirmBody.auto_fulfill = auto_fulfill; @@ -2614,11 +2773,11 @@ Cypress.Commands.add( 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]); + for (const key in resData.body) { + expect(resData.body[key]).to.equal(response.body[key]); } } else { - defaultErrorHandler(response, res_data); + defaultErrorHandler(response, resData); } }); } @@ -2770,14 +2929,16 @@ Cypress.Commands.add("ListMcaByMid", (globalState) => { Cypress.Commands.add( "addRoutingConfig", - (routingBody, req_data, res_data, type, data, globalState) => { - for (const key in req_data) { - routingBody[key] = req_data[key]; + (routingBody, data, type, routing_data, globalState) => { + const { Request: reqData, Response: resData } = data || {}; + + for (const key in reqData) { + routingBody[key] = reqData[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", @@ -2796,73 +2957,71 @@ Cypress.Commands.add( if (response.status === 200) { expect(response.body).to.have.property("id"); globalState.set("routingConfigId", response.body.id); - for (const key in res_data.body) { - expect(res_data.body[key]).to.equal(response.body[key]); + for (const key in resData.body) { + expect(resData.body[key]).to.equal(response.body[key]); } } else { - defaultErrorHandler(response, res_data); + defaultErrorHandler(response, resData); } }); } ); -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 { Response: resData } = 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); + const 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 resData.body) { + expect(resData.body[key]).to.equal(response.body[key]); } - }); - } -); + } else { + defaultErrorHandler(response, resData); + } + }); +}); -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 { Response: resData } = 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); + const 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 resData.body) { + expect(resData.body[key]).to.equal(response.body[key]); } - }); - } -); + } else { + defaultErrorHandler(response, resData); + } + }); +}); Cypress.Commands.add( "updateGsmConfig", @@ -2892,55 +3051,118 @@ Cypress.Commands.add( } ); -Cypress.Commands.add( - "updateConfig", - (configType, configData, globalState, value) => { - const base_url = globalState.get("baseUrl"); - const merchant_id = globalState.get("merchantId"); - const api_key = globalState.get("adminApiKey"); +Cypress.Commands.add("updateConfig", (configType, globalState, value) => { + const base_url = globalState.get("baseUrl"); + const merchant_id = globalState.get("merchantId"); + const api_key = globalState.get("adminApiKey"); + + let key; + let url; + let body; + + switch (configType) { + case "autoRetry": + key = `should_call_gsm_${merchant_id}`; + url = `${base_url}/configs/${key}`; + body = { key: key, value: value }; + break; + case "maxRetries": + key = `max_auto_retries_enabled_${merchant_id}`; + url = `${base_url}/configs/${key}`; + body = { key: key, value: value }; + break; + case "stepUp": + key = `step_up_enabled_${merchant_id}`; + url = `${base_url}/configs/${key}`; + body = { key: key, value: value }; + break; + default: + throw new Error( + `Invalid config type passed into the configs: "${api_key}: ${value}"` + ); + } - let key; - let url; - let body; - - switch (configType) { - case "autoRetry": - key = `should_call_gsm_${merchant_id}`; - url = `${base_url}/configs/${key}`; - body = { key: key, value: value }; - break; - case "maxRetries": - key = `max_auto_retries_enabled_${merchant_id}`; - url = `${base_url}/configs/${key}`; - body = { key: key, value: value }; - break; - case "stepUp": - key = `step_up_enabled_${merchant_id}`; - url = `${base_url}/configs/${key}`; - body = { key: key, value: value }; - break; - default: - throw new Error( - `Invalid config type passed into the configs: "${api_key}: ${value}"` - ); + cy.request({ + method: "POST", + url: url, + headers: { + "Content-Type": "application/json", + "api-key": api_key, + }, + body: body, + failOnStatusCode: false, + }).then((response) => { + logRequestId(response.headers["x-request-id"]); + + if (response.status === 200) { + expect(response.body).to.have.property("key").to.equal(key); + expect(response.body).to.have.property("value").to.equal(value); } + }); +}); - cy.request({ - method: "POST", - url: url, - headers: { - "Content-Type": "application/json", - "api-key": api_key, - }, - body: body, - failOnStatusCode: false, - }).then((response) => { - logRequestId(response.headers["x-request-id"]); +Cypress.Commands.add("incrementalAuth", (globalState, data) => { + const { Request: reqData, Response: resData } = data || {}; - if (response.status === 200) { - expect(response.body).to.have.property("key").to.equal(key); - expect(response.body).to.have.property("value").to.equal(value); + const baseUrl = globalState.get("baseUrl"); + const paymentId = globalState.get("paymentID"); + const apiKey = globalState.get("apiKey"); + const url = `${baseUrl}/payments/${paymentId}/incremental_authorization`; + + cy.request({ + method: "POST", + url: url, + headers: { + "api-key": apiKey, + "Content-Type": "application/json", + }, + body: reqData, + failOnStatusCode: false, + }).then((response) => { + logRequestId(response.headers["x-request-id"]); + + if (response.status === 200) { + expect(response.body.amount_capturable, "amount_capturable").to.equal( + resData.body.amount_capturable + ); + expect(response.body.authorization_count, "authorization_count").to.be.a( + "number" + ).and.not.be.null; + expect( + response.body.incremental_authorization_allowed, + "incremental_authorization_allowed" + ).to.be.true; + expect( + response.body.incremental_authorizations, + "incremental_authorizations" + ).to.be.an("array").and.not.be.empty; + expect(response.body.payment_id, "payment_id").to.equal(paymentId); + expect(response.body.status, "status").to.equal(resData.body.status); + + for (const key in response.body.incremental_authorizations) { + expect(response.body.incremental_authorizations[key], "amount") + .to.have.property("amount") + .to.be.a("number") + .to.equal(resData.body.amount).and.not.be.null; + expect( + response.body.incremental_authorizations[key], + "error_code" + ).to.have.property("error_code").to.be.null; + expect( + response.body.incremental_authorizations[key], + "error_message" + ).to.have.property("error_message").to.be.null; + expect( + response.body.incremental_authorizations[key], + "previously_authorized_amount" + ) + .to.have.property("previously_authorized_amount") + .to.be.a("number") + .to.equal(response.body.amount).and.not.be.null; + expect(response.body.incremental_authorizations[key], "status") + .to.have.property("status") + .to.equal("success"); } - }); - } -); + } + }); +}); diff --git a/cypress-tests/cypress/support/redirectionHandler.js b/cypress-tests/cypress/support/redirectionHandler.js index ee8e21979034..7c1675690eea 100644 --- a/cypress-tests/cypress/support/redirectionHandler.js +++ b/cypress-tests/cypress/support/redirectionHandler.js @@ -1,9 +1,10 @@ +/* eslint-disable cypress/unsafe-to-chain-command */ +/* eslint-disable cypress/no-unnecessary-waiting */ import jsQR from "jsqr"; // Define constants for wait times const TIMEOUT = 20000; // 20 seconds const WAIT_TIME = 10000; // 10 seconds -const WAIT_TIME_IATAPAY = 20000; // 20 seconds export function handleRedirection( redirection_type, @@ -156,7 +157,7 @@ function bankRedirectRedirection( cy.get("button.cookie-modal-deny-all.button-tertiary") .should("be.visible") .should("contain", "Reject All") - .click({ force: true, multiple: true }); + .click({ multiple: true }); cy.get("div#TopBanks.top-banks-multistep") .should("contain", "Demo Bank") .as("btn") @@ -280,7 +281,7 @@ function threeDsRedirection(redirection_url, expected_url, connectorId) { if (connectorId === "adyen") { cy.get("iframe") .its("0.contentDocument.body") - .within((body) => { + .within(() => { cy.get('input[type="password"]').click(); cy.get('input[type="password"]').type("password"); cy.get("#buttonSubmit").click(); @@ -292,17 +293,17 @@ function threeDsRedirection(redirection_url, expected_url, connectorId) { ) { cy.get("iframe", { timeout: TIMEOUT }) .its("0.contentDocument.body") - .within((body) => { + .within(() => { cy.get('input[type="text"]').click().type("1234"); cy.get('input[value="SUBMIT"]').click(); }); } else if (connectorId === "checkout") { cy.get("iframe", { timeout: TIMEOUT }) .its("0.contentDocument.body") - .within((body) => { + .within(() => { cy.get('form[id="form"]', { timeout: WAIT_TIME }) .should("exist") - .then((form) => { + .then(() => { cy.get('input[id="password"]').click(); cy.get('input[id="password"]').type("Checkout1!"); cy.get("#txtButton").click(); @@ -311,13 +312,13 @@ function threeDsRedirection(redirection_url, expected_url, connectorId) { } else if (connectorId === "nmi" || connectorId === "noon") { cy.get("iframe", { timeout: TIMEOUT }) .its("0.contentDocument.body") - .within((body) => { + .within(() => { cy.get("iframe", { timeout: TIMEOUT }) .its("0.contentDocument.body") - .within((body) => { + .within(() => { cy.get('form[name="cardholderInput"]', { timeout: TIMEOUT }) .should("exist") - .then((form) => { + .then(() => { cy.get('input[name="challengeDataEntry"]').click().type("1234"); cy.get('input[value="SUBMIT"]').click(); }); @@ -326,23 +327,23 @@ function threeDsRedirection(redirection_url, expected_url, connectorId) { } else if (connectorId === "novalnet") { cy.get("form", { timeout: WAIT_TIME }) .should("exist") - .then((form) => { + .then(() => { cy.get('input[id="submit"]').click(); }); } else if (connectorId === "stripe") { cy.get("iframe", { timeout: TIMEOUT }) .its("0.contentDocument.body") - .within((body) => { + .within(() => { cy.get("iframe") .its("0.contentDocument.body") - .within((body) => { + .within(() => { cy.get("#test-source-authorize-3ds").click(); }); }); } else if (connectorId === "trustpay") { cy.get('form[name="challengeForm"]', { timeout: WAIT_TIME }) .should("exist") - .then((form) => { + .then(() => { cy.get("#outcomeSelect").select("Approve").should("have.value", "Y"); cy.get('button[type="submit"]').click(); }); @@ -358,16 +359,16 @@ function threeDsRedirection(redirection_url, expected_url, connectorId) { }); }); } else if (connectorId === "fiuu") { - cy.get('form[id="cc_form"]', { timeout: WAIT_TIME_IATAPAY }) + cy.get('form[id="cc_form"]', { timeout: TIMEOUT }) .should("exist") - .then((form) => { + .then(() => { cy.get('button.pay-btn[name="pay"]').click(); cy.get("div.otp") .invoke("text") .then((otpText) => { const otp = otpText.match(/\d+/)[0]; // Extract the numeric OTP cy.get("input#otp-input").should("not.be.disabled").type(otp); - cy.get('button.pay-btn').click(); + cy.get("button.pay-btn").click(); }); }); } else { @@ -391,7 +392,7 @@ function upiRedirection( switch (payment_method_type) { case "upi_collect": cy.visit(redirection_url.href); - cy.wait(WAIT_TIME_IATAPAY).then(() => { + cy.wait(TIMEOUT).then(() => { verifyUrl = true; }); break; diff --git a/cypress-tests/cypress/utils/featureFlags.js b/cypress-tests/cypress/utils/featureFlags.js new file mode 100644 index 000000000000..7140aee3af7e --- /dev/null +++ b/cypress-tests/cypress/utils/featureFlags.js @@ -0,0 +1,156 @@ +/* eslint-disable no-console */ +const config_fields = ["CONNECTOR_CREDENTIAL", "DELAY", "TRIGGER_SKIP"]; + +const DEFAULT_CONNECTOR = "connector_1"; +const DEFAULT_CREDENTIALS = { + profile_id: "profileId", + merchant_connector_id: "merchantConnectorId", +}; +const CONNECTOR_2_CREDENTIALS = { + profile_id: "profile1Id", + merchant_connector_id: "merchantConnector1Id", +}; + +// Helper function for type and range validation +function validateType(value, type) { + if (typeof value !== type) { + console.error( + `Expected value to be of type ${type}, but got ${typeof value}.` + ); + return false; + } + return true; +} + +// Helper function to validate specific config keys based on schema rules +function validateConfigValue(key, value) { + // At present, there are only 2 api keys for connectors. Will be scaled based on the need + const SUPPORTED_CONNECTOR_CREDENTIAL = ["connector_1", "connector_2"]; + + if (config_fields.includes(key)) { + switch (key) { + case "DELAY": + if (typeof value !== "object" || value === null) { + console.error("DELAY must be an object."); + return false; + } + if (!validateType(value.STATUS, "boolean")) return false; + if ( + !value.STATUS || + typeof value.TIMEOUT !== "number" || + value.TIMEOUT < 0 || + value.TIMEOUT > 30000 + ) { + console.error( + "DELAY.TIMEOUT must be an integer between 0 and 30000 and DELAY.STATUS must be enabled." + ); + return false; + } + break; + + case "CONNECTOR_CREDENTIAL": + if (typeof value !== "object" || value === null) { + console.error("CONNECTOR_CREDENTIAL must be an object."); + return false; + } + // Validate structure + if ( + !value.value || + !SUPPORTED_CONNECTOR_CREDENTIAL.includes(value.value) + ) { + console.error( + `Config ${key}.value must be one of ${SUPPORTED_CONNECTOR_CREDENTIAL.join(", ")}.` + ); + return false; + } + break; + + case "TRIGGER_SKIP": + case "DELAY.STATUS": + if (!validateType(value, "boolean")) return false; + break; + + default: + console.error(`Config key ${key} is invalid.`); + return false; + } + } else { + console.error(`Config key ${key} is invalid.`); + } + return true; +} + +// Function to validate the config object +export function validateConfig(configObject) { + // Configs object is an optional field in Connector Configs + // If passed, it must be a valid Object + if (typeof configObject === "undefined") { + return null; + } else if (typeof configObject !== "object" || configObject === null) { + console.error(`Provided config is invalid:\n${configObject}`); + return null; + } + + for (const key in configObject) { + if (Object.prototype.hasOwnProperty.call(configObject, key)) { + const value = configObject[key]; + if (!validateConfigValue(key, value)) { + return null; // Return null if any validation fails + } + } + } + + return configObject; +} + +export function execConfig(configs) { + // Handle delay if present + if (configs?.DELAY?.STATUS) { + cy.wait(configs.DELAY.TIMEOUT); + } + if ( + typeof configs?.CONNECTOR_CREDENTIAL === "undefined" || + configs?.CONNECTOR_CREDENTIAL.value === "null" + ) { + return DEFAULT_CREDENTIALS; + } + + // Get connector configuration + const connectorType = determineConnectorConfig(configs.CONNECTOR_CREDENTIAL); + + // Return credentials based on connector type + return connectorType === "connector_2" + ? CONNECTOR_2_CREDENTIALS + : DEFAULT_CREDENTIALS; +} + +function determineConnectorConfig(connectorConfig) { + // Return default if config is undefined or null + if (!connectorConfig || connectorConfig.value === "null") { + return DEFAULT_CONNECTOR; + } + + const { specName = null, value } = connectorConfig; + + // If value is not provided, return default + if (!value) { + return DEFAULT_CONNECTOR; + } + + // If no specName or not an array, return value directly + if (!specName || !Array.isArray(specName) || specName.length === 0) { + return value; + } + + // Check if current spec matches any in specName + const currentSpec = Cypress.spec.name.toLowerCase(); + try { + const matchesSpec = specName.some( + (name) => name && currentSpec.includes(name.toLowerCase()) + ); + return matchesSpec ? value : DEFAULT_CONNECTOR; + } catch (error) { + console.error("Error matching spec names:", error); + return DEFAULT_CONNECTOR; + } +} diff --git a/cypress-tests/eslint.config.js b/cypress-tests/eslint.config.js new file mode 100644 index 000000000000..5e77513c97b8 --- /dev/null +++ b/cypress-tests/eslint.config.js @@ -0,0 +1,36 @@ +import pluginJs from "@eslint/js"; +import eslintConfigPrettier from "eslint-config-prettier"; +import pluginCypress from "eslint-plugin-cypress/flat"; +import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended"; +import globals from "globals"; + +/** @type {import('eslint').Linter.Config[]} */ +export default [ + pluginJs.configs.recommended, + pluginCypress.configs.recommended, + eslintPluginPrettierRecommended, + eslintConfigPrettier, + { + languageOptions: { + globals: { + ...globals.browser, + ...globals.node, + }, + }, + rules: { + "no-unused-vars": "error", + "no-undef": "error", + "no-console": "warn", + "prefer-const": "warn", + + "cypress/assertion-before-screenshot": "warn", + "cypress/no-assigning-return-values": "warn", + "cypress/no-force": "warn", + "cypress/no-unnecessary-waiting": "warn", + "cypress/no-async-tests": "error", + "cypress/unsafe-to-chain-command": "warn", + + "prettier/prettier": "error", + }, + }, +]; diff --git a/cypress-tests/package-lock.json b/cypress-tests/package-lock.json index 04390f76f1d0..a2c2c4b8fb24 100644 --- a/cypress-tests/package-lock.json +++ b/cypress-tests/package-lock.json @@ -9,10 +9,16 @@ "version": "1.0.0", "license": "ISC", "devDependencies": { + "@eslint/js": "^9.16.0", "cypress": "^13.16.0", "cypress-mochawesome-reporter": "^3.8.2", + "eslint": "^9.16.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-cypress": "^4.1.0", + "eslint-plugin-prettier": "^5.2.1", + "globals": "^15.13.0", "jsqr": "^1.4.0", - "prettier": "^3.3.2" + "prettier": "^3.4.1" } }, "node_modules/@colors/colors": { @@ -77,15 +83,245 @@ "ms": "^2.1.1" } }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.1.tgz", + "integrity": "sha512-s3O3waFUrMV8P/XaF/+ZTp1X9XBZW1a4B97ZnjQF2KYWaFD2A8KyFBsrsfSjEmjn3RGWAIuvlneuZm3CUK3jbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.1.tgz", + "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/config-array": { + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.19.0.tgz", + "integrity": "sha512-zdHg2FPIFNKPdcHWtiNT+jEFCHYVplAXRDlQDyqy0zGx/q2parwh7brGJSiTxRk/TSMkbM//zt/f5CHgyTyaSQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/object-schema": "^2.1.4", + "debug": "^4.3.1", + "minimatch": "^3.1.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/core": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.9.0.tgz", + "integrity": "sha512-7ATR9F0e4W85D/0w7cU0SNj7qkAexMG+bAHEZOjo9akvGuhHE2m7umzWzfnpa0XAg5Kxc1BWmtPMV67jJ+9VUg==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.2.0.tgz", + "integrity": "sha512-grOjVNN8P3hjJn/eIETF1wwd12DdnwFDoyceUJLYYdkpbwq3nLi+4fqrTAONx7XDALqlL220wC/RHSC/QTI/0w==", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^10.0.1", + "globals": "^14.0.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/js": { + "version": "9.16.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.16.0.tgz", + "integrity": "sha512-tw2HxzQkrbeuvyj1tG2Yqq+0H9wGoI2IMk4EOsQeX+vmd75FtJAzf+gTA69WF+baUKRYQ3x2kbLE08js5OsTVg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/object-schema": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.4.tgz", + "integrity": "sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/plugin-kit": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.3.tgz", + "integrity": "sha512-2b/g5hRmpbb1o4GnTZax9N9m0FXzz9OV42ZzI4rDDMDuHUqigAiQCEWChBWCY4ztAGVRjoWT19v0yMmc5/L5kA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "levn": "^0.4.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@humanfs/core": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", + "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node": { + "version": "0.16.6", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.6.tgz", + "integrity": "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/core": "^0.19.1", + "@humanwhocodes/retry": "^0.3.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node/node_modules/@humanwhocodes/retry": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.1.tgz", + "integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/retry": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.1.tgz", + "integrity": "sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@pkgr/core": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.1.1.tgz", + "integrity": "sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, + "node_modules/@types/estree": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/node": { - "version": "22.1.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.1.0.tgz", - "integrity": "sha512-AOmuRF0R2/5j1knA3c6G3HOk523Ga+l+ZXltX8SF1+5oqcXijjfTd8fY3XRZqSihEu9XhtQnKYLmkFaoxgsJHw==", + "version": "22.10.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.1.tgz", + "integrity": "sha512-qKgsUwfHZV2WCWLAnVP1JqnpE6Im6h3Y0+fYgMTasNQ7V++CBX5OT1as0g0f+OyubbFqhf6XVNIsmN4IIhEgGQ==", "dev": true, "license": "MIT", "optional": true, "dependencies": { - "undici-types": "~6.13.0" + "undici-types": "~6.20.0" } }, "node_modules/@types/sinonjs__fake-timers": { @@ -96,9 +332,9 @@ "license": "MIT" }, "node_modules/@types/sizzle": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.8.tgz", - "integrity": "sha512-0vWLNK2D5MT9dg0iOo8GlKguPAU02QjmZitPEsXRuJXU/OGIOt9vT9Fc26wtYuavLxtO45v9PGleoL9Z0k1LHg==", + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.9.tgz", + "integrity": "sha512-xzLEyKB50yqCUPUJkIsrVvoWNfFUbIZI+RspLWt8u+tIW/BetMBZtgV2LY/2o+tYH8dRvQ+eoPf3NdhQCcLE2w==", "dev": true, "license": "MIT" }, @@ -113,6 +349,29 @@ "@types/node": "*" } }, + "node_modules/acorn": { + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", + "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, "node_modules/aggregate-error": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", @@ -127,6 +386,23 @@ "node": ">=8" } }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, "node_modules/ansi-colors": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", @@ -220,8 +496,7 @@ "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true, - "license": "Python-2.0", - "peer": true + "license": "Python-2.0" }, "node_modules/asn1": { "version": "0.2.6", @@ -254,9 +529,9 @@ } }, "node_modules/async": { - "version": "3.2.5", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.5.tgz", - "integrity": "sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==", + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", + "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==", "dev": true, "license": "MIT" }, @@ -361,14 +636,14 @@ "license": "MIT" }, "node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { - "balanced-match": "^1.0.0" + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" } }, "node_modules/braces": { @@ -458,6 +733,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/camelcase": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", @@ -545,6 +830,20 @@ "fsevents": "~2.3.2" } }, + "node_modules/chokidar/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "peer": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/ci-info": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.1.0.tgz", @@ -853,20 +1152,20 @@ } }, "node_modules/dayjs": { - "version": "1.11.12", - "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.12.tgz", - "integrity": "sha512-Rt2g+nTbLlDWZTwwrIXjy9MeiZmSDI375FvZs72ngxx8PDC6YXOeR3q5LAuPzjZQxhiWdRKac7RKV+YyQYfYIg==", + "version": "1.11.13", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.13.tgz", + "integrity": "sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg==", "dev": true, "license": "MIT" }, "node_modules/debug": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz", - "integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==", + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", "dev": true, "license": "MIT", "dependencies": { - "ms": "2.1.2" + "ms": "^2.1.3" }, "engines": { "node": ">=6.0" @@ -891,6 +1190,13 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true, + "license": "MIT" + }, "node_modules/define-data-property": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", @@ -995,9 +1301,9 @@ } }, "node_modules/escalade": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz", - "integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", "dev": true, "license": "MIT", "engines": { @@ -1012,13 +1318,227 @@ "license": "MIT" }, "node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true, "license": "MIT", "engines": { - "node": ">=0.8.0" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "9.16.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.16.0.tgz", + "integrity": "sha512-whp8mSQI4C8VXd+fLgSM0lh3UlmcFtVwUQjyKCFfsp+2ItAIYhlq/hqGahGqHE6cv9unM41VlqKk2VtKYR2TaA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.12.1", + "@eslint/config-array": "^0.19.0", + "@eslint/core": "^0.9.0", + "@eslint/eslintrc": "^3.2.0", + "@eslint/js": "9.16.0", + "@eslint/plugin-kit": "^0.2.3", + "@humanfs/node": "^0.16.6", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.4.1", + "@types/estree": "^1.0.6", + "@types/json-schema": "^7.0.15", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.5", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^8.2.0", + "eslint-visitor-keys": "^4.2.0", + "espree": "^10.3.0", + "esquery": "^1.5.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^8.0.0", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } + } + }, + "node_modules/eslint-config-prettier": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", + "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", + "dev": true, + "license": "MIT", + "bin": { + "eslint-config-prettier": "bin/cli.js" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, + "node_modules/eslint-plugin-cypress": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-cypress/-/eslint-plugin-cypress-4.1.0.tgz", + "integrity": "sha512-JhqkMY02mw74USwK9OFhectx3YSj6Co1NgWBxlGdKvlqiAp9vdEuQqt33DKGQFvvGS/NWtduuhWXWNnU29xDSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "globals": "^15.11.0" + }, + "peerDependencies": { + "eslint": ">=9" + } + }, + "node_modules/eslint-plugin-prettier": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.2.1.tgz", + "integrity": "sha512-gH3iR3g4JfF+yYPaJYkN7jEl9QbweL/YfkoRlNnuIEHEz1vHVlCmWOS+eGGiRuzHQXdJFCOTxRgvju9b8VUmrw==", + "dev": true, + "license": "MIT", + "dependencies": { + "prettier-linter-helpers": "^1.0.0", + "synckit": "^0.9.1" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint-plugin-prettier" + }, + "peerDependencies": { + "@types/eslint": ">=8.0.0", + "eslint": ">=8.0.0", + "eslint-config-prettier": "*", + "prettier": ">=3.0.0" + }, + "peerDependenciesMeta": { + "@types/eslint": { + "optional": true + }, + "eslint-config-prettier": { + "optional": true + } + } + }, + "node_modules/eslint-scope": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.2.0.tgz", + "integrity": "sha512-PHlWUfG6lvPc3yvP5A4PNyBL1W8fkDUccmI21JUu/+GKZBoH/W5u6usENXUrWFRsyoW5ACUjFGgAFQp5gUlb/A==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", + "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.3.0.tgz", + "integrity": "sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.14.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^4.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", + "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" } }, "node_modules/eventemitter2": { @@ -1035,7 +1555,7 @@ "dev": true, "license": "MIT", "dependencies": { - "cross-spawn": "^7.0.6", + "cross-spawn": "^7.0.0", "get-stream": "^5.0.0", "human-signals": "^1.1.1", "is-stream": "^2.0.0", @@ -1103,6 +1623,34 @@ ], "license": "MIT" }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-diff": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz", + "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true, + "license": "MIT" + }, "node_modules/fd-slicer": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", @@ -1129,6 +1677,29 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/figures/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/file-entry-cache": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "flat-cache": "^4.0.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, "node_modules/fill-range": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", @@ -1149,7 +1720,6 @@ "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "locate-path": "^6.0.0", "path-exists": "^4.0.0" @@ -1172,6 +1742,27 @@ "flat": "cli.js" } }, + "node_modules/flat-cache": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.4" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/flatted": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.2.tgz", + "integrity": "sha512-AiwGJM8YcNOaobumgtng+6NHuOqC3A7MixFeDafM3X9cIUM+xUXoS5Vfgf+OihAYe20fxqNM9yPBXJzRtZ/4eA==", + "dev": true, + "license": "ISC" + }, "node_modules/forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", @@ -1342,17 +1933,41 @@ } }, "node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", "dev": true, "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/glob/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "license": "MIT", "peer": true, "dependencies": { - "is-glob": "^4.0.1" + "balanced-match": "^1.0.0" + } + }, + "node_modules/glob/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dev": true, + "license": "ISC", + "peer": true, + "dependencies": { + "brace-expansion": "^2.0.1" }, "engines": { - "node": ">= 6" + "node": ">=10" } }, "node_modules/global-dirs": { @@ -1371,6 +1986,19 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/globals": { + "version": "15.13.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-15.13.0.tgz", + "integrity": "sha512-49TewVEz0UxZjr1WYYsWpPrhyC/B/pA8Bq0fUmet2n+eR7yn0IvNzNaoBwnK6mdkzcN+se7Ez9zUgULTz2QH4g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/gopd": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", @@ -1510,6 +2138,43 @@ ], "license": "BSD-3-Clause" }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, "node_modules/indent-string": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", @@ -1569,7 +2234,6 @@ "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=0.10.0" } @@ -1590,7 +2254,6 @@ "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "is-extglob": "^2.1.1" }, @@ -1707,7 +2370,6 @@ "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "argparse": "^2.0.1" }, @@ -1722,6 +2384,13 @@ "dev": true, "license": "MIT" }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true, + "license": "MIT" + }, "node_modules/json-schema": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", @@ -1729,6 +2398,20 @@ "dev": true, "license": "(AFL-2.1 OR BSD-3-Clause)" }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true, + "license": "MIT" + }, "node_modules/json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", @@ -1772,6 +2455,16 @@ "dev": true, "license": "Apache-2.0" }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "json-buffer": "3.0.1" + } + }, "node_modules/lazy-ass": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/lazy-ass/-/lazy-ass-1.6.0.tgz", @@ -1782,6 +2475,20 @@ "node": "> 0.8" } }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/listr2": { "version": "3.14.0", "resolved": "https://registry.npmjs.org/listr2/-/listr2-3.14.0.tgz", @@ -1816,7 +2523,6 @@ "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "p-locate": "^5.0.0" }, @@ -1862,6 +2568,13 @@ "dev": true, "license": "MIT" }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true, + "license": "MIT" + }, "node_modules/lodash.once": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", @@ -1992,17 +2705,16 @@ } }, "node_modules/minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, "license": "ISC", - "peer": true, "dependencies": { - "brace-expansion": "^2.0.1" + "brace-expansion": "^1.1.7" }, "engines": { - "node": ">=10" + "node": "*" } }, "node_modules/minimist": { @@ -2016,9 +2728,9 @@ } }, "node_modules/mocha": { - "version": "10.7.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.7.0.tgz", - "integrity": "sha512-v8/rBWr2VO5YkspYINnvu81inSz2y3ODJrhO175/Exzor1RcEZZkizgE2A+w/CAXXoESS8Kys5E62dOHGHzULA==", + "version": "10.8.2", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.8.2.tgz", + "integrity": "sha512-VZlYo/WE8t1tstuRmqgeyBgCbJc/lEdopaa+axcKzTBJ+UIdlAB9XnmvTCAH4pwR4ElNInaedhEBmZD8iCSVEg==", "dev": true, "license": "MIT", "peer": true, @@ -2052,27 +2764,30 @@ "node": ">= 14.0.0" } }, - "node_modules/mocha/node_modules/escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "node_modules/mocha/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "dev": true, "license": "MIT", "peer": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "dependencies": { + "balanced-match": "^1.0.0" } }, - "node_modules/mocha/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "node_modules/mocha/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", "dev": true, - "license": "MIT", - "peer": true + "license": "ISC", + "peer": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } }, "node_modules/mochawesome": { "version": "7.1.3", @@ -2114,17 +2829,6 @@ "node": ">=10.0.0" } }, - "node_modules/mochawesome-merge/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, "node_modules/mochawesome-merge/node_modules/camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", @@ -2231,19 +2935,6 @@ "node": ">=8" } }, - "node_modules/mochawesome-merge/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, "node_modules/mochawesome-merge/node_modules/p-limit": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", @@ -2426,9 +3117,16 @@ } }, "node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true, "license": "MIT" }, @@ -2515,6 +3213,24 @@ "opener": "bin/opener-bin.js" } }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/ospath": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/ospath/-/ospath-1.2.2.tgz", @@ -2528,7 +3244,6 @@ "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "yocto-queue": "^0.1.0" }, @@ -2545,7 +3260,6 @@ "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "p-limit": "^3.0.2" }, @@ -2582,6 +3296,19 @@ "node": ">=6" } }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -2650,10 +3377,20 @@ "node": ">=0.10.0" } }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/prettier": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", - "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.4.1.tgz", + "integrity": "sha512-G+YdqtITVZmOJje6QkXQWzl3fSfMxFwm1tjTyo9exhkmWSqC4Yhd1+lug++IlR2mvRVAxEDDWYkQdeSztajqgg==", "dev": true, "license": "MIT", "bin": { @@ -2666,6 +3403,19 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, + "node_modules/prettier-linter-helpers": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", + "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-diff": "^1.1.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/pretty-bytes": { "version": "5.6.0", "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz", @@ -2709,9 +3459,9 @@ "license": "MIT" }, "node_modules/pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.2.tgz", + "integrity": "sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw==", "dev": true, "license": "MIT", "dependencies": { @@ -2719,6 +3469,16 @@ "once": "^1.3.1" } }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/qs": { "version": "6.13.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", @@ -2794,6 +3554,16 @@ "dev": true, "license": "ISC" }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, "node_modules/restore-cursor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", @@ -3036,7 +3806,6 @@ "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=8" }, @@ -3060,6 +3829,23 @@ "url": "https://github.com/chalk/supports-color?sponsor=1" } }, + "node_modules/synckit": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.9.2.tgz", + "integrity": "sha512-vrozgXDQwYO72vHjUb/HnFbQx1exDjoKzqx23aXEg2a9VIg2TSFZ8FmeZpTjUCFMYw7mpX4BE2SFu8wI7asYsw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@pkgr/core": "^0.1.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, "node_modules/tcomb": { "version": "3.2.29", "resolved": "https://registry.npmjs.org/tcomb/-/tcomb-3.2.29.tgz", @@ -3095,22 +3881,22 @@ "license": "MIT" }, "node_modules/tldts": { - "version": "6.1.62", - "resolved": "https://registry.npmjs.org/tldts/-/tldts-6.1.62.tgz", - "integrity": "sha512-TF+wo3MgTLbf37keEwQD0IxvOZO8UZxnpPJDg5iFGAASGxYzbX/Q0y944ATEjrfxG/pF1TWRHCPbFp49Mz1Y1w==", + "version": "6.1.64", + "resolved": "https://registry.npmjs.org/tldts/-/tldts-6.1.64.tgz", + "integrity": "sha512-ph4AE5BXWIOsSy9stpoeo7bYe/Cy7VfpciIH4RhVZUPItCJmhqWCN0EVzxd8BOHiyNb42vuJc6NWTjJkg91Tuw==", "dev": true, "license": "MIT", "dependencies": { - "tldts-core": "^6.1.62" + "tldts-core": "^6.1.64" }, "bin": { "tldts": "bin/cli.js" } }, "node_modules/tldts-core": { - "version": "6.1.62", - "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-6.1.62.tgz", - "integrity": "sha512-ohONqbfobpuaylhqFbtCzc0dFFeNz85FVKSesgT8DS9OV3a25Yj730pTj7/dDtCqmgoCgEj6gDiU9XxgHKQlBw==", + "version": "6.1.64", + "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-6.1.64.tgz", + "integrity": "sha512-uqnl8vGV16KsyflHOzqrYjjArjfXaU6rMPXYy2/ZWoRKCkXtghgB4VwTDXUG+t0OTGeSewNAG31/x1gCTfLt+Q==", "dev": true, "license": "MIT" }, @@ -3162,9 +3948,9 @@ } }, "node_modules/tslib": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", - "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==", + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", "dev": true, "license": "0BSD" }, @@ -3188,6 +3974,19 @@ "dev": true, "license": "Unlicense" }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/type-fest": { "version": "0.21.3", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", @@ -3202,9 +4001,9 @@ } }, "node_modules/undici-types": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.13.0.tgz", - "integrity": "sha512-xtFJHudx8S2DSoujjMd1WeWvn7KKWFRESZTMeL1RptAYERu29D6jphMjjY+vn96jvN3kVPDNxU/E13VTaXj6jg==", + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", + "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", "dev": true, "license": "MIT", "optional": true @@ -3229,6 +4028,16 @@ "node": ">=8" } }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, "node_modules/uuid": { "version": "8.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", @@ -3287,6 +4096,16 @@ "dev": true, "license": "ISC" }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/workerpool": { "version": "6.5.1", "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.5.1.tgz", @@ -3395,7 +4214,6 @@ "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=10" }, diff --git a/cypress-tests/package.json b/cypress-tests/package.json index 204e3393d0a1..ff168f61effb 100644 --- a/cypress-tests/package.json +++ b/cypress-tests/package.json @@ -3,6 +3,7 @@ "version": "1.0.0", "description": "", "main": "index.js", + "type": "module", "scripts": { "cypress": "npx cypress open", "cypress-e2e": "npx cypress run --e2e", @@ -10,14 +11,23 @@ "cypress:payments": "cypress run --headless --spec 'cypress/e2e/PaymentTest/**/*'", "cypress:payouts": "cypress run --headless --spec 'cypress/e2e/PayoutTest/**/*'", "cypress:payment-method-list": "cypress run --headless --spec 'cypress/e2e/PaymentMethodListTest/**/*'", - "cypress:routing": "cypress run --headless --spec 'cypress/e2e/RoutingTest/**/*'" + "cypress:routing": "cypress run --headless --spec 'cypress/e2e/RoutingTest/**/*'", + "format": "prettier --config .prettierrc . --write", + "format:check": "prettier --config .prettierrc . --check", + "lint": "eslint ." }, - "author": "", + "author": "Hyperswitch", "license": "ISC", "devDependencies": { + "@eslint/js": "^9.16.0", "cypress": "^13.16.0", "cypress-mochawesome-reporter": "^3.8.2", + "eslint": "^9.16.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-cypress": "^4.1.0", + "eslint-plugin-prettier": "^5.2.1", + "globals": "^15.13.0", "jsqr": "^1.4.0", - "prettier": "^3.3.2" + "prettier": "^3.4.1" } }