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

flutterwave

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flutterwave - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

examples/Compliance/flutterwave.bank.examples.md

63

lib/flw.account.js

@@ -9,9 +9,43 @@

var FlutterwaveAccount = function (FlutterwaveBase) {
var FlutterwaveAccount = function (FlutterwaveBase) {
/**
* Charge (for collecting payment from a bank account)
*
* @method charge
* @param {Object} paymentData {accountNumber, amountToPay, creditAccountNumber, trxref, narration, merchantid}
* @param {Function} callback
*/
this.charge = function (paymentData, callback) {
var requestParams = {};
paymentData.merchantid = FlutterwaveBase.getMerchantKey();
requestParams.data = FlutterwaveBase.validateAndEncryptParams(paymentData, this.endpointParamSpec('/accessbank/pay'), FlutterwaveBase.getMerchantAPIKey());
requestParams.method = 'POST';
return FlutterwaveBase.makeRequest('bank/pay', requestParams, callback);
}
/**
* Make payment using passed card data
* Validate (For validating pending transactions from a bank account)
*
* @method charge
* @param {Object} paymentData {accountToken, amountToPay, trxref}
* @param {Function} callback
*/
this.validate = function (paymentData, callback) {
var requestParams = {};
paymentData.merchantid = FlutterwaveBase.getMerchantKey();
requestParams.data = FlutterwaveBase.validateAndEncryptParams(paymentData, this.endpointParamSpec('/pay/validate'), FlutterwaveBase.getMerchantAPIKey());
requestParams.method = 'POST';
return FlutterwaveBase.makeRequest('bank/pay/validate', requestParams, callback);
}
/**
* Initiate (For setting up a bank account for recurrent payment)
*
* @method pay

@@ -21,3 +55,3 @@ * @param {String} accountNumber

*/
this.charge = function (accountNumber, callback) {
this.initiateRecurrentPayment = function (accountNumber, callback) {
var requestParams = {};

@@ -35,3 +69,3 @@ var paymentData = {};

/**
* Validate a payment
* Validate (For validating a bank account been setup for recurrent payment)
*

@@ -42,3 +76,3 @@ * @method validate

*/
this.validate = function (paymentData, callback) {
this.validateRecurrentAccount = function (paymentData, callback) {

@@ -55,15 +89,15 @@ var requestParams = {};

/**
* Resedn otp
* Charge (For charging a bank account that has been setup for recurrent payment)
*
* @method resendOtp
* @param {Object} paymentData {merchantid, validateoption, trxref}
* @method charge
* @param {Object} paymentData {merchantid, accountToken, billingamount, debitnarration}
* @param {Function} callback
*/
this.resendOtp = function (paymentData, callback) {
this.chargeRecurrentAccount = function (paymentData, callback) {
var requestParams = {};
paymentData.merchantid = FlutterwaveBase.getMerchantKey();
requestParams.data = FlutterwaveBase.validateAndEncryptParams(paymentData, this.endpointParamSpec('/pay/resendotp'), FlutterwaveBase.getMerchantAPIKey());
requestParams.data = FlutterwaveBase.validateAndEncryptParams(paymentData, this.endpointParamSpec('/account/charge'), FlutterwaveBase.getMerchantAPIKey());
requestParams.method = 'POST';
return FlutterwaveBase.makeRequest('accessbank/pay/resendotp', requestParams, callback);
return FlutterwaveBase.makeRequest('recurrent/account/charge', requestParams, callback);

@@ -90,3 +124,10 @@ }

specs['/account/charge'] = FlutterwaveBase.objectBuilder({})
.build('accountToken', 'required:true, encrypt:true')
.build('billingamount', 'required:true, encrypt:true')
.build('debitnarration', 'required:true, encrypt:true')
.build('merchantid', 'required:true, encrypt:false')
.end();
//Faulty SPECS

@@ -93,0 +134,0 @@ specs['/accessbank/pay'] = FlutterwaveBase.objectBuilder({})

6

lib/flw.card.js

@@ -15,3 +15,3 @@

* @method pay
* @param {Object} paymentData {amount, authmodel, cardno, currency, country, custid, cvv, [cardtype], expirymonth, expiryyear, merchantid, narration, responseurl }
* @param {Object} paymentData {amount, authmodel, cardno, currency, country, custid, cvv, [cardtype], expirymonth, expiryyear, merchantid, narration, [responseurl], [bvn], [pin] }
* @param {Function} callback

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

.build('narration', 'required:true, encrypt:true')
.build('responseurl', 'required:true, encrypt:true')
.build('responseurl', 'required:false, encrypt:true')
.build('bvn', 'required:false, encrypt:true')
.build('pin', 'required:false, encrypt:true')
.end();

@@ -167,0 +169,0 @@

{
"name": "flutterwave",
"version": "1.0.1",
"version": "1.0.2",
"description": "",

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

@@ -20,2 +20,5 @@ # Flutterwave Nodejs API Library

You can get your MerchantID and API_KEY from the dev dashboard. Go [here](https://www.flutterwavedev.com/signup/) if you don't have an account.
```

@@ -25,3 +28,2 @@ var Flutterwave = require('flutterwave');

var flutterwave = new Flutterwave(MerchantID, API_KEY);
/*

@@ -28,0 +30,0 @@ To call a flutter wave class (Code-name for API endpoint group) do :

@@ -8,9 +8,9 @@ 'use strict';

it('Should throw accountNumber is required error', function () {
it('Should throw accountToken is required error', function () {
var flutterwavebase = new flwBase('tk_NabYp2XjZ6G9WwdFruzK','tk_tdyrSMQo8a');
var flutterwaveaccount = new flwAccount(flutterwavebase);
function testAccountPay(){
flutterwaveaccount.charge(null, function () {});
flutterwaveaccount.chargeRecurrentAccount({}, function () {});
}
expect(testAccountPay).to.throw('accountNumber is required');
expect(testAccountPay).to.throw('accountToken is required');
});

@@ -23,7 +23,7 @@

var flutterwaveaccount = new flwAccount(flutterwavebase);
flutterwaveaccount.charge('0704580684', function (err, res, body) {
/*console.log*/(flutterwaveaccount.initiateRecurrentPayment('0690000001', function (err, res, body) { console.log(err,body);
expect(body).to.have.property('data');
expect(body.data.responseMessage).to.equal('SMS failed!');
done();
});
}));

@@ -30,0 +30,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