ach

package module
v1.42.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: Apache-2.0 Imports: 27 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 (

	// 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.42.0"

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) 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)
	GetADVEntries() []*ADVEntryDetail
	AddADVEntry(*ADVEntryDetail)
	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
	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