iso8583

package
Version: v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	V1         = "V1"
	V0         = "V0"
	IsoMsg1100 = "1100"
	IsoMsg1110 = "1110"
	IsoMsg1420 = "1420"
	IsoMsg1430 = "1430"
	IsoMsg1804 = "1804"
	IsoMsg1814 = "1814"

	IsoRespDecline  = "100"
	IsoRespPickup   = "200"
	IsoRespApproval = "000"
	IsoFormatError  = "909"
	IsoRespDrop     = "999"
)

Variables

This section is empty.

Functions

func CopyRequestToResponse

func CopyRequestToResponse(isoReq *Iso8583Message, isoResp *Iso8583Message)

copy all data from request to response message

func GetSpecNames

func GetSpecNames() []string

GetSpecNames returns names of all available specs

func ReadDemoSpecDefs

func ReadDemoSpecDefs()

func ReadSpecDefs

func ReadSpecDefs(fileName string)

func ReadSpecDefsFromBuf

func ReadSpecDefsFromBuf(buf *bytes.Buffer)

Types

type BitMap

type BitMap struct {
	// contains filtered or unexported fields
}

func NewBitMap

func NewBitMap() *BitMap

func (*BitMap) Bytes

func (bmp *BitMap) Bytes() []byte

func (*BitMap) Def

func (bmp *BitMap) Def() string

func (*BitMap) GetId

func (bmp *BitMap) GetId() int

func (*BitMap) IsOn

func (bmp *BitMap) IsOn(pos int) bool

check if the bit at position 'pos' is set as 1

func (*BitMap) Parse

func (bmp *BitMap) Parse(isoMsg *Iso8583Message, buf *bytes.Buffer)

func (*BitMap) SetId

func (bmp *BitMap) SetId(id int)

func (*BitMap) SetOff

func (bmp *BitMap) SetOff(pos int)

func (*BitMap) SetOn

func (bmp *BitMap) SetOn(pos int)

func (*BitMap) SetSpec

func (bmp *BitMap) SetSpec(isoMsgDef *MessageDef)

type BitmappedField

type BitmappedField interface {
	Parse(isoMsg *Iso8583Message, buf *bytes.Buffer)
	IsOn(int) bool
	SetOn(int)
	SetOff(int)
	SetId(int)
	GetId() int
	SetSpec(isoMsgDef *MessageDef)
	Bytes() []byte
	Def() string
}

type FieldAttributes

type FieldAttributes struct {
	DataEncoding           string
	FieldLength            int
	Key                    bool
	FieldIndicatorLength   int
	FieldIndicatorEncoding string
	Padding                string
}

type FieldData

type FieldData struct {
	// contains filtered or unexported fields
}

func (*FieldData) BitmapDef

func (fldData *FieldData) BitmapDef() *BitMap

func (FieldData) Bytes

func (fldData FieldData) Bytes() []byte

return the raw data associated with this field it will also include any ll portions for a variable field

func (*FieldData) Def

func (fldData *FieldData) Def() IsoField

func (*FieldData) SetData

func (fldData *FieldData) SetData(value string)

SetData sets field data as per the encoding additional padding will be applied if required

func (FieldData) String

func (fldData FieldData) String() string

type FieldDefExp

type FieldDefExp struct {
	BitPosition int
	Name        string
	JsSafeName  string
	Data        string
	Id          int
}

FieldDefExp represents the ISO8583 field information required to be sent as JSON to paysim application

func GetSpecLayout

func GetSpecLayout(specName string) []*FieldDefExp

GetSpecLayout returns all fields associated with a spec

type FixedFieldDef

type FixedFieldDef struct {
	// contains filtered or unexported fields
}

func NewFixedFieldDef

func NewFixedFieldDef(pName string, pDataEncoding int, pFieldLen int) *FixedFieldDef

create a new fixed field definition

func (*FixedFieldDef) Assemble

func (fieldDef *FixedFieldDef) Assemble(isoMsg *Iso8583Message, buf *bytes.Buffer)

add the field data into buf as per the encoding

func (*FixedFieldDef) BitPosition

func (fieldDef *FixedFieldDef) BitPosition() int

func (*FixedFieldDef) DataLength

func (fieldDef *FixedFieldDef) DataLength() int

func (*FixedFieldDef) Def

func (fieldDef *FixedFieldDef) Def() string

func (*FixedFieldDef) EncodedLength

func (fieldDef *FixedFieldDef) EncodedLength(dataLen int) []byte

func (*FixedFieldDef) GetId

func (fieldDef *FixedFieldDef) GetId() int

func (*FixedFieldDef) IsFixed

func (fieldDef *FixedFieldDef) IsFixed() bool

func (*FixedFieldDef) Parse

func (fieldDef *FixedFieldDef) Parse(
	isoMsg *Iso8583Message,
	fData *FieldData,
	buf *bytes.Buffer) *FieldData

parse and return field data by reading appropriate bytes from the buffer buf

func (*FixedFieldDef) SetBitPosition

func (fieldDef *FixedFieldDef) SetBitPosition(id int)

func (*FixedFieldDef) SetId

func (fieldDef *FixedFieldDef) SetId(id int)

func (*FixedFieldDef) String

func (fieldDef *FixedFieldDef) String() string

type Iso8583Message

type Iso8583Message struct {
	// contains filtered or unexported fields
}

func NewIso8583Message

func NewIso8583Message(specName string) *Iso8583Message

func (*Iso8583Message) Bitmap

