Powered by AppSignal & Oban Pro
Would you like to see your link here? Contact us

ISO8583 Tools

iso8583_tools.livemd

ISO8583 Tools

Mix.install([
  {:iso_8583, "~> 0.1.5"},
  {:tlv, "~> 0.2.0", path: "/Users/george/code/elixir_tlv"}
])

Section

{:ok, msg} =
  "5F2A020978"
  |> Base.decode16(case: :mixed)
{decoded, other} = TLV.decode(msg)
decoded.tag == <<95, 42>> |> 
"5F2A" |> Base.decode16!()
# Defining a binary with a 16-bit integer
binary = <<0x5F2A::16>>

# Output the binary
IO.inspect(binary)

# Converting the binary to a hex string for display purposes
hex_string = Base.encode16(binary)
IO.puts("Hex string: #{hex_string}")
# Hexadecimal string
hex_string = "5F2A"

# Convert hex string to integer
decimal_value = String.to_integer(hex_string, 16)

Integer.to_string(2)

# Output the decimal value
IO.puts("Decimal value: #{decimal_value}")