Пример #1
0
        ////  For Test
        //public string paySubscribtion(string refNum)
        //{
        //    try
        //    {
        //        dynamic payObjx = new JObject();
        //        dynamic payObj = _dr.PayLoad(refNum);
        //        //dynamic Phones = new JObject();
        //        //var Phone = _dr.GetPhone(refNum);
        //        //Phones.Phone = Phone;
        //        //var Payresponse = _paytv.PaySubscription(payObj, Phones);

        //        dynamic Jobj = new JObject();
        //        string Paymenttype = "";
        //        Paytv.PaytvObj PaytvObj = new Paytv.PaytvObj();
        //        Jobj.vice_id = ConfigurationManager.AppSettings["payvicewalletid"];
        //        Jobj.user_name = ConfigurationManager.AppSettings["payviceUsername"];
        //        string PostUrl = ConfigurationManager.AppSettings["payvicelookupurl"];
        //        var json = Jobj.ToString();
        //        // var data = Utility.DoPost(json, $"{PostUrl}", token);
        //        // var data = "{\"vice_id\":\"76058956\",\"token\":\"e0c65d0140e0f65ecce7ac233357df9263f16c581785fd8a6fdfb2f21a369ae8\",\"status\":0,\"message\":\"Authenticated successfully\"}";
        //        var Response = "0";

        //        // var Response = JObject.Parse(data);

        //        //if (Response != null && Response?.status == "0")
        //        if (Response == "0")
        //        {
        //            //token = Response?.token;
        //            //message = Response?.message;
        //            //vice_id = Response?.vice_id;
        //            token = "e0c65d0140e0f65ecce7ac233357df9263f16c581785fd8a6fdfb2f21a369ae890";
        //            message = "Authenticated successfully";
        //            vice_id = "76058956";

        //            dynamic Airtime = new JObject();
        //            Airtime.vice_id = ConfigurationManager.AppSettings["payvicewalletid"];
        //            Airtime.user_name = ConfigurationManager.AppSettings["payviceUsername"];
        //            Airtime.amount = payObj.Amount;
        //            Airtime.phone = payObj.CustomerID;
        //            Airtime.service = payObj.ServiceDetails;
        //            Airtime.paymentType = payObj.PaymentType;
        //            //Paymenttype = Convert.ToString(form["paymenttype"]);
        //            //var service = Convert.ToString(form["Recuring"]);
        //            ////service = service.Before(",").Trim();
        //            //service = service.After("Airtime/").Trim();
        //            //service = service.Before(".").Trim();
        //            //Airtime.service = service;
        //            //AirtimeObj.Service = Airtime.service;
        //            Airtime.auth = ConfigurationManager.AppSettings["payvicecode"];
        //            Airtime.token = token;
        //            Airtime.pwd = ConfigurationManager.AppSettings["payvicepassword"];
        //            var AirtimeURL = ConfigurationManager.AppSettings["payviceAirtimeupurl"];
        //            var Airtimes = Airtime.ToString();
        //            // var AirtimeRespons = Utility.DoPost(Airtimes, $"{AirtimeURL}");
        //            // var AirtimeRespons = "message":"Topup completed successfully","status":1,"date":"18\/02\/2019 15:51:22","txn_ref":"5c6ad47aae06f";
        //            //dynamic AirtimeRespons = new JObject();
        //            //  var AirtimeResponse = JObject.Parse(AirtimeRespons);
        //            var AirtimeResponse = "1";
        //            // if (AirtimeResponse != null && AirtimeResponse?.status == "1")
        //            if (AirtimeResponse != null && AirtimeResponse == "1")
        //            {
        //                //payObjx.tranNum = AirtimeResponse?.txn_ref;
        //                //payObjx.returnCode = AirtimeResponse?.status;
        //                //payObjx.returnMsg = AirtimeResponse?.message;
        //                //payObjx.date = AirtimeResponse?.date;

        //                payObjx.tranNum = "5c6ad47aae06f90123";
        //                payObjx.returnCode = "1";
        //                payObjx.returnMsg = "Topup completed successfully";
        //                payObjx.date = "18/02/2019 15:51:22";

        //            }
        //        }

        //        var jsons = Convert.ToString(payObjx);
        //        return jsons;
        //    }
        //    catch (Exception ex)
        //    {
        //        WebLog.Log(ex.Message.ToString());
        //        return "";
        //    }
        //}

        public string paySubscribtions(string refNum)
        {
            try
            {
                dynamic payObjx = new JObject();
                dynamic payObj  = _dr.PayLoad(refNum);
                // var ValidateRefNum = _dr.validateRefNum(refNum);

                dynamic        Jobj        = new JObject();
                string         Paymenttype = "";
                Paytv.PaytvObj PaytvObj    = new Paytv.PaytvObj();
                Jobj.vice_id   = ConfigurationManager.AppSettings["payvicewalletid"];
                Jobj.user_name = ConfigurationManager.AppSettings["payviceUsername"];
                string PostUrl = ConfigurationManager.AppSettings["payvicelookupurl"];
                var    json    = Jobj.ToString();
                var    data    = Utility.DoPost(json, $"{PostUrl}", token);

                var Response = JObject.Parse(data);

                if (Response != null && Response?.status == "0")

                {
                    token   = Response?.token;
                    message = Response?.message;
                    vice_id = Response?.vice_id;

                    dynamic Airtime = new JObject();
                    Airtime.vice_id   = ConfigurationManager.AppSettings["payvicewalletid"];
                    Airtime.user_name = ConfigurationManager.AppSettings["payviceUsername"];
                    Airtime.amount    = payObj.Amount;
                    Airtime.phone     = payObj.CustomerID;
                    Airtime.service   = payObj.ServiceDetails;
                    //Airtime.paymentType = payObj.PaymentType;

                    Airtime.auth  = ConfigurationManager.AppSettings["payvicecode"];
                    Airtime.token = token;
                    Airtime.pwd   = ConfigurationManager.AppSettings["payvicepassword"];
                    var AirtimeURL     = ConfigurationManager.AppSettings["payviceAirtimeupurl"];
                    var Airtimes       = Airtime.ToString();
                    var AirtimeRespons = Utility.DoPost(Airtimes, $"{AirtimeURL}");

                    //dynamic AirtimeRespons = new JObject();
                    var AirtimeResponse = JObject.Parse(AirtimeRespons);

                    if (AirtimeResponse != null && AirtimeResponse?.status == "1")
                    {
                        payObjx.tranNum    = AirtimeResponse?.txn_ref;
                        payObjx.returnCode = AirtimeResponse?.status;
                        payObjx.returnMsg  = AirtimeResponse?.message;
                        payObjx.date       = AirtimeResponse?.date;
                    }
                }

                var jsons = Convert.ToString(payObjx);
                return(jsons);
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return("");
            }
        }
