Skip to content

Commit d5086b4

Browse files
authored
Charge periods shown on bills in supplementary billing show all year (#492)
https://eaflood.atlassian.net/browse/WATER-4179 It has been reported by a customer that the charge period shown on a recent supplementary bill they received showed the whole financial year as a charge period, rather than the dates related to the charge versions and financial years. The data passed to the charge module for supplementary appears to be using the financial year dates in all circumstances, when it should be using the charge period dates as shown on the transaction screen. This PR will fix that issue by passing the correct dates to the CM.
1 parent ed2f3d7 commit d5086b4

File tree

4 files changed

+9
-14
lines changed

4 files changed

+9
-14
lines changed

app/presenters/charging-module/create-transaction.presenter.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ const { formatChargingModuleDate } = require('../base.presenter.js')
1212
*
1313
* @returns {Object} an object to be used as the body in a Charging Module POST transaction request
1414
*/
15-
function go (transaction, billingPeriod, invoiceAccountNumber, licence) {
16-
const periodStart = formatChargingModuleDate(billingPeriod.startDate)
17-
const periodEnd = formatChargingModuleDate(billingPeriod.endDate)
15+
function go (transaction, invoiceAccountNumber, licence) {
16+
const periodStart = formatChargingModuleDate(transaction.startDate)
17+
const periodEnd = formatChargingModuleDate(transaction.endDate)
1818

1919
return {
2020
clientId: transaction.billingTransactionId,

app/services/billing/supplementary/process-billing-period.service.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ async function _buildDataToPersist (billingData, billingPeriod, billRunExternalI
6666
currentBillingData.bill,
6767
currentBillingData.billLicence,
6868
billRunExternalId,
69-
cleansedTransactions,
70-
billingPeriod
69+
cleansedTransactions
7170
)
7271

7372
dataToPersist.transactions.push(...transactions)

app/services/billing/supplementary/send-transactions.service.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,13 @@ const ChargingModuleCreateTransactionPresenter = require('../../../presenters/ch
2424
*
2525
* @returns {Object[]} Array of transactions which have been sent to the Charging Module
2626
*/
27-
async function go (licence, bill, billLicence, billRunExternalId, transactions, billingPeriod) {
27+
async function go (licence, bill, billLicence, billRunExternalId, transactions) {
2828
try {
2929
const sentTransactions = []
3030

3131
for (const transaction of transactions) {
3232
const chargingModuleResponse = await _sendTransactionToChargingModule(
3333
transaction,
34-
billingPeriod,
3534
bill,
3635
licence,
3736
billRunExternalId
@@ -48,10 +47,9 @@ async function go (licence, bill, billLicence, billRunExternalId, transactions,
4847
}
4948
}
5049

51-
async function _sendTransactionToChargingModule (transaction, billingPeriod, bill, licence, billRunExternalId) {
50+
async function _sendTransactionToChargingModule (transaction, bill, licence, billRunExternalId) {
5251
const chargingModuleRequest = ChargingModuleCreateTransactionPresenter.go(
5352
transaction,
54-
billingPeriod,
5553
bill.invoiceAccountNumber,
5654
licence
5755
)

test/presenters/charging-module/create-transaction.presenter.test.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ const TransactionHelper = require('../../support/helpers/water/transaction.helpe
1919
const CreateTransactionPresenter = require('../../../app/presenters/charging-module/create-transaction.presenter.js')
2020

2121
describe('Charging Module Create Transaction presenter', () => {
22-
const billingPeriod = {
23-
startDate: new Date('2022-04-01'),
24-
endDate: new Date('2023-03-31')
25-
}
2622
const invoiceAccountNumber = 'A51542397A'
2723

2824
let transaction
@@ -69,10 +65,12 @@ describe('Charging Module Create Transaction presenter', () => {
6965
transaction.chargeCategoryCode = '4.5.6'
7066
transaction.section127Agreement = false
7167
transaction.section130Agreement = false
68+
transaction.startDate = new Date('2022-04-01')
69+
transaction.endDate = new Date('2023-03-31')
7270
})
7371

7472
it('correctly presents the data', () => {
75-
const result = CreateTransactionPresenter.go(transaction, billingPeriod, invoiceAccountNumber, licence)
73+
const result = CreateTransactionPresenter.go(transaction, invoiceAccountNumber, licence)
7674

7775
expect(result.clientId).to.equal(transaction.billingTransactionId)
7876
expect(result.ruleset).to.equal('sroc')

0 commit comments

Comments
 (0)