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 fetch bill licence service #501

Merged
merged 6 commits into from
Nov 6, 2023

Conversation

Cruikshanks
Copy link
Member

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

Related to WATER-4155 and the work to replace the legacy bill page with our own we're now starting to build the page it will link to; a view of the bill licence and all its transactions.

This adds a service that will get the data needed for the page. Mainly that is the transaction detail but also information about the bill and licence needed for context on the page.

One thing to note is the service makes no distinction between SROC and PRESROC. However, some linked entities and fields are only used when a transaction is one or the other.

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

Related to WATER-4155 and the work to replace the legacy bill page with our own we're now starting to build the page it will link to; a view of the bill licence and all its transactions.

This adds a service that will get the data need for the page. Mainly that is the transaction detail but also information about the bill and licence needed for context in the page.

One thing to note is the service makes no distinction between SROC and PRESROC. But some linked entities and fields are only used when a transaction is one or the other.
@Cruikshanks Cruikshanks added the enhancement New feature or request label Nov 6, 2023
@Cruikshanks Cruikshanks self-assigned this Nov 6, 2023
It is expected that tests will fail as their is a model change we need to do first.
Cruikshanks added a commit that referenced this pull request Nov 6, 2023
https://eaflood.atlassian.net/browse/WATER-4156

Related to WATER-4155 and the work to replace the legacy bill page with our own we're now starting to build the page it will link to; a view of the bill licence and all its transactions.

We are adding a [new fetch bill licence service](#501) that will return data for both SROC and PRESROC transactions. Unfortunately, the previous team chose to store data related to the transactions differently. This means depending on what scheme a transaction is linked to you need to pull information from different places.

To support this we need to make a tweak to our `ChargeReferenceModel`. Under SROC a charge reference has multiple charge elements which in turn have multiple charge purposes. These purposes then link to a `PurposeModel`.

Under PRESROC the charge reference is _actually_ a charge element (hence the table name is `charge_elements`) and directly links to a `PurposeModel`.

So, this change updates the ChargeReferenceModel so that it _can_ pull through the linked purpose should one exist.
@Cruikshanks
Copy link
Member Author

Need #502 merged before this can be merged.

Cruikshanks added a commit that referenced this pull request Nov 6, 2023
https://eaflood.atlassian.net/browse/WATER-4156

Related to WATER-4155 and the work to replace the legacy bill page with our own we're now starting to build the page it will link to; a view of the bill licence and all its transactions.

We are adding a [new fetch bill licence service](#501) that will return data for both SROC and PRESROC transactions. Unfortunately, the previous team chose to store data related to the transactions differently. This means depending on what scheme a transaction is linked to you need to pull information from different places.

To support this we need to make a tweak to our `ChargeReferenceModel`. Under SROC a charge reference has multiple charge elements which in turn have multiple charge purposes. These purposes then link to a `PurposeModel`.

Under PRESROC the charge reference is _actually_ a charge element (hence the table name is `charge_elements`) and directly links to a `PurposeModel`.

So, this change updates the ChargeReferenceModel so that it _can_ pull through the linked purpose should one exist.

We also update the `PurposeModel` with the new relationship. Note, whilst doing this we spotted that the existing relationship to charge elements was wrong. It should be a `HasManyRelation` so we also use this opportunity to fix it.
@Cruikshanks
Copy link
Member Author

SonarCloud is complaining about duplication I think (because it won't show where it thinks the duplication is!) with app/services/billing/supplementary/fetch-previous-transactions.service.js.

I'm fine with this as they are doing 2 separate things, and the duplication is with the query and not code (as such). We would overcomplicate things and/or impact performance by trying to write one query that would cover both scenarios just to make SonarCloud happy. Unfortunately, there isn't a way for me to tell SonarCloud to go away on this one 😁

@Cruikshanks Cruikshanks marked this pull request as ready for review November 6, 2023 16:43
@Cruikshanks Cruikshanks merged commit c45f608 into main Nov 6, 2023
5 of 6 checks passed
@Cruikshanks Cruikshanks deleted the add-new-fetch-bill-licence-service branch November 6, 2023 20:51
Cruikshanks added a commit that referenced this pull request Nov 6, 2023
https://eaflood.atlassian.net/browse/WATER-4156

Related to WATER-4155 and the work to replace the legacy bill page with our own we're now starting to build the page it will link to; a view of the bill licence and all its transactions.

We've already made several other changes to support this. This change adds a new service that orchestrates fetching the information needed ([Add new fetch bill licence service](#501)), passing it through to a presenter ([Add View bill licence presenter](#508)) and returning the result.
Cruikshanks added a commit that referenced this pull request Nov 6, 2023
https://eaflood.atlassian.net/browse/WATER-4156

Related to WATER-4155 and the work to replace the legacy bill page with our own we're now starting to build the page it will link to; a view of the bill licence and all its transactions.

We've already made several other changes to support this. This change adds a new service that orchestrates fetching the information needed ([Add new fetch bill licence service](#501)), passing it through to a presenter ([Add View bill licence presenter](#508)) and returning the result.
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