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

Add new two-part tariff generate bill run endpoint #1123

Merged
merged 6 commits into from
Jun 20, 2024

Conversation

Cruikshanks
Copy link
Member

@Cruikshanks Cruikshanks commented Jun 19, 2024

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

Part of the work for two-part tariff annual billing

We're ready to generate a bill run from our two-part tariff review data and with Add Continue bill run btn to 2PT review screen we have the means to trigger it.

Next, we need the endpoint that the button will hit. This change adds the endpoint (route and controller) plus a 'shell' GenerateBillRunService we can start to develop in subsequent changes.

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

> Part of the work for two-part tariff annual billing

We're ready to generate a bill run from our two-part tariff review data and with [Add Continue bill run btn to 2PT review screen](#1122) we have the means to trigger it.

Next we need the endpoint that button will hit. This change adds the endpoint (route and controller) plus a 'shell' `GenerateBillRunService` we can start to develop in subsequent PR's.
@Cruikshanks Cruikshanks added the enhancement New feature or request label Jun 19, 2024
@Cruikshanks Cruikshanks self-assigned this Jun 19, 2024
@Cruikshanks Cruikshanks marked this pull request as ready for review June 19, 2024 15:02
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 added a commit that referenced this pull request Jun 20, 2024
https://eaflood.atlassian.net/browse/WATER-4196

> Part of the work for two-part tariff annual billing

We're ready to generate a bill run from our two-part tariff review data and with [Add Continue bill run btn to 2PT review screen](#1122) and [Add new two-part tariff generate bill run endpoint](#1123) we have the means to trigger it.

We're following the pattern used in SROC annual billing of fetching the data needed by billing account. A bill run is made up of 'bills', one for each billing account. We learnt during the building of the SROC annual engine that having the root record as the billing account vastly simplified the process (we will complete our refactor of SROC supplementary one day!)

So, this change adds the `FetchBillingAccountsService` for two-part tariff bill runs. It goes without saying it is a bit of a beast! We are not just having to retrieve charge version, reference and element records but their equivalents in the review dataset.

It results in a massive Objection.js query. The good news is there is little complexity. It is a straight up data retrieval service.

Still a lot of code though! 😳😬
@Cruikshanks Cruikshanks merged commit 7825e61 into main Jun 20, 2024
6 checks passed
@Cruikshanks Cruikshanks deleted the add-new-two-part-tariff-endpoint branch June 20, 2024 13:23
Cruikshanks added a commit that referenced this pull request Jul 8, 2024
https://eaflood.atlassian.net/browse/WATER-4196

> Part of the work for two-part tariff annual billing

We're ready to generate a bill run from our two-part tariff review data and with [Add Continue bill run btn to 2PT review screen](#1122) and [Add new two-part tariff generate bill run endpoint](#1123) we have the means to trigger it.

We're following the pattern used in SROC annual billing of fetching the data needed by billing account. A bill run is made up of 'bills', one for each billing account. We learned during the building of the SROC annual engine that having the root record as the billing account vastly simplified the process (we will complete our refactor of SROC supplementary one day!)

So, this change adds the `FetchBillingAccountsService` for two-part tariff bill runs. It goes without saying it is a bit of a beast! We are not just having to retrieve charge version, reference and element records, but their equivalents in the review dataset.

It results in a massive [Objection.js](https://vincit.github.io/objection.js/) query. The good news is that there is little complexity. It is a straight-up data retrieval service.

Still a lot of code though! 😳😬
Cruikshanks added a commit that referenced this pull request Jul 8, 2024
https://eaflood.atlassian.net/browse/WATER-4196

> Part of the work for two-part tariff annual billing

We're ready to generate a bill run from our two-part tariff review data and with [Add Continue bill run btn to 2PT review screen](#1122) and [Add new two-part tariff generate bill run endpoint](#1123) we have the means to trigger it. We can now also [Fetch all the billing accounts and related data](#1129) needed to generate the bills.

This implements the remaining services needed to transform that data into actual bills using the same pattern we implemented for SROC annual billing.

- a service to manage the process - `GenerateBillRunService`
- a service to transform the data into bills `ProcessBillingPeriodService`
- a mirror of `GenerateTransactionService` amended specifically for two-part tariff bill runs (because of the need to incorporate values from the review stage)

With this in place users will finally be able to generate an annual two-part tariff SROC bill run!
Cruikshanks added a commit that referenced this pull request Jul 9, 2024
https://eaflood.atlassian.net/browse/WATER-4196

> Part of the work for two-part tariff annual billing

We're ready to generate a bill run from our two-part tariff review data and with [Add Continue bill run btn to 2PT review screen](#1122) and [Add new two-part tariff generate bill run endpoint](#1123) we have the means to trigger it. We can now also [Fetch all the billing accounts and related data](#1129) needed to generate the bills.

This implements the remaining services needed to transform that data into actual bills using the same pattern we implemented for SROC annual billing.

- a service to manage the process - `GenerateBillRunService`
- a service to transform the data into bills `ProcessBillingPeriodService`
- a mirror of `GenerateTransactionService` amended specifically for two-part tariff bill runs (because of the need to incorporate values from the review stage)

With this in place, users will finally be able to generate an annual two-part tariff SROC bill run!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants