feat: notifications and flow fixes
This commit is contained in:
parent
423cfd4bbb
commit
8f8e95c292
9 changed files with 103 additions and 26 deletions
|
|
@ -238,6 +238,7 @@ function sendSmsReceipt (req, res, next) {
|
|||
function getExternalComplianceLink (req, res, next) {
|
||||
const customerId = req.query.customer
|
||||
const triggerId = req.query.trigger
|
||||
const isRetry = req.query.isRetry
|
||||
if (_.isNil(customerId) || _.isNil(triggerId)) return next(httpError('Not Found', 404))
|
||||
|
||||
const settings = req.settings
|
||||
|
|
@ -245,6 +246,11 @@ function getExternalComplianceLink (req, res, next) {
|
|||
const trigger = _.find(it => it.id === triggerId)(triggers)
|
||||
const externalService = trigger.externalService
|
||||
|
||||
if (isRetry) {
|
||||
return externalCompliance.createLink(settings, externalService, customerId)
|
||||
.then(url => respond(req, res, { url }))
|
||||
}
|
||||
|
||||
return externalCompliance.createApplicant(settings, externalService, customerId)
|
||||
.then(applicant => customers.addExternalCompliance(customerId, externalService, applicant.id))
|
||||
.then(() => externalCompliance.createLink(settings, externalService, customerId))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue