public virtual ActionResult Donate(DonateModel model) { if (!StringExtensions.IsValidLtPersonCode(model.PersonCode)) { ModelState.AddModelError("PersonCode", "Neteisingas asmens kodas"); } if (model.IsPersonCodeRequired && string.IsNullOrEmpty(model.PersonCode)) { ModelState.AddModelError("PersonCode", "Įveskite asmens kodą"); } if (ModelState.IsValid) { var result = Service.GetWebToPayModel( model, ConfigurationManager.AppSettings["WebToPay_Password"], ConfigurationManager.AppSettings["WebToPay_ProjectId"], Url.ActionAbsolute(MVC.Sponsor.Accept()), Url.ActionAbsolute(MVC.Sponsor.Cancel()), Url.ActionAbsolute(MVC.Sponsor.Callback()), ConfigurationManager.AppSettings["WebToPay_PayText"], ConfigurationManager.AppSettings["WebToPay_Test"]); if (!string.IsNullOrEmpty(model.PersonCode)) { Service.SavePersonCode(model.PersonCode); } return(View(result)); } return(View(MVC.Sponsor.Views.About, model)); }
public virtual async void OpenDonation() { if (Wallet.View is DonateModel) { return; } var oldView = Wallet.View; var donateModel = new DonateModel( (m, a, v) => { try { OpenSendAndSend(a, v); Wallet.View = oldView; } catch (Exception e) { m.ErrorText = e.Message; } }, m => Wallet.View = oldView); Wallet.View = donateModel; }
public async Task <IActionResult> Donate([FromBody] DonateModel model) { var command = new DonateCommand { Amount = model.Amount, UserMultiAccountId = model.UserMultiAccountId, RequestedUserAccount = GetLoggerUserFromJwt() }; return(Ok(await _mediator.Send(command))); }
public WebToPayModel GetWebToPayModel(DonateModel model, string password, string projectId, string acceptUrl, string cancelUrl, string callbackUrl, string paytext, string test) { var orderid = GetNewOrderId(model); NameValueCollection nvc = new NameValueCollection() { { "projectid", projectId }, { "orderid", orderid }, { "lang", "LIT" }, { "amount", model.Amount.ToString() }, { "currency", "EUR" }, { "accepturl", acceptUrl }, { "cancelurl", cancelUrl }, { "callbackurl", callbackUrl }, { "payment", model.PaymentType }, { "country", "LT" }, { "paytext", paytext }, { "p_firstname", model.FirstName }, { "p_lastname", model.LastName }, { "p_email", model.Email }, { "p_street", "" }, { "p_city", "" }, { "p_state", "" }, { "p_zip", "" }, { "p_countrycode", "" }, { "test", test }, { "version", "1.6" }, { "personcode", (model.PersonCode ?? string.Empty).Trim() } }; var qs = ToQueryString(nvc); var data = Convert.ToBase64String(Encoding.UTF8.GetBytes(qs)); data = data.Replace('/', '_').Replace('+', '-'); var result = new WebToPayModel() { firstname = model.FirstName, lastname = model.LastName, email = model.Email, personcode = model.PersonCode, orderid = orderid, amount = model.Amount.ToString(), data = data, sign = (data + password).GetMd5Hash(), Gifts = GetAvailableGifts(model.Amount), PaymentType = model.PaymentType }; return(result); }
public string GetNewOrderId(DonateModel model) { using (var session = usersSessionFactory.CreateContext()) { var order = new Data.EF.Users.WebToPayLog() { Date = DateTime.Now, UserId = CurrentUser.IsAuthenticated ? (int?)CurrentUser.DbId : null, Firstname = model.FirstName, LastName = model.LastName, Email = model.Email, Status = 0 }; session.WebToPayLogs.Add(order); session.SaveChanges(); return(order.Id.ToString()); } }
public DonateModel GetDonateModel() { using (var session = usersSessionFactory.CreateContext()) { Data.EF.Users.User user = null; if (CurrentUser.IsAuthenticated) { user = session.Users.SingleOrDefault(u => u.Id == CurrentUser.DbId); } var model = new DonateModel() { FirstName = user != null ? user.FirstName : null, LastName = user != null ? user.LastName : null, Email = user != null?user.UserEmails.Where(e => e.SendMail && e.IsEmailConfirmed).Select(e => e.Email).FirstOrDefault() : null }; return(model); } }
public IActionResult Donate() { var donateModel = new DonateModel(); return(View(donateModel)); }