Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zemuldo/iso_8583_elixir
ISO 8583 messaging library in Elixir
https://github.com/zemuldo/iso_8583_elixir
elixir elixir-lang elixir-language elixir-library elixir-phoenix elixir-programming-language iso8583
Last synced: about 2 months ago
JSON representation
ISO 8583 messaging library in Elixir
- Host: GitHub
- URL: https://github.com/zemuldo/iso_8583_elixir
- Owner: zemuldo
- License: mit
- Created: 2019-04-12T21:31:07.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-24T20:11:24.000Z (about 4 years ago)
- Last Synced: 2024-10-31T10:36:28.127Z (about 2 months ago)
- Topics: elixir, elixir-lang, elixir-language, elixir-library, elixir-phoenix, elixir-programming-language, iso8583
- Language: Elixir
- Homepage: https://hexdocs.pm/iso_8583
- Size: 2.81 MB
- Stars: 8
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ISO8583
An ISO 8583 messaging library for Elixir. Supports message validation, encoding and decoding. [See the docs](https://hexdocs.pm/iso_8583)
This project is still in early stages. If you have feature suggestions you can do two things.
- Push a PR and I will be happy to review.
- Suggest using new issue and I will be happy to implement.```elixir
iex> message
%{
"0": "0800",
"11": "646465",
"12": "160244",
"13": "0818",
"7": "0818160244",
"70": "001"
}
iex> {:ok, encoded} = ISO8583.encode(message)
{:ok,
<<0, 49, 48, 56, 48, 48, 130, 56, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 48,
56, 49, 56, 49, 54, 48, 50, 52, 52, 54, 52, 54, 52, 54, 53, 49, 54, 48, 50,
52, 52, 48, 56, 49, 56, ...>>}
iex> {:ok, decoded} = ISO8583.decode(encoded)
{:ok,
%{
"0": "0800",
"11": "646465",
"12": "160244",
"13": "0818",
"7": "0818160244",
"70": "001"
}}
iex>
```## Installation
```elixir
def deps do
[
{:iso_8583, "~> 0.1.2"}
]
end
```## Customization and configuration
All exposed API functions take options with the following configurable options.
### TCP Length Indicator
This is used to specify whether or not to include the 2 byte hexadecimal encoded byte length of the whole message
whe encoding or to consider it when decoding.
This value is set to true by default.
Example:
```elixir
ISO8583.encode(message, tcp_len_header: false)
```### Bitmap encoding
Primary and SecondaryBitmap encoding bitmap for fields 0-127 is configurable like below.Examples:
```elixir
ISO8583.encode(bitmap_encoding: :ascii) # will result in 32 byte length bitmap
``````elixir
ISO8583.encode() # will default to :hex result in 16 byte length bitmap
```### Custom formats
Custom formats for data type, data length and length type for all fields including special bitmaps like
for 127.1 and 127.25.1 are configurable through custom formats. The default formats will be replaced by the custom one.To see the default formats [check here](https://github.com/zemuldo/iso_8583_elixir/blob/master/lib/iso_8583/formats/formats.ex#L104)
Example:
Here we override field 2 to have maximum of 30 characters.
```elixir
custome_format = %{
"2": %{
content_type: "n",
label: "Primary account number (PAN)",
len_type: "llvar",
max_len: 30,
min_len: 1
}
}{:ok, message} =
fixture_message(:"0100")
|> Map.put(:"2", "444466668888888888888888")
|> ISO8583.encode(formats: custome_format)refute message |> ISO8583.valid?()
end
```
## Roadmap
- Optimizations
- More customizations
- Message composition
- Support for compsable validators.
- More tests.