Merge branch 'release-10.0' into feat/lam-1062/save-unsuccessful-qr-scans
This commit is contained in:
commit
345e869826
339 changed files with 1007 additions and 81794 deletions
|
|
@ -25,6 +25,7 @@ const plugins = require('../plugins')
|
|||
const Tx = require('../tx')
|
||||
const loyalty = require('../loyalty')
|
||||
const logger = require('../logger')
|
||||
const externalCompliance = require('../compliance-external')
|
||||
|
||||
function updateCustomerCustomInfoRequest (customerId, patch) {
|
||||
const promise = _.isNil(patch.data) ?
|
||||
|
|
@ -234,6 +235,28 @@ 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
|
||||
const triggers = configManager.getTriggers(settings.config)
|
||||
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))
|
||||
.then(url => respond(req, res, { url }))
|
||||
}
|
||||
|
||||
function addOrUpdateCustomer (customerData, config, isEmailAuth) {
|
||||
const triggers = configManager.getTriggers(config)
|
||||
const maxDaysThreshold = complianceTriggers.maxDaysThreshold(triggers)
|
||||
|
|
@ -311,6 +334,7 @@ router.patch('/:id/suspend', triggerSuspend)
|
|||
router.patch('/:id/photos/idcarddata', updateIdCardData)
|
||||
router.patch('/:id/:txId/photos/customerphoto', updateTxCustomerPhoto)
|
||||
router.post('/:id/smsreceipt', sendSmsReceipt)
|
||||
router.get('/external', getExternalComplianceLink)
|
||||
router.post('/phone_code', getOrAddCustomerPhone)
|
||||
router.post('/email_code', getOrAddCustomerEmail)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue