Exemplo n.º 1
0
        public ActionResult WlinkBillInquiry(WorldLinkBillInquiryModel wpm)
        {
            WorldLinkBillInquiryCommon wpc = wpm.MapObject <WorldLinkBillInquiryCommon>();
            var productdetails             = GetWorldLinkproductDetails();

            wpm.ProductLogo     = productdetails.ProductLogo;
            wpm.CommissionType  = productdetails.CommissionType;
            wpm.CommissionValue = productdetails.CommissionValue;

            wpc.IpAddress = ApplicationUtilities.GetIP();
            wpc.UserId    = ApplicationUtilities.GetSessionValue("userid").ToString();
            var inquiry = _wlink.CheckWlinkAccount(wpc);
            WorldLinkBillInquiryResponseModel wlink = new WorldLinkBillInquiryResponseModel();

            wlink.ProductLogo     = productdetails.ProductLogo;
            wlink.CommissionType  = productdetails.CommissionType;
            wlink.CommissionValue = productdetails.CommissionValue;
            wlink.ProductId       = productdetails.ProductId.EncryptParameter();
            if (inquiry.GatewayName.ToUpper() == "PRABHUPAY")
            {
                if (inquiry.Code == shared.Models.ResponseCode.Success)
                {
                    var obj = Newtonsoft.Json.JsonConvert.SerializeObject(inquiry.Data);
                    var prabhupayinqresp = Newtonsoft.Json.JsonConvert.DeserializeObject <PrabhuPayWorldLinkBillInquiryResponseModel>(obj);
                    wlink.CustomerName   = prabhupayinqresp.CustomerName;
                    wlink.WlinkUserName  = prabhupayinqresp.WlinkUserName;
                    wlink.PaymentMessage = prabhupayinqresp.PaymentMessage;
                    List <PlansModel> lst = new List <PlansModel>();
                    foreach (var item in prabhupayinqresp.RenewalPlans)
                    {
                        PlansModel plan = new PlansModel()
                        {
                            PlanId          = item.PlanId,
                            PlanAmount      = item.PlanAmount,
                            PlanName        = item.PlanName,
                            PlanDescription = item.PlanDescription
                        };
                        lst.Add(plan);
                    }
                    //wlink.RenewalPlans = lst;
                    //var planlst = DropdownPlan(lst);
                    //if (planlst == null)
                    //{
                    //    ViewBag.Planlist = null;
                    //}
                    ViewBag.Planlist        = ApplicationUtilities.SetDDLValue(DropdownPlan(lst), "", "--Select--");
                    wlink.Encryptioncontent = (prabhupayinqresp.WlinkUserName + prabhupayinqresp.BillAmount).EncryptParameter();

                    string AgentId  = Session["AgentId"].ToString();
                    var    TxnLimit = _transactionLimit.GetTransactionLimitForUser(AgentId);
                    var    trangrid = ProjectGrid.TransactionLimit(TxnLimit);
                    ViewData["trangrid"] = trangrid;

                    return(View("WlinkBillPayment", wlink));
                }
                else
                {
                    string AgentId  = Session["AgentId"].ToString();
                    var    TxnLimit = _transactionLimit.GetTransactionLimitForUser(AgentId);
                    var    trangrid = ProjectGrid.TransactionLimit(TxnLimit);
                    ViewData["trangrid"] = trangrid;

                    this.ShowPopup(1, inquiry.Message);
                    return(View(wpm));
                }
            }
            this.ShowPopup(1, "Service Unavaliable");
            return(View(wpm));
        }
Exemplo n.º 2
0
        public ActionResult WlinkBillPayment(WorldLinkBillInquiryResponseModel Response)
        {
            if (Response.Encryptioncontent.DecryptParameter() != (Response.WlinkUserName + Response.BillAmount))
            {
                this.ShowPopup(1, "Data Mismatch");
                return(RedirectToAction("WlinkBillInquiry"));
            }
            if (string.IsNullOrEmpty(Response.BillAmount) && string.IsNullOrEmpty(Response.RenewalPlans))
            {
                this.ShowPopup(1, "Invalid Plan");
                return(View(Response));
            }
            WorldLinkBillPaymentModel payment = new WorldLinkBillPaymentModel();

            if (!string.IsNullOrEmpty(Response.RenewalPlans))
            {
                var plan      = Response.RenewalPlans;
                var plansplit = plan.Split('|');
                payment.WlinkUserName = Response.WlinkUserName;
                if (plansplit.Length == 2)
                {
                    payment.Amount = plansplit[0];
                    payment.PlanId = plansplit[1];
                }
                else
                {
                    this.ShowPopup(1, "Select Plan Invalid");
                    return(RedirectToAction("WlinkBillInquiry"));
                }
            }
            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.WlinkUserName,
                quantity       = "",
                additonal_data = jstring,
                CreatedIp      = ApplicationUtilities.GetIP()
            };
            var response = _mtp.MobileTopUpPaymentRequest(mtpr);

            if (response.Code == 0)
            {
                payment.TransactionId = response.Extra1;
                WorldLinkBillPaymentCommon pcommon = new WorldLinkBillPaymentCommon();
                var amt = payment.Amount.Contains(".") ? payment.Amount.Split('.')[0].ToString() : payment.Amount;
                payment.Amount = amt;
                pcommon        = payment.MapObject <WorldLinkBillPaymentCommon>();
                var  paymentresponse = _wlink.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", "WorldLinkBillPayment", 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", "WorldLinkBillPayment", 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, "WorldLinkBillPayment");
                    if (failed)
                    {
                        WorldLinkBillInquiryCommon query = new WorldLinkBillInquiryCommon()
                        {
                            WlinkUserName = payment.WlinkUserName
                        };
                        return(RedirectToAction("WlinkBillInquiry", new { wpm = query }));
                    }
                }
            }
            response.SetMessageInTempData(this, "WorldLinkBillPayment");

            WorldLinkBillInquiryCommon que = new WorldLinkBillInquiryCommon()
            {
                WlinkUserName = payment.WlinkUserName
            };

            return(RedirectToAction("WlinkBillInquiry", new { wpm = que }));
        }