public ActionResult NeaBillInquiry(NeaBillInquiryModel INQ) { NeaBillInquiryCommon INC = INQ.MapObject <NeaBillInquiryCommon>(); ViewBag.branchlist = ApplicationUtilities.SetDDLValue(Denomination("26"), INQ.OfficeCode, "--Select Branch--"); INC.IpAddress = ApplicationUtilities.GetIP(); INC.ActionUser = ApplicationUtilities.GetSessionValue("userid").ToString(); var inquiry = _nea.GetPackage(INC); //if (inquiry.Code == shared.Models.ResponseCode.Success) //{ NeaBillInquiryResponseModel neabillresponse = new NeaBillInquiryResponseModel(); if (inquiry.GatewayName == "PRABHUPAY") { if (inquiry.Code == shared.Models.ResponseCode.Success) { var obj = Newtonsoft.Json.JsonConvert.SerializeObject(inquiry.Data); var prabhupayinq = Newtonsoft.Json.JsonConvert.DeserializeObject <PrabhuPayNeaBillInquiryResponseModel>(obj); neabillresponse.OfficeCode = prabhupayinq.OfficeCode; neabillresponse.OfficeName = prabhupayinq.Office; neabillresponse.ScNo = prabhupayinq.ScNo; neabillresponse.CustomerId = prabhupayinq.ConsumerId; neabillresponse.CustomerName = prabhupayinq.CustomerName; neabillresponse.TotalDueAmount = prabhupayinq.TotalDueAmount; List <NeaBill> nb = new List <NeaBill>(); foreach (var item in prabhupayinq.BillDetail) { NeaBill pbill = new NeaBill() { DueDate = item.DueBillOf, PayableAmount = item.PayableAmount, BillDateOf = item.BillDate, NoOfDays = item.NoOfDays, BillAmount = item.BillAmount, Status = item.Status }; nb.Add(pbill); } neabillresponse.BillDetail = nb; NeaBillPaymentModel payment = new NeaBillPaymentModel(); payment.BranchName = neabillresponse.OfficeName; payment.CustomerName = neabillresponse.CustomerName; payment.ConsumerId = neabillresponse.CustomerId; payment.ScNo = neabillresponse.ScNo; payment.OfficeCode = neabillresponse.OfficeCode; payment.BillAmount = neabillresponse.TotalDueAmount; payment.BillDetail = neabillresponse.BillDetail.MapObjects <Neabilldetail>(); payment.EncryptedContent = (payment.ScNo + payment.ConsumerId + payment.BillAmount).EncryptParameter(); // var product = GetNEAproductDetails(); // PM.DueDate = PM.DueDate.ToDateTime(); payment.ProductId = product.ProductId; payment.ProductLogo = product.ProductLogo; payment.MinAmount = product.MinAmount; payment.MaxAmount = product.MaxAmount; payment.CommissionType = product.CommissionType; payment.CommissionValue = product.CommissionValue; string AgentId = Session["AgentId"].ToString(); var TxnLimit = _transactionLimit.GetTransactionLimitForUser(AgentId); payment.TxnLimitMax = TxnLimit.TxnLimitMax; payment.TxnDailyLimitMax = TxnLimit.TxnDailyLimitMax; payment.TxnMonthlyLimitMax = TxnLimit.TxnMonthlyLimitMax; payment.TxnDailyRemainingLimit = TxnLimit.TxnDailyRemainingLimit; payment.TxnMonthlyRemainingLimit = TxnLimit.TxnMonthlyRemainingLimit; // return(View("NeaBillPayment", payment)); } else { this.ShowPopup(1, inquiry.Message); return(View(INQ)); } } //} this.ShowPopup(1, "Service Unavaliable"); return(View(INQ)); }
public ActionResult NeaBillPayment(NeaBillPaymentModel NBP, string ActionType) { if (ActionType != "submitaction") { return(RedirectToAction("NeaBillInquiry")); } if (NBP.EncryptedContent.DecryptParameter() != NBP.ScNo + NBP.ConsumerId + NBP.BillAmount) { return(RedirectToAction("NeaBillInquiry")); } var jstring = Newtonsoft.Json.JsonConvert.SerializeObject(NBP); MobileTopUpPaymentRequest mtpr = new MobileTopUpPaymentRequest() { action_user = Session["UserName"].ToString(), product_id = NBP.ProductId, amount = NBP.TotalPayingAmount, subscriber_no = NBP.ScNo, quantity = "", additonal_data = jstring }; var response = _mtp.MobileTopUpPaymentRequest(mtpr); if (response.Code == 0) { NBP.TransactionId = response.Extra1; NeaBillPaymentCommon NPC = NBP.MapObject <NeaBillPaymentCommon>(); var amt = NBP.PayableAmount.Contains(".") ? NBP.PayableAmount.Split('.')[0].ToString() : NBP.PayableAmount; NPC.PayableAmount = amt; var payment = _nea.payment(NPC); bool failed = true; if (payment.GatewayName == "PRABHUPAY") { if (payment.Code == shared.Models.ResponseCode.Success) { var ppresponse = (prabhupay.service.data.ReturnTransaction)payment.Data; var data = new MobileTopUpPaymentUpdateRequest(); data.action_user = Session["username"].ToString(); data.transaction_id = response.Extra1; data.additonal_data = Newtonsoft.Json.JsonConvert.SerializeObject(ppresponse); data.amount = NPC.PayableAmount; data.refstan = ppresponse.TransactionId; data.status_code = ppresponse.Code; data.remarks = ppresponse.Message; data.ip_address = ApplicationUtilities.GetIP(); data.product_id = NPC.ProductId; data.partner_txn_id = ppresponse.TransactionId; response = _mtp.MobileTopUpPaymentResponse(data); failed = false; return(RedirectToAction("ResultPage", "NeaBillPayment", new { payment = ppresponse })); } else if (payment.Code == shared.Models.ResponseCode.Exception) { var ppresponse = (prabhupay.service.data.ReturnTransaction)payment.Data; var data = new MobileTopUpPaymentUpdateRequest(); data.action_user = Session["username"].ToString(); data.transaction_id = response.Extra1; data.additonal_data = Newtonsoft.Json.JsonConvert.SerializeObject(ppresponse); data.amount = NPC.PayableAmount; data.refstan = ppresponse.TransactionId; data.status_code = ppresponse.Code; data.remarks = ppresponse.Message; data.ip_address = ApplicationUtilities.GetIP(); data.product_id = NPC.ProductId; data.partner_txn_id = ppresponse.TransactionId; response = _mtp.MobileTopUpPaymentResponse(data); failed = false; return(RedirectToAction("ResultPage", "NeaBillPayment", new { payment = ppresponse })); } else { var ppresponse = (prabhupay.service.data.ReturnTransaction)payment.Data; var data = new MobileTopUpPaymentUpdateRequest(); data.action_user = Session["UserName"].ToString(); data.transaction_id = response.Extra1; data.additonal_data = Newtonsoft.Json.JsonConvert.SerializeObject(ppresponse); data.amount = NPC.PayableAmount; data.status_code = ((int)payment.Code).ToString(); data.remarks = payment.Message; data.ip_address = ApplicationUtilities.GetIP(); data.product_id = NPC.ProductId; response = _mtp.MobileTopUpPaymentResponse(data); } } response.SetMessageInTempData(this, "NEAPayment"); if (failed) { NeaBillInquiryModel query = new NeaBillInquiryModel() { ConsumerId = NBP.ConsumerId, OfficeCode = NBP.OfficeCode, ScNo = NBP.ScNo }; return(RedirectToAction("NeaBillInquiry", new { INQ = query })); } } response.SetMessageInTempData(this, "NEAPayment"); NeaBillInquiryModel que = new NeaBillInquiryModel() { ConsumerId = NBP.ConsumerId, OfficeCode = NBP.OfficeCode, ScNo = NBP.ScNo }; return(RedirectToAction("NeaBillInquiry", new { INQ = que })); }