Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fedACH

Build Status Go Report Card GoDoc

This Go package allows you to Marshal or Unmarshal from/to FedACH Participant RDFIs With Commercial Receipt Volume.

You can rely on this package to have the latest official version of the Fed file.

Installation

go get -u github.com/thylong/fedach

Examples

Get current Fed file version

package main

import (
	"fmt"

	"github.com/thylong/fedach"
)

func main() {
	current := fedach.GetCurrentDirectoryFile()

	fmt.Printf("%#v\n", current)
}

Unmarshal from file

package main

import (
	"fmt"

	"github.com/thylong/fedach"
)

func main() {
    fileContent, err := ioutil.ReadFile("sample/FedACHdir.txt")
	if err != nil {
		panic(err)
	}

	var routingDirectoryFile []fedach.RoutingDirectoryRecord
	if err := fedach.Unmarshal(fileContent, &routingDirectoryFile); err != nil {
		panic(err)
	}

	fmt.Printf("%#v\n", routingDirectoryFile)
}

Marshal to file

Using provided data structure

package main

import (
	"fmt"

	"github.com/thylong/fedach"
)

func main() {
	routingDirectoryFile := []fedach.RoutingDirectoryRecord{
		{
			"011000015",
			"O",
			"011000015",
			"0",
			"122415",
			"000000000",
			"FEDERAL RESERVE BANK                ",
			"1000 PEACHTREE ST N.E.              ",
			"ATLANTA             ",
			"GA",
			"30309",
			"4470",
			"877",
			"372",
			"2457",
			"1",
			"1",
			"     ",
		},
	}
	encoded, err := fedach.Marshal(routingDirectoryFile)
	if err != nil {
		panic(err)
	}

	fmt.Printf("%s\n", encoded)
}

Using slice

package main

import (
	"fmt"

	"github.com/thylong/fedach"
)

func main() {
	routingDirectoryFile := [][]string{
		{
			"011000015",
			"O",
			"011000015",
			"0",
			"122415",
			"000000000",
			"FEDERAL RESERVE BANK                ",
			"1000 PEACHTREE ST N.E.              ",
			"ATLANTA             ",
			"GA",
			"30309",
			"4470",
			"877",
			"372",
			"2457",
			"1",
			"1",
			"     ",
		},
	}
	encoded, err := fedach.Marshal(routingDirectoryFile)
	if err != nil {
		panic(err)
	}

	fmt.Printf("%s\n", encoded)
}

Notes

Please make sure you read the frbservices agreement: https://www.frbservices.org/EPaymentsDirectory/agreement.html

About

Go package to Marshal or Unmarshal from/to FedACH Participant RDFIs With Commercial Receipt Volume.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages