[erlang-questions] Packing and unpacking iso8583 messages

Hernando Gisinger hgisinger@REDACTED
Sat Sep 24 03:24:21 CEST 2016


Maybe ?

Msg1 = erl8583_message:new(),
Msg2 = erl8583_message:set(0, "0200", Msg1),
Msg3 = erl8583_message:set(2, "5234567890123456", Msg2),  %% Here is Msg2,
not Msg1
AsciiMessage =erl8583_marshaller_ascii:marshal(Msg3),

2016-09-23 21:29 GMT-03:00 Nuku Ameyibor <nayibor@REDACTED>:

> Dear List ,
>
> I am writing a program where i need to pack/unpack iso messages .
> i am using the erl8583 <https://github.com/mgwidmann/erl8583> application
> but i am getting some errors using the packing and unpacking functions of
> the library .
> i run the  test_all.erl
> <https://github.com/mgwidmann/erl8583/blob/master/test/test_all.erl>
> test script which runs the eunit scripts but got some errors .
> i scaled it down and run the test_asci_marshaller.erl eunit test .
> below is part of the output below
>
> eunit:test(test_ascii_marshaller).
>> test_ascii_marshaller: pan_test...*failed*
>> in function erl8583_marshaller_ascii:marshal_data_element/2 (src/erl8583_marshaller_ascii.erl, line 168)
>>   called as marshal_data_element({n,fixed,4},<<"0200">>)
>> in call from erl8583_marshaller:marshal/2 (src/erl8583_marshaller.erl, line 108)
>> in call from test_ascii_marshaller:pan_test/0 (test/test_ascii_marshaller.erl, line 43)
>> **error:function_clause
>>   output:<<"">>
>>
>> test_ascii_marshaller: proc_code_test...*failed*
>> in function erl8583_marshaller_ascii:marshal_data_element/2 (src/erl8583_marshaller_ascii.erl, line 168)
>>   called as marshal_data_element({n,fixed,4},<<"0100">>)
>> in call from erl8583_marshaller:marshal/2 (src/erl8583_marshaller.erl, line 108)
>> in call from test_ascii_marshaller:proc_code_test/0 (test/test_ascii_marshaller.erl, line 49)
>> **error:function_clause
>>   output:<<"">>
>>
>> test_ascii_marshaller: amount_tran_test...*failed*
>> in function erl8583_marshaller_ascii:marshal_data_element/2 (src/erl8583_marshaller_ascii.erl, line 168)
>>   called as marshal_data_element({n,fixed,4},<<"0200">>)
>> in call from erl8583_marshaller:marshal/2 (src/erl8583_marshaller.erl, line 108)
>> in call from test_ascii_marshaller:amount_tran_test/0 (test/test_ascii_marshaller.erl, line 55)
>> **error:function_clause
>>   output:<<"">>
>>
>>
> i traced it down to this line in this line in erl8583_marshaller_ascii.erl
>
>> marshal_data_element({n, fixed, Length}, FieldValue) when length(FieldValue) =< Length ->
>> IntValue = list_to_integer(FieldValue),
>> erl8583_convert:integer_to_string(IntValue, Length);
>>
>>
> i may be wrong but seems the length(FieldValue) is being passed a binary
> string instead of as string ??
> running some of the functions in the application eg . below
>
>     Msg1 = erl8583_message:new(),
>>     Msg2 = erl8583_message:set(0, "0200", Msg1),
>>     Msg3 = erl8583_message:set(2, "5234567890123456", Msg1),
>>     AsciiMessage =erl8583_marshaller_ascii:marshal(Msg3),
>>
>
> gives the below error
>  a similar example is included in the test cases and i am assuming its
> supposed to work .
>
> terminate reason: {undef,
>>                       [{undefined,get_encoding,[2],[]},
>>                        {erl8583_marshaller_ascii,marshal_field,3,
>>                            [{file,"src/erl8583_marshaller_ascii.erl"},
>>                             {line,109}]},
>>                        {erl8583_marshaller,encode,6,
>>                            [{file,"src/erl8583_marshaller
>> .erl"},{line,238}]},
>>                        {erl8583_marshaller,marshal,2,
>>                            [{file,"src/erl8583_marshaller
>> .erl"},{line,112}]},
>>
>
>
>
>
> Anyone have any experience with using this library and can help  point out
> what i may be doing wrong .
> Also are there any other libraries out there for packing and unpacking iso
> 8583 messages in erlang .
> searched on github but dont seem to find anything except erl8583 and some
> forks of it  .
> Are there other alternative approaches for this like the use of ports  to
> help with the packing/unpacking ?
>
>
>
>
>
>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160923/35a2c928/attachment.htm>


More information about the erlang-questions mailing list