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

@micham/iso8583

v1.0.4

Published

Implementation ISO8583 parser

Downloads

1,988

Readme

iso8583-typescript

A TypeScript implementation of an ISO 8583 parser.

license codecov Build Status

Introduction

ISO 8583 is a messaging standard used by financial institutions to exchange data between systems. It is widely used for electronic payment transactions, such as ATM withdrawals and credit card purchases. The standard defines a message format and communication protocol for exchanging financial transaction data, and is used by thousands of financial institutions worldwide.

Description

iso8583-typescript is a TypeScript implementation of an ISO 8583 parser that provides a few codec and examples on how to handle different types of data. The library is fully typed, making it easy to integrate with TypeScript-based applications and libraries.

Table of Contents

Requirements

To use this library, you'll need the following:

  • Node.js version 16 or later
  • npm or yarn package manager

Getting Started

To get started with iso8583-typescript, follow these steps:

  1. Install the library using npm or yarn:
npm install @micham/iso8583
yarn add @micham/iso8583
  1. Create a MessageDefinition object that describes the fields present in your ISO 8583 messages and serves as the base of the parser:
import { createFieldDefinition } from '@micham/iso8583';
import { N, LLVAR_N } from '@micham/iso8583/lib/fields';

export const IsoDefinition = createFieldDefinition({
  fields: {
    '2': { name: 'PAN', field: LLVAR_N },
  },
  mtiField: N({ length: 4 }),
});

The above example represents an ISO message that only consists of one field (Field 2). That is encoded as a LLVAR_N. This is a 2-byte variable-length numeric field. This means that in the ISO message, you will have two bytes that should be parsed as an integer first to understand the length of the field itself as x. The succeeding x bytes are then parsed as a number (padded on the right with zeros).

  1. Use the MessageDefinition object to parse and write ISO messages:
import { parse, prepare, printMessage } from '@micham/iso8583';

const buffer = Buffer.from('xxxxx'); // A buffer to your ISO message
const message = parse(IsoDefinition, buffer);
console.log(printMessage(message));
const result = prepare(IsoDefinition, message);

Alternatively, you can use the MessageDefinition object directly to parse and write ISO messages:

const buffer = Buffer.from('xxxxx'); // A buffer to your ISO message
const message = IsoDefinition.parse(buffer);
console.log(message.show());
const result = IsoDefinition.prepare(message);

For more information, check out the documentation.

Contributing

Contributions are welcome! If you have an improvement or feature you'd like to see added to this library, please follow these steps:

  • Fork this repository and create a new branch.
  • Make your changes and write tests to ensure they work as expected.
  • Ensure all tests pass by running npm test.
  • Update the README.md with any new features or changes to the library's behavior.
  • Submit a pull request with your changes.

Development

To get started with development, clone the repository and install the dependencies with npm install.

git clone https://github.com/MollardMichael/iso8583-typescript.git
cd iso8583-typescript
npm install

To build the project, run npm run build. This will build the project to the dist directory.

To run the tests, run npm test. This will run the test suite and output the results to the console.

Reporting Bugs

If you find a bug or issue with the library, please open an issue on the GitHub repository with a clear and detailed description of the problem. Please include any relevant code or logs that can help reproduce the issue.

Pull Requests

When submitting a pull request, please ensure that your code adheres to the project's coding standards and that all tests pass. If your pull request adds new functionality, please also include tests for that functionality.

License

This project is licensed under the MIT License - see the LICENSE file for details.