<div dir="ltr"><div class="gmail_quote"><div dir="ltr"><div><div>Dear List ,<br><br></div>I am writing a program where i need to pack/unpack iso messages .<br></div><div>i am using the <a href="https://github.com/mgwidmann/erl8583" target="_blank">erl8583</a> application but i am getting some errors using the packing and unpacking functions of the library .<br></div><div>
i run the  <a href="https://github.com/mgwidmann/erl8583/blob/master/test/test_all.erl" target="_blank">test_all.erl</a>  test script which runs the eunit scripts but got some errors .<br>
i scaled it down and run the test_asci_marshaller.erl eunit test .<br></div><div>below is part of the output below <br><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><pre><code>eunit:test(test_ascii_<wbr>marshaller).          
test_ascii_marshaller: pan_test...*failed*
in function erl8583_marshaller_ascii:<wbr>marshal_data_element/2 (src/erl8583_marshaller_ascii.<wbr>erl, line 168)
  called as marshal_data_element({n,fixed,<wbr>4},<<"0200">>)
in call from erl8583_marshaller:marshal/2 (src/erl8583_marshaller.erl, line 108)
in call from test_ascii_marshaller:pan_<wbr>test/0 (test/test_ascii_marshaller.<wbr>erl, line 43)
**error:function_clause
  output:<<"">>

test_ascii_marshaller: proc_code_test...*failed*
in function erl8583_marshaller_ascii:<wbr>marshal_data_element/2 (src/erl8583_marshaller_ascii.<wbr>erl, line 168)
  called as marshal_data_element({n,fixed,<wbr>4},<<"0100">>)
in call from erl8583_marshaller:marshal/2 (src/erl8583_marshaller.erl, line 108)
in call from test_ascii_marshaller:proc_<wbr>code_test/0 (test/test_ascii_marshaller.<wbr>erl, line 49)
**error:function_clause
  output:<<"">>

test_ascii_marshaller: amount_tran_test...*failed*
in function erl8583_marshaller_ascii:<wbr>marshal_data_element/2 (src/erl8583_marshaller_ascii.<wbr>erl, line 168)
  called as marshal_data_element({n,fixed,<wbr>4},<<"0200">>)
in call from erl8583_marshaller:marshal/2 (src/erl8583_marshaller.erl, line 108)
in call from test_ascii_marshaller:amount_<wbr>tran_test/0 (test/test_ascii_marshaller.<wbr>erl, line 55)
**error:function_clause
  output:<<"">></code></pre></blockquote><br><p>i traced it down to  this line in this line in erl8583_marshaller_ascii.erl</p><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><pre><code>marshal_data_element({n, fixed, Length}, FieldValue) when length(FieldValue) =< Length ->
IntValue = list_to_integer(FieldValue),
erl8583_convert:integer_to_<wbr>string(IntValue, Length);</code></pre></blockquote><div><br>i may be wrong but seems the length(FieldValue) is being passed a binary string instead of as string ??<br></div><div>running some of the functions in the application eg . below<br><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">    Msg1 = erl8583_message:new(),<br>    Msg2 = erl8583_message:set(0, "0200", Msg1),<br>    Msg3 = erl8583_message:set(2, "5234567890123456", Msg1),<br>    AsciiMessage =erl8583_marshaller_ascii:<wbr>marshal(Msg3),<br></blockquote><br></div><div>gives the below error <br></div><div> a similar example is included in the test cases and i am assuming its supposed to work .<br></div><div><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">terminate reason: {undef,<br>                      [{undefined,get_encoding,[2],[<wbr>]},<br>                       {erl8583_marshaller_ascii,<wbr>marshal_field,3,<br>                           [{file,"src/erl8583_<wbr>marshaller_ascii.erl"},<br>                            {line,109}]},<br>                       {erl8583_marshaller,encode,6,<br>                           [{file,"src/erl8583_<wbr>marshaller.erl"},{line,238}]},<br>                       {erl8583_marshaller,marshal,2,<br>                           [{file,"src/erl8583_<wbr>marshaller.erl"},{line,112}]},<br></blockquote><br></div><div><br></div><div><br></div><div><br></div><div>Anyone have any experience with using this library and can help  point out what i may be doing wrong .<br></div><div>Also are there any other libraries out there for packing and unpacking iso 8583 messages in erlang .<br></div><div>searched on github but dont seem to find anything except erl8583 and some forks of it  .<br></div><div>Are there other alternative approaches for this like the use of ports  to help with the packing/unpacking ?<br></div><p><br></p><br><br></div><div><br><br></div></div>
</div><br></div>