feat: implement sumsub API module
feat: add 3rd party services splash screen feat: add sumsub as a configurable 3rd party service feat: sumsub config loader fix: small fixes feat: add external validation as a compliance trigger feat: add external validation route in l-s feat: add external validation graphql module feat: integrate sumsub SDK feat: improve sumsub form to allow adding multiple applicant levels with enhanced UX feat: added support for array fields in FormRenderer feat: allow external validation triggers to dynamically use levels setup in the services page fix: multiple small fixes feat: get external compliance customer info fix: small fixes feat: add informational card in customer profile regarding external service info feat: send external customer data for machine trigger verification feat: restrictions to the creation of custom info requests and external validation triggers fix: allow for a single applicant level to be setup fix: account instance access fix: small fixes fix: development-only log
This commit is contained in:
parent
6c8ced3c1f
commit
6ba0632067
31 changed files with 1730 additions and 67 deletions
41
lib/plugins/compliance/sumsub/request.js
Normal file
41
lib/plugins/compliance/sumsub/request.js
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
const axios = require('axios')
|
||||
const crypto = require('crypto')
|
||||
const _ = require('lodash/fp')
|
||||
const FormData = require('form-data')
|
||||
const settingsLoader = require('../../../new-settings-loader')
|
||||
|
||||
const ph = require('../../../plugin-helper')
|
||||
|
||||
const axiosConfig = {
|
||||
baseURL: 'https://api.sumsub.com'
|
||||
}
|
||||
|
||||
const axiosInstance = axios.create(axiosConfig)
|
||||
|
||||
const buildSignature = config => {
|
||||
return settingsLoader.loadLatest()
|
||||
.then(({ accounts }) => ph.getAccountInstance(accounts.sumsub, 'sumsub'))
|
||||
.then(({ secretKey, apiToken }) => {
|
||||
const timestamp = Math.floor(Date.now() / 1000)
|
||||
const signature = crypto.createHmac('sha256', secretKey)
|
||||
|
||||
signature.update(`${timestamp}${_.toUpper(config.method)}${config.url}`)
|
||||
if (config.data instanceof FormData) {
|
||||
signature.update(config.data.getBuffer())
|
||||
} else if (config.data) {
|
||||
signature.update(config.data)
|
||||
}
|
||||
|
||||
config.headers['X-App-Token'] = apiToken
|
||||
config.headers['X-App-Access-Sig'] = signature.digest('hex')
|
||||
config.headers['X-App-Access-Ts'] = timestamp
|
||||
|
||||
return config
|
||||
})
|
||||
}
|
||||
|
||||
axiosInstance.interceptors.request.use(buildSignature, Promise.reject)
|
||||
|
||||
const request = config => axiosInstance(config)
|
||||
|
||||
module.exports = request
|
||||
Loading…
Add table
Add a link
Reference in a new issue