//[Route("~/Pushpay/Registration/{DatumId:int}")] public async Task <ActionResult> Registration(PaymentForm pf) { OnlineRegModel m = new OnlineRegModel(CurrentDatabase); RegistrationDatum datum = CurrentDatabase.RegistrationDatas.SingleOrDefault(d => d.Id == pf.DatumId); if (datum == null) { ViewBag.Message = "Something went wrong"; CurrentDatabase.LogActivity($"No datum found with id: {pf.DatumId}"); return(View("~/Views/Shared/PageError.cshtml")); } decimal?Amount = pf.AmtToPay; var mobile = CurrentDatabase.People.SingleOrDefault(p => p.PeopleId == m.UserPeopleId)?.CellPhone; var org = CurrentDatabase.Organizations.SingleOrDefault(o => o.OrganizationId == pf.OrgId); if (org == null) { ViewBag.Message = "Something went wrong"; CurrentDatabase.LogActivity($"No org found with id: {pf.OrgId}"); return(View("~/Views/Shared/PageError.cshtml")); } var fundName = await _resolver.GetOrgFund(CurrentDatabase.CreateRegistrationSettings(pf.OrgId.Value).PushpayFundName); var merchantHandle = GetMerchantHandle(pf.OrgId.Value); return(Redirect($"{_givingLink}{merchantHandle}?ru={_ru}&sr=re_{_state}_{pf.DatumId}-{pf.Amtdue}&rcv=false&r=no&up={mobile}&a={Amount}&fnd={fundName}&al=true&fndv=lock")); }
public async Task <ActionResult> Registration(int DatumId) { OnlineRegModel m = new OnlineRegModel(CurrentDatabase); decimal? Amount = 0; string mobile = string.Empty; string fundName = string.Empty; RegistrationDatum datum = CurrentDatabase.RegistrationDatas.SingleOrDefault(d => d.Id == DatumId); if (datum != null) { m = Util.DeSerialize <OnlineRegModel>(datum.Data); Amount = m.PayAmount() + (m.donation ?? 0); mobile = CurrentDatabase.People.SingleOrDefault(p => p.PeopleId == m.UserPeopleId)?.CellPhone; fundName = await _resolver.GetOrgFund(m.List.FirstOrDefault().setting.PushpayFundName); //Needs to redirect in case cupons are enable. } else { ViewBag.Message = "Something went wrong"; CurrentDatabase.LogActivity($"No datum founded with id: {DatumId}"); return(View("~/Views/Shared/PageError.cshtml")); } return(Redirect($"{_givingLink}?ru={_merchantHandle}&sr=dat_{DatumId}&rcv=false&r=no&up={mobile}&a={Amount}&fnd={fundName}&al=true&fndv=lock")); }