public void TestMessageHelper() { const string str = "<STX>00000000td2W0 <FS>S9218163 <FS>11<FS>4892<FS>4089670000392726=17112011000017980000<FS>00008900<FS>00000200<FS>76728398F76ED27D<FS><FS><FS>VA6.00.12WV02.70.10 V06.01.12 0 0T 00 100 00000302K0288000000002K028800000000000000000000000000000000000000<FS><FS><FS><ETX>"; byte[] rawMessageBytes = _baseMessageHelper.BuildMessageBytes(str); // Bulid byte string[] results = _baseMessageHelper.BuildMsgFromAtm(rawMessageBytes); var t1 = results[0].Substring(0, 8); var t2 = results[0].Substring(8, 2); var t3 = results[0].Substring(10, 2); var t4 = results[0].Substring(12, 1); var t5 = results[0].Substring(13, 7); }
public BaseModel CreateAtmRequest(byte[] bytes) { try { string request = _helper.AsciiOctets2String(bytes); _log.Debug(request); string[] results = _helper.BuildMsgFromAtm(bytes); switch (results[2]) { case "11": // Cash Withdrawal from primary checking account case "12": // Cash Withdrawal from primary savings account case "15": // Cash Withdrawal from primary credit card account case "31": // Primary cheque account balance inquiry case "32": // Primary Savings account balance inquiry case "35": // Primary Credit card balance inquiry return(new TransactionModel().Create(results, request)); case "60": // Download configuration table return(new ConfigModel().Create(results, request)); case "50": // Get host totals (do not change business day or reset totals) case "51": // Get host totals (Change business date and reset totals) return(new HostTotalModel().Create(results, request)); case "29": // Reverse Previous Withdrawal (Reversal Message ) return(new ReversalModel().Create(results, request)); default: throw new InvalidOperationException("Request message error => Transaction code not found"); } } catch (Exception) { throw new FormatException("Invalid ATM Request format"); } }