Exemplo n.º 1
0
        public static PaymentForm CreatePaymentForm(OnlineRegModel m)
        {
            var r = m.GetTransactionInfo();
            if (r == null)
                return null;

            var pf = new PaymentForm
            {
                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,
                City = r.City,
                State = r.State,
                Zip = r.Zip,
                Phone = r.Phone,
            #if DEBUG2
                 CreditCard = "4111111111111111",
                 CCV = "123",
                 Expires = "1015",
                 Routing = "056008849",
                 Account = "12345678901234"
            #else
                CreditCard = r.payinfo.MaskedCard,
                Account = r.payinfo.MaskedAccount,
                Routing = r.payinfo.Routing,
                Expires = r.payinfo.Expires,
                MaskedCCV = Util.Mask(new StringBuilder(r.payinfo.Ccv), 0),
                CCV = r.payinfo.Ccv,
                SavePayInfo =
                   (r.payinfo.MaskedAccount != null && r.payinfo.MaskedAccount.StartsWith("X"))
                   || (r.payinfo.MaskedCard != null && r.payinfo.MaskedCard.StartsWith("X")),
                Type = r.payinfo.PreferredPaymentType,
            #endif
            };
            if (m.OnlineGiving())
            {
                pf.NoCreditCardsAllowed = DbUtil.Db.Setting("NoCreditCardGiving", "false").ToBool();
                pf.IsGiving = true;
                pf.Type = r.payinfo.PreferredGivingType;
                if (pf.NoCreditCardsAllowed)
                    pf.Type = "B"; // bank account only
                else if (pf.NoEChecksAllowed)
                    pf.Type = "C"; // credit card only
            }
            pf.Type = pf.NoEChecksAllowed ? "C" : pf.Type;
            return pf;
        }
Exemplo n.º 2
0
        public ActionResult CompleteRegistration(OnlineRegModel m)
        {
            m.History.Add("CompleteRegistration");

            if(m.org != null && m.org.RegistrationTypeId == RegistrationTypeCode.SpecialJavascript )
            {
                SpecialRegModel.ParseResults( m.orgid ?? 0, m.UserPeopleId ?? 0, Request.Form );
                return View( "SpecialRegistrationResults" );
            }

            if (m.AskDonation() && !m.donor.HasValue && m.donation > 0)
            {
                SetHeaders(m);
                ModelState.AddModelError("donation",
                     "Please indicate a donor or clear the donation amount");
                return View("AskDonation", m);
            }

            if (m.List.Count == 0)
                return Content("Can't find any registrants");

            RemmoveLastRegistrantIfEmpty(m);

            var d = new ExtraDatum { Stamp = Util.Now };
            d.Data = Util.Serialize<OnlineRegModel>(m);
            DbUtil.Db.ExtraDatas.InsertOnSubmit(d);
            DbUtil.Db.SubmitChanges();
            DbUtil.LogActivity("Online Registration: {0} ({1})".Fmt(m.Header, d.Id));

            if (m.PayAmount() == 0 && (m.donation ?? 0) == 0 && !m.Terms.HasValue())
                return RedirectToAction("Confirm",
                     new
                     {
                         id = d.Id,
                         TransactionID = "zero due",
                     });

            var terms = Util.PickFirst(m.Terms, "");
            if (terms.HasValue())
                ViewData["Terms"] = terms;

            SetHeaders(m);
            if (m.PayAmount() == 0 && m.Terms.HasValue())
            {
                return View("Terms", new PaymentModel
                     {
                         Terms = m.Terms,
                         _URL = m.URL,
                         _timeout = INT_timeout,
                         PostbackURL = Util.ServerLink("/OnlineReg/Confirm/" + d.Id),
                     });
            }

            ViewBag.timeout = INT_timeout;
            ViewBag.Url = m.URL;

            var om =
                 DbUtil.Db.OrganizationMembers.SingleOrDefault(
                      mm => mm.OrganizationId == m.orgid && mm.PeopleId == m.List[0].PeopleId);
            m.ParseSettings();

            if (om != null && m.settings[m.orgid.Value].AllowReRegister == false)
            {
                return Content("You are already registered it appears");
            }

            var pf = PaymentForm.CreatePaymentForm(m);
            pf.DatumId = d.Id;
            pf.FormId = Guid.NewGuid();
            if (OnlineRegModel.GetTransactionGateway() == "serviceu")
                return View("Payment", pf);
            return View("ProcessPayment", pf);
        }
Exemplo n.º 3
0
        public static PaymentForm CreatePaymentForm(OnlineRegModel m)
        {
            var r = m.GetTransactionInfo();

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

            var pf = new PaymentForm
            {
                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.Header,
                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,
                City          = r.City,
                State         = r.State,
                Zip           = r.Zip,
                Phone         = r.Phone,
#if DEBUG2
                CreditCard = "4111111111111111",
                CCV        = "123",
                Expires    = "1015",
                Routing    = "056008849",
                Account    = "12345678901234"
#else
                CreditCard  = r.payinfo.MaskedCard,
                Account     = r.payinfo.MaskedAccount,
                Routing     = r.payinfo.Routing,
                Expires     = r.payinfo.Expires,
                MaskedCCV   = Util.Mask(new StringBuilder(r.payinfo.Ccv), 0),
                CCV         = r.payinfo.Ccv,
                SavePayInfo =
                    (r.payinfo.MaskedAccount != null && r.payinfo.MaskedAccount.StartsWith("X")) ||
                    (r.payinfo.MaskedCard != null && r.payinfo.MaskedCard.StartsWith("X")),
                Type = r.payinfo.PreferredPaymentType,
#endif
            };

            if (m.OnlineGiving())
            {
                pf.NoCreditCardsAllowed = DbUtil.Db.Setting("NoCreditCardGiving", "false").ToBool();
                pf.IsGiving             = true;
                pf.Type = r.payinfo.PreferredGivingType;
                if (pf.NoCreditCardsAllowed)
                {
                    pf.Type = "B"; // bank account only
                }
                else if (pf.NoEChecksAllowed)
                {
                    pf.Type = "C"; // credit card only
                }
            }
            pf.Type = pf.NoEChecksAllowed ? "C" : pf.Type;
            return(pf);
        }
Exemplo n.º 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    = "1015",
                Routing    = "056008849",
                Account    = "12345678901234"
#else
                CreditCard  = r.payinfo.MaskedCard,
                Account     = r.payinfo.MaskedAccount,
                Routing     = r.payinfo.Routing,
                Expires     = r.payinfo.Expires,
                SavePayInfo =
                    (r.payinfo.MaskedAccount != null && r.payinfo.MaskedAccount.StartsWith("X")) ||
                    (r.payinfo.MaskedCard != null && r.payinfo.MaskedCard.StartsWith("X")),
                Type = r.payinfo.PreferredPaymentType,
#endif
            };

            ClearMaskedNumbers(pf, r.payinfo);

            pf.AllowSaveProgress    = m.AllowSaveProgress();
            pf.NoCreditCardsAllowed = m.NoCreditCardsAllowed();
            if (m.OnlineGiving())
            {
                pf.NoCreditCardsAllowed = DbUtil.Db.Setting("NoCreditCardGiving", "false").ToBool();
                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);
        }