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

Add LegacyRequestLib #143

Merged
merged 5 commits into from
Mar 4, 2023
Merged

Add LegacyRequestLib #143

merged 5 commits into from
Mar 4, 2023

Conversation

Cruikshanks
Copy link
Member

@Cruikshanks Cruikshanks commented Mar 4, 2023

https://eaflood.atlassian.net/browse/WATER-3906
https://eaflood.atlassian.net/browse/WATER-3921

For the SROC supplementary bill run process we intend to take things as far as having the batch, invoice, invoice licence and transaction records created in the DB and the Charging Module API, and the bill run generated.

Control will then be handed to the legacy service to complete the process. src/modules/billing/jobs/create-charge.js in the water-abstraction-service has been our guide for this. After generating the bill run in the charging module it queues up the src/modules/billing/jobs/refresh-totals.js job.

We've added a new endpoint to the water-abstraction-service that allows us to do the same. The first step is to add a new LegacyRequestLib following the same pattern as app/lib/charging-module-request.lib.js.


As part of this change, we have to add a new env var to support talking to the legacy services. We also update our existing app/services/health/info.service.js to make use of LegacyRequestLib.

https://eaflood.atlassian.net/browse/WATER-3906
https://eaflood.atlassian.net/browse/WATER-3921

For the SROC supplementary bill run process we intend to take things as far as having the batch, invoice, invoice licence and transaction records created in the DB and the Charging Module API, and the bill run generated.

Control will then be handed to the legacy service to complete the process. `src/modules/billing/jobs/create-charge.js` in the [water-abstraction-service](https://github.com/DEFRA/water-abstraction-service) has been our guide for this. After generating the bill run in the charging module it queues up the `src/modules/billing/jobs/refresh-totals.js` job.

We've [added a new endpoint](DEFRA/water-abstraction-service#2036) to the **water-abstraction-service** that allows us to do the same. The first step is to add a new `LegacyRequestLib` following the same pattern as `app/lib/charging-module-request.lib.js`.
@Cruikshanks Cruikshanks added the enhancement New feature or request label Mar 4, 2023
@Cruikshanks Cruikshanks self-assigned this Mar 4, 2023
The legacy services use a shared [JSON Web Token (JWT)](https://jwt.io/) which is saved as an env var in their own config files. Requests need to have this set in their `authorisation` header or they'll be rejected.

TBH, it is a pointless authentication mechanism! All the legacy services share the same token, and read it from config files stored on the server instances. From a security point of view, it's the same as keeping your password on a post-it note stuck to your monitor.

But, Rome wasn't built in a day. So, for now, our new system has to play along.
Now we have it, we might as well use it in the existing code.
@Cruikshanks Cruikshanks marked this pull request as ready for review March 4, 2023 17:14
@Cruikshanks Cruikshanks merged commit 75bdb58 into main Mar 4, 2023
@Cruikshanks Cruikshanks deleted the add-legacy-request-lib branch March 4, 2023 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant