https://github.com/thylong/fedach
Go package to Marshal or Unmarshal from/to FedACH Participant RDFIs With Commercial Receipt Volume.
https://github.com/thylong/fedach
ach fed fedach finance go investm
Last synced: 4 months ago
JSON representation
Go package to Marshal or Unmarshal from/to FedACH Participant RDFIs With Commercial Receipt Volume.
- Host: GitHub
- URL: https://github.com/thylong/fedach
- Owner: thylong
- License: mit
- Created: 2017-10-20T10:11:28.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-26T08:56:51.000Z (over 8 years ago)
- Last Synced: 2024-06-20T14:17:19.609Z (almost 2 years ago)
- Topics: ach, fed, fedach, finance, go, investm
- Language: Go
- Homepage:
- Size: 567 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: MIT-LICENSE
Awesome Lists containing this project
README
# fedACH
[](https://travis-ci.org/thylong/fedach) [](https://goreportcard.com/report/github.com/thylong/fedach) [](https://godoc.org/github.com/thylong/fedach)
This Go package allows you to Marshal or Unmarshal from/to [FedACH Participant RDFIs With Commercial Receipt Volume](https://www.frbservices.org/operations/epayments/epayments.html).
You can rely on this package to have the latest official version of the Fed file.
## Installation
```bash
go get -u github.com/thylong/fedach
```
## Examples
### Get current Fed file version
```go
package main
import (
"fmt"
"github.com/thylong/fedach"
)
func main() {
current := fedach.GetCurrentDirectoryFile()
fmt.Printf("%#v\n", current)
}
```
### Unmarshal from file
```go
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
```go
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
```go
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