Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support new queued bill run status #2271

Merged
merged 3 commits into from
Jan 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/internal/modules/billing/lib/routing.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const getBillingBatchRoute = (batch, opts = {}) => {
.set('sent', opts.showSuccessPage ? `/billing/batch/${id}/confirm/success` : `/billing/batch/${id}/summary`)
.set('review', `/billing/batch/${id}/two-part-tariff-review`)
.set('empty', `/billing/batch/${id}/empty`)
.set('queued', `/billing/batch/${id}/processing?back=${opts.isBackEnabled ? 1 : 0}`)

if (opts.isErrorRoutesIncluded) {
routeMap
Expand Down
2 changes: 1 addition & 1 deletion src/internal/modules/billing/pre-handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const checkBatchStatusIsReview = partialRight(checkBatchStatus, 'review')
const checkBatchStatusIsReady = partialRight(checkBatchStatus, 'ready')

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

/**
Expand Down
2 changes: 1 addition & 1 deletion src/internal/modules/billing/routes/bill-run.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ const routes = {
handler: controller.getBillingBatchProcessing,
config: {
app: {
validBatchStatuses: ['processing', 'error', 'sending']
validBatchStatuses: ['queued', 'processing', 'error', 'sending']
},
auth: { scope: allowedScopes },
plugins: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{% endmacro %}

{% macro cancelStatusBatchButton(batch) %}
{% if batch.status in['processing'] %}
{% if batch.status in['queued', 'processing'] %}
{{
govukButton({
text: "Cancel bill run",
Expand Down
3 changes: 2 additions & 1 deletion src/shared/view/nunjucks/filters/batch-badge.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ const badge = {
sent: { status: 'success', text: 'Sent' },
review: { status: 'todo', text: 'Review' },
error: { status: 'error', text: 'Error' },
empty: { status: 'inactive', text: 'Empty' }
empty: { status: 'inactive', text: 'Empty' },
queued: { status: 'warning', text: 'Queued' }
}

exports.batchBadge = (batch, isLarge) => ({
Expand Down
2 changes: 1 addition & 1 deletion test/internal/modules/billing/routes/bill-run.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ experiment('internal/modules/billing/routes', () => {

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

Expand Down