-
Notifications
You must be signed in to change notification settings - Fork 0
/
AddendaRecord.cs
411 lines (370 loc) · 13.8 KB
/
AddendaRecord.cs
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
using Newtonsoft.Json;
namespace NACHAParser
{
public class Addenda
{
#region Properties
[JsonProperty("addenda05Id")]
public string AddendaId { get; set; } = string.Empty;
[JsonProperty("recType")]
public RecordType RecType { get; set; }
[JsonProperty("addendaTypeCode")]
public AddendaTypeCode AdTypeCode { get; set; }
[JsonProperty("returnReasonCode")]
public ReturnCode ReturnReasonCode { get; set; } = ReturnCode.Unknown;
[JsonProperty("disHonorReturnReasonCode")]
public ReturnCode DisHonorReturnReasonCode { get; set; } = ReturnCode.Unknown;
[JsonProperty("contestedDisHonorReturnReasonCode")]
public ReturnCode ContestedDisHonorReturnReasonCode { get; set; } = ReturnCode.Unknown;
[JsonProperty("refusedCORCode")]
public ChangeCode RefusedCORCode { get; set; }
[JsonProperty("changeCode")]
public ChangeCode ChangeCode { get; set; }
[JsonProperty("corTraceSeqNum")]
public string CorTraceSeqNum { get; set; } = string.Empty;
[JsonProperty("paymtRelatedInfo")]
public string? PaymtRelatedInfo { get; set; }
[JsonProperty("addendaSeqNum")]
public string AddendaSeqNum { get; set; } = string.Empty;
[JsonProperty("entDetailSeqNum")]
public string EntDetailSeqNum { get; set; } = string.Empty;
[JsonProperty("dReturnReasonCode")]
public string DReturnReasonCode { get; set; } = string.Empty;
[JsonProperty("contestedReturnCode")]
public string CReturnReasonCode { get; set; } = string.Empty;
[JsonProperty("dateOriginalEntryReturned")]
public string DateOriginalEntryReturned { get; set; } = string.Empty;
[JsonProperty("originalSettlementDate")]
public string OriginalSettlementDate { get; set; } = string.Empty;
[JsonProperty("disHonrorReturnTraceNum")]
public string DisHonrorReturnTraceNum { get; set; } = string.Empty;
[JsonProperty("disHonrorReturnSettlementDate")]
public string DisHonrorReturnSettlementDate { get; set; } = string.Empty;
[JsonProperty("returnTraceNumber")]
public string ReturnTraceNum { get; set; } = string.Empty;
[JsonProperty("returnSettlementDate")]
public string ReturnSettlementDate { get; set; } = string.Empty;
[JsonProperty("origTraceNumber")]
public string OrigTraceNum { get; set; } = string.Empty;
[JsonProperty("dateOfDeath")]
public string DateOfDeath { get; set; } = string.Empty;
[JsonProperty("origReceivingDFIId")]
public string OrigReceivingDFIId { get; set; } = string.Empty;
[JsonProperty("addendaInfo")]
public string AddendaInfo { get; set; } = string.Empty;
[JsonProperty("addendaTraceNum")]
public string AdTraceNum { get; set; } = string.Empty;
[JsonProperty("correctedData")]
public string CorrectedData { get; set; } = string.Empty;
[JsonProperty("reserved1")]
public string Reserved1 { get; set; } = string.Empty;
[JsonProperty("reserved2")]
public string Reserved2 { get; set; } = string.Empty;
[JsonProperty("refInfo1")]
public string RefInfo1 { get; set; } = string.Empty;
[JsonProperty("refInfo2")]
public string RefInfo2 { get; set; } = string.Empty;
[JsonProperty("terminalIDCode")]
public string TerminalIDCode { get; set; } = string.Empty;
[JsonProperty("transSerialNumber")]
public string TransSerialNum { get; set; } = string.Empty;
[JsonProperty("transactionDate")]
public string TransDate { get; set; } = string.Empty;
[JsonProperty("authCodeOrExpDate")]
public string AuthCodeOrExpDate { get; set; } = string.Empty;
[JsonProperty("terminalLocation")]
public string TerminalLoc { get; set; } = string.Empty;
[JsonProperty("terminalCity")]
public string TerminalCity { get; set; } = string.Empty;
[JsonProperty("terminalState")]
public string TerminalState { get; set; } = string.Empty;
[JsonProperty("transactionDescription")]
public string TransDescription { get; set; } = string.Empty;
[JsonProperty("networkIdCode")]
public string NetworkIdCode { get; set; } = string.Empty;
[JsonProperty("transactionTIme")]
public string TransTime { get; set; } = string.Empty;
#endregion
#region Constructors
public Addenda()
{
AddendaId = Guid.NewGuid().ToString();
Console.WriteLine($"AddendaId: '{AddendaId}'");
}
#endregion
#region Methods
public static AddendaTypeCode ParseAddendaType(string value)
{
switch (value)
{
case "02":
return AddendaTypeCode.Addenda02;
case "05":
return AddendaTypeCode.Addenda05;
case "98":
return AddendaTypeCode.Addenda98;
case "99":
return AddendaTypeCode.Addenda99;
default:
throw new InvalidOperationException($"Addenda Type Code '{value}' is not supported");
}
}
public bool IsContestedDishonor(EntryDetailRecord entry, ReturnCode rc)
{
bool isDishonorReturnCode = IsRCContestedReturnCode(rc);
bool isDishonorTransactionCode = entry.IsTransCodeReturnOrNOC();
if (isDishonorReturnCode && isDishonorTransactionCode == true)
{
return true;
}
else
{
return false;
}
}
public bool IsRCContestedReturnCode(ReturnCode rc)
{
switch (rc)
{
case ReturnCode.R71:
case ReturnCode.R72:
case ReturnCode.R73:
case ReturnCode.R74:
case ReturnCode.R75:
case ReturnCode.R76:
case ReturnCode.R77:
return true;
default:
return false;
}
}
public bool IsDisHonor(EntryDetailRecord entry, ReturnCode rc)
{
bool isDishonorReturnCode = IsRCDishonorReturnCode(rc);
bool isDishonorTransactionCode = entry.IsTransCodeReturnOrNOC();
if (isDishonorReturnCode && isDishonorTransactionCode == true)
{
return true;
}
else
{
return false;
}
}
public bool IsRCDishonorReturnCode(ReturnCode rc)
{
switch (rc)
{
case ReturnCode.R61:
case ReturnCode.R62:
case ReturnCode.R67:
case ReturnCode.R68:
case ReturnCode.R69:
case ReturnCode.R70:
case ReturnCode.R77:
return true;
default:
return false;
}
}
public bool IsRefusedCORCode(ChangeCode cc)
{
switch (cc)
{
case ChangeCode.C61:
case ChangeCode.C62:
case ChangeCode.C63:
case ChangeCode.C64:
case ChangeCode.C65:
case ChangeCode.C66:
case ChangeCode.C67:
case ChangeCode.C68:
case ChangeCode.C69:
return true;
default:
return false;
}
}
public ChangeCode ParseChangeCode(string value)
{
switch (value)
{
case "C01":
return ChangeCode.C01;
case "C02":
return ChangeCode.C02;
case "C03":
return ChangeCode.C03;
case "C05":
return ChangeCode.C05;
case "C06":
return ChangeCode.C06;
case "C07":
return ChangeCode.C07;
case "C08":
return ChangeCode.C08;
case "C09":
return ChangeCode.C09;
case "C13":
return ChangeCode.C13;
case "C14":
return ChangeCode.C14;
case "C61":
return ChangeCode.C61;
case "C62":
return ChangeCode.C62;
case "C63":
return ChangeCode.C63;
case "C64":
return ChangeCode.C64;
case "C65":
return ChangeCode.C65;
case "C66":
return ChangeCode.C66;
case "C67":
return ChangeCode.C67;
case "C68":
return ChangeCode.C68;
case "C69":
return ChangeCode.C69;
default:
throw new ArgumentException($"'{value}' is not a valid ChangeCode.");
}
}
public ReturnCode ParseReturnCode(string value)
{
switch (value)
{
case "R01":
return ReturnCode.R01;
case "R02":
return ReturnCode.R02;
case "R03":
return ReturnCode.R03;
case "R04":
return ReturnCode.R04;
case "R05":
return ReturnCode.R05;
case "R06":
return ReturnCode.R06;
case "R07":
return ReturnCode.R07;
case "R08":
return ReturnCode.R08;
case "R09":
return ReturnCode.R09;
case "R10":
return ReturnCode.R10;
case "R11":
return ReturnCode.R11;
case "R12":
return ReturnCode.R12;
case "R13":
return ReturnCode.R13;
case "R14":
return ReturnCode.R14;
case "R15":
return ReturnCode.R15;
case "R16":
return ReturnCode.R16;
case "R17":
return ReturnCode.R17;
case "R18":
return ReturnCode.R18;
case "R19":
return ReturnCode.R19;
case "R20":
return ReturnCode.R20;
case "R21":
return ReturnCode.R21;
case "R22":
return ReturnCode.R22;
case "R23":
return ReturnCode.R23;
case "R24":
return ReturnCode.R24;
case "R25":
return ReturnCode.R25;
case "R26":
return ReturnCode.R26;
case "R27":
return ReturnCode.R27;
case "R28":
return ReturnCode.R28;
case "R29":
return ReturnCode.R29;
case "R30":
return ReturnCode.R30;
case "R31":
return ReturnCode.R31;
case "R32":
return ReturnCode.R32;
case "R33":
return ReturnCode.R33;
case "R34":
return ReturnCode.R34;
case "R35":
return ReturnCode.R35;
case "R36":
return ReturnCode.R36;
case "R37":
return ReturnCode.R37;
case "R38":
return ReturnCode.R38;
case "R39":
return ReturnCode.R39;
case "R40":
return ReturnCode.R40;
case "R41":
return ReturnCode.R41;
case "R42":
return ReturnCode.R42;
case "R43":
return ReturnCode.R43;
case "R44":
return ReturnCode.R44;
case "R45":
return ReturnCode.R45;
case "R46":
return ReturnCode.R46;
case "R47":
return ReturnCode.R47;
case "R50":
return ReturnCode.R50;
case "R51":
return ReturnCode.R51;
case "R52":
return ReturnCode.R52;
case "R53":
return ReturnCode.R53;
case "R61":
return ReturnCode.R61;
case "R62":
return ReturnCode.R62;
case "R67":
return ReturnCode.R67;
case "R68":
return ReturnCode.R68;
case "R69":
return ReturnCode.R69;
case "R70":
return ReturnCode.R70;
case "R71":
return ReturnCode.R71;
case "R72":
return ReturnCode.R72;
case "R73":
return ReturnCode.R73;
case "R75":
return ReturnCode.R75;
case "R76":
return ReturnCode.R76;
case "R77":
return ReturnCode.R77;
default:
throw new ArgumentException($"'{value}' is not a valid ReturnCode.");
}
}
#endregion
}
}