Пример #2
0
        public ActionResult Checkout(string Biller, Paytv.PaytvObj paytv)
        {
            try
            {
                string user = LoggedInuser.LoggedInUser();

                if (user != null)
                {
                    Classes.Paytv.PaytvObj paytvs = new Paytv.PaytvObj();
                    string RefNum = Request.QueryString["RefNum"];
                    // RefNum = "payvice01137f85-e105-4839-936f-b14f53";
                    if (RefNum == null)
                    {
                        return(RedirectToAction("BuyAirtime", "Airtime"));
                    }
                    if (RefNum != null)
                    {
                        // if am here;
                        // var CusTransac = _dr.GetCustTransac(RefNum);
                        var CusTransac = _dr.GetRecord(RefNum);

                        // I Added This on 14/May/2019

                        ViewBag.Wallet = GetWalletBalance((int)CusTransac.Customer_FK);

                        // I Added This 27/Nov/2018
                        //paytvs.Phone = _dr.GetPhone(RefNum);
                        paytvs.Amount         = Convert.ToString(CusTransac.Amount);
                        paytvs.CustomerID     = CusTransac.CustomerID;
                        paytvs.Service        = CusTransac.ServiceDetails;
                        paytvs.ConvFee        = Convert.ToString(CusTransac.ServiceCharge);
                        paytvs.transactionlNo = CusTransac.ReferenceNumber;
                        paytvs.customerName   = CusTransac.CustomerName;
                        paytvs.Bouquet        = CusTransac.ServiceDetails;
                        paytvs.paymentType    = _dr.GetCustomerpaytype(RefNum);
                        string DiscoId = Convert.ToString(CusTransac.Merchant_FK);
                        paytvs.paymentType = _dr.GetCustomerpaytype(RefNum);
                        double Amount = Convert.ToDouble(paytvs.Amount);

                        /*  paytvs.Amount = "50";
                         * paytvs.CustomerID = "08077755537";
                         * paytvs.Service = "GLOVTV";
                         * paytvs.ConvFee = "20";
                         * paytvs.transactionlNo = "VTU122a39b7-202c-444e-92ad-967a6986";
                         * paytvs.customerName = "08077755537";
                         * paytvs.Bouquet = "GLOVTU";
                         * paytvs.paymentType = 1;
                         * string DiscoId = "1";
                         * paytvs.paymentType = 1;
                         * double Amount = Convert.ToDouble(paytvs.Amount);
                         */
                        //  string DiscoId = Convert.ToString(CusTransac.Merchant_FK);
                        if (Amount >= 50)
                        {
                            paytvs.ConvFee       = ConfigurationManager.AppSettings["NoConvFee"];
                            TempData["TotalAmt"] = Convert.ToDecimal(paytvs.ConvFee) + Convert.ToDecimal(paytvs.Amount);
                        }

                        return(View(paytvs));
                    }

                    paytv  = (Classes.Paytv.PaytvObj)ViewBag.PaytvObj;
                    paytvs = (Classes.Paytv.PaytvObj)TempData["PaytvObj"];
                    Biller = paytvs.BillerName;
                }
                return(View());
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(null);
            }
        }
Пример #3
0
        public ActionResult BuyAirtime(FormCollection form, Internetserviceprovider.InternetServiceObj AirtimeObj)
        {
            try
            {
                dynamic        Jobj        = new JObject();
                string         Paymenttype = "";
                Paytv.PaytvObj PaytvObj    = new Paytv.PaytvObj();
                // i added this line today for Validation
                Classes.Internetserviceprovider.InternetServiceObj _ptv    = new Classes.Internetserviceprovider.InternetServiceObj();
                Classes.Internetserviceprovider.InternetServiceObj Airtime = new Classes.Internetserviceprovider.InternetServiceObj();
                string user = LoggedInuser.LoggedInUser();
                if (user != null)
                {
                    // dynamic Airtime = new JObject();

                    Airtime.Amount     = AirtimeObj.Amount;
                    Airtime.Phone      = AirtimeObj.CustomerID;
                    Airtime.CustomerID = AirtimeObj.CustomerID;

                    Paymenttype         = Convert.ToString(form["paymenttype"]);
                    Airtime.paymentType = Convert.ToInt16(Paymenttype);
                    var service = Convert.ToString(form["Recuring"]);
                    if (service.StartsWith("Select"))
                    {
                        TempData["PaytvObj"] = Airtime;
                        //TempData["message"] = PaytvObj.BillerName;
                        //TempData["BillerName"] = PaytvObj.BillerImg;
                        TempData["Msg"] = "Please Select Airtime !";
                        return(Redirect("/Airtime/BuyAirtime/"));
                    }
                    service            = service.After("Airtime/").Trim();
                    service            = service.Before(".").Trim();
                    Airtime.Service    = service;
                    AirtimeObj.Service = Airtime.Service;
                    string services = AirtimeObj.Service;


                    string amount = Airtime.Amount;
                    string phone  = Airtime.Phone;

                    if (amount == "" || phone == "")
                    {
                        return(View());
                    }
                    bool Result = newutil.ValidateNum(amount, phone);
                    if (Result == false)
                    {
                        return(View());
                    }
                    string Phones      = "";
                    bool   ValidAmount = newutil.ValidateAmount(amount);
                    if (ValidAmount == false)
                    {
                        TempData["PaytvObj"] = Airtime;
                        // TempData["message"] = PaytvObj.BillerName;
                        //TempData["BillerName"] = PaytvObj.BillerImg;
                        TempData["Msg"] = "Amount Must Be Than N50!";
                        return(Redirect("/Airtime/BuyAirtime/"));
                    }
                    var isValid = Utility.ValidatePhoneNumber(phone, out Phones);
                    if (isValid == false)
                    {
                        TempData["PaytvObj"] = Airtime;
                        // TempData["message"] = PaytvObj.BillerName;
                        //TempData["BillerName"] = PaytvObj.BillerImg;
                        TempData["Msg"] = "Invalid Phone Number!";
                        return(Redirect("/Airtime/BuyAirtime/"));
                    }

                    PaytvObj.Amount         = AirtimeObj.Amount;
                    PaytvObj.CustomerID     = AirtimeObj.CustomerID;
                    PaytvObj.Service        = AirtimeObj.Service;
                    PaytvObj.transactionlNo = Utility.GenerateAlphanumericUniqueId(30);
                    PaytvObj.transactionlNo = "VTU" + PaytvObj.transactionlNo;
                    PaytvObj.Phone          = AirtimeObj.Phone;
                    PaytvObj.ConvFee        = ConfigurationManager.AppSettings["payviceConvFee"];
                    PaytvObj.paymentType    = Convert.ToInt16(Paymenttype);
                    PaytvObj.MerchantId     = getmerchantID(services);
                    // PaytvObj.MerchantId = 300;
                    // var RefNum = PaytvObj.transactionlNo;

                    string RefNum = paytvcontroller.InsertTransactionLog(PaytvObj);
                    return(RedirectToAction("Checkout", new { @RefNum = RefNum }));
                    //return View(PaytvObj);
                    //   }


                    // }
                    // return View();
                }
                return(View());
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(null);
            }
        }
