From 42f28ea0f98e9ec6bf0a804418e9893056760c7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=9Fur=20G=C3=BCm=C3=BC=C5=9Fhan?= Date: Wed, 21 Feb 2024 13:54:23 +0300 Subject: [PATCH 1/7] Qna fixes (#175) * 1.0.119 * determine whether to generate question set from the correct request body values * send expected value to webook * use webhook secret to make request valid --- npm-shrinkwrap.json | 4 ++-- package.json | 2 +- src/helpers/webhooks.ts | 2 ++ src/routes/backoffice.ts | 14 +++++++++----- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 33afd907fa..2656f973b8 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,12 +1,12 @@ { "name": "@kontist/mock-solaris", - "version": "1.0.118", + "version": "1.0.119", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@kontist/mock-solaris", - "version": "1.0.118", + "version": "1.0.119", "license": "Apache-2.0", "dependencies": { "bluebird": "^3.4.7", diff --git a/package.json b/package.json index b90b5dccc3..f052de5967 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kontist/mock-solaris", - "version": "1.0.118", + "version": "1.0.119", "description": "Mock Service for Solaris API", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", diff --git a/src/helpers/webhooks.ts b/src/helpers/webhooks.ts index 58e6445ba2..5fc1fcec52 100644 --- a/src/helpers/webhooks.ts +++ b/src/helpers/webhooks.ts @@ -63,6 +63,8 @@ const WEBHOOK_SECRETS = { process.env.SOLARIS_PERSON_DELETED_WEBHOOK_SECRET, [PersonWebhookEvent.PERSON_CHANGED]: process.env.SOLARIS_PERSON_CHANGED_WEBHOOK_SECRET, + [PersonWebhookEvent.QUESTIONS_REQUIRE_RESPONSE]: + process.env.SOLARIS_QUESTIONS_REQUIRE_RESPONSE_WEBHOOK_SECRET, [TransactionWebhookEvent.BOOKING]: process.env.SOLARIS_BOOKING_WEBHOOK_SECRET, [TransactionWebhookEvent.SEPA_SCHEDULED_TRANSACTION]: diff --git a/src/routes/backoffice.ts b/src/routes/backoffice.ts index bb83756826..bc1d4d4f8b 100644 --- a/src/routes/backoffice.ts +++ b/src/routes/backoffice.ts @@ -282,10 +282,11 @@ export const updatePersonHandler = async (req, res) => { } let questionSet = null; - const shouldGenerateQuestionSet = [ - req.body.customer_vetting_status, - req.body.risk_classification_status, - ].includes(CustomerVettingStatus.INFORMATION_REQUESTED); + const shouldGenerateQuestionSet = + req.body.customerVettingStatus === + CustomerVettingStatus.INFORMATION_REQUESTED || + req.body.riskClassificationStatus === + RiskClarificationStatus.INFORMATION_REQUESTED; if (shouldGenerateQuestionSet) { questionSet = await createQuestionSet(person.id); @@ -305,7 +306,10 @@ export const updatePersonHandler = async (req, res) => { if (questionSet) { await triggerWebhook({ type: PersonWebhookEvent.QUESTIONS_REQUIRE_RESPONSE, - payload: questionSet, + payload: { + question_set_id: questionSet.id, + ...questionSet, + }, personId: person.id, }); } From de0e76ea6dbe97eb5a014d11c609c16b36e38838 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=9Fur=20G=C3=BCm=C3=BC=C5=9Fhan?= Date: Wed, 21 Feb 2024 14:51:21 +0300 Subject: [PATCH 2/7] Qna fixes 2 (#178) * Adjust tests * Add nvmrc file --- .nvmrc | 1 + tests/routes/backoffice.spec.ts | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 .nvmrc diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000000..3c032078a4 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +18 diff --git a/tests/routes/backoffice.spec.ts b/tests/routes/backoffice.spec.ts index a398c36caa..00003a1a09 100644 --- a/tests/routes/backoffice.spec.ts +++ b/tests/routes/backoffice.spec.ts @@ -135,8 +135,7 @@ describe("Backoffice", () => { const req = mockReq({ params: { id: "personId" }, body: { - customer_vetting_status: - CustomerVettingStatus.INFORMATION_REQUESTED, + customerVettingStatus: CustomerVettingStatus.INFORMATION_REQUESTED, }, }); const res = mockRes(); @@ -162,7 +161,7 @@ describe("Backoffice", () => { const req = mockReq({ params: { id: "personId" }, body: { - risk_classification_status: + riskClassificationStatus: RiskClarificationStatus.INFORMATION_REQUESTED, }, }); From 364e2b5465242dd245db1db7ebd200e3c25cfb12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=9Fur=20G=C3=BCm=C3=BC=C5=9Fhan?= Date: Wed, 21 Feb 2024 15:30:48 +0300 Subject: [PATCH 3/7] Version 1.0.122 (#181) * 1.0.120 * 1.0.121 * 1.0.122 --- npm-shrinkwrap.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 2656f973b8..0b0f0ed60d 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,12 +1,12 @@ { "name": "@kontist/mock-solaris", - "version": "1.0.119", + "version": "1.0.122", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@kontist/mock-solaris", - "version": "1.0.119", + "version": "1.0.122", "license": "Apache-2.0", "dependencies": { "bluebird": "^3.4.7", diff --git a/package.json b/package.json index f052de5967..c644c93218 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kontist/mock-solaris", - "version": "1.0.119", + "version": "1.0.122", "description": "Mock Service for Solaris API", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", From 9ca165d4b7ef0b287f59261d1dfa2fa35131fe12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=9Fur=20G=C3=BCm=C3=BC=C5=9Fhan?= Date: Wed, 21 Feb 2024 15:31:03 +0300 Subject: [PATCH 4/7] Add publishing package section (#182) * Add publishing package section * add NOT * Change commands --- README.md | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 13298d21b0..4bf4ffcd82 100644 --- a/README.md +++ b/README.md @@ -107,6 +107,22 @@ JOBS_USERNAME=jobuser JOBS_PASSWORD=jobpassword ``` -## Usage in tests +## Publishing New Version -## Contribute +Create a branch that doesn't have the same name as the tag e.g. NOT v1.0.120 + +``` +git checkout +``` + +Increase the version + +``` +npm version patch +``` + +Push the changes with tags + +``` +git push --follow-tags +``` From d5538dc08d8c2f9cef13d43e5a2a6cfbcec01fd9 Mon Sep 17 00:00:00 2001 From: mbayraktr Date: Mon, 26 Feb 2024 10:32:10 +0100 Subject: [PATCH 5/7] do not return user object --- src/db.ts | 2 +- src/routes/persons.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/db.ts b/src/db.ts index 6661690356..192aa1203e 100644 --- a/src/db.ts +++ b/src/db.ts @@ -231,7 +231,7 @@ export const getPerson = async (personId: string): Promise => { return augmentPerson(person); }; -export const removePerson = async (personId: string): Promise => { +export const removePerson = async (personId: string) => { const person = await getPerson(personId); const score = moment(person.createdAt).valueOf(); const key = `${process.env.MOCKSOLARIS_REDIS_PREFIX}:persons`; diff --git a/src/routes/persons.ts b/src/routes/persons.ts index 2f91378f18..f5fc90cfc8 100644 --- a/src/routes/persons.ts +++ b/src/routes/persons.ts @@ -71,8 +71,8 @@ export const createPerson = async (req, res) => { export const deletePerson = async (req, res) => { const { id: personId } = req.params; try { - const isPersonDeleted = await removePerson(personId); - return res.status(200).send(isPersonDeleted); + await removePerson(personId); + return res.status(200).send(); } catch (err) { return res.status(500).send({ errors: [ From c2b4f5bc06b9868092a0c3323c82a1c4e3b72ebc Mon Sep 17 00:00:00 2001 From: mbayraktr Date: Mon, 26 Feb 2024 11:06:50 +0100 Subject: [PATCH 6/7] return no content status --- src/routes/persons.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/routes/persons.ts b/src/routes/persons.ts index f5fc90cfc8..84cd50e43d 100644 --- a/src/routes/persons.ts +++ b/src/routes/persons.ts @@ -1,5 +1,6 @@ import _ from "lodash"; import moment, { Moment } from "moment"; +import HttpStatusCodes from "http-status"; import { getPerson, @@ -72,7 +73,7 @@ export const deletePerson = async (req, res) => { const { id: personId } = req.params; try { await removePerson(personId); - return res.status(200).send(); + res.sendStatus(HttpStatusCodes.NO_CONTENT); } catch (err) { return res.status(500).send({ errors: [ From 92ac021d50e4ccd3275f2ba31383f0020c4f1ef1 Mon Sep 17 00:00:00 2001 From: mbayraktr Date: Mon, 26 Feb 2024 12:58:19 +0100 Subject: [PATCH 7/7] 1.0.123 --- npm-shrinkwrap.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 0b0f0ed60d..e0c4b37c7a 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,12 +1,12 @@ { "name": "@kontist/mock-solaris", - "version": "1.0.122", + "version": "1.0.123", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@kontist/mock-solaris", - "version": "1.0.122", + "version": "1.0.123", "license": "Apache-2.0", "dependencies": { "bluebird": "^3.4.7", diff --git a/package.json b/package.json index c644c93218..2cf8486259 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kontist/mock-solaris", - "version": "1.0.122", + "version": "1.0.123", "description": "Mock Service for Solaris API", "main": "dist/src/index.js", "types": "dist/src/index.d.ts",