3.1.2 • Published 4 years ago

mazzuma-node-library v3.1.2

Weekly downloads
1
License
ISC
Repository
github
Last release
4 years ago

Mazzuma Node.js Library

NPM

Open Source Love svg2 Maintenance MIT license Open Source Love svg2

The Mazzuma Node library provides convenient access to the mazzuma API from applications written in server-side JavaScript

Please keep in mind that this package is for use with server-side Node that use a mazzuma API key. In order to get this API key you must have an account with Mazzuma

Installation

 npm install mazzuma-node-library --save

Usage

The package needs to be configured with your account's API key which is available in your dashboard.

Initializing package

var Mazzuma = require("mazzuma-node-library");
var Maz = new Mazzuma.Mazzuma(APIKEY);

OR

import Mazzuma from "mazzuma-node-library";
var Maz = new Mazzuma.Mazzuma(APIKEY);

Making a payment request

Maz
  .makePaymentRequest({
    price: 1,
    sender_network: Maz.SENDER_NETWORK.MTN,
    recipient_number: "0205555555",
    sender_number: "024444444",
    payment_network_flow: Maz.PAYMENT_NETWORK_FLOW.MTN_TO_VODAFONE,
    orderID: "348967533"
  })
  .then(response => {
    console.log(response);
    //{"code":1,"status":"success","id":"XXXXX"}
  })
  .catch(error => {
    console.error(`Error: ${error}`);
  });

Checking transaction status

Maz
  .checkTransactionStatus("234322")
  .then(response => {
    console.log(response);
    // {"code":200,"id":"XXXXX","status":"Successful"}
    // {"code":200,"id":"XXXXX","status":"Failed"}
    // {"code":200,"id":"XXXXX","status":"Pending"}
  })
  .catch(error => {
    console.error(`Error: ${error}`);
  });

Generating orderID

Maz.generateOrderId(length);

length = length of IDs

Requests CONSTANTS

To specify the sender's network, these constants are available

ConstantsNetwork
SENDER_NETWORK.MTNMTN
SENDER_NETWORK.VODAFONEVodafone
SENDER_NETWORK.TIGOTIGO

To specify the network payment flow , these constants are available

ConstantsDescription
PAYMENT_NETWORK_FLOW.MTN_TO_MTNMTN to MTN
PAYMENT_NETWORK_FLOW.MTN_TO_TIGOMTN to Tigo
PAYMENT_NETWORK_FLOW.MTN_TO_VODAFONEMTN to Vodafone
PAYMENT_NETWORK_FLOW.TIGO_TO_MTNTigo to MTN
PAYMENT_NETWORK_FLOW.TIGO_TO_TIGOTigo to Tigo
PAYMENT_NETWORK_FLOW.TIGO_TO_VODAFONETigo to Vodafone
PAYMENT_NETWORK_FLOW.VODAFONE_TO_MTNVodafone to MTN
PAYMENT_NETWORK_FLOW.VODAFONE_TO_TIGOVodafone to Tigo
PAYMENT_NETWORK_FLOW.VODAFONE_TO_VODAFONEVodafone to Vodafone

Todo

  • Write Tests

Change log

License

MIT

Me

Want to say hi? Will be happy to hear from you

3.1.2

4 years ago

3.1.1

4 years ago

3.1.0

4 years ago

3.0.0

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago