paystack-node
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -0,1 +1,8 @@ | ||
<a name="0.2.0"></a> | ||
# 0.2.0 (2019-04-14) | ||
- Added 'Control-Cache' header to limit HTTP caching | ||
- Added Control Panel Payment Sessions API Endpoint methods | ||
<a name="0.1.0"></a> | ||
@@ -2,0 +9,0 @@ # 0.1.0 (2019-03-14) |
{ | ||
"name": "paystack-node", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "A NodeJS wrapper for the Paystack API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -39,3 +39,3 @@ # Paystack | ||
const promise = paystack.getSettlements({ | ||
const promise1 = paystack.getSettlements({ | ||
from:new Date("2017-02-09"), | ||
@@ -45,3 +45,3 @@ to:new Date() | ||
promise.then(function(response){ | ||
promise1.then(function(response){ | ||
var data = response.body | ||
@@ -51,2 +51,65 @@ | ||
// getCustomer | ||
const promise2 = paystack.getCustomer({ | ||
customer_id:'CUS_e24m6SqA6g3Jk889o21' | ||
}) | ||
promise2.then(function(response){ | ||
var data = response.body | ||
}).catch(function(error){ | ||
// deal with error | ||
}) | ||
// createCustomer | ||
const promise3 = paystack.createCustomer({ | ||
email:'malik.onyemah@gmail.com', | ||
first_name:'Malik', | ||
last_name:'Onyemah', | ||
phone:'+2347135548369' | ||
}) | ||
promise3.then(function(response){ | ||
return response.body | ||
}).then( body => { | ||
return res.status(200).json({id:body.data.id}) | ||
}) | ||
// setRiskActionOnCustomer | ||
const promise4 = paystack.setRiskActionOnCustomer({ | ||
risk_action:'deny', | ||
customer_id:'CUS_e24m6SqA6g3Jk889o21' | ||
}).then(function(response){ | ||
const result = response.body | ||
}) | ||
// createPage | ||
const promise5 = paystack.createPage({ | ||
name:'DoorPost Pay', | ||
description:'This is payment for every ', | ||
amount:30000, | ||
slug:'5nApBwZkvR', | ||
redirect_url:'https://www.localhost.com/pay/callback', | ||
custom_fields: ['phone', 'age'] | ||
}) | ||
app.use(async function verifications(req, res, next){ | ||
let responseBVN = await paystack.resolveBVN({ | ||
bvn:req.body.bvn //'22283643840404' | ||
}) | ||
let responseAcctNum = await paystack.resolveAccountNumber({ | ||
account_number:req.body.acc_num, // '0004644649' | ||
bank_code:req.body.bank_code // '075' | ||
}) | ||
await next() | ||
}) | ||
``` | ||
@@ -56,2 +119,4 @@ | ||
>Each method expects an object literal with both **route parameters** and **request parameters (query / body)**. Please, go through the _src/endpoints_ folder to see the specific items that should make up the object literal for each method | ||
- customers | ||
@@ -76,2 +141,5 @@ - paystack.createCustomer() | ||
- paystack.getSettlements() | ||
- payment sessions {control panel} | ||
- paystack.getPaymentSessionTimeout() | ||
- paystack.updatePaymentSessionTimeout() | ||
- pages | ||
@@ -124,3 +192,3 @@ - paystack.createPage() | ||
- [Ifeora Okechukwu <Head Of Technology - Oparand>](https://twitter.com/isocroft) | ||
- [Ahmad Abdul-Aziz <Software Engineer>](https://instagram.com/dev_amaz) | ||
- [Ahmad Abdul-Aziz <Software Engineer>](https://twitter.com/dev_amaz) | ||
@@ -135,2 +203,2 @@ # Contributing | ||
[travis-image]: https://img.shields.io/travis/stitchng/paystack/master.svg?style=flat-square | ||
[travis-url]: https://travis-ci.org/stitchng/paystack | ||
[travis-url]: https://travis-ci.org/stitchng/paystack |
@@ -6,3 +6,3 @@ 'use strict' | ||
Create customer | ||
@params: first_name, last_name, email, phone | ||
@params: first_name, last_name, email(required), phone | ||
*/ | ||
@@ -42,3 +42,3 @@ createCustomer: { | ||
Update customer | ||
@params: first_name, last_name, email (required), phone | ||
@params: customer_id, first_name, last_name, email (required), phone | ||
*/ | ||
@@ -45,0 +45,0 @@ updateCustomer: { |
@@ -6,3 +6,3 @@ 'use strict' | ||
Create Pages | ||
@params: name, description, amount, slug, redirect_url, custom_fields | ||
@params: name(required), description, amount, slug, redirect_url, custom_fields | ||
*/ | ||
@@ -18,3 +18,3 @@ createPage: { | ||
List Pages | ||
@params: | ||
@params: perPage, page | ||
*/ | ||
@@ -31,3 +31,3 @@ listPages: { | ||
Fetch Page | ||
@params: | ||
@params: id_or_slug | ||
*/ | ||
@@ -43,3 +43,3 @@ getPage: { | ||
Update Pages | ||
@params: name, description, amount, active | ||
@params: id_or_slug, name, description, amount, active | ||
*/ | ||
@@ -46,0 +46,0 @@ updatePage: { |
@@ -6,3 +6,3 @@ 'use strict' | ||
Create Refund | ||
@param: transaction<reference>, amount, currency, customer_note, merchant_note | ||
@param: transaction(reference), amount, currency, customer_note, merchant_note | ||
*/ | ||
@@ -20,3 +20,3 @@ createRefund: { | ||
List Refund | ||
@param: reference, currency | ||
@param: reference(required), currency | ||
*/ | ||
@@ -23,0 +23,0 @@ listRefund: { |
@@ -6,3 +6,3 @@ 'use strict' | ||
Initiate Transfer | ||
@param: source, reason, amount, recipient, currency, reference | ||
@param: source(required), reason, amount(required), recipient(required), currency, reference(required) | ||
*/ | ||
@@ -9,0 +9,0 @@ initiateTransfer: { |
@@ -16,3 +16,3 @@ 'use strict' | ||
Resolve Account Number | ||
@param: account_number, bank_code | ||
@param: account_number(required), bank_code | ||
*/ | ||
@@ -22,3 +22,3 @@ resolveAccountNumber: { | ||
path: '/bank/resolve', | ||
params: { account_number: String, bank_code: String }, | ||
params: { account_number$: String, bank_code: String }, | ||
route_params: null | ||
@@ -25,0 +25,0 @@ }, |
@@ -20,2 +20,3 @@ 'use strict' | ||
const subscriptions = require('../endpoints/subscriptions') | ||
const controlPanelForSessions = require('../endpoints/control_panel_for_sessions.js') | ||
@@ -37,3 +38,4 @@ /* Any param with '$' at the end is a REQUIRED param both for request body param(s) request route params */ | ||
settlements, | ||
subscriptions | ||
subscriptions, | ||
controlPanelForSessions | ||
) | ||
@@ -157,2 +159,3 @@ | ||
headers: { | ||
'Cache-Control': 'no-cache', | ||
'Accept': 'application/json' | ||
@@ -173,2 +176,6 @@ }, | ||
if (!(requestParams instanceof Object)) { | ||
throw new TypeError('Argument: [ requestParam(s) ] Should Be An Object Literal') | ||
} | ||
if (!_.isEmpty(requestParams, true)) { | ||
@@ -184,3 +191,3 @@ if (config.params !== null) { | ||
if (config.params !== null || config.route_params !== null) { | ||
throw new Error('Argument: [ requestParam(s) ] Not Meant To Be Empty!') | ||
throw new TypeError('Argument: [ requestParam(s) ] Not Meant To Be Empty!') | ||
} | ||
@@ -187,0 +194,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39756
20
1105
198