ach

package module
v1.44.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 28 Imported by: 28

README

Moov Banner Logo

Project Documentation · API Endpoints · API Guide · Community · Blog

GoDoc Build Status Go Report Card Repo Size Apache 2 License Slack Channel Docker Pulls GitHub Stars Twitter

moov-io/ach

Moov's mission is to give developers an easy way to create and integrate bank processing into their own software products. Our open source projects are each focused on solving a single responsibility in financial services and designed around performance, scalability, and ease of use.

ACH implements a reader, writer, and validator for Automated Clearing House (ACH) files following the Nacha standards. ACH is the primary method of electronic money movement throughout the United States. The HTTP server is available in a Docker image and the Go package github.com/moov-io/ach is available.

If you're looking for an event driven ACH engine for uploading/downloading files and operations we have built moov-io/achgateway and run it in production. Our article How and When to use the Moov ACH Library will help to generate ACH files for upload to your ODFI.

Table of contents

Project status

Moov ACH is actively used in multiple production environments. Please star the project if you are interested in its progress. The project supports generating and parsing all Standard Entry Class (SEC) codes and validating files according to the Nacha standards. If you have layers above ACH to simplify tasks, perform business operations, or found bugs we would appreciate an issue or pull request. Thanks!

Usage

The ACH project implements an HTTP server and Go library for creating and modifying ACH files. There are client libraries available for both Go and Node/JavaScript. We also have an extensive list of examples of the reader and writer applied to various ACH transaction types.

Docker

We publish a public Docker image moov/ach from Docker Hub or use this repository. No configuration is required to serve on :8080 and metrics at :9090/metrics in Prometheus format. We also have Docker images for OpenShift published as quay.io/moov/ach.

Pull & start the Docker image:

docker pull moov/ach:latest
docker run -p 8080:8080 -p 9090:9090 moov/ach:latest

List files stored in-memory:

curl localhost:8080/files
{"files":[],"error":null}

Create a file on the HTTP server:

curl -X POST --data-binary "@./test/testdata/ppd-debit.ach" http://localhost:8080/files/create
{"id":"<YOUR-UNIQUE-FILE-ID>","error":null}

Read the ACH file (in JSON form):