Пример #4
0
        public ActionResult Checkout(Classes.Paytv.PaytvObj _pv)
        {
            try
            {
                int PayMethod = PaymentMethod(_pv.paymethod);

                string user = LoggedInuser.LoggedInUser();
                if (user != null && PayMethod == 0)
                {
                    Classes.Paytv.PaytvObj paytv  = new Paytv.PaytvObj();
                    Classes.Paytv.PaytvObj paytvs = new Paytv.PaytvObj();
                    paytv  = (Classes.Paytv.PaytvObj)ViewBag.PaytvObj;
                    paytvs = (Classes.Paytv.PaytvObj)TempData["PaytvObj"];

                    string Firstname   = _pv.CustomerID;
                    string Email       = _pv.CustomerID;
                    string PhoneNumber = _pv.CustomerID;
                    string Amount      = _pv.Amount;
                    string ConvFee     = _pv.ConvFee;

                    //string ConvFee = ConfigurationManager.AppSettings["ConvFee"];
                    var    TotalAmt  = Convert.ToDecimal(Amount) + Convert.ToDecimal(ConvFee);
                    string TotalAmts = TotalAmt.ToString();
                    var    TranNum   = _pv.transactionlNo;
                    // i have to uncomment out this Line
                    int paymenttype = _dr.GetCustomerpaytype(TranNum);
                    // int paymenttype = 1;
                    int  paymentplanId = _dr.GetPaymentPlanID(_pv.Bouquet);
                    bool isNum         = Decimal.TryParse(TotalAmts, out TotalAmt);

                    if (isNum)
                    {
                        PaymentManager.Payment PayObj = new PaymentManager.Payment();
                        PayObj.PaymentType  = paymenttype;
                        PayObj.RefNumber    = TranNum; //System.DateTime.Now.ToString("yyyyMMddHmmss");
                        PayObj.amount       = TotalAmt.ToString();
                        PayObj.customerid   = "2";
                        PayObj.customerName = Firstname;
                        PayObj.emailaddress = Email;
                        PayObj.narration    = $"{Firstname.Trim()} Payment of NGN {decimal.Parse(PayObj.amount)}";
                        PayObj.phoneNo      = PhoneNumber;

                        PayObj.returnUrl     = ConfigurationManager.AppSettings["PavicePaymentReturnUrl"];
                        PayObj.PaymentPlanID = paymentplanId;
                        //PayObj.returnUrl = GetReturnUrl(PayObj.returnUrl);
                        string formObject = PaymentManager.GetPaymentPageDatails(PayObj);
                        if (formObject != "")
                        {
                            Response.Clear();
                            Response.ContentEncoding = Encoding.GetEncoding("ISO-8859-1"); Response.HeaderEncoding = Encoding.GetEncoding("ISO-8859-1");
                            Response.Charset         = "ISO-8859-1";
                            Response.Write(formObject);
                            Response.End();
                        }
                        else
                        {
                            TempData["Message"] = "Error Calling Payment Page - Code P002";
                        }
                    }
                    else
                    {
                        TempData["Message"] = "Error Calling Payment Page - Code P002";
                    }
                }
                else
                {
                    if (user != null && PayMethod == 1)
                    {
                        var    userid        = _dr.getUserID(user);
                        var    WalletBalance = _dr.WalletBalance(userid.id);
                        double Amount        = Convert.ToDouble(_pv.Amount);
                        if (WalletBalance >= Amount)
                        {
                            dynamic response = paySubscribtion(_pv.transactionlNo);
                            TempData["ErrMsg"] = "Transaction Successful!";
                            Receipt(response, _pv.transactionlNo);
                            _tL.ReferenceNumber = _pv.transactionlNo;
                            var id = _dc.InsertCustomerWallet(_tL);
                        }
                        else if (WalletBalance < Amount)
                        {
                            Classes.Internetserviceprovider.InternetServiceObj _ptv = new Classes.Internetserviceprovider.InternetServiceObj();
                            _ptv.Amount          = _pv.Amount;
                            _ptv.CustomerID      = _pv.CustomerID;
                            _ptv.transactionlNo  = _pv.transactionlNo;
                            _ptv.Service         = _pv.Service;
                            _pv.ConvFee          = "0";
                            TempData["TotalAmt"] = _pv.Amount;
                            TempData["PaytvObj"] = _ptv;
                            TempData["Msg"]      = "Low Balance In Wallet !";
                            return(Redirect("/Airtime/Checkout/"));
                        }
                        return(RedirectToAction("WalletReceipt", new { @RefNum = _tL.ReferenceNumber }));
                    }
                }
                return(View());
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(null);
            }
        }
