#!/usr/bin/env elixir # Reproducer: unpack the extracted ISO87B message hex from logs and print debug logs Code.prepend_path("lib") require Logger Logger.configure(level: :debug) alias DaProductApp.MercuryISO8583.Packagers.ISO87BPackager # Hex from logs (message data as hex) hex = "60007820000400703C078000C282051648549806007367400080000000000006000001231354300913310500510000078200313233343536373131323334353637383930313233343500817B226F72696744617465223A223230323530393133222C226F7269674D7469223A2230323030222C226F7269675472616365223A22303030313233222C226F72696754696D65223A22313335343330227D3738340028950500800400009F1E0832333733303030319F100706011203A0A80200063030303030311234567812345678" binary = Base.decode16!(String.upcase(hex)) IO.puts("Message binary length: #{byte_size(binary)}") case ISO87BPackager.unpack(ISO87BPackager.create_msg(), binary) do {:ok, msg} -> IO.puts("Unpack succeeded: ") IO.inspect(msg) {:error, reason} -> IO.puts("Unpack failed: #{inspect(reason)}") end # Ensure any runtime exceptions are visible try do :ok rescue e -> IO.puts("Exception: #{inspect(e)}") IO.puts(Exception.format(:error, e, __STACKTRACE__)) end