@fcgs/filerr-nach
Version:
nACH is a highly customizable Node.js module exposing a high & low-level API for generating ACH files for use within the ACH network
73 lines (55 loc) • 2.39 kB
TypeScript
import Batch from '../batch';
import ControlFields from './control';
import { HeaderFields } from './header';
export interface FileOptions {
header?: HeaderFields;
control?: ControlFields;
/** TThe nine-digit routing number of the institution receiving the ACH file for processing, preceded by a blank.
* Typically, this is your bank’s routing and transit number. */
immediateDestination?: string;
/** The nine-digit routing transit number of the institution sending (originating) the ACH file, preceded by a blank.
* (Often your ODFI will have you insert your company ID in this field.) */
immediateOrigin?: string;
fileCreationDate?: string;
fileCreationTime?: string;
/** Distinguishes individual Files when multiple Files are created on the same date.
* This value is reset to ‘A’ for the first File of the day and increment for each subsequent File. */
fileIdModifier?: string;
/** Name of the financial institution receiving the payment file.
* Max Length 23
*/
immediateDestinationName?: string;
/** Name of the financial institution sending the payment file.
* Max Length 23
*/
immediateOriginName?: string;
/** Optional field reserved for information pertinent to the Originator.
* Max Length 8
*/
referenceCode?: string;
batchSequenceNumber?: number;
}
export class File {
private _batches: Batch[];
header: HeaderFields;
control: ControlFields;
private _batchSequenceNumber: number;
constructor(options: FileOptions, autoValidate?: boolean);
get(field: string): string;
set(field: string, value: string): void;
private _validate(): void;
addBatch(batch: Batch): void;
getBatches(): Batch[];
generatePaddedRows(rows: number, cb: (paddedRows: string) => void): void;
generateBatches(done1: (result: string, rows: number) => void): void;
generateHeader(cb: (headerString: string) => void): void;
generateControl(cb: (controlString: string) => void): void;
generateFile(cb?: (err: any, str: string) => void): Promise<string>;
writeFile(path: string, cb: (err: any) => void): Promise<void>;
static parseFile(
filePath: string,
cb: (err: any, file: File) => void
): Promise<File>;
static parse(str: string, cb: (err: any, file: File) => void): Promise<File>;
}
export default File;