Merge pull request #1840 from RafaelTaranto/chore/remove-ekata
LAM-1411 chore: remove ekata
This commit is contained in:
commit
deaf7d6ecc
12 changed files with 8 additions and 184 deletions
|
|
@ -137,12 +137,6 @@ async function updateCustomer (id, data, userToken) {
|
|||
await db.none(sql, [id])
|
||||
}
|
||||
|
||||
if (data.subscriberInfo) {
|
||||
await Promise.all([getCustomerById(id), settingsLoader.loadLatest()])
|
||||
.then(([customer, config]) => sms.getLookup(config, customer.phone))
|
||||
.then(res => updateSubscriberData(id, res, userToken))
|
||||
.catch(logger.error)
|
||||
}
|
||||
invalidateCustomerNotifications(id, formattedData)
|
||||
return getCustomerById(id)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,6 @@ const typeDef = gql`
|
|||
lastTxFiatCode: String
|
||||
lastTxClass: String
|
||||
suspendedUntil: DateTimeISO
|
||||
subscriberInfo: Boolean
|
||||
phoneOverride: String
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,12 +40,7 @@ function sendMessage (account, rec) {
|
|||
})
|
||||
}
|
||||
|
||||
function getLookup () {
|
||||
throw new Error('inforu error: lookup not supported')
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
NAME,
|
||||
sendMessage,
|
||||
getLookup
|
||||
sendMessage
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,17 +2,6 @@ const _ = require('lodash/fp')
|
|||
|
||||
const NAME = 'MockSMS'
|
||||
|
||||
function getLookup (account, number) {
|
||||
console.log('Looking up number: %j', number)
|
||||
return new Promise((resolve, reject) => {
|
||||
if (_.endsWith('666', number)) {
|
||||
reject (new Error(`${exports.NAME} mocked error!`))
|
||||
} else {
|
||||
setTimeout(resolve, 1)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function sendMessage (account, rec) {
|
||||
console.log('Sending SMS: %j', rec)
|
||||
return new Promise((resolve, reject) => {
|
||||
|
|
@ -26,6 +15,5 @@ function sendMessage (account, rec) {
|
|||
|
||||
module.exports = {
|
||||
NAME,
|
||||
sendMessage,
|
||||
getLookup
|
||||
sendMessage
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,13 +15,7 @@ function sendMessage (account, rec) {
|
|||
})
|
||||
}
|
||||
|
||||
function getLookup () {
|
||||
throw new Error('Telnyx error: lookup not supported')
|
||||
}
|
||||
|
||||
|
||||
module.exports = {
|
||||
NAME,
|
||||
sendMessage,
|
||||
getLookup
|
||||
sendMessage
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,33 +37,7 @@ function sendMessage (account, rec) {
|
|||
})
|
||||
}
|
||||
|
||||
function getLookup (account, number) {
|
||||
return Promise.resolve()
|
||||
.then(() => {
|
||||
const client = twilio(account.accountSid, account.authToken)
|
||||
return client.lookups.v1.phoneNumbers(number)
|
||||
.fetch({ addOns: ['lamassu_ekata'] })
|
||||
})
|
||||
.then(info => info.addOns.results['lamassu_ekata'])
|
||||
.then(info => {
|
||||
if (info.status !== 'successful') {
|
||||
throw new Error(`Twilio error: ${info.message}`)
|
||||
}
|
||||
return info
|
||||
})
|
||||
.catch(err => {
|
||||
if (_.includes(err.code, BAD_NUMBER_CODES)) {
|
||||
const badNumberError = new Error(err.message)
|
||||
badNumberError.name = 'BadNumberError'
|
||||
throw badNumberError
|
||||
}
|
||||
|
||||
throw new Error(`Twilio error: ${err.message}`)
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
NAME,
|
||||
sendMessage,
|
||||
getLookup
|
||||
sendMessage
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,12 +20,7 @@ function sendMessage (account, rec) {
|
|||
})
|
||||
}
|
||||
|
||||
function getLookup () {
|
||||
throw new Error('Vonage error: lookup not supported')
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
NAME,
|
||||
sendMessage,
|
||||
getLookup
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,12 +36,7 @@ function sendMessage (account, rec) {
|
|||
})
|
||||
}
|
||||
|
||||
function getLookup () {
|
||||
throw new Error('Whatsapp error: lookup not supported')
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
NAME,
|
||||
sendMessage,
|
||||
getLookup
|
||||
sendMessage
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,13 +37,6 @@ function sendMessage (settings, rec) {
|
|||
})
|
||||
}
|
||||
|
||||
function getLookup (settings, number) {
|
||||
return Promise.resolve()
|
||||
.then(() => {
|
||||
const { plugin, account } = getPlugin(settings)
|
||||
return plugin.getLookup(account, number)
|
||||
})
|
||||
}
|
||||
const toCryptoUnits = (cryptoAtoms, cryptoCode) => {
|
||||
const unitScale = coinUtils.getCryptoCurrency(cryptoCode).unitScale
|
||||
return cryptoAtoms.shiftedBy(-unitScale)
|
||||
|
|
@ -117,7 +110,6 @@ function formatSmsReceipt (data, options) {
|
|||
module.exports = {
|
||||
getSms,
|
||||
sendMessage,
|
||||
getLookup,
|
||||
formatSmsReceipt,
|
||||
toCryptoUnits
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,8 +50,6 @@ const CustomerData = ({
|
|||
updateCustomRequest,
|
||||
authorizeCustomRequest,
|
||||
updateCustomEntry,
|
||||
retrieveAdditionalDataDialog,
|
||||
setRetrieve,
|
||||
checkAgainstSanctions
|
||||
}) => {
|
||||
const [previewPhoto, setPreviewPhoto] = useState(null)
|
||||
|
|
@ -176,7 +174,6 @@ const CustomerData = ({
|
|||
})
|
||||
},
|
||||
validationSchema: smsDataSchema.smsData,
|
||||
retrieveAdditionalData: () => setRetrieve(true),
|
||||
initialValues: initialValues.smsData,
|
||||
isAvailable: !R.isNil(phone),
|
||||
hasAdditionalData: !R.isNil(smsData) && !R.isEmpty(smsData),
|
||||
|
|
@ -440,7 +437,6 @@ const CustomerData = ({
|
|||
save,
|
||||
cancel,
|
||||
deleteEditedData,
|
||||
retrieveAdditionalData,
|
||||
children,
|
||||
validationSchema,
|
||||
initialValues,
|
||||
|
|
@ -468,7 +464,6 @@ const CustomerData = ({
|
|||
save={save}
|
||||
cancel={cancel}
|
||||
deleteEditedData={deleteEditedData}
|
||||
retrieveAdditionalData={retrieveAdditionalData}
|
||||
checkAgainstSanctions={checkAgainstSanctions}
|
||||
editable={editable}>
|
||||
{children}
|
||||
|
|
@ -546,7 +541,6 @@ const CustomerData = ({
|
|||
</div>
|
||||
)}
|
||||
</div>
|
||||
{retrieveAdditionalDataDialog}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,11 @@
|
|||
import IconButton from '@mui/material/IconButton'
|
||||
import SvgIcon from '@mui/material/SvgIcon'
|
||||
import { useQuery, useMutation, useLazyQuery, gql } from '@apollo/client'
|
||||
import Breadcrumbs from '@mui/material/Breadcrumbs'
|
||||
import DialogActions from '@mui/material/DialogActions'
|
||||
import DialogContent from '@mui/material/DialogContent'
|
||||
import Dialog from '@mui/material/Dialog'
|
||||
import Switch from '@mui/material/Switch'
|
||||
import NavigateNextIcon from '@mui/icons-material/NavigateNext'
|
||||
import * as R from 'ramda'
|
||||
import React, { memo, useState } from 'react'
|
||||
import { useHistory, useParams } from 'react-router-dom'
|
||||
import ErrorMessage from 'src/components/ErrorMessage'
|
||||
import { Label1, Label2, H2, Info3 } from 'src/components/typography'
|
||||
import CloseIcon from 'src/styling/icons/action/close/zodiac.svg?react'
|
||||
import { Label1, Label2 } from 'src/components/typography'
|
||||
import AuthorizeReversedIcon from 'src/styling/icons/button/authorize/white.svg?react'
|
||||
import AuthorizeIcon from 'src/styling/icons/button/authorize/zodiac.svg?react'
|
||||
import BlockReversedIcon from 'src/styling/icons/button/block/white.svg?react'
|
||||
|
|
@ -20,7 +13,7 @@ import BlockIcon from 'src/styling/icons/button/block/zodiac.svg?react'
|
|||
import DataReversedIcon from 'src/styling/icons/button/data/white.svg?react'
|
||||
import DataIcon from 'src/styling/icons/button/data/zodiac.svg?react'
|
||||
|
||||
import { Button, ActionButton } from 'src/components/buttons'
|
||||
import { ActionButton } from 'src/components/buttons'
|
||||
import {
|
||||
OVERRIDE_AUTHORIZED,
|
||||
OVERRIDE_REJECTED
|
||||
|
|
@ -147,7 +140,6 @@ const SET_CUSTOMER = gql`
|
|||
lastTxFiat
|
||||
lastTxFiatCode
|
||||
lastTxClass
|
||||
subscriberInfo
|
||||
phoneOverride
|
||||
externalCompliance
|
||||
}
|
||||
|
|
@ -297,7 +289,6 @@ const CHECK_AGAINST_SANCTIONS = gql`
|
|||
const CustomerProfile = memo(() => {
|
||||
const history = useHistory()
|
||||
|
||||
const [retrieve, setRetrieve] = useState(false)
|
||||
const [showCompliance, setShowCompliance] = useState(false)
|
||||
const [wizard, setWizard] = useState(false)
|
||||
const [error, setError] = useState(null)
|
||||
|
|
@ -343,7 +334,6 @@ const CustomerProfile = memo(() => {
|
|||
const [setCustomer] = useMutation(SET_CUSTOMER, {
|
||||
onCompleted: () => {
|
||||
getCustomer()
|
||||
setRetrieve(false)
|
||||
},
|
||||
onError: error => setError(error)
|
||||
})
|
||||
|
|
@ -467,16 +457,6 @@ const CustomerProfile = memo(() => {
|
|||
}
|
||||
})
|
||||
|
||||
const retrieveAdditionalData = () =>
|
||||
setCustomer({
|
||||
variables: {
|
||||
customerId,
|
||||
customerInput: {
|
||||
subscriberInfo: true
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const onClickSidebarItem = code => setClickedItem(code)
|
||||
|
||||
const configData = R.path(['config'])(customerResponse) ?? []
|
||||
|
|
@ -664,21 +644,8 @@ const CustomerProfile = memo(() => {
|
|||
updateCustomRequest={setCustomerCustomInfoRequest}
|
||||
authorizeCustomRequest={authorizeCustomRequest}
|
||||
updateCustomEntry={updateCustomEntry}
|
||||
setRetrieve={setRetrieve}
|
||||
checkAgainstSanctions={checkAgainstSanctions}
|
||||
retrieveAdditionalDataDialog={
|
||||
<RetrieveDataDialog
|
||||
onDismissed={() => {
|
||||
setError(null)
|
||||
setRetrieve(false)
|
||||
}}
|
||||
onConfirmed={() => {
|
||||
setError(null)
|
||||
retrieveAdditionalData()
|
||||
}}
|
||||
error={error}
|
||||
open={retrieve}></RetrieveDataDialog>
|
||||
}></CustomerData>
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
{isNotes && (
|
||||
|
|
@ -715,55 +682,4 @@ const CustomerProfile = memo(() => {
|
|||
)
|
||||
})
|
||||
|
||||
const RetrieveDataDialog = ({
|
||||
onConfirmed,
|
||||
onDismissed,
|
||||
open,
|
||||
error,
|
||||
props
|
||||
}) => {
|
||||
return (
|
||||
<Dialog
|
||||
open={open}
|
||||
aria-labelledby="form-dialog-title"
|
||||
PaperProps={{
|
||||
style: {
|
||||
borderRadius: 8,
|
||||
minWidth: 656,
|
||||
bottom: 125,
|
||||
right: 7
|
||||
}
|
||||
}}
|
||||
{...props}>
|
||||
<div className="pt-4 pr-4 flex justify-end">
|
||||
<IconButton aria-label="close" onClick={() => onDismissed(false)}>
|
||||
<SvgIcon>
|
||||
<CloseIcon />
|
||||
</SvgIcon>
|
||||
</IconButton>
|
||||
</div>
|
||||
<H2 className="mb-2 ml-10">{'Retrieve API data from Twilio'}</H2>
|
||||
<DialogContent className="w-153 ml-4">
|
||||
<Info3>{`With this action you'll be using Twilio's API to retrieve additional
|
||||
data from this user. This includes name and address, if available.\n`}</Info3>
|
||||
<Info3>{` There is a small cost from Twilio for each retrieval. Would you like
|
||||
to proceed?`}</Info3>
|
||||
</DialogContent>
|
||||
{error && (
|
||||
<ErrorMessage className="ml-10">
|
||||
Failed to fetch additional data
|
||||
</ErrorMessage>
|
||||
)}
|
||||
<DialogActions className="p-8 pt-4 gap-2">
|
||||
<Button
|
||||
onClick={() => {
|
||||
onConfirmed()
|
||||
}}>
|
||||
Confirm
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
)
|
||||
}
|
||||
|
||||
export default CustomerProfile
|
||||
|
|
|
|||
|
|
@ -74,8 +74,6 @@ const EditableCard = ({
|
|||
validationSchema,
|
||||
initialValues,
|
||||
deleteEditedData,
|
||||
retrieveAdditionalData,
|
||||
hasAdditionalData = true,
|
||||
editable,
|
||||
checkAgainstSanctions
|
||||
}) => {
|
||||
|
|
@ -168,16 +166,6 @@ const EditableCard = ({
|
|||
<div className="flex justify-end mt-5 gap-2">
|
||||
{!editing && (
|
||||
<>
|
||||
{!hasAdditionalData && (
|
||||
<ActionButton
|
||||
color="primary"
|
||||
type="button"
|
||||
Icon={DataIcon}
|
||||
InverseIcon={DataReversedIcon}
|
||||
onClick={() => retrieveAdditionalData()}>
|
||||
Retrieve API data
|
||||
</ActionButton>
|
||||
)}
|
||||
{checkAgainstSanctions && (
|
||||
<ActionButton
|
||||
color="primary"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue