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

@calculusky/ikeja-electric-sdk

v1.0.8

Published

Ikeja Electric SDK for Nodejs

Downloads

15

Readme

Ikeja Electric SDK for Nodejs

The SDK is a light weight package that exposes friendly interface for interacting with Ikeja Electric SOAP API and FTP Servers in your integration. It currently support the below functionalities:

  • Confirm Details: Confirm meter number or account number for both prepaid and postpaid customers.
  • Purchase Credit: Purchase credit for both prepaid and postpaid customers.
  • Reprint: Query for the last 3 valid credit purchase via the account number or meter number.
  • RetrieveDetails: Query for the valid credit purchase transactions in a specified time period with 2 days maximum range.
  • Acknowledge: Acknowledge either a successful or failed payment transaction from vending client end
  • Notify Auto Reconciliation: Notify auto reconciliation after a successful upload of the daily transaction reconciliation file.
  • Reconciliation File Upload: Uploads the daily transaction reconciliation file to the FTP server.

Installation

pnpm install @calculusky/ikeja-electric-sdk
#or
npm install @calculusky/ikeja-electric-sdk
#or
yarn add @calculusky/ikeja-electric-sdk

Usage

First, obtain your API and FTP credentials and initialize the SDK.

Examples

CommonJS Usage

Note: In order to gain the TypeScript typings (for intellisense / autocomplete) while using CommonJS, use require().default as seen below:

const IkejaElectric = require("@calculusky/ikeja-electric-sdk").default;

Typescript Usage

import IkejaElectric from "@calculusky/ikeja-electric-sdk";

const ie = new IkejaElectric({
    appId: "YOUR_APPID",
    cisPassword: "YOUR_PASSWORD",
    sftpPassword: "YOUR_FTP_PASSWORD",
    sftpUsername: "YOUR_SFTP_USERNAME",
    cisHost: "YOUR_CIS_HTTP_HOST",
    cisPort: "YOUR_CIS_HTTP_PORT",
    sftpHost: "YOUR_SFTP_HOST",
    sftpPort: "YOUR_SFTP_PORT",
    config: {
        mode: "development", //values: development or production
    },
});

Note: For sandbox/development environment, set the mode in the config options above to development and pass the development options.

API

Confirm Details

Confirm meter number or account number for a prepaid or postpaid account. This will also retrieve the information associated to the account.

const details = await ie.power.confirmDetails({
    type: "MN",
    requestNO: "6745548846",
});
console.log(details);

Purchase Credit

Purchase credit after a successful account confirmation. To trigger acknowledgement automatically on a successful purchase, set the acknowledge option to true. Default is false.

const response = await ie.power.purchaseCredit(
    {
        kind: "PREPAY",
        accountType: "MD",
        amountTendered: 45000,
        orderNO: "20210910093045123001000001",
        paidType: "POS",
        requestNO: "6745548846",
    },
    { acknowledge: true },
);
console.log(response);

Reprint

const data = await ie.power.reprint({
    type: "MN",
    requestNO: "6745548846",
    orderNO: "20210910093045123001000001", //optional
});

console.log(data);

Retrieve Details Retrieve transaction details

const result = await ie.power.retrieveDetails({
    beginDate: "20210905",
    endDate: "20210906",
    orderNO: "20210910093045123001000001",
});

console.log(result);

Acknowledge

await ie.power.acknowledge({
    amountTendered: 45000,
    orderNO: "20210910093045123001000001",
    purchaseStatus: "SUCCESS",
    receiptNO: "210918123456",
});

Upload reconciliation file

This method provides the interface to upload reconciliation file to the sftp server. It also has a notify option. When the notify option is set, the interface automatically triggers the notify-auto-reconciliation service after a successful file upload. Default is false.

  const response = await ie.reconciler.uploadReconciliationFile({
            firstRow: {
                totalAmount: 8500,
                totalRecord: 5,
                transactionStartDate: "20220717",
                transactionEndDate: "20220717",
            },
            records: [
                {
                    amountTendered: 2000,
                    kind: "PREPAY",
                    orderNO: "20210910093045123001000001",
                    paidType: "POS",
                    receiptNO: "210918123456",
                    requestNO: "6745548846",
                    transactionDate: "20210917093045",
                },
                ...
            ],
       }, { notify: true },);

        console.log(response)

Notify Auto Reconciliation

This method provides the functionality to manually notify the CIS Server after a successful reconciliation file upload. Note: This method is called immediately after the uploadReconciliationFile method runs with the notify options set to false.

await ie.reconciler.notifyAutoReconciliation();