From 9d6e64721f7d72c778e77f362933437367656753 Mon Sep 17 00:00:00 2001 From: Clete AI Date: Sat, 17 May 2025 12:35:31 +0000 Subject: [PATCH] Clete AI[bot] PR: Fix typos, version mismatch and error handling This is a PR opened by AI tool [Clete AI](https://www.clete.ai) to implement changes: Fix typos, version mismatch and error handling --- index.js | 19 ++++++++++++++----- model/oldPaystack.js | 4 ++-- model/questions.js | 2 +- package.json | 2 +- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/index.js b/index.js index 532cddc..b5b2769 100644 --- a/index.js +++ b/index.js @@ -10,7 +10,10 @@ 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); + process.exit(1); + } }); console.info("Done!!!") @@ -20,8 +23,11 @@ let newPaystack = (old = String, recent = String, type, min)=>{ minify(`${recent}.js`) .then((data)=>{ fs.writeFile(`${recent}.min.js`, data, 'utf8', err => { - if (err) return console.log(err); - else console.info(`"${recent}.min.js" also added as minified version`) + if (err) { + console.error('Error writing minified file:', err); + process.exit(1); + } + console.info(`"${recent}.min.js" also added as minified version`); }); }) .catch(console.error); @@ -38,7 +44,10 @@ 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); + process.exit(1); + } }); console.info("Done!!!") @@ -67,7 +76,7 @@ let newPaystack = (old = String, recent = String, type, min)=>{ } program - .version('1.2.0') + .version('1.2.3') .description('A simple CLI tool that makes paystack easier for developers to intergrate'); program 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 : [ diff --git a/package.json b/package.json index a9fe866..035ca33 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "preferGlobal": true, "bin": "./index.js", "version": "1.2.3", - "description": "A simple CLI tool that makes paystack easier for developers to intergrate", + "description": "A simple CLI tool that makes paystack easier for developers to integrate", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1"