npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

intouch-api-wrapper

v1.0.4

Published

The Intouch Payment Library is a NodeJS library that provides a simple interface for making payments with mobile money service providers that are supported by the Intouch platform. This library handles the complexities of interacting with the Intouch API,

Downloads

17

Readme

Intouch NodeJs API Wrapper

This is a TypeScript library for the Intouch API. It provides an easy-to-use interface for integrating with the Intouch API in your NodeJs projects.

Intallation

To use this library, you will need to install the intouch-api-wrapper package from NPM.

npm i intouch-api-wrapper

Usage

To use this library, first import it and create an instance with your Intouch credentials:

require('dotenv').config()
const intouch = require('intouch-api-wrapper')

const intouchPayment = intouch.Intouch.credentials({
    username: process.env.DIGEST_AUTH_USE
    password: process.env.DIGEST_AUTH_PASSWORD ?? '',
    loginAgent: process.env.LOGIN_AGENT ?? '',
    passwordAgent: process.env.PASSWORD_AGENT ?? '',
    intouchId: process.env.INTOUCH_ID ?? '',
})

Checking your balance

const balance = await intouchPayment
  .operator(Intouch.SUPPORTED_OPERATORS[0])
  .partnerId(process.env.PARTNER_ID ?? '')
  .getBalance();

// retrieve balance amount

balance.then((res)=>{
    console.log(res.amount)
    // Response
    // {
    // "status": null,
    // "amount": 988750,
    // "errorCode": "200",
    // "errorMessage": "SUCCESSFUL"
    // }
}).catch((err)=>{
    // Something went wrong !
    console.log(err)
})


Make merchant payment

const additionnalInfos = {
    recipientEmail: "[email protected]",
    recipientFirstName: "John",
    recipientLastName: "Doe",
}

const merchantPayment = await intouchPayment.callback("https://app.test")
  .partnerId("YOUR_PARTNER_ID")
  .operator('ORANGE')
  .phone('695xxxx0x')
  .amount(500)
  .makeMerchantPayment(additionnalInfos);
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.log(err))

// Response
// {
//    "idFromClient": "1679582194250",
//    "idFromGU": "1679582196117",
//    "amount": 1575.0,
//    "fees": 3.75,
//    "serviceCode": "CM_PAIEMENTMARCHAND_OM_TP",
//    "recipientNumber": "695xxxx0x",
//    "dateTime": 1679582196117,
//    "status": "INITIATED",
//    "numTransaction": "MP230323.1536.Bxxxxx",
//    "payment_url": null,
//    "codeMarchand": null,
//    "qrCode": null,
//    "validity": null,
//    "deepLink": null
// }