ach

package module
v0.3.0-M1 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2018 License: Apache-2.0 Imports: 9 Imported by: 46

README

moov-io/ach

GoDoc Build Status Coverage Status Go Report Card Apache 2 licensed

Package github.com/moov-io/ach implements a file reader and writer for parsing ACH Automated Clearing House files. ACH is the primary method of electronic money movement throughout the United States.

Docs: docs.moov.io | api docs

Project Status

ACH is under active development but already in production for multiple companies. Please star the project if you are interested in its progress.

  • Library currently supports the reading and writing
    • ARC (Accounts Receivable Entry)
    • BOC (Back Office Conversion)
    • CCD (Corporate credit or debit)
    • CIE (Customer-Initiated Entry)
    • COR (Automated Notification of Change(NOC))
    • CTX (Corporate Trade Exchange)
    • IAT (International ACH Transactions)
    • POP (Point of Purchase)
    • POS (Point of Sale)
    • PPD (Prearranged payment and deposits)
    • RCK (Represented Check Entries)
    • SHR (Shared Network Entry)
    • TEL (Telephone-Initiated Entry)
    • WEB (Internet-initiated Entries)
    • Return Entries
    • Addenda Type Code 02
    • Addenda Type Code 05
    • Addenda Type Code 10 (IAT)
    • Addenda Type Code 11 (IAT)
    • Addenda Type Code 12 (IAT)
    • Addenda Type Code 13 (IAT)
    • Addenda Type Code 14 (IAT)
    • Addenda Type Code 15 (IAT)
    • Addenda Type Code 16 (IAT)
    • Addenda Type Code 17 (IAT Optional)
    • Addenda Type Code 18 (IAT Optional)
    • Addenda Type Code 98 (NOC)
    • Addenda Type Code 99 (Return)

Project Roadmap

  • Additional SEC codes will be added based on library users needs. Please open an issue with a valid test file.
  • Review the project issues for more detailed information

Usage and tests

The following is a high level of reading and writing an ach file. Tests exist in projects test folder with more details.

Read a file
// open a file for reading or pass any io.Reader NewReader()
f, err := os.Open("name-of-your-ach-file.ach")
if err != nil {
	log.Panicf("Can not open local file: %s: \n", err)
}
r := ach.NewReader(f)
achFile, err := r.Read()
if err != nil {
	fmt.Printf("Issue reading file: %+v \n", err)
}
// ensure we have a validated file structure
if achFile.Validate(); err != nil {
	fmt.Printf("Could not validate entire read file: %v", err)
}
// Check if any Notifications Of Change exist in the file
if len(achFile.NotificationOfChange) > 0 {
	for _, batch := range achFile.NotificationOfChange {
		a98 := batch.GetEntries()[0].Addendum[0].(*Addenda98)
		println(a98.CorrectedData)
	}
}
// Check if any Return Entries exist in the file
if len(achFile.ReturnEntries) > 0 {
	for _, batch := range achFile.ReturnEntries {
		aReturn := batch.GetEntries()[0].Addendum[0].(*Addenda99)
		println(aReturn.ReturnCode)
	}
}
Create a file

The following is based on simple file creation

   fh := ach.NewFileHeader()
   fh.ImmediateDestination = "9876543210" // A blank space followed by your ODFI's transit/routing number
   fh.ImmediateOrigin = "1234567890"      // Organization or Company FED ID usually 1 and FEIN/SSN. Assigned by your ODFI
   fh.FileCreationDate = time.Now()     // Todays Date
   fh.ImmediateDestinationName = "Federal Reserve Bank"
   fh.ImmediateOriginName = "My Bank Name")

   file := ach.NewFile()
   file.SetHeader(fh)

Explicitly create a PPD batch file.

Errors only if payment type is not supported

func mockBatchPPDHeader() *BatchHeader {
   bh := NewBatchHeader()
   bh.ServiceClassCode = 220
   bh.StandardEntryClassCode = "PPD"
   bh.CompanyName = "ACME Corporation"
   bh.CompanyIdentification = "123456789"
   bh.CompanyEntryDescription = "PAYROLL"
   bh.EffectiveEntryDate = time.Now()
   bh.ODFIIdentification = "6200001"
   return bh
}

mockBatch := NewBatch(mockBatchPPDHeader())

OR use the NewBatch factory

func mockBatchPPDHeader() *BatchHeader {
   bh := NewBatchHeader()
   bh.ServiceClassCode = 220
   bh.StandardEntryClassCode = "PPD"
   bh.CompanyName = "ACME Corporation"
   bh.CompanyIdentification = "123456789"
   bh.CompanyEntryDescription = "PAYROLL"
   bh.EffectiveEntryDate = time.Now()
   bh.ODFIIdentification = "6200001"
   return bh
}

mockBatch, _ := ach.NewBatch(mockBatchPPDHeader())

To create an entry

entry := ach.NewEntryDetail()
entry.TransactionCode = 22
entry.SetRDFI("009101298")
entry.DFIAccountNumber = "123456789"
entry.Amount = 100000000
entry.IndividualName = "Wade Arnold"
entry.SetTraceNumber(bh.ODFIIdentification, 1)
entry.IdentificationNumber = "ABC##jvkdjfuiwn"
entry.Category = ach.CategoryForward

To add one or more optional addenda records for an entry

addenda := NewAddenda05()
addenda.PaymentRelatedInformation = "Bonus pay for amazing work on #OSS"

Add the addenda record to the detail entry

entry.AddAddenda(addenda)

Entries are added to batches like so:

batch.AddEntry(entry)

When all of the Entries are added to the batch we can create the batch.

if err := batch.Create(); err != nil {
   fmt.Printf("%T: %s", err, err)
}

And batches are added to files much the same way:

file.AddBatch(batch)

Now add a new batch for accepting payments on the WEB

func mockBatchWEBHeader() *BatchHeader {
	bh := NewBatchHeader()
	bh.ServiceClassCode = 220
	bh.StandardEntryClassCode = "WEB"
	bh.CompanyName = "Your Company, inc"
	bh.CompanyIdentification = "123456789"
	bh.CompanyEntryDescription = "Online Order"
	bh.ODFIIdentification = "6200001"
	return bh
}

batch2, _ := ach.NewBatch(mockBatchWEBHeader())

Add an entry and define if it is a single or reoccurring payment. The following is a reoccurring payment for $7.99

entry2 := ach.NewEntryDetail()
entry2.TransactionCode = 22
entry2.SetRDFI(102001017)
entry2.DFIAccountNumber = "5343121"
entry2.Amount = 799
entry2.IndividualName = "Wade Arnold"
entry2.SetTraceNumber(bh.ODFIIdentification, 1)
entry2.IdentificationNumber = "#123456"
entry.DiscretionaryData = "R"
entry2.Category = ach.CategoryForward


addenda2 := NewAddenda05()
addenda2.PaymentRelatedInformation = "Monthly Membership Subscription"

Add the entry to the batch

entry2.AddAddenda(addenda2)

Create and add the second batch

batch2.AddEntry(entry2)
if err := batch2.Create(); err != nil {
	fmt.Printf("%T: %s", err, err)
}
file.AddBatch(batch2)

Once we added all our batches we must build the file

if err := file.Create(); err != nil {
   fmt.Printf("%T: %s", err, err)
}

Finally we want to write the file to an io.Writer

w := ach.NewWriter(os.Stdout)
if err := w.Write(file); err != nil {
   fmt.Printf("%T: %s", err, err)
}
w.Flush()
}

