Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new NoBillingPeriodsError as a reminder (#1257)
https://eaflood.atlassian.net/browse/WATER-4403 As part of the work to add support for SROC two-part tariff bill runs to the service, we needed to amend the set-up bill run journey. We took this opportunity to rewrite it! This meant copying some of the existing restrictions, one of which being that you cannot generate a supplementary until the annual has been created and sent. We then replaced the legacy SROC annual with a new engine, which was much more performant and reliable. Because of this, the billing & data team was able to bring forward the month they generated the bill runs in. However, they are still blocked from running supplementary until they are ready to generate the annual bill run each year. So, we were asked to tweak our version, allowing them to generate a supplementary bill run even when the annual has not yet been done. The old logic for supplementary always took the current financial year as the starting point. The new logic we implemented works by finding the last annual bill run for a region and using its year. Already run the annual bill? Then, the result would be the current financial year. Not yet run it? Then we'll find last year's and start from there. That is, however, when working in pre-prod or production where there is a complete history of annual bill runs. Working locally, or perhaps in `dev` or `tst`, you may find the last annual was in 2021 or simply doesn't exist at all! When this happens, the SROC engine is unable to determine the billing periods for the supplementary bill run being requested, and an error is thrown. At the time, coding to handle this situation 'gracefully' was discussed but rejected. We'd be writing code and building screens for a situation that could _never_ happen in production. The problem is that we forget this every now and again. We then attempt to create a supplementary in one of these non-production environments and start panicking when it appears broken. This is a 'low-fi' attempt to try and remind us devs _why_ supplementary may appear to be broken. 😁
- Loading branch information