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

ProcessBillingBatchService refactor - pre-generate invoice licences #218

Merged
merged 10 commits into from
May 15, 2023

Conversation

StuAA78
Copy link
Contributor

@StuAA78 StuAA78 commented May 12, 2023

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

In order to fix a bug introduced by our refactoring, we moved to pre-generating all required billing invoices prior to entering the main charge version processing loop. Having done this, we think it would be a good idea to also pre-generate the required invoice licences.

This PR also introduces further optimisations to the pre-generation of the billing invoices, reducing the number of times we need to iterate in order to produce the object containing the generated billing invoices.

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

In order to fix a bug introduced by our refactoring, we moved to pre-generating all required billing invoices prior to entering the main charge version processing loop. Having done this, we think it would be a good idea to also pre-generate the required invoice licences.
@StuAA78 StuAA78 added the housekeeping Refactoring, tidying up or other work which supports the project label May 12, 2023
@StuAA78 StuAA78 self-assigned this May 12, 2023
StuAA78 added 4 commits May 12, 2023 12:24
Previously, `GenerateBillingInvoiceLicenceService` would check to see if a new billing invoice licence needed to be created. We no longer need to do this now that we pre-generate all required billing invoice licences. We therefore remove this functionality
We spotted that we were using `billingBatch.billingBatchId` when we were already destructuring this, so we move to using this directly
Renaming functions to make their intent clearer means we can remove comments
@StuAA78 StuAA78 force-pushed the process-billing-batch-pre-generate-invoice-licences branch from 9f788d4 to 3ea897c Compare May 15, 2023 10:34
@StuAA78 StuAA78 marked this pull request as ready for review May 15, 2023 10:55
StuAA78 added 4 commits May 15, 2023 11:56
In our `_preGenerateBillingInvoiceLicences` function we were iterating over all charge versions to generate a billing invoice licence for each one, then iterating over the generated billing invoice licences to produce the final keyed object. We realised that we could combine the two steps by iterating over the charge versions and generating the billing invoices in the same step. This means we can also check whether the billing invoice and licence in question already has a billing invoice licence generated, which we weren't doing with the first approach.
After refactoring `_preGenerateBillingInvoiceLicences` to only perform one iteration by combining the mapping and the keying in one go, we do the same for `_preGenerateBillingInvoices`
@StuAA78 StuAA78 merged commit 9d3f393 into main May 15, 2023
@StuAA78 StuAA78 deleted the process-billing-batch-pre-generate-invoice-licences branch May 15, 2023 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
housekeeping Refactoring, tidying up or other work which supports the project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants