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 through Z and a through z
  • n - Numeric digits, 0 through 9
  • p - Pad character, space
  • s - Special characters, i.e. other printable
  • an - Alphabetic and numeric characters
  • as - Alphabetic and special characters
  • ns - Numeric and special characters
  • anp - Alphabetic, numeric and pad characters
  • ans - Alphabetic, numeric and special characters
  • x C for credit, D for debit, always associated with a numeric amount field, i.e. x+n16 means a prefix of C or D followed by 16 numeric characters.
  • b - Binary representation of data
  • z - Track 2 as defined in ISO 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"}