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

payroc_ibx

v0.9.4

Published

This is an SDK for transaction processing with IBX gateway

Downloads

9

Readme

IBX SDK for NodeJS

As a quick helper for our NodeJS community to get up and running even faster in your favorite dependency manager, we have created this API / SDK wrapper specifically tailored for NodeJS and Express.

More details at IBX Developer API

Features

Usage

If there is a platform you would like to see in addition to npm for dependency management, let us know.

NPM Install

Run the following command at the root fo your project

npm install ibx-node

IBX SDK on NPM

Manual Install

Download the zip, or use git submodules to pull the SDK into your project.

Import Example

Here is an example implementation:

(see /examples for more)

DIY Example without IBX SDK

DIY Example

Post transaction with IBX SDK

"use strict";
const ibx = require('payroc_ibx');
const util = require('util');
const xml2js = require('xml2js').Parser({explicitArray:false});

// You can use your own JSON Model, or use the included models.
const cardData = new ibx.cardDataModel();
cardData.name = 'Barney Rubble';
cardData.number = '4242424242424242';
cardData.cvv = '999';
cardData.exp_month = '12';
cardData.exp_year = '20';

// Address is optional, unless using loopback /sandbox / demo account.
const addressData = new ibx.addressDataModel();
addressData.postal_code = '84025';

const metaData = new ibx.metaDataModel();
metaData.email = "[email protected]";

let payload = new ibx.storeCardPayloadModel();
payload.amount = '1000';
payload.card = cardData;
payload.address = addressData;


let myReportingCallback = function (response) {
    // Do something with response here
    console.log(util.inspect(response, false, null, true))
}

let myPaymentCallback = function (response) {
    // Do something with response here
    console.log(util.inspect(response, false, null, true))
    payload = new ibx.batchPayloadModel();
    ibx.openBatchSummary(payload, myReportingCallback);
}

// If you want to post a card transaction
let myCallback = function (response) {

    if (response.error) {
        console.log(util.inspect(response.error, false, null, true))
        return;
    }

    // Do something with response here
    console.log(util.inspect(response, false, null, true))

    payload = new ibx.processCardPayloadModel();

    payload.token = response.ExtData.CardSafeToken;
    payload.amount = (Math.random() * 100).toFixed(2).toString();
    payload.transaction_type = 'sale';
    payload.ext_data = '';

    ibx.processCard(payload, myPaymentCallback);
};

ibx.setAuth(process.env.TEST_USERNAME, process.env.TEST_PASSWORD);
ibx.setEnv(ibx.environments.SANDBOX);
ibx.storeCard(payload, myCallback); // That's it!

Example Response

Example successful processCard using the example above will return the following JSON object as a response:

{
    "$": {
    "xmlns:xsd": "http://www.w3.org/2001/XMLSchema",
     "xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
     "xmlns": "https://gw-v1.ibxpays.com/ws"
    },
    "Result": "0",
    "RespMSG": "Approved",
    "Message": "Approval - Approved and completed",
    "Message1": "",
    "Message2": "",
    "AuthCode": "TAS105",
    "PNRef": "104296",
    "HostCode": "000000000000147",
    "HostURL": "",
    "GetAVSResult": "N",
    "GetAVSResultTXT": "No Match",
    "GetStreetMatchTXT": "No Match",
    "GetZipMatchTXT": "No Match",
    "GetGetOrigResult": "",
    "GetCommercialCard": "False",
    "ExtData": {
        "CardType": "VISA",
        "LastFour": "4242",
        "ExpDate": "1220",
        "BatchNum": "128"
    }
}

Check out the files in /examples for other ideas for implementation.

Testing

Try Payroc IBX SDK on RunKit

Unit tests on this project are run using Mocha. You can find each test in the /test folder.

After doing an npm install mocha, and chai will be available to run using the following command.

npm test

Alternative Methods:

npm test-report
npm test-check-coverage
./node_modules/.bin/mocha --reporter spec