Which will generate a well formed ACH flat file.

101 210000890 1234567891708290000A094101Your Bank              Your Company           #00000A1
5200Your Company                        123456789 PPDTrans. DesOct 23010101   1234567890000001
6271020010175343121          0000017500#456789        Bob Smith             B11234567890000001
705bonus pay for amazing work on #OSS                                              00010000001
82000000020010200101000000017500000000000000123456789                          234567890000001
5220Your Company                        123456789 WEBsubscr    Oct 23010101   1234567890000002
6221020010175343121          0000000799#123456        Wade Arnold           R 1234567890000001
705Monthly Membership Subscription                                                 00010000001
82200000020010200101000000000000000000000799123456789                          234567890000002
9000002000001000000040020400202000000017500000000000799
Create an IAT file
    file := NewFile().SetHeader(mockFileHeader())
	iatBatch := IATBatch{}
	iatBatch.SetHeader(mockIATBatchHeaderFF())
	iatBatch.AddEntry(mockIATEntryDetail())
	iatBatch.Entries[0].Addenda10 = mockAddenda10()
	iatBatch.Entries[0].Addenda11 = mockAddenda11()
	iatBatch.Entries[0].Addenda12 = mockAddenda12()
	iatBatch.Entries[0].Addenda13 = mockAddenda13()
	iatBatch.Entries[0].Addenda14 = mockAddenda14()
	iatBatch.Entries[0].Addenda15 = mockAddenda15()
	iatBatch.Entries[0].Addenda16 = mockAddenda16()
	iatBatch.Entries[0].AddIATAddenda(mockAddenda17())
	iatBatch.Entries[0].AddIATAddenda(mockAddenda17B())
	iatBatch.Entries[0].AddIATAddenda(mockAddenda18())
	iatBatch.Entries[0].AddIATAddenda(mockAddenda18B())
	iatBatch.Entries[0].AddIATAddenda(mockAddenda18C())
	iatBatch.Entries[0].AddIATAddenda(mockAddenda18D())
	iatBatch.Entries[0].AddIATAddenda(mockAddenda18E())
	iatBatch.Create()
	file.AddIATBatch(iatBatch)

	iatBatch2 := IATBatch{}
	iatBatch2.SetHeader(mockIATBatchHeaderFF())
	iatBatch2.AddEntry(mockIATEntryDetail())
	iatBatch2.GetEntries()[0].TransactionCode = 27
	iatBatch2.GetEntries()[0].Amount = 2000
	iatBatch2.Entries[0].Addenda10 = mockAddenda10()
	iatBatch2.Entries[0].Addenda11 = mockAddenda11()
	iatBatch2.Entries[0].Addenda12 = mockAddenda12()
	iatBatch2.Entries[0].Addenda13 = mockAddenda13()
	iatBatch2.Entries[0].Addenda14 = mockAddenda14()
	iatBatch2.Entries[0].Addenda15 = mockAddenda15()
	iatBatch2.Entries[0].Addenda16 = mockAddenda16()
	iatBatch2.Entries[0].AddIATAddenda(mockAddenda17())
	iatBatch2.Entries[0].AddIATAddenda(mockAddenda17B())
	iatBatch2.Entries[0].AddIATAddenda(mockAddenda18())
	iatBatch2.Entries[0].AddIATAddenda(mockAddenda18B())
	iatBatch2.Entries[0].AddIATAddenda(mockAddenda18C())
	iatBatch2.Entries[0].AddIATAddenda(mockAddenda18D())
	iatBatch2.Entries[0].AddIATAddenda(mockAddenda18E())
	iatBatch2.Create()
	file.AddIATBatch(iatBatch2)

	if err := file.Create(); err != nil {
		t.Errorf("%T: %s", err, err)
	}
	if err := file.Validate(); err != nil {
		t.Errorf("%T: %s", err, err)
	}

	b := &bytes.Buffer{}
	f := NewWriter(b)

	if err := f.Write(file); err != nil {
		t.Errorf("%T: %s", err, err)
	}

	r := NewReader(strings.NewReader(b.String()))
	_, err := r.Read()
	if err != nil {
		t.Errorf("%T: %s", err, err)
	}
	if err = r.File.Validate(); err != nil {
		t.Errorf("%T: %s", err, err)
	}

	// Write IAT records to standard output. Anything io.Writer
	w := NewWriter(os.Stdout)
	if err := w.Write(file); err != nil {
		log.Fatalf("Unexpected error: %s\n", err)
	}
	w.Flush()

This will generate a well formed flat IAT ACH file

101 987654321 1234567891807200000A094101Federal Reserve Bank   My Bank Name
5220                FF3               US123456789 IATTRADEPAYMTCADUSD010101   0231380100000001
6221210428820007             0000100000123456789                              1231380100000001
710ANN000000000000100000928383-23938          BEK Enterprises                          0000001
711BEK Solutions                      15 West Place Street                             0000001
712JacobsTown*PA\                     US*19305\                                        0000001
713Wells Fargo                        01121042882                         US           0000001
714Citadel Bank                       01231380104                         US           0000001
7159874654932139872121 Front Street                                                    0000001
716LetterTown*AB\                     CA*80014\                                        0000001
717This is an international payment                                                00010000001
717Transfer of money from one country to another                                   00020000001
718Bank of Germany                    01987987987654654                   DE       00010000001
718Bank of Spain                      01987987987123123                   ES       00020000001
718Bank of France                     01456456456987987                   FR       00030000001
718Bank of Turkey                     0112312345678910                    TR       00040000001
718Bank of United Kingdom             011234567890123456789012345678901234GB       00050000001
82200000150012104288000000000000000000100000                                   231380100000001
5220                FF3               US123456789 IATTRADEPAYMTCADUSD010101   0231380100000002
6271210428820007             0000002000123456789                              1231380100000001
710ANN000000000000100000928383-23938          BEK Enterprises                          0000001
711BEK Solutions                      15 West Place Street                             0000001
712JacobsTown*PA\                     US*19305\                                        0000001
713Wells Fargo                        01121042882                         US           0000001
714Citadel Bank                       01231380104                         US           0000001
7159874654932139872121 Front Street                                                    0000001
716LetterTown*AB\                     CA*80014\                                        0000001
717This is an international payment                                                00010000001
717Transfer of money from one country to another                                   00020000001
718Bank of Germany                    01987987987654654                   DE       00010000001
718Bank of Spain                      01987987987123123                   ES       00020000001
718Bank of France                     01456456456987987                   FR       00030000001
718Bank of Turkey                     0112312345678910                    TR       00040000001
718Bank of United Kingdom             011234567890123456789012345678901234GB       00050000001
82200000150012104288000000002000000000000000                                   231380100000002
9000002000004000000300024208576000000002000000000100000
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999

Getting Help

channel info
Project Documentation Our project documentation available online.
Google Group moov-users The Moov users Google group is for contributors other people contributing to the Moov project. You can join them without a google account by sending an email to moov-users+subscribe@googlegroups.com. After receiving the join-request message, you can simply reply to that to confirm the subscription.
Twitter @moov_io 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 an 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. Request and invote to the slack channel

Supported and Tested Platforms

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

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

Contributing

Yes please! Please review our Contributing guide and Code of Conduct to get started!

Note: This project uses Go Modules, which requires Go 1.11 or higher, but we ship the vendor directory in our repository.

License

Apache License 2.0 See LICENSE for details.

Documentation

Overview

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

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

