Skip to content

Commit 9120be7

Browse files
authored
Support new queued bill run status (#2271)
https://eaflood.atlassian.net/browse/WATER-3877 When a supplementary bill run is started, we'll be creating both a PRESROC and SROC one at the same time. The PRESROC one will then begin `processing` (labelled as BUILDING in the UI) whilst the SROC one is `queued` waiting to be processed. At the moment though, all we can do is initialise the SROC bill run with a status of `processing` as that is all that is available to us. In the UI this will give the impression both are building when they're not. We've added a new `queued` status to [water-abstraction-service](DEFRA/water-abstraction-service#1965). This change updates the UI to add a new **QUEUED** badge and supports it.
1 parent 947e8c0 commit 9120be7

File tree

6 files changed

+7
-5
lines changed

6 files changed

+7
-5
lines changed

src/internal/modules/billing/lib/routing.js

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const getBillingBatchRoute = (batch, opts = {}) => {
2121
.set('sent', opts.showSuccessPage ? `/billing/batch/${id}/confirm/success` : `/billing/batch/${id}/summary`)
2222
.set('review', `/billing/batch/${id}/two-part-tariff-review`)
2323
.set('empty', `/billing/batch/${id}/empty`)
24+
.set('queued', `/billing/batch/${id}/processing?back=${opts.isBackEnabled ? 1 : 0}`)
2425

2526
if (opts.isErrorRoutesIncluded) {
2627
routeMap

src/internal/modules/billing/pre-handlers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ const checkBatchStatusIsReview = partialRight(checkBatchStatus, 'review')
9191
const checkBatchStatusIsReady = partialRight(checkBatchStatus, 'ready')
9292

9393
const validBatchStatusSchema = Joi.array().min(1).required().items(
94-
Joi.string().valid('processing', 'review', 'ready', 'error', 'empty', 'sent', 'sending')
94+
Joi.string().valid('queued', 'processing', 'review', 'ready', 'error', 'empty', 'sent', 'sending')
9595
)
9696

9797
/**

src/internal/modules/billing/routes/bill-run.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ const routes = {
293293
handler: controller.getBillingBatchProcessing,
294294
config: {
295295
app: {
296-
validBatchStatuses: ['processing', 'error', 'sending']
296+
validBatchStatuses: ['queued', 'processing', 'error', 'sending']
297297
},
298298
auth: { scope: allowedScopes },
299299
plugins: {

src/internal/views/nunjucks/billing/macros/batch-buttons.njk

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
{% endmacro %}
2424

2525
{% macro cancelStatusBatchButton(batch) %}
26-
{% if batch.status in['processing'] %}
26+
{% if batch.status in['queued', 'processing'] %}
2727
{{
2828
govukButton({
2929
text: "Cancel bill run",

src/shared/view/nunjucks/filters/batch-badge.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ const badge = {
77
sent: { status: 'success', text: 'Sent' },
88
review: { status: 'todo', text: 'Review' },
99
error: { status: 'error', text: 'Error' },
10-
empty: { status: 'inactive', text: 'Empty' }
10+
empty: { status: 'inactive', text: 'Empty' },
11+
queued: { status: 'warning', text: 'Queued' }
1112
}
1213

1314
exports.batchBadge = (batch, isLarge) => ({

test/internal/modules/billing/routes/bill-run.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ experiment('internal/modules/billing/routes', () => {
9898

9999
test('redirects unless batch status is "processing" or "error"', async () => {
100100
const { validBatchStatuses } = routes.getBillingBatchProcessing.config.app
101-
expect(validBatchStatuses).to.equal(['processing', 'error', 'sending'])
101+
expect(validBatchStatuses).to.equal(['queued', 'processing', 'error', 'sending'])
102102
})
103103
})
104104

0 commit comments

Comments
 (0)