Merge pull request #1029 from josepfo/feat/twilio-api-data-ui
Feat: twilio api data UI
This commit is contained in:
commit
201fec33e4
11 changed files with 316 additions and 86 deletions
|
|
@ -121,7 +121,8 @@ async function updateCustomer (id, data, userToken) {
|
|||
'us_ssn_override',
|
||||
'sanctions_override',
|
||||
'front_camera_override',
|
||||
'suspended_until'
|
||||
'suspended_until',
|
||||
'phone_override'
|
||||
],
|
||||
_.mapKeys(_.snakeCase, data))
|
||||
|
||||
|
|
@ -169,6 +170,7 @@ function edit (id, data, userToken) {
|
|||
const filteredData = _.pick(defaults, _.mapKeys(_.snakeCase, _.omitBy(_.isNil, data)))
|
||||
if (_.isEmpty(filteredData)) return getCustomerById(id)
|
||||
const formattedData = enhanceEditedPhotos(enhanceEditedFields(filteredData, userToken))
|
||||
|
||||
const defaultDbData = {
|
||||
customer_id: id,
|
||||
created: new Date(),
|
||||
|
|
@ -688,18 +690,18 @@ function getCustomersList (phone = null, name = null, address = null, id = null)
|
|||
function getCustomerById (id) {
|
||||
const passableErrorCodes = _.map(Pgp.as.text, TX_PASSTHROUGH_ERROR_CODES).join(',')
|
||||
const sql = `SELECT id, authorized_override, days_suspended, is_suspended, front_camera_path, front_camera_at, front_camera_override,
|
||||
phone, sms_override, id_card_data_at, id_card_data, id_card_data_override, id_card_data_expiration,
|
||||
phone, phone_at, phone_override, sms_override, id_card_data_at, id_card_data, id_card_data_override, id_card_data_expiration,
|
||||
id_card_photo_path, id_card_photo_at, id_card_photo_override, us_ssn_at, us_ssn, us_ssn_override, sanctions, sanctions_at,
|
||||
sanctions_override, total_txs, total_spent, LEAST(created, last_transaction) AS last_active, fiat AS last_tx_fiat,
|
||||
fiat_code AS last_tx_fiat_code, tx_class AS last_tx_class, subscriber_info, custom_fields, notes, is_test_customer
|
||||
fiat_code AS last_tx_fiat_code, tx_class AS last_tx_class, subscriber_info, subscriber_info_at, custom_fields, notes, is_test_customer
|
||||
FROM (
|
||||
SELECT c.id, c.authorized_override,
|
||||
greatest(0, date_part('day', c.suspended_until - now())) AS days_suspended,
|
||||
c.suspended_until > now() AS is_suspended,
|
||||
c.front_camera_path, c.front_camera_override, c.front_camera_at,
|
||||
c.phone, c.sms_override, c.id_card_data, c.id_card_data_at, c.id_card_data_override, c.id_card_data_expiration,
|
||||
c.phone, c.phone_at, c.phone_override, c.sms_override, c.id_card_data, c.id_card_data_at, c.id_card_data_override, c.id_card_data_expiration,
|
||||
c.id_card_photo_path, c.id_card_photo_at, c.id_card_photo_override, c.us_ssn, c.us_ssn_at, c.us_ssn_override, c.sanctions,
|
||||
c.sanctions_at, c.sanctions_override, c.subscriber_info, c.is_test_customer, c.created, t.tx_class, t.fiat, t.fiat_code, t.created as last_transaction, cn.notes,
|
||||
c.sanctions_at, c.sanctions_override, c.subscriber_info, c.subscriber_info_at, c.is_test_customer, c.created, t.tx_class, t.fiat, t.fiat_code, t.created as last_transaction, cn.notes,
|
||||
row_number() OVER (PARTITION BY c.id ORDER BY t.created DESC) AS rn,
|
||||
sum(CASE WHEN t.id IS NOT NULL THEN 1 ELSE 0 END) OVER (PARTITION BY c.id) AS total_txs,
|
||||
sum(CASE WHEN error_code IS NULL OR error_code NOT IN ($1^) THEN t.fiat ELSE 0 END) OVER (PARTITION BY c.id) AS total_spent, ccf.custom_fields
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ const typeDef = gql`
|
|||
lastTxClass: String
|
||||
transactions: [Transaction]
|
||||
subscriberInfo: JSONObject
|
||||
phoneOverride: String
|
||||
customFields: [CustomerCustomField]
|
||||
customInfoRequests: [CustomRequestData]
|
||||
notes: [CustomerNote]
|
||||
|
|
@ -63,12 +64,14 @@ const typeDef = gql`
|
|||
lastTxClass: String
|
||||
suspendedUntil: Date
|
||||
subscriberInfo: Boolean
|
||||
phoneOverride: String
|
||||
}
|
||||
|
||||
input CustomerEdit {
|
||||
idCardData: JSONObject
|
||||
idCardPhoto: UploadGQL
|
||||
usSsn: String
|
||||
subscriberInfo: JSONObject
|
||||
}
|
||||
|
||||
type CustomerNote {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ const _ = require('lodash/fp')
|
|||
const BN = require('../../../bn')
|
||||
const E = require('../../../error')
|
||||
const { utils: coinUtils } = require('lamassu-coins')
|
||||
const consoleLogLevel = require('console-log-level')
|
||||
|
||||
const NAME = 'FakeWallet'
|
||||
const BATCHABLE_COINS = ['BTC']
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue