From 81462b00eb3a40353b94bee32e29b0ed9c5cfa5d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 27 Aug 2019 07:01:27 +0000 Subject: [PATCH 1/3] Bump eslint-utils from 1.3.1 to 1.4.2 Bumps [eslint-utils](https://github.com/mysticatea/eslint-utils) from 1.3.1 to 1.4.2. - [Release notes](https://github.com/mysticatea/eslint-utils/releases) - [Commits](https://github.com/mysticatea/eslint-utils/compare/v1.3.1...v1.4.2) Signed-off-by: dependabot[bot] --- package-lock.json | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 361af05..64699c1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3387,10 +3387,13 @@ } }, "eslint-utils": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.3.1.tgz", - "integrity": "sha512-Z7YjnIldX+2XMcjr7ZkgEsOj/bREONV60qYeB/bjMAqqqZ4zxKyWX+BOUkdmRmA9riiIPVvo5x86m5elviOk0Q==", - "dev": true + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.2.tgz", + "integrity": "sha512-eAZS2sEUMlIeCjBeubdj45dmBHQwPHWyBcT1VSYB7o9x9WRRqKxyUoiXlRjyAwzN7YEzHJlYg0NmzDRWx6GP4Q==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.0.0" + } }, "eslint-visitor-keys": { "version": "1.0.0", From 399343a09d31977a75091a69ab4bbb527454a4b6 Mon Sep 17 00:00:00 2001 From: Mark Moffat Date: Fri, 30 Aug 2019 15:57:17 +0930 Subject: [PATCH 2/3] Update nodejs.yml --- .github/workflows/nodejs.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/nodejs.yml diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml new file mode 100644 index 0000000..e4a51cd --- /dev/null +++ b/.github/workflows/nodejs.yml @@ -0,0 +1,29 @@ +name: Node CI + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [8.x, 10.x, 12.x] + + steps: + - uses: mrvautin/mongodb-action@v1 + - name: MongoDB + with: + mongo version: '3.4.10' + - uses: actions/checkout@v1 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - name: npm install, build, and test + run: | + npm install + npm test + env: + CI: true From c42bd43de3dfda9c1e4ca6f4f338885d1a13d318 Mon Sep 17 00:00:00 2001 From: Aayush Saxena Date: Thu, 25 Jul 2019 00:47:19 +0530 Subject: [PATCH 3/3] code refactored - used switch case instead of if --- app.js | 45 +++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/app.js b/app.js index 8d0d573..ddcbdd8 100644 --- a/app.js +++ b/app.js @@ -31,26 +31,31 @@ if(baseConfig === false){ } // Validate the payment gateway config -if(config.paymentGateway === 'paypal'){ - const paypalConfig = ajv.validate(require('./config/paypalSchema'), require('./config/paypal.json')); - if(paypalConfig === false){ - console.log(colors.red(`PayPal config is incorrect: ${ajv.errorsText()}`)); - process.exit(2); - } -} -if(config.paymentGateway === 'stripe'){ - const stripeConfig = ajv.validate(require('./config/stripeSchema'), require('./config/stripe.json')); - if(stripeConfig === false){ - console.log(colors.red(`Stripe config is incorrect: ${ajv.errorsText()}`)); - process.exit(2); - } -} -if(config.paymentGateway === 'authorizenet'){ - const authorizenetConfig = ajv.validate(require('./config/authorizenetSchema'), require('./config/authorizenet.json')); - if(authorizenetConfig === false){ - console.log(colors.red(`Authorizenet config is incorrect: ${ajv.errorsText()}`)); - process.exit(2); - } +switch(config.paymentGateway) +{ + case 'paypal': + const paypalConfig = ajv.validate(require('./config/paypalSchema'), require('./config/paypal.json')); + if(paypalConfig === false){ + console.log(colors.red(`PayPal config is incorrect: ${ajv.errorsText()}`)); + process.exit(2); + } + break; + + case 'stripe': + const stripeConfig = ajv.validate(require('./config/stripeSchema'), require('./config/stripe.json')); + if(stripeConfig === false){ + console.log(colors.red(`Stripe config is incorrect: ${ajv.errorsText()}`)); + process.exit(2); + } + break; + + case 'authorizenet': + const authorizenetConfig = ajv.validate(require('./config/authorizenetSchema'), require('./config/authorizenet.json')); + if(authorizenetConfig === false){ + console.log(colors.red(`Authorizenet config is incorrect: ${ajv.errorsText()}`)); + process.exit(2); + } + break; } // require the routes