Code Monkey home page Code Monkey logo

iso8583's Introduction

Version: 0.3

ISO8583

This package can generate and parse messages in the ISO8583 standard.

Installation

composer require leandroandreaci/iso8583

Using

  • Each new instance of the parser requires a class containing the iso message definitions.
<?php


namespace Andromeda\ISO8583;

use Andromeda\ISO8583\Contracts\IsoMessageContract;
use Andromeda\ISO8583\MessageDefinition;

class ExampleMessage extends MessageDefinition implements IsoMessageContract
{
    public function getIso(): array
    {
        return [
            1   => ['b',   32,  self::FIXED_LENGTH],
            2   => ['ans',  99,  self::VARIABLE_LENGTH],
            3   => ['n',   6,   self::FIXED_LENGTH],
            4   => ['n',   12,  self::FIXED_LENGTH],
            5   => ['n',   12,  self::FIXED_LENGTH],
            6   => ['n',   12,  self::FIXED_LENGTH],
            7   => ['an',  10,  self::FIXED_LENGTH],
         ];
    }
}

/*
    Array definition:
    1   => ['b',   32,  self::FIXED_LENGTH],
    bit => ['type','size','is variable or fixed']
*/
  • Example to read a ISO8583 using a ExampleMessage in package.
$messageDefinition = new \Andromeda\ISO8583\ExampleMessage();
$parser = new \Andromeda\ISO8583\Parser($messageDefinition);

//Example 01 
$parser->addMessage('0800...');
$parser->validateISO(); //return false

//Example 02
$parser->addMessage('0800A238000000C0000804000000000000000000010401000443495194000443040176007008043177567000140003001000');
$parser->validateISO(); //return true
$parser->getBit('07');  //return 0401000443
  • Example to make a ISO8583 using a ExampleMessage in package.
$message = new \Andromeda\ISO8583\ExampleMessage();
$isoMaker = new \Andromeda\ISO8583\Parser($message);
$isoMaker->addMTI('0800');
$isoMaker->addData(3, '123456');
$isoMaker->addData(4, '000000001000');
$isoMaker->addData(7, '1234567890');
$isoMaker->getISO(); // return 080032000000000000001234560000000010001234567890

iso8583's People

Contributors

leandreaci avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.