UNPKG

@midlandsbank/node-nacha

Version:

NACHA ACH EFT File Parser/Formatter for CCD+ / PPD+ / CTX+

65 lines (59 loc) 1.56 kB
// Generated by CoffeeScript 1.11.1 var ctx, validate; let { web, ccd, ppd} = require('./batch-ccd-ppd-web') ctx = require('./batch-ctx'); validate = require('../validate'); let { toYYMMDD, toHHMM } = require('../../dates') module.exports = function(data) { var account, ach, base, key, next, now, ref2, ref3, ref4; if ((base = data["for"]).dfi == null) { base.dfi = data["for"].routing.slice(0, -1); } ref2 = data.to; for (key in ref2) { account = ref2[key]; account.dfi = account.routing.slice(0, -1); } if (data.from.fein.length === 9) { data.from.fein = ' ' + data.from.fein; } data.entryCount = 1; now = new Date; ach = { file: { recordType: '1', priority: (ref3 = data.priority) != null ? ref3 : 1, idModifier: (ref4 = data.idModifier) != null ? ref4 : 'A', recordSize: '094', blockingFactor: '10', formatCode: '1', creationDate: toYYMMDD(now), creationTime: toHHMM(now), origin: data.from.fein, destination: ' ' + data["for"].routing, originName: data.from.name, destinationName: data["for"].name, referenceCode: data.referenceCode, footer: { recordType: '9', lineCount: 2, blockCount: 1, batchCount: 0, entryAndAddendaCount: 0, entryHash: 0, totalDebit: 0, totalCredit: 0 } }, batches: [] }; next = { data: data, object: ach, ccd: ccd, ppd: ppd, web: web, validate: validate.bind(this, ach), }; return next; };