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

Handle failed request to system supplementary #2611

Merged
merged 3 commits into from
Aug 16, 2024
Merged
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
10 changes: 9 additions & 1 deletion src/lib/services/charge-versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const ChargeVersion = require('../models/charge-version')

const validators = require('../models/validators')

const { logger } = require('../../logger.js')

/**
* Gets charge version by ID
* @param {String} chargeVersionId
Expand Down Expand Up @@ -105,7 +107,13 @@ const persist = async chargeVersion => {
)
persistedChargeVersion.chargeElements = await Promise.all(tasks)

await system.flagSupplementaryBilling(persistedChargeVersion.id)
try {
// Let the water-abstraction-system know a new charge version has been added. It will then determine if the licence
// needs to be flagged for SROC supplementary billing based on the new charge version
await system.flagSupplementaryBilling(persistedChargeVersion.id)
} catch (error) {
logger.error('Flag supplementary request to system failed', error.stack)
}

return persistedChargeVersion
}
Expand Down
Loading