public static bool AddTransaction(CISSB.TransactionInfoResponse response, CISSB.TransactionInfoRequest request, string RequestType, string STAN1, string CardNo) { try { bool IsAdded = false; using (var db = new SoneriCISEntities()) { tbl_transactions t = new tbl_transactions(); t.Narration = request.TransactionNarration; t.Amount = double.Parse(request.TransactionAmount.ToString()); t.DebitAccountNo = request.DrCustomerAccountNumber; t.CreditAccountNo = request.CrCustomerAccountNumber; t.RequestType = RequestType; t.STAN = STAN1.Substring(3, STAN1.Length - 3);//STAN1; t.ResponseCode = response.ResponseCode; t.ResponseCodeDescription = response.ResponseCodeDescription; t.BranchCode = response.TransactionBranchCode; t.TransactionDateTime = DateTime.Now; t.TransactionIdNo = response.TransactionIdentificationNo; t.TransactionRefNo = CardNo; db.tbl_transactions.Add(t); db.SaveChanges(); IsAdded = true; FileHelper.RecoveryErrorLog("Income Transaction DB Insert", "Response Code:" + response.ResponseCode + "Response Desc:" + response.ResponseCodeDescription + "FT: " + response.TransactionIdentificationNo + "STAN:" + STAN1 + "FT:" + response.TransactionIdentificationNo, "Status:" + IsAdded, new System.Diagnostics.StackTrace(true).GetFrame(0).GetFileLineNumber().ToString()); } return(IsAdded); } catch (Exception ex) { return(false); } }
public static bool AddTransaction(CISSB.TransactionInfoResponse response, CISSB.TransactionInfoRequest request, string RequestType, string STAN1) { try { bool IsAdded = true; using (var db = new SoneriCISEntities()) { tbl_transactions t = new tbl_transactions(); t.Narration = request.TransactionNarration; t.Amount = double.Parse(request.TransactionAmount.ToString()); t.DebitAccountNo = request.DrCustomerAccountNumber; t.CreditAccountNo = request.CrCustomerAccountNumber; t.RequestType = RequestType; t.STAN = STAN1; t.ResponseCode = response.ResponseCode; t.ResponseCodeDescription = response.ResponseCodeDescription; t.BranchCode = response.TransactionBranchCode; t.TransactionDateTime = DateTime.Now; t.TransactionIdNo = response.TransactionIdentificationNo; t.TransactionRefNo = response.TransactionRefNo; db.tbl_transactions.Add(t); db.SaveChanges(); } return(IsAdded); } catch (Exception ex) { return(false); } }
public static CISSB.TransactionInfoResponse DebitTransaction(string DrCustomerAccountNumber, decimal TransactionAmount, string TransactionNarration, string RequestType, string RequestId, int LstCount) { string STAN1 = Core.Methods.CommonMethods.GetUniqueSTAN(RequestId, LstCount, RequestType); CISSB.TransactionInfoRequest request = new CISSB.TransactionInfoRequest(); CISSB.TransactionInfoResponse response = new CISSB.TransactionInfoResponse(); CISSB.BEAPITransactionService cis = new CISSB.BEAPITransactionService(); cis.BEAPIAuthHeaderValue = GetHeader(); request.TransactionDate = DateTime.Now; request.TransactionBranchCode = "0002"; request.STAN = STAN1; //Transaction No auto increnment with seed value 10001; request.TransactionType = "401201"; //Transaction Type tbp by SBL; request.DrCustomerAccountNumber = DrCustomerAccountNumber; //"20001266498"; //Debit AccountNumber of Card Holder; request.CrCustomerAccountNumber = "20000520676"; //"00022050684877";//"000220000000419";//"20000000389";//"20000404951"; ///Account Number to which the amount will be credited; request.InstrumentType = "0022"; //tbp by SBL; request.TransactionAmount = TransactionAmount; // TransactionAmount; request.InstrumentDate = DateTime.Now;; request.OrginatingTranIdentNo = 401201; //tbp by SBL same as transaction type; request.Currency = "PKR"; //transaction.Currency; request.Authorization = "0"; //(0 fro authorized payment) transaction.Authorization; request.TransactionNarration = !string.IsNullOrEmpty(TransactionNarration) ? TransactionNarration.Length >= 16 ? TransactionNarration.Substring(0, 16) : TransactionNarration : string.Empty; //Description of charges response = cis.DoTransactions(request); AddTransaction(response, request, RequestType, STAN1); return(response); }
public static CISSB.TransactionInfoResponse DebitTransaction(string DrCustomerAccountNumber, decimal TransactionAmount, string TransactionNarration, string RequestType, string BranchCode, string RequestId, int LstCount) { try { DAL.DataAccessClasses.IncomeAccountsDataAccess da = new IncomeAccountsDataAccess(); string CreditAccount = ""; if (TransactionNarration.Contains("FED")) { //CreditAccount = "PKR172530001"; CreditAccount = da.GetIncomeAccountByType("FED"); } else if (RequestType == "RC") { //CreditAccount = "PL52529"; CreditAccount = da.GetIncomeAccountByType("Annual"); } else { CreditAccount = da.GetIncomeAccountByType("Setup"); } string STAN1 = Core.Methods.CommonMethods.GetUniqueSTAN(RequestId, LstCount, RequestType); //string STAN1 = "CIF30032018"; FileHelper.RequestTransactionLog(false, DrCustomerAccountNumber, CreditAccount, TransactionAmount.ToString(), TransactionNarration, STAN1, "", "", "", RequestType); CISSB.TransactionInfoRequest request = new CISSB.TransactionInfoRequest(); CISSB.TransactionInfoResponse response = new CISSB.TransactionInfoResponse(); CISSB.BEAPITransactionService cis = new CISSB.BEAPITransactionService(); cis.BEAPIAuthHeaderValue = GetHeader(); request.TransactionDate = DateTime.Now; request.DrCustomerBranchCode = BranchCode; request.TransactionBranchCode = BranchCode; request.CrCustomerBranchCode = BranchCode; request.STAN = STAN1; //Transaction No auto increnment with seed value 10001; request.TransactionType = "401201"; //Transaction Type tbp by SBL; request.DrCustomerAccountNumber = DrCustomerAccountNumber; //"20001266498"; //Debit AccountNumber of Card Holder; request.CrCustomerAccountNumber = CreditAccount; //"00022050684877";//"000220000000419";//"20000000389";//"20000404951"; ///Account Number to which the amount will be credited; request.InstrumentType = "0022"; //tbp by SBL; request.TransactionAmount = TransactionAmount; // TransactionAmount; request.InstrumentDate = DateTime.Now;; request.OrginatingTranIdentNo = 401201; //tbp by SBL same as transaction type; request.Currency = "PKR"; //transaction.Currency; request.Authorization = "0"; //(0 fro authorized payment) transaction.Authorization; request.TransactionNarration = !string.IsNullOrEmpty(TransactionNarration) ? TransactionNarration.Length >= 16 ? TransactionNarration.Substring(0, 16) : TransactionNarration : string.Empty; //Description of charges response = cis.DoTransactions(request); AddTransaction(response, request, RequestType, STAN1); FileHelper.RequestTransactionLog(true, DrCustomerAccountNumber, CreditAccount, TransactionAmount.ToString(), TransactionNarration, STAN1, response.TransactionIdentificationNo, response.ResponseCode, response.ResponseCodeDescription, RequestType); return(response); } catch (Exception ex) { throw ex; } }
///FED Transaction public static CISSB.TransactionInfoResponse RecoveryFEDDebitTransaction(string DrCustomerAccountNumber, decimal TransactionAmount, string TransactionNarration, string RequestType, string BranchCode, string STAN, string CardNo) { DAL.DataAccessClasses.IncomeAccountsDataAccess da = new IncomeAccountsDataAccess(); string CreditAccount = ""; CreditAccount = da.GetIncomeAccountByType("FED"); string STAN1 = STAN; //string STAN1 = "CIF30032018"; CISSB.TransactionInfoRequest request = new CISSB.TransactionInfoRequest(); CISSB.TransactionInfoResponse response = new CISSB.TransactionInfoResponse(); CISSB.BEAPITransactionService cis = new CISSB.BEAPITransactionService(); cis.BEAPIAuthHeaderValue = GetHeader(); request.TransactionDate = DateTime.Now; request.DrCustomerBranchCode = BranchCode; request.TransactionBranchCode = BranchCode; request.CrCustomerBranchCode = BranchCode; request.STAN = STAN1; //Transaction No auto increnment with seed value 10001; request.TransactionType = "401201"; //Transaction Type tbp by SBL; request.DrCustomerAccountNumber = DrCustomerAccountNumber; //"20001266498"; //Debit AccountNumber of Card Holder; request.CrCustomerAccountNumber = CreditAccount; //"00022050684877";//"000220000000419";//"20000000389";//"20000404951"; ///Account Number to which the amount will be credited; request.InstrumentType = "0022"; //tbp by SBL; request.TransactionAmount = TransactionAmount; // TransactionAmount; request.InstrumentDate = DateTime.Now;; request.OrginatingTranIdentNo = 401201; //tbp by SBL same as transaction type; request.Currency = "PKR"; //transaction.Currency; request.Authorization = "0"; //(0 fro authorized payment) transaction.Authorization; request.TransactionNarration = !string.IsNullOrEmpty(TransactionNarration) ? TransactionNarration.Length >= 16 ? TransactionNarration.Substring(0, 16) : TransactionNarration : string.Empty; //Description of charges FileHelper.RecoveryTransactionLog(false, request.DrCustomerAccountNumber, request.CrCustomerAccountNumber, request.TransactionAmount.ToString() , request.TransactionNarration, request.STAN, request.TransactionRefNo, "", "", ""); response = cis.DoTransactions(request); FileHelper.RecoveryTransactionLog(true, request.DrCustomerAccountNumber, request.CrCustomerAccountNumber, request.TransactionAmount.ToString() , request.TransactionNarration, request.STAN, request.TransactionRefNo, response.TransactionIdentificationNo, response.ResponseCode, response.ResponseCodeDescription); return(response); }