ExCnab behaviour (ex_cnab v0.4.1)
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
Decode a single file. This return an short info about the cnab file
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
decode("JVH1234.rem")
{:ok, %{
header: %{
# Content
},
details: %{
# Content
},
footer: %{
# Content
},
additional_info: %{
# Content
}
}}
Link to this callback
decode(filepath, attrs)
Link to this callback
get_decoded_file(filepath)
@callback get_decoded_file(filepath :: String.t()) :: {:ok, Map.t()}
Decode a single file. This return an short info about the cnab file
example
Example
decode("JVH30016.txt")
{:ok,
%{
arquivo: "JVH30016.txt",
cliente: "JHON DOE",
cooperativa: "BANCO X",
totais: %{
credito_conta: 10600,
doc: 0,
liquidacao_titulos_banco: 484686,
liquidacao_titulos_outros_banco: 745483,
op: 0,
pagamento_de_contas_codigo_barras: 42949,
pix: 0,
ted: 20567976
}
}}
Link to this callback
get_decoded_file(filepath, attrs)
Link to this section Functions
Link to this function
decode(filepath, attrs \\ %{})
Link to this function