New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.6 to 0.3.0

src/endpoints/bulk_charges.js

13

CHANGELOG.md

@@ -0,1 +1,14 @@

<a name="0.3.0"></a>
# 0.3.0 (2021-03-23)
### Added Features
- Added the **submitAddress()** Endpoint method
- Added the **chargeUssd()** Endpoint method
- Added the **chargeMobileMoney()** Endpoint method
- Added the **resolveBVNPremium()** Endpoint method
- Added the **listProviders()** Endpoint method
### Bug Fixes
- Fixed error _"TypeError: function is not a function"_ when mock is enabled
<a name="0.2.6"></a>

@@ -2,0 +15,0 @@ # 0.2.6 (2021-02-27)

2

index.js

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

PayStack.prototype.version = '0.2.6'
PayStack.prototype.version = '0.3.0'

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

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

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

@@ -132,3 +132,3 @@ # Paystack

slug:'5nApBwZkvR',
redirect_url:'https://www.localhost.com/pay/callback',
redirect_url:'https://www.localhoster.com/pay/callback',
custom_fields: ['phone_number', 'age']

@@ -200,3 +200,3 @@ })

### Mocking the Instance (for Unit Tests)
### Mocking the Instance (for Unit/Integration Tests)
>Setting up mocks for testing with the paystack instance is now as easy as fliping a switch like so:

@@ -243,15 +243,8 @@

async function getCustomers (reqPayload = {}) {
if (!(reqPayload instanceof Object)) {
throw new TypeError(
'Argument: [ requestParam(s) ] Should Be An Object Literal'
)
}
// validate {reqPayload} key/value pairs
if (!reqPayload.customer_id
|| typeof reqPayload.customer_id !== 'string') {
return new TypeError(`param: "customer_id" is not of type ${typeof reqPayload.customer_id}; please provided as needed`)
}
// @TODO: connect to a in-memory db (redis) for mocking purposes
// validation for (reqPayload) is already taken care of!
return { body: { statsu: true, data: reqPayload } };
// @TODO: optionally, connect to a in-memory db (redis) for mocking purposes
// return mocked response object
return { status: 200, body: { status: "success", data: reqPayload } };
})

@@ -347,2 +340,3 @@

- paystack.resolveBVN()
- paystack.resolveBVNPremium()
- paystack.matchBVN()

@@ -366,2 +360,4 @@ - paystack.resolveAccountNumber()

- paystack.chargeBank()
- paystack.chargeUssd()
- paystack.chargeMobileMoney()
- paystack.submitPIN()

@@ -371,5 +367,7 @@ - paystack.submitOTP()

- paystack.submitBirthday()
- paystack.submitAddress()
- paystack.checkPendingCharge()
- miscellanous
- paystack.listBanks()
- paystack.listProviders()
- paystack.listCountries()

@@ -376,0 +374,0 @@

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

send_json: true,
params: { card$: Object, metadata: Object, reference: String, ussd: Object, pin: String, authorization_code: String, mobile_money: Object, device_id: String, amount$: String, email$: String },
params: { card$: Object, metadata: Object, reference: String, pin: String, authorization_code: String, device_id: String, amount$: String, email$: String },
param_defaults: null,

@@ -21,2 +21,28 @@ route_params: null

/*
Charge USSD
@param: ussd, metadata, reference, amount, email
*/
chargeUssd: {
method: 'POST',
path: '/charge',
send_json: true,
params: { ussd$: Object, metadata: Object, reference: String, pin: String, authorization_code: String, device_id: String, amount$: String, email$: String },
param_defaults: { ussd: { type: '737' } },
route_params: null
},
/*
Charge Mobile Money
@param: mobile_money, currency, metadata, reference, amount, email
*/
chargeMobileMoney: {
method: 'POST',
path: '/charge',
send_json: true,
params: { mobile_money$: Object, currency: String, metadata: Object, reference: String, pin: String, authorization_code: String, device_id: String, amount$: String, email$: String },
param_defaults: null,
route_params: null
},
/*
Charge Bank

@@ -29,3 +55,3 @@ @param: bank, metadata, reference, amount, email

send_json: true,
params: { bank$: Object, metadata: Object, reference: String, ussd: Object, pin: String, authorization_code: String, mobile_money: Object, device_id: String, amount$: String, email$: String },
params: { bank$: Object, metadata: Object, reference: String, pin: String, authorization_code: String, mobile_money: Object, device_id: String, amount$: String, email$: String },
route_params: null

@@ -83,2 +109,14 @@ },

/*
Submit Address
@param: address, reference, city, state, zipcode
*/
submitAddress: {
method: 'POST',
path: '/charge/submit_address',
send_json: true,
params: { address$: String, reference$: String, city$: String, state$: String, zipcode: String },
route_params: null
},
/*
Check Pending Charge

@@ -85,0 +123,0 @@ @param: reference

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

List Banks
@param: perPage, page
@param: perPage, page, use_cursor(required), next, previous, gateway, type, country(required)
*/