curl http://localhost:8080/files/<YOUR-UNIQUE-FILE-ID>
{"file":{"id":"<YOUR-UNIQUE-FILE-ID>","fileHeader":{"id":"","immediateDestination":"231380104","immediateOrigin":"121042882", ...
Google Cloud Run button

To get started in a hosted environment you can deploy this project to the Google Cloud Platform.

From your Google Cloud dashboard create a new project and call it:

moov-ach-demo

Click the button below to deploy this project to Google Cloud.

Run on Google Cloud

Note: If you get an error about the image being marked as "Do Not Trust" follow the below steps.

Error: You launched this custom Cloud Shell image as "Do not trust"
$ cloudshell_open --repo_url "https://github.com/moov-io/ach" --page "shell" --git_branch "master"
Error: You launched this custom Cloud Shell image as "Do not trust".
In this mode, your credentials are not available and this experience
cannot deploy to Cloud Run. Start over and "Trust" the image.
Error: aborting due to untrusted cloud shell environment

This error occurs when some security settings on your account / cloud shell are locked down. To run ACH you need to trust the image, so in the top-right click to restart this image as Trusted.

Click to "Return to default"

Then you'll need to clone down and launch ACH. Pick option #3 to clone this project.

cloudshell_open --repo_url "https://github.com/moov-io/ach" --page "shell" --git_branch "master"

Start the ACH server inside the cloned repository.

go run ./cmd/serverr

Connect to the web preview (e.g. https://YOUR-ACH-APP-URL.a.run.app:8080/files)


In the cloud shell you should be prompted with:

Choose a project to deploy this application:

Using the arrow keys select:

moov-ach-demo

You'll then be prompted to choose a region, use the arrow keys to select the region closest to you and hit enter.

Choose a region to deploy this application:

Upon a successful build you will be given a URL where the API has been deployed:

https://YOUR-ACH-APP-URL.a.run.app

From the cloud shell you need to cd into the ach folder:

cd ach

Now you can list files stored in-memory:

curl https://YOUR-ACH-APP-URL.a.run.app/files

You should get this response:

{"files":[],"error":null}

Create a file on the server:

curl -X POST --data-binary "@./test/testdata/ppd-debit.ach" https://YOUR-ACH-APP-URL.a.run.app/files/create

You should get this response:

{"id":"<YOUR-UNIQUE-FILE-ID>","error":null}

Finally, read the contents of the file you've just posted:

curl https://YOUR-ACH-APP-URL.a.run.app/files/<YOUR-UNIQUE-FILE-ID>

You should get this response:

{"file":{"id":"<YOUR-UNIQUE-FILE-ID>","fileHeader":{"id":"...","immediateDestination":"231380104","immediateOrigin":"121042882", ...
HTTP API

The package github.com/moov-io/ach/server offers an HTTP and JSON API for creating and editing files. If you're using Go the ach.File type can be used, otherwise you can send properly formatted JSON. We have an example JSON file, but each SEC type will generate different JSON.

Examples: Go | Ruby

Configuration settings
Environmental Variable Description Default
ACH_FILE_TTL Time to live (TTL) for *ach.File objects stored in the in-memory repository. 0 = No TTL / Never delete files (Example: 240m)
LOG_FORMAT Format for logging lines to be written as. Options: json, plain - Default: plain
HTTP_BIND_ADDRESS Address for ACH to bind its HTTP server on. This overrides the command-line flag -http.addr. Default: :8080
HTTP_ADMIN_BIND_ADDRESS Address for ACH to bind its admin HTTP server on. This overrides the command-line flag -admin.addr. Default: :9090
HTTPS_CERT_FILE Filepath containing a certificate (or intermediate chain) to be served by the HTTP server. Requires all traffic be over secure HTTP. Empty
HTTPS_KEY_FILE Filepath of a private key matching the leaf certificate from HTTPS_CERT_FILE. Empty
Data persistence

By design ACH does not persist (save) any data about the files, batches, or entry details created. The only storage occurs in memory of the process and upon restart ACH will have no files, batches, or data saved. Also, no in memory encryption of the data is performed.

Go library

This project uses Go Modules and Go v1.18 or newer. See Golang's install instructions for help in setting up Go. You can download the source code and we offer tagged and released versions as well. We highly recommend you use a tagged release for production.

# Pull down into the Go Module cache
$ go get -u github.com/moov-io/ach

# Show the documentation for the BatchHeader package
$ go doc github.com/moov-io/ach BatchHeader

The package github.com/moov-io/ach offers a Go-based ACH file reader and writer. To get started, check out a specific example:

Supported Standard Entry Class (SEC) codes
SEC Code Description Example Read Write
ACK Acknowledgment Entry for CCD Credit ACK Read ACK Write
ADV Automated Accounting Advice Prenote Debit ADV Read ADV Write
ARC Accounts Receivable Entry Debit ARC Read ARC Write
ATX Acknowledgment Entry for CTX Credit ATX Read ATX Write
BOC Back Office Conversion Debit BOC Read BOC Write
CCD Corporate credit or debit Debit CCD Read CCD Write
CIE Customer-Initiated Entry Credit CIE Read CIE Write
COR Automated Notification of Change(NOC) NOC COR Read COR Write
CTX Corporate Trade Exchange Debit CTX Read CTX Write
DNE Death Notification Entry DNE DNE Read DNE Write
ENR Automatic Enrollment Entry ENR ENR Read ENR Write
IAT International ACH Transactions Credit IAT Read IAT Write
MTE Machine Transfer Entry Credit MTE Read MTE Write
POP Point of Purchase Debit POP Read POP Write
POS Point of Sale Debit POS Read POS Write
PPD Prearranged payment and deposits Debit Credit PPD Read PPD Write
RCK Represented Check Entries Debit RCK Read RCK Write
SHR Shared Network Entry Debit SHR Read SHR Write
TEL Telephone-Initiated Entry Debit TEL Read TEL Write
TRC Truncated Check Entry Debit TRC Read TRC Write
TRX Check Truncation Entries Exchange Debit TRX Read TRX Write
WEB Internet-initiated Entries Credit WEB Read WEB Write
XCK Destroyed Check Entry Debit XCK Read XCK Write
Segment Files
SEC Code Name Example Read Write
IAT International ACH Transactions Credit IAT Read IAT Write
PPD Prearranged payment and deposits Debit Credit PPD Read PPD Write
Command line

On each release there's an achcli utility released. This tool can display ACH files in a human-readable format which is easier to read than their plaintext format. It also allows masking DFIAccountNumber values with the -mask flag.

Download the latest release for your computer

$ achcli test/testdata/ppd-debit.ach
Describing ACH file 'test/testdata/ppd-debit.ach'

  Origin     OriginName    Destination  DestinationName       FileCreationDate  FileCreationTime
  121042882  My Bank Name  231380104    Federal Reserve Bank  190624            0000

  BatchNumber  SECCode  ServiceClassCode  CompanyName      DiscretionaryData  Identification  EntryDescription  DescriptiveDate
  1            PPD      225 (Debits Only)  Name on Account                     121042882       REG.SALARY

    TransactionCode   RDFIIdentification  AccountNumber      Amount     Name                    TraceNumber      Category
    27 (Checking Debit)  23138010            12345678           100000000  Receiver Account Name   121042880000001

  ServiceClassCode  EntryAddendaCount  EntryHash  TotalDebits  TotalCredits  MACCode  ODFIIdentification  BatchNumber
  225 (Debits Only)  1                  23138010   100000000    0                      12104288            1

  BatchCount  BlockCount  EntryAddendaCount  TotalDebitAmount  TotalCreditAmount
  1           1           1                  100000000         0
In-browser ACH file parser

Using our in-browser utility, you can instantly convert ACH files into JSON. Either paste in ACH file content directly or choose a file from your local machine. This tool is particularly useful if you're handling sensitive PII or want perform some quick tests, as operations are fully client-side with nothing stored in memory.

SDKs

Below are some SDKs generated from the API documentation:

Learn about ACH

FAQ

Is there an in-browser tool for converting ACH files into JSON? Yes! You can find our browser utility at http://oss.moov.io/ach/.
Is my data being saved somewhere? No, we do not save any data related to files, batch, or entry details. All processing is done in-memory.
What ACH transaction types are supported? We support generating and parsing all Standard Entry Class (SEC) codes.
Where can I find the official Nacha Operating Rules? You can purchase the most recent Nacha Operating Rules and Guidelines resource directly from their webstore. Additionally, Nacha has published a free ACH guide for developers.

Getting help

If you have ACH-specific questions, NACHA (National Automated Clearing House Association) has their complete specification for all file formats and message types.

channel info
Project Documentation Our project documentation available online.
Twitter @moov You can follow Moov.io's Twitter feed to get updates on our project(s). You can also tweet us questions or just share blogs or stories.
GitHub Issue If you are able to reproduce a problem please open a GitHub Issue under the specific project that caused the error.
moov-io slack Join our slack channel to have an interactive discussion about the development of the project.

Supported and tested platforms

  • 64-bit Linux (Ubuntu, Debian), macOS, and Windows
  • Raspberry Pi

Note: 32-bit platforms have known issues and are not supported.

Contributing

Yes please! Please review our Contributing guide and Code of Conduct to get started! Check out our issues for first time contributors for something to help out with.

This project uses Go Modules and Go v1.18 or newer. See Golang's install instructions for help setting up Go. You can download the source code and we offer tagged and released versions as well. We highly recommend you use a tagged release for production.

Releasing

To make a release of ach simply open a pull request with CHANGELOG.md and version.go updated with the next version number and details. You'll also need to push the tag (i.e. git push origin v1.0.0) to origin in order for CI to make the release.

Testing

We maintain a comprehensive suite of unit tests and recommend table-driven testing when a particular function warrants several very similar test cases. To run all test files in the current directory, use go test.

Fuzzing

We currently run fuzzing over ACH in the form of a Github Action. Please report crashes examples to oss@moov.io. Thanks!

As part of Moov's initiative to offer open source fintech infrastructure, we have a large collection of active projects you may find useful:

  • Moov Watchman offers search functions over numerous trade sanction lists from the United States and European Union.

  • Moov Fed implements utility services for searching the United States Federal Reserve System such as ABA routing numbers, financial institution name lookup, and FedACH and Fedwire routing information.

  • Moov Wire implements an interface to write files for the Fedwire Funds Service, a real-time gross settlement funds transfer system operated by the United States Federal Reserve Banks.

  • Moov Image Cash Letter implements Image Cash Letter (ICL) files used for Check21, X.9 or check truncation files for exchange and remote deposit in the U.S.

  • Moov Metro 2 provides a way to easily read, create, and validate Metro 2 format, which is used for consumer credit history reporting by the United States credit bureaus.

License

Apache License 2.0 - See LICENSE for details.

Documentation

Overview

Package ach reads and writes Automated Clearing House (ACH) files. ACH is the primary method of electronic money movement through the United States.

https://en.wikipedia.org/wiki/Automated_Clearing_House

https://moov-io.github.io/ach/

Read an ACH File

fd, err := os.Open("name-of-your-ach-file.ach")
if err != nil {
    log.Fatalf("problem opening file: %v", err)
}
file, err := ach.NewReader(fd).Read()
if err != nil {
    log.Fatalf("problem parsing ACH file: %v", err)
}
if err := file.Validate(); err != nil {
    log.Fatalf("ACH file isn't valid: %v", err)
}

Index

Constants

View Source
const (

	// CreditForDebitsOriginated is an accounting entry credit for ACH debits originated
	CreditForDebitsOriginated = 81
	// CreditForCreditsReceived is an accounting entry credits for ACH credits received
	CreditForCreditsReceived = 83
	// CreditForCreditsRejected is an accounting entry credit for ACH credits in rejected batches
	CreditForCreditsRejected = 85
	// CreditSummary is an accounting entry for summary credit for respondent ACH activity
	CreditSummary = 87

	// DebitForCreditsOriginated is an accounting entry debit for ACH credits originated
	DebitForCreditsOriginated = 82
	// DebitForDebitsReceived is an accounting entry debit for ACH debits received
	DebitForDebitsReceived = 84
	// DebitForDebitsRejectedBatches is an accounting entry debit for ACH debits in rejected batches
	DebitForDebitsRejectedBatches = 86
	// DebitSummary is an accounting entry for summary debit for respondent ACH activity
	DebitSummary = 88
)
View Source
const (
	// ACK ACH Payment Acknowledgment - A code that indicates acknowledgment of receipt of a corporate credit payment
	// (CCD).
	ACK = "ACK"
	// ADV Automated Accounting Advice – A code that provide accounting information regarding an Entry. It is an
	// optional service.
	ADV = "ADV"
	// ARC Accounts Receivable Entry – A code that indicates a consumer check converted to a one-time ACH debit.
	// The Accounts Receivable (ARC) Entry provides initiates a single-entry ACH debit to customer accounts by
	// converting checks at the point of receipt through the U.S. mail, at a drop box location or in-person for
	// payment of a bill at a manned location.
	ARC = "ARC"
	// ATX Financial EDI Acknowledgment -  A code that indicates acknowledgement by the Receiving Depository Financial
	// Institution (RDFI) that a Corporate Credit Exchange (CTX) has been received.
	ATX = "ATX"
	// BOC Back Office Conversion Entry - A code that indicates single entry debit initiated at the point of purchase
	// or at a manned bill payment location to transfer funds through conversion to an ACH debit entry during back
	// office processing.
	BOC = "BOC"
	// CCD Corporate Credit or Debit Entry - A code that indicates an entry initiated by an Organization to transfer
	// funds to or from an account of that Organization or another Organization. For commercial accounts only.
	CCD = "CCD"
	// CIE Customer Initiated Entry - A code that indicates a credit entry initiated on behalf of, and upon the
	// instruction of, a consumer to transfer funds to a non-consumer Receiver.
	CIE = "CIE"
	// COR Notification of Change or Refused Notification of Change - A code used by an RDFI or ODFI when originating a
	// Notification of Change or Refused Notification of Change in automated format.
	COR = "COR"
	// CTX Corporate Trade Exchange - A code that indicates the ability to collect and disburse funds and information
	// between companies. Generally it is used by businesses paying one another for goods or services.
	CTX = "CTX"
	// DNE Death Notification Entry - A code that United States Federal agencies (e.g. Social Security) use to notify
	// depository financial institutions that the recipient of government benefit payments has died.
	DNE = "DNE"
	// ENR Automated Enrollment Entry - A code indicating enrollment of a person with an agency of the US government
	// for a depository financial institution.
	ENR = "ENR"
	// IAT International ACH Transaction - A code IAT indicating a  credit or debit ACH entry that is part of a payment
	// transaction involving a financial agency's office (i.e., depository financial institution or business issuing
	// money orders) that is not located in the territorial jurisdiction of the United States. IAT entries can be made
	// to or from a corporate or consumer account and must be accompanied by seven (7) mandatory addenda records
	// identifying the name and physical address of the Originator, name and physical address of the Receiver,
	// Receiver's account number, Receiver's bank identity and reason for the payment.
	IAT = "IAT"
	// MTE Machine Transfer Entry - A code that indicates when a consumer uses their debit card at an Automated Teller
	// Machine (ATM) to withdraw cash.  MTE transactions cannot be aggregated together under a single Entry.
	MTE = "MTE"
	// POP Point of Purchase Entry - A code that indicates a check presented in-person to a merchant for purchase
	// is presented as an ACH entry instead of a physical check.
	POP = "POP"
	// POS Point of Sale Entry - A code that indicates a debit entry initiated at an “electronic terminal” to a
	// consumer account of the receiver to pay an obligation incurred in a point-of-sale transaction, or to effect a
	// point-of-sale terminal cash withdrawal.
	POS = "POS"
	// PPD Prearranged Payment and Deposit Entry - A code tha indicates a an entry initiated by an organization based
	// on a standing or a single entry authorization to transfer funds.
	PPD = "PPD"
	// RCK Re-presented Check Entry - A code that indicates a physical check that was presented but returned because of
	//// insufficient funds may be represented as an ACH entry.
	RCK = "RCK"
	// SHR Shared Network Transaction - A code that indicates a debit Entry initiated at an “electronic terminal,” as
	// that term is defined in Regulation E, to a Consumer Account of the Receiver to pay an obligation incurred in a
	// point-of-sale transaction, or to effect a point-of-sale terminal cash withdrawal. Also an adjusting or other
	// credit Entry related to such debit Entry, transfer of funds, or obligation. SHR Entries are initiated in a
	// shared network where the ODFI and RDFI have an agreement in addition to these Rules to process such Entries.
	SHR = "SHR"
	// TEL Telephone Initiated Entry - A code indicating a Telephone-Initiated consumer debit transactions. The NACHA
	// Operating Rules permit TEL entries when the originator obtains the Receiver's authorization for the debit entry
	// orally via the telephone.  An entry based upon a Receiver's oral authorization must utilize the TEL
	// Standard Entry Class (SEC) Code.
	TEL = "TEL"
	// TRC Check Truncation Entry - is a code used to identify a debit entry of a truncated check.
	TRC = "TRC"
	// TRX Check Truncation Entries Exchange - used to identify a debit entry exchange of a truncated checks (multiple).
	TRX = "TRX"
	// WEB Internet-Initiated/Mobile Entry - A code indicating an entry submitted pursuant to an authorization obtained
	// solely via the Internet or a mobile network. For consumer accounts only.
	WEB = "WEB"
	// XCK Destroyed Check Entry - A code indicating a debit entry initiated for a destroyed check eligible items
	XCK = "XCK"
)
View Source
const (

	// MixedDebitsAndCredits indicates a batch can have debit and credit ACH entries
	MixedDebitsAndCredits = 200
	// CreditsOnly indicates a batch can only have credit ACH entries
	CreditsOnly = 220
	// DebitsOnly indicates a batch can only have debit ACH entries
	DebitsOnly = 225
	// AutomatedAccountingAdvices indicates a batch can only have Automated Accounting Advices (debit and credit)
	AutomatedAccountingAdvices = 280
)
View Source
const (
	// CategoryForward defines the entry as being sent to the receiving institution
	CategoryForward = "Forward"
	// CategoryReturn defines the entry as being a return of a forward entry back to the originating institution
	CategoryReturn = "Return"
	// CategoryNOC defines the entry as being a notification of change of a forward entry to the originating institution
	CategoryNOC = "NOC"
	// CategoryDishonoredReturn defines the entry as being a dishonored return initiated by the ODFI to the RDFI that
	// submitted the return entry
	CategoryDishonoredReturn = "DishonoredReturn"
	// CategoryDishonoredReturnContested defines the entry as a contested dishonored return initiated by the RDFI to
	// the ODFI that submitted the dishonored return
	CategoryDishonoredReturnContested = "DishonoredReturnContested"

	// CheckingCredit is a credit to the receiver's checking account
	CheckingCredit = 22
	// CheckingReturnNOCCredit is a return that credits the receiver's checking account
	CheckingReturnNOCCredit = 21
	// CheckingPrenoteCredit is a pre-notification of a credit to the receiver's checking account
	CheckingPrenoteCredit = 23
	// CheckingZeroDollarRemittanceCredit is a zero dollar remittance data credit to a checking account for CCD, CTX,
	// ACK, and ATX entries
	CheckingZeroDollarRemittanceCredit = 24
	// CheckingDebit is a debit to the receivers checking account
	CheckingDebit = 27
	// CheckingReturnNOCDebit is a return that debits the receiver's checking account
	CheckingReturnNOCDebit = 26
	// CheckingPrenoteDebit is a pre-notification of a debit to the receiver's checking account
	CheckingPrenoteDebit = 28
	// CheckingZeroDollarRemittanceDebit is a zero dollar remittance data debit to a checking account for CCD, CTX,
	// ACK, and ATX entries
	CheckingZeroDollarRemittanceDebit = 29

	// SavingsCredit is a credit to the receiver's savings account
	SavingsCredit = 32
	// SavingsReturnNOCCredit is a return that credits the receiver's savings account
	SavingsReturnNOCCredit = 31
	// SavingsPrenoteCredit is a pre-notification of a credit to the receiver's savings account
	SavingsPrenoteCredit = 33
	// SavingsZeroDollarRemittanceCredit is a zero dollar remittance data credit to a savings account for CCD
	// and CTX entries
	SavingsZeroDollarRemittanceCredit = 34
	// SavingsDebit is a debit to the receivers savings account
	SavingsDebit = 37
	// SavingsReturnNOCDebit is a return that debits the receiver's savings account
	SavingsReturnNOCDebit = 36
	// SavingsPrenoteDebit is a pre-notification of a debit to the receiver's savings account
	SavingsPrenoteDebit = 38
	// SavingsZeroDollarRemittanceDebit is a zero dollar remittance data debit to a savings account for CCD
	// and CTX entries
	SavingsZeroDollarRemittanceDebit = 39

	// GLCredit is a credit to the receiver's general ledger (GL) account
	GLCredit = 42
	// GLReturnNOCCredit is a return that credits the receiver's general ledger (GL) account
	GLReturnNOCCredit = 41
	// GLPrenoteCredit is a pre-notification of a credit to the receiver's general ledger (GL) account
	GLPrenoteCredit = 43
	// GLZeroDollarRemittanceCredit is a zero dollar remittance data credit to the receiver's general ledger (GL) account
	GLZeroDollarRemittanceCredit = 44
	// GLDebit is a debit to the receiver's general ledger (GL) account
	GLDebit = 47
	// GLReturnNOCDebit is a return that debits the receiver's general ledger (GL) account
	GLReturnNOCDebit = 46
	// GLPrenoteDebit is a pre-notification of a debit to the receiver's general ledger (GL) account
	GLPrenoteDebit = 48
	// GLZeroDollarRemittanceDebit is a zero dollar remittance data debit to the receiver's general ledger (GL) account
	GLZeroDollarRemittanceDebit = 49

	// LoanCredit is a credit to the receiver's loan account
	LoanCredit = 52
	// LoanReturnNOCCredit is a return that credits the receiver's loan account
	LoanReturnNOCCredit = 51
	// LoanPrenoteCredit is a pre-notification of a credit to the receiver's loan account
	LoanPrenoteCredit = 53
	// LoanZeroDollarRemittanceCredit is a zero dollar remittance data credit to the receiver's loan account
	LoanZeroDollarRemittanceCredit = 54
	// LoanDebit is a debit (Reversal's Only) to the receiver's loan account
	LoanDebit = 55
	// LoanReturnNOCDebit is a return that debits the receiver's loan account
	LoanReturnNOCDebit = 56
)
View Source
const (
	// IATCOR is the valid value for IATBatchHeader.IATIndicator for IAT Notification Of Changr
	IATCOR = "IATCOR"
)
View Source
const (
	NACHAFileLineLimit = 10000
)
View Source
const (
	// NachaBatchDebitCreditLimit is the maximum amount allowed by the Nacha format for a batch's debit/credit total (12 digits)
	NachaBatchDebitCreditLimit = 9_999_999_999_99
)
View Source
const (
	// NachaEntryAmountLimit is the maximum amount allowed by the Nacha format for an entry (10 digits)
	NachaEntryAmountLimit = 99_999_999_99
)
View Source
const (
	// NachaFileDebitCreditLimit is the maximum amount allowed by the Nacha format for a batch's debit/credit total (12 digits)
	NachaFileDebitCreditLimit = 9_999_999_999_99
)
View Source
const (

	// RecordLength character count of each line representing a letter in a file
	RecordLength = 94
)

First position of all Record Types. These codes are uniquely assigned to the first byte of each row in a file.

View Source
const Version = "v1.44.2"

Version Number

Variables

View Source
var (
	// ErrBatchNoEntries is the error given when a batch doesn't have any entries
	ErrBatchNoEntries = errors.New("must have Entry Record(s) to be built")
	// ErrBatchADVCount is the error given when an ADV batch has too many entries
	ErrBatchADVCount = errors.New("there can be a maximum of 9999 ADV Sequence Numbers (ADV Entry Detail Records)")
	// ErrBatchAddendaIndicator is the error given when the addenda indicator is incorrectly set
	ErrBatchAddendaIndicator = errors.New("is 0 but found addenda record(s)")
	// ErrBatchOriginatorDNE is the error given when a non-government agency tries to originate a DNE
	ErrBatchOriginatorDNE = errors.New("only government agencies (originator status code 2) can originate a DNE")
	// ErrBatchInvalidCardTransactionType is the error given when a card transaction type is invalid
	ErrBatchInvalidCardTransactionType = errors.New("invalid card transaction type")
	// ErrBatchDebitOnly is the error given when a batch which can only have debits has a credit
	ErrBatchDebitOnly = errors.New("this batch type does not allow credit transaction codes")
	// ErrBatchCheckSerialNumber is the error given when a batch requires check serial numbers, but it is missing
	ErrBatchCheckSerialNumber = errors.New("this batch type requires entries to have Check Serial Numbers")
	// ErrBatchSECType is the error given when the batch's header has the wrong SEC for its type
	ErrBatchSECType = errors.New("header SEC does not match this batch's type")
	// ErrBatchServiceClassCode is the error given when the batch's header has the wrong SCC for its type
	ErrBatchServiceClassCode = errors.New("header SCC is not valid for this batch's type")
	// ErrBatchTransactionCode is the error given when a batch has an invalid transaction code
	ErrBatchTransactionCode = errors.New("transaction code is not valid for this batch's type")
	// ErrBatchTransactionCodeAddenda is the error given when a batch has an addenda on a transaction code which doesn't allow it
	ErrBatchTransactionCodeAddenda = errors.New("this batch type does not allow an addenda for this transaction code")
	// ErrBatchAmountNonZero is the error given when an entry for a non-zero amount is in a batch that requires zero amount entries
	ErrBatchAmountNonZero = errors.New("this batch type requires that the amount is zero")
	// ErrBatchAmountZero is the error given when an entry for zero amount is in a batch that requires non-zero amount entries
	ErrBatchAmountZero = errors.New("this batch type requires that the amount is non-zero")
	// ErrBatchCompanyEntryDescriptionAutoenroll is the error given when the Company Entry Description is invalid (needs to be 'Autoenroll')
	ErrBatchCompanyEntryDescriptionAutoenroll = errors.New("this batch type requires that the Company Entry Description is AUTOENROLL")
	// ErrBatchCompanyEntryDescriptionREDEPCHECK is the error given when the Company Entry Description is invalid (needs to be 'REDEPCHECK')
	ErrBatchCompanyEntryDescriptionREDEPCHECK = errors.New("this batch type requires that the Company Entry Description is REDEPCHECK")
	// ErrBatchAddendaCategory is the error given when the addenda isn't allowed for the batch's type and category
	ErrBatchAddendaCategory = errors.New("this batch type does not allow this addenda for category")
)
View Source
var (

	//ErrNonAlphanumeric is given when a field has non-alphanumeric characters
	ErrNonAlphanumeric = errors.New("has non alphanumeric characters")
	//ErrUpperAlpha is given when a field is not in uppercase
	ErrUpperAlpha = errors.New("is not uppercase A-Z or 0-9")
	//ErrFieldInclusion is given when a field is mandatory and has a default value
	ErrFieldInclusion = errors.New("is a mandatory field and has a default value")
	//ErrConstructor is given when there's a mandatory field is not initialized correctly, and prompts to use the constructor
	ErrConstructor = errors.New("is a mandatory field and has a default value, did you use the constructor?")
	//ErrFieldRequired is given when a field is required
	ErrFieldRequired = errors.New("is a required field")
	//ErrServiceClass is given when there's an invalid service class code
	ErrServiceClass = errors.New("is an invalid Service Class Code")
	//ErrSECCode is given when there's an invalid standard entry class code
	ErrSECCode = errors.New("is an invalid Standard Entry Class Code")
	//ErrOrigStatusCode is given when there's an invalid originator status code
	ErrOrigStatusCode = errors.New("is an invalid Originator Status Code")
	//ErrAddendaTypeCode is given when there's an invalid addenda type code
	ErrAddendaTypeCode = errors.New("is an invalid Addenda Type Code")
	//ErrTransactionCode is given when there's an invalid transaction code
	ErrTransactionCode = errors.New("is an invalid Transaction Code")
	//ErrIdentificationNumber is given when there's an invalid identification number
	ErrIdentificationNumber = errors.New("is an invalid identification number")
	//ErrCardTransactionType  is given when there's an invalid card transaction type
	ErrCardTransactionType = errors.New("is an invalid Card Transaction Type")
	//ErrValidMonth is given when there's an invalid month
	ErrValidMonth = errors.New("is an invalid month")
	//ErrValidDay is given when there's an invalid day
	ErrValidDay = errors.New("is an invalid day")
	//ErrValidYear is given when there's an invalid year
	ErrValidYear = errors.New("is an invalid year")
	// ErrValidState is the error given when a field has an invalid US state or territory
	ErrValidState = errors.New("is an invalid US state or territory")
	// ErrValidISO3166 is the error given when a field has an invalid ISO 3166-1-alpha-2 code
	ErrValidISO3166 = errors.New("is an invalid ISO 3166-1-alpha-2 code")
	// ErrValidISO4217 is the error given when a field has an invalid ISO 4217 code
	ErrValidISO4217 = errors.New("is an invalid ISO 4217 code")

	// ErrNegativeAmount is the error given when an Amount value is negaitve, which is
	// against NACHA rules and guidelines.
	ErrNegativeAmount = errors.New("amounts cannot be negative")

	// ErrAddenda98ChangeCode is given when there's an invalid addenda change code
	ErrAddenda98ChangeCode = errors.New("found is not a valid addenda Change Code")
	// ErrAddenda98RefusedChangeCode is given when there's an invalid addenda refused change code
	ErrAddenda98RefusedChangeCode = errors.New("found is not a valid addenda Refused Change Code")
	// ErrAddenda98RefusedTraceSequenceNumber is given when there's an invalid addenda trace sequence number
	ErrAddenda98RefusedTraceSequenceNumber = errors.New("found is not a valid addenda trace sequence number")
	// ErrAddenda98CorrectedData is given when the corrected data does not corespond to the change code
	ErrAddenda98CorrectedData = errors.New("must contain the corrected information corresponding to the Change Code")
	// ErrAddenda99ReturnCode is given when there's an invalid return code
	ErrAddenda99ReturnCode = errors.New("found is not a valid return code")
	// ErrAddenda99DishonoredReturnCode is given when there's an invalid dishonored return code
	ErrAddenda99DishonoredReturnCode = errors.New("found is not a valid dishonored return code")
	// ErrAddenda99ContestedReturnCode is given when there's an invalid dishonored return code
	ErrAddenda99ContestedReturnCode = errors.New("found is not a valid contested dishonored return code")
	// ErrBatchCORAddenda is given when an entry in a COR batch does not have an addenda98
	ErrBatchCORAddenda = errors.New("one Addenda98 or Addenda98Refused record is required for each entry in SEC Type COR")

	// ErrRecordSize is given when there's an invalid record size
	ErrRecordSize = errors.New("is not 094")
	// ErrBlockingFactor is given when there's an invalid blocking factor
	ErrBlockingFactor = errors.New("is not 10")
	// ErrFormatCode is given when there's an invalid format code
	ErrFormatCode = errors.New("is not 1")

	// ErrForeignExchangeIndicator is given when there's an invalid foreign exchange indicator
	ErrForeignExchangeIndicator = errors.New("is an invalid Foreign Exchange Indicator")
	// ErrForeignExchangeReferenceIndicator is given when there's an invalid foreign exchange reference indicator
	ErrForeignExchangeReferenceIndicator = errors.New("is an invalid Foreign Exchange Reference Indicator")
	// ErrTransactionTypeCode is given when there's an invalid transaction type code
	ErrTransactionTypeCode = errors.New("is an invalid Addenda10 Transaction Type Code")
	// ErrIDNumberQualifier is given when there's an invalid identification number qualifier
	ErrIDNumberQualifier = errors.New("is an invalid Identification Number Qualifier")
	// ErrIATBatchAddendaIndicator is given when there's an invalid addenda record for an IAT batch
	ErrIATBatchAddendaIndicator = errors.New("is invalid for addenda record(s) found")
)
View Source
var (
	// ErrFileTooLong is the error given when a file exceeds the maximum possible length
	ErrFileTooLong = errors.New("file exceeds maximum possible number of lines")
	// ErrFileHeader is the error given if there is the wrong number of file headers
	ErrFileHeader = errors.New("none or more than one file headers exists")
	// ErrFileControl is the error given if there is the wrong number of file control records
	ErrFileControl = errors.New("none or more than one file control exists")
	// ErrFileEntryOutsideBatch is the error given if an entry is outside of a batch
	ErrFileEntryOutsideBatch = errors.New("entry outside of batch")
	// ErrFileAddendaOutsideBatch is the error given if an addenda is outside of a batch
	ErrFileAddendaOutsideBatch = errors.New("addenda outside of batch")
	// ErrFileAddendaOutsideEntry is the error given if an addenda is outside of an entry
	ErrFileAddendaOutsideEntry = errors.New("addenda outside of entry")
	// ErrFileBatchControlOutsideBatch is the error given if a batch control record is outside of a batch
	ErrFileBatchControlOutsideBatch = errors.New("batch control outside of batch")
	// ErrFileConsecutiveBatchHeaders is the error given when multiple batch header records occur in sequence
	ErrFileConsecutiveBatchHeaders = errors.New("consecutive Batch Headers in file")
	// ErrFileADVOnly is the error given if an ADV only file has a non-ADV batch
	ErrFileADVOnly = errors.New("file can only have ADV Batches")
	// ErrFileIATSEC is the error given if an IAT batch uses the normal NewBatch
	ErrFileIATSEC = errors.New("IAT Standard Entry Class Code should use iatBatch")
	// ErrFileNoBatches is the error given if a file has no batches
	ErrFileNoBatches = errors.New("must have []*Batches or []*IATBatches to be built")

	ErrInvalidJSON = errors.New("invalid JSON")
)
View Source
var (
	ErrFlattenChangedEntryCount   = errors.New("Flatten operation changed entry and addenda count")
	ErrFlattenChangedDebitAmount  = errors.New("Flatten operation changed total debit entry amount")
	ErrFlattenChangedCreditAmount = errors.New("Flatten operation changed total credit entry amount")
)
View Source
var (
	ErrPleaseReportBug = errors.New("Please report this error to github.com/moov-io/ach/issues")
)

Functions

func CalculateCheckDigit added in v1.24.0

func CalculateCheckDigit(routingNumber string) int

CalculateCheckDigit returns a check digit for a routing number Multiply each digit in the Routing number by a weighting factor. The weighting factors for each digit are: Position: 1 2 3 4 5 6 7 8 Weights : 3 7 1 3 7 1 3 7 Add the results of the eight multiplications Subtract the sum from the next highest multiple of 10. The result is the Check Digit

func CheckRoutingNumber added in v0.6.0

func CheckRoutingNumber(routingNumber string) error

CheckRoutingNumber returns a nil error if the provided routingNumber is valid according to NACHA rules. See CalculateCheckDigit for details on computing the check digit.

func IsContestedReturnCode added in v1.14.0

func IsContestedReturnCode(code string) bool

func IsDishonoredReturnCode added in v1.14.0

func IsDishonoredReturnCode(code string) bool

func IsRefusedChangeCode added in v1.32.0

func IsRefusedChangeCode(code string) bool

func StandardTransactionCode added in v1.5.0

func StandardTransactionCode(code int) error

StandardTransactionCode checks the provided TransactionCode to verify it is a valid NACHA value.

func WriteCorrectionData added in v1.3.0

func WriteCorrectionData(code string, data *CorrectedData) string

ParseCorrectedData returns the string properlty formatted and justified for an Addenda98.CorrectedData field. The code must be an official NACHA change code.

Types

type ADVBatchControl added in v0.5.0

type ADVBatchControl struct {
	// ID is an identifier only used by the moov-io/ach HTTP server as a way to identify a batch.
	ID string `json:"id"`
	// This should be the same as BatchHeader ServiceClassCode for ADV: AutomatedAccountingAdvices.
	ServiceClassCode int `json:"serviceClassCode"`
	// EntryAddendaCount is a tally of each Entry Detail Record and each Addenda
	// Record processed, within either the batch or file as appropriate.
	EntryAddendaCount int `json:"entryAddendaCount"`
	// validate the Receiving DFI Identification in each Entry Detail Record is hashed
	// to provide a check against inadvertent alteration of data contents due
	// to hardware failure or program error
	//
	// In this context the Entry Hash is the sum of the corresponding fields in the
	// Entry Detail Records on the file.
	EntryHash int `json:"entryHash"`
	// TotalDebitEntryDollarAmount Contains accumulated Entry debit totals within the batch.
	TotalDebitEntryDollarAmount int `json:"totalDebit"`
	// TotalCreditEntryDollarAmount Contains accumulated Entry credit totals within the batch.
	TotalCreditEntryDollarAmount int `json:"totalCredit"`
	// ACHOperatorData is an alphanumeric code used to identify an ACH Operator
	ACHOperatorData string `json:"achOperatorData"`
	// ODFIIdentification the routing number is used to identify the DFI originating entries within a given branch.
	ODFIIdentification string `json:"ODFIIdentification"`
	// BatchNumber this number is assigned in ascending sequence to each batch by the ODFI
	// or its Sending Point in a given file of entries. Since the batch number
	// in the Batch Header Record and the Batch Control Record is the same,
	// the ascending sequence number should be assigned by batch and not by record.
	BatchNumber int `json:"batchNumber"`
	// contains filtered or unexported fields
}

ADVBatchControl contains entry counts, dollar total and has totals for all entries contained in the preceding batch

func NewADVBatchControl added in v0.5.0

func NewADVBatchControl() *ADVBatchControl

NewADVBatchControl returns a new ADVBatchControl with default values for none exported fields

func (*ADVBatchControl) ACHOperatorDataField added in v0.5.0

func (bc *ADVBatchControl) ACHOperatorDataField() string

ACHOperatorDataField get the ACHOperatorData right padded

func (*ADVBatchControl) BatchNumberField added in v0.5.0

func (bc *ADVBatchControl) BatchNumberField() string

BatchNumberField gets a string of the batch number zero padded

func (*ADVBatchControl) CalculateCheckDigit added in v0.5.0

func (v *ADVBatchControl) CalculateCheckDigit(routingNumber string) int

func (*ADVBatchControl) EntryAddendaCountField added in v0.5.0

func (bc *ADVBatchControl) EntryAddendaCountField() string

EntryAddendaCountField gets a string of the addenda count zero padded

func (*ADVBatchControl) EntryHashField added in v0.5.0

func (bc *ADVBatchControl) EntryHashField() string

EntryHashField get a zero padded EntryHash

func (*ADVBatchControl) ODFIIdentificationField added in v0.5.0

func (bc *ADVBatchControl) ODFIIdentificationField() string

ODFIIdentificationField get the odfi number zero padded

func (*ADVBatchControl) Parse added in v0.5.0

func (bc *ADVBatchControl) Parse(record string)

Parse takes the input record string and parses the EntryDetail values

func (*ADVBatchControl) String added in v0.5.0

func (bc *ADVBatchControl) String() string

String writes the ADVBatchControl struct to a 94 character string.

func (*ADVBatchControl) TotalCreditEntryDollarAmountField added in v0.5.0

func (bc *ADVBatchControl) TotalCreditEntryDollarAmountField() string

TotalCreditEntryDollarAmountField get a zero padded Credit Entry Amount

func (*ADVBatchControl) TotalDebitEntryDollarAmountField added in v0.5.0

func (bc *ADVBatchControl) TotalDebitEntryDollarAmountField() string

TotalDebitEntryDollarAmountField get a zero padded Debit Entry Amount

func (*ADVBatchControl) Validate added in v0.5.0

func (bc *ADVBatchControl) Validate() error

Validate performs NACHA format rule checks on the record and returns an error if not Validated The first error encountered is returned and stops that parsing.

type ADVEntryDetail added in v0.5.0

type ADVEntryDetail struct {
	// ID is an identifier only used by the moov-io/ach HTTP server as a way to identify a batch.
	ID string `json:"id"`
	// TransactionCode representing Accounting Entries
	// Credit for ACH debits originated - 81
	// Debit for ACH credits originated - 82
	// Credit for ACH credits received 83
	// Debit for ACH debits received 84
	// Credit for ACH credits in rejected batches 85
	// Debit for ACH debits in rejected batches - 86
	// Summary credit for respondent ACH activity - 87
	// Summary debit for respondent ACH activity - 88
	TransactionCode int `json:"transactionCode"`
	// RDFIIdentification is the RDFI's routing number without the last digit.
	// Receiving Depository Financial Institution
	RDFIIdentification string `json:"RDFIIdentification"`
	// CheckDigit the last digit of the RDFI's routing number
	CheckDigit string `json:"checkDigit"`
	// DFIAccountNumber is the receiver's bank account number you are crediting/debiting.
	// It important to note that this is an alphanumeric field, so its space padded, no zero padded
	DFIAccountNumber string `json:"DFIAccountNumber"`
	// Amount Number of cents you are debiting/crediting this account
	Amount int `json:"amount"`
	// AdviceRoutingNumber
	AdviceRoutingNumber string `json:"adviceRoutingNumber"`
	// FileIdentification
	FileIdentification string `json:"fileIdentification,omitempty"`
	// ACHOperatorData
	ACHOperatorData string `json:"achOperatorData,omitempty"`
	// IndividualName The name of the receiver, usually the name on the bank account
	IndividualName string `json:"individualName"`
	// DiscretionaryData allows ODFIs to include codes, of significance only to them,
	// to enable specialized handling of the entry. There will be no
	// standardized interpretation for the value of this field. It can either
	// be a single two-character code, or two distinct one-character codes,
	// according to the needs of the ODFI and/or Originator involved. This
	// field must be returned intact for any returned entry.
	DiscretionaryData string `json:"discretionaryData,omitempty"`
	// AddendaRecordIndicator indicates the existence of an Addenda Record.
	// A value of "1" indicates that one ore more addenda records follow,
	// and "0" means no such record is present.
	AddendaRecordIndicator int `json:"addendaRecordIndicator,omitempty"`
	// ACHOperatorRoutingNumber
	ACHOperatorRoutingNumber string `json:"achOperatorRoutingNumber"`
	// JulianDay
	JulianDay int `json:"julianDay"`
	// SequenceNumber
	SequenceNumber int `json:"sequenceNumber"`
	// Addenda99 for use with Returns
	Addenda99 *Addenda99 `json:"addenda99,omitempty"`
	// Category defines if the entry is a Forward, Return, or NOC
	Category string `json:"category,omitempty"`
	// contains filtered or unexported fields
}

ADVEntryDetail contains the actual transaction data for an individual entry. Fields include those designating the entry as a deposit (credit) or withdrawal (debit), the transit routing number for the entry recipient's financial institution, the account number (left justify,no zero fill), name, and dollar amount.

func NewADVEntryDetail added in v0.5.0

func NewADVEntryDetail() *ADVEntryDetail

NewADVEntryDetail returns a new ADVEntryDetail with default values for non exported fields

func (*ADVEntryDetail) ACHOperatorDataField added in v0.5.0

func (ed *ADVEntryDetail) ACHOperatorDataField() string

ACHOperatorDataField returns a space padded string of ACHOperatorData

func (*ADVEntryDetail) ACHOperatorRoutingNumberField added in v0.5.0

func (ed *ADVEntryDetail) ACHOperatorRoutingNumberField() string

ACHOperatorRoutingNumberField returns a space padded string of ACHOperatorRoutingNumber

func (*ADVEntryDetail) AdviceRoutingNumberField added in v0.5.0

func (ed *ADVEntryDetail) AdviceRoutingNumberField() string

AdviceRoutingNumberField gets the AdviceRoutingNumber with zero padding

func (*ADVEntryDetail) AmountField added in v0.5.0

func (ed *ADVEntryDetail) AmountField() string

AmountField returns a zero padded string of amount

func (*ADVEntryDetail) CalculateCheckDigit added in v0.5.0

func (v *ADVEntryDetail) CalculateCheckDigit(routingNumber string) int

func (*ADVEntryDetail) DFIAccountNumberField added in v0.5.0

func (ed *ADVEntryDetail) DFIAccountNumberField() string

DFIAccountNumberField gets the DFIAccountNumber with space padding

func (*ADVEntryDetail) DiscretionaryDataField added in v0.5.0

func (ed *ADVEntryDetail) DiscretionaryDataField() string

DiscretionaryDataField returns a space padded string of DiscretionaryData

func (*ADVEntryDetail) FileIdentificationField added in v0.5.0

func (ed *ADVEntryDetail) FileIdentificationField() string

FileIdentificationField returns a space padded string of FileIdentification

func (*ADVEntryDetail) IndividualNameField added in v0.5.0

func (ed *ADVEntryDetail) IndividualNameField() string

IndividualNameField returns a space padded string of IndividualName

func (*ADVEntryDetail) JulianDateDayField added in v0.5.0

func (ed *ADVEntryDetail) JulianDateDayField() string

JulianDateDayField returns a zero padded string of JulianDay

func (*ADVEntryDetail) Parse added in v0.5.0

func (ed *ADVEntryDetail) Parse(record string)

Parse ADVEntryDetail

func (*ADVEntryDetail) RDFIIdentificationField added in v0.5.0

func (ed *ADVEntryDetail) RDFIIdentificationField() string

RDFIIdentificationField get the rdfiIdentification with zero padding

func (*ADVEntryDetail) SequenceNumberField added in v0.5.0

func (ed *ADVEntryDetail) SequenceNumberField() string

SequenceNumberField returns a zero padded string of SequenceNumber

func (*ADVEntryDetail) SetRDFI added in v0.5.0

func (ed *ADVEntryDetail) SetRDFI(rdfi string) *ADVEntryDetail

SetRDFI takes the 9 digit RDFI account number and separates it for RDFIIdentification and CheckDigit

func (*ADVEntryDetail) String added in v0.5.0

func (ed *ADVEntryDetail) String() string

String writes the ADVEntryDetail struct to a 94 character string.

func (*ADVEntryDetail) Validate added in v0.5.0

func (ed *ADVEntryDetail) Validate() error

Validate performs NACHA format rule checks on the record and returns an error if not Validated The first error encountered is returned and stops that parsing.

type ADVFileControl added in v0.5.0

type ADVFileControl struct {
	// ID is an identifier only used by the moov-io/ach HTTP server as a way to identify a batch.
	ID string `json:"id"`

	// BatchCount total number of batches (i.e., '5' records) in the file
	BatchCount int `json:"batchCount"`

	// BlockCount total number of records in the file (include all headers and trailer) divided
	// by 10 (This number must be evenly divisible by 10. If not, additional records consisting of all 9's are added to the file after the initial '9' record to fill out the block 10.)
	BlockCount int `json:"blockCount,omitempty"`

	// EntryAddendaCount total detail and addenda records in the file
	EntryAddendaCount int `json:"entryAddendaCount"`

	// EntryHash calculated in the same manner as the batch has total but includes total from entire file
	EntryHash int `json:"entryHash"`

	// TotalDebitEntryDollarAmountInFile contains accumulated Batch debit totals within the file.
	TotalDebitEntryDollarAmountInFile int `json:"totalDebit"`

	// TotalCreditEntryDollarAmountInFile contains accumulated Batch credit totals within the file.
	TotalCreditEntryDollarAmountInFile int `json:"totalCredit"`
	// contains filtered or unexported fields
}

ADVFileControl record contains entry counts, dollar totals and hash totals accumulated from each batchADV control record in the file.

func NewADVFileControl added in v0.5.0

func NewADVFileControl() ADVFileControl

NewADVFileControl returns a new ADVFileControl with default values for none exported fields

func (*ADVFileControl) BatchCountField added in v0.5.0

func (fc *ADVFileControl) BatchCountField() string

BatchCountField gets a string of the batch count zero padded

func (*ADVFileControl) BlockCountField added in v0.5.0

func (fc *ADVFileControl) BlockCountField() string

BlockCountField gets a string of the block count zero padded

func (*ADVFileControl) CalculateCheckDigit added in v0.5.0

func (v *ADVFileControl) CalculateCheckDigit(routingNumber string) int

func (*ADVFileControl) EntryAddendaCountField added in v0.5.0

func (fc *ADVFileControl) EntryAddendaCountField() string

EntryAddendaCountField gets a string of entry addenda batch count zero padded

func (*ADVFileControl) EntryHashField added in v0.5.0

func (fc *ADVFileControl) EntryHashField() string

EntryHashField gets a string of entry hash zero padded

func (*ADVFileControl) Parse added in v0.5.0

func (fc *ADVFileControl) Parse(record string)

Parse takes the input record string and parses the FileControl values Parse provides no guarantee about all fields being filled in. Callers should make a Validate call to confirm successful parsing and data validity.

func (*ADVFileControl) String added in v0.5.0

func (fc *ADVFileControl) String() string

String writes the ADVFileControl struct to a 94 character string.

func (*ADVFileControl) TotalCreditEntryDollarAmountInFileField added in v0.5.0

func (fc *ADVFileControl) TotalCreditEntryDollarAmountInFileField() string

TotalCreditEntryDollarAmountInFileField get a zero padded Total credit Entry Amount

func (*ADVFileControl) TotalDebitEntryDollarAmountInFileField added in v0.5.0

func (fc *ADVFileControl) TotalDebitEntryDollarAmountInFileField() string

TotalDebitEntryDollarAmountInFileField get a zero padded Total debit Entry Amount

func (*ADVFileControl) Validate added in v0.5.0

func (fc *ADVFileControl) Validate() error

Validate performs NACHA format rule checks on the record and returns an error if not Validated The first error encountered is returned and stops that parsing.

type Addenda02 added in v0.3.0

type Addenda02 struct {
	// ID is an identifier only used by the moov-io/ach HTTP server as a way to identify a batch.
	ID string `json:"id"`
	// TypeCode Addenda02 type code '02'
	TypeCode string `json:"typeCode"`
	// ReferenceInformationOne may be used for additional reference numbers, identification numbers,
	// or codes that the merchant needs to identify the particular transaction or customer.
	ReferenceInformationOne string `json:"referenceInformationOne,omitempty"`
	// ReferenceInformationTwo  may be used for additional reference numbers, identification numbers,
	// or codes that the merchant needs to identify the particular transaction or customer.
	ReferenceInformationTwo string `json:"referenceInformationTwo,omitempty"`
	// TerminalIdentificationCode identifies an Electronic terminal with a unique code that allows
	// a terminal owner and/or switching network to identify the terminal at which an Entry originated.
	TerminalIdentificationCode string `json:"terminalIdentificationCode"`
	// TransactionSerialNumber is assigned by the terminal at the time the transaction is originated.  The
	// number, with the Terminal Identification Code, serves as an audit trail for the transaction and is
	// usually assigned in ascending sequence.
	TransactionSerialNumber string `json:"transactionSerialNumber"`
	// TransactionDate expressed MMDD identifies the date on which the transaction occurred.
	TransactionDate string `json:"transactionDate"`
	// AuthorizationCodeOrExpireDate indicates the code that a card authorization center has
	// furnished to the merchant.
	AuthorizationCodeOrExpireDate string `json:"authorizationCodeOrExpireDate,omitempty"`
	// Terminal Location identifies the specific location of a terminal (i.e., street names of an
	// intersection, address, etc.) in accordance with the requirements of Regulation E.
	TerminalLocation string `json:"terminalLocation"`
	// TerminalCity Identifies the city in which the electronic terminal is located.
	TerminalCity string `json:"terminalCity"`
	// TerminalState Identifies the state in which the electronic terminal is located
	TerminalState string `json:"terminalState"`
	// TraceNumber Standard Entry Detail Trace Number
	//
	// Use TraceNumberField for a properly formatted string representation.
	TraceNumber string `json:"traceNumber,omitempty"`
	// contains filtered or unexported fields
}

Addenda02 is a Addendumer addenda which provides business transaction information for Addenda Type Code 02 in a machine readable format. It is usually formatted according to ANSI, ASC, X12 Standard. It is used for following StandardEntryClassCode: MTE, POS, and SHR.

func NewAddenda02 added in v0.3.0

func NewAddenda02() *Addenda02

NewAddenda02 returns a new Addenda02 with default values for none exported fields

func (*Addenda02) AuthorizationCodeOrExpireDateField added in v0.3.0

func (addenda02 *Addenda02) AuthorizationCodeOrExpireDateField() string

AuthorizationCodeOrExpireDateField returns a space padded AuthorizationCodeOrExpireDate string

func (*Addenda02) CalculateCheckDigit added in v0.3.0

func (v *Addenda02) CalculateCheckDigit(routingNumber string) int

func (*Addenda02) Parse added in v0.3.0

func (addenda02 *Addenda02) Parse(record string)

Parse takes the input record string and parses the Addenda02 values

Parse provides no guarantee about all fields being filled in. Callers should make a Validate call to confirm successful parsing and data validity.

func (*Addenda02) ReferenceInformationOneField added in v0.3.0

func (addenda02 *Addenda02) ReferenceInformationOneField() string

ReferenceInformationOneField returns a space padded ReferenceInformationOne string

func (*Addenda02) ReferenceInformationTwoField added in v0.3.0

func (addenda02 *Addenda02) ReferenceInformationTwoField() string

ReferenceInformationTwoField returns a space padded ReferenceInformationTwo string

func (*Addenda02) String added in v0.3.0

func (addenda02 *Addenda02) String() string

String writes the Addenda02 struct to a 94 character string.

func (*Addenda02) TerminalCityField added in v0.3.0

func (addenda02 *Addenda02) TerminalCityField() string

TerminalCityField returns a space padded TerminalCity string

func (*Addenda02) TerminalIdentificationCodeField added in v0.3.0

func (addenda02 *Addenda02) TerminalIdentificationCodeField() string

TerminalIdentificationCodeField returns a space padded TerminalIdentificationCode string

func (*Addenda02) TerminalLocationField added in v0.3.0

func (addenda02 *Addenda02) TerminalLocationField() string

TerminalLocationField returns a space padded TerminalLocation string

func (*Addenda02) TerminalStateField added in v0.3.0

func (addenda02 *Addenda02) TerminalStateField() string

TerminalStateField returns a space padded TerminalState string

func (*Addenda02) TraceNumberField added in v0.3.0

func (addenda02 *Addenda02) TraceNumberField() string

TraceNumberField returns a space padded TraceNumber string

func (*Addenda02) TransactionDateField added in v0.3.0

func (addenda02 *Addenda02) TransactionDateField() string

TransactionDateField returns TransactionDate MMDD string

func (*Addenda02) TransactionSerialNumberField added in v0.3.0

func (addenda02 *Addenda02) TransactionSerialNumberField() string

TransactionSerialNumberField returns a zero padded TransactionSerialNumber string

func (*Addenda02) Validate added in v0.3.0

func (addenda02 *Addenda02) Validate() error

Validate performs NACHA format rule checks on the record and returns an error if not Validated The first error encountered is returned and stops that parsing.

type Addenda05 added in v0.2.0

type Addenda05 struct {
	// ID is an identifier only used by the moov-io/ach HTTP server as a way to identify a batch.
	ID string `json:"id"`
	// TypeCode Addenda05 types code '05'
	TypeCode string `json:"typeCode"`
	// PaymentRelatedInformation
	PaymentRelatedInformation string `json:"paymentRelatedInformation"`
	// SequenceNumber is consecutively assigned to each Addenda05 Record following
	// an Entry Detail Record. The first addenda05 sequence number must always
	// be a "1".
	SequenceNumber int `json:"sequenceNumber"`
	// EntryDetailSequenceNumber contains the ascending sequence number section of the Entry
	// Detail or Corporate Entry Detail Record's trace number This number is
	// the same as the last seven digits of the trace number of the related
	// Entry Detail Record or Corporate Entry Detail Record.
	EntryDetailSequenceNumber int `json:"entryDetailSequenceNumber"`
	// contains filtered or unexported fields
}

Addenda05 is a Addendumer addenda which provides business transaction information for Addenda Type Code 05 in a machine readable format. It is usually formatted according to ANSI, ASC, X12 Standard. It is used for the following StandardEntryClassCode: ACK, ATX, CCD, CIE, CTX, DNE, ENR, WEB, PPD, TRX.

func NewAddenda05 added in v0.2.0

func NewAddenda05() *Addenda05

NewAddenda05 returns a new Addenda05 with default values for none exported fields

func (*Addenda05) CalculateCheckDigit added in v0.2.0

func (v *Addenda05) CalculateCheckDigit(routingNumber string) int

func (*Addenda05) EntryDetailSequenceNumberField added in v0.2.0

func (addenda05 *Addenda05) EntryDetailSequenceNumberField() string

EntryDetailSequenceNumberField returns a zero padded EntryDetailSequenceNumber string

func (*Addenda05) Parse added in v0.2.0

func (addenda05 *Addenda05) Parse(record string)

Parse takes the input record string and parses the Addenda05 values

Parse provides no guarantee about all fields being filled in. Callers should make a Validate call to confirm successful parsing and data validity.

func (*Addenda05) PaymentRelatedInformationField added in v0.2.0

func (addenda05 *Addenda05) PaymentRelatedInformationField() string

PaymentRelatedInformationField returns a zero padded PaymentRelatedInformation string

func (*Addenda05) SequenceNumberField added in v0.2.0

func (addenda05 *Addenda05) SequenceNumberField() string

SequenceNumberField returns a zero padded SequenceNumber string

func (*Addenda05) String added in v0.2.0

func (addenda05 *Addenda05) String() string

String writes the Addenda05 struct to a 94 character string.

func (*Addenda05) Validate added in v0.2.0

func (addenda05 *Addenda05) Validate() error

Validate performs NACHA format rule checks on the record and returns an error if not Validated The first error encountered is returned and stops that parsing.

type Addenda10 added in v0.3.0

type Addenda10 struct {
	// ID is an identifier only used by the moov-io/ach HTTP server as a way to identify a batch.
	ID string `json:"id"`
	// TypeCode Addenda10 types code '10'
	TypeCode string `json:"typeCode"`
	// Transaction Type Code Describes the type of payment:
	// ANN = Annuity, BUS = Business/Commercial, DEP = Deposit, LOA = Loan, MIS = Miscellaneous, MOR = Mortgage
	// PEN = Pension, RLS = Rent/Lease, REM = Remittance2, SAL = Salary/Payroll, TAX = Tax, TEL = Telephone-Initiated Transaction
	// WEB = Internet-Initiated Transaction, ARC = Accounts Receivable Entry, BOC = Back Office Conversion Entry,
	// POP = Point of Purchase Entry, RCK = Re-presented Check Entry
	TransactionTypeCode string `json:"transactionTypeCode"`
	// Foreign Payment Amount $$$$$$$$$$$$$$$$¢¢
	// For inbound IAT payments this field should contain the USD amount or may be blank.
	ForeignPaymentAmount int `json:"foreignPaymentAmount"`
	// Foreign Trace Number
	ForeignTraceNumber string `json:"foreignTraceNumber,omitempty"`
	// Receiving Company Name/Individual Name
	Name string `json:"name"`
	// EntryDetailSequenceNumber contains the ascending sequence number section of the Entry
	// Detail or Corporate Entry Detail Record's trace number This number is
	// the same as the last seven digits of the trace number of the related
	// Entry Detail Record or Corporate Entry Detail Record.
	EntryDetailSequenceNumber int `json:"entryDetailSequenceNumber"`
	// contains filtered or unexported fields
}

Addenda10 is an addenda which provides business transaction information for Addenda Type Code 10 in a machine readable format. It is usually formatted according to ANSI, ASC, X12 Standard.

Addenda10 is mandatory for IAT entries

The Addenda10 Record identifies the Receiver of the transaction and the dollar amount of the payment.

func NewAddenda10 added in v0.3.0

func NewAddenda10() *Addenda10

NewAddenda10 returns a new Addenda10 with default values for none exported fields

func (*Addenda10) CalculateCheckDigit added in v0.3.0

func (v *Addenda10) CalculateCheckDigit(routingNumber string) int

func (*Addenda10) EntryDetailSequenceNumberField added in v0.3.0

func (addenda10 *Addenda10) EntryDetailSequenceNumberField() string

EntryDetailSequenceNumberField returns a zero padded EntryDetailSequenceNumber string

func (*Addenda10) ForeignPaymentAmountField added in v0.3.0

func (addenda10 *Addenda10) ForeignPaymentAmountField() string

ForeignPaymentAmountField returns ForeignPaymentAmount zero padded ToDo: Review/Add logic for blank ?

func (*Addenda10) ForeignTraceNumberField added in v0.3.0

func (addenda10 *Addenda10) ForeignTraceNumberField() string

ForeignTraceNumberField gets the Foreign TraceNumber left padded

func (*Addenda10) NameField added in v0.3.0

func (addenda10 *Addenda10) NameField() string

NameField gets the name field - Receiving Company Name/Individual Name left padded

func (*Addenda10) Parse added in v0.3.0

func (addenda10 *Addenda10) Parse(record string)

Parse takes the input record string and parses the Addenda10 values

Parse provides no guarantee about all fields being filled in. Callers should make a Validate call to confirm successful parsing and data validity.

func (*Addenda10) String added in v0.3.0

func (addenda10 *Addenda10) String() string

String writes the Addenda10 struct to a 94 character string.

func (*Addenda10) Validate added in v0.3.0

func (addenda10 *Addenda10) Validate() error

Validate performs NACHA format rule checks on the record and returns an error if not Validated The first error encountered is returned and stops that parsing.

type Addenda11 added in v0.3.0

type Addenda11 struct {
	// ID is an identifier only used by the moov-io/ach HTTP server as a way to identify a batch.
	ID string `json:"id"`
	// TypeCode Addenda11 types code '11'
	TypeCode string `json:"typeCode"`
	// Originator Name contains the originators name (your company name / name)
	OriginatorName string `json:"originatorName"`
	// Originator Street Address Contains the originators street address (your company's address / your address)
	OriginatorStreetAddress string `json:"originatorStreetAddress"`
	// EntryDetailSequenceNumber contains the ascending sequence number section of the Entry
	// Detail or Corporate Entry Detail Record's trace number This number is
	// the same as the last seven digits of the trace number of the related
	// Entry Detail Record or Corporate Entry Detail Record.
	EntryDetailSequenceNumber int `json:"entryDetailSequenceNumber"`
	// contains filtered or unexported fields
}

Addenda11 is an addenda which provides business transaction information for Addenda Type Code 11 in a machine readable format. It is usually formatted according to ANSI, ASC, X12 Standard.

Addenda11 is mandatory for IAT entries

The Addenda11 record identifies key information related to the Originator of the entry.

func NewAddenda11 added in v0.3.0

func NewAddenda11() *Addenda11

NewAddenda11 returns a new Addenda11 with default values for none exported fields

func (*Addenda11) CalculateCheckDigit added in v0.3.0

func (v *Addenda11) CalculateCheckDigit(routingNumber string) int

func (*Addenda11) EntryDetailSequenceNumberField added in v0.3.0

func (addenda11 *Addenda11) EntryDetailSequenceNumberField() string

EntryDetailSequenceNumberField returns a zero padded EntryDetailSequenceNumber string

func (*Addenda11) OriginatorNameField added in v0.3.0

func (addenda11 *Addenda11) OriginatorNameField() string

OriginatorNameField gets the OriginatorName field - Originator Company Name/Individual Name left padded

func (*Addenda11) OriginatorStreetAddressField added in v0.3.0

func (addenda11 *Addenda11) OriginatorStreetAddressField() string

OriginatorStreetAddressField gets the OriginatorStreetAddress field - Originator Street Address left padded

func (*Addenda11) Parse added in v0.3.0

func (addenda11 *Addenda11) Parse(record string)

Parse takes the input record string and parses the Addenda11 values

Parse provides no guarantee about all fields being filled in. Callers should make a Validate call to confirm successful parsing and data validity.

func (*Addenda11) String added in v0.3.0

func (addenda11 *Addenda11) String() string

String writes the Addenda11 struct to a 94 character string.

func (*Addenda11) Validate added in v0.3.0

func (addenda11 *Addenda11) Validate() error

Validate performs NACHA format rule checks on the record and returns an error if not Validated The first error encountered is returned and stops that parsing.

type Addenda12 added in v0.3.0

type Addenda12 struct {
	// ID is an identifier only used by the moov-io/ach HTTP server as a way to identify a batch.
	ID string `json:"id"`
	// TypeCode Addenda12 types code '12'
	TypeCode string `json:"typeCode"`
	// Originator City & State / Province
	// Data elements City and State / Province  should be separated with an asterisk (*) as a delimiter
	// and the field should end with a backslash (\).
	// For example: San Francisco*CA\
	OriginatorCityStateProvince string `json:"originatorCityStateProvince"`
	// Originator Country & Postal Code
	// Data elements must be separated by an asterisk (*) and must end with a backslash (\)
	// For example: US*10036\
	OriginatorCountryPostalCode string `json:"originatorCountryPostalCode"`
	// EntryDetailSequenceNumber contains the ascending sequence number section of the Entry
	// Detail or Corporate Entry Detail Record's trace number This number is
	// the same as the last seven digits of the trace number of the related
	// Entry Detail Record or Corporate Entry Detail Record.
	EntryDetailSequenceNumber int `json:"entryDetailSequenceNumber"`
	// contains filtered or unexported fields
}

Addenda12 is an addenda which provides business transaction information for Addenda Type Code 12 in a machine readable format. It is usually formatted according to ANSI, ASC, X12 Standard.

Addenda12 is mandatory for IAT entries

The Addenda12 record identifies key information related to the Originator of the entry.

func NewAddenda12 added in v0.3.0

func NewAddenda12() *Addenda12

NewAddenda12 returns a new Addenda12 with default values for none exported fields

func (*Addenda12) CalculateCheckDigit added in v0.3.0

func (v *Addenda12) CalculateCheckDigit(routingNumber string) int

func (*Addenda12) EntryDetailSequenceNumberField added in v0.3.0

func (addenda12 *Addenda12) EntryDetailSequenceNumberField() string

EntryDetailSequenceNumberField returns a zero padded EntryDetailSequenceNumber string

func (*Addenda12) OriginatorCityStateProvinceField added in v0.3.0

func (addenda12 *Addenda12) OriginatorCityStateProvinceField() string

OriginatorCityStateProvinceField gets the OriginatorCityStateProvinceField left padded

func (*Addenda12) OriginatorCountryPostalCodeField added in v0.3.0

func (addenda12 *Addenda12) OriginatorCountryPostalCodeField() string

OriginatorCountryPostalCodeField gets the OriginatorCountryPostalCode field left padded

func (*Addenda12) Parse added in v0.3.0

func (addenda12 *Addenda12) Parse(record string)

Parse takes the input record string and parses the Addenda12 values

Parse provides no guarantee about all fields being filled in. Callers should make a Validate call to confirm successful parsing and data validity.

func (*Addenda12) String added in v0.3.0

func (addenda12 *Addenda12) String() string

String writes the Addenda12 struct to a 94 character string.

func (*Addenda12) Validate added in v0.3.0

func (addenda12 *Addenda12) Validate() error

Validate performs NACHA format rule checks on the record and returns an error if not Validated The first error encountered is returned and stops that parsing.

type Addenda13 added in v0.3.0

type Addenda13 struct {
	// ID is an identifier only used by the moov-io/ach HTTP server as a way to identify a batch.
	ID string `json:"id"`
	// TypeCode Addenda13 types code '13'
	TypeCode string `json:"typeCode"`
	// Originating DFI Name
	// For Outbound IAT Entries, this field must contain the name of the U.S. ODFI.
	// For Inbound IATs: Name of the foreign bank providing funding for the payment transaction
	ODFIName string `json:"ODFIName"`
	// Originating DFI Identification Number Qualifier
	// For Inbound IATs: The 2-digit code that identifies the numbering scheme used in the
	// Foreign DFI Identification Number field:
	// 01 = National Clearing System
	// 02 = BIC Code
	// 03 = IBAN Code
	ODFIIDNumberQualifier string `json:"ODFIIDNumberQualifier"`
	// Originating DFI Identification
	// This field contains the routing number that identifies the U.S. ODFI initiating the entry.
	// For Inbound IATs: This field contains the bank ID number of the Foreign Bank providing funding
	// for the payment transaction.
	ODFIIdentification string `json:"ODFIIdentification"`
	// Originating DFI Branch Country Code
	// USb” = United States
	//(“b” indicates a blank space)
	// For Inbound IATs: This 3 position field contains a 2-character code as approved by the
	// International Organization for Standardization (ISO) used to identify the country in which
	// the branch of the bank that originated the entry is located. Values for other countries can
	// be found on the International Organization for Standardization website: www.iso.org.
	ODFIBranchCountryCode string `json:"ODFIBranchCountryCode"`
	// EntryDetailSequenceNumber contains the ascending sequence number section of the Entry
	// Detail or Corporate Entry Detail Record's trace number This number is
	// the same as the last seven digits of the trace number of the related
	// Entry Detail Record or Corporate Entry Detail Record.
	EntryDetailSequenceNumber int `json:"entryDetailSequenceNumber"`
	// contains filtered or unexported fields
}

Addenda13 is an addenda which provides business transaction information for Addenda Type Code 13 in a machine readable format. It is usually formatted according to ANSI, ASC, X13 Standard.

Addenda13 is mandatory for IAT entries

The Addenda13 contains information related to the financial institution originating the entry. For inbound IAT entries, the Fourth Addenda Record must contain information to identify the foreign financial institution that is providing the funding and payment instruction for the IAT entry.

func NewAddenda13 added in v0.3.0

func NewAddenda13() *Addenda13

NewAddenda13 returns a new Addenda13 with default values for none exported fields

func (*Addenda13) CalculateCheckDigit added in v0.3.0

func (v *Addenda13) CalculateCheckDigit(routingNumber string) int

func (*Addenda13) EntryDetailSequenceNumberField added in v0.3.0

func (addenda13 *Addenda13) EntryDetailSequenceNumberField() string

EntryDetailSequenceNumberField returns a zero padded EntryDetailSequenceNumber string

func (*Addenda13) ODFIBranchCountryCodeField added in v0.3.0

func (addenda13 *Addenda13) ODFIBranchCountryCodeField() string

ODFIBranchCountryCodeField gets the ODFIBranchCountryCode field left padded

func (*Addenda13) ODFIIDNumberQualifierField added in v0.3.0

func (addenda13 *Addenda13) ODFIIDNumberQualifierField() string

ODFIIDNumberQualifierField gets the ODFIIDNumberQualifier field left padded

func (*Addenda13) ODFIIdentificationField added in v0.3.0

func (addenda13 *Addenda13) ODFIIdentificationField() string

ODFIIdentificationField gets the ODFIIdentificationCode field left padded

func (*Addenda13) ODFINameField added in v0.3.0

func (addenda13 *Addenda13) ODFINameField() string

ODFINameField gets the ODFIName field left padded

func (*Addenda13) Parse added in v0.3.0

func (addenda13 *Addenda13) Parse(record string)

Parse takes the input record string and parses the Addenda13 values

Parse provides no guarantee about all fields being filled in. Callers should make a Validate call to confirm successful parsing and data validity.

func (*Addenda13) String added in v0.3.0

func (addenda13 *Addenda13) String() string

String writes the Addenda13 struct to a 94 character string.

func (*Addenda13) Validate added in v0.3.0

func (addenda13 *Addenda13) Validate() error

Validate performs NACHA format rule checks on the record and returns an error if not Validated The first error encountered is returned and stops that parsing.

type Addenda14 added in v0.3.0

type Addenda14 struct {
	// ID is an identifier only used by the moov-io/ach HTTP server as a way to identify a batch.
	ID string `json:"id"`
	// TypeCode Addenda14 types code '14'
	TypeCode string `json:"typeCode"`
	// Name of the Receiver's bank
	RDFIName string `json:"RDFIName"`
	// Receiving DFI Identification Number Qualifier
	// The 2-digit code that identifies the numbering scheme used in the
	// Receiving DFI Identification Number field:
	// 01 = National Clearing System
	// 02 = BIC Code
	// 03 = IBAN Code
	RDFIIDNumberQualifier string `json:"RDFIIDNumberQualifier"`
	// Receiving DFI Identification
	// This field contains the bank identification number of the DFI at which the
	// Receiver maintains his account.
	RDFIIdentification string `json:"RDFIIdentification"`
	// Receiving DFI Branch Country Code
	// USb” = United States
	//(“b” indicates a blank space)
	// This 3 position field contains a 2-character code as approved by the International
	// Organization for Standardization (ISO) used to identify the country in which the
	// branch of the bank that receives the entry is located. Values for other countries can
	// be found on the International Organization for Standardization website: www.iso.org
	RDFIBranchCountryCode string `json:"RDFIBranchCountryCode"`
	// EntryDetailSequenceNumber contains the ascending sequence number section of the Entry
	// Detail or Corporate Entry Detail Record's trace number This number is
	// the same as the last seven digits of the trace number of the related
	// Entry Detail Record or Corporate Entry Detail Record.
	EntryDetailSequenceNumber int `json:"entryDetailSequenceNumber"`
	// contains filtered or unexported fields
}

Addenda14 is an addenda which provides business transaction information for Addenda Type Code 14 in a machine readable format. It is usually formatted according to ANSI, ASC, X14 Standard.

Addenda14 is mandatory for IAT entries

The Addenda14 identifies the Receiving financial institution holding the Receiver's account.

func NewAddenda14 added in v0.3.0

func NewAddenda14() *Addenda14

NewAddenda14 returns a new Addenda14 with default values for none exported fields

func (*Addenda14) CalculateCheckDigit added in v0.3.0

func (v *Addenda14) CalculateCheckDigit(routingNumber string) int

func (*Addenda14) EntryDetailSequenceNumberField added in v0.3.0

func (addenda14 *Addenda14) EntryDetailSequenceNumberField() string

EntryDetailSequenceNumberField returns a zero padded EntryDetailSequenceNumber string

func (*Addenda14) Parse added in v0.3.0

func (addenda14 *Addenda14) Parse(record string)

Parse takes the input record string and parses the Addenda14 values

Parse provides no guarantee about all fields being filled in. Callers should make a Validate call to confirm successful parsing and data validity.

func (*Addenda14) RDFIBranchCountryCodeField added in v0.3.0

func (addenda14 *Addenda14) RDFIBranchCountryCodeField() string

RDFIBranchCountryCodeField gets the RDFIBranchCountryCode field left padded

func (*Addenda14) RDFIIDNumberQualifierField added in v0.3.0

func (addenda14 *Addenda14) RDFIIDNumberQualifierField() string

RDFIIDNumberQualifierField gets the RDFIIDNumberQualifier field left padded

func (*Addenda14) RDFIIdentificationField added in v0.3.0

func (addenda14 *Addenda14) RDFIIdentificationField() string

RDFIIdentificationField gets the RDFIIdentificationCode field left padded

func (*Addenda14) RDFINameField added in v0.3.0

func (addenda14 *Addenda14) RDFINameField() string

RDFINameField gets the RDFIName field left padded

func (*Addenda14) String added in v0.3.0

func (addenda14 *Addenda14) String() string

String writes the Addenda14 struct to a 94 character string.

func (*Addenda14) Validate added in v0.3.0

func (addenda14 *Addenda14) Validate() error

Validate performs NACHA format rule checks on the record and returns an error if not Validated The first error encountered is returned and stops that parsing.

type Addenda15 added in v0.3.0

type Addenda15 struct {
	// ID is an identifier only used by the moov-io/ach HTTP server as a way to identify a batch.
	ID string `json:"id"`
	// TypeCode Addenda15 types code '15'
	TypeCode string `json:"typeCode"`
	// Receiver Identification Number contains the accounting number by which the Originator is known to
	// the Receiver for descriptive purposes. NACHA Rules recommend but do not require the RDFI to print
	// the contents of this field on the receiver's statement.
	ReceiverIDNumber string `json:"receiverIDNumber,omitempty"`
	// Receiver Street Address contains the Receiver's physical address
	ReceiverStreetAddress string `json:"receiverStreetAddress"`
	// EntryDetailSequenceNumber contains the ascending sequence number section of the Entry
	// Detail or Corporate Entry Detail Record's trace number This number is
	// the same as the last seven digits of the trace number of the related
	// Entry Detail Record or Corporate Entry Detail Record.
	EntryDetailSequenceNumber int `json:"entryDetailSequenceNumber"`
	// contains filtered or unexported fields
}

Addenda15 is an addenda which provides business transaction information for Addenda Type Code 15 in a machine readable format. It is usually formatted according to ANSI, ASC, X12 Standard.

Addenda15 is mandatory for IAT entries

The Addenda15 record identifies key information related to the Receiver.

func NewAddenda15 added in v0.3.0

func NewAddenda15() *Addenda15

NewAddenda15 returns a new Addenda15 with default values for none exported fields

func (*Addenda15) CalculateCheckDigit added in v0.3.0

func (v *Addenda15) CalculateCheckDigit(routingNumber string) int

func (*Addenda15) EntryDetailSequenceNumberField added in v0.3.0

func (addenda15 *Addenda15) EntryDetailSequenceNumberField() string

EntryDetailSequenceNumberField returns a zero padded EntryDetailSequenceNumber string

func (*Addenda15) Parse added in v0.3.0

func (addenda15 *Addenda15) Parse(record string)

Parse takes the input record string and parses the Addenda15 values

Parse provides no guarantee about all fields being filled in. Callers should make a Validate call to confirm successful parsing and data validity.

func (*Addenda15) ReceiverIDNumberField added in v0.3.0

func (addenda15 *Addenda15) ReceiverIDNumberField() string

ReceiverIDNumberField gets the ReceiverIDNumber field left padded

func (*Addenda15) ReceiverStreetAddressField added in v0.3.0

func (addenda15 *Addenda15) ReceiverStreetAddressField() string

ReceiverStreetAddressField gets the ReceiverStreetAddressField field left padded

func (*Addenda15) String added in v0.3.0

func (addenda15 *Addenda15) String() string

String writes the Addenda15 struct to a 94 character string.

func (*Addenda15) Validate added in v0.3.0

func (addenda15 *Addenda15) Validate() error

Validate performs NACHA format rule checks on the record and returns an error if not Validated The first error encountered is returned and stops that parsing.

type Addenda16 added in v0.3.0

type Addenda16 struct {
	// ID is an identifier only used by the moov-io/ach HTTP server as a way to identify a batch.
	ID string `json:"id"`
	// TypeCode Addenda16 types code '16'
	TypeCode string `json:"typeCode"`
	// Receiver City & State / Province
	// Data elements City and State / Province  should be separated with an asterisk (*) as a delimiter
	// and the field should end with a backslash (\).
	// For example: San Francisco*CA\
	ReceiverCityStateProvince string `json:"receiverCityStateProvince"`
	// Receiver Country & Postal Code
	// Data elements must be separated by an asterisk (*) and must end with a backslash (\)
	// For example: US*10036\
	ReceiverCountryPostalCode string `json:"receiverCountryPostalCode"`
	// EntryDetailSequenceNumber contains the ascending sequence number section of the Entry
	// Detail or Corporate Entry Detail Record's trace number This number is
	// the same as the last seven digits of the trace number of the related
	// Entry Detail Record or Corporate Entry Detail Record.
	EntryDetailSequenceNumber int `json:"entryDetailSequenceNumber"`
	// contains filtered or unexported fields
}

Addenda16 is an addenda which provides business transaction information for Addenda Type Code 16 in a machine readable format. It is usually formatted according to ANSI, ASC, X16 Standard.

Addenda16 is mandatory for IAT entries

The Addenda16 record identifies key information related to the Receiver.

func NewAddenda16 added in v0.3.0

func NewAddenda16() *Addenda16

NewAddenda16 returns a new Addenda16 with default values for none exported fields

func (*Addenda16) CalculateCheckDigit added in v0.3.0

func (v *Addenda16) CalculateCheckDigit(routingNumber string) int

func (*Addenda16) EntryDetailSequenceNumberField added in v0.3.0

func (addenda16 *Addenda16) EntryDetailSequenceNumberField() string

EntryDetailSequenceNumberField returns a zero padded EntryDetailSequenceNumber string

func (*Addenda16) Parse added in v0.3.0

func (addenda16 *Addenda16) Parse(record string)

Parse takes the input record string and parses the Addenda16 values

Parse provides no guarantee about all fields being filled in. Callers should make a Validate call to confirm successful parsing and data validity.

func (*Addenda16) ReceiverCityStateProvinceField added in v0.3.0

func (addenda16 *Addenda16) ReceiverCityStateProvinceField() string

ReceiverCityStateProvinceField gets the ReceiverCityStateProvinceField left padded

func (*Addenda16) ReceiverCountryPostalCodeField added in v0.3.0

func (addenda16 *Addenda16) ReceiverCountryPostalCodeField() string

ReceiverCountryPostalCodeField gets the ReceiverCountryPostalCode field left padded

func (*Addenda16) String added in v0.3.0

func (addenda16 *Addenda16) String() string

String writes the Addenda16 struct to a 94 character string.

func (*Addenda16) Validate added in v0.3.0

func (addenda16 *Addenda16) Validate() error

Validate performs NACHA format rule checks on the record and returns an error if not Validated The first error encountered is returned and stops that parsing.

type Addenda17 added in v0.3.0

type Addenda17 struct {
	// ID is an identifier only used by the moov-io/ach HTTP server as a way to identify a batch.
	ID string `json:"id"`
	// TypeCode Addenda17 types code '17'
	TypeCode string `json:"typeCode"`
	// PaymentRelatedInformation
	PaymentRelatedInformation string `json:"paymentRelatedInformation"`
	// SequenceNumber is consecutively assigned to each Addenda17 Record following
	// an Entry Detail Record. The first addenda17 sequence number must always
	// be a "1".
	SequenceNumber int `json:"sequenceNumber"`
	// EntryDetailSequenceNumber contains the ascending sequence number section of the Entry
	// Detail or Corporate Entry Detail Record's trace number This number is
	// the same as the last seven digits of the trace number of the related
	// Entry Detail Record or Corporate Entry Detail Record.
	EntryDetailSequenceNumber int `json:"entryDetailSequenceNumber"`
	// contains filtered or unexported fields
}

Addenda17 is an addenda which provides business transaction information for Addenda Type Code 17 in a machine readable format. It is usually formatted according to ANSI, ASC, X12 Standard.

Addenda17 is optional for IAT entries

The Addenda17 record identifies payment-related data. A maximum of two of these Addenda Records may be included with each IAT entry.

func NewAddenda17 added in v0.3.0

func NewAddenda17() *Addenda17

NewAddenda17 returns a new Addenda17 with default values for none exported fields

func (*Addenda17) CalculateCheckDigit added in v0.3.0

func (v *Addenda17) CalculateCheckDigit(routingNumber string) int

func (*Addenda17) EntryDetailSequenceNumberField added in v0.3.0

func (addenda17 *Addenda17) EntryDetailSequenceNumberField() string

EntryDetailSequenceNumberField returns a zero padded EntryDetailSequenceNumber string

func (*Addenda17) Parse added in v0.3.0

func (addenda17 *Addenda17) Parse(record string)

Parse takes the input record string and parses the Addenda17 values

Parse provides no guarantee about all fields being filled in. Callers should make a Validate call to confirm successful parsing and data validity.

func (*Addenda17) PaymentRelatedInformationField added in v0.3.0

func (addenda17 *Addenda17) PaymentRelatedInformationField() string

PaymentRelatedInformationField returns a zero padded PaymentRelatedInformation string

func (*Addenda17) SequenceNumberField added in v0.3.0

func (addenda17 *Addenda17) SequenceNumberField() string

SequenceNumberField returns a zero padded SequenceNumber string

func (*Addenda17) String added in v0.3.0

func (addenda17 *Addenda17) String() string

String writes the Addenda17 struct to a 94 character string.

func (*Addenda17) Validate added in v0.3.0

func (addenda17 *Addenda17) Validate() error

Validate performs NACHA format rule checks on the record and returns an error if not Validated The first error encountered is returned and stops that parsing.

type Addenda18 added in v0.3.0

type Addenda18 struct {
	// ID is an identifier only used by the moov-io/ach HTTP server as a way to identify a batch.
	ID string `json:"id"`
	// TypeCode Addenda18 types code '18'
	TypeCode string `json:"typeCode"`
	// ForeignCorrespondentBankName contains the name of the Foreign Correspondent Bank
	ForeignCorrespondentBankName string `json:"foreignCorrespondentBankName"`
	// Foreign Correspondent Bank Identification Number Qualifier contains a 2-digit code that
	// identifies the numbering scheme used in the Foreign Correspondent Bank Identification Number
	// field. Code values for this field are:
	// “01” = National Clearing System
	// “02” = BIC Code
	// “03” = IBAN Code
	ForeignCorrespondentBankIDNumberQualifier string `json:"foreignCorrespondentBankIDNumberQualifier"`
	// Foreign Correspondent Bank Identification Number contains the bank ID number of the Foreign
	// Correspondent Bank
	ForeignCorrespondentBankIDNumber string `json:"foreignCorrespondentBankIDNumber"`
	// Foreign Correspondent Bank Branch Country Code contains the two-character code, as approved by
	// the International Organization for Standardization (ISO), to identify the country in which the
	// branch of the Foreign Correspondent Bank is located. Values can be found on the International
	// Organization for Standardization website: www.iso.org
	ForeignCorrespondentBankBranchCountryCode string `json:"foreignCorrespondentBankBranchCountryCode"`
	// SequenceNumber is consecutively assigned to each Addenda18 Record following
	// an Entry Detail Record. The first addenda18 sequence number must always
	// be a "1".
	SequenceNumber int `json:"sequenceNumber"`
	// EntryDetailSequenceNumber contains the ascending sequence number section of the Entry
	// Detail or Corporate Entry Detail Record's trace number This number is
	// the same as the last seven digits of the trace number of the related
	// Entry Detail Record or Corporate Entry Detail Record.
	EntryDetailSequenceNumber int `json:"entryDetailSequenceNumber"`
	// contains filtered or unexported fields
}

Addenda18 is an addenda which provides business transaction information for Addenda Type Code 18 in a machine readable format. It is usually formatted according to ANSI, ASC, X12 Standard.

Addenda18 is optional for IAT entries

The Addenda18 record identifies information on each Foreign Correspondent Bank involved in the processing of the IAT entry. If no Foreign Correspondent Bank is involved,t he record should not be included. A maximum of five of these Addenda Records may be included with each IAT entry.

func NewAddenda18 added in v0.3.0

func NewAddenda18() *Addenda18

NewAddenda18 returns a new Addenda18 with default values for none exported fields

func (*Addenda18) CalculateCheckDigit added in v0.3.0

func (v *Addenda18) CalculateCheckDigit(routingNumber string) int

func (*Addenda18) EntryDetailSequenceNumberField added in v0.3.0

func (addenda18 *Addenda18) EntryDetailSequenceNumberField() string

EntryDetailSequenceNumberField returns a zero padded EntryDetailSequenceNumber string

func (*Addenda18) ForeignCorrespondentBankBranchCountryCodeField added in v0.3.0

func (addenda18 *Addenda18) ForeignCorrespondentBankBranchCountryCodeField() string

ForeignCorrespondentBankBranchCountryCodeField returns a zero padded ForeignCorrespondentBankBranchCountryCode string

func (*Addenda18) ForeignCorrespondentBankIDNumberField added in v0.3.0

func (addenda18 *Addenda18) ForeignCorrespondentBankIDNumberField() string

ForeignCorrespondentBankIDNumberField returns a zero padded ForeignCorrespondentBankIDNumber string

func (*Addenda18) ForeignCorrespondentBankIDNumberQualifierField added in v0.3.0

func (addenda18 *Addenda18) ForeignCorrespondentBankIDNumberQualifierField() string

ForeignCorrespondentBankIDNumberQualifierField returns a zero padded ForeignCorrespondentBankIDNumberQualifier string

func (*Addenda18) ForeignCorrespondentBankNameField added in v0.3.0

func (addenda18 *Addenda18) ForeignCorrespondentBankNameField() string

ForeignCorrespondentBankNameField returns a zero padded ForeignCorrespondentBankName string

func (*Addenda18) Parse added in v0.3.0

func (addenda18 *Addenda18) Parse(record string)

Parse takes the input record string and parses the Addenda18 values

Parse provides no guarantee about all fields being filled in. Callers should make a Validate call to confirm successful parsing and data validity.

func (*Addenda18) SequenceNumberField added in v0.3.0

func (addenda18 *Addenda18) SequenceNumberField() string

SequenceNumberField returns a zero padded SequenceNumber string

func (*Addenda18) String added in v0.3.0

func (addenda18 *Addenda18) String() string

String writes the Addenda18 struct to a 94 character string.

func (*Addenda18) Validate added in v0.3.0

func (addenda18 *Addenda18) Validate() error

Validate performs NACHA format rule checks on the record and returns an error if not Validated The first error encountered is returned and stops that parsing.

type Addenda98 added in v0.2.0

type Addenda98 struct {
	// ID is an identifier only used by the moov-io/ach HTTP server as a way to identify a batch.
	ID string `json:"id"`
	// TypeCode Addenda types code '98'
	TypeCode string `json:"typeCode"`
	// ChangeCode field contains a standard code used by an ACH Operator or RDFI to describe the reason for a change Entry.
	// Must exist in changeCodeDict
	ChangeCode string `json:"changeCode"`
	// OriginalTrace This field contains the Trace Number as originally included on the forward Entry or Prenotification.
	// The RDFI must include the Original Entry Trace Number in the Addenda Record of an Entry being returned to an ODFI,
	// in the Addenda Record of an 98, within an Acknowledgment Entry, or with an RDFI request for a copy of an authorization.
	OriginalTrace string `json:"originalTrace"`
	// OriginalDFI field contains the Receiving DFI Identification (addenda.RDFIIdentification) as originally included on the forward Entry or Prenotification that the RDFI is returning or correcting.
	OriginalDFI string `json:"originalDFI"`
	// CorrectedData is the corrected data
	CorrectedData string `json:"correctedData"`

	// TraceNumber matches the Entry Detail Trace Number of the entry being returned.
	//
	// Use TraceNumberField for a properly formatted string representation.
	TraceNumber string `json:"traceNumber,omitempty"`
	// contains filtered or unexported fields
}

Addenda98 is a Addendumer addenda record format for Notification OF Change(98) The field contents for Notification of Change Entries must match the field contents of the original Entries

func NewAddenda98 added in v0.2.0

func NewAddenda98() *Addenda98

NewAddenda98 returns an reference to an instantiated Addenda98 with default values

func (*Addenda98) CalculateCheckDigit added in v0.2.0

func (v *Addenda98) CalculateCheckDigit(routingNumber string) int

func (*Addenda98) ChangeCodeField added in v1.2.0

func (addenda98 *Addenda98) ChangeCodeField() *ChangeCode

func (*Addenda98) CorrectedDataField added in v0.2.0

func (addenda98 *Addenda98) CorrectedDataField() string

CorrectedDataField returns a space padded CorrectedData string

func (*Addenda98) IATCorrectedDataField added in v1.35.0

func (addenda98 *Addenda98) IATCorrectedDataField() string

IATCorrectedDataField returns a space padded CorrectedData string for IAT entries, which is a slightly larger field than typical CorrectedData values.

func (*Addenda98) OriginalDFIField added in v0.2.0

func (addenda98 *Addenda98) OriginalDFIField() string

OriginalDFIField returns a zero padded OriginalDFI string

func (*Addenda98) OriginalTraceField added in v0.2.0

func (addenda98 *Addenda98) OriginalTraceField() string

OriginalTraceField returns a zero padded OriginalTrace string

func (*Addenda98) Parse added in v0.2.0

func (addenda98 *Addenda98) Parse(record string)

Parse takes the input record string and parses the Addenda98 values

Parse provides no guarantee about all fields being filled in. Callers should make a Validate call to confirm successful parsing and data validity.

func (*Addenda98) ParseCorrectedData added in v1.3.0

func (addenda98 *Addenda98) ParseCorrectedData() *CorrectedData

ParseCorrectedData returns a struct with some fields filled in depending on the Addenda98's Code and CorrectedData. Fields are trimmed when populated in this struct.

func (*Addenda98) String added in v0.2.0

func (addenda98 *Addenda98) String() string

String writes the Addenda98 struct to a 94 character string

func (*Addenda98) TraceNumberField added in v0.2.0

func (addenda98 *Addenda98) TraceNumberField() string

TraceNumberField returns a zero padded traceNumber string

func (*Addenda98) Validate added in v0.2.0

func (addenda98 *Addenda98) Validate() error

Validate verifies NACHA rules for Addenda98

type Addenda98Refused added in v1.32.0

type Addenda98Refused struct {
	// ID is an identifier only used by the moov-io/ach HTTP server as a way to identify a batch.
	ID string `json:"id"`

	// TypeCode Addenda types code '98'
	TypeCode string `json:"typeCode"`

	// RefusedChangeCode is the code specifying why the Notification of Change is being refused.
	RefusedChangeCode string `json:"refusedChangeCode"`

	// OriginalTrace This field contains the Trace Number as originally included on the forward Entry or Prenotification.
	// The RDFI must include the Original Entry Trace Number in the Addenda Record of an Entry being returned to an ODFI,
	// in the Addenda Record of an 98, within an Acknowledgment Entry, or with an RDFI request for a copy of an authorization.
	OriginalTrace string `json:"originalTrace"`

	// OriginalDFI field contains the Receiving DFI Identification (addenda.RDFIIdentification) as originally included on the
	// forward Entry or Prenotification that the RDFI is returning or correcting.
	OriginalDFI string `json:"originalDFI"`

	// CorrectedData is the corrected data
	CorrectedData string `json:"correctedData"`

	// ChangeCode field contains a standard code used by an ACH Operator or RDFI to describe the reason for a change Entry.
	ChangeCode string `json:"changeCode"`

	// TraceSequenceNumber is the last seven digits of the TraceNumber in the original Notification of Change
	TraceSequenceNumber string `json:"traceSequenceNumber"`

	// TraceNumber matches the Entry Detail Trace Number of the entry being returned.
	//
	// Use TraceNumberField for a properly formatted string representation.
	TraceNumber string `json:"traceNumber"`
	// contains filtered or unexported fields
}

func NewAddenda98Refused added in v1.32.0

func NewAddenda98Refused() *Addenda98Refused

NewAddenda98Refused returns an reference to an instantiated Addenda98Refused with default values

func (*Addenda98Refused) CalculateCheckDigit added in v1.32.0

func (v *Addenda98Refused) CalculateCheckDigit(routingNumber string) int

func (*Addenda98Refused) ChangeCodeField added in v1.32.0

func (addenda98Refused *Addenda98Refused) ChangeCodeField() *ChangeCode

func (*Addenda98Refused) CorrectedDataField added in v1.32.0

func (addenda98Refused *Addenda98Refused) CorrectedDataField() string

CorrectedDataField returns a space padded CorrectedData string

func (*Addenda98Refused) OriginalDFIField added in v1.32.0

func (addenda98Refused *Addenda98Refused) OriginalDFIField() string

OriginalDFIField returns a zero padded OriginalDFI string

func (*Addenda98Refused) OriginalTraceField added in v1.32.0

func (addenda98Refused *Addenda98Refused) OriginalTraceField() string

OriginalTraceField returns a zero padded OriginalTrace string

func (*Addenda98Refused) Parse added in v1.32.0

func (addenda98Refused *Addenda98Refused) Parse(record string)

Parse takes the input record string and parses the Addenda98Refused values

Parse provides no guarantee about all fields being filled in. Callers should make a Validate call to confirm successful parsing and data validity.

func (*Addenda98Refused) RefusedChangeCodeField added in v1.32.0

func (addenda98Refused *Addenda98Refused) RefusedChangeCodeField() *ChangeCode

func (*Addenda98Refused) String added in v1.32.0

func (addenda98Refused *Addenda98Refused) String() string

String writes the Addenda98 struct to a 94 character string

func (*Addenda98Refused) TraceNumberField added in v1.32.0

func (addenda98Refused *Addenda98Refused) TraceNumberField() string

TraceNumberField returns a zero padded traceNumber string

func (*Addenda98Refused) TraceSequenceNumberField added in v1.32.0

func (addenda98Refused *Addenda98Refused) TraceSequenceNumberField() string

func (*Addenda98Refused) Validate added in v1.32.0

func (addenda98Refused *Addenda98Refused) Validate() error

Validate verifies NACHA rules for Addenda98

type Addenda99 added in v0.2.0

type Addenda99 struct {
	// ID is an identifier only used by the moov-io/ach HTTP server as a way to identify a batch.
	ID string `json:"id"`
	// TypeCode Addenda types code '99'
	TypeCode string `json:"typeCode"`
	// ReturnCode field contains a standard code used by an ACH Operator or RDFI to describe the reason for returning an Entry.
	// Must exist in returnCodeDict
	ReturnCode string `json:"returnCode"`
	// OriginalTrace This field contains the Trace Number as originally included on the forward Entry or Prenotification.
	// The RDFI must include the Original Entry Trace Number in the Addenda Record of an Entry being returned to an ODFI,
	// in the Addenda Record of an 98, within an Acknowledgment Entry, or with an RDFI request for a copy of an authorization.
	OriginalTrace string `json:"originalTrace"`
	// DateOfDeath The field date of death is to be supplied on Entries being returned for reason of death (return reason codes R14 and R15). Format: YYMMDD (Y=Year, M=Month, D=Day)
	DateOfDeath string `json:"dateOfDeath"`
	// OriginalDFI field contains the Receiving DFI Identification (addenda.RDFIIdentification) as originally included on the forward Entry or Prenotification that the RDFI is returning or correcting.
	OriginalDFI string `json:"originalDFI"`
	// AddendaInformation
	AddendaInformation string `json:"addendaInformation,omitempty"`
	// TraceNumber matches the Entry Detail Trace Number of the entry being returned.
	//
	// Use TraceNumberField for a properly formatted string representation.
	TraceNumber string `json:"traceNumber,omitempty"`
	// contains filtered or unexported fields
}

Addenda99 utilized for Notification of Change Entry (COR) and Return types.

func NewAddenda99 added in v0.2.0

func NewAddenda99() *Addenda99

NewAddenda99 returns a new Addenda99 with default values for none exported fields

func (*Addenda99) AddendaInformationExtra added in v1.33.5

func (Addenda99 *Addenda99) AddendaInformationExtra() string

func (*Addenda99) AddendaInformationField added in v0.2.0

func (Addenda99 *Addenda99) AddendaInformationField() string

AddendaInformationField returns a space padded AddendaInformation string

func (*Addenda99) AddendaInformationReturnReasonCode added in v1.33.5

func (Addenda99 *Addenda99) AddendaInformationReturnReasonCode() string

func (*Addenda99) AddendaInformationReturnSettlementDate added in v1.33.5

func (Addenda99 *Addenda99) AddendaInformationReturnSettlementDate() string

func (*Addenda99) AddendaInformationReturnTraceNumber added in v1.33.5

func (Addenda99 *Addenda99) AddendaInformationReturnTraceNumber() string

func (*Addenda99) CalculateCheckDigit added in v0.2.0

func (v *Addenda99) CalculateCheckDigit(routingNumber string) int

func (*Addenda99) DateOfDeathField added in v0.2.0

func (Addenda99 *Addenda99) DateOfDeathField() string

DateOfDeathField returns a space padded DateOfDeath string

func (*Addenda99) IATAddendaInformation added in v0.3.0

func (Addenda99 *Addenda99) IATAddendaInformation(s string)

IATAddendaInformation sets Addenda Information for IAT return items, characters 10-44 of underlying AddendaInformation

func (*Addenda99) IATAddendaInformationField added in v0.3.0

func (Addenda99 *Addenda99) IATAddendaInformationField() string

IATAddendaInformationField returns a space padded AddendaInformation string, characters 10-44 of underlying AddendaInformation

func (*Addenda99) IATPaymentAmount added in v0.3.0

func (Addenda99 *Addenda99) IATPaymentAmount(s string)

IATPaymentAmount sets original forward entry payment amount characters 1-10 of underlying AddendaInformation

func (*Addenda99) IATPaymentAmountField added in v0.3.0

func (Addenda99 *Addenda99) IATPaymentAmountField() int

IATPaymentAmountField returns original forward entry payment amount int, characters 1-10 of underlying AddendaInformation

func (*Addenda99) OriginalDFIField added in v0.2.0

func (Addenda99 *Addenda99) OriginalDFIField() string

OriginalDFIField returns a zero padded OriginalDFI string

func (*Addenda99) OriginalEntryReturnDate added in v1.33.5

func (Addenda99 *Addenda99) OriginalEntryReturnDate() string

func (*Addenda99) OriginalTraceField added in v0.2.0

func (Addenda99 *Addenda99) OriginalTraceField() string

OriginalTraceField returns a zero padded OriginalTrace string

func (*Addenda99) Parse added in v0.2.0

func (Addenda99 *Addenda99) Parse(record string)

Parse takes the input record string and parses the Addenda99 values

Parse provides no guarantee about all fields being filled in. Callers should make a Validate call to confirm successful parsing and data validity.

func (*Addenda99) ReturnCodeField added in v1.1.0

func (Addenda99 *Addenda99) ReturnCodeField() *ReturnCode

ReturnCodeField gives the ReturnCode struct for the given Addenda99 record

func (*Addenda99) SetContestedAddendaInformation added in v1.33.5

func (Addenda99 *Addenda99) SetContestedAddendaInformation(
	originalSettlementDate string,
	returnTraceNumber string,
	returnSettlementDate string,
	returnReasonCode string,
	dishonoredReturnTraceNumber string,
	dishonoredReturnSettlementDate string,
	dishonoredReturnReasonCode string,
)

Ref: https://www.nachaoperatingrulesonline.org/2.16334/s020

func (*Addenda99) SetDishonoredAddendaInformation added in v1.33.5

func (Addenda99 *Addenda99) SetDishonoredAddendaInformation(
	returnTraceNumber string,
	returnSettlementDate string,
	returnReasonCode string,
	addenda string,
)

format: reserved (3), return trace number (15), return settlement date (3), return reason (2), addenda (21) Ref: https://www.nachaoperatingrulesonline.org/2.16334/s020

func (*Addenda99) SetOriginalEntryReturnDate added in v1.33.5

func (Addenda99 *Addenda99) SetOriginalEntryReturnDate(date string)

func (*Addenda99) SetValidation added in v1.10.0

func (Addenda99 *Addenda99) SetValidation(opts *ValidateOpts)

SetValidation stores ValidateOpts on the Batch which are to be used to override the default NACHA validation rules.

func (*Addenda99) String added in v0.2.0

func (Addenda99 *Addenda99) String() string

String writes the Addenda99 struct to a 94 character string

func (*Addenda99) TraceNumberField added in v0.2.0

func (Addenda99 *Addenda99) TraceNumberField() string

TraceNumberField returns a zero padded TraceNumber string

func (*Addenda99) Validate added in v0.2.0

func (Addenda99 *Addenda99) Validate() error

Validate verifies NACHA rules for Addenda99

type Addenda99Contested added in v1.14.0

type Addenda99Contested struct {
	// ID is an identifier only used by the moov-io/ach HTTP server as a way to identify a batch.
	ID string `json:"id"`

	// TypeCode Addenda types code '99'
	TypeCode string `json:"typeCode"`

	// ContestedReturnCode is the return code explaining the contested dishonorment
	ContestedReturnCode string `json:"contestedReturnCode"`

	// OriginalEntryTraceNumber is the trace number specifieid in the initial entry
	OriginalEntryTraceNumber string `json:"originalEntryTraceNumber"`

	// DateOriginalEntryReturned is the original entry's date
	DateOriginalEntryReturned string `json:"dateOriginalEntryReturned"`

	// OriginalReceivingDFIIdentification is the DFI Identification specifieid in the initial entry
	OriginalReceivingDFIIdentification string `json:"originalReceivingDFIIdentification"`

	// OriginalSettlementDate is the initial date of settlement
	OriginalSettlementDate string `json:"originalSettlementDate"`

	// ReturnTraceNumber is the original returns trace number
	ReturnTraceNumber string `json:"returnTraceNumber"`

	// ReturnSettlementDate is the original return's settlement date
	ReturnSettlementDate string `json:"returnSettlementDate"`

	// ReturnReasonCode is the original return's code
	ReturnReasonCode string `json:"returnReasonCode"`

	// DishonoredReturnTraceNumber is the dishonorment's trace number
	DishonoredReturnTraceNumber string `json:"dishonoredReturnTraceNumber"`

	// DishonoredReturnSettlementDate is the dishonorment's settlement date
	DishonoredReturnSettlementDate string `json:"dishonoredReturnSettlementDate"`

	// DishonoredReturnReasonCode is the dishonorment's return code
	DishonoredReturnReasonCode string `json:"dishonoredReturnReasonCode"`

	// TraceNumber is the trace number for contesting
	TraceNumber string `json:"traceNumber"`
	// contains filtered or unexported fields
}

func NewAddenda99Contested added in v1.14.0

func NewAddenda99Contested() *Addenda99Contested

NewAddenda99Contested returns a new Addenda99Contested with default values for none exported fields

func (*Addenda99Contested) CalculateCheckDigit added in v1.14.0

func (v *Addenda99Contested) CalculateCheckDigit(routingNumber string) int

func (*Addenda99Contested) ContestedReturnCodeField added in v1.14.0

func (Addenda99Contested *Addenda99Contested) ContestedReturnCodeField() string

func (*Addenda99Contested) DateOriginalEntryReturnedField added in v1.14.0

func (Addenda99Contested *Addenda99Contested) DateOriginalEntryReturnedField() string

func (*Addenda99Contested) DishonoredReturnReasonCodeField added in v1.14.0

func (Addenda99Contested *Addenda99Contested) DishonoredReturnReasonCodeField() string

func (*Addenda99Contested) DishonoredReturnSettlementDateField added in v1.14.0

func (Addenda99Contested *Addenda99Contested) DishonoredReturnSettlementDateField() string

func (*Addenda99Contested) DishonoredReturnTraceNumberField added in v1.14.0

func (Addenda99Contested *Addenda99Contested) DishonoredReturnTraceNumberField() string

func (*Addenda99Contested) OriginalEntryTraceNumberField added in v1.14.0

func (Addenda99Contested *Addenda99Contested) OriginalEntryTraceNumberField() string

func (*Addenda99Contested) OriginalReceivingDFIIdentificationField added in v1.14.0

func (Addenda99Contested *Addenda99Contested) OriginalReceivingDFIIdentificationField() string

func (*Addenda99Contested) OriginalSettlementDateField added in v1.14.0

func (Addenda99Contested *Addenda99Contested) OriginalSettlementDateField() string

func (*Addenda99Contested) Parse added in v1.14.0

func (Addenda99Contested *Addenda99Contested) Parse(record string)

func (*Addenda99Contested) ReturnReasonCodeField added in v1.14.0

func (Addenda99Contested *Addenda99Contested) ReturnReasonCodeField() string

func (*Addenda99Contested) ReturnSettlementDateField added in v1.14.0

func (Addenda99Contested *Addenda99Contested) ReturnSettlementDateField() string

func (*Addenda99Contested) ReturnTraceNumberField added in v1.14.0

func (Addenda99Contested *Addenda99Contested) ReturnTraceNumberField() string

func (*Addenda99Contested) SetValidation added in v1.14.0

func (Addenda99Contested *Addenda99Contested) SetValidation(opts *ValidateOpts)

SetValidation stores ValidateOpts on the Batch which are to be used to override the default NACHA validation rules.

func (*Addenda99Contested) String added in v1.14.0

func (Addenda99Contested *Addenda99Contested) String() string

func (*Addenda99Contested) TraceNumberField added in v1.14.0

func (Addenda99Contested *Addenda99Contested) TraceNumberField() string

func (*Addenda99Contested) Validate added in v1.14.0

func (Addenda99Contested *Addenda99Contested) Validate() error

Validate verifies NACHA rules for Addenda99Contested

type Addenda99Dishonored added in v1.14.0

type Addenda99Dishonored struct {
	// ID is an identifier only used by the moov-io/ach HTTP server as a way to identify a batch.
	ID string `json:"id"`

	// TypeCode Addenda types code '99'
	TypeCode string `json:"typeCode"`

	// DishonoredReturnReasonCode is the return code explaining the dishonorment
	DishonoredReturnReasonCode string `json:"dishonoredReturnReasonCode"`

	// OriginalEntryTraceNumber is the trace number specifieid in the initial entry
	OriginalEntryTraceNumber string `json:"originalEntryTraceNumber"`

	// OriginalReceivingDFIIdentification is the DFI Identification specifieid in the initial entry
	OriginalReceivingDFIIdentification string `json:"originalReceivingDFIIdentification"`

	// ReturnTraceNumber is the TraceNumber used when issuing the return
	ReturnTraceNumber string `json:"returnTraceNumber"`

	// ReturnSettlementDate is the date of return issuing
	ReturnSettlementDate string `json:"returnSettlementDate"`

	// ReturnReasonCode is the initial return code
	ReturnReasonCode string `json:"returnReasonCode"`

	// AddendaInformation is additional data
	AddendaInformation string `json:"addendaInformation"`

	// TraceNumber is the trace number for dishonorment
	TraceNumber string `json:"traceNumber"`
	// contains filtered or unexported fields
}

func NewAddenda99Dishonored added in v1.14.0

func NewAddenda99Dishonored() *Addenda99Dishonored

NewAddenda99Dishonored returns a new Addenda99Dishonored with default values for none exported fields

func (*Addenda99Dishonored) AddendaInformationField added in v1.14.0

func (Addenda99Dishonored *Addenda99Dishonored) AddendaInformationField() string

func (*Addenda99Dishonored) CalculateCheckDigit added in v1.14.0

func (v *Addenda99Dishonored) CalculateCheckDigit(routingNumber string) int

func (*Addenda99Dishonored) DishonoredReturnReasonCodeField added in v1.14.0

func (Addenda99Dishonored *Addenda99Dishonored) DishonoredReturnReasonCodeField() string

func (*Addenda99Dishonored) OriginalEntryTraceNumberField added in v1.14.0

func (Addenda99Dishonored *Addenda99Dishonored) OriginalEntryTraceNumberField() string

OriginalEntryTraceNumberField returns a zero padded TraceNumber string

func (*Addenda99Dishonored) OriginalReceivingDFIIdentificationField added in v1.14.0

func (Addenda99Dishonored *Addenda99Dishonored) OriginalReceivingDFIIdentificationField() string

func (*Addenda99Dishonored) Parse added in v1.14.0

func (Addenda99Dishonored *Addenda99Dishonored) Parse(record string)

func (*Addenda99Dishonored) ReturnReasonCodeField added in v1.14.0

func (Addenda99Dishonored *Addenda99Dishonored) ReturnReasonCodeField() string

func (*Addenda99Dishonored) ReturnSettlementDateField added in v1.14.0

func (Addenda99Dishonored *Addenda99Dishonored) ReturnSettlementDateField() string

func (*Addenda99Dishonored) ReturnTraceNumberField added in v1.14.0

func (Addenda99Dishonored *Addenda99Dishonored) ReturnTraceNumberField() string

func (*Addenda99Dishonored) SetValidation added in v1.14.0

func (Addenda99Dishonored *Addenda99Dishonored) SetValidation(opts *ValidateOpts)

SetValidation stores ValidateOpts on the Batch which are to be used to override the default NACHA validation rules.

func (*Addenda99Dishonored) String added in v1.14.0

func (Addenda99Dishonored *Addenda99Dishonored) String() string

func (*Addenda99Dishonored) TraceNumberField added in v1.14.0

func (Addenda99Dishonored *Addenda99Dishonored) TraceNumberField() string

TraceNumberField returns a zero padded TraceNumber string

func (*Addenda99Dishonored) Validate added in v1.14.0

func (Addenda99Dishonored *Addenda99Dishonored) Validate() error

Validate verifies NACHA rules for Addenda99Dishonored

type Batch added in v0.5.0

type Batch struct {
	Header     *BatchHeader      `json:"batchHeader"`
	Entries    []*EntryDetail    `json:"entryDetails"`
	Control    *BatchControl     `json:"batchControl"`
	ADVEntries []*ADVEntryDetail `json:"advEntryDetails,omitempty"`
	ADVControl *ADVBatchControl  `json:"advBatchControl,omitempty"`
	// contains filtered or unexported fields
}

Batch holds the Batch Header and Batch Control and all Entry Records

func (*Batch) AddADVEntry added in v0.5.0

func (batch *Batch) AddADVEntry(entry *ADVEntryDetail)

AddADVEntry appends an ADV EntryDetail to the Batch

func (*Batch) AddEntry added in v0.5.0

func (batch *Batch) AddEntry(entry *EntryDetail)

AddEntry appends an EntryDetail to the Batch

func (*Batch) Category added in v0.5.0

func (batch *Batch) Category() string

Category returns batch category

func (*Batch) Create added in v0.5.0

func (batch *Batch) Create() error

Create will tabulate and assemble an ACH batch into a valid state. This includes setting any posting dates, sequence numbers, counts, and sums.

Create implementations are free to modify computable fields in a file and should call the Batch's Validate function at the end of their execution.

func (*Batch) DeleteADVEntries added in v1.43.0

func (batch *Batch) DeleteADVEntries(del func(e *ADVEntryDetail) bool)

DeleteADVEntries deletes all ADV Entries from the Batch where del() == true

func (*Batch) DeleteEntries added in v1.43.0

func (batch *Batch) DeleteEntries(del func(e *EntryDetail) bool)

DeleteEntries deletes all Entries from the Batch where del() == true

func (*Batch) Equal added in v1.1.0

func (batch *Batch) Equal(other Batcher) bool

Equal returns true only if two Batch (or any Batcher) objects are equal. Equality is determined by many of the ACH Batch and EntryDetail properties.

func (*Batch) Error added in v0.6.0

func (b *Batch) Error(field string, err error, values ...interface{}) error

error returns a new BatchError based on err

func (*Batch) GetADVControl added in v0.5.0

func (batch *Batch) GetADVControl() *ADVBatchControl

GetADVControl returns the current Batch ADVControl

func (*Batch) GetADVEntries added in v0.5.0

func (batch *Batch) GetADVEntries() []*ADVEntryDetail

GetADVEntries returns a slice of entry details for the batch

func (*Batch) GetControl added in v0.5.0

func (batch *Batch) GetControl() *BatchControl

GetControl returns the current Batch Control

func (*Batch) GetEntries added in v0.5.0

func (batch *Batch) GetEntries() []*EntryDetail

GetEntries returns a slice of entry details for the batch

func (*Batch) GetHeader added in v0.5.0

func (batch *Batch) GetHeader() *BatchHeader

GetHeader returns the current Batch header

func (*Batch) ID added in v0.5.0

func (batch *Batch) ID() string

ID returns the id of the batch

func (*Batch) IsADV added in v0.5.0

func (batch *Batch) IsADV() bool

IsADV determines if a batch is batch type ADV - BatchADV

func (*Batch) MarshalJSON added in v1.4.0

func (batch *Batch) MarshalJSON() ([]byte, error)

func (*Batch) SetADVControl added in v0.5.0

func (batch *Batch) SetADVControl(batchADVControl *ADVBatchControl)

SetADVControl appends an BatchADVControl to the Batch

func (*Batch) SetControl added in v0.5.0

func (batch *Batch) SetControl(batchControl *BatchControl)

SetControl appends an BatchControl to the Batch

func (*Batch) SetHeader added in v0.5.0

func (batch *Batch) SetHeader(batchHeader *BatchHeader)

SetHeader appends an BatchHeader to the Batch

func (*Batch) SetID added in v0.5.0

func (batch *Batch) SetID(id string)

SetID sets the batch id

func (*Batch) SetValidation added in v1.4.0

func (batch *Batch) SetValidation(opts *ValidateOpts)

SetValidation stores ValidateOpts on the Batch which are to be used to override the default NACHA validation rules.

func (*Batch) UnmarshalJSON added in v0.6.0

func (batch *Batch) UnmarshalJSON(p []byte) error

func (*Batch) ValidAmountForCodes added in v1.28.1

func (batch *Batch) ValidAmountForCodes(entry *EntryDetail) error

func (*Batch) ValidTranCodeForServiceClassCode added in v0.5.0

func (batch *Batch) ValidTranCodeForServiceClassCode(entry *EntryDetail) error

ValidTranCodeForServiceClassCode validates a TransactionCode is valid for a ServiceClassCode

func (*Batch) Validate added in v0.5.0

func (batch *Batch) Validate() error

Validate checks properties of the ACH batch to ensure they match NACHA guidelines. This includes computing checksums, totals, and sequence orderings.

Validate will never modify the batch.

func (*Batch) WithOffset added in v1.1.0

func (b *Batch) WithOffset(off *Offset)

WithOffset sets the Offset information onto a Batch so that during Create a balanced offset record(s) at the end of each batch.

If there are debits, there is a credit offset matching the sum of the debits. If there are credits, there is a debit offset matching the sum of the credits. They are mutually exclusive.

type BatchACK added in v0.4.0

type BatchACK struct {
	Batch
}

BatchACK is a batch file that handles SEC payment type ACK and ACK+. Acknowledgement of a Corporate credit by the Receiving Depository Financial Institution (RDFI). For commercial accounts only.

func NewBatchACK added in v0.4.0

func NewBatchACK(bh *BatchHeader) *BatchACK

NewBatchACK returns a *BatchACK

func (*BatchACK) Create added in v0.4.0

func (batch *BatchACK) Create() error

Create will tabulate and assemble an ACH batch into a valid state. This includes setting any posting dates, sequence numbers, counts, and sums.

Create implementations are free to modify computable fields in a file and should call the Batch's Validate function at the end of their execution.

func (*BatchACK) Validate added in v0.4.0

func (batch *BatchACK) Validate() error

Validate checks properties of the ACH batch to ensure they match NACHA guidelines. This includes computing checksums, totals, and sequence orderings.

Validate will never modify the batch.

type BatchADV added in v0.5.0

type BatchADV struct {
	Batch
}

BatchADV holds the Batch Header and Batch Control and all Entry Records for ADV Entries

The ADV entry identifies a Non-Monetary Entry that is used by an ACH Operator to provide accounting information regarding an entry to participating DFI's. It's an optional service provided by ACH operators and must be requested by a DFI wanting the service.

func NewBatchADV added in v0.5.0

func NewBatchADV(bh *BatchHeader) *BatchADV

NewBatchADV returns a *BatchADV

func (*BatchADV) Create added in v0.5.0

func (batch *BatchADV) Create() error

Create will tabulate and assemble an ACH batch into a valid state. This includes setting any posting dates, sequence numbers, counts, and sums.

Create implementations are free to modify computable fields in a file and should call the Batch's Validate function at the end of their execution.

func (*BatchADV) Validate added in v0.5.0

func (batch *BatchADV) Validate() error

Validate checks properties of the ACH batch to ensure they match NACHA guidelines. This includes computing checksums, totals, and sequence orderings.

Validate will never modify the batch.

type BatchARC added in v0.3.0

type BatchARC struct {
	Batch
}

BatchARC holds the BatchHeader and BatchControl and all EntryDetail for ARC Entries.

Accounts Receivable Entry (ARC). A consumer check converted to a one-time ACH debit. The Accounts Receivable (ARC) Entry provides billers the opportunity to initiate single-entry ACH debits to customer accounts by converting checks at the point of receipt through the U.S. mail, at a drop box location or in-person for payment of a bill at a manned location. The biller is required to provide the customer with notice prior to the acceptance of the check that states the receipt of the customer's check will be deemed as the authorization for an ARC debit entry to the customer's account. The provision of the notice and the receipt of the check together constitute authorization for the ARC entry. The customer's check is solely be used as a source document to obtain the routing number, account number and check serial number.

The difference between ARC and POP is that ARC can result from a check mailed in whereas POP is in-person.

func NewBatchARC added in v0.3.0

func NewBatchARC(bh *BatchHeader) *BatchARC

NewBatchARC returns a *BatchARC

func (*BatchARC) Create added in v0.3.0

func (batch *BatchARC) Create() error

Create will tabulate and assemble an ACH batch into a valid state. This includes setting any posting dates, sequence numbers, counts, and sums.

Create implementations are free to modify computable fields in a file and should call the Batch's Validate function at the end of their execution.

func (*BatchARC) Validate added in v0.3.0

func (batch *BatchARC) Validate() error

Validate checks properties of the ACH batch to ensure they match NACHA guidelines. This includes computing checksums, totals, and sequence orderings.

Validate will never modify the batch.

type BatchATX added in v0.4.0

type BatchATX struct {
	Batch
}

BatchATX holds the BatchHeader and BatchControl and all EntryDetail for ATX (Acknowledgment) Entries.

The ATX entry is an acknowledgement by the Receiving Depository Financial Institution (RDFI) that a Corporate Credit (CTX) has been received.

func NewBatchATX added in v0.4.0

func NewBatchATX(bh *BatchHeader) *BatchATX

NewBatchATX returns a *BatchATX

func (*BatchATX) Create added in v0.4.0

func (batch *BatchATX) Create() error

Create will tabulate and assemble an ACH batch into a valid state. This includes setting any posting dates, sequence numbers, counts, and sums.

Create implementations are free to modify computable fields in a file and should call the Batch's Validate function at the end of their execution.

func (*BatchATX) Validate added in v0.4.0

func (batch *BatchATX) Validate() error

Validate checks properties of the ACH batch to ensure they match NACHA guidelines. This includes computing checksums, totals, and sequence orderings.

Validate will never modify the batch.

type BatchBOC added in v0.3.0

type BatchBOC struct {
	Batch
}

BatchBOC holds the BatchHeader and BatchControl and all EntryDetail for BOC Entries.

Back Office Conversion (BOC) A single entry debit initiated at the point of purchase or at a manned bill payment location to transfer funds through conversion to an ACH debit entry during back office processing.

BOC allows retailers/billers, and ODFIs acting as Originators, to electronically convert checks received at the point-of-purchase as well as at a manned bill payment location into a single-entry ACH debit. The authorization to convert the check will be obtained through a notice at the checkout or manned bill payment location (e.g., loan payment at financial institution's teller window) and the receipt of the Receiver's check. The decision to process the check item as an ACH debit will be made in the “back office” instead of at the point-of-purchase. The customer's check will solely be used as a source document to obtain the routing number, account number and check serial number.

Unlike ARC entries, BOC conversions require the customer to be present and a notice that checks may be converted to BOC ACH entries be posted.

func NewBatchBOC added in v0.3.0

func NewBatchBOC(bh *BatchHeader) *BatchBOC

NewBatchBOC returns a *BatchBOC

func (*BatchBOC) Create added in v0.3.0

func (batch *BatchBOC) Create() error

Create will tabulate and assemble an ACH batch into a valid state. This includes setting any posting dates, sequence numbers, counts, and sums.

Create implementations are free to modify computable fields in a file and should call the Batch's Validate function at the end of their execution.

func (*BatchBOC) Validate added in v0.3.0

func (batch *BatchBOC) Validate() error

Validate checks properties of the ACH batch to ensure they match NACHA guidelines. This includes computing checksums, totals, and sequence orderings.

Validate will never modify the batch.

type BatchCCD

type BatchCCD struct {
	Batch
}

BatchCCD is a batch file that handles SEC payment type CCD and CCD+. Corporate credit or debit. Identifies an Entry initiated by an Organization to transfer funds to or from an account of that Organization or another Organization. For commercial accounts only.

func NewBatchCCD

func NewBatchCCD(bh *BatchHeader) *BatchCCD

NewBatchCCD returns a *BatchCCD

func (*BatchCCD) Create

func (batch *BatchCCD) Create() error

Create will tabulate and assemble an ACH batch into a valid state. This includes setting any posting dates, sequence numbers, counts, and sums.

Create implementations are free to modify computable fields in a file and should call the Batch's Validate function at the end of their execution.

func (*BatchCCD) Validate

func (batch *BatchCCD) Validate() error

Validate ensures the batch meets NACHA rules specific to this batch type.

type BatchCIE added in v0.3.0

type BatchCIE struct {
	Batch
}

BatchCIE holds the BatchHeader and BatchControl and all EntryDetail for CIE Entries.

Customer-Initiated Entry (or CIE entry) is a credit entry initiated on behalf of, and upon the instruction of, a consumer to transfer funds to a non-consumer Receiver. CIE entries are usually transmitted to a company for payment of funds that the consumer owes to that company and are initiated by the consumer through some type of online banking product or bill payment service provider. With CIEs, funds owed by the consumer are “pushed” to the biller in the form of an ACH credit, as opposed to the biller's use of a debit application (e.g., PPD, WEB) to “pull” the funds from a customer's account.

func NewBatchCIE added in v0.3.0

func NewBatchCIE(bh *BatchHeader) *BatchCIE

NewBatchCIE returns a *BatchCIE

func (*BatchCIE) Create added in v0.3.0

func (batch *BatchCIE) Create() error

Create will tabulate and assemble an ACH batch into a valid state. This includes setting any posting dates, sequence numbers, counts, and sums.

Create implementations are free to modify computable fields in a file and should call the Batch's Validate function at the end of their execution.

func (*BatchCIE) Validate added in v0.3.0

func (batch *BatchCIE) Validate() error

Validate checks properties of the ACH batch to ensure they match NACHA guidelines. This includes computing checksums, totals, and sequence orderings.

Validate will never modify the batch.

type BatchCOR

type BatchCOR struct {
	Batch
}

BatchCOR COR - Automated Notification of Change (NOC) or Refused Notification of Change This Standard Entry Class Code is used by an RDFI or ODFI when originating a Notification of Change or Refused Notification of Change in automated format. A Notification of Change may be created by an RDFI to notify the ODFI that a posted Entry or Prenotification Entry contains invalid or erroneous information and should be changed.

func NewBatchCOR

func NewBatchCOR(bh *BatchHeader) *BatchCOR

NewBatchCOR returns a *BatchCOR

func (*BatchCOR) Create

func (batch *BatchCOR) Create() error

Create will tabulate and assemble an ACH batch into a valid state. This includes setting any posting dates, sequence numbers, counts, and sums.

Create implementations are free to modify computable fields in a file and should call the Batch's Validate function at the end of their execution.

func (*BatchCOR) Validate

func (batch *BatchCOR) Validate() error

Validate ensures the batch meets NACHA rules specific to this batch type.

type BatchCTX added in v0.3.0

type BatchCTX struct {
	Batch
}

BatchCTX holds the BatchHeader and BatchControl and all EntryDetail for CTX Entries.

The Corporate Trade Exchange (CTX) application provides the ability to collect and disburse funds and information between companies. Generally it is used by businesses paying one another for goods or services. These payments replace checks with an electronic process of debiting and crediting invoices between the financial institutions of participating companies.

func NewBatchCTX added in v0.3.0

func NewBatchCTX(bh *BatchHeader) *BatchCTX

NewBatchCTX returns a *BatchCTX

func (*BatchCTX) Create added in v0.3.0

func (batch *BatchCTX) Create() error

Create will tabulate and assemble an ACH batch into a valid state. This includes setting any posting dates, sequence numbers, counts, and sums.

Create implementations are free to modify computable fields in a file and should call the Batch's Validate function at the end of their execution.

func (*BatchCTX) Validate added in v0.3.0

func (batch *BatchCTX) Validate() error

Validate checks properties of the ACH batch to ensure they match NACHA guidelines. This includes computing checksums, totals, and sequence orderings.

Validate will never modify the batch.

type BatchControl

type BatchControl struct {
	// ID is an identifier only used by the moov-io/ach HTTP server as a way to identify a batch.
	ID string `json:"id"`
	// ServiceClassCode ACH Mixed Debits and Credits '200'
	// ACH Credits Only '220'
	// ACH Debits Only '225'
	// Constants: MixedCreditsAnDebits (200), CreditsOnly (220), DebitsOnly (225)
	// Same as 'ServiceClassCode' in BatchHeaderRecord
	ServiceClassCode int `json:"serviceClassCode"`
	// EntryAddendaCount is a tally of each Entry Detail Record and each Addenda
	// Record processed, within either the batch or file as appropriate.
	EntryAddendaCount int `json:"entryAddendaCount"`
	// validate the Receiving DFI Identification in each Entry Detail Record is hashed
	// to provide a check against inadvertent alteration of data contents due
	// to hardware failure or program error
	//
	// In this context the Entry Hash is the sum of the corresponding fields in the
	// Entry Detail Records on the file.
	EntryHash int `json:"entryHash"`
	// TotalDebitEntryDollarAmount Contains accumulated Entry debit totals within the batch.
	TotalDebitEntryDollarAmount int `json:"totalDebit"`
	// TotalCreditEntryDollarAmount Contains accumulated Entry credit totals within the batch.
	TotalCreditEntryDollarAmount int `json:"totalCredit"`
	// CompanyIdentification is an alphanumeric code used to identify an Originator
	// The Company Identification Field must be included on all
	// prenotification records and on each entry initiated pursuant to such
	// prenotification. The Company ID may begin with the ANSI one-digit
	// Identification Code Designator (ICD), followed by the identification
	// number The ANSI Identification Numbers and related Identification Code
	// Designator (ICD) are:
	//
	// IRS Employer Identification Number (EIN) "1"
	// Data Universal Numbering Systems (DUNS) "3"
	// User Assigned Number "9"
	CompanyIdentification string `json:"companyIdentification"`
	// MessageAuthenticationCode the MAC is an eight character code derived from a special key used in
	// conjunction with the DES algorithm. The purpose of the MAC is to
	// validate the authenticity of ACH entries. The DES algorithm and key
	// message standards must be in accordance with standards adopted by the
	// American National Standards Institute. The remaining eleven characters
	// of this field are blank.
	MessageAuthenticationCode string `json:"messageAuthentication,omitempty"`
	// ODFIIdentification the routing number is used to identify the DFI originating entries within a given branch.
	ODFIIdentification string `json:"ODFIIdentification"`
	// BatchNumber this number is assigned in ascending sequence to each batch by the ODFI
	// or its Sending Point in a given file of entries. Since the batch number
	// in the Batch Header Record and the Batch Control Record is the same,
	// the ascending sequence number should be assigned by batch and not by record.
	BatchNumber int `json:"batchNumber"`
	// contains filtered or unexported fields
}

BatchControl contains entry counts, dollar total and has totals for all entries contained in the preceding batch

func NewBatchControl

func NewBatchControl() *BatchControl

NewBatchControl returns a new BatchControl with default values for none exported fields

func (*BatchControl) BatchNumberField

func (bc *BatchControl) BatchNumberField() string

BatchNumberField gets a string of the batch number zero padded

func (*BatchControl) CalculateCheckDigit

func (v *BatchControl) CalculateCheckDigit(routingNumber string) int

func (*BatchControl) CompanyIdentificationField

func (bc *BatchControl) CompanyIdentificationField() string

CompanyIdentificationField get the CompanyIdentification right padded

func (*BatchControl) EntryAddendaCountField

func (bc *BatchControl) EntryAddendaCountField() string

EntryAddendaCountField gets a string of the addenda count zero padded

func (*BatchControl) EntryHashField

func (bc *BatchControl) EntryHashField() string

EntryHashField get a zero padded EntryHash

func (*BatchControl) MessageAuthenticationCodeField

func (bc *BatchControl) MessageAuthenticationCodeField() string

MessageAuthenticationCodeField get the MessageAuthenticationCode right padded

func (*BatchControl) ODFIIdentificationField

func (bc *BatchControl) ODFIIdentificationField() string

ODFIIdentificationField get the odfi number zero padded

func (*BatchControl) Parse

func (bc *BatchControl) Parse(record string)

Parse takes the input record string and parses the EntryDetail values

Parse provides no guarantee about all fields being filled in. Callers should make a Validate call to confirm successful parsing and data validity.

func (*BatchControl) SetValidation added in v1.28.0

func (bc *BatchControl) SetValidation(opts *ValidateOpts)

func (*BatchControl) String

func (bc *BatchControl) String() string

String writes the BatchControl struct to a 94 character string.

func (*BatchControl) TotalCreditEntryDollarAmountField

func (bc *BatchControl) TotalCreditEntryDollarAmountField() string

TotalCreditEntryDollarAmountField get a zero padded Credit Entry Amount

func (*BatchControl) TotalDebitEntryDollarAmountField

func (bc *BatchControl) TotalDebitEntryDollarAmountField() string

TotalDebitEntryDollarAmountField get a zero padded Debit Entry Amount

func (*BatchControl) Validate

func (bc *BatchControl) Validate() error

Validate performs NACHA format rule checks on the record and returns an error if not Validated The first error encountered is returned and stops that parsing.

type BatchDNE added in v0.4.0

type BatchDNE struct {
	Batch
}

BatchDNE is a batch file that handles SEC code Death Notification Entry (DNE) United States Federal agencies (e.g. Social Security) use this to notify depository financial institutions that the recipient of government benefit payments has died.

Notes:

  • Date of death always in positions 18-23
  • SSN (positions 38-46) are zero if no SSN
  • Beneficiary payment starts at position 55

func NewBatchDNE added in v0.4.0

func NewBatchDNE(bh *BatchHeader) *BatchDNE

NewBatchDNE returns a *BatchDNE

func (*BatchDNE) Create added in v0.4.0

func (batch *BatchDNE) Create() error

Create will tabulate and assemble an ACH batch into a valid state. This includes setting any posting dates, sequence numbers, counts, and sums.

Create implementations are free to modify computable fields in a file and should call the Batch's Validate function at the end of their execution.

func (*BatchDNE) Validate added in v0.4.0

func (batch *BatchDNE) Validate() error

Validate ensures the batch meets NACHA rules specific to this batch type.

type BatchENR added in v0.4.0

type BatchENR struct {
	Batch
}

BatchENR is a non-monetary entry that enrolls a person with an agency of the US government for a depository financial institution.

Allowed TransactionCode values: 22 Demand Credit, 27 Demand Debit, 32 Savings Credit, 37 Savings Debit

func NewBatchENR added in v0.4.0

func NewBatchENR(bh *BatchHeader) *BatchENR

NewBatchENR returns a *BatchENR

func (*BatchENR) Create added in v0.4.0

func (batch *BatchENR) Create() error

Create will tabulate and assemble an ACH batch into a valid state. This includes setting any posting dates, sequence numbers, counts, and sums.

Create implementations are free to modify computable fields in a file and should call the Batch's Validate function at the end of their execution.

func (*BatchENR) Validate added in v0.4.0

func (batch *BatchENR) Validate() error

Validate ensures the batch meets NACHA rules specific to this batch type.

type BatchError

type BatchError struct {
	BatchNumber int
	BatchType   string
	FieldName   string
	FieldValue  interface{}
	Err         error
}

BatchError is an Error that describes batch validation issues

func (*BatchError) Error

func (e *BatchError) Error() string

func (*BatchError) Unwrap added in v0.6.0

func (e *BatchError) Unwrap() error

Unwrap implements the base.UnwrappableError interface for BatchError

type BatchHeader

type BatchHeader struct {
	// ID is an identifier only used by the moov-io/ach HTTP server as a way to identify a batch.
	ID string `json:"id"`

	// ServiceClassCode ACH Mixed Debits and Credits '200'
	// ACH Credits Only '220'
	// ACH Debits Only '225'
	ServiceClassCode int `json:"serviceClassCode"`

	// CompanyName the company originating the entries in the batch
	CompanyName string `json:"companyName"`

	// CompanyDiscretionaryData allows Originators and/or ODFIs to include codes (one or more),
	// of significance only to them, to enable specialized handling of all
	// subsequent entries in that batch. There will be no standardized
	// interpretation for the value of the field. This field must be returned
	// intact on any return entry.
	CompanyDiscretionaryData string `json:"companyDiscretionaryData,omitempty"`

	// CompanyIdentification The 9 digit FEIN number (proceeded by a predetermined
	// alpha or numeric character) of the entity in the company name field
	CompanyIdentification string `json:"companyIdentification"`

	// StandardEntryClassCode
	// Identifies the payment type (product) found within an ACH batch-using a 3-character code.
	// The SEC Code pertains to all items within batch.
	// Determines format of the detail records.
	// Determines addenda records (required or optional PLUS one or up to 9,999 records).
	// Determines rules to follow (return time frames).
	// Some SEC codes require specific data in predetermined fields within the ACH record
	StandardEntryClassCode string `json:"standardEntryClassCode"`

	// CompanyEntryDescription A description of the entries contained in the batch
	//
	//The Originator establishes the value of this field to provide a
	// description of the purpose of the entry to be displayed back to
	// the receive For example, "GAS BILL," "REG. SALARY," "INS. PREM,"
	// "SOC. SEC.," "DTC," "TRADE PAY," "PURCHASE," etc.
	//
	// This field must contain the word "REVERSAL" (left justified) when the
	// batch contains reversing entries.
	//
	// This field must contain the word "RECLAIM" (left justified) when the
	// batch contains reclamation entries.
	//
	// This field must contain the word "NONSETTLED" (left justified) when the
	// batch contains entries which could not settle.
	CompanyEntryDescription string `json:"companyEntryDescription,omitempty"`

	// CompanyDescriptiveDate currently, the Rules provide that the “Originator establishes this field as the date it
	// would like to see displayed to the Receiver for descriptive purposes.” NACHA recommends that, as desired,
	// the content of this field be formatted using the convention “SDHHMM”, where the “SD” in positions 64- 65 denotes
	// the intent for same-day settlement, and the hours and minutes in positions 66-69 denote the desired settlement
	// time using a 24-hour clock. When electing to use this convention, the ODFI would validate that the field
	// contains either.
	//
	// ODFIs at their discretion may require their Originators to further show intent for
	// same-day settlement using an optional, yet standardized, same-day indicator in the Company Descriptive Date
	// field. The Company Descriptive Date field (5 record, field 8) is an optional field with 6 positions available
	// (positions 64-69).
	CompanyDescriptiveDate string `json:"companyDescriptiveDate,omitempty"`

	// EffectiveEntryDate the date on which the entries are to settle. Format: YYMMDD (Y=Year, M=Month, D=Day)
	EffectiveEntryDate string `json:"effectiveEntryDate,omitempty"`

	// SettlementDate Leave blank, this field is inserted by the ACH operator
	SettlementDate string `json:"settlementDate,omitempty"`

	// OriginatorStatusCode refers to the ODFI initiating the Entry.
	// 0 ADV File prepared by an ACH Operator.
	// 1 This code identifies the Originator as a depository financial institution.
	// 2 This code identifies the Originator as a Federal Government entity or agency.
	OriginatorStatusCode int `json:"originatorStatusCode,omitempty"`

	//ODFIIdentification First 8 digits of the originating DFI transit routing number
	ODFIIdentification string `json:"ODFIIdentification"`

	// BatchNumber is assigned in ascending sequence to each batch by the ODFI
	// or its Sending Point in a given file of entries. Since the batch number
	// in the Batch Header Record and the Batch Control Record is the same,
	// the ascending sequence number should be assigned by batch and not by
	// record.
	BatchNumber int `json:"batchNumber"`
	// contains filtered or unexported fields
}

BatchHeader identifies the originating entity and the type of transactions contained in the batch (i.e., the standard entry class, PPD for consumer, CCD or CTX for corporate). This record also contains the effective date, or desired settlement date, for all entries contained in this batch. The settlement date field is not entered as it is determined by the ACH operator

func NewBatchHeader

func NewBatchHeader() *BatchHeader

NewBatchHeader returns a new BatchHeader with default values for non exported fields

func (*BatchHeader) BatchNumberField

func (bh *BatchHeader) BatchNumberField() string

BatchNumberField get the batch number zero padded

func (*BatchHeader) CalculateCheckDigit

func (v *BatchHeader) CalculateCheckDigit(routingNumber string) int

func (*BatchHeader) CompanyDescriptiveDateField

func (bh *BatchHeader) CompanyDescriptiveDateField() string

CompanyDescriptiveDateField get the CompanyDescriptiveDate left padded

func (*BatchHeader) CompanyDiscretionaryDataField

func (bh *BatchHeader) CompanyDiscretionaryDataField() string

CompanyDiscretionaryDataField get the CompanyDiscretionaryData left padded

func (*BatchHeader) CompanyEntryDescriptionField

func (bh *BatchHeader) CompanyEntryDescriptionField() string

CompanyEntryDescriptionField get the CompanyEntryDescription left padded

func (*BatchHeader) CompanyIdentificationField

func (bh *BatchHeader) CompanyIdentificationField() string

CompanyIdentificationField get the CompanyIdentification left padded

func (*BatchHeader) CompanyNameField

func (bh *BatchHeader) CompanyNameField() string

CompanyNameField get the CompanyName left padded

func (*BatchHeader) EffectiveEntryDateField

func (bh *BatchHeader) EffectiveEntryDateField() string

EffectiveEntryDateField get the EffectiveEntryDate in YYMMDD format

func (*BatchHeader) Equal added in v1.9.0

func (bh *BatchHeader) Equal(other *BatchHeader) bool

Equal returns true only if two BatchHeaders are equal. Equality is determined by the Nacha defined fields of each record.

func (*BatchHeader) LiftEffectiveEntryDate added in v1.4.0

func (bh *BatchHeader) LiftEffectiveEntryDate() (time.Time, error)

func (*BatchHeader) ODFIIdentificationField

func (bh *BatchHeader) ODFIIdentificationField() string

ODFIIdentificationField get the odfi number zero padded

func (*BatchHeader) Parse

func (bh *BatchHeader) Parse(record string)

Parse takes the input record string and parses the BatchHeader values

Parse provides no guarantee about all fields being filled in. Callers should make a Validate call to confirm successful parsing and data validity.

func (*BatchHeader) SetValidation added in v1.5.0

func (bh *BatchHeader) SetValidation(opts *ValidateOpts)

SetValidation stores ValidateOpts on the BatchHeader which are to be used to override the default NACHA validation rules.

func (*BatchHeader) SettlementDateField added in v1.10.0

func (bh *BatchHeader) SettlementDateField() string

func (*BatchHeader) String

func (bh *BatchHeader) String() string

String writes the BatchHeader struct to a 94 character string.

func (*BatchHeader) Validate

func (bh *BatchHeader) Validate() error

Validate performs NACHA format rule checks on the record and returns an error if not Validated The first error encountered is returned and stops that parsing.

type BatchMTE added in v0.5.0

type BatchMTE struct {
	Batch
}

BatchMTE holds the BatchHeader, BatchControl, and EntryDetail for Machine Transfer Entry (MTE) entries.

A MTE transaction is created when a consumer uses their debit card at an Automated Teller Machine (ATM) to withdraw cash. MTE transactions cannot be aggregated together under a single Entry.

func NewBatchMTE added in v0.5.0

func NewBatchMTE(bh *BatchHeader) *BatchMTE

NewBatchMTE returns a *BatchMTE

func (*BatchMTE) Create added in v0.5.0

func (batch *BatchMTE) Create() error

Create will tabulate and assemble an ACH batch into a valid state. This includes setting any posting dates, sequence numbers, counts, and sums.

Create implementations are free to modify computable fields in a file and should call the Batch's Validate function at the end of their execution.

func (*BatchMTE) Validate added in v0.5.0

func (batch *BatchMTE) Validate() error

Validate checks properties of the ACH batch to ensure they match NACHA guidelines. This includes computing checksums, totals, and sequence orderings.

Validate will never modify the batch.

type BatchPOP added in v0.3.0

type BatchPOP struct {
	Batch
}

BatchPOP holds the BatchHeader and BatchControl and all EntryDetail for POP Entries.

Point-of-Purchase. A check presented in-person to a merchant for purchase is presented as an ACH entry instead of a physical check.

This ACH debit application is used by originators as a method of payment for the in-person purchase of goods or services by consumers. These Single Entry debit entries are initiated by the originator based on a written authorization and account information drawn from the source document (a check) obtained from the consumer at the point-of-purchase. The source document, which is voided by the merchant and returned to the consumer at the point-of-purchase, is used to collect the consumer's routing number, account number and check serial number that will be used to generate the debit entry to the consumer's account.

The difference between POP and ARC is that ARC can result from a check mailed in whereas POP is in-person.

func NewBatchPOP added in v0.3.0

func NewBatchPOP(bh *BatchHeader) *BatchPOP

NewBatchPOP returns a *BatchPOP

func (*BatchPOP) Create added in v0.3.0

func (batch *BatchPOP) Create() error

Create will tabulate and assemble an ACH batch into a valid state. This includes setting any posting dates, sequence numbers, counts, and sums.

Create implementations are free to modify computable fields in a file and should call the Batch's Validate function at the end of their execution.

func (*BatchPOP) Validate added in v0.3.0

func (batch *BatchPOP) Validate() error

Validate checks properties of the ACH batch to ensure they match NACHA guidelines. This includes computing checksums, totals, and sequence orderings.

Validate will never modify the batch.

type BatchPOS added in v0.3.0

type BatchPOS struct {
	Batch
}

BatchPOS holds the BatchHeader and BatchControl and all EntryDetail for POS Entries.

A POS Entry is a debit Entry initiated at an “electronic terminal” to a consumer account of the receiver to pay an obligation incurred in a point- of-sale transaction, or to effect a point-of-sale terminal cash withdrawal.

Point-of-Sale Entries (POS) are ACH debit entries typically initiated by the use of a merchant-issued plastic card to pay an obligation at the point-of-sale. Much like a financial institution issued debit card, the merchant- issued debit card is swiped at the point-of-sale and approved for use; however, the authorization only verifies the card is open, active and within the card's limits—it does not verify the Receiver's account balance or debit the account at the time of the purchase. Settlement of the transaction moves from the card network to the ACH Network through the creation of a POS entry by the card issuer to debit the Receiver's account.

func NewBatchPOS added in v0.3.0

func NewBatchPOS(bh *BatchHeader) *BatchPOS

NewBatchPOS returns a *BatchPOS

func (*BatchPOS) Create added in v0.3.0

func (batch *BatchPOS) Create() error

Create will tabulate and assemble an ACH batch into a valid state. This includes setting any posting dates, sequence numbers, counts, and sums.

Create implementations are free to modify computable fields in a file and should call the Batch's Validate function at the end of their execution.

func (*BatchPOS) Validate added in v0.3.0

func (batch *BatchPOS) Validate() error

Validate checks properties of the ACH batch to ensure they match NACHA guidelines. This includes computing checksums, totals, and sequence orderings.

Validate will never modify the batch.

type BatchPPD

type BatchPPD struct {
	Batch
}

BatchPPD holds the Batch Header and Batch Control and all Entry Records for PPD Entries

func NewBatchPPD

func NewBatchPPD(bh *BatchHeader) *BatchPPD

NewBatchPPD returns a *BatchPPD

func (*BatchPPD) Create

func (batch *BatchPPD) Create() error

Create will tabulate and assemble an ACH batch into a valid state. This includes setting any posting dates, sequence numbers, counts, and sums.

Create implementations are free to modify computable fields in a file and should call the Batch's Validate function at the end of their execution.

func (*BatchPPD) Validate

func (batch *BatchPPD) Validate() error

Validate checks properties of the ACH batch to ensure they match NACHA guidelines. This includes computing checksums, totals, and sequence orderings.

Validate will never modify the batch.

type BatchRCK added in v0.3.0

type BatchRCK struct {
	Batch
}

BatchRCK holds the BatchHeader and BatchControl and all EntryDetail for RCK Entries.

Represented Check Entries (RCK). A physical check that was presented but returned because of insufficient funds may be represented as an ACH entry.

func NewBatchRCK added in v0.3.0

func NewBatchRCK(bh *BatchHeader) *BatchRCK

NewBatchRCK returns a *BatchRCK

func (*BatchRCK) Create added in v0.3.0

func (batch *BatchRCK) Create() error

Create will tabulate and assemble an ACH batch into a valid state. This includes setting any posting dates, sequence numbers, counts, and sums.

Create implementations are free to modify computable fields in a file and should call the Batch's Validate function at the end of their execution.

func (*BatchRCK) Validate added in v0.3.0

func (batch *BatchRCK) Validate() error

Validate checks properties of the ACH batch to ensure they match NACHA guidelines. This includes computing checksums, totals, and sequence orderings.

Validate will never modify the batch.

type BatchSHR added in v0.3.0

type BatchSHR struct {
	Batch
}

BatchSHR holds the BatchHeader and BatchControl and all EntryDetail for SHR Entries.

Shared Network Entry (SHR) is a debit Entry initiated at an “electronic terminal,” as that term is defined in Regulation E, to a Consumer Account of the Receiver to pay an obligation incurred in a point-of-sale transaction, or to effect a point-of-sale terminal cash withdrawal. Also an adjusting or other credit Entry related to such debit Entry, transfer of funds, or obligation. SHR Entries are initiated in a shared network where the ODFI and RDFI have an agreement in addition to these Rules to process such Entries.

func NewBatchSHR added in v0.3.0

func NewBatchSHR(bh *BatchHeader) *BatchSHR

NewBatchSHR returns a *BatchSHR

func (*BatchSHR) Create added in v0.3.0

func (batch *BatchSHR) Create() error

Create will tabulate and assemble an ACH batch into a valid state. This includes setting any posting dates, sequence numbers, counts, and sums.

Create implementations are free to modify computable fields in a file and should call the Batch's Validate function at the end of their execution.

func (*BatchSHR) Validate added in v0.3.0

func (batch *BatchSHR) Validate() error

Validate checks properties of the ACH batch to ensure they match NACHA guidelines. This includes computing checksums, totals, and sequence orderings.

Validate will never modify the batch.

type BatchTEL added in v0.2.0

type BatchTEL struct {
	Batch
}

BatchTEL is a batch that handles SEC payment type Telephone-Initiated Entries (TEL) Telephone-Initiated Entries (TEL) are consumer debit transactions. The NACHA Operating Rules permit TEL entries when the Originator obtains the Receiver's authorization for the debit entry orally via the telephone. An entry based upon a Receiver's oral authorization must utilize the TEL (Telephone-Initiated Entry) Standard Entry Class (SEC) Code.

func NewBatchTEL added in v0.2.0

func NewBatchTEL(bh *BatchHeader) *BatchTEL

NewBatchTEL returns a *BatchTEL

func (*BatchTEL) Create added in v0.2.0

func (batch *BatchTEL) Create() error

Create will tabulate and assemble an ACH batch into a valid state. This includes setting any posting dates, sequence numbers, counts, and sums.

Create implementations are free to modify computable fields in a file and should call the Batch's Validate function at the end of their execution.

func (*BatchTEL) Validate added in v0.2.0

func (batch *BatchTEL) Validate() error

Validate ensures the batch meets NACHA rules specific to the SEC type TEL

type BatchTRC added in v0.5.0

type BatchTRC struct {
	Batch
}

BatchTRC holds the BatchHeader and BatchControl and all EntryDetail for TRC Entries.

Check Truncation Entry (Truncated Entry) is used to identify a debit entry of a truncated check.

func NewBatchTRC added in v0.5.0

func NewBatchTRC(bh *BatchHeader) *BatchTRC

NewBatchTRC returns a *BatchTRC

func (*BatchTRC) Create added in v0.5.0

func (batch *BatchTRC) Create() error

Create will tabulate and assemble an ACH batch into a valid state. This includes setting any posting dates, sequence numbers, counts, and sums.

Create implementations are free to modify computable fields in a file and should call the Batch's Validate function at the end of their execution.

func (*BatchTRC) Validate added in v0.5.0

func (batch *BatchTRC) Validate() error

Validate checks properties of the ACH batch to ensure they match NACHA guidelines. This includes computing checksums, totals, and sequence orderings.

Validate will never modify the batch.

type BatchTRX added in v0.5.0

type BatchTRX struct {
	Batch
}

BatchTRX holds the BatchHeader and BatchControl and all EntryDetail for TRX Entries.

Check Truncation Entries Exchange is used to identify a debit entry of a truncated checks (multiple).

func NewBatchTRX added in v0.5.0

func NewBatchTRX(bh *BatchHeader) *BatchTRX

NewBatchTRX returns a *BatchTRX

func (*BatchTRX) Create added in v0.5.0

func (batch *BatchTRX) Create() error

Create will tabulate and assemble an ACH batch into a valid state. This includes setting any posting dates, sequence numbers, counts, and sums.

Create implementations are free to modify computable fields in a file and should call the Batch's Validate function at the end of their execution.

func (*BatchTRX) Validate added in v0.5.0

func (batch *BatchTRX) Validate() error

Validate checks properties of the ACH batch to ensure they match NACHA guidelines. This includes computing checksums, totals, and sequence orderings.

Validate will never modify the batch.

type BatchWEB

type BatchWEB struct {
	Batch
}

BatchWEB creates a batch file that handles SEC payment type WEB. Entry submitted pursuant to an authorization obtained solely via the Internet or a wireless network For consumer accounts only.

func NewBatchWEB

func NewBatchWEB(bh *BatchHeader) *BatchWEB

NewBatchWEB returns a *BatchWEB

func (*BatchWEB) Create

func (batch *BatchWEB) Create() error

Create will tabulate and assemble an ACH batch into a valid state. This includes setting any posting dates, sequence numbers, counts, and sums.

Create implementations are free to modify computable fields in a file and should call the Batch's Validate function at the end of their execution.

func (*BatchWEB) Validate

func (batch *BatchWEB) Validate() error

Validate ensures the batch meets NACHA rules specific to this batch type.

type BatchXCK added in v0.5.0

type BatchXCK struct {
	Batch
}

BatchXCK holds the BatchHeader and BatchControl and all EntryDetail for XCK Entries.

Destroyed Check Entry identifies a debit entry initiated for a XCK eligible items.

func NewBatchXCK added in v0.5.0

func NewBatchXCK(bh *BatchHeader) *BatchXCK

NewBatchXCK returns a *BatchXCK

func (*BatchXCK) Create added in v0.5.0

func (batch *BatchXCK) Create() error

Create will tabulate and assemble an ACH batch into a valid state. This includes setting any posting dates, sequence numbers, counts, and sums.

Create implementations are free to modify computable fields in a file and should call the Batch's Validate function at the end of their execution.

func (*BatchXCK) Validate added in v0.5.0

func (batch *BatchXCK) Validate() error

Validate checks properties of the ACH batch to ensure they match NACHA guidelines. This includes computing checksums, totals, and sequence orderings.

Validate will never modify the batch.

type Batcher

type Batcher interface {
	GetHeader() *BatchHeader
	SetHeader(*BatchHeader)
	GetControl() *BatchControl
	SetControl(*BatchControl)
	GetADVControl() *ADVBatchControl
	SetADVControl(*ADVBatchControl)
	GetEntries() []*EntryDetail
	AddEntry(*EntryDetail)
	DeleteEntries(func(*EntryDetail) bool)
	GetADVEntries() []*ADVEntryDetail
	AddADVEntry(*ADVEntryDetail)
	DeleteADVEntries(func(*ADVEntryDetail) bool)
	Create() error
	Validate() error
	SetID(string)
	ID() string
	// Category defines if a Forward or Return
	Category() string
	Error(string, error, ...interface{}) error
	Equal(other Batcher) bool
	WithOffset(off *Offset)
	SetValidation(*ValidateOpts)
}

Batcher abstract the different ACH batch types that can exist in a file. Each batch type is defined by SEC (Standard Entry Class) code in the Batch Header * SEC identifies the payment type (product) found within an ACH batch-using a 3-character code * The SEC Code pertains to all items within batch

  • Determines format of the entry detail records
  • Determines addenda records (required or optional PLUS one or up to 9,999 records)
  • Determines rules to follow (return time frames)
  • Some SEC codes require specific data in predetermined fields within the ACH record

func ConvertBatchType added in v0.6.0

func ConvertBatchType(b Batch) Batcher

ConvertBatchType will take a batch object and convert it into one of the correct batch type

func NewBatch

func NewBatch(bh *BatchHeader) (Batcher, error)

NewBatch takes a BatchHeader and returns a matching SEC code batch type that is a batcher. Returns an error if the SEC code is not supported.

type ChangeCode added in v1.2.0

type ChangeCode struct {
	Code        string `json:"code"`
	Reason      string `json:"reason"`
	Description string `json:"description"`
}

ChangeCode holds a change Code, Reason/Title, and Description table of return codes exists in Part 4.2 of the NACHA corporate rules and guidelines

func LookupChangeCode added in v1.2.0

func LookupChangeCode(code string) *ChangeCode

LookupChangeCode will return a struct representing the reason and description for the provided NACHA change code.

type Conditions added in v1.15.0

type Conditions struct {
	// MaxLines will limit each merged files line count.
	MaxLines int `json:"maxLines"`

	// MaxDollarAmount will limit each merged file's total dollar amount.
	MaxDollarAmount int64 `json:"maxDollarAmount"`
}

type CorrectedData added in v1.3.0

type CorrectedData struct {
	AccountNumber   string
	RoutingNumber   string
	Name            string
	TransactionCode int
	Identification  string
}

CorrectedData is a struct returned from our helper method for parsing the NOC/COR corrected data from Addenda98 records.

All fields are optional and a valid code may not have populated data in this struct.

type DNEPaymentInformation added in v1.42.0

type DNEPaymentInformation struct {
	DateOfDeath time.Time
	CustomerSSN string

	// Amount is a two-decimal float value formatted as a string
	// Example: 123.45
	Amount string
}

func ParseDNEPaymentInformation added in v1.42.0

func ParseDNEPaymentInformation(addenda05 *Addenda05) (*DNEPaymentInformation, error)

ParseDNEPaymentInformation returns an DNEPaymentInformation for a given Addenda05 record. The information is parsed from the addenda's PaymentRelatedInformation field.

The returned information is not validated for correctness.

func (DNEPaymentInformation) String added in v1.42.0

func (info DNEPaymentInformation) String() string

type ENRPaymentInformation added in v0.4.0

type ENRPaymentInformation struct {
	// TransactionCode is the Transaction Code of the holder's account
	// Values: 22 (Demand  Credit), 27 (Demand Debit), 32 (Savings Credit), 37 (Savings Debit)
	TransactionCode int

	// RDFIIdentification is the Receiving Depository Identification Number. Typically the first 8 of their ABA routing number.
	RDFIIdentification string

	// CheckDigit is the last digit from an ABA routing number.
	CheckDigit string

	// DFIAccountNumber contains the holder's account number.
	DFIAccountNumber string

	// IndividualIdentification contains the customer's Social Security Number (SSN) for automated enrollments and the
	// taxpayer ID for companies.
	IndividualIdentification string

	// IndividualName is the account holders full name.
	IndividualName string

	// EnrolleeClassificationCode (also called Representative Payee Indicator) returns a code from a specific Addenda05 record.
	// These codes represent:
	//  0: (no)  - Initiated by beneficiary
	//  1: (yes) - Initiated by someone other than named beneficiary
	//  A: Enrollee is a consumer
	//  b: Enrollee is a company
	EnrolleeClassificationCode string
}

ENRPaymentInformation structure

func ParseENRPaymentInformation added in v1.42.0

func ParseENRPaymentInformation(addenda05 *Addenda05) (*ENRPaymentInformation, error)

ParseENRPaymentInformation returns an ENRPaymentInformation for a given Addenda05 record. The information is parsed from the addenda's PaymentRelatedInformation field.

The returned information is not validated for correctness.

func (ENRPaymentInformation) String added in v0.4.0

func (info ENRPaymentInformation) String() string

type EntryDetail

type EntryDetail struct {
	// ID is an identifier only used by the moov-io/ach HTTP server as a way to identify a batch.
	ID string `json:"id"`
	// TransactionCode if the receivers account is checking, savings, general ledger (GL) or loan.
	TransactionCode int `json:"transactionCode"`
	// RDFIIdentification is the RDFI's routing number without the last digit.
	// Receiving Depository Financial Institution
	RDFIIdentification string `json:"RDFIIdentification"`
	// CheckDigit the last digit of the RDFI's routing number
	CheckDigit string `json:"checkDigit"`
	// DFIAccountNumber is the receiver's bank account number you are crediting/debiting.
	// It important to note that this is an alphanumeric field, so its space padded, no zero padded
	DFIAccountNumber string `json:"DFIAccountNumber"`
	// Amount Number of cents you are debiting/crediting this account
	Amount int `json:"amount"`
	// IdentificationNumber an internal identification (alphanumeric) that
	// you use to uniquely identify this Entry Detail Record
	IdentificationNumber string `json:"identificationNumber,omitempty"`
	// IndividualName The name of the receiver, usually the name on the bank account
	IndividualName string `json:"individualName"`
	// DiscretionaryData allows ODFIs to include codes, of significance only to them,
	// to enable specialized handling of the entry. There will be no
	// standardized interpretation for the value of this field. It can either
	// be a single two-character code, or two distinct one-character codes,
	// according to the needs of the ODFI and/or Originator involved. This
	// field must be returned intact for any returned entry.
	//
	// WEB and TEL batches use the Discretionary Data Field as the Payment Type Code
	//
	// Refused ACK AND ATX entries will use this field for the Refused Acknowledgement Code
	DiscretionaryData string `json:"discretionaryData,omitempty"`
	// AddendaRecordIndicator indicates the existence of an Addenda Record.
	// A value of "1" indicates that one ore more addenda records follow,
	// and "0" means no such record is present.
	AddendaRecordIndicator int `json:"addendaRecordIndicator,omitempty"`
	// TraceNumber is assigned by the ODFI or software vendor and used as part of identification.
	//
	// The format of trace numbers is the first 8 digits of the ODFI's routing number followed by
	// 7 digits chosen by the ODFI or software vendor.
	//
	// Sequentual or random numbers can be chosen. The only requirement of Nacha is unique trace
	// numbers within a batch and file.
	//
	// Trace Numbers are included in each Entry Detail Record, Corporate Entry Detail Record,
	// and addenda Record.
	//
	// In association with the Batch Number, transmission (File Creation) Date,
	// and File ID Modifier, the Trace Number uniquely identifies an entry within a given file.
	//
	// For addenda Records, the Trace Number will be identical to the Trace Number
	// in the associated Entry Detail Record, since the Trace Number is associated
	// with an entry or item rather than a physical record.
	//
	// Use TraceNumberField for a properly formatted string representation.
	TraceNumber string `json:"traceNumber,omitempty"`
	// Addenda02 for use with StandardEntryClassCode MTE, POS, and SHR
	Addenda02 *Addenda02 `json:"addenda02,omitempty"`
	// Addenda05 for use with StandardEntryClassCode: ACK, ATX, CCD, CIE, CTX, DNE, ENR, WEB, PPD, TRX.
	Addenda05 []*Addenda05 `json:"addenda05,omitempty"`
	// Addenda98 for user with Notification of Change
	Addenda98 *Addenda98 `json:"addenda98,omitempty"`
	// Addenda98 for user with Refused Notification of Change
	Addenda98Refused *Addenda98Refused `json:"addenda98Refused,omitempty"`
	// Addenda99 for use with Returns
	Addenda99 *Addenda99 `json:"addenda99,omitempty"`
	// Addenda99Contested for use with Contested Dishonored Returns
	Addenda99Contested *Addenda99Contested `json:"addenda99Contested,omitempty"`
	// Addenda99Dishonored for use with Dishonored Returns
	Addenda99Dishonored *Addenda99Dishonored `json:"addenda99Dishonored,omitempty"`
	// Category defines if the entry is a Forward, Return, or NOC
	Category string `json:"category,omitempty"`
	// contains filtered or unexported fields
}

EntryDetail contains the actual transaction data for an individual entry. Fields include those designating the entry as a deposit (credit) or withdrawal (debit), the transit routing number for the entry recipient's financial institution, the account number (left justify,no zero fill), name, and dollar amount.

func NewEntryDetail

func NewEntryDetail() *EntryDetail

NewEntryDetail returns a new EntryDetail with default values for non exported fields

func (*EntryDetail) AddAddenda05 added in v0.4.0

func (ed *EntryDetail) AddAddenda05(addenda05 *Addenda05)

AddAddenda05 appends an Addenda05 to the EntryDetail

func (*EntryDetail) AmountField

func (ed *EntryDetail) AmountField() string

AmountField returns a zero padded string of amount

func (*EntryDetail) CATXAddendaRecordsField added in v0.4.0

func (ed *EntryDetail) CATXAddendaRecordsField() string

CATXAddendaRecordsField is used in CTX and ATX files, characters 1-4 of underlying IndividualName field

func (*EntryDetail) CATXReceivingCompanyField added in v0.4.0

func (ed *EntryDetail) CATXReceivingCompanyField() string

CATXReceivingCompanyField is used in CTX and ATX files, characters 5-20 of underlying IndividualName field

func (*EntryDetail) CATXReservedField added in v0.4.0

func (ed *EntryDetail) CATXReservedField() string

CATXReservedField is used in CTX and ATX files, characters 21-22 of underlying IndividualName field

func (*EntryDetail) CalculateCheckDigit

func (v *EntryDetail) CalculateCheckDigit(routingNumber string) int

func (*EntryDetail) CheckSerialNumberField added in v0.3.0

func (ed *EntryDetail) CheckSerialNumberField() string

CheckSerialNumberField is used in RCK, ARC, BOC files but returns a space padded string of the underlying IdentificationNumber field

func (*EntryDetail) CreditOrDebit added in v0.2.0

func (ed *EntryDetail) CreditOrDebit() string

CreditOrDebit returns a "C" for credit or "D" for debit based on the entry TransactionCode

func (*EntryDetail) DFIAccountNumberField

func (ed *EntryDetail) DFIAccountNumberField() string

DFIAccountNumberField gets the DFIAccountNumber with space padding

func (*EntryDetail) DiscretionaryDataField

func (ed *EntryDetail) DiscretionaryDataField() string

DiscretionaryDataField returns a space padded string of DiscretionaryData

func (*EntryDetail) IdentificationNumberField

func (ed *EntryDetail) IdentificationNumberField() string

IdentificationNumberField returns a space padded string of IdentificationNumber

func (*EntryDetail) IndividualNameField

func (ed *EntryDetail) IndividualNameField() string

IndividualNameField returns a space padded string of IndividualName

func (*EntryDetail) ItemResearchNumber added in v0.5.0

func (ed *EntryDetail) ItemResearchNumber() string

ItemResearchNumber getter for TRC Item Research Number characters 7-22 of underlying IndividualName

func (*EntryDetail) ItemTypeIndicator added in v0.5.0

func (ed *EntryDetail) ItemTypeIndicator() string

ItemTypeIndicator getter for TRC Item Type Indicator which is underlying Discretionary Data

func (*EntryDetail) OriginalTraceNumberField added in v0.4.0

func (ed *EntryDetail) OriginalTraceNumberField() string

OriginalTraceNumberField is used in ACK and ATX files but returns the underlying IdentificationNumber field

func (*EntryDetail) POPCheckSerialNumberField added in v0.3.0

func (ed *EntryDetail) POPCheckSerialNumberField() string

POPCheckSerialNumberField is used in POP, characters 1-9 of underlying BatchPOP CheckSerialNumber / IdentificationNumber

func (*EntryDetail) POPTerminalCityField added in v0.3.0

func (ed *EntryDetail) POPTerminalCityField() string

POPTerminalCityField is used in POP, characters 10-13 of underlying BatchPOP CheckSerialNumber / IdentificationNumber

func (*EntryDetail) POPTerminalStateField added in v0.3.0

func (ed *EntryDetail) POPTerminalStateField() string

POPTerminalStateField is used in POP, characters 14-15 of underlying BatchPOP CheckSerialNumber / IdentificationNumber

func (*EntryDetail) Parse

func (ed *EntryDetail) Parse(record string)

Parse takes the input record string and parses the EntryDetail values

Parse provides no guarantee about all fields being filled in. Callers should make a Validate call to confirm successful parsing and data validity.

func (*EntryDetail) PaymentTypeField

func (ed *EntryDetail) PaymentTypeField() string

PaymentTypeField returns the DiscretionaryData field used in WEB and TEL batch files

func (*EntryDetail) ProcessControlField added in v0.5.0

func (ed *EntryDetail) ProcessControlField() string

ProcessControlField getter for TRC Process Control Field characters 1-6 of underlying IndividualName

func (*EntryDetail) RDFIIdentificationField

func (ed *EntryDetail) RDFIIdentificationField() string

RDFIIdentificationField get the rdfiIdentification with zero padding

func (*EntryDetail) ReceivingCompanyField

func (ed *EntryDetail) ReceivingCompanyField() string

ReceivingCompanyField is used in CCD files but returns the underlying IndividualName field

func (*EntryDetail) SHRCardExpirationDateField added in v0.3.0

func (ed *EntryDetail) SHRCardExpirationDateField() string

SHRCardExpirationDateField format MMYY is used in SHR, characters 1-4 of underlying IdentificationNumber

func (*EntryDetail) SHRDocumentReferenceNumberField added in v0.3.0

func (ed *EntryDetail) SHRDocumentReferenceNumberField() string

SHRDocumentReferenceNumberField format int is used in SHR, characters 5-15 of underlying IdentificationNumber

func (*EntryDetail) SHRIndividualCardAccountNumberField added in v0.3.0

func (ed *EntryDetail) SHRIndividualCardAccountNumberField() string

SHRIndividualCardAccountNumberField format int is used in SHR, underlying IndividualName

func (*EntryDetail) SetCATXAddendaRecords added in v0.4.0

func (ed *EntryDetail) SetCATXAddendaRecords(i int)

SetCATXAddendaRecords setter for CTX and ATX AddendaRecords characters 1-4 of underlying IndividualName

func (*EntryDetail) SetCATXReceivingCompany added in v0.4.0

func (ed *EntryDetail) SetCATXReceivingCompany(s string)

SetCATXReceivingCompany setter for CTX and ATX ReceivingCompany characters 5-20 underlying IndividualName Position 21-22 of underlying Individual Name are reserved blank space for CTX " "

func (*EntryDetail) SetCheckSerialNumber added in v0.3.0

func (ed *EntryDetail) SetCheckSerialNumber(s string)

SetCheckSerialNumber setter for RCK, ARC, BOC CheckSerialNumber which is underlying IdentificationNumber

func (*EntryDetail) SetItemResearchNumber added in v0.5.0

func (ed *EntryDetail) SetItemResearchNumber(s string)

SetItemResearchNumber setter for TRC Item Research Number characters 7-22 of underlying IndividualName

func (*EntryDetail) SetItemTypeIndicator added in v0.5.0

func (ed *EntryDetail) SetItemTypeIndicator(s string)

SetItemTypeIndicator setter for TRC Item Type Indicator which is underlying Discretionary Data

func (*EntryDetail) SetOriginalTraceNumber added in v0.4.0

func (ed *EntryDetail) SetOriginalTraceNumber(s string)

SetOriginalTraceNumber setter for ACK and ATX OriginalTraceNumber which is underlying IdentificationNumber

func (*EntryDetail) SetPOPCheckSerialNumber added in v0.3.0

func (ed *EntryDetail) SetPOPCheckSerialNumber(s string)

SetPOPCheckSerialNumber setter for POP CheckSerialNumber which is characters 1-9 of underlying CheckSerialNumber \ IdentificationNumber

func (*EntryDetail) SetPOPTerminalCity added in v0.3.0

func (ed *EntryDetail) SetPOPTerminalCity(s string)

SetPOPTerminalCity setter for POP Terminal City which is characters 10-13 of underlying CheckSerialNumber \ IdentificationNumber

func (*EntryDetail) SetPOPTerminalState added in v0.3.0

func (ed *EntryDetail) SetPOPTerminalState(s string)

SetPOPTerminalState setter for POP Terminal State which is characters 14-15 of underlying CheckSerialNumber \ IdentificationNumber

func (*EntryDetail) SetPaymentType

func (ed *EntryDetail) SetPaymentType(t string)

SetPaymentType as R (Recurring) all other values will result in S (single). This is used for WEB and TEL batch files in-place of DiscretionaryData.

func (*EntryDetail) SetProcessControlField added in v0.5.0

func (ed *EntryDetail) SetProcessControlField(s string)

SetProcessControlField setter for TRC Process Control Field characters 1-6 of underlying IndividualName

func (*EntryDetail) SetRDFI

func (ed *EntryDetail) SetRDFI(rdfi string) *EntryDetail

SetRDFI takes the 9 digit RDFI account number and separates it for RDFIIdentification and CheckDigit

func (*EntryDetail) SetReceivingCompany

func (ed *EntryDetail) SetReceivingCompany(s string)

SetReceivingCompany setter for CCD ReceivingCompany which is underlying IndividualName

func (*EntryDetail) SetSHRCardExpirationDate added in v0.3.0

func (ed *EntryDetail) SetSHRCardExpirationDate(s string)

SetSHRCardExpirationDate format MMYY is used in SHR, characters 1-4 of underlying IdentificationNumber

func (*EntryDetail) SetSHRDocumentReferenceNumber added in v0.3.0

func (ed *EntryDetail) SetSHRDocumentReferenceNumber(s string)

SetSHRDocumentReferenceNumber format int is used in SHR, characters 5-15 of underlying IdentificationNumber

func (*EntryDetail) SetSHRIndividualCardAccountNumber added in v0.3.0

func (ed *EntryDetail) SetSHRIndividualCardAccountNumber(s string)

SetSHRIndividualCardAccountNumber format int is used in SHR, underlying IndividualName

func (*EntryDetail) SetTraceNumber added in v0.2.0

func (ed *EntryDetail) SetTraceNumber(ODFIIdentification string, seq int)

SetTraceNumber takes first 8 digits of ODFI and concatenates a sequence number onto the TraceNumber

func (*EntryDetail) SetValidation added in v1.5.0

func (ed *EntryDetail) SetValidation(opts *ValidateOpts)

SetValidation stores ValidateOpts on the EntryDetail which are to be used to override the default NACHA validation rules.

func (*EntryDetail) String

func (ed *EntryDetail) String() string

String writes the EntryDetail struct to a 94 character string.

func (*EntryDetail) TraceNumberField

func (ed *EntryDetail) TraceNumberField() string

TraceNumberField returns a zero padded TraceNumber string

func (*EntryDetail) Validate

func (ed *EntryDetail) Validate() error

Validate performs NACHA format rule checks on the record and returns an error if not Validated The first error encountered is returned and stops that parsing.

type ErrBatchAddendaCount added in v0.6.0

type ErrBatchAddendaCount struct {
	Message      string
	FoundCount   int
	AllowedCount int
}

ErrBatchAddendaCount is the error given when there are too many addenda than allowed for the batch type

func NewErrBatchAddendaCount added in v0.6.0

func NewErrBatchAddendaCount(found, allowed int) ErrBatchAddendaCount

NewErrBatchAddendaCount creates a new error of the ErrBatchAddendaCount type

func (ErrBatchAddendaCount) Error added in v0.6.0

func (e ErrBatchAddendaCount) Error() string

type ErrBatchAddendaTraceNumber added in v0.6.0

type ErrBatchAddendaTraceNumber struct {
	Message           string
	EntryDetailNumber string
	TraceNumber       string
}

ErrBatchAddendaTraceNumber is the error given when the entry detail sequence number doesn't match the trace number

func NewErrBatchAddendaTraceNumber added in v0.6.0

func NewErrBatchAddendaTraceNumber(entryDetail, trace string) ErrBatchAddendaTraceNumber

NewErrBatchAddendaTraceNumber creates a new error of the ErrBatchAddendaTraceNumber type

func (ErrBatchAddendaTraceNumber) Error added in v0.6.0

type ErrBatchAmount added in v0.6.0

type ErrBatchAmount struct {
	Message string
	Amount  int
	Limit   int
}

ErrBatchAmount is the error given when the amount exceeds the batch type's limit

func NewErrBatchAmount added in v0.6.0

func NewErrBatchAmount(amount, limit int) ErrBatchAmount

NewErrBatchAmount creates a new error of the ErrBatchAmount type

func (ErrBatchAmount) Error added in v0.6.0

func (e ErrBatchAmount) Error() string

type ErrBatchAscending added in v0.6.0

type ErrBatchAscending struct {
	Message       string
	PreviousTrace interface{}
	CurrentTrace  interface{}
}

ErrBatchAscending is the error given when the trace numbers in a batch are not in ascending order

func NewErrBatchAscending added in v0.6.0

func NewErrBatchAscending(previous, current interface{}) ErrBatchAscending

NewErrBatchAscending creates a new error of the ErrBatchAscending type

func (ErrBatchAscending) Error added in v0.6.0

func (e ErrBatchAscending) Error() string

type ErrBatchCalculatedControlEquality added in v0.6.0

type ErrBatchCalculatedControlEquality struct {
	Message         string
	CalculatedValue interface{}
	ControlValue    interface{}
}

ErrBatchCalculatedControlEquality is the error given when the control record does not match the calculated value

func NewErrBatchCalculatedControlEquality added in v0.6.0

func NewErrBatchCalculatedControlEquality(calculated, control interface{}) ErrBatchCalculatedControlEquality

NewErrBatchCalculatedControlEquality creates a new error of the ErrBatchCalculatedControlEquality type

func (ErrBatchCalculatedControlEquality) Error added in v0.6.0

type ErrBatchCategory added in v0.6.0

type ErrBatchCategory struct {
	Message   string
	CategoryA string
	CategoryB string
}

ErrBatchCategory is the error given when a batch has entires with two different categories

func NewErrBatchCategory added in v0.6.0

func NewErrBatchCategory(categoryA, categoryB string) ErrBatchCategory

NewErrBatchCategory creates a new error of the ErrBatchCategory type

func (ErrBatchCategory) Error added in v0.6.0

func (e ErrBatchCategory) Error() string

type ErrBatchExpectedAddendaCount added in v0.6.0

type ErrBatchExpectedAddendaCount struct {
	Message       string
	FoundCount    int
	ExpectedCount int
}

ErrBatchExpectedAddendaCount is the error given when the batch type has entries with a field for the number of addenda, and a different number of addenda are foound

func NewErrBatchExpectedAddendaCount added in v0.6.0

func NewErrBatchExpectedAddendaCount(found, expected int) ErrBatchExpectedAddendaCount

NewErrBatchExpectedAddendaCount creates a new error of the ErrBatchExpectedAddendaCount type

func (ErrBatchExpectedAddendaCount) Error added in v0.6.0

type ErrBatchHeaderControlEquality added in v0.6.0

type ErrBatchHeaderControlEquality struct {
	Message      string
	HeaderValue  interface{}
	ControlValue interface{}
}

ErrBatchHeaderControlEquality is the error given when the control record does not match the calculated value

func NewErrBatchHeaderControlEquality added in v0.6.0

func NewErrBatchHeaderControlEquality(header, control interface{}) ErrBatchHeaderControlEquality

NewErrBatchHeaderControlEquality creates a new error of the ErrBatchHeaderControlEquality type

func (ErrBatchHeaderControlEquality) Error added in v0.6.0

type ErrBatchIATNOC added in v0.6.0

type ErrBatchIATNOC struct {
	Message  string
	Found    interface{}
	Expected interface{}
}

ErrBatchIATNOC is the error given when an IAT batch has an NOC, and there are invalid values

func NewErrBatchIATNOC added in v0.6.0

func NewErrBatchIATNOC(found, expected interface{}) ErrBatchIATNOC

NewErrBatchIATNOC creates a new error of the ErrBatchIATNOC type

func (ErrBatchIATNOC) Error added in v0.6.0

func (e ErrBatchIATNOC) Error() string

type ErrBatchRequiredAddendaCount added in v0.6.0

type ErrBatchRequiredAddendaCount struct {
	Message       string
	FoundCount    int
	RequiredCount int
}

ErrBatchRequiredAddendaCount is the error given when the batch type requires a certain number of addenda, which is not met

func NewErrBatchRequiredAddendaCount added in v0.6.0

func NewErrBatchRequiredAddendaCount(found, required int) ErrBatchRequiredAddendaCount

NewErrBatchRequiredAddendaCount creates a new error of the ErrBatchRequiredAddendaCount type

func (ErrBatchRequiredAddendaCount) Error added in v0.6.0

type ErrBatchServiceClassTranCode added in v0.6.0

type ErrBatchServiceClassTranCode struct {
	Message          string
	ServiceClassCode int
	TransactionCode  int
}

ErrBatchServiceClassTranCode is the error given when the transaction code is not valid for the batch's service class

func NewErrBatchServiceClassTranCode added in v0.6.0

func NewErrBatchServiceClassTranCode(serviceClassCode, transactionCode int) ErrBatchServiceClassTranCode

NewErrBatchServiceClassTranCode creates a new error of the ErrBatchServiceClassTranCode type

func (ErrBatchServiceClassTranCode) Error added in v0.6.0

type ErrBatchTraceNumberNotODFI added in v0.6.0

type ErrBatchTraceNumberNotODFI struct {
	Message     string
	ODFI        string
	TraceNumber string
}

ErrBatchTraceNumberNotODFI is the error given when a batch's ODFI does not match an entry's trace number

func NewErrBatchTraceNumberNotODFI added in v0.6.0

func NewErrBatchTraceNumberNotODFI(odfi, trace string) ErrBatchTraceNumberNotODFI

NewErrBatchTraceNumberNotODFI creates a new error of the ErrBatchTraceNumberNotODFI type

func (ErrBatchTraceNumberNotODFI) Error added in v0.6.0

type ErrFileBatchNumberAscending added in v1.6.2

type ErrFileBatchNumberAscending struct {
	Message       string
	PreviousBatch int
	CurrentBatch  int
}

ErrFileBatchNumberAscending is the error given when the batch numbers in a file are not in ascending order

func NewErrFileBatchNumberAscending added in v1.6.2

func NewErrFileBatchNumberAscending(previous, current int) ErrFileBatchNumberAscending

NewErrFileBatchNumberAscending creates a new error of the ErrFileBatchNumberAscending type

func (ErrFileBatchNumberAscending) Error added in v1.6.2

type ErrFileCalculatedControlEquality added in v0.6.0

type ErrFileCalculatedControlEquality struct {
	Message         string
	Field           string
	CalculatedValue int
	ControlValue    int
}

ErrFileCalculatedControlEquality is the error given when the control record does not match the calculated value

func NewErrFileCalculatedControlEquality added in v0.6.0

func NewErrFileCalculatedControlEquality(field string, calculated, control int) ErrFileCalculatedControlEquality

NewErrFileCalculatedControlEquality creates a new error of the ErrFileCalculatedControlEquality type

func (ErrFileCalculatedControlEquality) Error added in v0.6.0

type ErrFileUnknownSEC added in v0.6.0

type ErrFileUnknownSEC struct {
	Message string
	SEC     string
}

ErrFileUnknownSEC is the error given when a record does not have a known type

func NewErrFileUnknownSEC added in v0.6.0

func NewErrFileUnknownSEC(secType string) ErrFileUnknownSEC

NewErrFileUnknownSEC creates a new error of the ErrFileUnknownSEC type

func (ErrFileUnknownSEC) Error added in v0.6.0

func (e ErrFileUnknownSEC) Error() string

type ErrRecordType added in v0.6.0

type ErrRecordType struct {
	Message      string
	ExpectedType int
}

ErrRecordType is the error given when the field does not have the right record type

func NewErrRecordType added in v0.6.0

func NewErrRecordType(expectedType int) ErrRecordType

NewErrRecordType creates a new error of the ErrRecordType type

func (ErrRecordType) Error added in v0.6.0

func (e ErrRecordType) Error() string

type ErrUnknownRecordType added in v0.6.0

type ErrUnknownRecordType struct {
	Message string
	Type    string
}

ErrUnknownRecordType is the error given when a record does not have a known type

func NewErrUnknownRecordType added in v0.6.0

func NewErrUnknownRecordType(recordType string) ErrUnknownRecordType

NewErrUnknownRecordType creates a new error of the ErrUnknownRecordType type

func (ErrUnknownRecordType) Error added in v0.6.0

func (e ErrUnknownRecordType) Error() string

type ErrValidCheckDigit added in v0.6.0

type ErrValidCheckDigit struct {
	Message              string
	CalculatedCheckDigit int
}

ErrValidCheckDigit is the error given when the observed check digit does not match the calculated one

func NewErrValidCheckDigit added in v0.6.0

func NewErrValidCheckDigit(digit int) ErrValidCheckDigit

NewErrValidCheckDigit creates a new error of the ErrValidCheckDigit type

func (ErrValidCheckDigit) Error added in v0.6.0

func (e ErrValidCheckDigit) Error() string

type ErrValidFieldLength added in v0.6.0

type ErrValidFieldLength struct {
	Message        string
	ExpectedLength int
}

ErrValidFieldLength is the error given when the field does not have the correct length

func NewErrValidFieldLength added in v0.6.0

func NewErrValidFieldLength(expectedLength int) ErrValidFieldLength

NewErrValidFieldLength creates a new error of the ErrValidFieldLength type

func (ErrValidFieldLength) Error added in v0.6.0

func (e ErrValidFieldLength) Error() string

type FieldError

type FieldError struct {
	FieldName string      // field name where error happened
	Value     interface{} // value that cause error
	Err       error       // context of the error.
	Msg       string      // deprecated
}

FieldError is returned for errors at a field level in a record

func (*FieldError) Error

func (e *FieldError) Error() string

Error message is constructed FieldName Msg Value Example1: BatchCount $% has none alphanumeric characters Example2: BatchCount 5 is out-of-balance with file count 6

func (*FieldError) Unwrap added in v0.6.0

func (e *FieldError) Unwrap() error

Unwrap implements the base.UnwrappableError interface for FieldError

type File

type File struct {
	// ID is an identifier only used by the moov-io/ach HTTP server as a way to identify a file.
	ID string `json:"id"`

	Header     FileHeader     `json:"fileHeader"`
	Batches    []Batcher      `json:"batches"`
	IATBatches []IATBatch     `json:"IATBatches"`
	Control    FileControl    `json:"fileControl"`
	ADVControl ADVFileControl `json:"fileADVControl"`

	// NotificationOfChange (Notification of change) is a slice of references to BatchCOR in file.Batches
	NotificationOfChange []Batcher `json:"NotificationOfChange"`

	// ReturnEntries is a slice of references to file.Batches that contain return entries
	ReturnEntries []Batcher `json:"ReturnEntries"`
	// contains filtered or unexported fields
}

File contains the structures of a parsed ACH File.

func FileFromJSON added in v0.5.0

func FileFromJSON(bs []byte) (*File, error)

FileFromJSON attempts to return a *File object assuming the input is valid JSON.

Callers should always check for a nil-error before using the returned file.

The File returned may not be valid and an error may be returned from validation. Invalid files may be rejected by Financial Institutions or ACH tools.

Date and Time fields in formats: RFC 3339 and ISO 8601 will be parsed and rewritten as their YYMMDD (year, month, day) or hhmm (hour, minute) formats.

func FileFromJSONWith added in v1.10.0

func FileFromJSONWith(bs []byte, opts *ValidateOpts) (*File, error)

FileFromJSONWith attempts to return a *File object assuming the input is valid JSON.

It allows custom validation overrides, so the file may not be Nacha compliant after parsing. Invalid files may be rejected by Financial Institutions or ACH tools.

Callers should always check for a nil-error before using the returned file.

Date and Time fields in formats: RFC 3339 and ISO 8601 will be parsed and rewritten as their YYMMDD (year, month, day) or hhmm (hour, minute) formats.

func Flatten added in v1.29.0

func Flatten(originalFile *File) (*File, error)

Flatten returns a flattened version of a File, where batches with similar batch headers are consolidated.

Two batches are eligible to be combined if:

  • their headers match, excluding the batch number (which isn't used in return matching and reflects the final composition of the file.)
  • they don't contain any entries with common trace numbers, since trace numbers must be unique within a batch.

func MergeDir added in v1.37.0

func MergeDir(dir string, conditions Conditions, opts *MergeDirOptions) ([]*File, error)

MergeDir will consolidate a directory of ACH files into as few files as possible. This is useful for optimizing cost and network utilization.

This operation will override batch numbers in each file to ensure they do not collide. The ascending batch numbers will start at 1.

Entries with duplicate TraceNumbers are allowed in the same file, but must be in separate batches and are automatically separated.

ADV and IAT Batches and Entries are currently not merged together.

MergeDir is typically more performant than MergeFiles as it reads files concurrently while merging occurs. This has a more stable cpu and memory usage trend over reading all files into memory and then calling MergeFiles.

File Batches can only be merged if they are unique and routed to and from the same ABA routing numbers.

func MergeFiles added in v1.1.0

func MergeFiles(files []*File) ([]*File, error)

MergeFiles is a helper function for consolidating an array of ACH Files into as few files as possible. This is useful for optimizing cost and network utilization.

This operation will override batch numbers in each file to ensure they do not collide. The ascending batch numbers will start at 1.

Entries with duplicate TraceNumbers are allowed in the same file, but must be in separate batches and are automatically separated.

ADV and IAT Batches and Entries are currently not merged together.

Old rules limit files to 10,000 lines (when rendered in their ASCII encoding), which is the default for this function. Use MergeFilesWith for a higher limit.

File Batches can only be merged if they are unique and routed to and from the same ABA routing numbers.

func MergeFilesWith added in v1.15.0

func MergeFilesWith(incoming []*File, conditions Conditions) ([]*File, error)

MergeFilesWith is a function for consolidating an array of ACH Files into a few files as possible. This is useful for optimizing cost and network utilization.

This operation will override batch numbers in each file to ensure they do not collide. The ascending batch numbers will start at 1.

Entries with duplicate TraceNumbers are allowed in the same file, but must be in separate batches and are automatically separated.

ADV and IAT Batches and Entries are currently not merged together.

Conditions allows for capping the maximum line length or dollar amount of merged files.

File Batches can only be merged if they are unique and routed to and from the same ABA routing numbers.

func NewFile

func NewFile() *File

NewFile constructs a file template.

func ReadDir added in v1.3.0

func ReadDir(dir string) ([]*File, error)

ReadDir will attempt to parse all ACH files in the given directory. Only files which parse successfully will be returned.

func ReadFile added in v1.4.0

func ReadFile(path string) (*File, error)

ReadFile attempts to open a file at path and read the contents before closing and returning the parsed ACH File.

func ReadFiles added in v1.9.0

func ReadFiles(paths []string) ([]*File, error)

ReadFiles attempts to open files at the given paths and read the contents of each before closing and returning the parsed ACH Files.

func ReadJSONFile added in v1.22.0

func ReadJSONFile(path string) (*File, error)

ReadJSONFile will consume the specified filepath and parse the contents as a JSON formatted ACH file.

func ReadJSONFileWith added in v1.22.0

func ReadJSONFileWith(path string, opts *ValidateOpts) (*File, error)

ReadJSONFileWith will consume the specified filepath and parse the contents as a JSON formatted ACH file with custom ValidateOpts.

func (*File) AddBatch

func (f *File) AddBatch(batch Batcher) []Batcher

AddBatch appends a Batch to the ach.File

func (*File) AddIATBatch added in v0.3.0

func (f *File) AddIATBatch(iatBatch IATBatch) []IATBatch

AddIATBatch appends a IATBatch to the ach.File

func (*File) Create

func (f *File) Create() error

Create will modify the File to tabulate and assemble it into a valid state. This includes setting any posting dates, sequence numbers, counts, and sums.

Create requires a FileHeader and at least one Batch if validateOpts.AllowZeroBatches is false.

Since each Batch may modify computable fields in the File, any calls to Batch.Create should be done before Create.

To check if the File is Nacha compliant, call Validate or ValidateWith.

func (*File) FlattenBatches added in v1.2.0

func (f *File) FlattenBatches() (*File, error)

FlattenBatches flattens the file's batches by consolidating batches with the same BatchHeader data into one Batch. Entries within each flattened batch will be sorted by their TraceNumber field.

func (*File) GetValidation added in v1.13.0

func (f *File) GetValidation() *ValidateOpts

func (*File) IsADV added in v0.5.0

func (f *File) IsADV() bool

IsADV determines if the File is a File containing ADV batches

func (*File) MarshalJSON added in v1.13.0

func (f *File) MarshalJSON() ([]byte, error)

MarshalJSON will produce a JSON blob with the ACH file's fields and validation settings.

func (*File) RemoveBatch added in v1.1.0

func (f *File) RemoveBatch(batch Batcher)

RemoveBatch will delete a given Batcher from an ach.File

func (*File) Reversal added in v1.22.0

func (f *File) Reversal(effectiveEntryDate time.Time) error

Reversal will transform a File into a Nacha compliant reversal which can be transmitted to undo fund movement.

func (*File) SegmentFile added in v1.1.0

func (f *File) SegmentFile(_ *SegmentFileConfiguration) (*File, *File, error)

SegmentFile takes a valid ACH File and returns 2 segmented ACH Files, one ACH File containing credit entries and one ACH File containing debit entries. The return is 2 Files a Credit File and Debit File, or an error.

Callers should always check for a nil-error before using the returned file.

The File returned may not be valid and callers should confirm with Validate. Invalid files may be rejected by other Financial Institutions or ACH tools.

func (*File) SetHeader

func (f *File) SetHeader(h FileHeader) *File

SetHeader allows for header to be built.

func (*File) SetValidation added in v1.4.0

func (f *File) SetValidation(opts *ValidateOpts)

SetValidation stores ValidateOpts on the File which are to be used to override the default NACHA validation rules.

func (*File) UnmarshalJSON added in v0.4.0

func (f *File) UnmarshalJSON(p []byte) error

UnmarshalJSON parses a JSON blob with ach.FileFromJSON

func (*File) Validate

func (f *File) Validate() error

Validate performs checks on each record according to Nacha guidelines. Validate will never modify the File.

ValidateOpts may be set to bypass certain rules and will only be applied to the FileHeader. The underlying Batches and Entries on this File will use their own ValidateOpts if they are set.

The first error encountered is returned.

func (*File) ValidateWith added in v1.4.0

func (f *File) ValidateWith(opts *ValidateOpts) error

ValidateWith performs checks on each record according to Nacha guidelines. ValidateWith will never modify the File.

ValidateOpts may be set to bypass certain rules and will only be applied to the FileHeader. opts passed in will override ValidateOpts set by SetValidation. The underlying Batches and Entries on this File will use their own ValidateOpts if they are set.

The first error encountered is returned.

type FileAcceptance added in v1.37.0

type FileAcceptance string
const (
	AcceptFile   FileAcceptance = "accept"
	AcceptAsJSON FileAcceptance = "json"
	SkipFile     FileAcceptance = "skip"
)

func DefaultFileAcceptor added in v1.37.0

func DefaultFileAcceptor(path string) FileAcceptance

DefaultFileAcceptor is the default logic for which file extensions to merge and how to read them.

Nacha Format: "" (blank), .ach, and .txt
 JSON Format: ".json"

Files with extensions that do not match are skipped.

type FileControl

type FileControl struct {
	// ID is an identifier only used by the moov-io/ach HTTP server as a way to identify a batch.
	ID string `json:"id"`
	// BatchCount total number of batches (i.e., '5' records) in the file
	BatchCount int `json:"batchCount"`
	// BlockCount total number of records in the file (include all headers and trailer) divided
	// by 10 (This number must be evenly divisible by 10. If not, additional records consisting of all 9's are added to the file after the initial '9' record to fill out the block 10.)
	BlockCount int `json:"blockCount"`
	// EntryAddendaCount is a tally of each Entry Detail Record and each Addenda
	// Record processed, within either the batch or file as appropriate.
	EntryAddendaCount int `json:"entryAddendaCount"`
	// EntryHash calculated in the same manner as the batch has total but includes total from entire file
	EntryHash int `json:"entryHash"`
	// TotalDebitEntryDollarAmountInFile contains accumulated Batch debit totals within the file.
	TotalDebitEntryDollarAmountInFile int `json:"totalDebit"`
	// TotalCreditEntryDollarAmountInFile contains accumulated Batch credit totals within the file.
	TotalCreditEntryDollarAmountInFile int `json:"totalCredit"`
	// contains filtered or unexported fields
}

FileControl record contains entry counts, dollar totals and hash totals accumulated from each batch control record in the file.

func NewFileControl

func NewFileControl() FileControl

NewFileControl returns a new FileControl with default values for none exported fields

func (*FileControl) BatchCountField

func (fc *FileControl) BatchCountField() string

BatchCountField gets a string of the batch count zero padded

func (*FileControl) BlockCountField

func (fc *FileControl) BlockCountField() string

BlockCountField gets a string of the block count zero padded

func (*FileControl) CalculateCheckDigit

func (v *FileControl) CalculateCheckDigit(routingNumber string) int

func (*FileControl) EntryAddendaCountField

func (fc *FileControl) EntryAddendaCountField() string

EntryAddendaCountField gets a string of entry addenda batch count zero padded

func (*FileControl) EntryHashField

func (fc *FileControl) EntryHashField() string

EntryHashField gets a string of entry hash zero padded

func (*FileControl) Parse

func (fc *FileControl) Parse(record string)

Parse takes the input record string and parses the FileControl values

Parse provides no guarantee about all fields being filled in. Callers should make a Validate call to confirm successful parsing and data validity.

func (*FileControl) String

func (fc *FileControl) String() string

String writes the FileControl struct to a 94 character string.

func (*FileControl) TotalCreditEntryDollarAmountInFileField

func (fc *FileControl) TotalCreditEntryDollarAmountInFileField() string

TotalCreditEntryDollarAmountInFileField get a zero padded Total credit Entry Amount

func (*FileControl) TotalDebitEntryDollarAmountInFileField

func (fc *FileControl) TotalDebitEntryDollarAmountInFileField() string

TotalDebitEntryDollarAmountInFileField get a zero padded Total debit Entry Amount

func (*FileControl) Validate

func (fc *FileControl) Validate() error

Validate performs NACHA format rule checks on the record and returns an error if not Validated The first error encountered is returned and stops that parsing.

type FileError

type FileError struct {
	FieldName string
	Value     string
	Msg       string
}

FileError is an error describing issues validating a file

func (FileError) Error

func (e FileError) Error() string

type FileHeader

type FileHeader struct {
	// ID is an identifier only used by the moov-io/ach HTTP server as a way to identify a batch.
	ID string `json:"id"`

	// ImmediateDestination contains the Routing Number of the ACH Operator or receiving
	// point to which the file is being sent. The ach file format specifies a 10 character
	// field begins with a blank space in the first position, followed by the four digit
	// Federal Reserve Routing Symbol, the four digit ABA Institution Identifier, and the Check
	// Digit (bTTTTAAAAC). ImmediateDestinationField will append the blank space to the
	// routing number.
	ImmediateDestination string `json:"immediateDestination"`

	// ImmediateOrigin contains the Routing Number of the ACH Operator or sending
	// point that is sending the file. The ach file format specifies a 10 character
	// field begins with a blank space in the first position, followed by the four digit
	// Federal Reserve Routing Symbol, the four digit ABA Institution Identifier, and the Check
	// Digit (bTTTTAAAAC). ImmediateOriginField will append the blank space to the
	// routing number.
	ImmediateOrigin string `json:"immediateOrigin"`

	// FileCreationDate is the date on which the file is prepared by an ODFI (ACH input files)
	// or the date (exchange date) on which a file is transmitted from ACH Operator
	// to ACH Operator, or from ACH Operator to RDFIs (ACH output files).
	//
	// The format is: YYMMDD. Y=Year, M=Month, D=Day
	FileCreationDate string `json:"fileCreationDate"`

	// FileCreationTime is the system time when the ACH file was created.
	//
	// The format is: HHmm. H=Hour, m=Minute
	FileCreationTime string `json:"fileCreationTime"`

	// This field should start at zero and increment by 1 (up to 9) and then go to
	// letters starting at A through Z for each subsequent file that is created for
	// a single system date. (34-34) 1 numeric 0-9 or uppercase alpha A-Z.
	// I have yet to see this ID not A
	FileIDModifier string `json:"fileIDModifier,omitempty"`

	// ImmediateDestinationName us the name of the ACH or receiving point for which that
	// file is destined. Name corresponding to the ImmediateDestination
	ImmediateDestinationName string `json:"immediateDestinationName"`

	// ImmediateOriginName is the name of the ACH operator or sending point that is
	// sending the file. Name corresponding to the ImmediateOrigin
	ImmediateOriginName string `json:"immediateOriginName"`

	// ReferenceCode is reserved for information pertinent to the Originator.
	ReferenceCode string `json:"referenceCode,omitempty"`
	// contains filtered or unexported fields
}

FileHeader is a Record designating physical file characteristics and identify the origin (sending point) and destination (receiving point) of the entries contained in the file. The file header also includes creation date and time fields which can be used to uniquely identify a file.

func NewFileHeader

func NewFileHeader() FileHeader

NewFileHeader returns a new FileHeader with default values for none exported fields

func (*FileHeader) CalculateCheckDigit

func (v *FileHeader) CalculateCheckDigit(routingNumber string) int

func (*FileHeader) FileCreationDateField

func (fh *FileHeader) FileCreationDateField() string

FileCreationDateField gets the file creation date in YYMMDD (year, month, day) format A blank string is returned when an error occurred while parsing the timestamp. ISO 8601 is the only other format supported.

func (*FileHeader) FileCreationTimeField

func (fh *FileHeader) FileCreationTimeField() string

FileCreationTimeField gets the file creation time in HHmm (hour, minute) format A blank string is returned when an error occurred while parsing the timestamp. ISO 8601 is the only other format supported.

func (*FileHeader) ImmediateDestinationField

func (fh *FileHeader) ImmediateDestinationField() string

ImmediateDestinationField gets the immediate destination number with zero padding

func (*FileHeader) ImmediateDestinationNameField

func (fh *FileHeader) ImmediateDestinationNameField() string

ImmediateDestinationNameField gets the ImmediateDestinationName field padded

func (*FileHeader) ImmediateOriginField

func (fh *FileHeader) ImmediateOriginField() string

ImmediateOriginField gets the immediate origin number with 0 padding

func (*FileHeader) ImmediateOriginNameField

func (fh *FileHeader) ImmediateOriginNameField() string

ImmediateOriginNameField gets the ImmImmediateOriginName field padded

func (*FileHeader) Parse

func (fh *FileHeader) Parse(record string)

Parse takes the input record string and parses the FileHeader values

Parse provides no guarantee about all fields being filled in. Callers should make a Validate call to confirm successful parsing and data validity.

func (*FileHeader) ReferenceCodeField

func (fh *FileHeader) ReferenceCodeField() string

ReferenceCodeField gets the ReferenceCode field padded

func (*FileHeader) SetValidation added in v1.4.0

func (fh *FileHeader) SetValidation(opts *ValidateOpts)

SetValidation stores ValidateOpts on the FileHeader which are to be used to override the default NACHA validation rules.

func (*FileHeader) String

func (fh *FileHeader) String() string

String writes the FileHeader struct to a 94 character string.

func (*FileHeader) Validate

func (fh *FileHeader) Validate() error

Validate performs NACHA format rule checks on the record and returns an error if not Validated The first error encountered is returned and stops the parsing.

func (*FileHeader) ValidateWith added in v1.4.0

func (fh *FileHeader) ValidateWith(opts *ValidateOpts) error

ValidateWith performs NACHA format rule checks on each record according to their specification overlayed with any custom flags. The first error encountered is returned and stops the parsing.

type IATBatch added in v0.3.0

type IATBatch struct {
	// ID is an identifier only used by the moov-io/ach HTTP server as a way to identify a batch.
	ID      string            `json:"id"`
	Header  *IATBatchHeader   `json:"IATBatchHeader"`
	Entries []*IATEntryDetail `json:"IATEntryDetails"`
	Control *BatchControl     `json:"batchControl"`
	// contains filtered or unexported fields
}

IATBatch holds the Batch Header and Batch Control and all Entry Records for an IAT batch

An IAT entry is a credit or debit ACH entry that is part of a payment transaction involving a financial agency's office (i.e., depository financial institution or business issuing money orders) that is not located in the territorial jurisdiction of the United States. IAT entries can be made to or from a corporate or consumer account and must be accompanied by seven (7) mandatory addenda records identifying the name and physical address of the Originator, name and physical address of the Receiver, Receiver's account number, Receiver's bank identity and reason for the payment.

func NewIATBatch added in v0.3.0

func NewIATBatch(bh *IATBatchHeader) IATBatch

NewIATBatch takes a BatchHeader and returns a matching SEC code batch type that is a batcher. Returns an error if the SEC code is not supported.

func (*IATBatch) AddEntry added in v0.3.0

func (iatBatch *IATBatch) AddEntry(entry *IATEntryDetail)

AddEntry appends an EntryDetail to the Batch

func (*IATBatch) Category added in v0.3.0

func (iatBatch *IATBatch) Category() string

Category returns IATBatch Category

func (*IATBatch) Create added in v0.3.0

func (iatBatch *IATBatch) Create() error

Create will tabulate and assemble an ACH batch into a valid state. This includes setting any posting dates, sequence numbers, counts, and sums.

Create implementations are free to modify computable fields in a file and should call the Batch's Validate function at the end of their execution.

func (*IATBatch) Error added in v0.6.0

func (iatBatch *IATBatch) Error(field string, err error, values ...interface{}) error

error returns a new BatchError based on err

func (*IATBatch) GetControl added in v0.3.0

func (iatBatch *IATBatch) GetControl() *BatchControl

GetControl returns the current Batch Control

func (*IATBatch) GetEntries added in v0.3.0

func (iatBatch *IATBatch) GetEntries() []*IATEntryDetail

GetEntries returns a slice of entry details for the batch

func (*IATBatch) GetHeader added in v0.3.0

func (iatBatch *IATBatch) GetHeader() *IATBatchHeader

GetHeader returns the current Batch header

func (*IATBatch) SetControl added in v0.3.0

func (iatBatch *IATBatch) SetControl(batchControl *BatchControl)

SetControl appends an BatchControl to the Batch

func (*IATBatch) SetHeader added in v0.3.0

func (iatBatch *IATBatch) SetHeader(batchHeader *IATBatchHeader)

SetHeader appends an BatchHeader to the Batch

func (*IATBatch) SetValidation added in v1.20.0

func (iatBatch *IATBatch) SetValidation(opts *ValidateOpts)

SetValidation stores ValidateOpts on the Batch which are to be used to override the default NACHA validation rules.

func (*IATBatch) UnmarshalJSON added in v0.6.0

func (iatBatch *IATBatch) UnmarshalJSON(p []byte) error

UnmarshalJSON un-marshals JSON IATBatch

func (*IATBatch) Validate added in v0.3.0

func (iatBatch *IATBatch) Validate() error

Validate checks properties of the ACH batch to ensure they match NACHA guidelines. This includes computing checksums, totals, and sequence orderings.

Validate will never modify the iatBatch.

type IATBatchHeader added in v0.3.0

type IATBatchHeader struct {
	// ID is an identifier only used by the moov-io/ach HTTP server as a way to identify a batch.
	ID string `json:"id"`

	// ServiceClassCode ACH Mixed Debits and Credits '200'
	// ACH Credits Only '220'
	// ACH Debits Only '225'
	ServiceClassCode int `json:"serviceClassCode"`

	// IATIndicator - Leave Blank - It is only used for corrected IAT entries
	IATIndicator string `json:"IATIndicator,omitempty"`

	// ForeignExchangeIndicator is a code indicating currency conversion
	//
	// FV Fixed-to-Variable – Entry is originated in a fixed-value amount
	// and is to be received in a variable amount resulting from the
	// execution of the foreign exchange conversion.
	//
	// VF Variable-to-Fixed – Entry is originated in a variable-value
	// amount based on a specific foreign exchange rate for conversion to a
	// fixed-value amount in which the entry is to be received.
	//
	// FF Fixed-to-Fixed – Entry is originated in a fixed-value amount and
	// is to be received in the same fixed-value amount in the same
	// currency denomination. There is no foreign exchange conversion for
	// entries transmitted using this code. For entries originated in a fixed value
	// amount, the foreign Exchange Reference Field will be space
	// filled.
	ForeignExchangeIndicator string `json:"foreignExchangeIndicator"`

	// ForeignExchangeReferenceIndicator is a code used to indicate the content of the
	// Foreign Exchange Reference Field and is filled by the gateway operator.
	// Valid entries are:
	// 1 - Foreign Exchange Rate;
	// 2 - Foreign Exchange Reference Number; or
	// 3 - Space Filled
	ForeignExchangeReferenceIndicator int `json:"foreignExchangeReferenceIndicator"`

	// ForeignExchangeReference  Contains either the foreign exchange rate used to execute
	// the foreign exchange conversion of a cross-border entry or another reference to the foreign
	// exchange transaction.
	ForeignExchangeReference string `json:"foreignExchangeReference"`

	// ISODestinationCountryCode is the two-character code, as approved by the International
	// Organization for Standardization (ISO), to identify the country in which the entry is
	// to be received. Values can be found on the International Organization for Standardization
	// website: www.iso.org.  For entries destined to account holder in the U.S., this would be US.
	ISODestinationCountryCode string `json:"ISODestinationCountryCode"`

	// OriginatorIdentification identifies the following:
	// For U.S. entities: the number assigned will be your tax ID
	// For non-U.S. entities: the number assigned will be your DDA number,
	// or the last 9 characters of your account number if it exceeds 9 characters
	OriginatorIdentification string `json:"originatorIdentification"`

	// StandardEntryClassCode for consumer and non consumer international payments is IAT
	// Identifies the payment type (product) found within an ACH batch-using a 3-character code.
	// The SEC Code pertains to all items within batch.
	// Determines format of the detail records.
	// Determines addenda records (required or optional PLUS one or up to 9,999 records).
	// Determines rules to follow (return time frames).
	// Some SEC codes require specific data in predetermined fields within the ACH record
	StandardEntryClassCode string `json:"standardEntryClassCode"`

	// CompanyEntryDescription A description of the entries contained in the batch
	//
	//The Originator establishes the value of this field to provide a
	// description of the purpose of the entry to be displayed back to
	// the receive For example, "GAS BILL," "REG. SALARY," "INS. PREM,"
	// "SOC. SEC.," "DTC," "TRADE PAY," "PURCHASE," etc.
	//
	// This field must contain the word "REVERSAL" (left justified) when the
	// batch contains reversing entries.
	//
	// This field must contain the word "RECLAIM" (left justified) when the
	// batch contains reclamation entries.
	//
	// This field must contain the word "NONSETTLED" (left justified) when the
	// batch contains entries which could not settle.
	CompanyEntryDescription string `json:"companyEntryDescription,omitempty"`

	// ISOOriginatingCurrencyCode is the three-character code, as approved by the International
	// Organization for Standardization (ISO), to identify the currency denomination in which the
	// entry was first originated. If the source of funds is within the territorial jurisdiction
	// of the U.S., enter 'USD', otherwise refer to International Organization for Standardization
	// website for value: www.iso.org -- (Account Currency)
	ISOOriginatingCurrencyCode string `json:"ISOOriginatingCurrencyCode"`

	// ISODestinationCurrencyCode is the three-character code, as approved by the International
	// Organization for Standardization (ISO), to identify the currency denomination in which the
	// entry will ultimately be settled. If the final destination of funds is within the territorial
	// jurisdiction of the U.S., enter “USD”, otherwise refer to International Organization for
	// Standardization website for value: www.iso.org -- (Payment Currency)
	ISODestinationCurrencyCode string `json:"ISODestinationCurrencyCode"`

	// EffectiveEntryDate the date on which the entries are to settle. Format: YYMMDD (Y=Year, M=Month, D=Day)
	EffectiveEntryDate string `json:"effectiveEntryDate,omitempty"`

	// SettlementDate Leave blank, this field is inserted by the ACH operator
	SettlementDate string `json:"settlementDate,omitempty"`

	// OriginatorStatusCode refers to the ODFI initiating the Entry.
	// 0 ADV File prepared by an ACH Operator.
	// 1 This code identifies the Originator as a depository financial institution.
	// 2 This code identifies the Originator as a Federal Government entity or agency.
	OriginatorStatusCode int `json:"originatorStatusCode,omitempty"`

	// ODFIIdentification First 8 digits of the originating DFI transit routing number
	// For Inbound IAT Entries, this field contains the routing number of the U.S. Gateway
	// Operator.  For Outbound IAT Entries, this field contains the standard routing number,
	// as assigned by Accuity, that identifies the U.S. ODFI initiating the Entry.
	// Format - TTTTAAAA
	ODFIIdentification string `json:"ODFIIdentification"`

	// BatchNumber is assigned in ascending sequence to each batch by the ODFI
	// or its Sending Point in a given file of entries. Since the batch number
	// in the Batch Header Record and the Batch Control Record is the same,
	// the ascending sequence number should be assigned by batch and not by
	// record.
	BatchNumber int `json:"batchNumber"`
	// contains filtered or unexported fields
}

IATBatchHeader identifies the originating entity and the type of transactions contained in the batch for SEC Code IAT. This record also contains the effective date, or desired settlement date, for all entries contained in this batch. The settlement date field is not entered as it is determined by the ACH operator.

An IAT entry is a credit or debit ACH entry that is part of a payment transaction involving a financial agency's office (i.e., depository financial institution or business issuing money orders) that is not located in the territorial jurisdiction of the United States. IAT entries can be made to or from a corporate or consumer account and must be accompanied by seven (7) mandatory addenda records identifying the name and physical address of the Originator, name and physical address of the Receiver, Receiver's account number, Receiver's bank identity and reason for the payment.

func NewIATBatchHeader added in v0.3.0

func NewIATBatchHeader() *IATBatchHeader

NewIATBatchHeader returns a new BatchHeader with default values for non exported fields

func (*IATBatchHeader) BatchNumberField added in v0.3.0

func (iatBh *IATBatchHeader) BatchNumberField() string

BatchNumberField get the batch number zero padded

func (*IATBatchHeader) CalculateCheckDigit added in v0.3.0

func (v *IATBatchHeader) CalculateCheckDigit(routingNumber string) int

func (*IATBatchHeader) CompanyEntryDescriptionField added in v0.3.0

func (iatBh *IATBatchHeader) CompanyEntryDescriptionField() string

CompanyEntryDescriptionField gets the CompanyEntryDescription left padded

func (*IATBatchHeader) EffectiveEntryDateField added in v0.3.0

func (iatBh *IATBatchHeader) EffectiveEntryDateField() string

EffectiveEntryDateField get the EffectiveEntryDate in YYMMDD format

func (*IATBatchHeader) ForeignExchangeIndicatorField added in v0.3.0

func (iatBh *IATBatchHeader) ForeignExchangeIndicatorField() string

ForeignExchangeIndicatorField gets the ForeignExchangeIndicator

func (*IATBatchHeader) ForeignExchangeReferenceField added in v0.3.0

func (iatBh *IATBatchHeader) ForeignExchangeReferenceField() string

ForeignExchangeReferenceField gets the ForeignExchangeReference left padded

func (*IATBatchHeader) ForeignExchangeReferenceIndicatorField added in v0.3.0

func (iatBh *IATBatchHeader) ForeignExchangeReferenceIndicatorField() string

ForeignExchangeReferenceIndicatorField gets the ForeignExchangeReferenceIndicator

func (*IATBatchHeader) IATIndicatorField added in v0.3.0

func (iatBh *IATBatchHeader) IATIndicatorField() string

IATIndicatorField gets the IATIndicator left padded

func (*IATBatchHeader) ISODestinationCountryCodeField added in v0.3.0

func (iatBh *IATBatchHeader) ISODestinationCountryCodeField() string

ISODestinationCountryCodeField gets the ISODestinationCountryCode

func (*IATBatchHeader) ISODestinationCurrencyCodeField added in v0.3.0

func (iatBh *IATBatchHeader) ISODestinationCurrencyCodeField() string

ISODestinationCurrencyCodeField gets the ISODestinationCurrencyCode

func (*IATBatchHeader) ISOOriginatingCurrencyCodeField added in v0.3.0

func (iatBh *IATBatchHeader) ISOOriginatingCurrencyCodeField() string

ISOOriginatingCurrencyCodeField gets the ISOOriginatingCurrencyCode

func (*IATBatchHeader) ODFIIdentificationField added in v0.3.0

func (iatBh *IATBatchHeader) ODFIIdentificationField() string

ODFIIdentificationField get the odfi number zero padded

func (*IATBatchHeader) OriginatorIdentificationField added in v0.3.0

func (iatBh *IATBatchHeader) OriginatorIdentificationField() string

OriginatorIdentificationField gets the OriginatorIdentification left padded

func (*IATBatchHeader) Parse added in v0.3.0

func (iatBh *IATBatchHeader) Parse(record string)

Parse takes the input record string and parses the BatchHeader values

Parse provides no guarantee about all fields being filled in. Callers should make a Validate call to confirm successful parsing and data validity.

func (*IATBatchHeader) SettlementDateField added in v1.18.0

func (iatBh *IATBatchHeader) SettlementDateField() string

SettlementDateField gets the SettlementDate

func (*IATBatchHeader) String added in v0.3.0

func (iatBh *IATBatchHeader) String() string

String writes the BatchHeader struct to a 94 character string.

func (*IATBatchHeader) Validate added in v0.3.0

func (iatBh *IATBatchHeader) Validate() error

Validate performs NACHA format rule checks on the record and returns an error if not Validated The first error encountered is returned and stops that parsing.

type IATEntryDetail added in v0.3.0

type IATEntryDetail struct {
	// ID is an identifier only used by the moov-io/ach HTTP server as a way to identify a batch.
	ID string `json:"id"`
	// TransactionCode if the receivers account is:
	// Credit (deposit) to checking account '22'
	// Prenote for credit to checking account '23'
	// Debit (withdrawal) to checking account '27'
	// Prenote for debit to checking account '28'
	// Credit to savings account '32'
	// Prenote for credit to savings account '33'
	// Debit to savings account '37'
	// Prenote for debit to savings account '38'
	TransactionCode int `json:"transactionCode"`
	// RDFIIdentification is the RDFI's routing number without the last digit.
	// Receiving Depository Financial Institution
	RDFIIdentification string `json:"RDFIIdentification"`
	// CheckDigit the last digit of the RDFI's routing number
	CheckDigit string `json:"checkDigit"`
	// AddendaRecords is the number of Addenda Records
	AddendaRecords int `json:"addendaRecords"`
	// Amount Number of cents you are debiting/crediting this account
	Amount int `json:"amount"`
	// DFIAccountNumber is the receiver's bank account number you are crediting/debiting.
	// It important to note that this is an alphanumeric field, so its space padded, no zero padded
	DFIAccountNumber string `json:"DFIAccountNumber"`
	// OFACScreeningIndicator - Leave blank
	OFACScreeningIndicator string `json:"OFACScreeningIndicator"`
	// SecondaryOFACScreeningIndicator - Leave blank
	SecondaryOFACScreeningIndicator string `json:"secondaryOFACScreeningIndicator"`
	// AddendaRecordIndicator indicates the existence of an Addenda Record.
	// A value of "1" indicates that one or more addenda records follow,
	// and "0" means no such record is present.
	AddendaRecordIndicator int `json:"addendaRecordIndicator"`
	// TraceNumber is assigned by the ODFI or software vendor and used as part of identification.
	//
	// The format of trace numbers is the first 8 digits of the ODFI's routing number followed by
	// 7 digits chosen by the ODFI or software vendor.
	//
	// Sequentual or random numbers can be chosen. The only requirement of Nacha is unique trace
	// numbers within a batch and file.
	//
	// Trace Numbers are included in each Entry Detail Record, Corporate Entry Detail Record,
	// and addenda Record.
	//
	// In association with the Batch Number, transmission (File Creation) Date,
	// and File ID Modifier, the Trace Number uniquely identifies an entry within a given file.
	//
	// For addenda Records, the Trace Number will be identical to the Trace Number
	// in the associated Entry Detail Record, since the Trace Number is associated
	// with an entry or item rather than a physical record.
	//
	// Use TraceNumberField for a properly formatted string representation.
	TraceNumber string `json:"traceNumber,omitempty"`
	// Addenda10 is mandatory for IAT entries
	//
	// The Addenda10 Record identifies the Receiver of the transaction and the dollar amount of
	// the payment.
	Addenda10 *Addenda10 `json:"addenda10"`
	// Addenda11 is mandatory for IAT entries
	//
	// The Addenda11 record identifies key information related to the Originator of
	// the entry.
	Addenda11 *Addenda11 `json:"addenda11"`
	// Addenda12 is mandatory for IAT entries
	//
	// The Addenda12 record identifies key information related to the Originator of
	// the entry.
	Addenda12 *Addenda12 `json:"addenda12"`
	// Addenda13 is mandatory for IAT entries
	//
	// The Addenda13 contains information related to the financial institution originating the entry.
	// For inbound IAT entries, the Fourth Addenda Record must contain information to identify the
	// foreign financial institution that is providing the funding and payment instruction for
	// the IAT entry.
	Addenda13 *Addenda13 `json:"addenda13"`
	// Addenda14 is mandatory for IAT entries
	//
	// The Addenda14 identifies the Receiving financial institution holding the Receiver's account.
	Addenda14 *Addenda14 `json:"addenda14"`
	// Addenda15 is mandatory for IAT entries
	//
	// The Addenda15 record identifies key information related to the Receiver.
	Addenda15 *Addenda15 `json:"addenda15"`
	// Addenda16 is mandatory for IAt entries
	//
	// Addenda16 record identifies additional key information related to the Receiver.
	Addenda16 *Addenda16 `json:"addenda16"`
	// Addenda17 is optional for IAT entries
	//
	// This is an optional Addenda Record used to provide payment-related data. There i a maximum of up to two of these
	// Addenda Records with each IAT entry.
	Addenda17 []*Addenda17 `json:"addenda17,omitempty"`
	// Addenda18 is optional for IAT entries
	//
	// This optional addenda record is used to provide information on each Foreign Correspondent Bank involved in the
	// processing of the IAT entry. If no Foreign Correspondent Bank is involved,the record should not be included.
	// A maximum of five Addenda18 records may be included with each IAT entry.
	Addenda18 []*Addenda18 `json:"addenda18,omitempty"`
	// Addenda98 for user with NOC
	Addenda98 *Addenda98 `json:"addenda98,omitempty"`
	// Addenda99 for use with Returns
	Addenda99 *Addenda99 `json:"addenda99,omitempty"`
	// Category defines if the entry is a Forward, Return, or NOC
	Category string `json:"category,omitempty"`
	// contains filtered or unexported fields
}

IATEntryDetail contains the actual transaction data for an individual entry. Fields include those designating the entry as a deposit (credit) or withdrawal (debit), the transit routing number for the entry recipient's financial institution, the account number (left justify,no zero fill), name, and dollar amount.

func NewIATEntryDetail added in v0.3.0

func NewIATEntryDetail() *IATEntryDetail

NewIATEntryDetail returns a new IATEntryDetail with default values for non exported fields

func (*IATEntryDetail) AddAddenda17 added in v0.4.0

func (iatEd *IATEntryDetail) AddAddenda17(addenda17 *Addenda17)

AddAddenda17 appends an Addenda17 to the IATEntryDetail

func (*IATEntryDetail) AddAddenda18 added in v0.4.0

func (iatEd *IATEntryDetail) AddAddenda18(addenda18 *Addenda18)

AddAddenda18 appends an Addenda18 to the IATEntryDetail

func (*IATEntryDetail) AddendaRecordsField added in v0.3.0

func (iatEd *IATEntryDetail) AddendaRecordsField() string

AddendaRecordsField returns a zero padded AddendaRecords string

func (*IATEntryDetail) AmountField added in v0.3.0

func (iatEd *IATEntryDetail) AmountField() string

AmountField returns a zero padded string of amount

func (*IATEntryDetail) CalculateCheckDigit added in v0.3.0

func (v *IATEntryDetail) CalculateCheckDigit(routingNumber string) int

func (*IATEntryDetail) DFIAccountNumberField added in v0.3.0

func (iatEd *IATEntryDetail) DFIAccountNumberField() string

DFIAccountNumberField gets the DFIAccountNumber with space padding

func (*IATEntryDetail) OFACScreeningIndicatorField added in v0.6.0

func (iatEd *IATEntryDetail) OFACScreeningIndicatorField() string

OFACScreeningIndicatorField gets the OFACScreeningIndicator

func (*IATEntryDetail) Parse added in v0.3.0

func (iatEd *IATEntryDetail) Parse(record string)

Parse takes the input record string and parses the EntryDetail values

Parse provides no guarantee about all fields being filled in. Callers should make a Validate call to confirm successful parsing and data validity.

func (*IATEntryDetail) RDFIIdentificationField added in v0.3.0

func (iatEd *IATEntryDetail) RDFIIdentificationField() string

RDFIIdentificationField get the rdfiIdentification with zero padding

func (*IATEntryDetail) SecondaryOFACScreeningIndicatorField added in v0.6.0

func (iatEd *IATEntryDetail) SecondaryOFACScreeningIndicatorField() string

SecondaryOFACScreeningIndicatorField gets the SecondaryOFACScreeningIndicator

func (*IATEntryDetail) SetRDFI added in v0.3.0

func (iatEd *IATEntryDetail) SetRDFI(rdfi string) *IATEntryDetail

SetRDFI takes the 9 digit RDFI account number and separates it for RDFIIdentification and CheckDigit

func (*IATEntryDetail) SetTraceNumber added in v0.3.0

func (iatEd *IATEntryDetail) SetTraceNumber(ODFIIdentification string, seq int)

SetTraceNumber takes first 8 digits of ODFI and concatenates a sequence number onto the TraceNumber

func (*IATEntryDetail) SetValidation added in v1.20.0

func (iatEd *IATEntryDetail) SetValidation(opts *ValidateOpts)

SetValidation stores ValidateOpts on the EntryDetail which are to be used to override the default NACHA validation rules.

func (*IATEntryDetail) String added in v0.3.0

func (iatEd *IATEntryDetail) String() string

String writes the EntryDetail struct to a 94 character string.

func (*IATEntryDetail) TraceNumberField added in v0.3.0

func (iatEd *IATEntryDetail) TraceNumberField() string

TraceNumberField returns a zero padded TraceNumber string

func (*IATEntryDetail) Validate added in v0.3.0

func (iatEd *IATEntryDetail) Validate() error

Validate performs NACHA format rule checks on the record and returns an error if not Validated The first error encountered is returned and stops that parsing.

type Iterator added in v1.33.0

type Iterator struct {
	// contains filtered or unexported fields
}

Iterator is a data structure for processing an ACH file one entry at a time.

func NewIterator added in v1.33.0

func NewIterator(r io.Reader) *Iterator

NewIterator returns an Iterator

func (*Iterator) GetControl added in v1.33.0

func (i *Iterator) GetControl() *FileControl

GetControl will return the FileControl once encountered by the iterator. Call NextEntry() at least once to populate the control.

func (*Iterator) GetHeader added in v1.33.0

func (i *Iterator) GetHeader() *FileHeader

GetHeader will return the FileHeader once encountered by the iterator. Call NextEntry() at least once to populate the header.

func (*Iterator) NextEntry added in v1.33.0

func (i *Iterator) NextEntry() (*BatchHeader, *EntryDetail, error)

NextEntry will return the next available EntryDetail record and the BatchHeader the entry belongs to.

IAT entries are not currently supported.

func (*Iterator) SetValidation added in v1.33.0

func (i *Iterator) SetValidation(opts *ValidateOpts)

type MergeDirOptions added in v1.37.0

type MergeDirOptions struct {
	// AcceptFile is a function which determines what to do with the file.
	AcceptFile func(path string) FileAcceptance

	// FS is the fs.FS (filesystem) to read and scan files from.
	// If nil the system's filesystem will be used.
	//
	// This fs.FS should be at a higher directory level than the dir passed into MergeDir.
	FS fs.FS

	// ValidateOptsExtension is a setting to check the filesystem for files containing
	// JSON representations of ValidateOpts for each ACH file encountered.
	// The value should be the file extension for ValidateOpts files.
	ValidateOptsExtension string

	// ParseWorkers is the concurrent number of ACH file reader/parser goroutines
	// Default: 10
	ParseWorkers int

	// SubDirectories is a setting to traverse sub directories for mergable ACH files.
	SubDirectories bool
}

type Merger added in v1.31.0

type Merger interface {
	MergeWith(files []*File, conditions Conditions) ([]*File, error)
}

Merge can merge ACH files with custom ValidateOpts

func NewMerger added in v1.31.0

func NewMerger(opts *ValidateOpts) Merger

NewMerger returns a Merge which can have custom ValidateOpts

type Offset added in v1.1.0

type Offset struct {
	RoutingNumber string            `json:"routingNumber"`
	AccountNumber string            `json:"accountNumber"`
	AccountType   OffsetAccountType `json:"accountType"`
	Description   string            `json:"description"`
}

Offset contains the associated information to append an 'Offset Record' on an ACH batch during Create.

type OffsetAccountType added in v1.1.0

type OffsetAccountType string
const (
	OffsetChecking OffsetAccountType = "checking"
	OffsetSavings  OffsetAccountType = "savings"
)

type Reader

type Reader struct {
	// file is ach.file model being built as r is parsed.
	File File

	// IATCurrentBatch is the current IATBatch entries being parsed
	IATCurrentBatch IATBatch
	// contains filtered or unexported fields
}

Reader reads records from an ACH-encoded file.

func NewReader

func NewReader(r io.Reader) *Reader

NewReader returns a new ACH Reader that reads from r.

func (*Reader) Read

func (r *Reader) Read() (File, error)

Read reads each line in the underlying io.Reader and returns a File and any errors encountered.

Read enforces ACH formatting rules and the first character of each line determines which parser is used.

The returned File may not be valid. Callers should tabulate the File with File.Create followed by File.Validate to ensure it is Nacha compliant.

Invalid files may be rejected by other financial institutions or ACH tools.

func (*Reader) SetMaxLines added in v1.24.0

func (r *Reader) SetMaxLines(max int)

func (*Reader) SetValidation added in v1.4.0

func (r *Reader) SetValidation(opts *ValidateOpts)

SetValidation stores ValidateOpts on the Reader's underlying File which are to be used to override the default NACHA validation rules.

type RecordWrongLengthErr added in v0.6.0

type RecordWrongLengthErr struct {
	Message string
	Length  int
}

RecordWrongLengthErr is the error given when a record is the wrong length

func NewRecordWrongLengthErr added in v0.6.0

func NewRecordWrongLengthErr(length int) RecordWrongLengthErr

NewRecordWrongLengthErr creates a new error of the RecordWrongLengthErr type

func (RecordWrongLengthErr) Error added in v0.6.0

func (e RecordWrongLengthErr) Error() string

type ReturnCode added in v1.1.0

type ReturnCode struct {
	Code        string `json:"code"`
	Reason      string `json:"reason"`
	Description string `json:"description"`
}

ReturnCode holds a return Code, Reason/Title, and Description

Table of return codes exists in Part 4.2 of the NACHA corporate rules and guidelines

func LookupReturnCode added in v1.2.0

func LookupReturnCode(code string) *ReturnCode

LookupReturnCode will return a struct representing the reason and description for the provided NACHA return code.

type SegmentFileConfiguration added in v1.1.0

type SegmentFileConfiguration struct{}

SegmentFileConfiguration contains configuration setting for sorting during Segment File Creation.

It is currently not defined, but can/will be expanded later and File.SegmentFile enhanced to use the configuration settings

func NewSegmentFileConfiguration added in v1.1.0

func NewSegmentFileConfiguration() *SegmentFileConfiguration

SegmentFileConfiguration returns a new SegmentFileConfiguration with default values for non exported fields

type ValidateOpts added in v1.4.0

type ValidateOpts struct {
	// SkipAll will disable all validation checks of a File. It has no effect when set on records.
	SkipAll bool `json:"skipAll"`

	// RequireABAOrigin can be set to enable routing number validation
	// over the ImmediateOrigin file header field.
	RequireABAOrigin bool `json:"requireABAOrigin"`

	// BypassOriginValidation can be set to skip validation for the
	// ImmediateOrigin file header field.
	//
	// This also allows for custom TraceNumbers which aren't prefixed with
	// a routing number as required by the NACHA specification.
	BypassOriginValidation bool `json:"bypassOriginValidation"`

	// BypassDestinationValidation can be set to skip validation for the
	// ImmediateDestination file header field.
	//
	// This also allows for custom TraceNumbers which aren't prefixed with
	// a routing number as required by the NACHA specification.
	BypassDestinationValidation bool `json:"bypassDestinationValidation"`

	// CheckTransactionCode allows for custom validation of TransactionCode values
	//
	// Note: Functions cannot be serialized into/from JSON, so this check cannot be used from config files.
	CheckTransactionCode func(code int) error `json:"-"`

	// CustomTraceNumbers disables Nacha specified checks of TraceNumbers:
	// - Ascending order of trace numbers within batches
	// - Trace numbers beginning with their ODFI's routing number
	// - AddendaRecordIndicator is set correctly
	CustomTraceNumbers bool `json:"customTraceNumbers"`

	// AllowZeroBatches allows the file to have zero batches
	AllowZeroBatches bool `json:"allowZeroBatches"`

	// AllowMissingFileHeader allows a file to be read without a FileHeader record.
	AllowMissingFileHeader bool `json:"allowMissingFileHeader"`

	// AllowMissingFileControl allows a file to be read without a FileControl record.
	AllowMissingFileControl bool `json:"allowMissingFileControl"`

	// BypassCompanyIdentificationMatch allows batches in which the Company Identification field
	// in the batch header and control do not match.
	BypassCompanyIdentificationMatch bool `json:"bypassCompanyIdentificationMatch"`

	// CustomReturnCodes can be set to skip validation for the Return Code field in an Addenda99
	// This allows for non-standard/deprecated return codes (e.g. R97)
	CustomReturnCodes bool `json:"customReturnCodes"`

	// UnequalServiceClassCode skips equality checks for the ServiceClassCode in each pair of BatchHeader
	// and BatchControl records.
	UnequalServiceClassCode bool `json:"unequalServiceClassCode"`

	// AllowUnorderedBatchNumebrs allows a file to be read with unordered batch numbers.
	AllowUnorderedBatchNumbers bool `json:"allowUnorderedBatchNumbers"`

	// AllowInvalidCheckDigit allows the CheckDigit field in EntryDetail to differ from
	// the expected calculation
	AllowInvalidCheckDigit bool `json:"allowInvalidCheckDigit"`

	// UnequalAddendaCounts skips checking that Addenda Count fields match their expected and computed values.
	UnequalAddendaCounts bool `json:"unequalAddendaCounts"`

	// PreserveSpaces keeps the spacing before and after values that normally have spaces trimmed during parsing.
	PreserveSpaces bool `json:"preserveSpaces"`

	// AllowInvalidAmounts will skip verifying the Amount is valid for the TransactionCode and entry type.
	AllowInvalidAmounts bool `json:"allowInvalidAmounts"`

	// AllowZeroEntryAmount will skip enforcing the entry Amount to be non-zero
	AllowZeroEntryAmount bool `json:"allowZeroEntryAmount"`
}

ValidateOpts contains specific overrides from the default set of validations performed on a NACHA file, records and various fields within.

type WriteOpts added in v1.40.0

type WriteOpts struct {
	// LineEnding sets a custom line ending character.
	LineEnding string `json:"lineEnding"`
}

WriteOpts defines options for writing a file.

type Writer

type Writer struct {
	LineEnding string // configurable line ending to support different consumer requirements
	// BypassValidation can be set to skip file validation and will allow non-compliant Nacha files to be written.
	BypassValidation bool
	// contains filtered or unexported fields
}

Writer writes a File to an io.Writer. The File is validated against Nacha guidelines unless BypassValidation is enabled.

func NewWriter

func NewWriter(w io.Writer) *Writer

NewWriter returns a new Writer that writes to w.

func NewWriterWithOpts added in v1.40.0

func NewWriterWithOpts(w io.Writer, opts *WriteOpts) *Writer

NewWriter returns a new Writer that writes to w.

func (*Writer) Flush

func (w *Writer) Flush() error

Flush writes any buffered data to the underlying io.Writer.

func (*Writer) Write

func (w *Writer) Write(file *File) error

Writer writes a single ach.file record to w

Directories

Path Synopsis
cmd
docs
http
Package main is an example for creating an Automated Clearing House (ACH) file with Moov's HTTP service.
Package main is an example for creating an Automated Clearing House (ACH) file with Moov's HTTP service.
micro-entries
Package main shows an example of creating micro-deposits to validate an account.
Package main shows an example of creating micro-deposits to validate an account.
internal
iso3166
Generated on 2024-01-22T04:09:44Z by adam, any modifications will be overwritten
Generated on 2024-01-22T04:09:44Z by adam, any modifications will be overwritten
test

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL