Skip to content

Commit

Permalink
Move shared billing services to bill-runs root (#720)
Browse files Browse the repository at this point in the history
https://eaflood.atlassian.net/browse/WATER-4365

As part of looking at re-implementing the SROC annual billing engine in this project our spike (WATER-4348 ) confirmed we'd need to reuse some of the services currently sitting in `app/services/bill-runs/supplementary`

- `CalculateAuthorisedAndBillableDaysService`
- `ConsolidateDateRangesService`
- `DetermineMinimumChargeService`
- `GenerateTransactionsService`

This change moves them to the root of bill runs; `app/services/bill-runs`.
  • Loading branch information
Cruikshanks authored Feb 9, 2024
1 parent edf1c48 commit 7701591
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

const ConsolidateDateRangesService = require('./consolidate-date-ranges.service.js')
const DetermineAbstractionPeriodService = require('../determine-abstraction-periods.service.js')
const DetermineAbstractionPeriodService = require('./determine-abstraction-periods.service.js')

const ONE_DAY_IN_MILLISECONDS = 24 * 60 * 60 * 1000

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @module GenerateTransactionsService
*/

const { generateUUID } = require('../../../lib/general.lib.js')
const { generateUUID } = require('../../lib/general.lib.js')

const CalculateAuthorisedAndBillableDaysServiceService = require('./calculate-authorised-and-billable-days.service.js')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const BillRunModel = require('../../../models/bill-run.model.js')
const BillModel = require('../../../models/bill.model.js')
const BillLicenceModel = require('../../../models/bill-licence.model.js')
const DetermineChargePeriodService = require('../determine-charge-period.service.js')
const DetermineMinimumChargeService = require('./determine-minimum-charge.service.js')
const GenerateTransactionsService = require('./generate-transactions.service.js')
const DetermineMinimumChargeService = require('../determine-minimum-charge.service.js')
const GenerateTransactionsService = require('../generate-transactions.service.js')
const PreGenerateBillingDataService = require('./pre-generate-billing-data.service.js')
const ProcessTransactionsService = require('./process-transactions.service.js')
const SendTransactionsService = require('./send-transactions.service.js')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ const { describe, it, beforeEach } = exports.lab = Lab.script()
const { expect } = Code

// Test helpers
const ChargeReferenceHelper = require('../../../support/helpers/charge-reference.helper.js')
const ChargeElementHelper = require('../../../support/helpers/charge-element.helper.js')
const DatabaseHelper = require('../../../support/helpers/database.helper.js')
const ChargeReferenceHelper = require('../../support/helpers/charge-reference.helper.js')
const ChargeElementHelper = require('../../support/helpers/charge-element.helper.js')
const DatabaseHelper = require('../../support/helpers/database.helper.js')

// Thing under test
const CalculateAuthorisedAndBillableDaysService = require('../../../../app/services/bill-runs/supplementary/calculate-authorised-and-billable-days.service.js')
const CalculateAuthorisedAndBillableDaysService = require('../../../app/services/bill-runs/calculate-authorised-and-billable-days.service.js')

// NOTE: You might find it helpful to refresh your understanding of abstraction periods and what the service is trying
// to fathom when referencing them to the billing and charge periods. See the documentation in the service. Also, a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const { describe, it } = exports.lab = Lab.script()
const { expect } = Code

// Thing under test
const ConsolidateDateRangesService = require('../../../../app/services/bill-runs/supplementary/consolidate-date-ranges.service')
const ConsolidateDateRangesService = require('../../../app/services/bill-runs/consolidate-date-ranges.service')

describe('ConsolidateDateRanges service', () => {
describe('when the provided ranges are non-overlapping', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ const { describe, it, beforeEach } = exports.lab = Lab.script()
const { expect } = Code

// Test helpers
const ChangeReasonHelper = require('../../../support/helpers/change-reason.helper.js')
const ChargeVersionHelper = require('../../../support/helpers/charge-version.helper.js')
const DatabaseHelper = require('../../../support/helpers/database.helper.js')
const ChangeReasonHelper = require('../../support/helpers/change-reason.helper.js')
const ChargeVersionHelper = require('../../support/helpers/charge-version.helper.js')
const DatabaseHelper = require('../../support/helpers/database.helper.js')

// Thing under test
const DetermineMinimumChargeService = require('../../../../app/services/bill-runs/supplementary/determine-minimum-charge.service.js')
const DetermineMinimumChargeService = require('../../../app/services/bill-runs/determine-minimum-charge.service.js')

describe('Determine Minimum Charge service', () => {
const chargePeriod = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ const { describe, it, beforeEach, afterEach } = exports.lab = Lab.script()
const { expect } = Code

// Test helpers
const ChargeCategoryHelper = require('../../../support/helpers/charge-category.helper.js')
const ChargeElementHelper = require('../../../support/helpers/charge-element.helper.js')
const ChargeReferenceHelper = require('../../../support/helpers/charge-reference.helper.js')
const DatabaseHelper = require('../../../support/helpers/database.helper.js')
const ChargeCategoryHelper = require('../../support/helpers/charge-category.helper.js')
const ChargeElementHelper = require('../../support/helpers/charge-element.helper.js')
const ChargeReferenceHelper = require('../../support/helpers/charge-reference.helper.js')
const DatabaseHelper = require('../../support/helpers/database.helper.js')

// Things we need to stub
const CalculateAuthorisedAndBillableDaysService = require('../../../../app/services/bill-runs/supplementary/calculate-authorised-and-billable-days.service.js')
const CalculateAuthorisedAndBillableDaysService = require('../../../app/services/bill-runs/calculate-authorised-and-billable-days.service.js')

// Thing under test
const GenerateTransactionsService = require('../../../../app/services/bill-runs/supplementary/generate-transactions.service.js')
const GenerateTransactionsService = require('../../../app/services/bill-runs/generate-transactions.service.js')

describe('Generate Transactions service', () => {
const reference = '4.4.5'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const RegionHelper = require('../../../support/helpers/region.helper.js')

// Things we need to stub
const ChargingModuleGenerateService = require('../../../../app/services/charging-module/generate-bill-run.service.js')
const GenerateTransactionsService = require('../../../../app/services/bill-runs/supplementary/generate-transactions.service.js')
const GenerateTransactionsService = require('../../../../app/services/bill-runs/generate-transactions.service.js')
const SendTransactionsService = require('../../../../app/services/bill-runs/supplementary/send-transactions.service.js')

// Thing under test
Expand Down

0 comments on commit 7701591

Please sign in to comment.