Merge branch 'master' of github.com:mrvautin/expressCart

master
Mark Moffat 2019-10-25 13:34:49 +10:30
commit 59c7d1c8e4
3 changed files with 61 additions and 24 deletions

29
.github/workflows/nodejs.yml vendored Normal file
View File

@ -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

15
app.js
View File

@ -31,26 +31,31 @@ if(baseConfig === false){
} }
// Validate the payment gateway config // Validate the payment gateway config
if(config.paymentGateway === 'paypal'){ switch(config.paymentGateway)
{
case 'paypal':
const paypalConfig = ajv.validate(require('./config/paypalSchema'), require('./config/paypal.json')); const paypalConfig = ajv.validate(require('./config/paypalSchema'), require('./config/paypal.json'));
if(paypalConfig === false){ if(paypalConfig === false){
console.log(colors.red(`PayPal config is incorrect: ${ajv.errorsText()}`)); console.log(colors.red(`PayPal config is incorrect: ${ajv.errorsText()}`));
process.exit(2); process.exit(2);
} }
} break;
if(config.paymentGateway === 'stripe'){
case 'stripe':
const stripeConfig = ajv.validate(require('./config/stripeSchema'), require('./config/stripe.json')); const stripeConfig = ajv.validate(require('./config/stripeSchema'), require('./config/stripe.json'));
if(stripeConfig === false){ if(stripeConfig === false){
console.log(colors.red(`Stripe config is incorrect: ${ajv.errorsText()}`)); console.log(colors.red(`Stripe config is incorrect: ${ajv.errorsText()}`));
process.exit(2); process.exit(2);
} }
} break;
if(config.paymentGateway === 'authorizenet'){
case 'authorizenet':
const authorizenetConfig = ajv.validate(require('./config/authorizenetSchema'), require('./config/authorizenet.json')); const authorizenetConfig = ajv.validate(require('./config/authorizenetSchema'), require('./config/authorizenet.json'));
if(authorizenetConfig === false){ if(authorizenetConfig === false){
console.log(colors.red(`Authorizenet config is incorrect: ${ajv.errorsText()}`)); console.log(colors.red(`Authorizenet config is incorrect: ${ajv.errorsText()}`));
process.exit(2); process.exit(2);
} }
break;
} }
// require the routes // require the routes

11
package-lock.json generated
View File

@ -3387,10 +3387,13 @@
} }
}, },
"eslint-utils": { "eslint-utils": {
"version": "1.3.1", "version": "1.4.2",
"resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.3.1.tgz", "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.2.tgz",
"integrity": "sha512-Z7YjnIldX+2XMcjr7ZkgEsOj/bREONV60qYeB/bjMAqqqZ4zxKyWX+BOUkdmRmA9riiIPVvo5x86m5elviOk0Q==", "integrity": "sha512-eAZS2sEUMlIeCjBeubdj45dmBHQwPHWyBcT1VSYB7o9x9WRRqKxyUoiXlRjyAwzN7YEzHJlYg0NmzDRWx6GP4Q==",
"dev": true "dev": true,
"requires": {
"eslint-visitor-keys": "^1.0.0"
}
}, },
"eslint-visitor-keys": { "eslint-visitor-keys": {
"version": "1.0.0", "version": "1.0.0",