Exemplo n.º 1
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);
        }
Exemplo n.º 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
#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;
        }