-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConversion.cs
More file actions
232 lines (230 loc) · 11.4 KB
/
Copy pathConversion.cs
File metadata and controls
232 lines (230 loc) · 11.4 KB
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
using System;
namespace ACH2JSON
{
class Conversion : mainWindow
{
CreateJSON cjn = new CreateJSON();
public int PaymentCount { get; set; }
public int AddendaCount { get; set; }
public void getFilePath(string o)
{
cjn.damnFilePath = o;
//Console.WriteLine("your file path is: " + o);
}
public string SECResult { get; set; }
public void FHRConv(string p)
{
//begin the redundancy!
//TODO just get rid of the string declarations and directly call the createjson getsets
string FHRLine = p;
string FHRRTC = p.Substring(0, 1);
cjn.FHRRecordTypeCode = FHRRTC;
string FHRPC = p.Substring(1, 2);
cjn.FHRPriorityCode = FHRPC;
string FHRID = p.Substring(3, 10);
cjn.FHRImmediateDestination = FHRID;
string FHRIO = p.Substring(13, 10);
cjn.FHRImmediateOrigin = FHRIO;
string FHRFCD = p.Substring(23, 6);
cjn.FHRFileCreationDate = FHRFCD;
string FHRFCT = p.Substring(29, 4);
cjn.FHRFileCreationTime = FHRFCT;
string FHRFIM = p.Substring(33, 1);
cjn.FHRFileIDModifier = FHRFIM;
string FHRRS = p.Substring(34, 3);
cjn.FHRRecordSize = FHRRS;
string FHRBF = p.Substring(37, 2);
cjn.FHRBlockingFactor = FHRBF;
string FHRFC = p.Substring(39, 1);
cjn.FHRFormatCode = FHRFC;
string FHRIDN = p.Substring(40, 23);
cjn.FHRImmediateDestinationName = FHRIDN;
string FHRION = p.Substring(63, 23);
cjn.FHRImmediateOriginName = FHRION;
string FHRRC = p.Substring(86, 8);
cjn.FHRReferenceCode = FHRRC;
cjn.CreateThatFile(1);
}
public int BHRConv(string q)
{
string BHRLine = q;
string SEC = q.Substring(50, 3);
int result;
cjn.BHRRecordTypeCode = q.Substring(0, 1);
cjn.BHRServiceClassCode = q.Substring(1, 3);
cjn.BHRCompanyName = q.Substring(4, 16);
cjn.BHRCompanyDiscretionaryData = q.Substring(20, 20);
cjn.BHRCompanyIdentification = q.Substring(40, 10);
cjn.BHRStandardEntryClassCode = q.Substring(50, 3);
cjn.BHRCompanyEntryDescription = q.Substring(53, 10);
cjn.BHRCompanyDescriptiveDate = q.Substring(63, 6);
cjn.BHREffectiveEntryDate = q.Substring(69, 6);
cjn.BHRSettlementDate = q.Substring(75, 3);
cjn.BHROriginatorStatusCode = q.Substring(78, 1);
cjn.BHROriginatingDFIIdentification = q.Substring(79, 8);
cjn.BHRBatchNumber = q.Substring(87, 7);
cjn.CreateThatFile(2);
//here's the determination of further conversion...
if (SEC == "CTX")
{
Console.WriteLine("CTX file found...");
SECResult = "CTX";
result = 1;
return result;
} else if(SEC == "CCD")
{
Console.WriteLine("CCD file found...");
SECResult = "CCD";
result = 2;
return result;
} else if(SEC == "PPD")
{
SECResult = "PPD";
Console.WriteLine("PPD file found...");
result = 3;
return result;
} else if(SEC == "TEL")
{
Console.WriteLine("TEL file found...");
SECResult = "TEL";
result = 4;
return result;
} else if(SEC == "WEB")
{
Console.WriteLine("WEB file found...");
SECResult = "WEB";
result = 5;
return result;
} else
{
return 9;
}
}
public void PEConv(string r)
{
if (SECResult == "PPD")
{
Console.WriteLine("PPD Conversion Started...");
cjn.PaymentCount = PaymentCount;
cjn.PPDRecordTypeCode = r.Substring(0, 1);
cjn.PPDTransactionCode = r.Substring(1, 2);
cjn.PPDReceivingDFIIdentification = r.Substring(3, 8);
cjn.PPDCheckDigit = r.Substring(11, 1);
cjn.PPDDFIAccountNumber = r.Substring(12, 17);
cjn.PPDAmount = r.Substring(29, 10);
cjn.PPDIndividualIdentificationNumber = r.Substring(39, 15);
cjn.PPDIndividualName = r.Substring(54, 22);
cjn.PPDDiscretionaryData = r.Substring(76, 2);
cjn.PPDAddendaRecordIndicator = r.Substring(78, 1);
cjn.PPDTraceNumber = r.Substring(79, 15);
cjn.CreateThatFile(3);
} else if(SECResult == "CTX")
{
Console.WriteLine("CTX Conversion Started...");
cjn.PPDRecordTypeCode = r.Substring(0, 1); //RecordTypeCode
cjn.PPDTransactionCode = r.Substring(1, 2); //Transaction Code
cjn.PPDReceivingDFIIdentification = r.Substring(3, 8); //ReceivingDFIIdentification
cjn.PPDCheckDigit = r.Substring(11, 1); //CheckDigit
cjn.PPDDFIAccountNumber = r.Substring(12, 17); //DFIAccountNumber
cjn.PPDAmount = r.Substring(29, 10); //TotalAmount
cjn.PPDIndividualIdentificationNumber = r.Substring(39, 15); //IdentificationNumber
cjn.PPDIndividualName = r.Substring(54, 4); //NumberOfAddendaRecords
cjn.PPDDiscretionaryData = r.Substring(58, 16); //ReceivingCompanyName
cjn.PPDAddendaRecordIndicator = r.Substring(74, 2); //Reserved
cjn.PPDTraceNumber = r.Substring(76, 2); //DiscretionaryData
cjn.CTXField12 = r.Substring(78, 1); //AddendaRecordIndicator
cjn.CTXField13 = r.Substring(79, 15); //TraceNumber
cjn.CreateThatFile(4);
} else if(SECResult == "CCD")
{
Console.WriteLine("CCD Conversion Started...");
cjn.PPDRecordTypeCode = r.Substring(0, 1); //RecordTypeCode
cjn.PPDTransactionCode = r.Substring(1, 2); //Transaction Code
cjn.PPDReceivingDFIIdentification = r.Substring(3, 8); //ReceivingDFIIdentification
cjn.PPDCheckDigit = r.Substring(11, 1); //CheckDigit
cjn.PPDDFIAccountNumber = r.Substring(12, 17); //DFIAccountNumber
cjn.PPDAmount = r.Substring(29, 10); //Amount
cjn.PPDIndividualIdentificationNumber = r.Substring(39, 15); //IdentificationNumber
cjn.PPDIndividualName = r.Substring(54, 22); //ReceivingCompanyName
cjn.PPDDiscretionaryData = r.Substring(76, 2); //DiscretionaryData
cjn.PPDAddendaRecordIndicator = r.Substring(78, 1); //AddendaRecordIndicator
cjn.PPDTraceNumber = r.Substring(79, 15); //TraceNumber
cjn.CreateThatFile(5);
} else if(SECResult == "TEL")
{
Console.WriteLine("TEL conversion started...");
cjn.PPDRecordTypeCode = r.Substring(0, 1); //RecordTypeCode
cjn.PPDTransactionCode = r.Substring(1, 2); //Transaction Code
cjn.PPDReceivingDFIIdentification = r.Substring(3, 8); //ReceivingDFIIdentification
cjn.PPDCheckDigit = r.Substring(11, 1); //CheckDigit
cjn.PPDDFIAccountNumber = r.Substring(12, 17); //DFIAccountNumber
cjn.PPDAmount = r.Substring(29, 10); //Amount
cjn.PPDIndividualIdentificationNumber = r.Substring(39, 15); //IndividualIdentificationNumber
cjn.PPDIndividualName = r.Substring(54, 22); //IndividualName
cjn.PPDDiscretionaryData = r.Substring(76, 2); //DiscretionaryData
cjn.PPDAddendaRecordIndicator = r.Substring(78, 1); //AddendaRecordIndicator
cjn.PPDTraceNumber = r.Substring(79, 15); //TraceNumber
cjn.CreateThatFile(6);
} else if(SECResult == "WEB")
{
Console.WriteLine("WEB conversion started...");
cjn.PPDRecordTypeCode = r.Substring(0, 1); //RecordTypeCode
cjn.PPDTransactionCode = r.Substring(1, 2); //Transaction Code
cjn.PPDReceivingDFIIdentification = r.Substring(3, 8); //ReceivingDFIIdentification
cjn.PPDCheckDigit = r.Substring(11, 1); //CheckDigit
cjn.PPDDFIAccountNumber = r.Substring(12, 17); //DFIAccountNumber
cjn.PPDAmount = r.Substring(29, 10); //Amount
cjn.PPDIndividualIdentificationNumber = r.Substring(39, 15); //IdentificationNumber
cjn.PPDIndividualName = r.Substring(54, 22); //ReceivingCompanyName
cjn.PPDDiscretionaryData = r.Substring(76, 2); //PaymentTypeCode
cjn.PPDAddendaRecordIndicator = r.Substring(78, 1); //AddendaRecordIndicator
cjn.PPDTraceNumber = r.Substring(79, 15); //TraceNumber
cjn.CreateThatFile(7);
} else
{
Console.WriteLine("FORMAT NOT DEFINED");
//catch them errors boi
}
}
public void ARConv(string s) //TODO - parse addenda records
{
Console.WriteLine("Addenda Conversion Started...");
cjn.AddendaCount = AddendaCount;
cjn.AddendaRecordTypeCode = s.Substring(0, 1);
cjn.AddendaAddendaTypeCode = s.Substring(1, 2);
cjn.AddendaPaymentRelatedInformation = s.Substring(3, 80);
cjn.AddendaAddendaSequenceNumber = s.Substring(83, 4);
cjn.AddendaEntrySequenceNumber = s.Substring(87, 7);
cjn.CreateThatFile(10);
}
public void BCRConv(string t)
{
Console.WriteLine("Batch Control Record Conversion Started...");
cjn.BCRRecordTypeCode = t.Substring(0, 1);
cjn.BCRServiceClassCode = t.Substring(1, 3);
cjn.BCREntryAddendaCount = t.Substring(4, 6);
cjn.BCREntryHash = t.Substring(10, 10);
cjn.BCRTotalDebitEntryAmt = t.Substring(20, 12);
cjn.BCRTotalCreditEntryAmt = t.Substring(32, 12);
cjn.BCRCompanyIdentification = t.Substring(44, 10);
cjn.BCRMessageAuthCode = t.Substring(54, 19);
cjn.BCRReserved = t.Substring(73, 6);
cjn.BCROriginatingDFIIdentification = t.Substring(79, 8);
cjn.BCRBatchNumber = t.Substring(87, 7);
cjn.CreateThatFile(8);
}
public void FCRConv(string u)
{
Console.WriteLine("File Control Record Conversion Started...");
cjn.FCRRecordTypeCode = u.Substring(0, 1);
cjn.FCRBatchCount = u.Substring(1, 6);
cjn.FCRBlockCount = u.Substring(7, 6);
cjn.FCREntryAddendaCount = u.Substring(13, 8);
cjn.FCREntryHash = u.Substring(21, 10);
cjn.FCRTotalDebitEntryAmt = u.Substring(31, 12);
cjn.FCRTotalCreditEntryAmt = u.Substring(43, 12);
cjn.FCRReserved = u.Substring(55, 39);
cjn.CreateThatFile(9);
}
}
}