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

Handle no charge versions in ProcessBillingBatch #174

Merged
merged 7 commits into from
Mar 30, 2023

Conversation

Cruikshanks
Copy link
Member

@Cruikshanks Cruikshanks commented Mar 24, 2023

https://eaflood.atlassian.net/browse/WATER-3952
https://eaflood.atlassian.net/browse/WATER-3803

To be honest, this change started as our first effort to add unit test coverage for the ProcessBillingBatchService. So, for example, our unit test error coverage now covers the changes we made including reversing the previous billing batch.

Whilst working on them we realised we were not handling no charge versions being returned at all. So, we put in protection against this issue. Nice!

Only our QA has come across this issue in testing and needs it resolved so they can continue their work.

Hence, we're derailing the original intent of this PR and getting the fix to handle no charge versions returned (plus tests! 😬)

@Cruikshanks Cruikshanks added the housekeeping Refactoring, tidying up or other work which supports the project label Mar 24, 2023
@Cruikshanks Cruikshanks self-assigned this Mar 24, 2023
@Cruikshanks Cruikshanks force-pushed the add-unit-tests-for-process-billing-batch branch from 71d8a78 to c1bb80d Compare March 30, 2023 08:14
@Cruikshanks Cruikshanks added bug Something isn't working and removed housekeeping Refactoring, tidying up or other work which supports the project labels Mar 30, 2023
@Cruikshanks Cruikshanks changed the title Add missing unit tests ProcessBillingBatchService Handle no charge versions in ProcessBillingBatch Mar 30, 2023
https://eaflood.atlassian.net/browse/WATER-3803

When we create the `ProcessBillingBatchService` we did it as a spike, as we were unsure of what the final service would look like. It's been through some changes since then, especially once we added support for crediting the previous billing batch in.

But now we think we have a stable design that we will iterate rather than trash and re-write in future changes. So, as promised, it is time to start adding the missing unit tests.
Whilst thinking of the scenarios to test for ProcessBillingBatchService we though of one not currently tested for the ProcessBillingTransactionsService.

What happens if we calculate no billable transactions but the previous billing batch does have transactions for the matching invoice and licence? Our current understanding is that we would credit everything on the previous bill run so our test ensures we get that result.
Again, we are not clear on how it could happen. But just in case we fetch no charge versions to bill we ensure we have protections for it in the service. We also add a unit test to document what we expect the service to do if this happens.
We've had to move around a lot of where things are getting created and stubbed. But now we have our first happy-path unit test that allows the process to complete.
@Cruikshanks Cruikshanks force-pushed the add-unit-tests-for-process-billing-batch branch from c1bb80d to 173b859 Compare March 30, 2023 11:23
@Cruikshanks Cruikshanks marked this pull request as ready for review March 30, 2023 11:35
Copy link
Contributor

@Jozzey Jozzey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼

@Cruikshanks Cruikshanks merged commit e4767c7 into main Mar 30, 2023
@Cruikshanks Cruikshanks deleted the add-unit-tests-for-process-billing-batch branch March 30, 2023 16:59
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.

2 participants