From 8143b30483e36677a180cabb97a07f7cda4ba4e4 Mon Sep 17 00:00:00 2001 From: shashi165 <33355509+shashi165@users.noreply.github.com> Date: Wed, 17 Feb 2021 09:53:58 -0600 Subject: [PATCH] fix(headers)!: made fspiop-destination header mandatory (#259) * fix(headers) ! :made fspiop-destination header mandatory * added unit test * added unit test --- .circleci/config.yml | 2 +- audit-resolve.json | 5 +- package-lock.json | 211 +++++++++++----------- package.json | 8 +- src/interface/QuotingService-swagger.yaml | 1 + src/interface/swagger.json | 28 +-- test/unit/serverStart.test.js | 36 +++- 7 files changed, 162 insertions(+), 129 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 63b1c5d1..b32f8c18 100755 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,7 +10,7 @@ orbs: anchore: anchore/anchore-engine@1.6.6 deploy-kube: mojaloop/deployment@0.1.6 slack: circleci/slack@3.4.2 - pr-tools: mojaloop/pr-tools@0.1.8 + pr-tools: mojaloop/pr-tools@0.1.10 ## # defaults diff --git a/audit-resolve.json b/audit-resolve.json index 5569142b..3a242174 100644 --- a/audit-resolve.json +++ b/audit-resolve.json @@ -1,8 +1,9 @@ { "decisions": { "1500|@mojaloop/central-services-shared>widdershins>yargs>yargs-parser": { - "decision": "postpone", - "madeAt": 1612854410785 + "decision": "ignore", + "madeAt": 1613503685058, + "expiresAt": 1616095674581 } }, "rules": {}, diff --git a/package-lock.json b/package-lock.json index dd14f096..44e908fb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "quoting-service", - "version": "11.2.3", + "version": "12.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1282,18 +1282,18 @@ "optional": true }, "@mojaloop/central-services-error-handling": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@mojaloop/central-services-error-handling/-/central-services-error-handling-11.0.0.tgz", - "integrity": "sha512-kK7d09NM9uhpwXSzeAuyVWetVkrK5UICC/jdByYry1QQ2JosaKbu12N08qRTjfbpkHU7DG5l+EV2vmdMPeQ3ZQ==", + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/@mojaloop/central-services-error-handling/-/central-services-error-handling-11.1.0.tgz", + "integrity": "sha512-xtYn4Q+D5Sg8ApyjDVFL9KfVsBY4lK2z2CZtE3J80MJRyFJg9X+K+ORQKCVq3+5+bGhTtpsEAGBXGRtrAH8tPA==", "requires": { - "@mojaloop/sdk-standard-components": "13.1.2", + "@mojaloop/sdk-standard-components": "14.0.0", "lodash": "4.17.20" }, "dependencies": { "@mojaloop/sdk-standard-components": { - "version": "13.1.2", - "resolved": "https://registry.npmjs.org/@mojaloop/sdk-standard-components/-/sdk-standard-components-13.1.2.tgz", - "integrity": "sha512-eo8DWLUYkeXoj+Qd97qEm2fQEVzodJTB0eBUjWUS7pcNWEzLW7HXh0Kouozyfs0Ba5SUngYXNjWDTce0Qp95uQ==", + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/@mojaloop/sdk-standard-components/-/sdk-standard-components-14.0.0.tgz", + "integrity": "sha512-ktnwh0QG13hHZYgW3xKpPz/tcE5+2/ReA37269buEROOfyFk8PtSlzk3EGxhnL9kHGE4tdG8k77pyFKrIGj7lQ==", "requires": { "base64url": "3.0.1", "fast-safe-stringify": "^2.0.7", @@ -1486,9 +1486,9 @@ "dev": true }, "@npmcli/git": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@npmcli/git/-/git-2.0.4.tgz", - "integrity": "sha512-OJZCmJ9DNn1cz9HPXXsPmUBnqaArot3CGYo63CyajHQk+g87rPXVOJByGsskQJhPsUUEXJcsZ2Q6bWd2jSwnBA==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@npmcli/git/-/git-2.0.6.tgz", + "integrity": "sha512-a1MnTfeRPBaKbFY07fd+6HugY1WAkKJzdiJvlRub/9o5xz2F/JtPacZZapx5zRJUQFIzSL677vmTSxEcDMrDbg==", "dev": true, "requires": { "@npmcli/promise-spawn": "^1.1.0", @@ -1496,7 +1496,7 @@ "mkdirp": "^1.0.3", "npm-pick-manifest": "^6.0.0", "promise-inflight": "^1.0.1", - "promise-retry": "^1.1.1", + "promise-retry": "^2.0.1", "semver": "^7.3.2", "unique-filename": "^1.1.1", "which": "^2.0.2" @@ -1529,21 +1529,19 @@ } }, "@npmcli/installed-package-contents": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@npmcli/installed-package-contents/-/installed-package-contents-1.0.5.tgz", - "integrity": "sha512-aKIwguaaqb6ViwSOFytniGvLPb9SMCUm39TgM3SfUo7n0TxUMbwoXfpwyvQ4blm10lzbAwTsvjr7QZ85LvTi4A==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/@npmcli/installed-package-contents/-/installed-package-contents-1.0.7.tgz", + "integrity": "sha512-9rufe0wnJusCQoLpV9ZPKIVP55itrM5BxOXs10DmdbRfgWtHy1LDyskbwRnBghuB0PrF7pNPOqREVtpz4HqzKw==", "dev": true, "requires": { "npm-bundled": "^1.1.1", - "npm-normalize-package-bin": "^1.0.1", - "read-package-json-fast": "^1.1.1", - "readdir-scoped-modules": "^1.1.0" + "npm-normalize-package-bin": "^1.0.1" } }, "@npmcli/move-file": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@npmcli/move-file/-/move-file-1.1.1.tgz", - "integrity": "sha512-LtWTicuF2wp7PNTuyCwABx7nNG+DnzSE8gN0iWxkC6mpgm/iOPu0ZMTkXuCxmJxtWFsDxUaixM9COSNJEMUfuQ==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@npmcli/move-file/-/move-file-1.1.2.tgz", + "integrity": "sha512-1SUf/Cg2GzGDyaf15aR9St9TWlb+XvbZXWpDx8YKs7MLzMH/BCeopv+y9vzrzgkfykCGuWOlSu3mZhj2+FQcrg==", "dev": true, "requires": { "mkdirp": "^1.0.4", @@ -1568,9 +1566,9 @@ } }, "@npmcli/node-gyp": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@npmcli/node-gyp/-/node-gyp-1.0.1.tgz", - "integrity": "sha512-pBqoKPWmuk9iaEcXlLBVRIA6I1kG9JiICU+sG0NuD6NAR461F+02elHJS4WkQxHW2W5rnsfvP/ClKwmsZ9RaaA==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@npmcli/node-gyp/-/node-gyp-1.0.2.tgz", + "integrity": "sha512-yrJUe6reVMpktcvagumoqD9r08fH1iRo01gn1u0zoCApa9lnZGEigVKUd2hzsCId4gdtkZZIVscLhNxMECKgRg==", "dev": true }, "@npmcli/promise-spawn": { @@ -1583,17 +1581,17 @@ } }, "@npmcli/run-script": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-1.8.1.tgz", - "integrity": "sha512-G8c86g9cQHyRINosIcpovzv0BkXQc3urhL1ORf3KTe4TS4UBsg2O4Z2feca/W3pfzdHEJzc83ETBW4aKbb3SaA==", + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-1.8.3.tgz", + "integrity": "sha512-ELPGWAVU/xyU+A+H3pEPj0QOvYwLTX71RArXcClFzeiyJ/b/McsZ+d0QxpznvfFtZzxGN/gz/1cvlqICR4/suQ==", "dev": true, "requires": { - "@npmcli/node-gyp": "^1.0.0", - "@npmcli/promise-spawn": "^1.3.0", + "@npmcli/node-gyp": "^1.0.2", + "@npmcli/promise-spawn": "^1.3.2", "infer-owner": "^1.0.4", "node-gyp": "^7.1.0", "puka": "^1.0.1", - "read-package-json-fast": "^1.1.3" + "read-package-json-fast": "^2.0.1" } }, "@protobufjs/aspromise": { @@ -2245,12 +2243,6 @@ "function-bind": "^1.1.1" } }, - "asap": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", - "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=", - "dev": true - }, "ascli": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/ascli/-/ascli-1.0.1.tgz", @@ -3661,12 +3653,6 @@ "ms": "^2.1.1" } }, - "debuglog": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/debuglog/-/debuglog-1.0.1.tgz", - "integrity": "sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI=", - "dev": true - }, "decamelize": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", @@ -3834,16 +3820,6 @@ "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", "dev": true }, - "dezalgo": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/dezalgo/-/dezalgo-1.0.3.tgz", - "integrity": "sha1-f3Qt4Gb8dIvI24IFad3c5Jvw1FY=", - "dev": true, - "requires": { - "asap": "^2.0.0", - "wrappy": "1" - } - }, "diff": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", @@ -4116,9 +4092,9 @@ "integrity": "sha512-XnoXQhg98QpSQqpBjySM3VjXGVrIvisgFbFURxAxOymarLzlcdvy6Y3qlnvZFaAp5j99qwSbRwqbrZtug/0x9w==" }, "err-code": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/err-code/-/err-code-1.1.2.tgz", - "integrity": "sha1-BuARbTAo9q70gGhJ6w6mp0iuaWA=", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz", + "integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==", "dev": true }, "error-callsites": { @@ -4261,12 +4237,12 @@ } }, "eslint": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.19.0.tgz", - "integrity": "sha512-CGlMgJY56JZ9ZSYhJuhow61lMPPjUzWmChFya71Z/jilVos7mR/jPgaEfVGgMBY5DshbKdG8Ezb8FDCHcoMEMg==", + "version": "7.20.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.20.0.tgz", + "integrity": "sha512-qGi0CTcOGP2OtCQBgWZlQjcTuP0XkIpYFj25XtRTQSHC+umNnp7UMshr2G8SLsRFYDdAPFeHOsiteadmMH02Yw==", "dev": true, "requires": { - "@babel/code-frame": "^7.0.0", + "@babel/code-frame": "7.12.11", "@eslint/eslintrc": "^0.3.0", "ajv": "^6.10.0", "chalk": "^4.0.0", @@ -4278,7 +4254,7 @@ "eslint-utils": "^2.1.0", "eslint-visitor-keys": "^2.0.0", "espree": "^7.3.1", - "esquery": "^1.2.0", + "esquery": "^1.4.0", "esutils": "^2.0.2", "file-entry-cache": "^6.0.0", "functional-red-black-tree": "^1.0.1", @@ -4305,6 +4281,15 @@ "v8-compile-cache": "^2.0.3" }, "dependencies": { + "@babel/code-frame": { + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz", + "integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==", + "dev": true, + "requires": { + "@babel/highlight": "^7.10.4" + } + }, "@eslint/eslintrc": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.3.0.tgz", @@ -4389,6 +4374,21 @@ "ms": "2.1.2" } }, + "esquery": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "dev": true, + "requires": { + "estraverse": "^5.1.0" + } + }, + "estraverse": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", + "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "dev": true + }, "is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", @@ -4493,9 +4493,9 @@ }, "dependencies": { "ajv": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-7.0.4.tgz", - "integrity": "sha512-xzzzaqgEQfmuhbhAoqjJ8T/1okb6gAzXn/eQRNpAN1AEUoHJTNF9xCDRTtf/s3SKldtZfa+RJeTs+BQq+eZ/sw==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-7.1.0.tgz", + "integrity": "sha512-svS9uILze/cXbH0z2myCK2Brqprx/+JJYK5pHicT/GQiBfzzhUVAIT6MwqJg8y4xV/zoGsUeuPuwtoiKSGE15g==", "dev": true, "requires": { "fast-deep-equal": "^3.1.1", @@ -9000,9 +9000,9 @@ } }, "make-fetch-happen": { - "version": "8.0.13", - "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-8.0.13.tgz", - "integrity": "sha512-rQ5NijwwdU8tIaBrpTtSVrNCcAJfyDRcKBC76vOQlyJX588/88+TE+UpjWl4BgG7gCkp29wER7xcRqkeg+x64Q==", + "version": "8.0.14", + "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-8.0.14.tgz", + "integrity": "sha512-EsS89h6l4vbfJEtBZnENTOFk8mCRpY5ru36Xe5bcX1KYIli2mkSHqoFsp5O1wMDvTJJzxe/4THpCTtygjeeGWQ==", "dev": true, "requires": { "agentkeepalive": "^4.1.3", @@ -9017,7 +9017,7 @@ "minipass-fetch": "^1.3.2", "minipass-flush": "^1.0.5", "minipass-pipeline": "^1.2.4", - "promise-retry": "^1.1.1", + "promise-retry": "^2.0.1", "socks-proxy-agent": "^5.0.0", "ssri": "^8.0.0" }, @@ -9966,9 +9966,9 @@ } }, "npm-check-updates": { - "version": "11.1.1", - "resolved": "https://registry.npmjs.org/npm-check-updates/-/npm-check-updates-11.1.1.tgz", - "integrity": "sha512-0K2csepXxqXd3sh05qxU9BcW/pvFBatlM6E4UKKVFe6XlGjQXo4TfI5vRT4uZLG0v2Zj/bWUouQiZvEg5iAFHA==", + "version": "11.1.4", + "resolved": "https://registry.npmjs.org/npm-check-updates/-/npm-check-updates-11.1.4.tgz", + "integrity": "sha512-jq1KAfYcbeFWBLyRj7YT5rwQ3paInsqukeawlwfUdnvmgxKb5uFpd7km/ghPjxAQWVvIecvsYJX0FCHWk4j/iA==", "dev": true, "requires": { "chalk": "^4.1.0", @@ -9979,7 +9979,7 @@ "fp-and-or": "^0.1.3", "get-stdin": "^8.0.0", "globby": "^11.0.2", - "hosted-git-info": "^3.0.7", + "hosted-git-info": "^3.0.8", "json-parse-helpfulerror": "^1.0.3", "jsonlines": "^0.1.1", "libnpmconfig": "^1.2.1", @@ -9996,7 +9996,7 @@ "semver": "^7.3.4", "semver-utils": "^1.1.4", "spawn-please": "^1.0.0", - "update-notifier": "^5.0.1" + "update-notifier": "^5.1.0" }, "dependencies": { "ansi-styles": { @@ -11003,15 +11003,15 @@ } }, "pacote": { - "version": "11.2.5", - "resolved": "https://registry.npmjs.org/pacote/-/pacote-11.2.5.tgz", - "integrity": "sha512-KgVY3Rh3xJnhnRCirmsXW8kIdbslrFTnYeTtdzyvObPgj/Tc5VqdmazxsvdXGdIgRB/Km92mBKfuWcGGqgu7UQ==", + "version": "11.2.6", + "resolved": "https://registry.npmjs.org/pacote/-/pacote-11.2.6.tgz", + "integrity": "sha512-xCl++Hb3aBC7LaWMimbO4xUqZVsEbKDVc6KKDIIyAeBYrmMwY1yJC2nES/lsGd8sdQLUosgBxQyuVNncZ2Ru0w==", "dev": true, "requires": { "@npmcli/git": "^2.0.1", - "@npmcli/installed-package-contents": "^1.0.5", + "@npmcli/installed-package-contents": "^1.0.6", "@npmcli/promise-spawn": "^1.2.0", - "@npmcli/run-script": "^1.3.0", + "@npmcli/run-script": "^1.8.2", "cacache": "^15.0.5", "chownr": "^2.0.0", "fs-minipass": "^2.1.0", @@ -11022,10 +11022,10 @@ "npm-packlist": "^2.1.4", "npm-pick-manifest": "^6.0.0", "npm-registry-fetch": "^9.0.0", - "promise-retry": "^1.1.1", - "read-package-json-fast": "^1.1.3", + "promise-retry": "^2.0.1", + "read-package-json-fast": "^2.0.1", "rimraf": "^3.0.2", - "ssri": "^8.0.0", + "ssri": "^8.0.1", "tar": "^6.1.0" }, "dependencies": { @@ -11557,13 +11557,13 @@ "dev": true }, "promise-retry": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-1.1.1.tgz", - "integrity": "sha1-ZznpaOMFHaIM5kl/srUPaRHfPW0=", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-2.0.1.tgz", + "integrity": "sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g==", "dev": true, "requires": { - "err-code": "^1.0.0", - "retry": "^0.10.0" + "err-code": "^2.0.2", + "retry": "^0.12.0" } }, "prompts": { @@ -11698,6 +11698,12 @@ "resolved": "https://registry.npmjs.org/qs/-/qs-6.9.6.tgz", "integrity": "sha512-TIRk4aqYLNoJUbd+g2lEdz5kLWIuTMRagAXxl78Q0RiVjAOugHmeKNGdd3cwo/ktpf9aL9epCfFqWDEKysUlLQ==" }, + "queue-microtask": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.2.tgz", + "integrity": "sha512-dB15eXv3p2jDlbOiNLyMabYg1/sXvppd8DP2J3EOCQ0AkuSXCW2tP7mnVouVLJKgUMY6yP0kcQDVpLCN13h4Xg==", + "dev": true + }, "randexp": { "version": "0.4.9", "resolved": "https://registry.npmjs.org/randexp/-/randexp-0.4.9.tgz", @@ -11808,9 +11814,9 @@ } }, "read-package-json-fast": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/read-package-json-fast/-/read-package-json-fast-1.2.1.tgz", - "integrity": "sha512-OFbpwnHcv74Oa5YN5WvbOBfLw6yPmPcwvyJJw/tj9cWFBF7juQUDLDSZiOjEcgzfweWeeROOmbPpNN1qm4hcRg==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/read-package-json-fast/-/read-package-json-fast-2.0.1.tgz", + "integrity": "sha512-bp6z0tdgLy9KzdfENDIw/53HWAolOVoQTRWXv7PUiqAo3YvvoUVeLr7RWPWq+mu7KUOu9kiT4DvxhUgNUBsvug==", "dev": true, "requires": { "json-parse-even-better-errors": "^2.3.0", @@ -11866,18 +11872,6 @@ "util-deprecate": "^1.0.1" } }, - "readdir-scoped-modules": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/readdir-scoped-modules/-/readdir-scoped-modules-1.1.0.tgz", - "integrity": "sha512-asaikDeqAQg7JifRsZn1NJZXo9E+VwlyCfbkZhwyISinqk5zNS6266HS5kah6P0SaQKGF6SkNnZVHUzHFYxYDw==", - "dev": true, - "requires": { - "debuglog": "^1.0.1", - "dezalgo": "^1.0.0", - "graceful-fs": "^4.1.2", - "once": "^1.3.0" - } - }, "readdirp": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", @@ -12171,9 +12165,9 @@ "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==" }, "retry": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/retry/-/retry-0.10.1.tgz", - "integrity": "sha1-52OI0heZLCUnUCQdPTlW/tmNj/Q=", + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", + "integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=", "dev": true }, "reusify": { @@ -12205,10 +12199,13 @@ "dev": true }, "run-parallel": { - "version": "1.1.10", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.1.10.tgz", - "integrity": "sha512-zb/1OuZ6flOlH6tQyMPUrE3x3Ulxjlo9WIVXR4yVYi4H9UXQaeIsPbLn2R3O3vQCnDKkAl2qHiuocKKX4Tz/Sw==", - "dev": true + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "requires": { + "queue-microtask": "^1.2.2" + } }, "safe-buffer": { "version": "5.2.1", diff --git a/package.json b/package.json index 24073bbe..66d8dce6 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "quoting-service", "description": "Quoting Service hosted by a scheme", "license": "Apache-2.0", - "version": "11.2.3", + "version": "12.0.0", "author": "ModusBox", "contributors": [ "Georgi Georgiev ", @@ -63,7 +63,7 @@ "@hapi/hapi": "20.1.0", "@hapi/inert": "6.0.3", "@hapi/vision": "6.0.1", - "@mojaloop/central-services-error-handling": "11.0.0", + "@mojaloop/central-services-error-handling": "11.1.0", "@mojaloop/central-services-logger": "10.6.0", "@mojaloop/central-services-shared": "11.5.5", "@mojaloop/event-sdk": "10.6.0", @@ -88,11 +88,11 @@ }, "devDependencies": { "@types/jest": "26.0.20", - "eslint": "7.19.0", + "eslint": "7.20.0", "jest": "26.6.3", "jest-junit": "12.0.0", "npm-audit-resolver": "2.2.1", - "npm-check-updates": "11.1.1", + "npm-check-updates": "11.1.4", "nyc": "15.1.0", "pre-commit": "1.2.2", "proxyquire": "2.1.3", diff --git a/src/interface/QuotingService-swagger.yaml b/src/interface/QuotingService-swagger.yaml index 7fea70da..3c3c460c 100644 --- a/src/interface/QuotingService-swagger.yaml +++ b/src/interface/QuotingService-swagger.yaml @@ -1618,6 +1618,7 @@ components: the destination. The field should be set by the original sender of the request (if known), so that any entities between the client and the server do not need to parse the payload for routing purposes. + required: true schema: type: string FSPIOP-Encryption: diff --git a/src/interface/swagger.json b/src/interface/swagger.json index 8f88b971..9ef78f9c 100644 --- a/src/interface/swagger.json +++ b/src/interface/swagger.json @@ -1898,11 +1898,11 @@ "description": "Data model for the complex type GeoCode. Indicates the geographic location from where the transaction was initiated.", "properties": { "latitude": { - "type": "string", + "$ref": "#/definitions/Latitude", "description": "Latitude of the Party." }, "longitude": { - "type": "string", + "$ref": "#/definitions/Longitude", "description": "Longitude of the Party." } }, @@ -2180,7 +2180,7 @@ "description": "Party Id type, id, sub id or type, and FSP Id." }, "merchantClassificationCode": { - "type": "string", + "$ref": "#/definitions/MerchantClassificationCode", "description": "Used in the context of Payee Information, where the Payee happens to be a merchant accepting merchant payments." }, "name": { @@ -2270,7 +2270,7 @@ "description": "First, middle and last name for the Party." }, "dateOfBirth": { - "type": "string", + "$ref": "#/definitions/DateOfBirth", "description": "Date of birth for the Party." } } @@ -2307,7 +2307,7 @@ "description": "Common id (decided by the Payer FSP) between the FSPs for the future transaction object. The actual transaction will be created as part of a successful transfer process. The id should be reused for resends of the same quote for a transaction. A new id should be generated for each new quote for a transaction." }, "transactionRequestId": { - "type": "string", + "$ref": "#/definitions/TransactionId", "description": "Identifies an optional previously-sent transaction request." }, "payee": { @@ -2319,7 +2319,7 @@ "description": "Information about the Payer in the proposed financial transaction." }, "amountType": { - "type": "string", + "$ref": "#/definitions/AmountType", "description": "SEND for send amount, RECEIVE for receive amount." }, "amount": { @@ -2343,7 +2343,7 @@ "description": "A memo that will be attached to the transaction." }, "expiration": { - "type": "string", + "$ref": "#/definitions/DateTime", "description": "Expiration is optional. It can be set to get a quick failure in case the peer FSP takes too long to respond. Also, it may be beneficial for Consumer, Agent, and Merchant to know that their request has a time limit." }, "extensionList": { @@ -2416,7 +2416,7 @@ "description": "Data model for the complex type Refund.", "properties": { "originalTransactionId": { - "type": "string", + "$ref": "#/definitions/TransactionId", "description": "Reference to the original transaction id that is requested to be refunded." }, "refundReason": { @@ -2540,19 +2540,19 @@ "description": "Data model for the complex type TransactionType.", "properties": { "scenario": { - "type": "string", + "$ref": "#/definitions/TransactionScenario", "description": "Deposit, withdrawal, refund, …" }, "subScenario": { - "type": "string", + "$ref": "#/definitions/TransactionSubScenario", "description": "Possible sub-scenario, defined locally within the scheme." }, "initiator": { - "type": "string", + "$ref": "#/definitions/TransactionInitiator", "description": "Who is initiating the transaction - Payer or Payee" }, "initiatorType": { - "type": "string", + "$ref": "#/definitions/TransactionInitiatorType", "description": "Consumer, agent, business, …" }, "refundInfo": { @@ -2560,7 +2560,7 @@ "description": "Extra information specific to a refund scenario. Should only be populated if scenario is REFUND" }, "balanceOfPayments": { - "type": "string", + "$ref": "#/definitions/BalanceOfPayments", "description": "Balance of Payments code." } }, @@ -2888,7 +2888,7 @@ "name": "fspiop-destination", "in": "header", "type": "string", - "required": false, + "required": true, "description": "The FSPIOP-Destination header field is a non-HTTP standard field used by the API for HTTP header based routing of requests and responses to the destination. The field should be set by the original sender of the request (if known), so that any entities between the client and the server do not need to parse the payload for routing purposes." }, "FSPIOP-Encryption": { diff --git a/test/unit/serverStart.test.js b/test/unit/serverStart.test.js index a54d6765..ea60743b 100644 --- a/test/unit/serverStart.test.js +++ b/test/unit/serverStart.test.js @@ -29,7 +29,7 @@ -------------- ******/ -const Mockgen = require('../util/helper').mockRequest +const { mockRequest: Mockgen, defaultHeaders } = require('../util/helper') let Database let server @@ -69,4 +69,38 @@ describe('Server Start', () => { const response = await server.inject(options) expect(response.statusCode).toBe(200) }) + + it('post /quotes throws error when missing mandatory header', async () => { + // Arrange + Database.mockImplementationOnce(() => ({ + connect: jest.fn().mockResolvedValueOnce() + })) + + // Act + const initialize = require('../../src/server') + server = await initialize() + const requests = Mockgen().requestsAsync('/quotes', 'post') + const mock = await requests + + // Arrange + const headers = defaultHeaders() + delete headers['fspiop-destination'] + const expectedResult = { + errorInformation: { + errorCode: '3102', + errorDescription: 'Missing mandatory element - .header should have required property \'fspiop-destination\'' + } + } + + const options = { + method: 'post', + url: '' + mock.request.path, + headers, + payload: mock.request.body + } + // Act + const response = await server.inject(options) + expect(response.statusCode).toBe(400) + expect(response.result).toEqual(expectedResult) + }) })