//// 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(""); } }