SROC Supplementary flag not cleared for 'non-chargeable' licence #266
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 aninvoice_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_id
s are then extracted from the results of this query before finally stripping out the charge versions that have noinvoice_account_id
.