public PrintecResponse ParseEFTTransactionResponse(string[] msg) { var index = msg.Length; var result = new PrintecResponse(); var sepDecimal = Convert.ToChar(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator); result.SystemId = Helper.TryParse <string>(msg[0], 32, ref index); result.TransactionType = Helper.TryParse <string>(!string.IsNullOrEmpty(msg[1])?msg[1].Substring(0, 2):"", 2, ref index); result.NOInstallments = Helper.TryParse <int>(!string.IsNullOrEmpty(msg[1])?msg[1].Substring(2, 2):"", 2, "00", ref index); result.NoOfPostdatedMonths = Helper.TryParse <int>(!string.IsNullOrEmpty(msg[1]) ? msg[1].Substring(4, 2):"", 2, "00", ref index); result.TerminalIdentification = Helper.TryParse <string>(!string.IsNullOrEmpty(msg[1]) ? msg[1].Substring(6, 12):"", 12, ref index); result.BatchNumber = Helper.TryParse <string>(msg[2], 3, ref index); result.ResponseCode = Helper.TryParse <string>(msg[3], 2, ref index); result.OriginalAmountOrBatchTotalNetAmount = Helper.TryParseDecimal <decimal>(!string.IsNullOrEmpty(msg[4])?msg[4].Substring(1):"", 11, sepDecimal, 'V', ref index); result.LoyaltyRedemptionIndicator = Helper.TryParse <bool>(msg[5], 1, ref index); result.ModifiedAmount = Helper.TryParseDecimal <decimal>(msg[6], 10, sepDecimal, 'V', ref index); result.RetrievalReferenceNumber = Helper.TryParse <string>(msg[7], 12, ref index); result.TransReferNumberOrBatchTotalCounter = Helper.TryParse <string>(msg[8], 4, ref index); result.AuthCode = Helper.TryParse <string>(msg[9], 6, ref index); result.AccountNumber = Helper.TryParse <string>(msg[10], 40, ref index); result.ExpirationDate = Helper.TryParse <DateTime>(msg[11], 4, "yyMM", ref index); result.CardholderName = Helper.TryParse <string>(msg[12], 80, ref index); result.DCCTransactionAmount = Helper.TryParseDecimal <decimal>(msg[13], 10, sepDecimal, 'V', ref index); result.DCCCurrency = Helper.TryParse <string>(msg[14], 3, ref index); result.DCCExchangeRateMarkUp = Helper.TryParseDecimal <decimal>(msg[15], 10, sepDecimal, 'V', ref index); result.DCCMarkUpPercentage = Helper.TryParseDecimal <decimal>(msg[16], 10, sepDecimal, 'V', ref index); result.DCCExchangeDateOfRate = Helper.TryParse <DateTime>(msg[17], 4, "ddMM", ref index); result.ResponseTextMessage = Helper.TryParse <string>(msg[18], 200, ref index); result.CardProductName = Helper.TryParse <string>(msg[19], 24, ref index); result.OriginalResponseCode = Helper.TryParse <string>(msg[20], 3, ref index); result.FirstInstallmentDate = Helper.TryParse <DateTime>(msg[21], 6, "ddMMyy", ref index); result.NetAmount = Helper.TryParseDecimal <decimal>(msg[22], 10, sepDecimal, 'V', ref index); result.TransactionReceiptTicket = Helper.TryParse <string>(msg[23], 2499, ref index); result.BatchStatus = Helper.TryParse <bool>(msg[24], 1, ref index); result.CurrencyCode = Helper.TryParse <string>(msg[25], 3, ref index); result.LoyaltyBalance = Helper.TryParse <string>(msg[26], 12, ref index); result.LoyaltyTransactionPoint = Helper.TryParse <string>(msg[27], 12, ref index); result.LoyaltyTransReferenceNo = Helper.TryParse <string>(msg[28], 4, ref index); result.PanEncrypted = Helper.TryParse <string>(msg[29], 512, ref index); result.Track2Data = Helper.TryParse <string>(msg[30], 40, ref index); result.PINValue = Helper.TryParse <string>(msg[31], 16, ref index); result.KilometresIndicator = Helper.TryParse <string>(msg[32], 16, ref index); result.GiftBalance = Helper.TryParse <string>(msg[33], 12, ref index); result.GiftTransRefNo = Helper.TryParse <string>(msg[34], 4, ref index); result.TransCVMResult = Helper.TryParse <bool>(msg[35], 1, ref index); result.BOCLoyaltyItems = Helper.TryParse <string>(msg[36], 1990, ref index); result.IsBOCLoyaltyTransaction = Helper.TryParse <bool>(msg[37], 1, ref index); result.BOCLoyaltyPointsEarned = Helper.TryParse <string>(msg[38], 10, ref index); result.MerchantDiscount = Helper.TryParse <string>(msg[39], 10, ref index); result.VoucherDiscount = Helper.TryParse <string>(msg[40], 10, ref index); result.BOCRedemptionAmount = Helper.TryParse <string>(msg[41], 10, ref index); result.CashbackAmount = Helper.TryParseDecimal <decimal>(msg[42], 10, sepDecimal, 'V', ref index); return(result); }
private GenericResponse BuildVoidResponse(GenericResponse response, string responseString) { var resObj = new PrintecResponse(); string[] valuesArray; valuesArray = responseString.Split((char)0x1C); //resObj.SystemId = valuesArray[0]; //resObj.TransactionType = valuesArray[1]; //resObj.NOInstallments = Int32.Parse(valuesArray[2]); //resObj.NoOfPostdatedMonths = Int32.Parse(valuesArray[3]); //resObj.TerminalIdentification = valuesArray[4]; //resObj.BatchNumber = Int32.Parse(valuesArray[5]); //resObj.ResponseCode = valuesArray[6]; //resObj.LoyaltyRedemptionIndicator = bool.Parse(valuesArray[8]); //resObj.ModifiedAmount = decimal.Parse(valuesArray[9]); //resObj.RetrievalReferenceNumber = valuesArray[10]; //resObj.TransReferNumberOrBatchTotalCounter = valuesArray[11]; //resObj.AuthCode = valuesArray[12]; //resObj.AccountNumber = valuesArray[13]; //resObj.ExpirationDate = DateTime.Parse(valuesArray[14]); //resObj.CardholderName = valuesArray[15]; //resObj.DCCTransactionAmount = valuesArray[16]; //resObj.DCCCurrency = valuesArray[17]; //resObj.DCCMarkUpPercentage = valuesArray[19]; //resObj.DCCExchangeDateOfRate = valuesArray[18]; //resObj.ResponseTextMessage = valuesArray[20]; //resObj.CardProductName = valuesArray[21]; //resObj.OriginalResponseCode = valuesArray[23]; //resObj.FirstInstallmentDate = DateTime.Parse(valuesArray[22]); //resObj.NetAmount = valuesArray[24]; //resObj.TransactionReceiptTicket = valuesArray[25]; //resObj.CurrencyCode = valuesArray[26]; //resObj.PanEncrypted = valuesArray[27]; //resObj.TransCVMResult = valuesArray[28]; //resObj.BOCLoyaltyItems = valuesArray[29]; response.Result.ResponseCode = resObj.ResponseCode; return(response); }
public GenericResponse BuildPaymentResponse(GenericResponse response, PrintecResponse res) { response.Result.ResponseCode = res.ResponseCode; response.Result.ResponseContent = res.TransactionReceiptTicket; return(response); }