Skip to content

lestoni/hellocash-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hello Cash API Node Client

WIP

Hello Cash API NodeJS Client

Made in Africa

Install

Requires NodeJS 8+

  npm install hellocash-node --save

Pre-Usage

You need the following before getting to use this library:

  1. Password
  2. Internal user id, phone number or agent id.

Basic Usage

const HelloCash = require('hellocash-node')
const helloCash = new HelloCash();

await helloCash.authenticate({
  principal: '251xxxxxxxxx',
  credentials: 'password',
  system: 'lucy'
});

let res = await helloCash.airtimeTransfer({
  amount: 100,
  to: '251xxxxxxxxxxx'
});

API

  1. Authenticate

Authenticate a user with username and password. Returns a Bearer API token. The API token must be passed as header with Authorization: Bearer on all subsequent accesses to the api.

let authInfo = await helloCash.authenticate({
  principal: '251xxxxxxxxx',
  credentials: 'password',
  system: 'lucy'
});
  1. Password Change

Change a user's password. Returns a Bearer API token on successful change.

await helloCash.password({
  principal: '251xxxxxxxxx',
  old_password: 'old',
  new_password: 'new',
  system: 'lucy'
});
  1. Accounts

Finds a list of accounts visible.

let accounts = await helloCash.visibleAccounts();
  1. Account

Find an accounts .

let account = await helloCash.findAccount('xxxxxxxxxxxxxxx');
  1. Airtime Transfer

Create a new Airtime transfer. The Airtime transfer will be attempted and may have several possible states.

let res = await helloCash.airtimeTransfer({
  amount: 100,
  to: '251xxxxxxxxxxx'
});
  1. Airtime Transfer

Validate if an airtime topup can be made.

let res = await helloCash.validateAirtime({
  amount: 100,
  to: '251xxxxxxxxxxx'
});
  1. Airtime Amounts

Returns a list of amonts, which are currently available topup amounts in the system.

let amounts = await helloCash.airtimeAmounts();
  1. Airtime Transfers

Finds a list of airtime transfers to and from this account.

let amounts = await helloCash.airtimeTransfers({
  offset: 10,
  limit: 100,
  status: 'PREPARED'
});

License

MIT

Releases

No releases published

Packages

No packages published