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,AthroughZand a throughzn- Numeric digits,0through9p- 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 charactersxCfor credit,Dfor debit, always associated with a numeric amount field, i.e.x+n16means a prefix ofCorDfollowed by16numeric characters.b- Binary representation of dataz-Track 2as 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"}