-
Notifications
You must be signed in to change notification settings - Fork 7
/
payroll.ts
118 lines (114 loc) · 3.41 KB
/
payroll.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
import {RootObject,FileHeader,EntryDetail,BatchHeader} from "./achInterface"
import { ACHFilesApi, Configuration } from 'ach-node-sdk';
const configuration = new Configuration({ basePath: 'http://ach:8080' });
const achFilesApi = new ACHFilesApi(configuration);
let Example_BlogPost = {};
// Build the File Header
const fh: FileHeader = {
immediateOrigin: "123456780",
immediateOriginName: "My Bank Name",
immediateDestination: "071000301",
immediateDestinationName: "FRBATLANTA",
fileCreationDate: "190816", // dynamic, current day - YYMMDD. Y=Year, M=Month, D=Day
fileCreationTime: "1055", // dynamic, currnet day - HHmm. H=Hour, m=Minute;
fileIDModifier: 'M'
}
//Build the Batch Header
const bh = {
"ID": "0",
"serviceClassCode": 220,
"companyName": "MY_COMPANY_NAME", // Your company name
"companyDiscretionaryData": "123456789",
"companyIdentification": "1",
"standardEntryClassCode": "PPD",
"companyEntryDescription": "PURCHASE",
"companyDescriptiveDate": "string",
"effectiveEntryDate": "190102",
"ODFIIdentification": "12345678",
}
//Create Entry Detail
var entries = [];
const entry: EntryDetail = {
ID: 'a.NewEntryDetail(',
transactionCode: 22,
RDFIIdentification: '12345678',
DFIAccountNumber: "151",
amount: 2000, //Integer of amount per pay period
individualName: "YOUR_EMPLOYEE_NAME", //String name of employee
traceNumber: 'string',
addenda02: {
//This is where you put data for the addenda02
id: 'test',
typeCode: 'test',
referenceInformationOne: 'test',
referenceInformationTwo: 'test',
terminalIdentificationCode: 'test',
transactionSerialNumber: 'test',
transactionDate: '1220',
authorizationCodeOrExpireDate: 'test',
terminalLocation: 'test',
terminalCity: 'test',
terminalState: 'test',
traceNumber: 'test'
},
addenda05: [{
entryDetailSequenceNumber: 4,
id: '3',
paymentRelatedInformation: 'PRI',
sequenceNumber: 454,
typeCode: "TC"
}],
addendaRecordIndicator: 1,
checkDigit: "0",
discretionaryData: 'somedata',
identificationNumber: 'idnumber'
}
entries.push(entry);
// console.log(entries);
const id = (Math.random()+1) * 10000000000;
const body = JSON.stringify({
ID: id+'',
fileHeader: fh,
batches: [{
batchHeader: bh,
entryDetails: entries
}]
});
const xRequestID = "";
const xIdempotencyKey = "";
// ValidateOpts
const requireABAOrigin = undefined;
const bypassOrigin = undefined;
const bypassDestination = undefined;
const customTraceNumbers = undefined;
const allowZeroBatches = undefined;
const allowMissingFileHeader = undefined;
const allowMissingFileControl = undefined;
const bypassCompanyIdentificationMatch = undefined;
const customReturnCodes = undefined;
const unequalServiceClassCode = undefined;
// Request Options
const options = {
headers: {
"Content-Type": "application/json",
},
};
const testFile = achFilesApi.createFile(
body,
xRequestID,
xIdempotencyKey,
requireABAOrigin,
bypassOrigin,
bypassDestination,
customTraceNumbers,
allowZeroBatches,
allowMissingFileHeader,
allowMissingFileControl,
bypassCompanyIdentificationMatch,
customReturnCodes,
unequalServiceClassCode,
options,
).
then((id) => console.log(id.data))
.catch( err => console.log(err))
//