Index

Constants

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"
)
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 = "v0.3.0-dev"

Variables

This section is empty.

Functions

This section is empty.

Types

type Addenda02 added in v0.3.0

type Addenda02 struct {
	// ID is a client defined string used as a reference to this record.
	ID string `json:"id"`

	// 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
	TraceNumber int `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.

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

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 (*Addenda02) Parse added in v0.3.0

func (addenda02 *Addenda02) Parse(record string)

Parse takes the input record string and parses the Addenda02 values

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) TypeCode added in v0.3.0

func (addenda02 *Addenda02) TypeCode() string

TypeCode Defines the specific explanation and format for the addenda02 information

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 a client defined string used as a reference to this record.
	ID string `json:"id"`

	// 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,omitempty"`
	// 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,omitempty"`
	// 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.

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

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 (*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

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) TypeCode added in v0.2.0

func (addenda05 *Addenda05) TypeCode() string

TypeCode Defines the specific explanation and format for the addenda05 information

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 a client defined string used as a reference to this record.
	ID string `json:"id"`

	// 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,omitempty"`
	// 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

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 (*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

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) TypeCode added in v0.3.0

func (addenda10 *Addenda10) TypeCode() string

TypeCode Defines the specific explanation and format for the addenda10 information left padded

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 a client defined string used as a reference to this record.
	ID string `json:"id"`

	// 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,omitempty"`
	// 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

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 (*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

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) TypeCode added in v0.3.0

func (addenda11 *Addenda11) TypeCode() string

TypeCode Defines the specific explanation and format for the addenda11 information left padded

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 a client defined string used as a reference to this record.
	ID string `json:"id"`

	// 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 FranciscoCA.
	OriginatorCityStateProvince string `json:"originatorCityStateProvince"`
	// Originator Country & Postal Code
	// Data elements must be separated by an asterisk (*) and must end with a backslash (\)
	// For example: US10036\
	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,omitempty"`
	// 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

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 (*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

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) TypeCode added in v0.3.0

func (addenda12 *Addenda12) TypeCode() string

TypeCode Defines the specific explanation and format for the addenda12 information left padded

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 a client defined string used as a reference to this record.
	ID string `json:"id"`

	// 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,omitempty"`
	// 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

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 (*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

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) TypeCode added in v0.3.0

func (addenda13 *Addenda13) TypeCode() string

TypeCode Defines the specific explanation and format for the addenda13 information left padded

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 a client defined string used as a reference to this record.
	ID string `json:"id"`

	// Receiving DFI Name
	// 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,omitempty"`
	// 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

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 (*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

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) TypeCode added in v0.3.0

func (addenda14 *Addenda14) TypeCode() string

TypeCode Defines the specific explanation and format for the addenda14 information left padded

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 a client defined string used as a reference to this record.
	ID string `json:"id"`

	// 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,omitempty"`
	// 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

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 (*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

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) TypeCode added in v0.3.0

func (addenda15 *Addenda15) TypeCode() string

TypeCode Defines the specific explanation and format for the addenda15 information left padded

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 a client defined string used as a reference to this record.
	ID string `json:"id"`

	// 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 FranciscoCA.
	ReceiverCityStateProvince string `json:"receiverCityStateProvince"`
	// Receiver Country & Postal Code
	// Data elements must be separated by an asterisk (*) and must end with a backslash (\)
	// For example: US10036\
	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,omitempty"`
	// 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

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 (*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

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) TypeCode added in v0.3.0

func (addenda16 *Addenda16) TypeCode() string

TypeCode Defines the specific explanation and format for the addenda16 information left padded

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 a client defined string used as a reference to this record.
	ID string `json:"id"`

	// 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,omitempty"`
	// 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,omitempty"`
	// 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

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 (*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

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) TypeCode added in v0.3.0

func (addenda17 *Addenda17) TypeCode() string

TypeCode Defines the specific explanation and format for the addenda17 information

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 a client defined string used as a reference to this record.
	ID string `json:"id"`

	// 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,omitempty"`
	// 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,omitempty"`
	// 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

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 (*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

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) TypeCode added in v0.3.0

func (addenda18 *Addenda18) TypeCode() string

TypeCode Defines the specific explanation and format for the addenda18 information

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 a client defined string used as a reference to this record.
	ID string `json:"id"`

	// 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 int `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
	CorrectedData string `json:"correctedData"`
	// TraceNumber matches the Entry Detail Trace Number of the entry being returned.
	TraceNumber int `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

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 (*Addenda98) CorrectedDataField added in v0.2.0

func (addenda98 *Addenda98) CorrectedDataField() string

CorrectedDataField returns a space padded CorrectedData string

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

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) TypeCode added in v0.2.0

func (addenda98 *Addenda98) TypeCode() string

TypeCode defines the format of the underlying addenda record

func (*Addenda98) Validate added in v0.2.0

func (addenda98 *Addenda98) Validate() error

Validate verifies NACHA rules for Addenda98

type Addenda99 added in v0.2.0

type Addenda99 struct {
	// ID is a client defined string used as a reference to this record.
	ID string `json:"id"`

	// 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 int `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).
	DateOfDeath time.Time `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.
	TraceNumber int `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) AddendaInformationField added in v0.2.0

func (Addenda99 *Addenda99) AddendaInformationField() string

AddendaInformationField returns a space padded AddendaInformation string

func (*Addenda99) CalculateCheckDigit added in v0.2.0

func (v *Addenda99) 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 (*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) 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

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) TypeCode added in v0.2.0

func (Addenda99 *Addenda99) TypeCode() string

TypeCode defines the format of the underlying addenda record

func (*Addenda99) Validate added in v0.2.0

func (Addenda99 *Addenda99) Validate() error

Validate verifies NACHA rules for Addenda99

type Addendumer

type Addendumer interface {
	Parse(string)
	//TypeCode Defines the specific explanation and format for the addenda information
	TypeCode() string
	String() string
	Validate() error
}

Addendumer abstracts the different ACH addendum types that can be added to an EntryDetail record

type BatchARC added in v0.3.0

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

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) AddEntry added in v0.3.0

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

AddEntry appends an EntryDetail to the Batch

func (*BatchARC) Category added in v0.3.0

func (batch *BatchARC) Category() string

IsReturn is true if the batch contains an Entry Return

func (*BatchARC) Create added in v0.3.0

func (batch *BatchARC) Create() error

Create takes Batch Header and Entries and builds a valid batch

func (*BatchARC) GetControl added in v0.3.0

func (batch *BatchARC) GetControl() *BatchControl

GetControl returns the current Batch Control

func (*BatchARC) GetEntries added in v0.3.0

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

GetEntries returns a slice of entry details for the batch

func (*BatchARC) GetHeader added in v0.3.0

func (batch *BatchARC) GetHeader() *BatchHeader

GetHeader returns the current Batch header

func (*BatchARC) ID added in v0.3.0

func (batch *BatchARC) ID() string

ID returns the id of the batch

func (*BatchARC) SetControl added in v0.3.0

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

SetControl appends an BatchControl to the Batch

func (*BatchARC) SetHeader added in v0.3.0

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

SetHeader appends an BatchHeader to the Batch

func (*BatchARC) SetID added in v0.3.0

func (batch *BatchARC) SetID(id string)

SetID sets the batch id

func (*BatchARC) Validate added in v0.3.0

func (batch *BatchARC) Validate() error

Validate checks valid NACHA batch rules. Assumes properly parsed records.

