Click here to Skip to main content
15,894,646 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am working on a project to do simple online authorizations for a customer. This requires that the end user enter in a buyer number, a seller number, and the amount of the sale (a description is OPTIONAL) in a web form. This information is then going to be compared to information that is stored in a comma delimited text file. We need to:
1. Check the buyer's number - valid or not (does it exist in the text file)

2. Check the seller's number - valid or not (does it exist in the text file)

3. Check the buyer's available balance - ((trade balance + credit line) - pending) transactions - if that amount is >= the amount of sale, then we authorize the transaction; if not, then we deny the transaction

4. If the transaction is authorized, we generate an authorization number - First 3 digits are the day of the year + 100, the last 3 digits are a sequential number starting at 500, going to 699, resetting these last 3 each day

5. Either way, we write out to a separate fixed length text file that is processed by the "accounting" system

Below are the details of the files. I need some "newbie" assistance in the best approach to do this with C# / ASP.NET. My thoughts were to read the entire file into an array of some sort each time the "Authorization" button was clicked, and then somehow search the array for the information we need to compare. Then, based on the information and comparisons, I would write the fixed length text file.

Suggestions and help are GREATLY appreciated.

Here is the layout for DW48843C.DAT (incoming file) – it is a comma delimited file.
Label – DW48843C.DAT

11920,"Advanced Roofing Systems, Inc ","0","0","2321",978.06,.00,.00,778.30,"1",3113.20," ","                          ",.00," "," "
11935,"Advertising Accents, Inc.     ","0","0","4628",7928.79,530.00,.00,76.39," ",.00," ","1-313-937-3636            ",.00,"B"," "

Client number (or debit card number)
Client name
No restrictions code
No authorizations code
Client PIN (default is 9898 for a debit card)
Current trade balance (available balance if debit card)
Credit line
Pending authorization purchases
Cash fees due
Temp no authorization code for fees (“D” if debit card)
Fee restricted amount
Temp no authorization code for status
Fax number (expiration date if debit card)
Pending authorization sales
Client rating code
No sales code

A fixed length ASCII file would need to be created with a label of DW488439.D The following is a sample of what this file would contain:

1234567890123456789012345678901234567890123456789012314567890
         1         2         3         4         5          6    
000000 0474300 04594 00/00/00 08-18-2012 000004283 2012  1
302327 1982800 12620 11/25/12 08-18-2012 000027900 2012
302329 1153600 18268 11/25/12 08-18-2012 000021200 2012
302331 6394800 64718 11/25/12 08-18-2012 000040000 2012

1– 6 – authorization number (zeros if declined)
8-12 – buyer account number
13-14 – optional card number (zeros if not used)
8-14 – full buyer card number (if used) or debit card number
16-20 – seller account number
22-29 – expiration date (zeros if declined)
31-40 – issued date
42-50 – dollar amount without decimal
52-54 – year
57-57 – 1 = declined (otherwise blank)
61-90 – optional description (not shown in above sample)

What it appears we have to do is read in the DW48843C.DAT file and use that as our comparison. If the authorization is good, we then generate an authorization number – first 3 digits are the day of the year + 100, followed by a sequential number starting at 500. The last three digits are RESET every day. So, for example, 12/17/2012 would have authorization numbers starting with 450 (day 350+100), like 450501. We would need to have to find a way to track what number was last generated for authorizations. We would write this information to DW488439.D (this is the file that is used for Internet authorizations). The TWOL resident program polls for the DW488431.D and DW488439.D files on a regular basis to keep the DW48843C.DAT file up to date, as well as keeping TradeWorks balances up to date.
Posted
Updated 21-Dec-12 5:42am
v2

1 solution

To read the CSV file I've used A Fast CSV Reader[^] here on CodeProject with great success. Writing the data back out should be easy.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900