Git Product home page Git Product logo

fedach's Introduction

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

fedach's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.