diff --git a/.eslintrc.js b/.eslintrc.js index d7d1971e29..2e149a2b7b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -9,7 +9,8 @@ module.exports = { ignoreStrings: true, ignoreTemplateLiterals: true, ignoreUrls: true - }] + }], + 'import/extensions': ['error', 'always'] } } diff --git a/app/controllers/bill-runs.controller.js b/app/controllers/bill-runs.controller.js index 73f1dfb05a..00498b6150 100644 --- a/app/controllers/bill-runs.controller.js +++ b/app/controllers/bill-runs.controller.js @@ -21,6 +21,7 @@ const StartBillRunProcessService = require('../services/bill-runs/start-bill-run const SubmitAmendedBillableReturnsService = require('..//services/bill-runs/two-part-tariff/submit-amended-billable-returns.service.js') const SubmitCancelBillRunService = require('../services/bill-runs/submit-cancel-bill-run.service.js') const SubmitRemoveBillRunLicenceService = require('../services/bill-runs/two-part-tariff/submit-remove-bill-run-licence.service.js') +const SubmitReviewBillRunService = require('../services/bill-runs/two-part-tariff/submit-review-bill-run.service.js') const SubmitReviewLicenceService = require('../services/bill-runs/two-part-tariff/submit-review-licence.service.js') const SubmitSendBillRunService = require('../services/bill-runs/submit-send-bill-run.service.js') const ViewBillRunService = require('../services/bill-runs/view-bill-run.service.js') @@ -49,6 +50,18 @@ async function cancel (request, h) { }) } +async function chargeReferenceDetails (request, h) { + const { id: billRunId, licenceId, reviewChargeReferenceId } = request.params + + const pageData = await ChargeReferenceDetailsService.go(billRunId, licenceId, reviewChargeReferenceId) + + return h.view('bill-runs/charge-reference-details.njk', { + pageTitle: 'Charge reference details', + activeNavBar: 'bill-runs', + ...pageData + }) +} + async function create (request, h) { const validatedData = CreateBillRunValidator.go(request.payload) @@ -102,7 +115,7 @@ async function removeLicence (request, h) { async function review (request, h) { const { id } = request.params - const pageData = await ReviewBillRunService.go(id, request.payload, request.yar) + const pageData = await ReviewBillRunService.go(id, request.yar) return h.view('bill-runs/review.njk', { pageTitle: 'Review licences', @@ -111,18 +124,6 @@ async function review (request, h) { }) } -async function chargeReferenceDetails (request, h) { - const { id: billRunId, licenceId, reviewChargeReferenceId } = request.params - - const pageData = await ChargeReferenceDetailsService.go(billRunId, licenceId, reviewChargeReferenceId) - - return h.view('bill-runs/charge-reference-details.njk', { - pageTitle: 'Charge reference details', - activeNavBar: 'bill-runs', - ...pageData - }) -} - async function reviewLicence (request, h) { const { id: billRunId, licenceId } = request.params @@ -191,6 +192,14 @@ async function submitRemoveLicence (request, h) { return h.redirect(`/system/bill-runs/${billRunId}/review`) } +async function submitReview (request, h) { + const { id } = request.params + + await SubmitReviewBillRunService.go(request.payload, request.yar) + + return h.redirect(`/system/bill-runs/${id}/review`) +} + async function submitReviewLicence (request, h) { const { id: billRunId, licenceId } = request.params @@ -228,16 +237,17 @@ async function view (request, h) { module.exports = { amendBillableReturns, cancel, + chargeReferenceDetails, create, index, matchDetails, removeLicence, review, - chargeReferenceDetails, reviewLicence, send, submitAmendedBillableReturns, submitCancel, + submitReview, submitRemoveLicence, submitReviewLicence, submitSend, diff --git a/app/routes/bill-runs.routes.js b/app/routes/bill-runs.routes.js index 0fa43f69b7..de197861ce 100644 --- a/app/routes/bill-runs.routes.js +++ b/app/routes/bill-runs.routes.js @@ -113,7 +113,7 @@ const routes = [ { method: 'POST', path: '/bill-runs/{id}/review', - handler: BillRunsController.review, + handler: BillRunsController.submitReview, options: { auth: { access: { diff --git a/app/services/bill-runs/two-part-tariff/review-bill-run.service.js b/app/services/bill-runs/two-part-tariff/review-bill-run.service.js index 6865797951..c9856fb572 100644 --- a/app/services/bill-runs/two-part-tariff/review-bill-run.service.js +++ b/app/services/bill-runs/two-part-tariff/review-bill-run.service.js @@ -12,17 +12,17 @@ const ReviewBillRunPresenter = require('../../../presenters/bill-runs/two-part-t * Orchestrates fetching and presenting the data needed for the review bill run page * * @param {String} id The UUID for the bill run to review - * @param {Object} payload The `request.payload` containing the filter data. This is only passed to the service when - * there is a POST request, which only occurs when a filter is applied to the results. * @param {Object} yar - The Hapi `request.yar` session manager passed on by the controller * * @returns {Promise} An object representing the `pageData` needed by the review bill run template. It contains * details of the bill run and the licences linked to it as well as any data that has been used to filter the results. */ -async function go (id, payload, yar) { - const filterIssues = payload?.filterIssues - const filterLicenceHolder = payload?.filterLicenceHolder - const filterLicenceStatus = payload?.filterLicenceStatus +async function go (id, yar) { + const filters = yar.get('reviewFilters') + + const filterIssues = filters?.filterIssues + const filterLicenceHolder = filters?.filterLicenceHolder + const filterLicenceStatus = filters?.filterLicenceStatus const { billRun, licences } = await FetchBillRunLicencesService.go( id, diff --git a/app/services/bill-runs/two-part-tariff/submit-review-bill-run.service.js b/app/services/bill-runs/two-part-tariff/submit-review-bill-run.service.js new file mode 100644 index 0000000000..b1baa4272c --- /dev/null +++ b/app/services/bill-runs/two-part-tariff/submit-review-bill-run.service.js @@ -0,0 +1,33 @@ +'use strict' + +/** + * Updates the session cookie with the filter data needed for the two-part tariff review bill run page + * @module SubmitReviewBillRunService + */ + +/** + * Updates the session cookie with the filter data needed for the two-part tariff review bill run page + * + * @param {Object} payload The `request.payload` containing the filter data. + * @param {Object} yar - The Hapi `request.yar` session manager passed on by the controller + */ +async function go (payload, yar) { + const clearFilters = payload?.clearFilters + const filterIssues = payload?.filterIssues + const filterLicenceHolder = payload?.filterLicenceHolder + const filterLicenceStatus = payload?.filterLicenceStatus + + if (clearFilters) { + yar.clear('reviewFilters') + } else { + yar.set('reviewFilters', { + filterIssues, + filterLicenceHolder, + filterLicenceStatus + }) + } +} + +module.exports = { + go +} diff --git a/app/views/bill-runs/review.njk b/app/views/bill-runs/review.njk index 5ca9fe6756..4d239f6733 100644 --- a/app/views/bill-runs/review.njk +++ b/app/views/bill-runs/review.njk @@ -248,8 +248,7 @@ text: "Clear filters", classes: "govuk-button--secondary ", name: "clearFilters", - type: "reset", - href: "review", + value: 'reset', preventDoubleClick: true }) }} diff --git a/package-lock.json b/package-lock.json index 4677f09546..8c833700c5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -239,15 +239,15 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" }, "node_modules/@aws-sdk/client-s3": { - "version": "3.572.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-s3/-/client-s3-3.572.0.tgz", - "integrity": "sha512-YLtJRVZN+ktOaseWeTtthmimRQoWxygdzRPFlb1HpDPX+akBrGkL7Mz69onpXKfqm9Loz3diUXHqKfpxRX9Pog==", + "version": "3.574.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-s3/-/client-s3-3.574.0.tgz", + "integrity": "sha512-198QLFeJEs3xgCkLcGD8r0IVCR+BTjXGbVpDYC0DCU7vWjINR8igwwnuA5kbCHDALXvWmkX5MVuAlDuawsUn6w==", "dependencies": { "@aws-crypto/sha1-browser": "3.0.0", "@aws-crypto/sha256-browser": "3.0.0", "@aws-crypto/sha256-js": "3.0.0", - "@aws-sdk/client-sso-oidc": "3.572.0", - "@aws-sdk/client-sts": "3.572.0", + "@aws-sdk/client-sso-oidc": "3.574.0", + "@aws-sdk/client-sts": "3.574.0", "@aws-sdk/core": "3.572.0", "@aws-sdk/credential-provider-node": "3.572.0", "@aws-sdk/middleware-bucket-endpoint": "3.568.0", @@ -355,13 +355,13 @@ } }, "node_modules/@aws-sdk/client-sso-oidc": { - "version": "3.572.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso-oidc/-/client-sso-oidc-3.572.0.tgz", - "integrity": "sha512-S6C/S6xYesDakEuzYvlY1DMMKLtKQxdbbygq3hfeG2R0jUt9KpRLsQXK8qrBuVCKa3WcnjN/30hp4g/iUWFU/w==", + "version": "3.574.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso-oidc/-/client-sso-oidc-3.574.0.tgz", + "integrity": "sha512-WcR8AnFhx7bqhYwfSl3OrF0Pu0LfHGgSOnmmORHqRF7ykguE09M/WUlCCjTGmZjJZ1we3uF5Xg8Jg12eiD+bmw==", "dependencies": { "@aws-crypto/sha256-browser": "3.0.0", "@aws-crypto/sha256-js": "3.0.0", - "@aws-sdk/client-sts": "3.572.0", + "@aws-sdk/client-sts": "3.574.0", "@aws-sdk/core": "3.572.0", "@aws-sdk/credential-provider-node": "3.572.0", "@aws-sdk/middleware-host-header": "3.567.0", @@ -405,13 +405,13 @@ } }, "node_modules/@aws-sdk/client-sts": { - "version": "3.572.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.572.0.tgz", - "integrity": "sha512-jCQuH2qkbWoSY4wckLSfzf3OPh7zc7ZckEbIGGVUQar/JVff6EIbpQ+uNG29DDEOpdPPd8rrJsVuUlA/nvJdXA==", + "version": "3.574.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.574.0.tgz", + "integrity": "sha512-WNDSG9nipap/L1gGDkCQvU2u413HmVxMJKr41lBCibioz42Z4i6XkCr1etYwIjuVfGF6QPrsEsYLqRwlAC/BQg==", "dependencies": { "@aws-crypto/sha256-browser": "3.0.0", "@aws-crypto/sha256-js": "3.0.0", - "@aws-sdk/client-sso-oidc": "3.572.0", + "@aws-sdk/client-sso-oidc": "3.574.0", "@aws-sdk/core": "3.572.0", "@aws-sdk/credential-provider-node": "3.572.0", "@aws-sdk/middleware-host-header": "3.567.0", @@ -504,12 +504,14 @@ "node": ">=16.0.0" } }, - "node_modules/@aws-sdk/credential-provider-ini": { + "node_modules/@aws-sdk/credential-provider-node": { "version": "3.572.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.572.0.tgz", - "integrity": "sha512-05KzbAp77fEiQXqMeodXeMbT83FOqSyBrfSEMz6U8uBXeJCy8zPUjN3acqcbG55/HNJHUvg1cftqzy+fUz71gA==", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.572.0.tgz", + "integrity": "sha512-anlYZnpmVkfp9Gan+LcEkQvmRf/m0KcbR11th8sBEyI5lxMaHKXhnAtC/hEGT7e3L6rgNOrFYTPuSvllITD/Pg==", "dependencies": { "@aws-sdk/credential-provider-env": "3.568.0", + "@aws-sdk/credential-provider-http": "3.568.0", + "@aws-sdk/credential-provider-ini": "3.572.0", "@aws-sdk/credential-provider-process": "3.572.0", "@aws-sdk/credential-provider-sso": "3.572.0", "@aws-sdk/credential-provider-web-identity": "3.568.0", @@ -522,19 +524,116 @@ }, "engines": { "node": ">=16.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/client-sso-oidc": { + "version": "3.572.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso-oidc/-/client-sso-oidc-3.572.0.tgz", + "integrity": "sha512-S6C/S6xYesDakEuzYvlY1DMMKLtKQxdbbygq3hfeG2R0jUt9KpRLsQXK8qrBuVCKa3WcnjN/30hp4g/iUWFU/w==", + "peer": true, + "dependencies": { + "@aws-crypto/sha256-browser": "3.0.0", + "@aws-crypto/sha256-js": "3.0.0", + "@aws-sdk/client-sts": "3.572.0", + "@aws-sdk/core": "3.572.0", + "@aws-sdk/credential-provider-node": "3.572.0", + "@aws-sdk/middleware-host-header": "3.567.0", + "@aws-sdk/middleware-logger": "3.568.0", + "@aws-sdk/middleware-recursion-detection": "3.567.0", + "@aws-sdk/middleware-user-agent": "3.572.0", + "@aws-sdk/region-config-resolver": "3.572.0", + "@aws-sdk/types": "3.567.0", + "@aws-sdk/util-endpoints": "3.572.0", + "@aws-sdk/util-user-agent-browser": "3.567.0", + "@aws-sdk/util-user-agent-node": "3.568.0", + "@smithy/config-resolver": "^2.2.0", + "@smithy/core": "^1.4.2", + "@smithy/fetch-http-handler": "^2.5.0", + "@smithy/hash-node": "^2.2.0", + "@smithy/invalid-dependency": "^2.2.0", + "@smithy/middleware-content-length": "^2.2.0", + "@smithy/middleware-endpoint": "^2.5.1", + "@smithy/middleware-retry": "^2.3.1", + "@smithy/middleware-serde": "^2.3.0", + "@smithy/middleware-stack": "^2.2.0", + "@smithy/node-config-provider": "^2.3.0", + "@smithy/node-http-handler": "^2.5.0", + "@smithy/protocol-http": "^3.3.0", + "@smithy/smithy-client": "^2.5.1", + "@smithy/types": "^2.12.0", + "@smithy/url-parser": "^2.2.0", + "@smithy/util-base64": "^2.3.0", + "@smithy/util-body-length-browser": "^2.2.0", + "@smithy/util-body-length-node": "^2.3.0", + "@smithy/util-defaults-mode-browser": "^2.2.1", + "@smithy/util-defaults-mode-node": "^2.3.1", + "@smithy/util-endpoints": "^1.2.0", + "@smithy/util-middleware": "^2.2.0", + "@smithy/util-retry": "^2.2.0", + "@smithy/util-utf8": "^2.3.0", + "tslib": "^2.6.2" }, - "peerDependencies": { - "@aws-sdk/client-sts": "3.572.0" + "engines": { + "node": ">=16.0.0" } }, - "node_modules/@aws-sdk/credential-provider-node": { + "node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/client-sts": { "version": "3.572.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.572.0.tgz", - "integrity": "sha512-anlYZnpmVkfp9Gan+LcEkQvmRf/m0KcbR11th8sBEyI5lxMaHKXhnAtC/hEGT7e3L6rgNOrFYTPuSvllITD/Pg==", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.572.0.tgz", + "integrity": "sha512-jCQuH2qkbWoSY4wckLSfzf3OPh7zc7ZckEbIGGVUQar/JVff6EIbpQ+uNG29DDEOpdPPd8rrJsVuUlA/nvJdXA==", + "peer": true, + "dependencies": { + "@aws-crypto/sha256-browser": "3.0.0", + "@aws-crypto/sha256-js": "3.0.0", + "@aws-sdk/client-sso-oidc": "3.572.0", + "@aws-sdk/core": "3.572.0", + "@aws-sdk/credential-provider-node": "3.572.0", + "@aws-sdk/middleware-host-header": "3.567.0", + "@aws-sdk/middleware-logger": "3.568.0", + "@aws-sdk/middleware-recursion-detection": "3.567.0", + "@aws-sdk/middleware-user-agent": "3.572.0", + "@aws-sdk/region-config-resolver": "3.572.0", + "@aws-sdk/types": "3.567.0", + "@aws-sdk/util-endpoints": "3.572.0", + "@aws-sdk/util-user-agent-browser": "3.567.0", + "@aws-sdk/util-user-agent-node": "3.568.0", + "@smithy/config-resolver": "^2.2.0", + "@smithy/core": "^1.4.2", + "@smithy/fetch-http-handler": "^2.5.0", + "@smithy/hash-node": "^2.2.0", + "@smithy/invalid-dependency": "^2.2.0", + "@smithy/middleware-content-length": "^2.2.0", + "@smithy/middleware-endpoint": "^2.5.1", + "@smithy/middleware-retry": "^2.3.1", + "@smithy/middleware-serde": "^2.3.0", + "@smithy/middleware-stack": "^2.2.0", + "@smithy/node-config-provider": "^2.3.0", + "@smithy/node-http-handler": "^2.5.0", + "@smithy/protocol-http": "^3.3.0", + "@smithy/smithy-client": "^2.5.1", + "@smithy/types": "^2.12.0", + "@smithy/url-parser": "^2.2.0", + "@smithy/util-base64": "^2.3.0", + "@smithy/util-body-length-browser": "^2.2.0", + "@smithy/util-body-length-node": "^2.3.0", + "@smithy/util-defaults-mode-browser": "^2.2.1", + "@smithy/util-defaults-mode-node": "^2.3.1", + "@smithy/util-endpoints": "^1.2.0", + "@smithy/util-middleware": "^2.2.0", + "@smithy/util-retry": "^2.2.0", + "@smithy/util-utf8": "^2.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/credential-provider-ini": { + "version": "3.572.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.572.0.tgz", + "integrity": "sha512-05KzbAp77fEiQXqMeodXeMbT83FOqSyBrfSEMz6U8uBXeJCy8zPUjN3acqcbG55/HNJHUvg1cftqzy+fUz71gA==", "dependencies": { "@aws-sdk/credential-provider-env": "3.568.0", - "@aws-sdk/credential-provider-http": "3.568.0", - "@aws-sdk/credential-provider-ini": "3.572.0", "@aws-sdk/credential-provider-process": "3.572.0", "@aws-sdk/credential-provider-sso": "3.572.0", "@aws-sdk/credential-provider-web-identity": "3.568.0", @@ -547,6 +646,9 @@ }, "engines": { "node": ">=16.0.0" + }, + "peerDependencies": { + "@aws-sdk/client-sts": "3.572.0" } }, "node_modules/@aws-sdk/credential-provider-process": { @@ -581,6 +683,126 @@ "node": ">=16.0.0" } }, + "node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/client-sso-oidc": { + "version": "3.572.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso-oidc/-/client-sso-oidc-3.572.0.tgz", + "integrity": "sha512-S6C/S6xYesDakEuzYvlY1DMMKLtKQxdbbygq3hfeG2R0jUt9KpRLsQXK8qrBuVCKa3WcnjN/30hp4g/iUWFU/w==", + "peer": true, + "dependencies": { + "@aws-crypto/sha256-browser": "3.0.0", + "@aws-crypto/sha256-js": "3.0.0", + "@aws-sdk/client-sts": "3.572.0", + "@aws-sdk/core": "3.572.0", + "@aws-sdk/credential-provider-node": "3.572.0", + "@aws-sdk/middleware-host-header": "3.567.0", + "@aws-sdk/middleware-logger": "3.568.0", + "@aws-sdk/middleware-recursion-detection": "3.567.0", + "@aws-sdk/middleware-user-agent": "3.572.0", + "@aws-sdk/region-config-resolver": "3.572.0", + "@aws-sdk/types": "3.567.0", + "@aws-sdk/util-endpoints": "3.572.0", + "@aws-sdk/util-user-agent-browser": "3.567.0", + "@aws-sdk/util-user-agent-node": "3.568.0", + "@smithy/config-resolver": "^2.2.0", + "@smithy/core": "^1.4.2", + "@smithy/fetch-http-handler": "^2.5.0", + "@smithy/hash-node": "^2.2.0", + "@smithy/invalid-dependency": "^2.2.0", + "@smithy/middleware-content-length": "^2.2.0", + "@smithy/middleware-endpoint": "^2.5.1", + "@smithy/middleware-retry": "^2.3.1", + "@smithy/middleware-serde": "^2.3.0", + "@smithy/middleware-stack": "^2.2.0", + "@smithy/node-config-provider": "^2.3.0", + "@smithy/node-http-handler": "^2.5.0", + "@smithy/protocol-http": "^3.3.0", + "@smithy/smithy-client": "^2.5.1", + "@smithy/types": "^2.12.0", + "@smithy/url-parser": "^2.2.0", + "@smithy/util-base64": "^2.3.0", + "@smithy/util-body-length-browser": "^2.2.0", + "@smithy/util-body-length-node": "^2.3.0", + "@smithy/util-defaults-mode-browser": "^2.2.1", + "@smithy/util-defaults-mode-node": "^2.3.1", + "@smithy/util-endpoints": "^1.2.0", + "@smithy/util-middleware": "^2.2.0", + "@smithy/util-retry": "^2.2.0", + "@smithy/util-utf8": "^2.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/client-sts": { + "version": "3.572.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.572.0.tgz", + "integrity": "sha512-jCQuH2qkbWoSY4wckLSfzf3OPh7zc7ZckEbIGGVUQar/JVff6EIbpQ+uNG29DDEOpdPPd8rrJsVuUlA/nvJdXA==", + "peer": true, + "dependencies": { + "@aws-crypto/sha256-browser": "3.0.0", + "@aws-crypto/sha256-js": "3.0.0", + "@aws-sdk/client-sso-oidc": "3.572.0", + "@aws-sdk/core": "3.572.0", + "@aws-sdk/credential-provider-node": "3.572.0", + "@aws-sdk/middleware-host-header": "3.567.0", + "@aws-sdk/middleware-logger": "3.568.0", + "@aws-sdk/middleware-recursion-detection": "3.567.0", + "@aws-sdk/middleware-user-agent": "3.572.0", + "@aws-sdk/region-config-resolver": "3.572.0", + "@aws-sdk/types": "3.567.0", + "@aws-sdk/util-endpoints": "3.572.0", + "@aws-sdk/util-user-agent-browser": "3.567.0", + "@aws-sdk/util-user-agent-node": "3.568.0", + "@smithy/config-resolver": "^2.2.0", + "@smithy/core": "^1.4.2", + "@smithy/fetch-http-handler": "^2.5.0", + "@smithy/hash-node": "^2.2.0", + "@smithy/invalid-dependency": "^2.2.0", + "@smithy/middleware-content-length": "^2.2.0", + "@smithy/middleware-endpoint": "^2.5.1", + "@smithy/middleware-retry": "^2.3.1", + "@smithy/middleware-serde": "^2.3.0", + "@smithy/middleware-stack": "^2.2.0", + "@smithy/node-config-provider": "^2.3.0", + "@smithy/node-http-handler": "^2.5.0", + "@smithy/protocol-http": "^3.3.0", + "@smithy/smithy-client": "^2.5.1", + "@smithy/types": "^2.12.0", + "@smithy/url-parser": "^2.2.0", + "@smithy/util-base64": "^2.3.0", + "@smithy/util-body-length-browser": "^2.2.0", + "@smithy/util-body-length-node": "^2.3.0", + "@smithy/util-defaults-mode-browser": "^2.2.1", + "@smithy/util-defaults-mode-node": "^2.3.1", + "@smithy/util-endpoints": "^1.2.0", + "@smithy/util-middleware": "^2.2.0", + "@smithy/util-retry": "^2.2.0", + "@smithy/util-utf8": "^2.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers": { + "version": "3.572.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/token-providers/-/token-providers-3.572.0.tgz", + "integrity": "sha512-IkSu8p32tQZhKqwmfLZLGfYwNhsS/HUQBLnDMHJlr9VifmDqlTurcr+DwMCaMimuFhcLeb45vqTymKf/ro/OBw==", + "dependencies": { + "@aws-sdk/types": "3.567.0", + "@smithy/property-provider": "^2.2.0", + "@smithy/shared-ini-file-loader": "^2.4.0", + "@smithy/types": "^2.12.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + }, + "peerDependencies": { + "@aws-sdk/client-sso-oidc": "3.572.0" + } + }, "node_modules/@aws-sdk/credential-provider-web-identity": { "version": "3.568.0", "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.568.0.tgz", @@ -797,24 +1019,6 @@ "node": ">=16.0.0" } }, - "node_modules/@aws-sdk/token-providers": { - "version": "3.572.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/token-providers/-/token-providers-3.572.0.tgz", - "integrity": "sha512-IkSu8p32tQZhKqwmfLZLGfYwNhsS/HUQBLnDMHJlr9VifmDqlTurcr+DwMCaMimuFhcLeb45vqTymKf/ro/OBw==", - "dependencies": { - "@aws-sdk/types": "3.567.0", - "@smithy/property-provider": "^2.2.0", - "@smithy/shared-ini-file-loader": "^2.4.0", - "@smithy/types": "^2.12.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - }, - "peerDependencies": { - "@aws-sdk/client-sso-oidc": "3.572.0" - } - }, "node_modules/@aws-sdk/types": { "version": "3.567.0", "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.567.0.tgz", @@ -7742,9 +7946,9 @@ "integrity": "sha512-j05vL56tR90rsYqm9ZD05v6K4HI7t4yMDEvvU0x4f+IADXM9Jx1x9mzatxOs5drJq6dGhugxDW99mcPvXVLl+Q==" }, "node_modules/sass": { - "version": "1.77.0", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.77.0.tgz", - "integrity": "sha512-eGj4HNfXqBWtSnvItNkn7B6icqH14i3CiCGbzMKs3BAPTq62pp9NBYsBgyN4cA+qssqo9r26lW4JSvlaUUWbgw==", + "version": "1.77.1", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.77.1.tgz", + "integrity": "sha512-OMEyfirt9XEfyvocduUIOlUSkWOXS/LAt6oblR/ISXCTukyavjex+zQNm51pPCOiFKY1QpWvEH1EeCkgyV3I6w==", "dependencies": { "chokidar": ">=3.0.0 <4.0.0", "immutable": "^4.0.0", @@ -8895,15 +9099,15 @@ } }, "@aws-sdk/client-s3": { - "version": "3.572.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-s3/-/client-s3-3.572.0.tgz", - "integrity": "sha512-YLtJRVZN+ktOaseWeTtthmimRQoWxygdzRPFlb1HpDPX+akBrGkL7Mz69onpXKfqm9Loz3diUXHqKfpxRX9Pog==", + "version": "3.574.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-s3/-/client-s3-3.574.0.tgz", + "integrity": "sha512-198QLFeJEs3xgCkLcGD8r0IVCR+BTjXGbVpDYC0DCU7vWjINR8igwwnuA5kbCHDALXvWmkX5MVuAlDuawsUn6w==", "requires": { "@aws-crypto/sha1-browser": "3.0.0", "@aws-crypto/sha256-browser": "3.0.0", "@aws-crypto/sha256-js": "3.0.0", - "@aws-sdk/client-sso-oidc": "3.572.0", - "@aws-sdk/client-sts": "3.572.0", + "@aws-sdk/client-sso-oidc": "3.574.0", + "@aws-sdk/client-sts": "3.574.0", "@aws-sdk/core": "3.572.0", "@aws-sdk/credential-provider-node": "3.572.0", "@aws-sdk/middleware-bucket-endpoint": "3.568.0", @@ -9005,13 +9209,13 @@ } }, "@aws-sdk/client-sso-oidc": { - "version": "3.572.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso-oidc/-/client-sso-oidc-3.572.0.tgz", - "integrity": "sha512-S6C/S6xYesDakEuzYvlY1DMMKLtKQxdbbygq3hfeG2R0jUt9KpRLsQXK8qrBuVCKa3WcnjN/30hp4g/iUWFU/w==", + "version": "3.574.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso-oidc/-/client-sso-oidc-3.574.0.tgz", + "integrity": "sha512-WcR8AnFhx7bqhYwfSl3OrF0Pu0LfHGgSOnmmORHqRF7ykguE09M/WUlCCjTGmZjJZ1we3uF5Xg8Jg12eiD+bmw==", "requires": { "@aws-crypto/sha256-browser": "3.0.0", "@aws-crypto/sha256-js": "3.0.0", - "@aws-sdk/client-sts": "3.572.0", + "@aws-sdk/client-sts": "3.574.0", "@aws-sdk/core": "3.572.0", "@aws-sdk/credential-provider-node": "3.572.0", "@aws-sdk/middleware-host-header": "3.567.0", @@ -9052,13 +9256,13 @@ } }, "@aws-sdk/client-sts": { - "version": "3.572.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.572.0.tgz", - "integrity": "sha512-jCQuH2qkbWoSY4wckLSfzf3OPh7zc7ZckEbIGGVUQar/JVff6EIbpQ+uNG29DDEOpdPPd8rrJsVuUlA/nvJdXA==", + "version": "3.574.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.574.0.tgz", + "integrity": "sha512-WNDSG9nipap/L1gGDkCQvU2u413HmVxMJKr41lBCibioz42Z4i6XkCr1etYwIjuVfGF6QPrsEsYLqRwlAC/BQg==", "requires": { "@aws-crypto/sha256-browser": "3.0.0", "@aws-crypto/sha256-js": "3.0.0", - "@aws-sdk/client-sso-oidc": "3.572.0", + "@aws-sdk/client-sso-oidc": "3.574.0", "@aws-sdk/core": "3.572.0", "@aws-sdk/credential-provider-node": "3.572.0", "@aws-sdk/middleware-host-header": "3.567.0", @@ -9139,23 +9343,6 @@ "tslib": "^2.6.2" } }, - "@aws-sdk/credential-provider-ini": { - "version": "3.572.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.572.0.tgz", - "integrity": "sha512-05KzbAp77fEiQXqMeodXeMbT83FOqSyBrfSEMz6U8uBXeJCy8zPUjN3acqcbG55/HNJHUvg1cftqzy+fUz71gA==", - "requires": { - "@aws-sdk/credential-provider-env": "3.568.0", - "@aws-sdk/credential-provider-process": "3.572.0", - "@aws-sdk/credential-provider-sso": "3.572.0", - "@aws-sdk/credential-provider-web-identity": "3.568.0", - "@aws-sdk/types": "3.567.0", - "@smithy/credential-provider-imds": "^2.3.0", - "@smithy/property-provider": "^2.2.0", - "@smithy/shared-ini-file-loader": "^2.4.0", - "@smithy/types": "^2.12.0", - "tslib": "^2.6.2" - } - }, "@aws-sdk/credential-provider-node": { "version": "3.572.0", "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.572.0.tgz", @@ -9173,6 +9360,121 @@ "@smithy/shared-ini-file-loader": "^2.4.0", "@smithy/types": "^2.12.0", "tslib": "^2.6.2" + }, + "dependencies": { + "@aws-sdk/client-sso-oidc": { + "version": "3.572.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso-oidc/-/client-sso-oidc-3.572.0.tgz", + "integrity": "sha512-S6C/S6xYesDakEuzYvlY1DMMKLtKQxdbbygq3hfeG2R0jUt9KpRLsQXK8qrBuVCKa3WcnjN/30hp4g/iUWFU/w==", + "peer": true, + "requires": { + "@aws-crypto/sha256-browser": "3.0.0", + "@aws-crypto/sha256-js": "3.0.0", + "@aws-sdk/client-sts": "3.572.0", + "@aws-sdk/core": "3.572.0", + "@aws-sdk/credential-provider-node": "3.572.0", + "@aws-sdk/middleware-host-header": "3.567.0", + "@aws-sdk/middleware-logger": "3.568.0", + "@aws-sdk/middleware-recursion-detection": "3.567.0", + "@aws-sdk/middleware-user-agent": "3.572.0", + "@aws-sdk/region-config-resolver": "3.572.0", + "@aws-sdk/types": "3.567.0", + "@aws-sdk/util-endpoints": "3.572.0", + "@aws-sdk/util-user-agent-browser": "3.567.0", + "@aws-sdk/util-user-agent-node": "3.568.0", + "@smithy/config-resolver": "^2.2.0", + "@smithy/core": "^1.4.2", + "@smithy/fetch-http-handler": "^2.5.0", + "@smithy/hash-node": "^2.2.0", + "@smithy/invalid-dependency": "^2.2.0", + "@smithy/middleware-content-length": "^2.2.0", + "@smithy/middleware-endpoint": "^2.5.1", + "@smithy/middleware-retry": "^2.3.1", + "@smithy/middleware-serde": "^2.3.0", + "@smithy/middleware-stack": "^2.2.0", + "@smithy/node-config-provider": "^2.3.0", + "@smithy/node-http-handler": "^2.5.0", + "@smithy/protocol-http": "^3.3.0", + "@smithy/smithy-client": "^2.5.1", + "@smithy/types": "^2.12.0", + "@smithy/url-parser": "^2.2.0", + "@smithy/util-base64": "^2.3.0", + "@smithy/util-body-length-browser": "^2.2.0", + "@smithy/util-body-length-node": "^2.3.0", + "@smithy/util-defaults-mode-browser": "^2.2.1", + "@smithy/util-defaults-mode-node": "^2.3.1", + "@smithy/util-endpoints": "^1.2.0", + "@smithy/util-middleware": "^2.2.0", + "@smithy/util-retry": "^2.2.0", + "@smithy/util-utf8": "^2.3.0", + "tslib": "^2.6.2" + } + }, + "@aws-sdk/client-sts": { + "version": "3.572.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.572.0.tgz", + "integrity": "sha512-jCQuH2qkbWoSY4wckLSfzf3OPh7zc7ZckEbIGGVUQar/JVff6EIbpQ+uNG29DDEOpdPPd8rrJsVuUlA/nvJdXA==", + "peer": true, + "requires": { + "@aws-crypto/sha256-browser": "3.0.0", + "@aws-crypto/sha256-js": "3.0.0", + "@aws-sdk/client-sso-oidc": "3.572.0", + "@aws-sdk/core": "3.572.0", + "@aws-sdk/credential-provider-node": "3.572.0", + "@aws-sdk/middleware-host-header": "3.567.0", + "@aws-sdk/middleware-logger": "3.568.0", + "@aws-sdk/middleware-recursion-detection": "3.567.0", + "@aws-sdk/middleware-user-agent": "3.572.0", + "@aws-sdk/region-config-resolver": "3.572.0", + "@aws-sdk/types": "3.567.0", + "@aws-sdk/util-endpoints": "3.572.0", + "@aws-sdk/util-user-agent-browser": "3.567.0", + "@aws-sdk/util-user-agent-node": "3.568.0", + "@smithy/config-resolver": "^2.2.0", + "@smithy/core": "^1.4.2", + "@smithy/fetch-http-handler": "^2.5.0", + "@smithy/hash-node": "^2.2.0", + "@smithy/invalid-dependency": "^2.2.0", + "@smithy/middleware-content-length": "^2.2.0", + "@smithy/middleware-endpoint": "^2.5.1", + "@smithy/middleware-retry": "^2.3.1", + "@smithy/middleware-serde": "^2.3.0", + "@smithy/middleware-stack": "^2.2.0", + "@smithy/node-config-provider": "^2.3.0", + "@smithy/node-http-handler": "^2.5.0", + "@smithy/protocol-http": "^3.3.0", + "@smithy/smithy-client": "^2.5.1", + "@smithy/types": "^2.12.0", + "@smithy/url-parser": "^2.2.0", + "@smithy/util-base64": "^2.3.0", + "@smithy/util-body-length-browser": "^2.2.0", + "@smithy/util-body-length-node": "^2.3.0", + "@smithy/util-defaults-mode-browser": "^2.2.1", + "@smithy/util-defaults-mode-node": "^2.3.1", + "@smithy/util-endpoints": "^1.2.0", + "@smithy/util-middleware": "^2.2.0", + "@smithy/util-retry": "^2.2.0", + "@smithy/util-utf8": "^2.3.0", + "tslib": "^2.6.2" + } + }, + "@aws-sdk/credential-provider-ini": { + "version": "3.572.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.572.0.tgz", + "integrity": "sha512-05KzbAp77fEiQXqMeodXeMbT83FOqSyBrfSEMz6U8uBXeJCy8zPUjN3acqcbG55/HNJHUvg1cftqzy+fUz71gA==", + "requires": { + "@aws-sdk/credential-provider-env": "3.568.0", + "@aws-sdk/credential-provider-process": "3.572.0", + "@aws-sdk/credential-provider-sso": "3.572.0", + "@aws-sdk/credential-provider-web-identity": "3.568.0", + "@aws-sdk/types": "3.567.0", + "@smithy/credential-provider-imds": "^2.3.0", + "@smithy/property-provider": "^2.2.0", + "@smithy/shared-ini-file-loader": "^2.4.0", + "@smithy/types": "^2.12.0", + "tslib": "^2.6.2" + } + } } }, "@aws-sdk/credential-provider-process": { @@ -9199,6 +9501,116 @@ "@smithy/shared-ini-file-loader": "^2.4.0", "@smithy/types": "^2.12.0", "tslib": "^2.6.2" + }, + "dependencies": { + "@aws-sdk/client-sso-oidc": { + "version": "3.572.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso-oidc/-/client-sso-oidc-3.572.0.tgz", + "integrity": "sha512-S6C/S6xYesDakEuzYvlY1DMMKLtKQxdbbygq3hfeG2R0jUt9KpRLsQXK8qrBuVCKa3WcnjN/30hp4g/iUWFU/w==", + "peer": true, + "requires": { + "@aws-crypto/sha256-browser": "3.0.0", + "@aws-crypto/sha256-js": "3.0.0", + "@aws-sdk/client-sts": "3.572.0", + "@aws-sdk/core": "3.572.0", + "@aws-sdk/credential-provider-node": "3.572.0", + "@aws-sdk/middleware-host-header": "3.567.0", + "@aws-sdk/middleware-logger": "3.568.0", + "@aws-sdk/middleware-recursion-detection": "3.567.0", + "@aws-sdk/middleware-user-agent": "3.572.0", + "@aws-sdk/region-config-resolver": "3.572.0", + "@aws-sdk/types": "3.567.0", + "@aws-sdk/util-endpoints": "3.572.0", + "@aws-sdk/util-user-agent-browser": "3.567.0", + "@aws-sdk/util-user-agent-node": "3.568.0", + "@smithy/config-resolver": "^2.2.0", + "@smithy/core": "^1.4.2", + "@smithy/fetch-http-handler": "^2.5.0", + "@smithy/hash-node": "^2.2.0", + "@smithy/invalid-dependency": "^2.2.0", + "@smithy/middleware-content-length": "^2.2.0", + "@smithy/middleware-endpoint": "^2.5.1", + "@smithy/middleware-retry": "^2.3.1", + "@smithy/middleware-serde": "^2.3.0", + "@smithy/middleware-stack": "^2.2.0", + "@smithy/node-config-provider": "^2.3.0", + "@smithy/node-http-handler": "^2.5.0", + "@smithy/protocol-http": "^3.3.0", + "@smithy/smithy-client": "^2.5.1", + "@smithy/types": "^2.12.0", + "@smithy/url-parser": "^2.2.0", + "@smithy/util-base64": "^2.3.0", + "@smithy/util-body-length-browser": "^2.2.0", + "@smithy/util-body-length-node": "^2.3.0", + "@smithy/util-defaults-mode-browser": "^2.2.1", + "@smithy/util-defaults-mode-node": "^2.3.1", + "@smithy/util-endpoints": "^1.2.0", + "@smithy/util-middleware": "^2.2.0", + "@smithy/util-retry": "^2.2.0", + "@smithy/util-utf8": "^2.3.0", + "tslib": "^2.6.2" + } + }, + "@aws-sdk/client-sts": { + "version": "3.572.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.572.0.tgz", + "integrity": "sha512-jCQuH2qkbWoSY4wckLSfzf3OPh7zc7ZckEbIGGVUQar/JVff6EIbpQ+uNG29DDEOpdPPd8rrJsVuUlA/nvJdXA==", + "peer": true, + "requires": { + "@aws-crypto/sha256-browser": "3.0.0", + "@aws-crypto/sha256-js": "3.0.0", + "@aws-sdk/client-sso-oidc": "3.572.0", + "@aws-sdk/core": "3.572.0", + "@aws-sdk/credential-provider-node": "3.572.0", + "@aws-sdk/middleware-host-header": "3.567.0", + "@aws-sdk/middleware-logger": "3.568.0", + "@aws-sdk/middleware-recursion-detection": "3.567.0", + "@aws-sdk/middleware-user-agent": "3.572.0", + "@aws-sdk/region-config-resolver": "3.572.0", + "@aws-sdk/types": "3.567.0", + "@aws-sdk/util-endpoints": "3.572.0", + "@aws-sdk/util-user-agent-browser": "3.567.0", + "@aws-sdk/util-user-agent-node": "3.568.0", + "@smithy/config-resolver": "^2.2.0", + "@smithy/core": "^1.4.2", + "@smithy/fetch-http-handler": "^2.5.0", + "@smithy/hash-node": "^2.2.0", + "@smithy/invalid-dependency": "^2.2.0", + "@smithy/middleware-content-length": "^2.2.0", + "@smithy/middleware-endpoint": "^2.5.1", + "@smithy/middleware-retry": "^2.3.1", + "@smithy/middleware-serde": "^2.3.0", + "@smithy/middleware-stack": "^2.2.0", + "@smithy/node-config-provider": "^2.3.0", + "@smithy/node-http-handler": "^2.5.0", + "@smithy/protocol-http": "^3.3.0", + "@smithy/smithy-client": "^2.5.1", + "@smithy/types": "^2.12.0", + "@smithy/url-parser": "^2.2.0", + "@smithy/util-base64": "^2.3.0", + "@smithy/util-body-length-browser": "^2.2.0", + "@smithy/util-body-length-node": "^2.3.0", + "@smithy/util-defaults-mode-browser": "^2.2.1", + "@smithy/util-defaults-mode-node": "^2.3.1", + "@smithy/util-endpoints": "^1.2.0", + "@smithy/util-middleware": "^2.2.0", + "@smithy/util-retry": "^2.2.0", + "@smithy/util-utf8": "^2.3.0", + "tslib": "^2.6.2" + } + }, + "@aws-sdk/token-providers": { + "version": "3.572.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/token-providers/-/token-providers-3.572.0.tgz", + "integrity": "sha512-IkSu8p32tQZhKqwmfLZLGfYwNhsS/HUQBLnDMHJlr9VifmDqlTurcr+DwMCaMimuFhcLeb45vqTymKf/ro/OBw==", + "requires": { + "@aws-sdk/types": "3.567.0", + "@smithy/property-provider": "^2.2.0", + "@smithy/shared-ini-file-loader": "^2.4.0", + "@smithy/types": "^2.12.0", + "tslib": "^2.6.2" + } + } } }, "@aws-sdk/credential-provider-web-identity": { @@ -9372,18 +9784,6 @@ "tslib": "^2.6.2" } }, - "@aws-sdk/token-providers": { - "version": "3.572.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/token-providers/-/token-providers-3.572.0.tgz", - "integrity": "sha512-IkSu8p32tQZhKqwmfLZLGfYwNhsS/HUQBLnDMHJlr9VifmDqlTurcr+DwMCaMimuFhcLeb45vqTymKf/ro/OBw==", - "requires": { - "@aws-sdk/types": "3.567.0", - "@smithy/property-provider": "^2.2.0", - "@smithy/shared-ini-file-loader": "^2.4.0", - "@smithy/types": "^2.12.0", - "tslib": "^2.6.2" - } - }, "@aws-sdk/types": { "version": "3.567.0", "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.567.0.tgz", @@ -14578,9 +14978,9 @@ "integrity": "sha512-j05vL56tR90rsYqm9ZD05v6K4HI7t4yMDEvvU0x4f+IADXM9Jx1x9mzatxOs5drJq6dGhugxDW99mcPvXVLl+Q==" }, "sass": { - "version": "1.77.0", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.77.0.tgz", - "integrity": "sha512-eGj4HNfXqBWtSnvItNkn7B6icqH14i3CiCGbzMKs3BAPTq62pp9NBYsBgyN4cA+qssqo9r26lW4JSvlaUUWbgw==", + "version": "1.77.1", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.77.1.tgz", + "integrity": "sha512-OMEyfirt9XEfyvocduUIOlUSkWOXS/LAt6oblR/ISXCTukyavjex+zQNm51pPCOiFKY1QpWvEH1EeCkgyV3I6w==", "requires": { "chokidar": ">=3.0.0 <4.0.0", "immutable": "^4.0.0", diff --git a/test/controllers/bill-runs.controller.test.js b/test/controllers/bill-runs.controller.test.js index b180d62bf6..ebcd6ab627 100644 --- a/test/controllers/bill-runs.controller.test.js +++ b/test/controllers/bill-runs.controller.test.js @@ -23,6 +23,7 @@ const StartBillRunProcessService = require('../../app/services/bill-runs/start-b const SubmitAmendedBillableReturnsService = require('../../app/services/bill-runs/two-part-tariff/submit-amended-billable-returns.service.js') const SubmitCancelBillRunService = require('../../app/services/bill-runs/submit-cancel-bill-run.service.js') const SubmitRemoveBillRunLicenceService = require('../../app/services/bill-runs/two-part-tariff/submit-remove-bill-run-licence.service.js') +const SubmitReviewBillRunService = require('../../app/services/bill-runs/two-part-tariff/submit-review-bill-run.service.js') const SubmitReviewLicenceService = require('../../app/services/bill-runs/two-part-tariff/submit-review-licence.service.js') const SubmitSendBillRunService = require('../../app/services/bill-runs/submit-send-bill-run.service.js') const ViewBillRunService = require('../../app/services/bill-runs/view-bill-run.service.js') @@ -374,46 +375,17 @@ describe('Bill Runs controller', () => { }) describe('when a request is valid', () => { - describe('and no filters have been applied', () => { - beforeEach(() => { - Sinon.stub(ReviewBillRunService, 'go').resolves(_reviewBillRunData()) - }) - - it('returns a 200 response', async () => { - const response = await server.inject(options) - - expect(response.statusCode).to.equal(200) - expect(response.payload).to.contain('two-part tariff') - expect(response.payload).to.contain('Southern (Test replica)') - expect(response.payload).to.contain( - 'You need to review 1 licences with returns data issues. You can then continue and send the bill run.' - ) - expect(response.payload).to.contain('Showing all 2 licences') - }) + beforeEach(() => { + Sinon.stub(SubmitReviewBillRunService, 'go').resolves() }) - describe('and a filter has been applied', () => { - beforeEach(() => { - const reviewBillRunData = _reviewBillRunData() - - // edit the data to represent a filter being applied - reviewBillRunData.filter = { openFilter: true, licenceHolder: 'big' } - reviewBillRunData.numberOfLicencesDisplayed = 1 - - Sinon.stub(ReviewBillRunService, 'go').resolves(reviewBillRunData) - }) - - it('returns a 200 response', async () => { - const response = await server.inject(options) + it('redirects to the review licences page', async () => { + const response = await server.inject(options) - expect(response.statusCode).to.equal(200) - expect(response.payload).to.contain('two-part tariff') - expect(response.payload).to.contain('Southern (Test replica)') - expect(response.payload).to.contain( - 'You need to review 1 licences with returns data issues. You can then continue and send the bill run.' - ) - expect(response.payload).to.contain('Showing 1 of 2 licences') - }) + expect(response.statusCode).to.equal(302) + expect(response.headers.location).to.equal( + '/system/bill-runs/97db1a27-8308-4aba-b463-8a6af2558b28/review' + ) }) }) }) diff --git a/test/services/bill-runs/two-part-tariff/review-bill-run.service.test.js b/test/services/bill-runs/two-part-tariff/review-bill-run.service.test.js index d8f0ea55aa..09786ea8a8 100644 --- a/test/services/bill-runs/two-part-tariff/review-bill-run.service.test.js +++ b/test/services/bill-runs/two-part-tariff/review-bill-run.service.test.js @@ -33,7 +33,6 @@ describe('Review Bill Run Service', () => { describe('when called without a filter applied', () => { const bannerMessage = undefined - const payload = undefined const presenterStubData = { preparedBillRun: 'bill run data', preparedLicences: 'licence data', @@ -48,11 +47,11 @@ describe('Review Bill Run Service', () => { beforeEach(() => { Sinon.stub(ReviewBillRunPresenter, 'go').returns(presenterStubData) - yarStub = { flash: Sinon.stub().returns([]) } + yarStub = { flash: Sinon.stub().returns([]), get: Sinon.stub().returns(undefined) } }) it('will fetch the data for the review page and return it once formatted by the presenter', async () => { - const result = await ReviewBillRunService.go(billRunId, payload, yarStub) + const result = await ReviewBillRunService.go(billRunId, yarStub) expect(result).to.equal({ bannerMessage, ...presenterStubData }) @@ -63,11 +62,6 @@ describe('Review Bill Run Service', () => { describe('when called with a filter applied', () => { const bannerMessage = undefined - const payload = { - filterIssues: ['abs-outside-period', 'aggregate-factor'], - filterLicenceHolder: 'A Licence Holder Ltd', - filterLicenceStatus: 'review' - } const presenterStubData = { preparedBillRun: 'bill run data', preparedLicences: 'licence data', @@ -90,15 +84,20 @@ describe('Review Bill Run Service', () => { openFilter: true } } + const yarGetStubData = { + filterIssues: ['abs-outside-period', 'aggregate-factor'], + filterLicenceHolder: 'A Licence Holder Ltd', + filterLicenceStatus: 'review' + } beforeEach(() => { Sinon.stub(ReviewBillRunPresenter, 'go').returns(presenterStubData) - yarStub = { flash: Sinon.stub().returns([]) } + yarStub = { flash: Sinon.stub().returns([]), get: Sinon.stub().returns(yarGetStubData) } }) it('will fetch the data for the review page and return it once formatted by the presenter', async () => { - const result = await ReviewBillRunService.go(billRunId, payload, yarStub) + const result = await ReviewBillRunService.go(billRunId, yarStub) expect(result).to.equal({ bannerMessage, ...presenterStubData }) @@ -109,12 +108,6 @@ describe('Review Bill Run Service', () => { describe('when called with a banner displayed', () => { const bannerMessage = 'Licence 01/123/ABC removed from the bill run.' - const payload = { - filterIssues: ['abs-outside-period', 'aggregate-factor'], - filterLicenceHolder: 'A Licence Holder Ltd', - filterLicenceStatus: 'review' - } - const presenterStubData = { preparedBillRun: 'bill run data', preparedLicences: 'licence data', @@ -137,15 +130,23 @@ describe('Review Bill Run Service', () => { openFilter: true } } + const yarGetStubData = { + filterIssues: ['abs-outside-period', 'aggregate-factor'], + filterLicenceHolder: 'A Licence Holder Ltd', + filterLicenceStatus: 'review' + } beforeEach(() => { Sinon.stub(ReviewBillRunPresenter, 'go').returns(presenterStubData) - yarStub = { flash: Sinon.stub().returns(['Licence 01/123/ABC removed from the bill run.']) } + yarStub = { + flash: Sinon.stub().returns(['Licence 01/123/ABC removed from the bill run.']), + get: Sinon.stub().returns(yarGetStubData) + } }) it('will fetch the data for the review page and return it once formatted by the presenter', async () => { - const result = await ReviewBillRunService.go(billRunId, payload, yarStub) + const result = await ReviewBillRunService.go(billRunId, yarStub) expect(result).to.equal({ bannerMessage, ...presenterStubData }) diff --git a/test/services/bill-runs/two-part-tariff/submit-review-bill-run.service.test.js b/test/services/bill-runs/two-part-tariff/submit-review-bill-run.service.test.js new file mode 100644 index 0000000000..d8d416bdfa --- /dev/null +++ b/test/services/bill-runs/two-part-tariff/submit-review-bill-run.service.test.js @@ -0,0 +1,51 @@ +'use strict' + +// Test framework dependencies +const Lab = require('@hapi/lab') +const Code = require('@hapi/code') +const Sinon = require('sinon') + +const { describe, it, beforeEach, afterEach } = exports.lab = Lab.script() +const { expect } = Code + +// Thing under test +const SubmitReviewBillRunService = require('../../../../app/services/bill-runs/two-part-tariff/submit-review-bill-run.service.js') + +describe('Submit Review Bill Run Service', () => { + let yarStub + + beforeEach(() => { + yarStub = { clear: Sinon.stub().returns(), set: Sinon.stub().returns() } + }) + + afterEach(() => { + Sinon.restore() + }) + + describe('when called with the filters applied', () => { + const payload = { + filterIssues: ['abs-outside-period', 'aggregate-factor'], + filterLicenceHolder: 'A Licence Holder Ltd', + filterLicenceStatus: 'review' + } + + it('will set the cookie with the filter data', async () => { + await SubmitReviewBillRunService.go(payload, yarStub) + + expect(yarStub.clear.called).to.be.false() + expect(yarStub.set.called).to.be.true() + expect(yarStub.set.args[0][1]).to.equal(payload) + }) + }) + + describe('when called to clear the filters', () => { + const payload = { clearFilters: 'reset' } + + it('will clear the filter data from the cookie', async () => { + await SubmitReviewBillRunService.go(payload, yarStub) + + expect(yarStub.clear.called).to.be.true() + expect(yarStub.set.called).to.be.false() + }) + }) +})