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

SROC Supplementary flag not cleared for 'non-chargeable' licence #266

Merged
merged 6 commits into from
Jun 14, 2023

Conversation

Jozzey
Copy link
Contributor

@Jozzey Jozzey commented Jun 13, 2023

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

It has been found in QA that when a licence has no other SROC charge versions and is made 'non-chargeable', this correctly sets the SROC supplementary billing flag on the licence. However, the problem is that when a bill run that includes this licence is created, the SROC supplementary billing flag is not un-set for it.

This issue is being caused because when a licence is made “non-chargeable” it creates a charge version without any charge elements, but also without an invoice_account_id.

Our fetch-charge-versions service only fetches charge versions which have an invoice_account_id. This in effect means that if a licence only has the “non-chargeable” charge version associated with it. That licence will never be looked at, since the licence ID is extracted from the results of the fetch-charge-versions service. As the licence is never included by the SROC supplementary service the flag is never un-set.

This PR fixes that issue by initially fetching the charge versions with no invoice_account_id, rather than filtering them out in the query as was done previously.

The licence_ids are then extracted from the results of this query before finally stripping out the charge versions that have no invoice_account_id.

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

It has been found in QA that when a licence has no other SROC charge versions and is made 'non-chargeable', this correctly sets the SROC supplementary billing flag on the licence. However, the problem is that when a bill run is created that includes this licence, the SROC supplementary billing flag is not un-set for it.

This issue is being caused because when a licence is made “non-chargeable” it creates a charge version without any charge elements, but also without an `invoice_account_id`.

Our `fetch-charge-versions` service only fetches charge versions which have an `invoice_account_id`. Which in effect means that if a licence only has the “non-chargeable” charge version associated with it. That licence will never be looked at since the licence ID is extracted from the results of the fetch-charge-versions service. As the licence is never looked at by the SROC supplementary service the flag is never un-set.

This PR fixes that issue by initially also fetching the charge versions that have no `invoice_account_id`, rather than filtering them out in the query as was done previously.

The `licence_id`s are then extracted from the results of this query before finally stripping out the charge versions that have no `invoice_account_id`.
@Jozzey Jozzey added the bug Something isn't working label Jun 13, 2023
@Jozzey Jozzey self-assigned this Jun 13, 2023
@Jozzey Jozzey marked this pull request as ready for review June 13, 2023 15:48
Co-authored-by: Alan Cruikshanks <[email protected]>
@Jozzey Jozzey requested a review from Cruikshanks June 14, 2023 08:51
@Jozzey Jozzey merged commit 4341113 into main Jun 14, 2023
@Jozzey Jozzey deleted the supp-flag-not-cleared-for-non-chargeable branch June 14, 2023 09:11
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