@rationalthinker1/eft-generator
v8.1.4
Published
Formats Electronic Funds Transfer (EFT) data into the CPA 005 standard.
Maintainers
Readme
EFT Generator for Node
Forked from cityssm/node-eft-generator.
Formats Electronic Funds Transfer (EFT) data into the CPA 005 standard.
Supports credit (C) and debit (D) record types. Other logical record types are not supported.
✔️ Output parsed successfully by BMO.
Installation
npm install @rationalthinker1/eft-generator
# or
yarn add @rationalthinker1/eft-generatorUsage
import fs from 'node:fs'
import { BankPADInformation, EFTFileBuilder } from '@rationalthinker1/eft-generator'
const { bankInstitution, bankTransit, bankAccount } = BankPADInformation
const eftFile = new EFTFileBuilder({
originatorId: '0123456789',
originatorShortName: 'SSM',
originatorLongName: 'The City of Sault Ste. Marie',
fileCreationNumber: '0001'
})
eftFile.addDebitTransaction({
bankInstitutionNumber: bankInstitution('003'), // RBC
bankTransitNumber: bankTransit('22222'),
bankAccountNumber: bankAccount('333333333'),
cpaCode: '385', // Property Taxes
amount: 1234.56,
payeeName: 'Test Property Owner'
})
// `generate()` runs the strict validator first; any spec violation
// throws before any output is written.
const { output, lines } = eftFile.generate()
fs.writeFileSync('cpa005.txt', output)output is the CPA-005 string. lines is a per-record breakdown — one
entry per logical record (header, each transaction, trailer). Each entry
maps every @Field-decorated property to { before, after }, where
before is the raw instance value coerced to a string and after is
the on-the-wire value rendered for that field. A transaction entry is a
flat array of its segments' field-value records.
The validator can also be invoked directly:
eftFile.validate() // returns void; throws on any violationResources
- Canadian Payments Association Standard 005
- Royal Bank CPA-005 Reference (RBC source)
- BMO Electronic Funds Transfer Client Manual
Related Projects
CPA Codes for Node Lookups, validations, and utility functions for Canadian Payments Association (CPA) Standard 007 transaction and return codes.