@@ -13,3 +13,3 @@ listBanks: {

send_json: false,
params: { perPage: Number, page: Number, type: String, currency: String, country: String },
params: { perPage$: Number, page: Number, use_cursor: Boolean, next: String, previous: String, type: String, currency: String, country$: String },
param_defaults: { perPage: 50, page: 1, currency: 'NGN', country: 'Nigeria' },

@@ -20,6 +20,18 @@ route_params: null

/*
List Providers
@param: pay_with_bank_transfer
*/
listProviders: {
method: 'GET',
path: '/bank',
send_json: false,
params: { pay_with_bank_transfer$: Boolean },
param_defaults: { pay_with_bank_transfer: true },
route_params: null
},
/*
List Countries
@param: -
*/
listCountries: {

@@ -26,0 +38,0 @@ method: 'GET',

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

Initiate Transfer
@param: source(required), reason, amount(required), recipient(required), currency, reference(required)
@param: source(required), reason, amount(required), recipient(required), currency, reference
*/

@@ -12,3 +12,3 @@ initiateTransfer: {

path: '/transfer',
params: { source$: String, reason: String, amount$: Number, recipient$: String, currency: String, reference$: String },
params: { source$: String, reason: String, amount$: Number, recipient$: String, currency: String, reference: String },
send_json: true,

@@ -15,0 +15,0 @@ param_defaults: { source: 'balance', currency: 'NGN' },

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

/*
Resolve Bank Verification Number
@param: bvn
*/
Resolve Bank Verification Number (Standard)
@param: bvn
*/
resolveBVN: {

@@ -16,6 +16,19 @@ method: 'GET',

},
/*
Match Bank Verification Number
@param: bvn (required), account_number(required), bank_code (required), first_name, middle_name, last_name
*/
Resolve Bank Verification Number (Premium)
@param: bvn
*/
resolveBVNPremium: {
method: 'GET',
path: 'identity/bvn/resolve/{:bvn}',
params: null,
param_defaults: null,
route_params: { bvn: String }
},
/*
Match Bank Verification Number
@param: bvn (required), account_number(required), bank_code (required), first_name, middle_name, last_name
*/
matchBVN: {

@@ -29,6 +42,7 @@ method: 'POST',

},
/*
Resolve Account Number
@param: account_number(required), bank_code (required)
*/
Resolve Account Number
@param: account_number(required), bank_code (required)
*/
resolveAccountNumber: {

@@ -43,5 +57,5 @@ method: 'GET',

/*
Resolve Card Bin
@param: bin
*/
Resolve Card Bin
@param: bin
*/
resolveCardBin: {

@@ -56,5 +70,5 @@ method: 'GET',

/*
Resolve Phone Number
@param: verification_type, phone, callback_url
*/
Resolve Phone Number
@param: verification_type, phone, callback_url
*/
resolvePhoneNumber: {

@@ -61,0 +75,0 @@ method: 'POST',

@@ -27,6 +27,9 @@ 'use strcit'

status: 200,
statusText: 'OK',
body: {
status: true,
message: 'successfull paystack request {' + method + '}',
data: data
data: data || {
status: 'success'
}
}

@@ -33,0 +36,0 @@ })

@@ -289,10 +289,2 @@ 'use strict'

if (this._mock !== null &&
canInvokeTestingMock) {
throw new TypeError(
typeof this._mock[methodName] +
' is not a function'
)
}
if (canInvokeTestingMock) {

@@ -299,0 +291,0 @@ if (methodName !== 'chargeBank' &&

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