Skip to content

Commit

Permalink
Merge branch 'develop' into upload-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
p-janik authored Feb 28, 2024
2 parents 264d321 + 54de241 commit 8bcfb9f
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 16 deletions.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <some_name>
```

Increase the version

```
npm version patch
```

Push the changes with tags

```
git push --follow-tags
```
4 changes: 2 additions & 2 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kontist/mock-solaris",
"version": "1.0.118",
"version": "1.0.123",
"description": "Mock Service for Solaris API",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export const getPerson = async (personId: string): Promise<MockPerson> => {
return augmentPerson(person);
};

export const removePerson = async (personId: string): Promise<MockPerson> => {
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`;
Expand Down
2 changes: 2 additions & 0 deletions src/helpers/webhooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down
14 changes: 9 additions & 5 deletions src/routes/backoffice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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,
});
}
Expand Down
5 changes: 3 additions & 2 deletions src/routes/persons.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import _ from "lodash";
import moment, { Moment } from "moment";
import type { Request, Response } from "express";
import HttpStatusCodes from "http-status";

import {
getPerson,
Expand Down Expand Up @@ -73,8 +74,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);
res.sendStatus(HttpStatusCodes.NO_CONTENT);
} catch (err) {
return res.status(500).send({
errors: [
Expand Down
5 changes: 2 additions & 3 deletions tests/routes/backoffice.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -162,7 +161,7 @@ describe("Backoffice", () => {
const req = mockReq({
params: { id: "personId" },
body: {
risk_classification_status:
riskClassificationStatus:
RiskClarificationStatus.INFORMATION_REQUESTED,
},
});
Expand Down

0 comments on commit 8bcfb9f

Please sign in to comment.