type BatchBOC added in v0.3.0

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

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) AddEntry added in v0.3.0

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

AddEntry appends an EntryDetail to the Batch

func (*BatchBOC) Category added in v0.3.0

func (batch *BatchBOC) Category() string

IsReturn is true if the batch contains an Entry Return

func (*BatchBOC) Create added in v0.3.0

func (batch *BatchBOC) Create() error

Create takes Batch Header and Entries and builds a valid batch

func (*BatchBOC) GetControl added in v0.3.0

func (batch *BatchBOC) GetControl() *BatchControl

GetControl returns the current Batch Control

func (*BatchBOC) GetEntries added in v0.3.0

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

GetEntries returns a slice of entry details for the batch

func (*BatchBOC) GetHeader added in v0.3.0

func (batch *BatchBOC) GetHeader() *BatchHeader

GetHeader returns the current Batch header

func (*BatchBOC) ID added in v0.3.0

func (batch *BatchBOC) ID() string

ID returns the id of the batch

func (*BatchBOC) SetControl added in v0.3.0

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

SetControl appends an BatchControl to the Batch

func (*BatchBOC) SetHeader added in v0.3.0

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

SetHeader appends an BatchHeader to the Batch

func (*BatchBOC) SetID added in v0.3.0

func (batch *BatchBOC) SetID(id string)

SetID sets the batch id

func (*BatchBOC) Validate added in v0.3.0

func (batch *BatchBOC) Validate() error

Validate checks valid NACHA batch rules. Assumes properly parsed records.

type BatchCCD

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

BatchCCD is a batch file that handles SEC payment type CCD amd 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) AddEntry

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

AddEntry appends an EntryDetail to the Batch

func (*BatchCCD) Category

func (batch *BatchCCD) Category() string

IsReturn is true if the batch contains an Entry Return

func (*BatchCCD) Create

func (batch *BatchCCD) Create() error

Create builds the batch sequence numbers and batch control. Additional creation

func (*BatchCCD) GetControl

func (batch *BatchCCD) GetControl() *BatchControl

GetControl returns the current Batch Control

func (*BatchCCD) GetEntries

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

GetEntries returns a slice of entry details for the batch

func (*BatchCCD) GetHeader

func (batch *BatchCCD) GetHeader() *BatchHeader

GetHeader returns the current Batch header

func (*BatchCCD) ID added in v0.3.0

func (batch *BatchCCD) ID() string

ID returns the id of the batch

func (*BatchCCD) SetControl

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

SetControl appends an BatchControl to the Batch

func (*BatchCCD) SetHeader

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

SetHeader appends an BatchHeader to the Batch

func (*BatchCCD) SetID added in v0.3.0

func (batch *BatchCCD) SetID(id string)

SetID sets the batch id

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 {
	// contains filtered or unexported fields
}

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) AddEntry added in v0.3.0

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

AddEntry appends an EntryDetail to the Batch

func (*BatchCIE) Category added in v0.3.0

func (batch *BatchCIE) Category() string

IsReturn is true if the batch contains an Entry Return

func (*BatchCIE) Create added in v0.3.0

func (batch *BatchCIE) Create() error

Create takes Batch Header and Entries and builds a valid batch

func (*BatchCIE) GetControl added in v0.3.0

func (batch *BatchCIE) GetControl() *BatchControl

GetControl returns the current Batch Control

func (*BatchCIE) GetEntries added in v0.3.0

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

GetEntries returns a slice of entry details for the batch

func (*BatchCIE) GetHeader added in v0.3.0

func (batch *BatchCIE) GetHeader() *BatchHeader

GetHeader returns the current Batch header

func (*BatchCIE) ID added in v0.3.0

func (batch *BatchCIE) ID() string

ID returns the id of the batch

func (*BatchCIE) SetControl added in v0.3.0

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

SetControl appends an BatchControl to the Batch

func (*BatchCIE) SetHeader added in v0.3.0

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

SetHeader appends an BatchHeader to the Batch

func (*BatchCIE) SetID added in v0.3.0

func (batch *BatchCIE) SetID(id string)

SetID sets the batch id

func (*BatchCIE) Validate added in v0.3.0

func (batch *BatchCIE) Validate() error

Validate checks valid NACHA batch rules. Assumes properly parsed records.

type BatchCOR

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

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) AddEntry

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

AddEntry appends an EntryDetail to the Batch

func (*BatchCOR) Category

func (batch *BatchCOR) Category() string

IsReturn is true if the batch contains an Entry Return

func (*BatchCOR) Create

func (batch *BatchCOR) Create() error

Create builds the batch sequence numbers and batch control. Additional creation

func (*BatchCOR) GetControl

func (batch *BatchCOR) GetControl() *BatchControl

GetControl returns the current Batch Control

func (*BatchCOR) GetEntries

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

GetEntries returns a slice of entry details for the batch

func (*BatchCOR) GetHeader

func (batch *BatchCOR) GetHeader() *BatchHeader

GetHeader returns the current Batch header

func (*BatchCOR) ID added in v0.3.0

func (batch *BatchCOR) ID() string

ID returns the id of the batch

func (*BatchCOR) SetControl

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

SetControl appends an BatchControl to the Batch

func (*BatchCOR) SetHeader

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

SetHeader appends an BatchHeader to the Batch

func (*BatchCOR) SetID added in v0.3.0

func (batch *BatchCOR) SetID(id string)

SetID sets the batch id

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 {
	// contains filtered or unexported fields
}

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) AddEntry added in v0.3.0

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

AddEntry appends an EntryDetail to the Batch

func (*BatchCTX) Category added in v0.3.0

func (batch *BatchCTX) Category() string

IsReturn is true if the batch contains an Entry Return

func (*BatchCTX) Create added in v0.3.0

func (batch *BatchCTX) Create() error

Create takes Batch Header and Entries and builds a valid batch

func (*BatchCTX) GetControl added in v0.3.0

func (batch *BatchCTX) GetControl() *BatchControl

GetControl returns the current Batch Control

func (*BatchCTX) GetEntries added in v0.3.0

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

GetEntries returns a slice of entry details for the batch

func (*BatchCTX) GetHeader added in v0.3.0

func (batch *BatchCTX) GetHeader() *BatchHeader

GetHeader returns the current Batch header

func (*BatchCTX) ID added in v0.3.0

func (batch *BatchCTX) ID() string

ID returns the id of the batch

func (*BatchCTX) SetControl added in v0.3.0

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

SetControl appends an BatchControl to the Batch

func (*BatchCTX) SetHeader added in v0.3.0

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

SetHeader appends an BatchHeader to the Batch

func (*BatchCTX) SetID added in v0.3.0

func (batch *BatchCTX) SetID(id string)

SetID sets the batch id

func (*BatchCTX) Validate added in v0.3.0

func (batch *BatchCTX) Validate() error

Validate checks valid NACHA batch rules. Assumes properly parsed records.

type BatchControl

