Skip to content

Commit

Permalink
Add: Workflow call when approving a charge version
Browse files Browse the repository at this point in the history
  • Loading branch information
Beckyrose200 committed Dec 2, 2024
1 parent ebd1e1e commit 82238b7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ const { serviceRequest } = require('@envage/water-abstraction-helpers')
* Posts to system repo to flag new charge versions for SROC supplementary billing
* @return {Promise}
*/
const chargeVersionFlagSupplementaryBilling = (chargeVersionId, workflowId) => {
const chargeVersionFlagSupplementaryBilling = (chargeVersionId) => {
const url = `${config.services.system}/licences/supplementary`
const options = {
body: {
chargeVersionId,
workflowId
chargeVersionId
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ const bluebird = require('bluebird')

// Services
const service = require('../../../lib/services/service')
const system = require('../../../lib/connectors/system/charge-version-supplementary-billing.js')
const systemChargeVersionConnector = require('../../../lib/connectors/system/charge-version-supplementary-billing.js')
const systemWorkflowConnector = require('../../../lib/connectors/system/workflow-supplementary-billing.js')

const documentsService = require('../../../lib/services/documents-service')
const chargeVersionService = require('../../../lib/services/charge-versions')

Expand Down Expand Up @@ -233,7 +235,8 @@ const approve = async (chargeVersionWorkflow, approvedBy) => {
// 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 supplementary billing based on the new charge version and how long the licence was in
// workflow
await system.chargeVersionFlagSupplementaryBilling(persistedChargeVersion.id, chargeVersionWorkflow.id)
await systemChargeVersionConnector.chargeVersionFlagSupplementaryBilling(persistedChargeVersion.id)
await systemWorkflowConnector.workflowFlagSupplementaryBilling(chargeVersionWorkflow.id)
} catch (error) {
logger.error('Flag supplementary request to system failed', error.stack)
}
Expand Down

0 comments on commit 82238b7

Please sign in to comment.