From 041124cf54874c9c40896b64573ee6e9d4a1c633 Mon Sep 17 00:00:00 2001 From: Tony Barnes Date: Tue, 17 Dec 2024 10:03:35 +0000 Subject: [PATCH] feat(APIM-609): companies house - extend returned fields (#1089) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Introduction :pencil2: In order for Companies House to be consumed by other products/services, the integration needs to return some additional fields. Note: unfortunately, some methods in the Companies House service do not have unit test coverage as they are private methods. I would like to add unit tests for all private methods (likely needing to make them public or extracted into helper functions), but this would be a bigger change than introducing additional fields. ## Resolution :heavy_check_mark: - Update Companies House types. - Update `CompaniesService` to return the following additional data: - `accounts` object - `dateOfCreation` - `registeredAddress.careOf` - `registeredAddress.premises` - `registeredAddress.region` - Updated test generator shapes. # Todo ❗ * Ensure tests are DRY and centralised helpers for types, DTO and interfaces. --------- Co-authored-by: Abhi Markan --- package-lock.json | 321 +++++++++--------- package.json | 7 +- ...et-company-companies-house-response.dto.ts | 5 +- src/modules/companies/companies.service.ts | 24 +- .../companies/dto/get-company-response.dto.ts | 53 ++- ...or-get-company-by-registration-number.json | 75 ++-- .../generator/get-company-generator.ts | 121 +++++-- .../generator/random-value-generator.ts | 19 ++ 8 files changed, 402 insertions(+), 223 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2424c08d..b77cea1f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -55,10 +55,10 @@ "@types/lodash": "^4.17.13", "@types/node": "^22.10.2", "@types/supertest": "^6.0.2", - "@typescript-eslint/eslint-plugin": "^8.18.0", - "@typescript-eslint/parser": "^8.18.0", + "@typescript-eslint/eslint-plugin": "^8.18.1", + "@typescript-eslint/parser": "^8.18.1", "chance": "^1.1.12", - "cspell": "^8.17.0", + "cspell": "^8.17.1", "eslint": "^8.57.1", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-airbnb-typescript": "^18.0.0", @@ -1344,9 +1344,9 @@ } }, "node_modules/@cspell/cspell-bundled-dicts": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/@cspell/cspell-bundled-dicts/-/cspell-bundled-dicts-8.17.0.tgz", - "integrity": "sha512-kJfHW+/BkhnP/FUQ8Tl1Eb8ZaZRozw1i+UaD0RVxNOlRGev4Lnyq5nszJwmc8NSBwAS1wmq7OTHvnOvJ1YE0og==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/@cspell/cspell-bundled-dicts/-/cspell-bundled-dicts-8.17.1.tgz", + "integrity": "sha512-HmkXS5uX4bk/XxsRS4Q+zRvhgRa81ddGiR2/Xfag9MIi5L5UnEJ4g21EpmIlXkMxYrTu2fp69SZFss5NfcFF9Q==", "dev": true, "license": "MIT", "dependencies": { @@ -1411,22 +1411,22 @@ } }, "node_modules/@cspell/cspell-json-reporter": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/@cspell/cspell-json-reporter/-/cspell-json-reporter-8.17.0.tgz", - "integrity": "sha512-AJZIjLi/rwOHjTZMQMoGOBht1ERFHUUreTFIOTi4oZCBundnk2bXUteIQthXUCgHL2JSiS9yboUWoAIrekz7Yg==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/@cspell/cspell-json-reporter/-/cspell-json-reporter-8.17.1.tgz", + "integrity": "sha512-EV9Xkh42Xw3aORvDZfxusICX91DDbqQpYdGKBdPGuhgxWOUYYZKpLXsHCmDkhruMPo2m5gDh++/OqjLRPZofKQ==", "dev": true, "license": "MIT", "dependencies": { - "@cspell/cspell-types": "8.17.0" + "@cspell/cspell-types": "8.17.1" }, "engines": { "node": ">=18" } }, "node_modules/@cspell/cspell-pipe": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/@cspell/cspell-pipe/-/cspell-pipe-8.17.0.tgz", - "integrity": "sha512-2wdF4OfrUtY8oJvLzJdc5Z1qbVUYC706jmTq/48jTeMWl0tfUyb7JslZrnCxYxQmX3EzQhWyoj4lPfgjbxIvbg==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/@cspell/cspell-pipe/-/cspell-pipe-8.17.1.tgz", + "integrity": "sha512-uhC99Ox+OH3COSgShv4fpVHiotR70dNvAOSkzRvKVRzV6IGyFnxHjmyVVPEV0dsqzVLxltwYTqFhwI+UOwm45A==", "dev": true, "license": "MIT", "engines": { @@ -1434,9 +1434,9 @@ } }, "node_modules/@cspell/cspell-resolver": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/@cspell/cspell-resolver/-/cspell-resolver-8.17.0.tgz", - "integrity": "sha512-UfvCjFqCUIucqdEWAl1MuezaRS4l3NumWFlaavVdGhdyf5nL+ydmFvrp5YXGQdBzMYnpzwQOwgMU3Jt5xXgFAQ==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/@cspell/cspell-resolver/-/cspell-resolver-8.17.1.tgz", + "integrity": "sha512-XEK2ymTdQNgsV3ny60VkKzWskbICl4zNXh/DbxsoRXHqIRg43MXFpTNkEJ7j873EqdX7BU4opQQ+5D4stWWuhQ==", "dev": true, "license": "MIT", "dependencies": { @@ -1447,9 +1447,9 @@ } }, "node_modules/@cspell/cspell-service-bus": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/@cspell/cspell-service-bus/-/cspell-service-bus-8.17.0.tgz", - "integrity": "sha512-ureBVt/fa5IHooFBfNpZUyTzqMN7aaPhXiGrb1oIfroNZaqiXG5WbvwAeyDrrk2KUa7Fl74/Yr2sOOdT3i7WSg==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/@cspell/cspell-service-bus/-/cspell-service-bus-8.17.1.tgz", + "integrity": "sha512-2sFWQtMEWZ4tdz7bw0bAx4NaV1t0ynGfjpuKWdQppsJFKNb+ZPZZ6Ah1dC13AdRRMZaG194kDRFwzNvRaCgWkQ==", "dev": true, "license": "MIT", "engines": { @@ -1457,9 +1457,9 @@ } }, "node_modules/@cspell/cspell-types": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/@cspell/cspell-types/-/cspell-types-8.17.0.tgz", - "integrity": "sha512-irrADI/GvabVTD9LRP/8mIH/bdoP7AOBgO7DVgNB+fZHDyJa/omzJjjie5kAZuen0l/3TrOadl3F+K0y/9AZ5A==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/@cspell/cspell-types/-/cspell-types-8.17.1.tgz", + "integrity": "sha512-NJbov7Jp57fh8addoxesjb8atg/APQfssCH5Q9uZuHBN06wEJDgs7fhfE48bU+RBViC9gltblsYZzZZQKzHYKg==", "dev": true, "license": "MIT", "engines": { @@ -1495,9 +1495,9 @@ "license": "MIT" }, "node_modules/@cspell/dict-companies": { - "version": "3.1.8", - "resolved": "https://registry.npmjs.org/@cspell/dict-companies/-/dict-companies-3.1.8.tgz", - "integrity": "sha512-4DVPBwEPWa97g3bgg80i3orGeOGnOiJ7tj3c7n6y7FmqkEgyXcnpxOq0n0HWzwRrwrJp9KIJbtMzSAEynIwyNw==", + "version": "3.1.9", + "resolved": "https://registry.npmjs.org/@cspell/dict-companies/-/dict-companies-3.1.9.tgz", + "integrity": "sha512-w7XEJ2B6x2jq9ws5XNyYgpYj2MxdZ3jW3PETLxjK7nc8pulCFmaGVgZ0JTnDWfJ3QMOczoagn5f9LM2PZ/CuJg==", "dev": true, "license": "MIT" }, @@ -1753,9 +1753,9 @@ "license": "MIT" }, "node_modules/@cspell/dict-npm": { - "version": "5.1.17", - "resolved": "https://registry.npmjs.org/@cspell/dict-npm/-/dict-npm-5.1.17.tgz", - "integrity": "sha512-RBx4yml+GbjgqmV2R9A8rO+uqjb8hV9arZXxVzW04TNdgGT/VjZnu6/3/QDzEp3DxnbSxknAbIii8BzpF/o5EQ==", + "version": "5.1.18", + "resolved": "https://registry.npmjs.org/@cspell/dict-npm/-/dict-npm-5.1.18.tgz", + "integrity": "sha512-/Nukl+DSxtEWSlb8svWFSpJVctAsM9SP+f5Q1n+qdDcXNKMb1bUCo/d3QZPwyOhuMjDawnsGBUAfp+iq7Mw83Q==", "dev": true, "license": "MIT" }, @@ -1819,9 +1819,9 @@ "license": "MIT" }, "node_modules/@cspell/dict-software-terms": { - "version": "4.1.19", - "resolved": "https://registry.npmjs.org/@cspell/dict-software-terms/-/dict-software-terms-4.1.19.tgz", - "integrity": "sha512-6yQa3A8PGa2fJ7bnLI21nBnOa89Rjckdgq8kwvqvZgrAptV/KLfcXbGgFriICbu3GJqTVcnMMh1fLtz+pdwIEg==", + "version": "4.1.20", + "resolved": "https://registry.npmjs.org/@cspell/dict-software-terms/-/dict-software-terms-4.1.20.tgz", + "integrity": "sha512-ma51njqbk9ZKzZF9NpCZpZ+c50EwR5JTJ2LEXlX0tX+ExVbKpthhlDLhT2+mkUh5Zvj+CLf5F9z0qB4+X3re/w==", "dev": true, "license": "MIT" }, @@ -1868,13 +1868,13 @@ "license": "MIT" }, "node_modules/@cspell/dynamic-import": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/@cspell/dynamic-import/-/dynamic-import-8.17.0.tgz", - "integrity": "sha512-dd5Xz+10crBJmCzseV+9IPgxI0nNqWW43FBG317droxlhc2L7NktlIe6bsVVCjSoGRrKjQFzTn+cV9kJ9FKvPw==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/@cspell/dynamic-import/-/dynamic-import-8.17.1.tgz", + "integrity": "sha512-XQtr2olYOtqbg49E+8SISd6I5DzfxmsKINDn0ZgaTFeLalnNdF3ewDU4gOEbApIzGffRa1mW9t19MsiVrznSDw==", "dev": true, "license": "MIT", "dependencies": { - "@cspell/url": "8.17.0", + "@cspell/url": "8.17.1", "import-meta-resolve": "^4.1.0" }, "engines": { @@ -1882,9 +1882,9 @@ } }, "node_modules/@cspell/filetypes": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/@cspell/filetypes/-/filetypes-8.17.0.tgz", - "integrity": "sha512-EJ5APmdJV5GWZx5S47R4T3sEwFuP3PugnucqC8wwNutT8cUZrwYOsh/7bqAjkLiXXiUsJllUsDPlpTbxVfPk+g==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/@cspell/filetypes/-/filetypes-8.17.1.tgz", + "integrity": "sha512-AxYw6j7EPYtDFAFjwybjFpMc9waXQzurfBXmEVfQ5RQRlbylujLZWwR6GnMqofeNg4oGDUpEjcAZFrgdkvMQlA==", "dev": true, "license": "MIT", "engines": { @@ -1892,9 +1892,9 @@ } }, "node_modules/@cspell/strong-weak-map": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/@cspell/strong-weak-map/-/strong-weak-map-8.17.0.tgz", - "integrity": "sha512-a2ypnatMb81X/Mx0ibTwiFx1Dg6/oPyNJ9ShTI4cp5gDC1iLJqlXzsYGgTOsGKQ8dYW1hBZxg+hXTfC1ePzDsQ==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/@cspell/strong-weak-map/-/strong-weak-map-8.17.1.tgz", + "integrity": "sha512-8cY3vLAKdt5gQEMM3Gr57BuQ8sun2NjYNh9qTdrctC1S9gNC7XzFghTYAfHSWR4VrOUcMFLO/izMdsc1KFvFOA==", "dev": true, "license": "MIT", "engines": { @@ -1902,9 +1902,9 @@ } }, "node_modules/@cspell/url": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/@cspell/url/-/url-8.17.0.tgz", - "integrity": "sha512-78ZmsbAZ8RbEWRpLgsOuFxEa7Het4pkHyr2AiC0oUiUnvGuVGmUmT4KLCGvzpOzKKztinwgC+u4G5+sC/J6s7A==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/@cspell/url/-/url-8.17.1.tgz", + "integrity": "sha512-LMvReIndW1ckvemElfDgTt282fb2C3C/ZXfsm0pJsTV5ZmtdelCHwzmgSBmY5fDr7D66XDp8EurotSE0K6BTvw==", "dev": true, "license": "MIT", "engines": { @@ -3922,17 +3922,17 @@ "license": "MIT" }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.18.0.tgz", - "integrity": "sha512-NR2yS7qUqCL7AIxdJUQf2MKKNDVNaig/dEB0GBLU7D+ZdHgK1NoH/3wsgO3OnPVipn51tG3MAwaODEGil70WEw==", + "version": "8.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.18.1.tgz", + "integrity": "sha512-Ncvsq5CT3Gvh+uJG0Lwlho6suwDfUXH0HztslDf5I+F2wAFAZMRwYLEorumpKLzmO2suAXZ/td1tBg4NZIi9CQ==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "8.18.0", - "@typescript-eslint/type-utils": "8.18.0", - "@typescript-eslint/utils": "8.18.0", - "@typescript-eslint/visitor-keys": "8.18.0", + "@typescript-eslint/scope-manager": "8.18.1", + "@typescript-eslint/type-utils": "8.18.1", + "@typescript-eslint/utils": "8.18.1", + "@typescript-eslint/visitor-keys": "8.18.1", "graphemer": "^1.4.0", "ignore": "^5.3.1", "natural-compare": "^1.4.0", @@ -3952,16 +3952,16 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "8.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.18.0.tgz", - "integrity": "sha512-hgUZ3kTEpVzKaK3uNibExUYm6SKKOmTU2BOxBSvOYwtJEPdVQ70kZJpPjstlnhCHcuc2WGfSbpKlb/69ttyN5Q==", + "version": "8.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.18.1.tgz", + "integrity": "sha512-rBnTWHCdbYM2lh7hjyXqxk70wvon3p2FyaniZuey5TrcGBpfhVp0OxOa6gxr9Q9YhZFKyfbEnxc24ZnVbbUkCA==", "dev": true, - "license": "MITClause", + "license": "MIT", "dependencies": { - "@typescript-eslint/scope-manager": "8.18.0", - "@typescript-eslint/types": "8.18.0", - "@typescript-eslint/typescript-estree": "8.18.0", - "@typescript-eslint/visitor-keys": "8.18.0", + "@typescript-eslint/scope-manager": "8.18.1", + "@typescript-eslint/types": "8.18.1", + "@typescript-eslint/typescript-estree": "8.18.1", + "@typescript-eslint/visitor-keys": "8.18.1", "debug": "^4.3.4" }, "engines": { @@ -3977,14 +3977,14 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.18.0.tgz", - "integrity": "sha512-PNGcHop0jkK2WVYGotk/hxj+UFLhXtGPiGtiaWgVBVP1jhMoMCHlTyJA+hEj4rszoSdLTK3fN4oOatrL0Cp+Xw==", + "version": "8.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.18.1.tgz", + "integrity": "sha512-HxfHo2b090M5s2+/9Z3gkBhI6xBH8OJCFjH9MhQ+nnoZqxU3wNxkLT+VWXWSFWc3UF3Z+CfPAyqdCTdoXtDPCQ==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.18.0", - "@typescript-eslint/visitor-keys": "8.18.0" + "@typescript-eslint/types": "8.18.1", + "@typescript-eslint/visitor-keys": "8.18.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -3995,14 +3995,14 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "8.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.18.0.tgz", - "integrity": "sha512-er224jRepVAVLnMF2Q7MZJCq5CsdH2oqjP4dT7K6ij09Kyd+R21r7UVJrF0buMVdZS5QRhDzpvzAxHxabQadow==", + "version": "8.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.18.1.tgz", + "integrity": "sha512-jAhTdK/Qx2NJPNOTxXpMwlOiSymtR2j283TtPqXkKBdH8OAMmhiUfP0kJjc/qSE51Xrq02Gj9NY7MwK+UxVwHQ==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/typescript-estree": "8.18.0", - "@typescript-eslint/utils": "8.18.0", + "@typescript-eslint/typescript-estree": "8.18.1", + "@typescript-eslint/utils": "8.18.1", "debug": "^4.3.4", "ts-api-utils": "^1.3.0" }, @@ -4019,9 +4019,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "8.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.18.0.tgz", - "integrity": "sha512-FNYxgyTCAnFwTrzpBGq+zrnoTO4x0c1CKYY5MuUTzpScqmY5fmsh2o3+57lqdI3NZucBDCzDgdEbIaNfAjAHQA==", + "version": "8.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.18.1.tgz", + "integrity": "sha512-7uoAUsCj66qdNQNpH2G8MyTFlgerum8ubf21s3TSM3XmKXuIn+H2Sifh/ES2nPOPiYSRJWAk0fDkW0APBWcpfw==", "dev": true, "license": "MIT", "engines": { @@ -4033,14 +4033,14 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.18.0.tgz", - "integrity": "sha512-rqQgFRu6yPkauz+ms3nQpohwejS8bvgbPyIDq13cgEDbkXt4LH4OkDMT0/fN1RUtzG8e8AKJyDBoocuQh8qNeg==", + "version": "8.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.18.1.tgz", + "integrity": "sha512-z8U21WI5txzl2XYOW7i9hJhxoKKNG1kcU4RzyNvKrdZDmbjkmLBo8bgeiOJmA06kizLI76/CCBAAGlTlEeUfyg==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.18.0", - "@typescript-eslint/visitor-keys": "8.18.0", + "@typescript-eslint/types": "8.18.1", + "@typescript-eslint/visitor-keys": "8.18.1", "debug": "^4.3.4", "fast-glob": "^3.3.2", "is-glob": "^4.0.3", @@ -4060,16 +4060,16 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "8.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.18.0.tgz", - "integrity": "sha512-p6GLdY383i7h5b0Qrfbix3Vc3+J2k6QWw6UMUeY5JGfm3C5LbZ4QIZzJNoNOfgyRe0uuYKjvVOsO/jD4SJO+xg==", + "version": "8.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.18.1.tgz", + "integrity": "sha512-8vikiIj2ebrC4WRdcAdDcmnu9Q/MXXwg+STf40BVfT8exDqBCUPdypvzcUPxEqRGKg9ALagZ0UWcYCtn+4W2iQ==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "8.18.0", - "@typescript-eslint/types": "8.18.0", - "@typescript-eslint/typescript-estree": "8.18.0" + "@typescript-eslint/scope-manager": "8.18.1", + "@typescript-eslint/types": "8.18.1", + "@typescript-eslint/typescript-estree": "8.18.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -4084,13 +4084,13 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.18.0.tgz", - "integrity": "sha512-pCh/qEA8Lb1wVIqNvBke8UaRjJ6wrAWkJO5yyIbs8Yx6TNGYyfNjOo61tLv+WwLvoLPp4BQ8B7AHKijl8NGUfw==", + "version": "8.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.18.1.tgz", + "integrity": "sha512-Vj0WLm5/ZsD013YeUKn+K0y8p1M0jPpxOkKdbD1wB0ns53a5piVY02zjf072TblEweAbcYiFiPoSMF3kp+VhhQ==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.18.0", + "@typescript-eslint/types": "8.18.1", "eslint-visitor-keys": "^4.2.0" }, "engines": { @@ -6212,25 +6212,25 @@ } }, "node_modules/cspell": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/cspell/-/cspell-8.17.0.tgz", - "integrity": "sha512-xg2o85zK0G12LA2dK7+zUHp1+udFYSC3dkQw6+Pfo2T99HrlnlaHn57GnoENgOBqfeSTBaN9ApS0Ekeewa8e1w==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/cspell/-/cspell-8.17.1.tgz", + "integrity": "sha512-D0lw8XTXrTycNzOn5DkfPJNUT00X53OgvFDm+0SzhBr1r+na8LEh3CnQ6zKYVU0fL0x8vU82vs4jmGjDho9mPg==", "dev": true, "license": "MIT", "dependencies": { - "@cspell/cspell-json-reporter": "8.17.0", - "@cspell/cspell-pipe": "8.17.0", - "@cspell/cspell-types": "8.17.0", - "@cspell/dynamic-import": "8.17.0", - "@cspell/url": "8.17.0", + "@cspell/cspell-json-reporter": "8.17.1", + "@cspell/cspell-pipe": "8.17.1", + "@cspell/cspell-types": "8.17.1", + "@cspell/dynamic-import": "8.17.1", + "@cspell/url": "8.17.1", "chalk": "^5.3.0", "chalk-template": "^1.1.0", "commander": "^12.1.0", - "cspell-dictionary": "8.17.0", - "cspell-gitignore": "8.17.0", - "cspell-glob": "8.17.0", - "cspell-io": "8.17.0", - "cspell-lib": "8.17.0", + "cspell-dictionary": "8.17.1", + "cspell-gitignore": "8.17.1", + "cspell-glob": "8.17.1", + "cspell-io": "8.17.1", + "cspell-lib": "8.17.1", "fast-json-stable-stringify": "^2.1.0", "file-entry-cache": "^9.1.0", "get-stdin": "^9.0.0", @@ -6249,13 +6249,13 @@ } }, "node_modules/cspell-config-lib": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/cspell-config-lib/-/cspell-config-lib-8.17.0.tgz", - "integrity": "sha512-MSa1LENlHpb8vlKqu4i4uJ8n+mwnn+dqkggefUq3Mrbkv1v3oTT5XyMyv586p1+r8KeZgISBniHVv7IN9iWvXQ==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/cspell-config-lib/-/cspell-config-lib-8.17.1.tgz", + "integrity": "sha512-x1S7QWprgUcwuwiJB1Ng0ZTBC4G50qP9qQyg/aroMkcdMsHfk26E8jUGRPNt4ftHFzS4YMhwtXuJQ9IgRUuNPA==", "dev": true, "license": "MIT", "dependencies": { - "@cspell/cspell-types": "8.17.0", + "@cspell/cspell-types": "8.17.1", "comment-json": "^4.2.5", "yaml": "^2.6.1" }, @@ -6264,15 +6264,15 @@ } }, "node_modules/cspell-dictionary": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/cspell-dictionary/-/cspell-dictionary-8.17.0.tgz", - "integrity": "sha512-PisnibsCrt/EbL4vmoVZZNWpjtquXBlrrY+iSbbQN5rJXCGX1St79DxgZcSzBLpc6Tt08l/VgFlvTDEGRf2xLA==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/cspell-dictionary/-/cspell-dictionary-8.17.1.tgz", + "integrity": "sha512-zSl9l3wii+x16yc2NVZl/+CMLeLBAiuEd5YoFkOYPcbTJnfPwdjMNcj71u7wBvNJ+qwbF+kGbutEt15yHW3NBw==", "dev": true, "license": "MIT", "dependencies": { - "@cspell/cspell-pipe": "8.17.0", - "@cspell/cspell-types": "8.17.0", - "cspell-trie-lib": "8.17.0", + "@cspell/cspell-pipe": "8.17.1", + "@cspell/cspell-types": "8.17.1", + "cspell-trie-lib": "8.17.1", "fast-equals": "^5.0.1" }, "engines": { @@ -6280,15 +6280,15 @@ } }, "node_modules/cspell-gitignore": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/cspell-gitignore/-/cspell-gitignore-8.17.0.tgz", - "integrity": "sha512-Qk5sgf6sDOI3egNQJAuGnbi3V63Vk/CUX7/CplcrJbX8Yu9fXmjjGN+ffMtLDay3+VLsOLmFJZWCGfgqW/kP6g==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/cspell-gitignore/-/cspell-gitignore-8.17.1.tgz", + "integrity": "sha512-bk727Zf4FBCjm9Mwvyreyhgjwe+YhPQEW7PldkHiinKd+Irfez4s8GXLQb1EgV0UpvViqaqBqLmngjZdS30BTA==", "dev": true, "license": "MIT", "dependencies": { - "@cspell/url": "8.17.0", - "cspell-glob": "8.17.0", - "cspell-io": "8.17.0", + "@cspell/url": "8.17.1", + "cspell-glob": "8.17.1", + "cspell-io": "8.17.1", "find-up-simple": "^1.0.0" }, "bin": { @@ -6299,13 +6299,13 @@ } }, "node_modules/cspell-glob": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/cspell-glob/-/cspell-glob-8.17.0.tgz", - "integrity": "sha512-Miy0kqDIUfsCdLQTJxlXlt9fXqpakwsmyDNKyGjBPNLPF3OAcSelzzxhOUUyzKRgIqXBx4vP3+EF6ZUO3SKDsQ==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/cspell-glob/-/cspell-glob-8.17.1.tgz", + "integrity": "sha512-cUwM5auSt0RvLX7UkP2GEArJRWc85l51B1voArl+3ZIKeMZwcJpJgN3qvImtF8yRTZwYeYCs1sgsihb179q+mg==", "dev": true, "license": "MIT", "dependencies": { - "@cspell/url": "8.17.0", + "@cspell/url": "8.17.1", "micromatch": "^4.0.8" }, "engines": { @@ -6313,14 +6313,14 @@ } }, "node_modules/cspell-grammar": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/cspell-grammar/-/cspell-grammar-8.17.0.tgz", - "integrity": "sha512-2lvxGetbpCNRZJeGK1AjtBnDYD9gc3lPcjD4wFunPMMQbfi3p/pCUrNtMv8eA/pHaF403ah0MQfS/hgdLczoww==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/cspell-grammar/-/cspell-grammar-8.17.1.tgz", + "integrity": "sha512-H5tLcBuW7aUj9L0rR+FSbnWPEsWb8lWppHVidtqw9Ll1CUHWOZC9HTB2RdrhJZrsz/8DJbM2yNbok0Xt0VAfdw==", "dev": true, "license": "MIT", "dependencies": { - "@cspell/cspell-pipe": "8.17.0", - "@cspell/cspell-types": "8.17.0" + "@cspell/cspell-pipe": "8.17.1", + "@cspell/cspell-types": "8.17.1" }, "bin": { "cspell-grammar": "bin.mjs" @@ -6330,42 +6330,42 @@ } }, "node_modules/cspell-io": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/cspell-io/-/cspell-io-8.17.0.tgz", - "integrity": "sha512-gNmgRCIwa1/kki6/ekgk/dhTpojpppufu1j5FvuKk9Ib4gOibUdVKcxCi8uk6LbwOFrrDTOtRhC6WgdMmXerUQ==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/cspell-io/-/cspell-io-8.17.1.tgz", + "integrity": "sha512-liIOsblt7oVItifzRAbuxiYrwlgw1VOqKppMxVKtYoAn2VUuuEpjCj6jLWpoTqSszR/38o7ChsHY1LHakhJZmw==", "dev": true, "license": "MIT", "dependencies": { - "@cspell/cspell-service-bus": "8.17.0", - "@cspell/url": "8.17.0" + "@cspell/cspell-service-bus": "8.17.1", + "@cspell/url": "8.17.1" }, "engines": { "node": ">=18" } }, "node_modules/cspell-lib": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/cspell-lib/-/cspell-lib-8.17.0.tgz", - "integrity": "sha512-+5zMNt+n6/9FbMGKZdDUscpbJe2V54W7cA662f6LbzPXImfNpKZSzU0kSNJ9NyKpaJBoA/Yhb4WrBy1XmscS6g==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/cspell-lib/-/cspell-lib-8.17.1.tgz", + "integrity": "sha512-66n83Q7bK5tnvkDH7869/pBY/65AKmZVfCOAlsbhJn3YMDbNHFCHR0d1oNMlqG+n65Aco89VGwYfXxImZY+/mA==", "dev": true, "license": "MIT", "dependencies": { - "@cspell/cspell-bundled-dicts": "8.17.0", - "@cspell/cspell-pipe": "8.17.0", - "@cspell/cspell-resolver": "8.17.0", - "@cspell/cspell-types": "8.17.0", - "@cspell/dynamic-import": "8.17.0", - "@cspell/filetypes": "8.17.0", - "@cspell/strong-weak-map": "8.17.0", - "@cspell/url": "8.17.0", + "@cspell/cspell-bundled-dicts": "8.17.1", + "@cspell/cspell-pipe": "8.17.1", + "@cspell/cspell-resolver": "8.17.1", + "@cspell/cspell-types": "8.17.1", + "@cspell/dynamic-import": "8.17.1", + "@cspell/filetypes": "8.17.1", + "@cspell/strong-weak-map": "8.17.1", + "@cspell/url": "8.17.1", "clear-module": "^4.1.2", "comment-json": "^4.2.5", - "cspell-config-lib": "8.17.0", - "cspell-dictionary": "8.17.0", - "cspell-glob": "8.17.0", - "cspell-grammar": "8.17.0", - "cspell-io": "8.17.0", - "cspell-trie-lib": "8.17.0", + "cspell-config-lib": "8.17.1", + "cspell-dictionary": "8.17.1", + "cspell-glob": "8.17.1", + "cspell-grammar": "8.17.1", + "cspell-io": "8.17.1", + "cspell-trie-lib": "8.17.1", "env-paths": "^3.0.0", "fast-equals": "^5.0.1", "gensequence": "^7.0.0", @@ -6393,14 +6393,14 @@ } }, "node_modules/cspell-trie-lib": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/cspell-trie-lib/-/cspell-trie-lib-8.17.0.tgz", - "integrity": "sha512-QeHTxjSBtyFDb8/mIn4PVY0wwc31U3AOUdwEKD6Mshd3OexvS6UhGqfNvHijIuy2WD6Z/2XHpQYVcQF1UXfKkA==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/cspell-trie-lib/-/cspell-trie-lib-8.17.1.tgz", + "integrity": "sha512-13WNa5s75VwOjlGzWprmfNbBFIfXyA7tYYrbV+LugKkznyNZJeJPojHouEudcLq3SYb2Q6tJ7qyWcuT5bR9qPA==", "dev": true, "license": "MIT", "dependencies": { - "@cspell/cspell-pipe": "8.17.0", - "@cspell/cspell-types": "8.17.0", + "@cspell/cspell-pipe": "8.17.1", + "@cspell/cspell-types": "8.17.1", "gensequence": "^7.0.0" }, "engines": { @@ -6826,9 +6826,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.5.73", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.73.tgz", - "integrity": "sha512-8wGNxG9tAG5KhGd3eeA0o6ixhiNdgr0DcHWm85XPCphwZgD1lIEoi6t3VERayWao7SF7AAZTw6oARGJeVjH8Kg==", + "version": "1.5.74", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.74.tgz", + "integrity": "sha512-ck3//9RC+6oss/1Bh9tiAVFy5vfSKbRHAFh7Z3/eTRkEqJeWgymloShB17Vg3Z4nmDNp35vAd1BZ6CMW4Wt6Iw==", "dev": true, "license": "ISC" }, @@ -10246,14 +10246,15 @@ } }, "node_modules/is-array-buffer": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.4.tgz", - "integrity": "sha512-wcjaerHw0ydZwfhiKbXJWLDY8A7yV7KhjQOpb83hGgGfId/aQa4TOvwyzn2PuswW2gPCYEL/nEAiSVpdOj1lXw==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.5.tgz", + "integrity": "sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.2.1" + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" }, "engines": { "node": ">= 0.4" diff --git a/package.json b/package.json index 3b006653..7b89f750 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "start:prod": "node dist/src/main", "type-check": "tsc --noEmit --pretty", "unit-test": "jest --selectProjects=Unit", + "unit-test-dev": "jest --verbose --config=jest.config.ts", "validate:all": "npm run lint:fix && npm run prettier:fix && npm run type-check && npm run validate:yml", "validate:yml": "npx yaml-lint **/*.yml --ignore=**/node_modules" }, @@ -87,10 +88,10 @@ "@types/lodash": "^4.17.13", "@types/node": "^22.10.2", "@types/supertest": "^6.0.2", - "@typescript-eslint/eslint-plugin": "^8.18.0", - "@typescript-eslint/parser": "^8.18.0", + "@typescript-eslint/eslint-plugin": "^8.18.1", + "@typescript-eslint/parser": "^8.18.1", "chance": "^1.1.12", - "cspell": "^8.17.0", + "cspell": "^8.17.1", "eslint": "^8.57.1", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-airbnb-typescript": "^18.0.0", diff --git a/src/helper-modules/companies-house/dto/get-company-companies-house-response.dto.ts b/src/helper-modules/companies-house/dto/get-company-companies-house-response.dto.ts index 8fe7143a..9d5b3d14 100644 --- a/src/helper-modules/companies-house/dto/get-company-companies-house-response.dto.ts +++ b/src/helper-modules/companies-house/dto/get-company-companies-house-response.dto.ts @@ -45,9 +45,12 @@ export type GetCompanyCompaniesHouseResponse = { address_line_1: string; address_line_2?: string; address_line_3?: string; + care_of?: string; + country: string; locality: string; postal_code: string; - country: string; + premises?: string; + region?: string; }; registered_office_is_in_dispute: boolean; sic_codes: string[]; diff --git a/src/modules/companies/companies.service.ts b/src/modules/companies/companies.service.ts index ba3a4ef4..1b4c1ec7 100644 --- a/src/modules/companies/companies.service.ts +++ b/src/modules/companies/companies.service.ts @@ -50,16 +50,38 @@ export class CompaniesService { const address = company.registered_office_address; return { + accounts: { + accountingReferenceDate: company.accounts.accounting_reference_date, + lastAccounts: { + madeUpTo: company.accounts.last_accounts?.made_up_to, + periodEndOn: company.accounts.last_accounts?.period_end_on, + periodStartOn: company.accounts.last_accounts?.period_start_on, + type: company.accounts.last_accounts?.period_start_on, + }, + nextAccounts: { + dueOn: company.accounts.next_accounts.due_on, + overdue: company.accounts.next_accounts.overdue, + periodEndOn: company.accounts.next_accounts.period_end_on, + periodStartOn: company.accounts.next_accounts.period_start_on, + }, + nextDue: company.accounts.next_due, + nextMadeUpTo: company.accounts.next_made_up_to, + overdue: company.accounts.overdue, + }, companiesHouseRegistrationNumber: company.company_number, companyName: company.company_name, + dateOfCreation: company.date_of_creation, registeredAddress: { organisationName: address?.organisation_name, addressLine1: address?.address_line_1, addressLine2: address?.address_line_2, addressLine3: address?.address_line_3, + careOf: address?.care_of, + country: address?.country, locality: address?.locality, postalCode: address?.postal_code, - country: address?.country, + premises: address?.premises, + region: address?.region, }, industries: this.mapSicCodes(company.sic_codes, industryClasses), }; diff --git a/src/modules/companies/dto/get-company-response.dto.ts b/src/modules/companies/dto/get-company-response.dto.ts index 9f199d31..4cd70da7 100644 --- a/src/modules/companies/dto/get-company-response.dto.ts +++ b/src/modules/companies/dto/get-company-response.dto.ts @@ -1,15 +1,50 @@ +class AccountsReferenceDate { + day: string; + month: string; +} + +class AccountsLastAccounts { + madeUpTo: string; + periodEndOn: string; + periodStartOn: string; + type: string; +} + +class AccountsNextAccounts { + dueOn: string; + overdue: boolean; + periodEndOn: string; + periodStartOn: string; +} + +class Accounts { + accountingReferenceDate?: AccountsReferenceDate; + lastAccounts?: AccountsLastAccounts; + nextAccounts?: AccountsNextAccounts; + nextDue?: string; + nextMadeUpTo?: string; + overdue?: boolean; +} + +class RegisteredAddress { + organisationName?: string; + addressLine1?: string; + addressLine2?: string; + addressLine3?: string; + careOf?: string; + country?: string; + locality?: string; + postalCode?: string; + premises?: string; + region?: string; +} + export class GetCompanyResponse { + accounts: Accounts; companiesHouseRegistrationNumber: string; companyName: string; - registeredAddress: { - organisationName?: string; - addressLine1?: string; - addressLine2?: string; - addressLine3?: string; - locality?: string; - postalCode?: string; - country?: string; - }; + dateOfCreation: string; + registeredAddress: RegisteredAddress; industries: Industry[]; } diff --git a/src/modules/companies/examples/example-response-for-get-company-by-registration-number.json b/src/modules/companies/examples/example-response-for-get-company-by-registration-number.json index 7087668a..0ea01073 100644 --- a/src/modules/companies/examples/example-response-for-get-company-by-registration-number.json +++ b/src/modules/companies/examples/example-response-for-get-company-by-registration-number.json @@ -1,44 +1,59 @@ { + "accounts": { + "accountingReferenceDate": { + "day": "31", + "month": "12" + }, + "lastAccounts": { + "madeUpTo": "2024-12-31", + "periodEndOn": "2024-12-31", + "periodStartOn": "2024-01-01", + "type": "2024-01-01" + }, + "nextAccounts": { + "dueOn": "2026-09-30", + "overdue": false, + "periodEndOn": "2024-12-31", + "periodStartOn": "2024-01-01" + }, + "nextDue": "2026-09-30", + "nextMadeUpTo": "2024-12-31", + "overdue": false + }, "companiesHouseRegistrationNumber": "00000001", "companyName": "TEST COMPANY LTD", + "dateOfCreation": "1989-09-20", "registeredAddress": { - "addressLine1": "1 Test Street", - "locality": "Test City", - "postalCode": "A1 2BC", - "country": "United Kingdom" + "addressLine1": "1 Test", + "addressLine2": "Test", + "country": "England", + "locality": "London", + "postalCode": "A12 3AB" }, "industries": [ { - "class": { - "code": "59112", - "name": "Video production activities" - }, - "code": "1009", - "name": "Information and communication" - }, - { - "class": { - "code": "62012", - "name": "Business and domestic software development" - }, - "code": "1009", - "name": "Information and communication" + "code": "1003", + "name": "Manufacturing", + "class": { + "code": "26110", + "name": "Manufacture of electronic components" + } }, { - "class": { - "code": "62020", - "name": "Information technology consultancy activities" - }, - "code": "1009", - "name": "Information and communication" + "code": "1003", + "name": "Manufacturing", + "class": { + "code": "27120", + "name": "Manufacture of electricity distribution and control apparatus" + } }, { - "class": { - "code": "62090", - "name": "Other information technology service activities" - }, - "code": "1009", - "name": "Information and communication" + "code": "1006", + "name": "Wholesale and retail trade; repair of motor vehicles and motorcycles", + "class": { + "code": "46520", + "name": "Wholesale of electronic and telecommunications equipment and parts" + } } ] } \ No newline at end of file diff --git a/test/support/generator/get-company-generator.ts b/test/support/generator/get-company-generator.ts index 922a883e..60de94fe 100644 --- a/test/support/generator/get-company-generator.ts +++ b/test/support/generator/get-company-generator.ts @@ -15,13 +15,38 @@ export class GetCompanyGenerator extends AbstractGenerator this.valueGenerator.date().toISOString().split('T')[0]; - const randomAccountingReferenceDate = this.valueGenerator.date(); + const randomISO8601Date = () => this.valueGenerator.dateISO8601(); const shuffleArray = (array: Array) => { for (const i of [...Array(array.length).keys()].reverse().slice(0, -1)) { @@ -67,43 +91,49 @@ export class GetCompanyGenerator extends AbstractGenerator