type BatchControl struct {
	// ID is a client defined string used as a reference to this record.
	ID string `json:"id"`

	// ServiceClassCode ACH Mixed Debits and Credits ‘200’
	// ACH Credits Only ‘220’
	// ACH Debits Only ‘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:"entryAddendaÇount"`
	// 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

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 (*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

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 BatchError

type BatchError struct {
	BatchNumber int
	FieldName   string
	Msg         string
}

BatchError is an Error that describes batch validation issues

func (*BatchError) Error

func (e *BatchError) Error() string

type BatchHeader

type BatchHeader struct {
	// ID is a client defined string used as a reference to this record.
	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,omitempty"`

	// 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 except as otherwise noted below, the Originator establishes this field
	// as the date it would like to see displayed to the receiver for
	// descriptive purposes. This field is never used to control timing of any
	// computer or manual operation. It is solely for descriptive purposes.
	// The RDFI should not assume any specific format. Examples of possible
	// entries in this field are "011392,", "01 92," "JAN 13," "JAN 92," etc.
	CompanyDescriptiveDate string `json:"companyDescriptiveDate,omitempty"`

	// EffectiveEntryDate the date on which the entries are to settle
	EffectiveEntryDate time.Time `json:"effectiveEntryDate,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,omitempty"`
	// 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

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 (*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) 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

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 BatchPOP added in v0.3.0

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

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) AddEntry added in v0.3.0

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

AddEntry appends an EntryDetail to the Batch

func (*BatchPOP) Category added in v0.3.0

func (batch *BatchPOP) Category() string

IsReturn is true if the batch contains an Entry Return

func (*BatchPOP) Create added in v0.3.0

func (batch *BatchPOP) Create() error

Create takes Batch Header and Entries and builds a valid batch

func (*BatchPOP) GetControl added in v0.3.0

func (batch *BatchPOP) GetControl() *BatchControl

GetControl returns the current Batch Control

func (*BatchPOP) GetEntries added in v0.3.0

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

GetEntries returns a slice of entry details for the batch

func (*BatchPOP) GetHeader added in v0.3.0

func (batch *BatchPOP) GetHeader() *BatchHeader

GetHeader returns the current Batch header

func (*BatchPOP) ID added in v0.3.0

func (batch *BatchPOP) ID() string

ID returns the id of the batch

func (*BatchPOP) SetControl added in v0.3.0

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

SetControl appends an BatchControl to the Batch

func (*BatchPOP) SetHeader added in v0.3.0

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

SetHeader appends an BatchHeader to the Batch

func (*BatchPOP) SetID added in v0.3.0

func (batch *BatchPOP) SetID(id string)

SetID sets the batch id

func (*BatchPOP) Validate added in v0.3.0

func (batch *BatchPOP) Validate() error

Validate checks valid NACHA batch rules. Assumes properly parsed records.

type BatchPOS added in v0.3.0

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

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) AddEntry added in v0.3.0

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

AddEntry appends an EntryDetail to the Batch

func (*BatchPOS) Category added in v0.3.0

func (batch *BatchPOS) Category() string

IsReturn is true if the batch contains an Entry Return

func (*BatchPOS) Create added in v0.3.0

func (batch *BatchPOS) Create() error

Create takes Batch Header and Entries and builds a valid batch

func (*BatchPOS) GetControl added in v0.3.0

func (batch *BatchPOS) GetControl() *BatchControl

GetControl returns the current Batch Control

func (*BatchPOS) GetEntries added in v0.3.0

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

GetEntries returns a slice of entry details for the batch

func (*BatchPOS) GetHeader added in v0.3.0

func (batch *BatchPOS) GetHeader() *BatchHeader

GetHeader returns the current Batch header

func (*BatchPOS) ID added in v0.3.0

func (batch *BatchPOS) ID() string

ID returns the id of the batch

func (*BatchPOS) SetControl added in v0.3.0

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

SetControl appends an BatchControl to the Batch

func (*BatchPOS) SetHeader added in v0.3.0

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

SetHeader appends an BatchHeader to the Batch

func (*BatchPOS) SetID added in v0.3.0

func (batch *BatchPOS) SetID(id string)

SetID sets the batch id

func (*BatchPOS) Validate added in v0.3.0

func (batch *BatchPOS) Validate() error

Validate checks valid NACHA batch rules. Assumes properly parsed records.

type BatchPPD

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

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) AddEntry

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

AddEntry appends an EntryDetail to the Batch

func (*BatchPPD) Category

func (batch *BatchPPD) Category() string

IsReturn is true if the batch contains an Entry Return

func (*BatchPPD) Create

func (batch *BatchPPD) Create() error

Create takes Batch Header and Entries and builds a valid batch

func (*BatchPPD) GetControl

func (batch *BatchPPD) GetControl() *BatchControl

GetControl returns the current Batch Control

func (*BatchPPD) GetEntries

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

GetEntries returns a slice of entry details for the batch

func (*BatchPPD) GetHeader

func (batch *BatchPPD) GetHeader() *BatchHeader

GetHeader returns the current Batch header

func (*BatchPPD) ID added in v0.3.0

func (batch *BatchPPD) ID() string

ID returns the id of the batch

func (*BatchPPD) SetControl

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

SetControl appends an BatchControl to the Batch

func (*BatchPPD) SetHeader

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

SetHeader appends an BatchHeader to the Batch

func (*BatchPPD) SetID added in v0.3.0

func (batch *BatchPPD) SetID(id string)

SetID sets the batch id

func (*BatchPPD) Validate

func (batch *BatchPPD) Validate() error

Validate checks valid NACHA batch rules. Assumes properly parsed records.

type BatchRCK added in v0.3.0

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

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) AddEntry added in v0.3.0

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

AddEntry appends an EntryDetail to the Batch

func (*BatchRCK) Category added in v0.3.0

func (batch *BatchRCK) Category() string

IsReturn is true if the batch contains an Entry Return

func (*BatchRCK) Create added in v0.3.0

func (batch *BatchRCK) Create() error

Create takes Batch Header and Entries and builds a valid batch

func (*BatchRCK) GetControl added in v0.3.0

func (batch *BatchRCK) GetControl() *BatchControl

GetControl returns the current Batch Control

func (*BatchRCK) GetEntries added in v0.3.0

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

GetEntries returns a slice of entry details for the batch

func (*BatchRCK) GetHeader added in v0.3.0

func (batch *BatchRCK) GetHeader() *BatchHeader

GetHeader returns the current Batch header

func (*BatchRCK) ID added in v0.3.0

func (batch *BatchRCK) ID() string

ID returns the id of the batch

func (*BatchRCK) SetControl added in v0.3.0

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

SetControl appends an BatchControl to the Batch

func (*BatchRCK) SetHeader added in v0.3.0

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

SetHeader appends an BatchHeader to the Batch

func (*BatchRCK) SetID added in v0.3.0

func (batch *BatchRCK) SetID(id string)

SetID sets the batch id

func (*BatchRCK) Validate added in v0.3.0

func (batch *BatchRCK) Validate() error

Validate checks valid NACHA batch rules. Assumes properly parsed records.

type BatchSHR added in v0.3.0

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

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) AddEntry added in v0.3.0

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

AddEntry appends an EntryDetail to the Batch

func (*BatchSHR) Category added in v0.3.0

func (batch *BatchSHR) Category() string

IsReturn is true if the batch contains an Entry Return

func (*BatchSHR) Create added in v0.3.0

func (batch *BatchSHR) Create() error

Create takes Batch Header and Entries and builds a valid batch

func (*BatchSHR) GetControl added in v0.3.0

func (batch *BatchSHR) GetControl() *BatchControl

GetControl returns the current Batch Control

func (*BatchSHR) GetEntries added in v0.3.0

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

GetEntries returns a slice of entry details for the batch

func (*BatchSHR) GetHeader added in v0.3.0

func (batch *BatchSHR) GetHeader() *BatchHeader

GetHeader returns the current Batch header

func (*BatchSHR) ID added in v0.3.0

