fix: change sumsub usage away from self-hosted solutions
This commit is contained in:
parent
6ba0632067
commit
b06927fd1c
7 changed files with 15 additions and 17 deletions
|
|
@ -40,16 +40,16 @@ const getApplicant = (settings, customer) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const createApplicantAccessToken = (settings, customerId, triggerId) => {
|
const createApplicantExternalLink = (settings, customerId, triggerId) => {
|
||||||
const triggers = configManager.getTriggers(settings.config)
|
const triggers = configManager.getTriggers(settings.config)
|
||||||
const trigger = _.find(it => it.id === triggerId)(triggers)
|
const trigger = _.find(it => it.id === triggerId)(triggers)
|
||||||
const { plugin } = getPlugin(settings)
|
const { plugin } = getPlugin(settings)
|
||||||
return plugin.createApplicantAccessToken({ levelName: trigger.externalServiceApplicantLevel, userId: customerId })
|
return plugin.createApplicantExternalLink({ levelName: trigger.externalServiceApplicantLevel, userId: customerId })
|
||||||
.then(r => r.data.token)
|
.then(r => r.data.url)
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
createApplicant,
|
createApplicant,
|
||||||
getApplicant,
|
getApplicant,
|
||||||
createApplicantAccessToken
|
createApplicantExternalLink
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,7 @@ type CustomInput {
|
||||||
constraintType: String!
|
constraintType: String!
|
||||||
label1: String
|
label1: String
|
||||||
label2: String
|
label2: String
|
||||||
|
label3: String
|
||||||
choiceList: [String]
|
choiceList: [String]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@ const { loadLatest } = require('../../../new-settings-loader')
|
||||||
|
|
||||||
const resolvers = {
|
const resolvers = {
|
||||||
Query: {
|
Query: {
|
||||||
getApplicantAccessToken: (...[, { customerId, triggerId }]) => loadLatest()
|
getApplicantExternalLink: (...[, { customerId, triggerId }]) => loadLatest()
|
||||||
.then(settings => externalCompliance.createApplicantAccessToken(settings, customerId, triggerId))
|
.then(settings => externalCompliance.createApplicantExternalLink(settings, customerId, triggerId))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ const { gql } = require('apollo-server-express')
|
||||||
|
|
||||||
const typeDef = gql`
|
const typeDef = gql`
|
||||||
type Query {
|
type Query {
|
||||||
getApplicantAccessToken(customerId: ID, triggerId: ID): String
|
getApplicantExternalLink(customerId: ID, triggerId: ID): String
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ const getMissingRequiredFields = (fields, obj) =>
|
||||||
fields
|
fields
|
||||||
)
|
)
|
||||||
|
|
||||||
const createApplicantAccessToken = opts => {
|
const createApplicantExternalLink = opts => {
|
||||||
const REQUIRED_FIELDS = ['userId', 'levelName']
|
const REQUIRED_FIELDS = ['userId', 'levelName']
|
||||||
|
|
||||||
if (_.isEmpty(opts) || !hasRequiredFields(REQUIRED_FIELDS, opts)) {
|
if (_.isEmpty(opts) || !hasRequiredFields(REQUIRED_FIELDS, opts)) {
|
||||||
|
|
@ -26,8 +26,9 @@ const createApplicantAccessToken = opts => {
|
||||||
|
|
||||||
return request({
|
return request({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: `/resources/accessTokens?userId=${opts.userId}&levelName=${opts.levelName}`,
|
url: `/resources/sdkIntegrations/levels/${opts.levelName}/websdkLink?ttlInSecs=${600}&externalUserId=${opts.userId}`,
|
||||||
headers: {
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -434,7 +435,7 @@ const getApiHealth = () => {
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
CODE,
|
CODE,
|
||||||
createApplicantAccessToken,
|
createApplicantExternalLink,
|
||||||
createApplicant,
|
createApplicant,
|
||||||
getApplicant,
|
getApplicant,
|
||||||
addIdDocument,
|
addIdDocument,
|
||||||
|
|
|
||||||
|
|
@ -244,9 +244,8 @@ function getExternalComplianceLink (req, res, next) {
|
||||||
const triggers = configManager.getTriggers(settings.config)
|
const triggers = configManager.getTriggers(settings.config)
|
||||||
const trigger = _.find(it => it.id === triggerId)(triggers)
|
const trigger = _.find(it => it.id === triggerId)(triggers)
|
||||||
|
|
||||||
return externalCompliance.createApplicantAccessToken(settings, customerId, trigger.id)
|
return externalCompliance.createApplicantExternalLink(settings, customerId, trigger.id)
|
||||||
.then(token => {
|
.then(url => {
|
||||||
const url = `https://${process.env.NODE_ENV === 'production' ? `${process.env.HOSTNAME}` : `localhost:3001` }/${trigger.externalService}?customer=${customerId}&trigger=${trigger.id}&t=${token}`
|
|
||||||
process.env.NODE_ENV === 'development' && console.log(url)
|
process.env.NODE_ENV === 'development' && console.log(url)
|
||||||
return respond(req, res, { url: url })
|
return respond(req, res, { url: url })
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ import Login from 'src/pages/Authentication/Login'
|
||||||
import Register from 'src/pages/Authentication/Register'
|
import Register from 'src/pages/Authentication/Register'
|
||||||
import Reset2FA from 'src/pages/Authentication/Reset2FA'
|
import Reset2FA from 'src/pages/Authentication/Reset2FA'
|
||||||
import ResetPassword from 'src/pages/Authentication/ResetPassword'
|
import ResetPassword from 'src/pages/Authentication/ResetPassword'
|
||||||
import Sumsub from 'src/pages/Compliance/Sumsub'
|
|
||||||
import Dashboard from 'src/pages/Dashboard'
|
import Dashboard from 'src/pages/Dashboard'
|
||||||
import Machines from 'src/pages/Machines'
|
import Machines from 'src/pages/Machines'
|
||||||
import Wizard from 'src/pages/Wizard'
|
import Wizard from 'src/pages/Wizard'
|
||||||
|
|
@ -92,8 +91,7 @@ const Routes = () => {
|
||||||
'/login',
|
'/login',
|
||||||
'/register',
|
'/register',
|
||||||
'/resetpassword',
|
'/resetpassword',
|
||||||
'/reset2fa',
|
'/reset2fa'
|
||||||
'/sumsub'
|
|
||||||
]
|
]
|
||||||
|
|
||||||
if (!wizardTested && !R.contains(location.pathname)(dontTriggerPages)) {
|
if (!wizardTested && !R.contains(location.pathname)(dontTriggerPages)) {
|
||||||
|
|
@ -144,7 +142,6 @@ const Routes = () => {
|
||||||
</PrivateRoute>
|
</PrivateRoute>
|
||||||
<PrivateRoute path="/machines" component={Machines} />
|
<PrivateRoute path="/machines" component={Machines} />
|
||||||
<PrivateRoute path="/wizard" component={Wizard} />
|
<PrivateRoute path="/wizard" component={Wizard} />
|
||||||
<PublicRoute path="/sumsub" component={Sumsub} />
|
|
||||||
<PublicRoute path="/register" component={Register} />
|
<PublicRoute path="/register" component={Register} />
|
||||||
{/* <PublicRoute path="/configmigration" component={ConfigMigration} /> */}
|
{/* <PublicRoute path="/configmigration" component={ConfigMigration} /> */}
|
||||||
<PublicRoute path="/login" restricted component={Login} />
|
<PublicRoute path="/login" restricted component={Login} />
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue