Skip to content

Commit

Permalink
Update billing accounts controller
Browse files Browse the repository at this point in the history
This hooks up the service to the controller. The only bit remaining is to update its tests.
  • Loading branch information
Cruikshanks committed Sep 4, 2023
1 parent 65abbc3 commit 55c81f8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion app/controllers/billing-accounts.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

const Boom = require('@hapi/boom')

const ChangeAddressService = require('../services/billing-accounts/change-address.service.js')
const ChangeAddressValidator = require('../validators/change-address.validator.js')

async function changeAddress (request, h) {
Expand All @@ -16,7 +17,16 @@ async function changeAddress (request, h) {
return _formattedValidationError(validatedData.error)
}

return h.response().code(201)
const { address, agentCompany, contact } = validatedData.value

const result = await ChangeAddressService.go(
request.params.invoiceAccountId,
address,
agentCompany,
contact
)

return h.response(result).code(201)
}

/**
Expand Down

0 comments on commit 55c81f8

Please sign in to comment.