func (batch *BatchSHR) ID() string

ID returns the id of the batch

func (*BatchSHR) SetControl added in v0.3.0

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

SetControl appends an BatchControl to the Batch

func (*BatchSHR) SetHeader added in v0.3.0

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

SetHeader appends an BatchHeader to the Batch

func (*BatchSHR) SetID added in v0.3.0

func (batch *BatchSHR) SetID(id string)

SetID sets the batch id

func (*BatchSHR) Validate added in v0.3.0

func (batch *BatchSHR) Validate() error

Validate checks valid NACHA batch rules. Assumes properly parsed records.

type BatchTEL added in v0.2.0

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

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) AddEntry added in v0.2.0

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

AddEntry appends an EntryDetail to the Batch

func (*BatchTEL) Category added in v0.2.0

func (batch *BatchTEL) Category() string

IsReturn is true if the batch contains an Entry Return

func (*BatchTEL) Create added in v0.2.0

func (batch *BatchTEL) Create() error

Create builds the batch sequence numbers and batch control. Additional creation

func (*BatchTEL) GetControl added in v0.2.0

func (batch *BatchTEL) GetControl() *BatchControl

GetControl returns the current Batch Control

func (*BatchTEL) GetEntries added in v0.2.0

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

GetEntries returns a slice of entry details for the batch

func (*BatchTEL) GetHeader added in v0.2.0

func (batch *BatchTEL) GetHeader() *BatchHeader

GetHeader returns the current Batch header

func (*BatchTEL) ID added in v0.3.0

func (batch *BatchTEL) ID() string

ID returns the id of the batch

func (*BatchTEL) SetControl added in v0.2.0

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

SetControl appends an BatchControl to the Batch

func (*BatchTEL) SetHeader added in v0.2.0

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

SetHeader appends an BatchHeader to the Batch

func (*BatchTEL) SetID added in v0.3.0

func (batch *BatchTEL) SetID(id string)

SetID sets the batch id

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 BatchWEB

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

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) AddEntry

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

AddEntry appends an EntryDetail to the Batch

func (*BatchWEB) Category

func (batch *BatchWEB) Category() string

IsReturn is true if the batch contains an Entry Return

func (*BatchWEB) Create

func (batch *BatchWEB) Create() error

Create builds the batch sequence numbers and batch control. Additional creation

func (*BatchWEB) GetControl

func (batch *BatchWEB) GetControl() *BatchControl

GetControl returns the current Batch Control

func (*BatchWEB) GetEntries

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

GetEntries returns a slice of entry details for the batch

func (*BatchWEB) GetHeader

func (batch *BatchWEB) GetHeader() *BatchHeader

GetHeader returns the current Batch header

func (*BatchWEB) ID added in v0.3.0

func (batch *BatchWEB) ID() string

ID returns the id of the batch

func (*BatchWEB) SetControl

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

SetControl appends an BatchControl to the Batch

func (*BatchWEB) SetHeader

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

SetHeader appends an BatchHeader to the Batch

func (*BatchWEB) SetID added in v0.3.0

func (batch *BatchWEB) SetID(id string)

SetID sets the batch id

func (*BatchWEB) Validate

func (batch *BatchWEB) Validate() error

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

type Batcher

type Batcher interface {
	GetHeader() *BatchHeader
	SetHeader(*BatchHeader)
	GetControl() *BatchControl
	SetControl(*BatchControl)
	GetEntries() []*EntryDetail
	AddEntry(*EntryDetail)
	Create() error
	Validate() error
	SetID(string)
	ID() string
	// Category defines if a Forward or Return
	Category() string
}

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 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 EntryDetail

