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

Fix determine billing periods #859

Merged
merged 5 commits into from
Mar 26, 2024
Merged

Conversation

Cruikshanks
Copy link
Member

https://eaflood.atlassian.net/browse/WATER-4375

To implement changes to support new two-part tariff bill run options we needed to update the create bill run journey. We took advantage of this to migrate the functionality into water-abstraction-system.

In our new journey to determine if there are any live bill runs that would block a new bill run from proceeding, we have to determine the financial end year for the proposed bill run. We do this in app/services/bill-runs/setup/exists.service.js.

Having determined the year we pass this into our existing StartBillRunProcessService for consistency.

What we had overlooked was that if the year is set it will then pass that on to DetermineBillingPeriodsService which, if provided with a financial year will only generate a billing period for that year. This breaks supplementary billing which for SROC needs multiple billing periods to be determined.

We'll be revisiting DetermineBillingPeriodsService soon as part of our work to Exclude Financial Year from Supplementary Billing where Annual Bill has not been run for region & year. But for now, we just need to get supplementary billing working again.

https://eaflood.atlassian.net/browse/WATER-4375

To implement changes to support new two-part tariff bill run options we needed to update the create bill run journey. We took advantage of this to migrate the functionality into [water-abstraction-system](https://github.com/DEFRA/water-abstraction-system).

In our new journey in order to determine fi there are any live bill runs that would block a new bill run from proceeding we have to determine the financial end year for the proposed bill run. We do this in `app/services/bill-runs/setup/exists.service.js`.

Having determine the year we passed this into our existing `StartBillRunProcessService` for consistency.

What we had overlooked was that if the year is set it will then pass that on to `DetermineBillingPeriodsService` which, if provided with a financial year will _only_ generate a billing period for that year. This breaks supplementary billing which for SROC needs multiple billing periods to be determined.

We'll be revisiting `DetermineBillingPeriodsService` in the near future as part of our work to [Exclude Financial Year from Supplementary Billing where Annual Bill has not been run for region & year](https://eaflood.atlassian.net/browse/WATER-4403). But for now we just need to get supplementary billing working again.
@Cruikshanks Cruikshanks added the bug Something isn't working label Mar 26, 2024
@Cruikshanks Cruikshanks self-assigned this Mar 26, 2024
@Cruikshanks Cruikshanks marked this pull request as ready for review March 26, 2024 08:58
@Cruikshanks Cruikshanks merged commit 9496199 into main Mar 26, 2024
6 checks passed
@Cruikshanks Cruikshanks deleted the fix-determine-billing-periods branch March 26, 2024 08:58
Cruikshanks added a commit that referenced this pull request Mar 28, 2024
Now we've refactored `DetermineBillingPeriodsService` to not just return a single billing period when financial year is set we can remove the temporary fix we did in [Fix determine billing periods](#859).
Cruikshanks added a commit that referenced this pull request Apr 2, 2024
https://eaflood.atlassian.net/browse/WATER-4403

In [Bump supplementary end year if no annual bill run](#875) we added logic that would mean when creating a new supplementary bill run the engine could tell if an annual bill run existed for the same year and region.

If one doesn't it will make a mess of the billing for customers if the supplementary happened before the annual. But we don't want to block users from working. So, instead we bump the financial end year to use back to the same as the last 'sent' annual bill run for that region.

We even [Refactor DetermineBillingPeriods to use type](#864) so it would know to use the calculated year when determining the billing periods for the supplementary bill run.

What we forgot to do was remove a [temporary fix](#859) we'd added until this work can be completed.

This means the year we've calculated is being dropped and not passed to `DetermineBillingPeriods`. This change fixes that!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant