Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

paystack-node

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

paystack-node - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

src/endpoints/products.js

14

CHANGELOG.md

@@ -0,13 +1,21 @@

<a name="0.2.1"></a>
# 0.2.1 (2019-10-13)
### Bug Fixes
- Fixed `SyntaxError: Unexpected end of JSON input` by [@HopePraise5](https://github.com/HopePraise5)
### Feature Added
- Added _Products_ API Endpoint methods
<a name="0.2.0"></a>
# 0.2.0 (2019-04-14)
### Feature Added
- Added 'Control-Cache' header to limit HTTP caching
- Added _Control Panel Payment Sessions_ API Endpoint methods
- Added Control Panel Payment Sessions API Endpoint methods
<a name="0.1.0"></a>
# 0.1.0 (2019-03-14)
### Bug Fixes
- None

@@ -5,3 +5,3 @@ 'use strict'

PayStack.prototype.version = '0.1.0'
PayStack.prototype.version = '0.2.1'

@@ -8,0 +8,0 @@ const Fees = function (cap, additionalCharge, percentage, threshold) {

{
"name": "paystack-node",
"version": "0.2.0",
"version": "0.2.1",
"description": "A NodeJS wrapper for the Paystack API",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -27,3 +27,3 @@ # Paystack

let APIKEY = 'sk_test_2hWyQ6HW73jS8p1IkXmSWOlE4y9Inhgyd6g5f2R7'
let APIKEY = 'sk_live_2hWyQ6HW73jS8p1IkXmSWOlE4y9Inhgyd6g5f2R7'
const environment = process.env.NODE_ENV

@@ -33,2 +33,5 @@

const feesCalculator = new PayStack.Fees();
const feeCharge = feesCalculator.calculateFor(250000) // 2,500 Naira
/*

@@ -48,3 +51,4 @@ NOTE: All fields/params that require dates should be set to

var data = response.body
}).catch(function (error){
// deal with error
})

@@ -76,5 +80,4 @@

return response.body
}).then( body => {
return res.status(200).json({id:body.data.id})
return res.status(200).json({id:body.data.id})
})

@@ -87,4 +90,8 @@

customer_id:'CUS_e24m6SqA6g3Jk889o21'
}).then(function(response){
})
promise4.then(function (response){
const result = response.body
}).catch(function (error){
// deal with error
})

@@ -97,9 +104,56 @@

description:'This is payment for every ',
amount:30000,
amount:300000, // Amount in kobo
slug:'5nApBwZkvR',
redirect_url:'https://www.localhost.com/pay/callback',
custom_fields: ['phone', 'age']
custom_fields: ['phone_number', 'age']
})
promise5.then(function (response){
console.log(response.body);
}).catch(function (error){
// deal with error
})
// initializeTransaction
const promise6 = paystack.initializeTransaction({
reference: "7PVGX8MEk85tgeEpVDtD",
amount: 500000, // 5,000 Naira (remember you have to pass amount in kobo)
email: "seun045olayinka@gmail.com",
subaccount: "ACCT_8f4s1eq7ml6rlzj"
})
promise6.then(function (response){
console.log(response.body);
}).catch(function (error){
// deal with error
})
// verifyTransaction
const promise7 = paystack.verifyTransaction({
reference: "7PVGX8MEk85tgeEpVDtD"
})
promise7.then(function (response){
console.log(response.body);
}).catch(function (error){
// deal with error
})
// listInvoices
const promise8 = paystack.listInvoices({
customer: "CUS_je02lbimlqixzax",
status: "pending",
paid: false,
currency: "NGN"
})
promise8.then(function (response){
console.log(response.body);
}).catch(function (error){
// deal with error
})
app.use(async function verifications(req, res, next){

@@ -115,3 +169,3 @@ let responseBVN = await paystack.resolveBVN({

await next()
next()
})

@@ -153,2 +207,7 @@

- paystack.checkSlugAvailability()
- products
- paystack.createProduct()
- paystack.listProduct()
- paystack.getProduct()
- paystack.updateProduct()
- transactions

@@ -185,2 +244,21 @@ - paystack.initializeTransaction()

- paystack.updateSubaccount()
- verifications
- paystack.resolveBVN()
- paystack.resolveAccountNumber()
- paystack.resolveCardBin()
- paystack.resolvePhoneNumber()
- transfers
- paystack.initiateTransfer()
- paystack.listTransfers()
- paystack.fetchTransfer()
- paystack.finalizeTransfer()
- paystack.initiateBulkTransfer()
- charges
- paystack.chargeCard()
- paystack.chargeBank()
- paystack.submitPIN()
- paystack.submitOTP()
- paystack.submitPhone()
- paystack.submitBirthday()
- paystack.checkPendingCharge()
- miscellanous

@@ -195,3 +273,3 @@ - paystack.listBanks()

- [Ifeora Okechukwu <Head Of Technology - Oparand>](https://twitter.com/isocroft)
- [Ifeora Okechukwu <Software Engineer>](https://twitter.com/isocroft)
- [Ahmad Abdul-Aziz <Software Engineer>](https://twitter.com/dev_amaz)

@@ -208,1 +286,9 @@

[travis-url]: https://travis-ci.org/stitchng/paystack
## Support
**Coolcodes** is a non-profit software foundation (collective) created by **Oparand** - parent company of StitchNG, Synergixe based in Abuja, Nigeria. You'll find an overview of all our work and supported open source projects on our [Facebook Page](https://www.facebook.com/coolcodes/).
>Follow us on facebook if you can to get the latest open source software/freeware news and infomation.
Does your business depend on our open projects? Reach out and support us on [Patreon](https://www.patreon.com/coolcodes/). All pledges will be dedicated to allocating workforce on maintenance and new awesome stuff.

@@ -15,2 +15,3 @@ 'use strict'

params: { card$: Object, metadata: Object, reference: String, amount: Number, email: String },
param_defaults: null,
route_params: null

@@ -87,4 +88,5 @@ },

params: null,
param_defaults: null,
route_params: { reference: String }
}
}

@@ -36,2 +36,3 @@ 'use strict'

params: { description: String, line_items: Array, tax: Array, customer: String, due_date: String, metadata: Object, send_notification: Boolean },
param_defaults: { send_notification: false },
route_params: { invoice_id_or_code: String }

@@ -49,2 +50,3 @@ },

params: { customer: String, status: String, currency: String, paid: String, include_archive: String },
param_defaults: { currency: 'NGN' },
route_params: null

@@ -62,2 +64,3 @@ },

params: null,
param_defaults: null,
route_params: { invoice_code: String }

@@ -89,2 +92,3 @@ },

params: null,
param_defaults: null,
route_params: null

@@ -91,0 +95,0 @@ },

@@ -18,3 +18,3 @@ 'use strict'

/*
List Sub Account
List Sub Accounts
@param: perPage(50 per page), page

@@ -38,3 +38,5 @@ */

path: '/subaccount/{:id_or_slug}',
send_json: false,
params: null,
param_defaults: null,
route_params: { id_or_slug: String }

@@ -41,0 +43,0 @@ },

@@ -13,2 +13,3 @@ 'use strict'

params: { customer$: String, plan$: String, authorization$: String, start_date: Date },
param_defaults: null,
route_params: null

@@ -39,2 +40,3 @@ },

params: { code: String, token: String },
param_defaults: null,
route_params: null

@@ -52,2 +54,3 @@ },

params: { code: String, token: String },
param_defaults: null,
route_params: null

@@ -64,2 +67,3 @@ },

params: null,
param_defaults: null,
route_params: { id_or_subscription_code: String }

@@ -66,0 +70,0 @@ }

@@ -25,2 +25,4 @@ 'use strict'

send_json: false,
params: null,
param_defaults: null,
route_params: { reference: String }

@@ -35,3 +37,3 @@ },

method: 'GET',
path: '/transaction/',
path: '/transaction',
send_json: false,

@@ -51,2 +53,4 @@ params: { perPage: Number, page: Number, customer: Number, status: String, from: Date, to: Date, amount: Number },

send_json: false,
param_defaults: null,
params: null,
route_params: { id: String }

@@ -76,2 +80,4 @@ },

send_json: false,
param_defaults: null,
params: null,
route_params: { id: String }

@@ -89,2 +95,3 @@ },

params: { from: Date, to: Date },
param_defaults: null,
route_params: null

@@ -91,0 +98,0 @@ },

@@ -24,2 +24,3 @@ 'use strict'

path: '/transfer',
send_json: false,
params: { perPage: Number, page: Number },

@@ -37,3 +38,5 @@ param_defaults: { perPage: 0, page: 0 },

path: '/transfer/{:id_or_code}',
send_json: false,
params: null,
param_defaults: null,
route_params: { id_or_code: String }

@@ -51,2 +54,3 @@ },

params: { transfer_code$: String, otp$: String },
param_defaults: null,
route_params: null

@@ -53,0 +57,0 @@ },

@@ -12,2 +12,3 @@ 'use strict'

params: null,
param_defaults: null,
route_params: { bvn: String }

@@ -23,2 +24,3 @@ },

params: { account_number$: String, bank_code: String },
param_defaults: null,
route_params: null

@@ -35,2 +37,3 @@ },

params: null,
param_defaults: null,
route_params: { bin: String }

@@ -37,0 +40,0 @@ },

@@ -12,2 +12,3 @@ 'use strict'

const pages = require('../endpoints/pages.js')
const products = require('../endpoints/products.js')
const refunds = require('../endpoints/refunds.js')

@@ -23,3 +24,3 @@ const charges = require('../endpoints/charges.js')

/* Any param with '$' at the end is a REQUIRED param both for request body param(s) request route params */
/* Any param with '$' at the end is a REQUIRED param both for request body param(s) request route params */
const apiEndpoints = Object.assign(

@@ -32,2 +33,3 @@ {},

pages,
products,
refunds,

@@ -168,4 +170,6 @@ charges,

httpConfig.headers['Content-Type'] = httpConfig.headers['Accept'] // 'application/json'
httpConfig.form = false
} else if (config.send_form) {
httpConfig.headers['Content-Type'] = 'x-www-form-urlencoded'
httpConfig.headers['Content-Type'] = 'application/x-www-form-urlencoded'
httpConfig.form = true
}

@@ -201,3 +205,3 @@

if (payload.hasOwnProperty(type)) {
httpConfig[type] = JSON.parse(payload[type])
httpConfig[type] = (type === 'query') ? payload[type] : JSON.parse(payload[type])
}

@@ -251,6 +255,6 @@ }

case 404: // Not Found
errorMessage = ''
errorMessage = 'Request endpoint does not exist: Not Found (404)'
break
case 403: // Forbidden
errorMessage = ''
errorMessage = 'Request endpoint requires further priviledges to be accessed: Forbidden (403)'
break

@@ -257,0 +261,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc