-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove POST create bill run route (#1418)
https://eaflood.atlassian.net/browse/WATER-4201 When we first added SROC supplementary billing to this project, creation of the bill run was triggered from [water-abstraction-ui](https://github.com/DEFRA/water-abstraction-ui). Later, we added SROC two-part tariff annual billing. That required a change to the create bill run journey, so we took the opportunity to migrate it to this project. This means we no longer expect the legacy UI to trigger bill runs. The endpoint it was using is now defunct. But also, it means we can simplify our bill run creation/initialisation logic because we no longer have to consider two trigger points. We have been working on SROC two-part tariff supplementary recently. We're ready to stitch all the pieces we've built together, the first step being triggering the bill run. Our journey now includes the option, but it hasn't been updated to check whether a user can create a two-part tariff supplementary bill run (based on the state of existing bill runs). That will complicate the create/initiate process even more. So, as a preparatory step, we're simplifying things first by dropping the old POST create bill run route.
- Loading branch information
1 parent
29eea30
commit 6135ba0
Showing
5 changed files
with
0 additions
and
347 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,6 @@ const RemoveBillRunLicenceService = require('../../app/services/bill-runs/two-pa | |
const ReviewBillRunService = require('../../app/services/bill-runs/two-part-tariff/review-bill-run.service.js') | ||
const ReviewLicenceService = require('../../app/services/bill-runs/two-part-tariff/review-licence.service.js') | ||
const SendBillRunService = require('../../app/services/bill-runs/send-bill-run.service.js') | ||
const StartBillRunProcessService = require('../../app/services/bill-runs/start-bill-run-process.service.js') | ||
const SubmitAmendedAdjustmentFactorService = require('../../app/services/bill-runs/two-part-tariff/submit-amended-adjustment-factor.service.js') | ||
const SubmitAmendedAuthorisedVolumeService = require('../../app/services/bill-runs/two-part-tariff/submit-amended-authorised-volume.service.js') | ||
const SubmitAmendedBillableReturnsService = require('../../app/services/bill-runs/two-part-tariff/submit-amended-billable-returns.service.js') | ||
|
@@ -115,73 +114,6 @@ describe('Bill Runs controller', () => { | |
}) | ||
}) | ||
}) | ||
|
||
describe('POST', () => { | ||
beforeEach(() => { | ||
options = postRequestOptions( | ||
'/bill-runs', | ||
{ | ||
type: 'supplementary', | ||
scheme: 'sroc', | ||
region: '07ae7f3a-2677-4102-b352-cc006828948c', | ||
user: '[email protected]' | ||
} | ||
) | ||
}) | ||
|
||
describe('when a request is valid', () => { | ||
const validResponse = { | ||
id: 'f561990b-b29a-42f4-b71a-398c52339f78', | ||
region: '07ae7f3a-2677-4102-b352-cc006828948c', | ||
scheme: 'sroc', | ||
batchType: 'supplementary', | ||
status: 'processing' | ||
} | ||
|
||
beforeEach(async () => { | ||
Sinon.stub(StartBillRunProcessService, 'go').resolves(validResponse) | ||
}) | ||
|
||
it('returns a 200 response including details of the new bill run', async () => { | ||
const response = await server.inject(options) | ||
const payload = JSON.parse(response.payload) | ||
|
||
expect(response.statusCode).to.equal(200) | ||
expect(payload).to.equal(validResponse) | ||
}) | ||
}) | ||
|
||
describe('when the request fails', () => { | ||
describe('because the request is invalid', () => { | ||
beforeEach(() => { | ||
options.payload.scheme = 'INVALID' | ||
}) | ||
|
||
it('returns an error response', async () => { | ||
const response = await server.inject(options) | ||
const payload = JSON.parse(response.payload) | ||
|
||
expect(response.statusCode).to.equal(400) | ||
expect(payload.message).to.startWith('"scheme" must be') | ||
}) | ||
}) | ||
|
||
describe('because the bill run could not be initiated', () => { | ||
beforeEach(async () => { | ||
Sinon.stub(Boom, 'badImplementation').returns(new Boom.Boom('Bang', { statusCode: 500 })) | ||
Sinon.stub(StartBillRunProcessService, 'go').rejects() | ||
}) | ||
|
||
it('returns an error response', async () => { | ||
const response = await server.inject(options) | ||
const payload = JSON.parse(response.payload) | ||
|
||
expect(response.statusCode).to.equal(500) | ||
expect(payload.message).to.equal('An internal server error occurred') | ||
}) | ||
}) | ||
}) | ||
}) | ||
}) | ||
|
||
describe('/bill-runs/{id}', () => { | ||
|
This file was deleted.
Oops, something went wrong.