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

Fix fetch-charge-versions service #187

Merged
merged 2 commits into from
Apr 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async function _fetch (regionId, billingPeriod) {
])
.innerJoinRelated('licence')
.where('scheme', 'sroc')
.where('includeInSrocSupplementaryBilling', 'yes')
.where('includeInSrocSupplementaryBilling', true)
.where('regionId', regionId)
.where('chargeVersions.status', 'current')
.where('chargeVersions.startDate', '>=', billingPeriod.startDate)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ describe('Fetch Charge Versions service', () => {
// This creates an SROC charge version linked to a licence marked for supplementary billing
const srocChargeVersion = await ChargeVersionHelper.add(
{ changeReasonId: changeReason.changeReasonId },
{ regionId, isWaterUndertaker: true, includeInSrocSupplementaryBilling: 'yes' }
{ regionId, isWaterUndertaker: true, includeInSrocSupplementaryBilling: true }
)

// This creates an SROC charge version linked to a licence marked for supplementary billing
// with a status of 'superseded'
const srocSupersededChargeVersion = await ChargeVersionHelper.add(
{ changeReasonId: changeReason.changeReasonId, status: 'superseded' },
{ regionId, isWaterUndertaker: true, includeInSrocSupplementaryBilling: 'yes' }
{ regionId, isWaterUndertaker: true, includeInSrocSupplementaryBilling: true }
)

// This creates an ALCS (presroc) charge version linked to a licence marked for supplementary billing
Expand Down Expand Up @@ -167,11 +167,11 @@ describe('Fetch Charge Versions service', () => {

const srocSupersededChargeVersion = await ChargeVersionHelper.add(
{ status: 'superseded' },
{ regionId, isWaterUndertaker: true, includeInSrocSupplementaryBilling: 'yes' }
{ regionId, isWaterUndertaker: true, includeInSrocSupplementaryBilling: true }
)
const srocDraftChargeVersion = await ChargeVersionHelper.add(
{ status: 'draft' },
{ regionId, isWaterUndertaker: true, includeInSrocSupplementaryBilling: 'yes' }
{ regionId, isWaterUndertaker: true, includeInSrocSupplementaryBilling: true }
)
testRecords = [srocSupersededChargeVersion, srocDraftChargeVersion]
})
Expand Down Expand Up @@ -217,7 +217,7 @@ describe('Fetch Charge Versions service', () => {
// picked up by a previous bill run
const alcsChargeVersion = await ChargeVersionHelper.add(
{ startDate: new Date(2022, 2, 31) }, // 2022-03-01 - Months are zero indexed :-)
{ includeInSrocSupplementaryBilling: 'yes' }
{ includeInSrocSupplementaryBilling: true }
)
testRecords = [alcsChargeVersion]
})
Expand All @@ -240,7 +240,7 @@ describe('Fetch Charge Versions service', () => {
// next years bill runs
const alcsChargeVersion = await ChargeVersionHelper.add(
{ startDate: new Date(2023, 3, 1) }, // 2023-04-01 - Months are zero indexed :-)
{ includeInSrocSupplementaryBilling: 'yes' }
{ includeInSrocSupplementaryBilling: true }
)
testRecords = [alcsChargeVersion]
})
Expand All @@ -264,7 +264,7 @@ describe('Fetch Charge Versions service', () => {
const otherRegionChargeVersion = await ChargeVersionHelper.add(
{},
{
includeInSrocSupplementaryBilling: 'yes',
includeInSrocSupplementaryBilling: true,
regionId: 'e117b501-e3c1-4337-ad35-21c60ed9ad73'
}
)
Expand All @@ -288,7 +288,7 @@ describe('Fetch Charge Versions service', () => {
const chargeVersion = await ChargeVersionHelper.add(
{},
{
includeInSrocSupplementaryBilling: 'yes',
includeInSrocSupplementaryBilling: true,
regionId
}
)
Expand Down