public ActionResult RegisterUser(Models.Input model) { try { if (!ModelState.IsValid) { model.Genders.Add("Male"); model.Genders.Add("Female"); TryUpdateModel(model); return(View(model)); } InvokeRequestResponseService(model).Wait(); return(RedirectToAction("Result", new { Result = model.result })); } catch (Exception ex) { model.Genders.Add("Male"); model.Genders.Add("Female"); TryUpdateModel(model); return(View(model)); } }
public Models.Input <Models.Inputs.ProcessIN> Process() { Models.Input <Models.Inputs.ProcessIN> log = new Models.Input <Models.Inputs.ProcessIN>(); Models.CommonInputParams param = new Models.CommonInputParams(); Models.Inputs.ProcessIN Sin = new Models.Inputs.ProcessIN(); Models.SecureHash sh = new Models.SecureHash(); param.username = "******"; param.password = "******"; Sin.AccountId = 12; Sin.AccountUserId = 12; Sin.ServiceAmount = 0.0; Sin.PaymentAmount = 0.0; Sin.countryCode = ""; Sin.DeviceID = 12; Sin.msisdn = ""; Sin.PaymentChannel = ""; Sin.seriviceCode = ""; Sin.ServiceId = 12; Sin.serviceName = ""; Sin.transactionId = ""; sh.data = ""; sh.securehash = ""; log.param = param; log.input = Sin; log.secure = sh; return(log); }
public ActionResult RegisterUser() { var ViewModel = new Models.Input(); ViewModel.Genders.Add("Male"); ViewModel.Genders.Add("Female"); return(View(ViewModel)); }
public Models.Input <Models.Inputs.LoginIN> login() { Models.Input <Models.Inputs.LoginIN> log = new Models.Input <Models.Inputs.LoginIN>(); Models.CommonInputParams param = new Models.CommonInputParams(); param.username = "******"; param.password = "******"; log.param = param; Models.Inputs.LoginIN login = new Models.Inputs.LoginIN(); log.input = login; return(log); }
public int DebitTransactionOld(Models.Input <DebitTransactions> obj) { PayitMerchantsnWalletsEntities db = new PayitMerchantsnWalletsEntities(); CustomerWalletTransactionsDebit CusWC = new CustomerWalletTransactionsDebit(); int status = 1; var CustDeatils = (from a in db.Customers join c in db.CustomerWallets on a.ID equals c.CustomerID where a.MobileNo == obj.input.mobile select c.ID).FirstOrDefault(); try { if (CustDeatils != 0) { CusWL.CustomerWalletID = CustDeatils; CusWL.Amount = string.IsNullOrEmpty(obj.input.amount) ? 0 : Convert.ToDouble(obj.input.amount); CusWL.ThirdPartyID = 1; CusWL.Reference = obj.input.paymentref; CusWL.TransactionType = "DEBIT"; CusWL.TransactionDate = DateTime.Now; CusWL.Status = true; db.CustomerWalletTransactions.Add(CusWL); db.SaveChanges(); var walletTranID = CusWL.ID; CusWC.WalletTransactionID = walletTranID; CusWC.DebitServiceName = "OneInWallet"; CusWC.DebitReference = obj.input.paymentref; CusWC.Status = true; CusWC.TransactionDate = DateTime.Now; CusWC.Description = "PAID"; db.CustomerWalletTransactionsDebits.Add(CusWC); db.SaveChanges(); status = 0; } } catch { status = 1; } return(status); }
public static void CreditTransactionOld(Models.Input <CreditTransactions> obj) { PayitMerchantsnWalletsEntities db = new PayitMerchantsnWalletsEntities(); var CustDeatils = (from a in db.Customers join b in db.CustomerDevices on a.ID equals b.CustomerID join c in db.CustomerWallets on a.ID equals c.CustomerID where a.MobileNo == obj.input.mobile && b.DeviceUDID == obj.param.deviceuniqueid select c.ID).FirstOrDefault(); if (CustDeatils != null) { CustomerWalletTransaction CusWL = new CustomerWalletTransaction(); CusWL.CustomerWalletID = CustDeatils; CusWL.Amount = string.IsNullOrEmpty(obj.input.amount) ? 0 : Convert.ToDouble(obj.input.amount); CusWL.ThirdPartyID = 1; CusWL.Reference = obj.input.paymentref; CusWL.TransactionType = "CREDIT"; CusWL.TransactionDate = DateTime.Now; CusWL.Status = true; db.CustomerWalletTransactions.Add(CusWL); db.SaveChanges(); var walletTranID = CusWL.ID; CustomerWalletTransactionsCredit CusWC = new CustomerWalletTransactionsCredit(); CusWC.WalletTransactionID = walletTranID; CusWC.CreditChannel = "OneInWallet"; CusWC.CreditChannelReference = obj.input.paymentref; CusWC.Status = true; CusWC.TransactionDate = DateTime.Now; CusWC.Description = "CAPTURED"; db.CustomerWalletTransactionsCredits.Add(CusWC); db.SaveChanges(); } }
public Models.Input <Models.Inputs.ServicesIN> GetServicesByCountry() { Models.Input <Models.Inputs.ServicesIN> log = new Models.Input <Models.Inputs.ServicesIN>(); Models.CommonInputParams param = new Models.CommonInputParams(); Models.Inputs.ServicesIN Sin = new Models.Inputs.ServicesIN(); Models.Inputs.GetActiveServices GAS = new Models.Inputs.GetActiveServices(); Models.Inputs.SecureHash sh = new Models.Inputs.SecureHash(); param.username = "******"; param.password = "******"; sh.data = ""; sh.securehash = ""; GAS.countryCode = "CW"; GAS.secure = sh; Sin.AccountID = 12; Sin.GetActiveServices = GAS; log.param = param; log.input = Sin; return(log); }
public DTO <CreateDTO> CreateSubscription(Models.Input <CreateSubscription> obj) { return(_dob.CreateSubscription(obj)); }
public Models.DTO <Models.Outputs.ServiceAmountsDTO> GetServiceAmounts(Models.Input <Models.Inputs.LoginIN> obj) { return(dealers.GetServiceAmounts(obj)); }
public Models.DTO <Models.Outputs.ProcessDTO> Process2(Models.Input <Models.Inputs.ProcessIN2> obj) { return(dealers.Process2(obj)); }
public Models.DTO <Models.Outputs.CategoryServices> GetAllServices(Models.Input <Models.Inputs.GetActiveServices> obj) { return(dealers.GetAllServices(obj)); }
public Models.DTO <Models.Outputs.CategoryServices> GetServicesByCountry2(Models.Input <Models.Inputs.ServicesIN> obj) { return(dealers.GetServicesByCountry2(obj)); }
public Models.DTO <Models.Outputs.ServicesDTO> GetServicesByCountry(Models.Input <Models.Inputs.ServicesIN> obj) { return(dealers.GetServicesByCountry(obj)); }
public Models.DTO <Models.Outputs.LoginDTO> login(Models.Input <Models.Inputs.LoginIN> obj) { return(dealers.login(obj)); }
public static void RegisterOld(Models.Input <WalletProfile> obj) { PayitMerchantsnWalletsEntities db = new PayitMerchantsnWalletsEntities(); var isWalletExist = (from a in db.Customers join b in db.CustomerDevices on a.ID equals b.CustomerID where a.MobileNo == obj.input.mobileno && b.DeviceUDID == obj.param.deviceuniqueid select a).FirstOrDefault(); if (isWalletExist == null) { Customer cus = new Customer(); cus.CountryCode = string.IsNullOrEmpty(obj.input.countrycode) ? "" : obj.input.countrycode; cus.CustomerCode = string.IsNullOrEmpty(obj.input.userid) ? "" : obj.input.userid; cus.Password = string.IsNullOrEmpty(obj.input.password) ? "" : obj.input.password; cus.MobileNo = string.IsNullOrEmpty(obj.input.mobileno) ? "" : obj.input.mobileno; cus.MobileActivated = false; cus.OTP = 0; cus.Email = string.IsNullOrEmpty(obj.input.email) ? "" : obj.input.email; cus.EmailActivated = false; //cus.AppIdentifier=""; cus.TranDate = DateTime.Now; cus.Status = false; db.Customers.Add(cus); db.SaveChanges(); var CID = cus.ID; CustomerDevice CusD = new CustomerDevice(); CusD.CustomerID = CID; CusD.DeviceUDID = obj.param.deviceuniqueid; CusD.Status = false; CusD.CreatedDae = DateTime.Now; db.CustomerDevices.Add(CusD); db.SaveChanges(); var DeviceID = CusD.ID; CustomerWallet CusW = new CustomerWallet(); CusW.CustomerID = CID; CusW.Balance = 0; CusW.CreatedDate = DateTime.Now; CusW.Status = true; db.CustomerWallets.Add(CusW); db.SaveChanges(); CustomerOTP CusO = new CustomerOTP(); CusO.CusomerID = CID; CusO.DeviceID = DeviceID; CusO.WalletServiceID = 1; CusO.OTP = ""; CusO.CreatedDate = DateTime.Now; CusO.Status = true; CusO.isUsed = false; db.CustomerOTPs.Add(CusO); db.SaveChanges(); } }
public DTO <DeleteSubscriptionDTO> DeleteSubscription(Models.Input <DeleteSubscription> obj) { return(_dob.DeleteSubscription(obj)); }
//public MerchantDTO MerchantTransaction(Models.Input<QRPayRequest> obj, string refer, string code) //{ // PayitMerchantsnWalletsEntities db = new PayitMerchantsnWalletsEntities(); // Merchant merchant = new Merchant(); // MerchantDTO dto = new MerchantDTO(); // MerchantOrder order = new MerchantOrder(); // MerchantTransaction merchantTran = new MerchantTransaction(); // CustomerWalletTransaction CusWL = new CustomerWalletTransaction(); // var mDetails = (from a in db.Merchants // where a.Name == obj.input.QR.name && a.Code == code // select a).FirstOrDefault(); // try // { // if (mDetails != null) // { // merchantTran.Amount = string.IsNullOrEmpty(obj.input.amount) ? 0 : Convert.ToDouble(obj.input.amount); // merchantTran.MerchantID = mDetails.ID; // merchantTran.Reference = refer; // merchantTran.Status = true; // merchantTran.TransactionDate = DateTime.Now; // db.MerchantTransactions.Add(merchantTran); // db.SaveChanges(); // order.Amount = merchantTran.Amount; // order.MerchantUserID = Convert.ToInt32(obj.input.QR.merchantuserid); // order.Description = "QRPAYMENT"; // order.isPaid = true; // //order.MerchantUserID = // order.MobileNo = mDetails.PhoneNo; // order.PaymentReference = merchantTran.Reference; // order.ProcessDate = DateTime.Now; // order.Reference = merchantTran.Reference; // order.Status = true; // order.StatusDescription = "WalletPay"; // order.TranDate = DateTime.Now; // db.MerchantOrders.Add(order); // db.SaveChanges(); // merchant.Amount = mDetails.Amount + merchantTran.Amount; // db.SaveChanges(); // dto.Amount = mDetails.Amount.ToString(); // dto.Code = mDetails.Code.ToString(); // dto.CountryCode = mDetails.CountryCode; // dto.Name = mDetails.Name; // } // } // catch // { // dto.Name = ""; // dto.Amount = ""; // dto.Code = ""; // dto.CountryCode = ""; // } // return dto; //} public MerchantDTO MerchantTransaction(Models.Input <QROrderRequest> obj, string refer, string code) { PayitMerchantsnWalletsEntities db = new PayitMerchantsnWalletsEntities(); Merchant merchant = new Merchant(); MerchantDTO dto = new MerchantDTO(); MerchantOrder order = new MerchantOrder(); //QROrderItem qrord = new QROrderItem(); QROrderRequest qrord = new QROrderRequest(); MerchantOrderItem ordItem = new MerchantOrderItem(); MerchantTransaction merchantTran = new MerchantTransaction(); CustomerWalletTransaction CusWL = new CustomerWalletTransaction(); var mDetails = (from a in db.Merchants where a.Name == obj.input.QR.name && a.Code == code select a).FirstOrDefault(); try { if (mDetails != null) { merchantTran.Amount = string.IsNullOrEmpty(obj.input.amount) ? 0 : Convert.ToDouble(obj.input.amount); merchantTran.MerchantID = mDetails.ID; merchantTran.Reference = refer; merchantTran.Status = true; merchantTran.TransactionDate = DateTime.Now; db.MerchantTransactions.Add(merchantTran); db.SaveChanges(); order.Amount = merchantTran.Amount; order.Description = "QRPAYMENT"; order.isPaid = true; order.MerchantUserID = Convert.ToInt32(obj.input.QR.merchantuserid); order.MobileNo = mDetails.PhoneNo; order.PaymentReference = merchantTran.Reference; order.ProcessDate = DateTime.Now; order.Reference = merchantTran.Reference; order.Status = true; order.StatusDescription = "WalletPay"; order.TranDate = DateTime.Now; db.MerchantOrders.Add(order); db.SaveChanges(); foreach (var row in obj.input.QR.orderitems) { double total = Convert.ToInt32(row.price) * Convert.ToInt32(row.quantity); ordItem.MerchantOrderID = order.ID; ordItem.MerchantItemID = Convert.ToInt32(row.itemid); ordItem.Quantity = Convert.ToInt32(row.quantity); ordItem.UnitPrice = Convert.ToDouble(row.price); ordItem.ItemAmount = total; ordItem.CreatedDate = DateTime.Now; ordItem.Status = true; db.MerchantOrderItems.Add(ordItem); db.SaveChanges(); } merchant.Amount = mDetails.Amount + merchantTran.Amount; db.SaveChanges(); dto.Amount = mDetails.Amount.ToString(); dto.Code = mDetails.Code.ToString(); dto.CountryCode = mDetails.CountryCode; dto.Name = mDetails.Name; } } catch { dto.Name = ""; dto.Amount = ""; dto.Code = ""; dto.CountryCode = ""; } return(dto); }
public DTO <PINDTO> Pin(Models.Input <PIN> obj) { return(_dob.Pin(obj)); }
public String InsertTransaction(String BalanceType, String Type, String Id, Models.Input <Models.Inputs.ProcessIN> obj, Models.Outputs.ProcessDTO rep, String FailureReason, String Status) { try { String Trackid = ""; Random rnd = new Random(); DealerTransaction tr = new DealerTransaction(); var ACCDeatils = (from a in db.Tbl_Accounts join b in db.Agents on a.AgentId equals b.Id join c in db.Dealers on b.DealerId equals c.Id where a.AccountId == obj.input.AccountId select new { a.AccountName, a.AgentId, b.AgentName, b.DealerId, c.DealerName }).FirstOrDefault(); if (ACCDeatils != null) { tr.AgentId = Convert.ToInt32(ACCDeatils.AgentId); tr.DealerId = ACCDeatils.DealerId; tr.AgentName = ACCDeatils.AgentName; tr.DealerName = ACCDeatils.DealerName; tr.AccountName = ACCDeatils.AccountName; } tr.AccountId = obj.input.AccountId; tr.AccountUser = obj.param.username; tr.AccountUserId = obj.input.AccountUserId; tr.ServiceId = obj.input.ServiceId; tr.ServiceCode = obj.input.seriviceCode; tr.ServiceRefference = obj.input.serviceName; tr.Amount = obj.input.PaymentAmount; tr.CountryCode = obj.input.countryCode; tr.DeviceId = obj.input.DeviceID; tr.DeviceIMEI = (from a in db.Devices where a.Id == obj.input.DeviceID select a.IMEI).FirstOrDefault(); tr.MobileNumber = obj.input.msisdn; tr.PaymentChannel = obj.input.PaymentChannel; tr.TrackID = obj.input.transactionId; if (rep != null) { tr.OperatorReference = rep.operatorRef; tr.PaymentReference = ""; tr.Pin = rep.pin; tr.Serial = rep.serial; if (rep.status != null) { tr.Status = rep.status; tr.Details = rep.statusDescription; } else { tr.Status = Status; tr.Details = FailureReason; } } else { tr.Status = Status; tr.Details = FailureReason; } tr.TransactionDate = DateTime.Now; tr.UpdatedOn = DateTime.Now; tr.info1 = BalanceType; tr.info2 = Type; tr.info3 = Id; db.DealerTransactions.Add(tr); db.SaveChanges(); Trackid = tr.Id.ToString(); return(Trackid); } catch (Exception ex) { return("ERROR" + ex.Message); } }
public DTO <PINDTO> Pin(Models.Input <PIN> obj) { Models.DTO <PINDTO> dto = new Models.DTO <PINDTO>(); PINDTO resp = new PINDTO(); dto.objname = "Pin"; try { /* Check required parameters */ if (string.IsNullOrEmpty(obj.input.username) || string.IsNullOrEmpty(obj.input.password) || string.IsNullOrEmpty(obj.input.authkey) || string.IsNullOrEmpty(obj.input.msisdn)) { dto.status = new Models.Status(800); return(dto); } if (!(string.IsNullOrEmpty(obj.input.PaymentID))) { obj.input.service = getService(Convert.ToInt32(obj.input.PaymentID)); } Authentication ar = new Authentication(); string hash = ar.UserAuth(obj.input.msisdn, obj.input.service); string uri = ConfigurationManager.AppSettings["oneglobalDOB"].ToString(); string url = uri + "/Pin"; HttpClient client = new HttpClient(); client.BaseAddress = new Uri(url); if (url != null) { try { JavaScriptSerializer jdes = new JavaScriptSerializer(); var reqObj = new PIN(); reqObj.username = obj.input.username; reqObj.password = obj.input.password; reqObj.authkey = obj.input.authkey; reqObj.service = obj.input.service; reqObj.hash = hash; reqObj.msisdn = obj.input.msisdn; reqObj.language = obj.input.language; reqObj.template = obj.input.template; reqObj.appuser = "******"; Input <PIN> inp = new Input <PIN>(); inp.input = reqObj; client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json; charset=utf-8"); HttpResponseMessage response = client.PostAsJsonAsync(url, inp).Result; if (response.IsSuccessStatusCode) { if (response != null) { Task <String> ss = response.Content.ReadAsStringAsync(); var result = JsonConvert.DeserializeObject <Models.DTO <PINDTO> >(ss.Result); if (result != null) { dto.response = result.response; dto.status = result.status; return(dto); } } } } catch (HttpRequestException e) { Console.WriteLine(e.Message); } } } catch (Exception ex) { dto.status = new Models.Status(1); } return(dto); }
static async Task InvokeRequestResponseService(Models.Input input) { using (var client = new HttpClient()) { var scoreRequest = new { Inputs = new Dictionary <string, List <Dictionary <string, string> > >() { { "input1", new List <Dictionary <string, string> >() { new Dictionary <string, string>() { { "UserId", input.UserId }, { "Age", input.Age }, { "Address", input.Address }, { "Gender", input.Gender }, { "UserType", input.UserType }, { "TransactionId", input.TransactionId }, { "Timestamp", input.Timestamp }, { "ItemId", input.ItemId }, { "Quantity", input.Quantity }, { "Value", input.Value }, { "Location", input.Location }, { "ProductCategory", input.ProductCategory }, { "Group", input.Group }, { "ChurnPeriod", input.ChurnPeriod }, } } }, }, GlobalParameters = new Dictionary <string, string>() { } }; const string apiKey = "nEbVHiFhByd7Bu13U9saLXhffkcOBq6zJD0txo3jQnuv8NEwLeQdu7k5rWzZNTtGeeazkfjKFrG9AQx4+c/pdA=="; // Replace this with the API key for the web service client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", apiKey); client.BaseAddress = new Uri("https://ussouthcentral.services.azureml.net/workspaces/11ee6507e4cc444781c42cc522ca73ba/services/75ff1f63cd054a5d833e32127feb0527/execute?api-version=2.0&format=swagger"); // WARNING: The 'await' statement below can result in a deadlock // if you are calling this code from the UI thread of an ASP.Net application. // One way to address this would be to call ConfigureAwait(false) // so that the execution does not attempt to resume on the original context. // For instance, replace code such as: // result = await DoSomeTask() // with the following: // result = await DoSomeTask().ConfigureAwait(false) HttpResponseMessage response = await client.PostAsJsonAsync("", scoreRequest).ConfigureAwait(false); if (response.IsSuccessStatusCode) { string result = await response.Content.ReadAsStringAsync(); OutputData outputData = JsonConvert.DeserializeObject <OutputData>(result); input.result = Math.Round(Convert.ToDouble(outputData.GetResponse().ScoredProbabilities) * 100, 0).ToString(); //Result: {"Results":{"output1":[{"Scored Labels":"Churner","Scored Probabilities":"0.287719696760178"}]}} } else { Console.WriteLine(string.Format("The request failed with status code: {0}", response.StatusCode)); // Print the headers - they include the requert ID and the timestamp, // which are useful for debugging the failure Console.WriteLine(response.Headers.ToString()); string responseContent = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseContent); } } }