Пример #5
0
        public ActionResult Checkout(FormCollection form, Internetserviceprovider.InternetServiceObj cusdata)
        {
            try
            {
                Classes.Paytv.PaytvObj paytv  = new Paytv.PaytvObj();
                Classes.Paytv.PaytvObj paytvs = new Paytv.PaytvObj();
                paytv  = (Classes.Paytv.PaytvObj)ViewBag.PaytvObj;
                paytvs = (Classes.Paytv.PaytvObj)TempData["PaytvObj"];

                string Firstname   = cusdata.customerName;
                string Email       = cusdata.customerName;
                string PhoneNumber = cusdata.Phone;
                string Amount      = cusdata.Amount;
                string ConvFee     = cusdata.ConvFee;
                string RefNum      = cusdata.transactionlNo;
                cusdata.transactionlNo = RefNum;
                //string ConvFee = ConfigurationManager.AppSettings["ConvFee"];
                var    TotalAmt  = Convert.ToDecimal(Amount) + Convert.ToDecimal(ConvFee);
                string TotalAmts = TotalAmt.ToString();
                var    TranNum   = cusdata.transactionlNo;
                // int paymenttype = _dr.GetCustomerpaytype(TranNum);
                int paymenttype = 1;
                // int paymentplanId = _dr.GetPaymentPlanID(_pv.Bouquet);
                int  paymentplanId = 2;
                bool isNum         = Decimal.TryParse(TotalAmts, out TotalAmt);

                if (isNum)
                {
                    PaymentManager.Payment PayObj = new PaymentManager.Payment();
                    PayObj.PaymentType  = paymenttype;
                    PayObj.RefNumber    = TranNum; //System.DateTime.Now.ToString("yyyyMMddHmmss");
                    PayObj.amount       = TotalAmt.ToString();
                    PayObj.customerid   = "2";
                    PayObj.customerName = Firstname;
                    PayObj.emailaddress = Email;
                    PayObj.narration    = $"{Firstname.Trim()} Payment of NGN {decimal.Parse(PayObj.amount)}";
                    PayObj.phoneNo      = PhoneNumber;

                    PayObj.returnUrl     = ConfigurationManager.AppSettings["SpecPaymentReturnUrls"];
                    PayObj.PaymentPlanID = paymentplanId;
                    //PayObj.returnUrl = GetReturnUrl(PayObj.returnUrl);
                    string formObject = PaymentManager.GetPaymentPageDatails(PayObj);
                    if (formObject != "")
                    {
                        /*string RefNum = "420020181227072633oNl8R";
                         *   // I Added This today .
                         * Requery(RefNum);*/
                        // Today I Added This For Requery*/
                        Response.Clear();
                        Response.ContentEncoding = Encoding.GetEncoding("ISO-8859-1"); Response.HeaderEncoding = Encoding.GetEncoding("ISO-8859-1");
                        Response.Charset         = "ISO-8859-1";
                        Response.Write(formObject);
                        Response.End();
                    }
                    else
                    {
                        TempData["Message"] = "Error Calling Payment Page - Code P002";
                    }
                }
                else
                {
                    TempData["Message"] = "Error Calling Payment Page - Code P002";
                }



                return(View());
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(null);
            }
        }