Skip to content

eulixir/ex_cnab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ExCnab

ExCnab makes it easy to read and process CNAB files.

This README follows the main branch, which may not be the currently published version. Here are the docs for the latest published version of ExCnab.

Installation

To install in all environments (useful for generating seed data in dev/prod):

In mix.exs, add the ExMachina dependency:

def deps do
  [
    {:ex_cnab, "~> 1.3.6"},
  ]
end

Overview

Check out the docs for more details.

Read and Build info from file:

defmodule MyApp.CnabParser do
  import ExCnab240

  def run(filepath), do: decode(filepath, %{})
end

output:

    {:ok, %{
        header: %{
          # Content
        },
        details: %{
          # Content
        },
        footer: %{
          # Content
        },
        additional_info: %{
          # Content
        }
      }}
defmodule MyApp.CnabParser do
  import ExCnab240

  def run(decoded_cnab), do: encode(decoded_cnab, %{})
end

output:

    {:ok, %{content: "xxxx...", filename: "JHVAABBDD.ret"}}
defmodule MyApp.GetDetailsType do
  import ExCnab240

  def run(decoded_cnab), do: find_details_type(cnab_file)

end

output:

     ["A", "B"]

Contributing

Before opening a pull request, please open an issue first.

$ git clone https://github.com/joaopealves/ex_cnab.git
$ cd ex_cnab
$ mix deps.get
$ mix test

Once you've made your additions and mix test passes, go ahead and open a PR!

License

ExCnab is Copyright © 2023 João Pedro Alves. It is free software, and may be redistributed under the terms specified in the LICENSE file.

About

A CNAB file helper. This library aims to help your bank or cooperative read, decode, display, and perform various operations on a CNAB file

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages