public ActionResult VianetBillPayment(VianetBillInquiryResponseModel Response) { if (Response.Encryptioncontent.DecryptParameter() != (Response.VianetCustomerId + Response.BillAmount)) { this.ShowPopup(1, "Data Mismatch"); return(RedirectToAction("VianetBillInquiry")); } if (string.IsNullOrEmpty(Response.BillAmount) && string.IsNullOrEmpty(Response.RenewalPlans)) { this.ShowPopup(1, "Invalid Plan"); return(View(Response)); } VianetBillPaymentModel payment = new VianetBillPaymentModel(); if (!string.IsNullOrEmpty(Response.RenewalPlans)) { var plan = Response.RenewalPlans; var plansplit = plan.Split('|'); payment.VianetCustomerId = Response.VianetCustomerId; if (plansplit.Length == 2) { payment.Amount = plansplit[0]; payment.PlanId = plansplit[1]; } else { this.ShowPopup(1, "Select Plan Invalid"); return(RedirectToAction("VianetBillInquiry")); } } else { payment.Amount = Response.BillAmount; } var jstring = Newtonsoft.Json.JsonConvert.SerializeObject(payment); MobileTopUpPaymentRequest mtpr = new MobileTopUpPaymentRequest() { action_user = Session["UserName"].ToString(), product_id = Response.ProductId.DecryptParameter(), amount = payment.Amount, subscriber_no = payment.VianetCustomerId, quantity = "", additonal_data = jstring, CreatedIp = ApplicationUtilities.GetIP() }; var response = _mtp.MobileTopUpPaymentRequest(mtpr); if (response.Code == 0) { payment.TransactionId = response.Extra1; VianetBillPaymentCommon pcommon = new VianetBillPaymentCommon(); var amt = payment.Amount.Contains(".") ? payment.Amount.Split('.')[0].ToString() : payment.Amount; payment.Amount = amt; pcommon = payment.MapObject <VianetBillPaymentCommon>(); var paymentresponse = _vianet.BillPayment(pcommon); bool failed = true; if (paymentresponse.GatewayName == "PRABHUPAY") { if (paymentresponse.Code == shared.Models.ResponseCode.Success) { var ppresponse = (prabhupay.service.data.ReturnTransaction)paymentresponse.Data; var data = new MobileTopUpPaymentUpdateRequest(); data.action_user = Session["username"].ToString(); data.refstan = ppresponse.TransactionId; data.transaction_id = response.Extra1; data.additonal_data = Newtonsoft.Json.JsonConvert.SerializeObject(ppresponse); data.amount = pcommon.Amount; data.status_code = ppresponse.Code; data.remarks = ppresponse.Message; data.ip_address = ApplicationUtilities.GetIP(); response = _mtp.MobileTopUpPaymentResponse(data); failed = false; //return RedirectToAction("ResultPage", "WorldLinkBillPayment", new { txnid = ppresponse }); return(RedirectToAction("ResultPage", "VianetBillPayment", new { txnid = response.Extra1.EncryptParameter() })); } else if (paymentresponse.Code == shared.Models.ResponseCode.Exception) { var ppresponse = (prabhupay.service.data.ReturnTransaction)paymentresponse.Data; var data = new MobileTopUpPaymentUpdateRequest(); data.action_user = Session["username"].ToString(); data.transaction_id = response.Extra1; data.refstan = ppresponse.TransactionId; data.additonal_data = Newtonsoft.Json.JsonConvert.SerializeObject(ppresponse); data.amount = pcommon.Amount; data.status_code = ppresponse.Code; data.remarks = ppresponse.Message; data.ip_address = ApplicationUtilities.GetIP(); //data.product_id = pcommon.; data.partner_txn_id = ppresponse.TransactionId; response = _mtp.MobileTopUpPaymentResponse(data); failed = false; return(RedirectToAction("ResultPage", "VianetBillPayment", new { txnid = response.Extra1.EncryptParameter() })); } else { var ppresponse = (prabhupay.service.data.ReturnTransaction)paymentresponse.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 = pcommon.Amount; data.status_code = ((int)paymentresponse.Code).ToString(); data.remarks = paymentresponse.Message; data.ip_address = ApplicationUtilities.GetIP(); //data.product_id = pcommon.ProductId; response = _mtp.MobileTopUpPaymentResponse(data); } response.SetMessageInTempData(this, "VianetBillPayment"); if (failed) { VianetBillInquiryCommon query = new VianetBillInquiryCommon() { VianetCustomerId = payment.VianetCustomerId }; return(RedirectToAction("VianetBillInquiry", new { wpm = query })); } } } response.SetMessageInTempData(this, "VianetBillPayment"); VianetBillInquiryCommon que = new VianetBillInquiryCommon() { VianetCustomerId = payment.VianetCustomerId }; return(RedirectToAction("VianetBillInquiry", new { wpm = que })); }
public CommonDbResponse BillPayment(VianetBillPaymentCommon payment) { return(repo.BillPayment(payment)); }