An erlang library for processing iso8583 messages inspired by [erl8583],[jpos library].

This is a minimalist library for  packing and unpacking iso8583 financial messages.

It accepts a specification file which contains information about fields,mti,bitmap  for your interchange.

It then uses those specifications to then pack and unpack iso messages for your interchange.

The specification can be loaded once and then used for all packing and unpacking operations

## usage ##

the library can be used by putting the following in your rebar.config or mix.exs


{:iso8583_erl, "~> 0.4.1"}

## quickstart ##

%set mti
	Specification = iso8583_erl:load_specification(code:priv_dir(iso8583_erl)++"/custom.cfg"),
	{ok,First_map} = iso8583_erl:set_mti(maps:new(),<<"0200">>),

%set field
	{ok,Second_map} = iso8583_erl:set_field(First_map,3,<<"201234">>),

	%%one way to pack data
	{ok,First_map} = iso8583_erl:set_mti(maps:new(),<<"0200">>),
	{ok,Second_map} = iso8583_erl:set_field(First_map,3,<<"201234">>),
	{ok,Third_map} = iso8583_erl:set_field(Second_map,4,<<"4.5">>),
	{ok,Fourth_map} = iso8583_erl:set_field(Third_map,5,<<"5000">>),
	{ok,Fifth_map} = iso8583_erl:set_field(Fourth_map,102,<<"123413243">>),
	{ok,Six_map} = iso8583_erl:set_field(Fifth_map,103,<<"12897979987">>),
	[Mti,Bitmap_final_bit,Fields_list] = iso8583_erl:pack(Six_map,Specification),
	%another way to pack data
	Map_send_list = iso8583_erl:set_field_list([{mti,<<"0200">>},{3,<<"201234">>},{4,<<"4.5">>},{5,<<"5000">>},{102,<<"123413243">>},{103,<<"12897979987">>}]),
	[Mti,Bitmap_final_bit,Fields_list] = iso8583_erl:pack(Map_send_list,Specification).

%unpack data
	{ok,First_map} = iso8583_erl:set_mti(maps:new(),<<"0200">>),
	{ok,Second_map} = iso8583_erl:set_field(First_map,3,<<"001234">>),
	{ok,Third_map} = iso8583_erl:set_field(Second_map,4,<<"123456789012">>),
	{ok,Fourth_map} = iso8583_erl:set_field(Third_map,5,<<"123456789012">>),
	[Mti,Bitmap_final_bit,Fields_list] = iso8583_erl:pack(Fourth_map,Specification),
	Final_fields = [Mti,Bitmap_final_bit,Fields_list],
	Map_data = #{3 => <<"001234">>,4 => <<"123456789012">>,5 => <<"123456789012">>,
    bit => <<"3800000000000000">>,mti => <<"0200">>},
	?assertEqual(true,Map_data =:= iso8583_erl:unpack(Final_fields,Specification)).


## to create documentation ##

to create documentation run command below 
rebar3 ex_doc

more examples of usage can be found in  ```test/iso8583_erl_SUITE.erl```

## acknowledgements ##
i wish to thank the creators of the jpos library from which gave a lot of great ideas.

i also wish to thank the creators of erl8583 library which gave a lot of excellent ideas.

[jpos library]: