示例#1
0
 private string RouteManageGivingSubscriptionsPledgeVolunteer(OnlineRegModel m)
 {
     if (m.RegisterLinkMaster())
     {
         if (m.registerLinkType == "masterlink" || User.Identity.IsAuthenticated)
         {
             TempData["token"] = m.registertag;
             TempData["PeopleId"] = m.UserPeopleId ?? Util.UserPeopleId;
         }
         return $"/OnlineReg/RegisterLinkMaster/{m.Orgid}";
     }
     TempData["PeopleId"] = m.UserPeopleId ?? Util.UserPeopleId;
     if (m.ManagingSubscriptions())
         return $"/OnlineReg/ManageSubscriptions/{m.masterorgid}";
     if (m.ManageGiving())
         return $"/OnlineReg/ManageGiving/{m.Orgid}";
     if (m.OnlinePledge())
         return $"/OnlineReg/ManagePledge/{m.Orgid}";
     if (m.ChoosingSlots())
         return $"/OnlineReg/ManageVolunteer/{m.Orgid}";
     TempData.Remove("PeopleId");
     return null;
 }
示例#2
0
        public static PaymentForm CreatePaymentForm(OnlineRegModel m)
        {
            var r = m.GetTransactionInfo();

            if (r == null)
            {
                return(null);
            }

            var pf = new PaymentForm
            {
                FormId             = Guid.NewGuid(),
                AmtToPay           = m.PayAmount() + (m.donation ?? 0),
                AskDonation        = m.AskDonation(),
                AllowCoupon        = !m.OnlineGiving(),
                PayBalance         = false,
                Amtdue             = m.TotalAmount() + (m.donation ?? 0),
                Donate             = m.donation,
                Description        = m.DescriptionForPayment,
                Email              = r.Email,
                First              = r.First,
                MiddleInitial      = r.Middle,
                Last               = r.Last,
                Suffix             = r.Suffix,
                IsLoggedIn         = m.UserPeopleId.HasValue,
                OrgId              = m.List[0].orgid,
                URL                = m.URL,
                testing            = m.testing ?? false,
                Terms              = m.Terms,
                Address            = r.Address,
                Address2           = r.Address2,
                City               = r.City,
                State              = r.State,
                Country            = r.Country,
                Zip                = r.Zip,
                Phone              = r.Phone,
                SupportMissionTrip = m.SupportMissionTrip,
                extTransactionId   = m.transactionId,
                ProcessType        = m.ProcessType,
#if DEBUG2
                CreditCard = "4111111111111111",
                CVV        = "123",
                Expires    = "1017",
                Routing    = "056008849",
                Account    = "12345678901234",
#endif
            };

            if (r.payinfo.PeopleId == m.UserPeopleId) // Is this the logged in user?
            {
                pf.CreditCard  = r.payinfo.MaskedCard;
                pf.Account     = r.payinfo.MaskedAccount;
                pf.Routing     = r.payinfo.Routing;
                pf.Expires     = r.payinfo.Expires;
                pf.SavePayInfo =
                    (r.payinfo.MaskedAccount != null && r.payinfo.MaskedAccount.StartsWith("X")) ||
                    (r.payinfo.MaskedCard != null && r.payinfo.MaskedCard.StartsWith("X"));
                pf.Type = r.payinfo.PreferredPaymentType;

                // if no preferred payment type pick credit card or ach if we have anything.
                if (string.IsNullOrWhiteSpace(pf.Type))
                {
                    pf.Type = !string.IsNullOrWhiteSpace(pf.CreditCard) ? PaymentType.CreditCard : null;
                }

                if (string.IsNullOrWhiteSpace(pf.Type))
                {
                    pf.Type = !string.IsNullOrWhiteSpace(pf.Account) ? PaymentType.Ach : null;
                }
            }

            ClearMaskedNumbers(pf, r.payinfo);

            pf.AllowSaveProgress    = m.AllowSaveProgress();
            pf.NoCreditCardsAllowed = m.NoCreditCardsAllowed();
            if (m.OnlineGiving())
            {
#if DEBUG
                pf.NoCreditCardsAllowed = false;
#else
                pf.NoCreditCardsAllowed = DbUtil.Db.Setting("NoCreditCardGiving", "false").ToBool();
#endif
                pf.IsGiving    = true;
                pf.FinanceOnly = true;
                pf.Type        = r.payinfo.PreferredGivingType;
            }
            else if (m.ManageGiving() || m.OnlinePledge())
            {
                pf.FinanceOnly = true;
            }
            if (pf.NoCreditCardsAllowed)
            {
                pf.Type = PaymentType.Ach; // bank account only
            }
            else if (pf.NoEChecksAllowed)
            {
                pf.Type = PaymentType.CreditCard; // credit card only
            }

            pf.Type    = pf.NoEChecksAllowed ? PaymentType.CreditCard : pf.Type;
            pf.DatumId = m.DatumId ?? 0;
            return(pf);
        }
示例#3
0
        private ActionResult RouteRegistration(OnlineRegModel m, int pid, bool? showfamily)
        {
            if(pid == 0)
                return View(m);
#if DEBUG
            m.DebugCleanUp();
#endif

            var link = RouteExistingRegistration(m, pid);
            if (link.HasValue())
                return Redirect(link);

            OnlineRegPersonModel p = null;
            if (showfamily != true)
            {
                // No need to pick family, so prepare first registrant ready to answer questions
                p = m.LoadExistingPerson(pid, 0);
                p.ValidateModelForFind(ModelState, 0);
                if (m.masterorg == null)
                {
                    if (m.List.Count == 0)
                        m.List.Add(p);
                    else
                        m.List[0] = p;
                }
            }
            if (!ModelState.IsValid)
            {
                m.Log("CannotProceed");
                return View(m);
            }

            link = RouteManageGivingSubscriptionsPledgeVolunteer(m);
            if(link.HasValue())
                if (m.ManageGiving()) // use Direct ActionResult instead of redirect
                    return ManageGiving(m.Orgid.ToString(), m.testing);
                else if (m.RegisterLinkMaster())
                    return Redirect(link);
                else
                    return Redirect(link);

            // check for forcing show family, master org, or not found
            if (showfamily == true || p.org == null || p.Found != true)
                return View(m);

            // ready to answer questions, make sure registration is ok to go
            m.Log("Authorized");
            if (!m.SupportMissionTrip)
                p.IsFilled = p.org.RegLimitCount(DbUtil.Db) >= p.org.Limit;
            if (p.IsFilled)
            {
                m.Log("Closed");
                ModelState.AddModelError(m.GetNameFor(mm => mm.List[0].Found), "Sorry, but registration is closed.");
            }

            p.FillPriorInfo();
            p.SetSpecialFee();

            m.HistoryAdd($"index, pid={pid}, !showfamily, p.org, found=true");
            return View(m);
        }
示例#4
0
        public static PaymentForm CreatePaymentForm(OnlineRegModel m)
        {
            var r = m.GetTransactionInfo();
            if (r == null)
                return null;

            var pf = new PaymentForm
            {
                FormId = Guid.NewGuid(),
                AmtToPay = m.PayAmount() + (m.donation ?? 0),
                AskDonation = m.AskDonation(),
                AllowCoupon = !m.OnlineGiving(),
                PayBalance = false,
                Amtdue = m.TotalAmount() + (m.donation ?? 0),
                Donate = m.donation,
                Description = m.DescriptionForPayment,
                Email = r.Email,
                First = r.First,
                MiddleInitial = r.Middle,
                Last = r.Last,
                Suffix = r.Suffix,
                IsLoggedIn = m.UserPeopleId.HasValue,
                OrgId = m.List[0].orgid,
                URL = m.URL,
                testing = m.testing ?? false,
                Terms = m.Terms,
                Address = r.Address,
                Address2 = r.Address2,
                City = r.City,
                State = r.State,
                Country = r.Country,
                Zip = r.Zip,
                Phone = r.Phone
#if DEBUG2
                 CreditCard = "4111111111111111",
                 CVV = "123",
                 Expires = "1017",
                 Routing = "056008849",
                 Account = "12345678901234"
#endif
            };
            if (r.payinfo.PeopleId == m.UserPeopleId) // Is this the logged in user?
            {
                pf.CreditCard = r.payinfo.MaskedCard;
                pf.Account = r.payinfo.MaskedAccount;
                pf.Routing = r.payinfo.Routing;
                pf.Expires = r.payinfo.Expires;
                pf.SavePayInfo =
                    (r.payinfo.MaskedAccount != null && r.payinfo.MaskedAccount.StartsWith("X"))
                    || (r.payinfo.MaskedCard != null && r.payinfo.MaskedCard.StartsWith("X"));
                pf.Type = r.payinfo.PreferredPaymentType;
            }

            ClearMaskedNumbers(pf, r.payinfo);

            pf.AllowSaveProgress = m.AllowSaveProgress();
            pf.NoCreditCardsAllowed = m.NoCreditCardsAllowed();
            if (m.OnlineGiving())
            {
#if DEBUG
                pf.NoCreditCardsAllowed = false;
#else
                pf.NoCreditCardsAllowed = DbUtil.Db.Setting("NoCreditCardGiving", "false").ToBool();
#endif
                pf.IsGiving = true;
                pf.FinanceOnly = true;
                pf.Type = r.payinfo.PreferredGivingType;
            }
            else if (m.ManageGiving() || m.OnlinePledge())
            {
                pf.FinanceOnly = true;
            }
            if (pf.NoCreditCardsAllowed)
                pf.Type = PaymentType.Ach; // bank account only
            else if (pf.NoEChecksAllowed)
                pf.Type = PaymentType.CreditCard; // credit card only
            pf.Type = pf.NoEChecksAllowed ? PaymentType.CreditCard : pf.Type;
            pf.DatumId = m.DatumId ?? 0;
            return pf;
        }