Comparing version 1.1.2 to 1.2.0
75
index.js
@@ -18,3 +18,2 @@ /** | ||
const c = require('rangi'); | ||
const d = require('debug')('equity'); | ||
const p = require('./package.json'); | ||
@@ -84,3 +83,3 @@ const fs = require('fs'); | ||
if (typeof opts !== 'object' || !opts.hasOwnProperty('consumerKey') || !opts.hasOwnProperty('consumerSecret')) { | ||
d(c.red(error.noKeyAndSecret)); | ||
console.error(c.red(error.noKeyAndSecret)); | ||
process.exit(1); | ||
@@ -113,7 +112,7 @@ } | ||
if (typeof opts !== 'object') { | ||
d(c.red(error.missingParam)); | ||
console.error(c.red(error.missingParam)); | ||
} | ||
if (!opts.hasOwnProperty('username') || opts['username'] === '') { | ||
d(c.red(error.noParam + 'username')); | ||
console.error(c.red(error.noParam + 'username')); | ||
} | ||
@@ -124,3 +123,3 @@ | ||
if (!opts.hasOwnProperty('password') || opts['password'] === '') { | ||
d(c.red(error.noParam + 'password')); | ||
console.error(c.red(error.noParam + 'password')); | ||
} | ||
@@ -131,3 +130,3 @@ | ||
if (!opts.hasOwnProperty('grant_type') || opts['grant_type'] === '') { | ||
d(c.red(error.noParam + 'grant_type')); | ||
console.error(c.red(error.noParam + 'grant_type')); | ||
} | ||
@@ -177,11 +176,11 @@ | ||
if (typeof opts !== 'object') { | ||
d(c.red(error.missingParam)); | ||
console.error(c.red(error.missingParam)); | ||
} | ||
if (!opts.hasOwnProperty('merchantId') || opts['merchantId'] === '') { | ||
d(c.red(error.noParam + 'merchant id')); | ||
console.error(c.red(error.noParam + 'merchant id')); | ||
} | ||
if (!opts.hasOwnProperty('currentPassword') || opts['currentPassword'] === '') { | ||
d(c.red(error.noParam + 'current password')); | ||
console.error(c.red(error.noParam + 'current password')); | ||
} | ||
@@ -192,3 +191,3 @@ | ||
if (!opts.hasOwnProperty('newPassword') || opts['newPassword'] === '') { | ||
d(c.red(error.noParam + 'new password')); | ||
console.error(c.red(error.noParam + 'new password')); | ||
} | ||
@@ -236,7 +235,7 @@ | ||
if (typeof opts !== 'object') { | ||
d(c.red(error.missingParam)); | ||
console.error(c.red(error.missingParam)); | ||
} | ||
if (!opts.hasOwnProperty('mobileNumber') || opts['mobileNumber'] === '') { | ||
d(c.red(error.noParam + 'mobile number')); | ||
console.error(c.red(error.noParam + 'mobile number')); | ||
@@ -248,3 +247,3 @@ } | ||
if (!opts.hasOwnProperty('amount') || opts['amount'] === '') { | ||
d(c.red(error.noParam + 'amount')); | ||
console.error(c.red(error.noParam + 'amount')); | ||
} | ||
@@ -255,3 +254,3 @@ | ||
if (!opts.hasOwnProperty('telco') || opts['telco'] === '') { | ||
d(c.red(error.noParam + 'telco')); | ||
console.error(c.red(error.noParam + 'telco')); | ||
} | ||
@@ -262,3 +261,3 @@ | ||
if (!opts.hasOwnProperty('reference') || opts['reference'] === '') { | ||
d(c.red(error.noParam + 'reference')); | ||
console.error(c.red(error.noParam + 'reference')); | ||
} | ||
@@ -307,7 +306,7 @@ | ||
if (typeof opts !== 'object') { | ||
d(c.red(error.missingParam)); | ||
console.error(c.red(error.missingParam)); | ||
} | ||
if (!opts.hasOwnProperty('mobileNumber') || opts['mobileNumber'] === '') { | ||
d(c.red(error.noParam + 'mobile number')); | ||
console.error(c.red(error.noParam + 'mobile number')); | ||
} | ||
@@ -318,3 +317,3 @@ | ||
if (!opts.hasOwnProperty('amount') || opts['amount'] === '') { | ||
d(c.red(error.noParam + 'amount')); | ||
console.error(c.red(error.noParam + 'amount')); | ||
} | ||
@@ -325,3 +324,3 @@ | ||
if (!opts.hasOwnProperty('description') || opts['description'] === '') { | ||
d(c.red(error.noParam + 'description')); | ||
console.error(c.red(error.noParam + 'description')); | ||
} | ||
@@ -332,3 +331,3 @@ | ||
if (!opts.hasOwnProperty('type') || opts['type'] === '') { | ||
d(c.red(error.noParam + 'type')); | ||
console.error(c.red(error.noParam + 'type')); | ||
} | ||
@@ -339,3 +338,3 @@ | ||
if (!opts.hasOwnProperty('auditNumber') || opts['auditNumber'] === '') { | ||
d(c.red(error.noParam + 'audit number')); | ||
console.error(c.red(error.noParam + 'audit number')); | ||
} | ||
@@ -377,7 +376,7 @@ | ||
if (typeof opts !== 'object') { | ||
d(c.red(error.missingParam)); | ||
console.error(c.red(error.missingParam)); | ||
} | ||
if (!opts.hasOwnProperty('transactionId') || opts['transactionId'] === '') { | ||
d(c.red(error.noParam + 'transaction id')); | ||
console.error(c.red(error.noParam + 'transaction id')); | ||
} | ||
@@ -434,7 +433,7 @@ | ||
if (typeof opts !== 'object') { | ||
d(c.red(error.missingParam)); | ||
console.error(c.red(error.missingParam)); | ||
} | ||
if (!opts.hasOwnProperty('transactionReference') || opts['transactionReference'] === '') { | ||
d(c.red(error.noParam + 'transaction reference')); | ||
console.error(c.red(error.noParam + 'transaction reference')); | ||
} | ||
@@ -445,3 +444,3 @@ | ||
if (!opts.hasOwnProperty('senderName') || opts['senderName'] === '') { | ||
d(c.red(error.noParam + 'sender name')); | ||
console.error(c.red(error.noParam + 'sender name')); | ||
} | ||
@@ -452,3 +451,3 @@ | ||
if (!opts.hasOwnProperty('accountNumber') || opts['accountNumber'] === '') { | ||
d(c.red(error.noParam + 'account number')); | ||
console.error(c.red(error.noParam + 'account number')); | ||
} | ||
@@ -459,3 +458,3 @@ | ||
if (!opts.hasOwnProperty('bicCode') || opts['bicCode'] === '') { | ||
d(c.red(error.noParam + 'BIC CODE')); | ||
console.error(c.red(error.noParam + 'BIC CODE')); | ||
} | ||
@@ -466,3 +465,3 @@ | ||
if (!opts.hasOwnProperty('mobileNumber') || opts['mobileNumber'] === '') { | ||
d(c.red(error.noParam + 'mobile number')); | ||
console.error(c.red(error.noParam + 'mobile number')); | ||
} | ||
@@ -473,3 +472,3 @@ | ||
if (!opts.hasOwnProperty('walletName') || opts['walletName'] === '') { | ||
d(c.red(error.noParam + 'wallet name')); | ||
console.error(c.red(error.noParam + 'wallet name')); | ||
} | ||
@@ -480,3 +479,3 @@ | ||
if (!opts.hasOwnProperty('bankCode') || opts['bankCode'] === '') { | ||
d(c.red(error.noParam + 'bank code')); | ||
console.error(c.red(error.noParam + 'bank code')); | ||
} | ||
@@ -487,3 +486,3 @@ | ||
if (!opts.hasOwnProperty('branchCode') || opts['branchCode'] === '') { | ||
d(c.red(error.noParam + 'branch code')); | ||
console.error(c.red(error.noParam + 'branch code')); | ||
} | ||
@@ -494,3 +493,3 @@ | ||
if (!opts.hasOwnProperty('countryCode') || opts['countryCode'] === '') { | ||
d(c.red(error.noParam + 'country code')); | ||
console.error(c.red(error.noParam + 'country code')); | ||
} | ||
@@ -501,3 +500,3 @@ | ||
if (!opts.hasOwnProperty('currencyCode') || opts['currencyCode'] === '') { | ||
d(c.red(error.noParam + 'currency code')); | ||
console.error(c.red(error.noParam + 'currency code')); | ||
} | ||
@@ -508,3 +507,3 @@ | ||
if (!opts.hasOwnProperty('amount') || opts['amount'] === '') { | ||
d(c.red(error.noParam + 'amount')); | ||
console.error(c.red(error.noParam + 'amount')); | ||
} | ||
@@ -515,3 +514,3 @@ | ||
if (!opts.hasOwnProperty('paymentType') || opts['paymentType'] === '') { | ||
d(c.red(error.noParam + 'payment type')); | ||
console.error(c.red(error.noParam + 'payment type')); | ||
} | ||
@@ -522,3 +521,3 @@ | ||
if (!opts.hasOwnProperty('paymentReferences') || opts['paymentReferences'] === '') { | ||
d(c.red(error.noParam + 'payment references')); | ||
console.error(c.red(error.noParam + 'payment references')); | ||
} | ||
@@ -529,3 +528,3 @@ | ||
if (!opts.hasOwnProperty('remarks') || opts['remarks'] === '') { | ||
d(c.red(error.noParam + 'remarks')); | ||
console.error(c.red(error.noParam + 'remarks')); | ||
} | ||
@@ -532,0 +531,0 @@ |
{ | ||
"name": "equityjs", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "A Node.js Library For The Equity Eazzy API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -30,3 +30,3 @@ [![npm](https://img.shields.io/npm/v/equityjs.svg?style=flat-square)](https://www.npmjs.com/package/equityjs) | ||
consumerSecret: 'YOUR_CONSUMER_SECRET' | ||
}); | ||
); | ||
``` | ||
@@ -55,22 +55,79 @@ | ||
console.error(e); | ||
} else { | ||
else { | ||
console.log(r); | ||
} | ||
} | ||
``` | ||
### Methods | ||
## Methods | ||
- _All parameters are **required**!_ | ||
- _All parameters for **all** methods are **required**!_ | ||
- _All `opts` take a JSON Object structure!_ | ||
**Identity API** | ||
## _Identity API_ | ||
`equity.changePassword(opts, callback)` | ||
### `equity.changePassword(opts, callback)` | ||
Parameter | Description | ||
--- | --- | | ||
merchantId | Your merchant ID | ||
currentPassword | Your current password | ||
newPassword | Your new password | ||
`merchantId` | _Your merchant ID_ | ||
`currentPassword` | _Your current password_ | ||
`newPassword` | _Your new password_ | ||
### `equity.getToken(opts, callback)` | ||
Parameter | Description | ||
--- | --- | | ||
`username` | _Merchant Username, provided by Equity Bank_ | ||
`password` | _Merchant Password, provided by Equity Bank_ | ||
`grant_type` | _OAuth 2.0 Grant Type - must be 'password'_ | ||
## _Transaction API_ | ||
### `equity.purcahseAirtime(opts, callback)` | ||
Parameter | Description | ||
--- | --- | | ||
`mobileNumber` | _Mobile Number For Which To Purchase Airtime_ | ||
`amount` | _Airtime Amount_ | ||
`reference` | _Airtime Reference_ | ||
`telco` | _Network Provider_ | ||
### `equity.createPayment(opts, callback)` | ||
Parameter | Description | ||
--- | --- | | ||
`mobileNumber` | _Mobile Number For Which To PSend Money_ | ||
`amount` | _Amount_ | ||
`description` | _Transaction Description_ | ||
`type` | _Type_ | ||
`auditNumber` | _Audit Number_ | ||
### `equity.paymentStatus(opts, callback)` | ||
Parameter | Description | ||
--- | --- | | ||
`transactionId` | _TransactionId_ | ||
### `equity.onlineRemit(opts, callback)` | ||
Parameter | Description | ||
--- | --- | | ||
`transactionReference` | _Transaction Reference_ | ||
`senderName` | _Sender Name_ | ||
`accountNumber` | _Account Number_ | ||
`bicCode` | _BIC CODE_ | ||
`mobileNumber` | _Mobile Number_ | ||
`walletName` | _Wallet Name_ | ||
`bankCode` | _Bank Code_ | ||
`branchCode` | _Branch Code_ | ||
`countryCode` | _Country Code_ | ||
`currencyCode` | _Currency Code_ | ||
`amount` | _Ammount_ | ||
`paymentType` | _Payment Type_ | ||
`paymentReferences` | _Payment References_ | ||
`remarks` | _Remarks_ | ||
## Issues And Contribution | ||
Fork the repository and submit a pull request for whatever change you want to be added to this project. If you have any questions, just open an issue. |
Sorry, the diff of this file is not supported yet
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
132
6
56826
5
422