Packages

A CNAB file helper. This library aims to help your bank or cooperative read, decode, display, and perform various operations on a CNAB file. Supported operations: - Read CNAB240 file - Return some data - Get details type

Current section

Files

Jump to
ex_cnab app excnab.ex
Raw

app/excnab.ex

defmodule ExCnab do
@moduledoc """
Cnab keeps the contexts that define your domain
and business logic.
Contexts are also responsible for managing your data, regardless
if it comes from the database, an external API or others.
"""
defmacro __using__(_opts) do
quote do
@before_compile unquote(__MODULE__)
import CnabParser
def decode(filepath, attrs \\ %{}) do
Cnab.decode(filepath, attrs)
end
end
end
@doc """
Decode a single file.
This will decode the cnab file applying the correct format to each CNAB 240 template
### Example
decode("JVH1234.rem")
{:ok, %{
header: %{
# Content
},
details: %{
# Content
},
footer: %{
# Content
},
additional_info: %{
# Content
}
}}
"""
@callback decode(filepath :: String.t()) :: any
@callback decode(filepath :: String.t(), attrs :: keyword | map) :: any
def decode(filepath, attrs \\ %{}) do
ExCnab.Cnab240.Services.Decode.run(filepath, attrs)
end
end