type EntryDetail struct {
	// ID is a client defined string used as a reference to this record.
	ID string `json:"id"`

	// TransactionCode if the receivers account is:
	// Credit (deposit) to checking account ‘22’
	// Prenote for credit to checking account ‘23’
	// Debit (withdrawal) to checking account ‘27’
	// Prenote for debit to checking account ‘28’
	// Credit to savings account ‘32’
	// Prenote for credit to savings account ‘33’
	// Debit to savings account ‘37’
	// Prenote for debit to savings account ‘38’
	TransactionCode int `json:"transactionCode"`
	// RDFIIdentification is the RDFI's routing number without the last digit.
	// Receiving Depository Financial Institution
	RDFIIdentification string `json:"RDFIIdentification"`
	// CheckDigit the last digit of the RDFI's routing number
	CheckDigit string `json:"checkDigit"`
	// 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 uses 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 assigned by the ODFI in ascending sequence, is included in each
	// Entry Detail Record, Corporate Entry Detail Record, and addenda Record.
	// Trace Numbers uniquely identify each entry within a batch in an ACH input file.
	// 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.
	TraceNumber int `json:"traceNumber,omitempty"`
	// Addendum a list of Addenda for the Entry Detail
	Addendum []Addendumer `json:"addendum,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) AddAddenda

func (ed *EntryDetail) AddAddenda(addenda Addendumer) []Addendumer

AddAddenda appends an Addendumer to the EntryDetail

func (*EntryDetail) AmountField

func (ed *EntryDetail) AmountField() string

AmountField returns a zero padded string of amount

func (*EntryDetail) CTXAddendaRecordsField added in v0.3.0

func (ed *EntryDetail) CTXAddendaRecordsField() string

CTXAddendaRecordsField is used in CTX files, characters 1-4 of underlying IndividualName field

func (*EntryDetail) CTXReceivingCompanyField added in v0.3.0

func (ed *EntryDetail) CTXReceivingCompanyField() string

CTXReceivingCompanyField is used in CTX files, characters 5-20 of underlying IndividualName field

func (*EntryDetail) CTXReservedField added in v0.3.0

func (ed *EntryDetail) CTXReservedField() string

CTXReservedField is used in CTX files, characters 21-22 of underlying IndividualName field

func (*EntryDetail) CalculateCheckDigit

func (v *EntryDetail) 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 (*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) 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

func (*EntryDetail) PaymentTypeField

func (ed *EntryDetail) PaymentTypeField() string

PaymentTypeField returns the DiscretionaryData field used in WEB batch files

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) SetCTXAddendaRecords added in v0.3.0

func (ed *EntryDetail) SetCTXAddendaRecords(i int)

SetCTXAddendaRecords setter for CTX AddendaRecords characters 1-4 of underlying IndividualName

func (*EntryDetail) SetCTXReceivingCompany added in v0.3.0

func (ed *EntryDetail) SetCTXReceivingCompany(s string)

SetCTXReceivingCompany setter for CTX 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) 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)

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) 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 FieldError

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

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

type File

type File struct {
	ID         string      `json:"id"`
	Header     FileHeader  `json:"fileHeader"`
	Batches    []Batcher   `json:"batches"`
	IATBatches []IATBatch  `json:"IATBatches"`
	Control    FileControl `json:"fileControl"`

	// NotificationOfChange (Notification of change) is a slice of references to BatchCOR in file.Batches
	NotificationOfChange []*BatchCOR
	// ReturnEntries is a slice of references to file.Batches that contain return entries
	ReturnEntries []Batcher
	// contains filtered or unexported fields
}

File contains the structures of a parsed ACH File.

func NewFile

func NewFile() *File

NewFile constructs a file template.

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 creates a valid file and requires that the FileHeader and at least one Batch

func (*File) SetHeader

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

SetHeader allows for header to be built.

func (*File) Validate

func (f *File) Validate() error

Validate NACHA rules on the entire batch before being added to a File

type FileControl

type FileControl struct {
	// ID is a client defined string used as a reference to this record.
	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
}

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

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 (*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

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 a client defined string used as a reference to this record.
	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
	// which 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 expressed in a "YYMMDD" format. The File Creation
	// Date 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).
	FileCreationDate time.Time `json:"fileCreationDate"`

	// FileCreationTime is expressed ina n "HHMM" (24 hour clock) format.
	// The system time when the ACH file was created
	FileCreationTime time.Time `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

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 (*FileHeader) FileCreationDateField

func (fh *FileHeader) FileCreationDateField() string

FileCreationDateField gets the file creation date in YYMMDD format

func (*FileHeader) FileCreationTimeField

func (fh *FileHeader) FileCreationTimeField() string

FileCreationTimeField gets the file creation time in HHMM format

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

func (*FileHeader) ReferenceCodeField

func (fh *FileHeader) ReferenceCodeField() string

ReferenceCodeField gets the ReferenceCode field padded

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.

type IATBatch added in v0.3.0

type IATBatch struct {
	// ID is a client defined string used as a reference to this record.
	ID      string            `json:"id"`
	Header  *IATBatchHeader   `json:"IATBatchHeader,omitempty"`
	Entries []*IATEntryDetail `json:"IATEntryDetails,omitempty"`
	Control *BatchControl     `json:"batchControl,omitempty"`
	// 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 (batch *IATBatch) AddEntry(entry *IATEntryDetail)

AddEntry appends an EntryDetail to the Batch

func (*IATBatch) Category added in v0.3.0

func (batch *IATBatch) Category() string

Category returns IATBatch Category

func (*IATBatch) Create added in v0.3.0

func (batch *IATBatch) Create() error

Create takes Batch Header and Entries and builds a valid batch

func (*IATBatch) GetControl added in v0.3.0

func (batch *IATBatch) GetControl() *BatchControl

GetControl returns the current Batch Control

func (*IATBatch) GetEntries added in v0.3.0

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

GetEntries returns a slice of entry details for the batch

func (*IATBatch) GetHeader added in v0.3.0

func (batch *IATBatch) GetHeader() *IATBatchHeader

GetHeader returns the current Batch header

func (*IATBatch) SetControl added in v0.3.0

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

SetControl appends an BatchControl to the Batch

func (*IATBatch) SetHeader added in v0.3.0

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

SetHeader appends an BatchHeader to the Batch

func (*IATBatch) Validate added in v0.3.0

func (batch *IATBatch) Validate() error

Validate checks valid NACHA batch rules. Assumes properly parsed records.

type IATBatchHeader added in v0.3.0

type IATBatchHeader struct {
	// ID is a client defined string used as a reference to this record.
	ID string `json:"id"`

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

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

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

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

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

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

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

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

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

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

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

	// EffectiveEntryDate the date on which the entries are to settle format YYMMDD
	EffectiveEntryDate time.Time `json:"effectiveEntryDate,omitempty"`

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

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

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

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

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

func NewIATBatchHeader added in v0.3.0

func NewIATBatchHeader() *IATBatchHeader

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

func (*IATBatchHeader) BatchNumberField added in v0.3.0

func (iatBh *IATBatchHeader) BatchNumberField() string

BatchNumberField get the batch number zero padded

func (*IATBatchHeader) CalculateCheckDigit added in v0.3.0

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

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 (*IATBatchHeader) CompanyEntryDescriptionField added in v0.3.0

func (iatBh *IATBatchHeader) CompanyEntryDescriptionField() string

CompanyEntryDescriptionField gets the CompanyEntryDescription left padded

func (*IATBatchHeader) EffectiveEntryDateField added in v0.3.0

func (iatBh *IATBatchHeader) EffectiveEntryDateField() string

EffectiveEntryDateField get the EffectiveEntryDate in YYMMDD format

func (*IATBatchHeader) ForeignExchangeIndicatorField added in v0.3.0

func (iatBh *IATBatchHeader) ForeignExchangeIndicatorField() string

ForeignExchangeIndicatorField gets the ForeignExchangeIndicator

func (*IATBatchHeader) ForeignExchangeReferenceField added in v0.3.0

func (iatBh *IATBatchHeader) ForeignExchangeReferenceField() string

ForeignExchangeReferenceField gets the ForeignExchangeReference left padded

func (*IATBatchHeader) ForeignExchangeReferenceIndicatorField added in v0.3.0

func (iatBh *IATBatchHeader) ForeignExchangeReferenceIndicatorField() string

ForeignExchangeReferenceIndicatorField gets the ForeignExchangeReferenceIndicator

func (*IATBatchHeader) IATIndicatorField added in v0.3.0

func (iatBh *IATBatchHeader) IATIndicatorField() string

IATIndicatorField gets the IATIndicator left padded

func (*IATBatchHeader) ISODestinationCountryCodeField added in v0.3.0

func (iatBh *IATBatchHeader) ISODestinationCountryCodeField() string

ISODestinationCountryCodeField gets the ISODestinationCountryCode

func (*IATBatchHeader) ISODestinationCurrencyCodeField added in v0.3.0

func (iatBh *IATBatchHeader) ISODestinationCurrencyCodeField() string

ISODestinationCurrencyCodeField gets the ISODestinationCurrencyCode

func (*IATBatchHeader) ISOOriginatingCurrencyCodeField added in v0.3.0

func (iatBh *IATBatchHeader) ISOOriginatingCurrencyCodeField() string

ISOOriginatingCurrencyCodeField gets the ISOOriginatingCurrencyCode

func (*IATBatchHeader) ODFIIdentificationField added in v0.3.0

func (iatBh *IATBatchHeader) ODFIIdentificationField() string

ODFIIdentificationField get the odfi number zero padded

func (*IATBatchHeader) OriginatorIdentificationField added in v0.3.0

func (iatBh *IATBatchHeader) OriginatorIdentificationField() string

OriginatorIdentificationField gets the OriginatorIdentification left padded

func (*IATBatchHeader) Parse added in v0.3.0

func (iatBh *IATBatchHeader) Parse(record string)

Parse takes the input record string and parses the BatchHeader values

func (*IATBatchHeader) String added in v0.3.0

func (iatBh *IATBatchHeader) String() string

String writes the BatchHeader struct to a 94 character string.

func (*IATBatchHeader) Validate added in v0.3.0

func (iatBh *IATBatchHeader) Validate() error

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

type IATEntryDetail added in v0.3.0

type IATEntryDetail struct {
	// ID is a client defined string used as a reference to this record.
	ID string `json:"id"`

	// TransactionCode if the receivers account is:
	// Credit (deposit) to checking account ‘22’
	// Prenote for credit to checking account ‘23’
	// Debit (withdrawal) to checking account ‘27’
	// Prenote for debit to checking account ‘28’
	// Credit to savings account ‘32’
	// Prenote for credit to savings account ‘33’
	// Debit to savings account ‘37’
	// Prenote for debit to savings account ‘38’
	TransactionCode int `json:"transactionCode"`
	// RDFIIdentification is the RDFI's routing number without the last digit.
	// Receiving Depository Financial Institution
	RDFIIdentification string `json:"RDFIIdentification"`
	// CheckDigit the last digit of the RDFI's routing number
	CheckDigit string `json:"checkDigit"`
	// AddendaRecords is the number of Addenda Records
	AddendaRecords int `json:"AddendaRecords"`

	// Amount Number of cents you are debiting/crediting this account
	Amount int `json:"amount"`
	// DFIAccountNumber is the receiver's bank account number you are crediting/debiting.
	// It important to note that this is an alphanumeric field, so its space padded, no zero padded
	DFIAccountNumber string `json:"DFIAccountNumber"`

	// OFACSreeningIndicator - Leave blank
	OFACSreeningIndicator string `json:"OFACSreeningIndicator"`
	// SecondaryOFACSreeningIndicator - Leave blank
	SecondaryOFACSreeningIndicator string `json:"SecondaryOFACSreeningIndicator"`
	// AddendaRecordIndicator indicates the existence of an Addenda Record.
	// A value of "1" indicates that one or more addenda records follow,
	// and "0" means no such record is present.
	AddendaRecordIndicator int `json:"addendaRecordIndicator,omitempty"`
	// TraceNumber assigned by the ODFI in ascending sequence, is included in each
	// Entry Detail Record, Corporate Entry Detail Record, and addenda Record.
	// Trace Numbers uniquely identify each entry within a batch in an ACH input file.
	// 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.
	TraceNumber int `json:"traceNumber,omitempty"`
	// Addenda10 is mandatory for IAT entries
	//
	// The Addenda10 Record identifies the Receiver of the transaction and the dollar amount of
	// the payment.
	Addenda10 *Addenda10 `json:"addenda10,omitempty"`
	// Addenda11 is mandatory for IAT entries
	//
	// The Addenda11 record identifies key information related to the Originator of
	// the entry.
	Addenda11 *Addenda11 `json:"addenda11,omitempty"`
	// Addenda12 is mandatory for IAT entries
	//
	// The Addenda12 record identifies key information related to the Originator of
	// the entry.
	Addenda12 *Addenda12 `json:"addenda12,omitempty"`
	// Addenda13 is mandatory for IAT entries
	//
	// The Addenda13 contains information related to the financial institution originating the entry.
	// For inbound IAT entries, the Fourth Addenda Record must contain information to identify the
	// foreign financial institution that is providing the funding and payment instruction for
	// the IAT entry.
	Addenda13 *Addenda13 `json:"addenda13,omitempty"`
	// Addenda14 is mandatory for IAT entries
	//
	// The Addenda14 identifies the Receiving financial institution holding the Receiver's account.
	Addenda14 *Addenda14 `json:"addenda14,omitempty"`
	// Addenda15 is mandatory for IAT entries
	//
	// The Addenda15 record identifies key information related to the Receiver.
	Addenda15 *Addenda15 `json:"addenda15,omitempty"`
	// Addenda16 is mandatory for IAt entries
	//
	// Addenda16 record identifies additional key information related to the Receiver.
	Addenda16 *Addenda16 `json:"addenda16,omitempty"`
	// Addendum a list of Addenda for the Entry Detail.  For IAT the addendumer is currently being used
	// for the optional Addenda17 and Addenda18 records.
	// ToDo: Consider reverting Addenda* explicit properties back to being addendumer
	Addendum []Addendumer `json:"addendum,omitempty"`
	// Category defines if the entry is a Forward, Return, or NOC
	Category string `json:"category,omitempty"`
	// contains filtered or unexported fields
}

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

func NewIATEntryDetail added in v0.3.0

func NewIATEntryDetail() *IATEntryDetail

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

func (*IATEntryDetail) AddIATAddenda added in v0.3.0

func (ed *IATEntryDetail) AddIATAddenda(addenda Addendumer) []Addendumer

AddIATAddenda appends an Addendumer to the IATEntryDetail Currently this is used to add Addenda17 and Addenda18 IAT Addenda records

func (*IATEntryDetail) AddendaRecordsField added in v0.3.0

func (ed *IATEntryDetail) AddendaRecordsField() string

AddendaRecordsField returns a zero padded TraceNumber string

func (*IATEntryDetail) AmountField added in v0.3.0

func (ed *IATEntryDetail) AmountField() string

AmountField returns a zero padded string of amount

func (*IATEntryDetail) CalculateCheckDigit added in v0.3.0

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

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 (*IATEntryDetail) DFIAccountNumberField added in v0.3.0

func (ed *IATEntryDetail) DFIAccountNumberField() string

DFIAccountNumberField gets the DFIAccountNumber with space padding

func (*IATEntryDetail) OFACSreeningIndicatorField added in v0.3.0

func (ed *IATEntryDetail) OFACSreeningIndicatorField() string

OFACSreeningIndicatorField gets the OFACSreeningIndicator

func (*IATEntryDetail) Parse added in v0.3.0

func (ed *IATEntryDetail) Parse(record string)

Parse takes the input record string and parses the EntryDetail values

func (*IATEntryDetail) RDFIIdentificationField added in v0.3.0

func (ed *IATEntryDetail) RDFIIdentificationField() string

RDFIIdentificationField get the rdfiIdentification with zero padding

func (*IATEntryDetail) SecondaryOFACSreeningIndicatorField added in v0.3.0

func (ed *IATEntryDetail) SecondaryOFACSreeningIndicatorField() string

SecondaryOFACSreeningIndicatorField gets the SecondaryOFACSreeningIndicator

func (*IATEntryDetail) SetRDFI added in v0.3.0

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

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

func (*IATEntryDetail) SetTraceNumber added in v0.3.0

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

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

func (*IATEntryDetail) String added in v0.3.0

func (ed *IATEntryDetail) String() string

String writes the EntryDetail struct to a 94 character string.

func (*IATEntryDetail) TraceNumberField added in v0.3.0

func (ed *IATEntryDetail) TraceNumberField() string

TraceNumberField returns a zero padded TraceNumber string

func (*IATEntryDetail) Validate added in v0.3.0

func (ed *IATEntryDetail) Validate() error

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

type ParseError

type ParseError struct {
	Line   int    // Line number where the error occurred
	Record string // Name of the record type being parsed
	Err    error  // The actual error
}

ParseError is returned for parsing reader errors. The first line is 1.

func (*ParseError) Error

func (e *ParseError) Error() string

type Reader

type Reader struct {

	// file is ach.file model being built as r is parsed.
	File File

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

Reader reads records from a ACH-encoded file.

func NewReader

func NewReader(r io.Reader) *Reader

NewReader returns a new ACH Reader that reads from r.

func (*Reader) Read

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

Read reads each line of the ACH file and defines which parser to use based on the first character of each line. It also enforces ACH formatting rules and returns the appropriate error if issues are found.

type Writer

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

A Writer writes an ach.file to a NACHA encoded file.

As returned by NewWriter, a Writer writes ach.file structs into NACHA formatted files.

func NewWriter

func NewWriter(w io.Writer) *Writer

NewWriter returns a new Writer that writes to w.

func (*Writer) Flush

func (w *Writer) Flush() error

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

func (*Writer) Write

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

Writer writes a single ach.file record to w

Directories

Path Synopsis
cmd
readACH command
server command
writeACH command
test
ach-arc-read command
ach-arc-write command
ach-boc-read command
ach-boc-write command
ach-ccd-read command
ach-ccd-write command
ach-cie-read command
ach-cie-write command
ach-ctx-read command
ach-ctx-write command
ach-iat-read command
ach-iat-write command
ach-pop-read command
ach-pop-write command
ach-pos-read command
ach-pos-write command
ach-ppd-read command
ach-ppd-write command
ach-rck-read command
ach-rck-write command
ach-shr-read command
ach-shr-write command

Jump to

Keyboard shortcuts

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