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 DetermineFinancialEndYearService #891

Merged
merged 3 commits into from
Apr 4, 2024

Conversation

Cruikshanks
Copy link
Member

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

In Bump supplementary end year if no annual bill run we amended our billing engine for supplementary. We made it possible for users to generate supplementary bill runs in years where no annual has yet been created and sent.

Previously, the Billing & Data team would have to put a block on creating bill runs until the annuals were generated. This is because supplementary takes into account previous transactions whereas annual doesn't. Without the change creating a supplementary followed by an annual bill run would result in the customer getting charged twice.

We now determine when the last annual bill run was sent and use its financial end year as the end year for the supplementary bill run. Annual created in this billing period? Then the supplementary will start there and work back 5 years. If the last sent annual was for the previous billing period the supplementary will start there and work back 5 years.

So, what's the problem? In this explanation, we keep referring to the last sent 'annual' bill run. But we've just spotted the logic which looks for the last sent bill run does not include batch type in the where() clause. Theoretically, we could create a two-part tariff bill run, send it and that would then match our query!

This change corrects the query we use to find the last sent annual bill run for a region.

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

In [Bump supplementary end year if no annual bill run](#875) we amended our billing engine for supplementary. We made it possible for users to generate supplementary bill runs in years where no annual has yet been created and sent.

Previously, the Billing & Data team would have to put a block on creating bill runs until the annuals were generated. This is because supplementary takes into account previous transactions whereas annual doesn't. Without the change creating a supplementary followed by an annual bill run would result in the customer getting charged twice.

We now determine when the last annual bill run was sent and use its financial end year as the end year for the supplementary bill run. Annual created in this billing period? Then the supplementary will start there and work back 5 years. If the last sent annual was for the previous billing period the supplementary will start _there_ and work back 5 years.

So, what's the problem? In this explanation we keep referring to the last sent 'annual' bill run. But we've just spotted the logic which looks for the last sent bill run does not include batch type in the `where()` clause. Theoretically, we could create a two-part tariff bill run, send it and that would then match our query!

This change corrects the query we use to find the last sent annual bill run for a region.
@Cruikshanks Cruikshanks added the bug Something isn't working label Apr 4, 2024
@Cruikshanks Cruikshanks self-assigned this Apr 4, 2024
@Cruikshanks Cruikshanks marked this pull request as ready for review April 4, 2024 22:44
@Cruikshanks Cruikshanks merged commit 38b4070 into main Apr 4, 2024
6 checks passed
@Cruikshanks Cruikshanks deleted the fix-determine-financial-year-end-service branch April 4, 2024 22:44
Demwunz pushed a commit that referenced this pull request Apr 5, 2024
https://eaflood.atlassian.net/browse/WATER-4403

In [Bump supplementary end year if no annual bill run](#875) we amended our billing engine for supplementary. We made it possible for users to generate supplementary bill runs in years where no annual has yet been created and sent.

Previously, the Billing & Data team would have to put a block on creating bill runs until the annuals were generated. This is because supplementary takes into account previous transactions whereas annual doesn't. Without the change creating a supplementary followed by an annual bill run would result in the customer getting charged twice.

We now determine when the last annual bill run was sent and use its financial end year as the end year for the supplementary bill run. Annual created in this billing period? Then the supplementary will start there and work back 5 years. If the last sent annual was for the previous billing period the supplementary will start _there_ and work back 5 years.

So, what's the problem? In this explanation, we keep referring to the last sent 'annual' bill run. But we've just spotted the logic which looks for the last sent bill run does not include batch type in the `where()` clause. Theoretically, we could create a two-part tariff bill run, send it and that would then match our query!

This change corrects the query we use to find the last sent annual bill run for a region.
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