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

nodejs-maib

v1.0.0

Published

MAIB Payment Gateway for Node.js

Downloads

203

Readme

MAIB Payment Gateway for Node.js

Table of Contents

Installation

Get started by installing the package:

npm install --save nodejs-maib

Usage

Setup

First, require the package in your file:

const MAIB = require('nodejs-maib');

Then, instantiate the class providing the cert file and passphrase:

const maib = new MAIB('certificate_path', 'certificate_pass', 'merchanthandler_endpoint');

Test certificate: 0149583.pem

Password: Za86DuC$

Test MerchantHandler URL: https://maib.ecommerce.md:21440/ecomm/MerchantHandler

Test ClientHandler URL: https://maib.ecommerce.md:21443/ecomm/ClientHandler

Use openssl to convert certificate in .pem format from .pfx and password provided by bank:

openssl pkcs12 -in certificate.pfx -out certificate.pem -nodes

You can now start working with the payment gateway.

Create SMS Transaction


const smstrans = async function() {
  const result = await maib
  .setDescription('Test Transaction')
  .setClientIpAddress('127.0.0.1')
  .setLanguage('ro')
  .setCurrency(498)
  .setAmount(1)
  .createTransaction();
  
console.log(result);
 }
smstrans();

/*
{
  TRANSACTION_ID: 'TRANSACTION_ID_HERE'
}
*/

To enter card details redirect transaction ID to ClientHandler URL. Ex:

https://maib.ecommerce.md:21443/ecomm/ClientHandler?trans_id=rEsfhyIk8s9ypxkcS9fjo3C8FqA=

Create DMS Transaction


const dmstrans = async function() {
  const result = await maib
  .setDescription('Test Transaction')
  .setClientIpAddress('127.0.0.1')
  .setLanguage('ro')
  .setCurrency(498)
  .setAmount(1)
  .createTransaction(type = 'DMS');
  
console.log(result);
}
dmstrans();

/*
{
  TRANSACTION_ID: 'TRANSACTION_ID_HERE'
}
*/

To enter card details redirect transaction ID to ClientHandler URL.

Commit DMS Transaction

const commitdms = async function() {
const result = await maib
  .setDescription('Test Transaction')
  .setClientIpAddress('127.0.0.1')
  .setCurrency(498)
  .setAmount(1)
  .commitTransaction('TRANSACTION_ID_HERE');
  
console.log(result);
}
commitdms();

/*
{
  RESULT: '...',
  RESULT_CODE: '...',
  RRN: '...',
  APPROVAL_CODE: '...',
  CARD_NUMBER: '...'
}
*/

Transaction Status

const status = async function() {
const result = await maib.getTransactionStatus('TRANSACTION_ID_HERE');

console.log(result);
}
status();

/*
{
  RESULT: '...',
  RESULT_CODE: '...',
  3DSECURE: '...',
  RRN: '...',
  APPROVAL_CODE: '...',
  CARD_NUMBER: '...'
  RECC_PMNT_ID: '...'
  RECC_PMNT_EXPIRY: '...'
  MRCH_TRANSACTION_ID: '...'
}
*/

Reverse Transaction

const revers = async function() {
const result = await maib
  .setAmount(1)
  .reverseTransaction('TRANSACTION_ID_HERE');
  
console.log(result);
}
revers();

/*
{
  RESULT: '...',
  RESULT_CODE: '...',
}
*/

Close Day

const closeday = async function() {
const result = await maib.closeDay();

console.log(result);
}
closeday();

/*
{
  RESULT: '...',
  RESULT_CODE: '...',
  FLD_074: '...',
  FLD_075: '...',
  FLD_076: '...',
  FLD_077: '...',
  FLD_086: '...',
  FLD_087: '...',
  FLD_088: '...',
  FLD_089: '...',
}
*/

Card Registration

const cardregist = async function() {
const result = await maib
  .setCurrency(498)
  .setClientIpAddress('127.0.0.1')
  .setDescription('Card Registration Test')
  .registerCard('CARD_ID');
  
console.log(result);
}
cardregist();

/*
{
  TRANSACTION_ID: '...',
}
*/

To enter card details redirect transaction ID to ClientHandler URL.

Regular Payments

const regularpayment = async function() {
const result = await maib
  .setCurrency(498)
  .setClientIpAddress('127.0.0.1')
  .setDescription('Regular Payment Test')
  .setAmount(1)
  .makeRegularPayment('CARD_ID');
  
console.log(result);
}
regularpayment();

/*
{
  TRANSACTION_ID: '...',
  RESULT: '...',
  RESULT_CODE: '...',
  RRN: '...',
  APPROVAL_CODE: '...',
}
*/

Delete Regular Payment

const deleterec = async function() {
const result = await maib
  .deleteRegularPayment('CARD_ID');

console.log(result);
}
deleterec();

/*
{
  RESULT: '...',
}
*/