Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
33f6c75
update axios version
lukman-paystack Mar 16, 2021
658264b
migrate CLI framework from vorpal to oclif
lukman-paystack Apr 4, 2021
bae8515
add helper plugins
lukman-paystack Apr 4, 2021
831f3f9
Merge branch 'master' into version/2.0
lukman-paystack Apr 4, 2021
e850084
remove API keys from local DB
lukman-paystack Apr 13, 2021
d474311
Merge branch 'version/2.0' of github.com:PaystackOSS/paystack-cli int…
lukman-paystack Apr 13, 2021
a373a14
add info command
lukman-paystack Oct 27, 2021
c36a7cd
add info command
lukman-paystack Oct 27, 2021
61d52b4
migrate Oclif to V2
lukman-paystack Feb 15, 2022
5d97858
update oclif version
lukman-paystack Feb 23, 2022
d06fb7e
1.0.0-beta.1
lukman-paystack Feb 23, 2022
1b86870
update package name
lukman-paystack Feb 23, 2022
49b387c
1.0.0-beta.2
lukman-paystack Feb 23, 2022
44b7a9d
update package version
lukman-paystack Feb 23, 2022
bf262a0
1.0.0-nightly.0
lukman-paystack Feb 23, 2022
6135695
regenerate API commands from OpenAPI spec
lukman-paystack Mar 14, 2022
b83d862
some update sha
lukman-paystack Mar 15, 2022
7d513c5
build linux and windows packages
lukman-paystack Mar 17, 2022
ad1597f
add Open, Logout and WhoamI commands
lukman-paystack Mar 31, 2022
3e98f21
Merge branch 'version/2.0' of github.com:PaystackOSS/paystack-cli int…
lukman-paystack Mar 31, 2022
cbb5257
add logs
lukman-paystack Apr 28, 2022
3d94762
add logs to commands
lukman-paystack Apr 28, 2022
69831ea
remove rogue console.logs
lukman-paystack May 11, 2022
3af0523
remove rogue console.logs
lukman-paystack May 11, 2022
06a3607
Update Readme.MD
lukman-paystack Oct 31, 2023
7261f09
Update README.md
lukman-paystack Oct 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove rogue console.logs
  • Loading branch information
lukman-paystack committed May 11, 2022
commit 3af0523cfff00b87db8961df32fa92f7508ffd7c
3 changes: 0 additions & 3 deletions postmanToAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,12 @@ collection.item.forEach((APIObject) => {
subcommand_name = _subObject.name.toLowerCase();
subcommand_name = subcommand_name.replace(/ /g, '');
if (isAPIObject(_subObject)) {
//add to API collection
let formattedAPI = createAPIObject(_subObject, command_name);
parsedAPIs[command_name].push(formattedAPI);
// console.log(Object.keys(_subObject))
} else {
// console.log('Naah', _subObject)
}
})
// console.log('sub-'+subcommand_name, subObject.item.length);
} else {
//add to API collection
let formattedAPI = createAPIObject(subObject, command_name);
Expand Down
9 changes: 5 additions & 4 deletions src/commands/webhook.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ class WebhookCommand extends Command {
if (!flags.forward) {
this.error('To listen to webhook events locally, you have to specify a local route to forward events to using the forward flag e.g --forward localhost:3000/webhook')
}
let urlObject = helpers.parseURL(flags.forward)

let urlObject = helpers.parseURL(flags.forward);
if(urlObject.hostname !== 'localhost' && urlObject.hostname !== '127.0.0.1'){
return helpers.errorLog(`Invalid host provided "${urlObject.hostname}" - You can only forward events to localhost`);
}
if (!urlObject.port) {
urlObject.port = 8080
urlObject.port = 80
}
if (!urlObject.search || urlObject.search === '?') {
urlObject.search = ''
Expand All @@ -51,7 +53,6 @@ class WebhookCommand extends Command {
if (flags.domain === 'live') {
domain = 'live'
}
console.log('tunnel', ngrokURL)
let originalWebhookUrl = db.read('selected_integration.' + domain + '_webhook_endpoint')
helpers.infoLog(`Forwarding webhook events to ${flags.forward}`)

Expand Down
13 changes: 3 additions & 10 deletions src/lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,7 @@ const promiseWrapper = promise => (
)

function jsonLog(json) {
// let keys = Object.keys(json)
console.log(json)
// keys.forEach(k => {
// if (isJson(json[k]) || json[k] == null) {
// return
// }
// infoLog(`${k} - - - -- - -- - - - - - - - - - - - ${json[k]}`)
// })
}
function successLog(error) {
const eLog = chalk.green(error)
Expand All @@ -43,7 +36,7 @@ function isJson(val) {
}

function infoLog(error) {
const eLog = chalk.blue(error)
const eLog = chalk.blueBright(error)
console.log(eLog)
}
function parseURL(uri) {
Expand Down Expand Up @@ -205,13 +198,13 @@ function webhookInspector(ngrokApi, tunnel) {
requestBody = JSON.parse(requestBody)
let responseCode = lastRequest.response.status_code.toString()
let webhookDescription = getWebhookMessage(requestBody)
let responseMessage = responseCode + ' ' + lastRequest.response.status + ' - ' + requestBody.event + ' - ' + webhookDescription
let responseMessage = lastRequest.response.status + ' - ' + requestBody.event + ' - ' + webhookDescription
if (responseCode.slice(0, 1) !== '2') {
responseMessage = chalk.red(responseMessage)
}
console.log(responseMessage)
console.log(base64ToString(lastRequest.response.raw))
console.log('----------------------------------------------')
console.log('- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -')
})
}, 5000)
}
Expand Down
6 changes: 4 additions & 2 deletions src/lib/paystack.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ function setWebhook(url, token, integration, domain = 'test') {
axios.put('https://api.paystack.co/integration/webhooks', data, { headers }).then(resp => {
resolve(resp.data.message)
}).catch(error => {
if(error.response){
reject(error.response.data.message);
return
}
console.log(error.response.data)
reject(error)
})
Expand Down Expand Up @@ -238,7 +242,6 @@ function signIn(email, password) {
method: 'POST',
data: { email, password }
}).then(response => {
console.log(response);
resolve(response.data.data)
}).catch(error => {
if (error.response) {
Expand All @@ -263,7 +266,6 @@ function verifyToken(totp, token) {
},
data: { totp },
}).then(response => {
console.log(response);
resolve(response.data.data)
}).catch(error => {
helpers.errorLog(error.response.data.message || 'Unable to sign in, please try again in a few minutes')
Expand Down