func (isoMsg *Iso8583Message) Bitmap() *BitMap

func (*Iso8583Message) Bytes

func (isoMsg *Iso8583Message) Bytes() []byte

func (*Iso8583Message) Dump

func (isoMsg *Iso8583Message) Dump() string

create a string dump of the iso message

func (*Iso8583Message) Field

func (isoMsg *Iso8583Message) Field(pos int) (*FieldData, error)

func (*Iso8583Message) GetBinaryBitmap

func (isoMsg *Iso8583Message) GetBinaryBitmap() string

GetBinaryBitmap returns the 'Bitmap' as binary string

func (*Iso8583Message) GetFieldByName

func (isoMsg *Iso8583Message) GetFieldByName(name string) *FieldData

set field

func (*Iso8583Message) GetFieldData

func (isoMsg *Iso8583Message) GetFieldData(position int) (data string, err error)

GetFieldData returns the data associated with the 'position' in the iso_msg

func (*Iso8583Message) GetFieldDataById

func (isoMsg *Iso8583Message) GetFieldDataById(id int) *FieldData

func (*Iso8583Message) GetMessageType

func (isoMsg *Iso8583Message) GetMessageType() string

GetMessageType returns the 'Message Type' as string

func (*Iso8583Message) IsSelected

func (isoMsg *Iso8583Message) IsSelected(position int) bool

IsSelected returns a boolean indicating if the 'position' is selected in the bitmap

func (*Iso8583Message) Parse

func (isoMsg *Iso8583Message) Parse(buf *bytes.Buffer) (err error)

parse the bytes from 'buf' and populate 'Iso8583Message'

func (*Iso8583Message) SetData

func (isoMsg *Iso8583Message) SetData(data []string)

SetData sets data into individual fields by id

func (*Iso8583Message) SetField

func (isoMsg *Iso8583Message) SetField(pos int, value string)

set field

func (*Iso8583Message) SetFieldData

func (isoMsg *Iso8583Message) SetFieldData(id int, fieldVal string)

func (*Iso8583Message) SpecName

func (isoMsg *Iso8583Message) SpecName() string

SpecName returns the name of the specification for this message

func (*Iso8583Message) TabularFormat

func (isoMsg *Iso8583Message) TabularFormat() *list.List

create a string dump of the iso message

func (*Iso8583Message) ToWebMsg

func (isoMsg *Iso8583Message) ToWebMsg(isReq bool) *WebMsgData

type IsoField

type IsoField interface {
	Parse(*Iso8583Message, *FieldData, *bytes.Buffer) *FieldData
	Assemble(*Iso8583Message, *bytes.Buffer)
	String() string
	IsFixed() bool
	SetId(int)
	GetId() int
	DataLength() int
	EncodedLength(int) []byte

	Def() string

	BitPosition() int
	SetBitPosition(int)
	// contains filtered or unexported methods
}

type JsonFieldDef

type JsonFieldDef struct {
	BitPosition int
	Name        string
	Type        string
	Attrs       FieldAttributes
	Children    []JsonFieldDef
}

JsonFieldDef represents the definition of a field in the specs.json file

type JsonSpecDef

type JsonSpecDef struct {
	SpecName string
	Fields   []JsonFieldDef
}

JsonSpecDef represents the definition of a field in the specs.json file

type JsonSpecDefs

type JsonSpecDefs struct {
	Specs []JsonSpecDef
}

type MessageDef

type MessageDef struct {
	// contains filtered or unexported fields
}

func GetMessageDefByName

func GetMessageDefByName(specName string) *MessageDef

GetMessageDefByName returns a spec definition for the given spec_name

func GetSpecs

func GetSpecs() []*MessageDef

GetSpecs returns all available specs

func (*MessageDef) Name

func (isoDef *MessageDef) Name() string

type VariableFieldDef

type VariableFieldDef struct {
	// contains filtered or unexported fields
}

func NewVariableFieldDef

func NewVariableFieldDef(pName string,
	pLenEncoding int,
	pDataEncoding int,
	pLenIndSize int) *VariableFieldDef

create a new fixed field definition

func (*VariableFieldDef) Assemble

func (field *VariableFieldDef) Assemble(isoMsg *Iso8583Message, buf *bytes.Buffer)

add the field data into buf as per the encoding

func (*VariableFieldDef) BitPosition

func (field *VariableFieldDef) BitPosition() int

func (*VariableFieldDef) DataLength

func (field *VariableFieldDef) DataLength() int

func (*VariableFieldDef) Def

func (field *VariableFieldDef) Def() string

func (*VariableFieldDef) EncodedLength

func (field *VariableFieldDef) EncodedLength(dataLen int) []byte

return the length part of the variable field as a []byte slice

func (*VariableFieldDef) GetId

func (field *VariableFieldDef) GetId() int

func (*VariableFieldDef) IsFixed

func (field *VariableFieldDef) IsFixed() bool

func (*VariableFieldDef) Parse

func (field *VariableFieldDef) Parse(
	isoMsg *Iso8583Message,
	fData *FieldData,
	buf *bytes.Buffer) *FieldData

func (*VariableFieldDef) SetBitPosition

func (field *VariableFieldDef) SetBitPosition(id int)

func (*VariableFieldDef) SetId

func (field *VariableFieldDef) SetId(id int)

func (*VariableFieldDef) String

func (field *VariableFieldDef) String() string

type WebMsgData

type WebMsgData struct {
	Spec      string
	Type      string
	DataArray []string
}

To send data back and forth between browser and paysim application

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL