iso_8583 v0.1.5 ISO8583.DataTypes
This module provides utilities for validation ISO 8583
field data types based the description below pulled
from a postilion interface documentation. Each character gets validated against the regex that defines each fata type.
a
- Alphabetic characters,A
throughZ
and a throughz
n
- Numeric digits,0
through9
p
- Pad character, spaces
- Special characters, i.e. other printablean
- Alphabetic and numeric charactersas
- Alphabetic and special charactersns
- Numeric and special charactersanp
- Alphabetic, numeric and pad charactersans
- Alphabetic, numeric and special charactersx
C
for credit,D
for debit, always associated with a numeric amount field, i.e.x+n16
means a prefix ofC
orD
followed by16
numeric characters.b
- Binary representation of dataz
-Track 2
as defined inISO 7813
Link to this section Summary
Functions
Function to validate the data type in a field, returns true
if all characters in a field matches the type otherwize return false
Link to this section Functions
Link to this function
check_data_length(field, data, format)
Link to this function
valid?(field, string_data, format)
Function to validate the data type in a field, returns true
if all characters in a field matches the type otherwize return false
Examples
iex> DataTypes.valid?("2", "440044444444444", ISO8583.Formats.format(:"2"))
true
iex> DataTypes.valid?("2", "440044444444444R", ISO8583.Formats.format(:"2"))
{:error, "While processing field 2 data provided is not of type 'n'"}
iex> DataTypes.valid?("2", "44004444444444499999999", ISO8583.Formats.format(:"2"))
{:error, "Invalid length of data on field 2, expected maximum of 19 , found 23"}