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