chore: remove ekata feature
This commit is contained in:
parent
8b3f93d8f0
commit
c593b60a4e
12 changed files with 8 additions and 184 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue