diff --git a/index.js b/index.js index 532cddc..a929107 100644 --- a/index.js +++ b/index.js @@ -10,11 +10,12 @@ const fs = require("fs"), let newPaystack = (old = String, recent = String, type, min)=>{ if(type == "paystack-js"){ fs.writeFile(`${recent}.js`, old, 'utf8', err => { - if (err) return console.log(err); + if (err) { + console.error('Error writing file:', err); + return; + } + console.info(`Successfully created "${recent}.js"`) }); - - console.info("Done!!!") - console.info('Please check directory for "paystack.js"') if(min == "min"){ minify(`${recent}.js`) @@ -38,11 +39,12 @@ let newPaystack = (old = String, recent = String, type, min)=>{ fs.writeFile(`${recent}.js`, result, 'utf8', err => { - if (err) return console.log(err); + if (err) { + console.error('Error writing file:', err); + return; + } + console.info(`Successfully created "${recent}.js"`) }); - - console.info("Done!!!") - console.info(`Done. Please check directory for "${recent}.js"`) if(min == "min"){ minify(`${recent}.js`) @@ -67,8 +69,8 @@ let newPaystack = (old = String, recent = String, type, min)=>{ } program - .version('1.2.0') - .description('A simple CLI tool that makes paystack easier for developers to intergrate'); + .version('1.2.3') + .description('A simple CLI tool that makes paystack easier for developers to integrate'); program .command('create [min]') diff --git a/model/oldPaystack.js b/model/oldPaystack.js index 3959544..10bc1ed 100644 --- a/model/oldPaystack.js +++ b/model/oldPaystack.js @@ -5,7 +5,7 @@ module.exports = { PaystackPop.setup({ key: 'the-public-key', email: $("#customer-email").val(), - amount: parseInt($("#amount").val())+"00", + amount: parseInt($("#amount").val() * 100), container: 'paystackEmbedContainer', callback: function(response){ $("#success-response").text('success. transaction ref is ' + response.reference) @@ -18,7 +18,7 @@ module.exports = { var handler = PaystackPop.setup({ key: 'the-public-key', email: $("#customer-email").val(), - amount: parseInt($("#amount").val()) + "00", + amount: parseInt($("#amount").val() * 100), currency: "NGN", // ref: ''+Math.floor((Math.random() * 1000000000) + 1), // generates a pseudo-unique reference. Please replace with a reference you generated. Or remove the line entirely so our API will generate one for you metadata: { diff --git a/model/questions.js b/model/questions.js index 1d86405..decec17 100644 --- a/model/questions.js +++ b/model/questions.js @@ -3,7 +3,7 @@ module.exports = { { type : 'input', name : 'public_key', - message : 'Enter your Paystack Pubic Key:' + message : 'Enter your Paystack Public Key:' } ], confirm : [