Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
19 changes: 14 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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!!!")
Expand All @@ -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);
Expand All @@ -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!!!")
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions model/oldPaystack.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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: {
Expand Down
2 changes: 1 addition & 1 deletion model/questions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
{
type : 'input',
name : 'public_key',
message : 'Enter your Paystack Pubic Key:'
message : 'Enter your Paystack Public Key:'
}
],
confirm : [
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down