ExCnab240 behaviour (ex_cnab v1.0.0)
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.
Link to this section Summary
Callbacks
Decode a single file. This will decode the cnab file applying the correct format to each CNAB 240 template
Encode a single file. This will encode your params to a one CNAB file applying the correct format to each CNAB 240 template
Link to this section Callbacks
Link to this callback
decode(filepath)
Decode a single file. This will decode the cnab file applying the correct format to each CNAB 240 template
example
Example
import ExCnab240
decode("JVH1234.rem", %{})
{:ok, %{
header: %{
# Content
},
details: %{
# Content
},
footer: %{
# Content
},
additional_info: %{
# Content
}
}}
Link to this callback
decode(filepath, attrs)
Link to this callback
encode(params)
Encode a single file. This will encode your params to a one CNAB file applying the correct format to each CNAB 240 template
example
Example
import ExCnab240
encode(%{cnab: cnab}, %{filename: "JVH1010101.ret"})
{:ok, %{contnet: "xxx...", filename: "JVH1010101.ret"}}
encode(%{cnab: cnab}, %{})
{:ok, %{contnet: "xxx...", filename: "default.ret"}}
encode!(%{cnab: cnab}, %{filename: "JVH1010101.ret"})
%{contnet: "xxx...", filename: "JVH1010101.ret"}
encode!(%{cnab: cnab}, %{})
%{contnet: "xxx...", filename: "default.ret"}
Link to this callback
encode(params, attrs)
Link to this section Functions
Link to this function
decode(filepath, attrs \\ %{})
Link to this function
decode!(filepath, attrs \\ %{})
Link to this function
encode(params, attrs \\ %{})
Link to this function