Exemple #1
0
        private void InitializePaymentInfo(int peopleId)
        {
            var person    = CurrentDatabase.LoadPersonById(peopleId);
            var accountId = MultipleGatewayUtils.GetAccount(CurrentDatabase, ProcessType)?.GatewayAccountId;
            var pi        = person.PaymentInfo(accountId ?? 0);

            if (pi == null)
            {
                pi = new PaymentInfo()
                {
                    GatewayAccountId = accountId ?? 0
                };
                person.PaymentInfos.Add(pi);
            }
            pi.SetBillingAddress(First, MiddleInitial, Last, Suffix, Address, Address2, City,
                                 State, Country, Zip, Phone);
        }
        private TransactionInfo InitializeTransactionInfo()
        {
            var r         = new TransactionInfo();
            var accountId = MultipleGatewayUtils.GetAccount(CurrentDatabase, ProcessType)?.GatewayAccountId ?? 0;

            if (user != null && FirstPerson != null)
            {
                r.payinfo = FirstPerson.PaymentInfo(accountId);
            }
            if (r.payinfo == null)
            {
                r.payinfo = new PaymentInfo {
                    MaskedAccount = "", MaskedCard = "", GatewayAccountId = accountId
                };
            }
            return(r);
        }
Exemple #3
0
        public static PaymentForm CreatePaymentFormForBalanceDue(CMSDataContext db, Transaction ti, decimal amtdue, string email)
        {
            PaymentInfo pi        = null;
            var         accountId = MultipleGatewayUtils.GetAccount(db, PaymentProcessTypes.OnlineRegistration)?.GatewayAccountId;

            if (ti.Person != null)
            {
                pi = ti.Person.PaymentInfo(accountId ?? 0);
            }

            if (pi == null)
            {
                pi = new PaymentInfo()
                {
                    GatewayAccountId = accountId ?? 0
                };
            }

            var pf = new PaymentForm
            {
                URL           = ti.Url,
                PayBalance    = true,
                AmtToPay      = amtdue,
                Amtdue        = 0,
                AllowCoupon   = true,
                AskDonation   = false,
                Description   = ti.Description,
                OrgId         = ti.OrgId,
                OriginalId    = ti.OriginalId,
                Email         = Util.FirstAddress(ti.Emails ?? email).Address,
                FormId        = Guid.NewGuid(),
                First         = ti.First,
                MiddleInitial = ti.MiddleInitial.Truncate(1) ?? "",
                Last          = ti.Last,
                Suffix        = ti.Suffix,
                Phone         = ti.Phone,
                Address       = ti.Address,
                Address2      = ti.Address2,
                City          = ti.City,
                State         = ti.State,
                Country       = ti.Country,
                Zip           = ti.Zip,
                testing       = ti.Testing ?? false,
                TranId        = ti.Id,
                ProcessType   = PaymentProcessTypes.OnlineRegistration
            };

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

            ClearMaskedNumbers(pf, pi);

            var org = db.LoadOrganizationById(ti.OrgId);

            pf.NoCreditCardsAllowed = org?.NoCreditCards == true;
            pf.Type = pf.NoEChecksAllowed ? PaymentType.CreditCard : pf.NoCreditCardsAllowed ? PaymentType.Ach : "";
            return(pf);
        }
Exemple #4
0
 public static GatewayAccount GetTransactionGateway(PaymentProcessTypes processType = PaymentProcessTypes.OnlineRegistration)
 {
     return(MultipleGatewayUtils.GetAccount(DbUtil.Db, processType));
 }
Exemple #5
0
 public static GatewayAccount GetTransactionGateway(CMSDataContext db, PaymentProcessTypes processType = PaymentProcessTypes.OnlineRegistration)
 {
     return(MultipleGatewayUtils.GetAccount(db, processType));
 }