Example #1
0
        public TransactionInfo GetTransactionInfo()
        {
            if (List.Count == 0)
            {
                return(null);
            }
            var p  = List[0];
            var pp = p.person;
            var r  = new TransactionInfo();

            if (user != null && GetTransactionGateway() == "sage" && pp != null)
            {
                r.payinfo = pp.PaymentInfos.FirstOrDefault();
            }
            if (r.payinfo == null)
            {
                r.payinfo = new PaymentInfo {
                    MaskedAccount = "", MaskedCard = ""
                }
            }
            ;

            if (user != null)
            {
                pp       = user;
                r.First  = pp.FirstName;
                r.Last   = pp.LastName;
                r.Middle = pp.MiddleName.Truncate(1);
                r.Email  = pp.EmailAddress;
                r.Suffix = pp.SuffixCode;
                r.Phone  = (pp.HomePhone ?? pp.CellPhone).FmtFone();
            }
            else
            {
                r.Email  = p.EmailAddress;
                r.Suffix = p.Suffix;
                r.First  = p.FirstName;
                r.Middle = p.MiddleName;
                r.Last   = p.LastName;
                r.Suffix = p.Suffix;
                r.Phone  = p.HomePhone ?? p.Phone;
            }

            if (p.org != null && p.setting.AskVisible("AskParents"))
            {
                p.Suffix = "";
                var a = (p.fname ?? p.mname ?? "").Trim().Split(' ');
                if (a.Length > 1)
                {
                    r.First = a[0];
                    r.Last  = a[1];
                }
                else
                {
                    r.Last = a[0];
                }
            }
            if (UserPeopleId.HasValue || p.IsNew)
            {
                if (pp == null)
                {
                    r.Address = p.AddressLineOne.Truncate(50);
                    r.City    = p.City;
                    r.State   = p.State;
                    r.Zip     = p.ZipCode;
                    r.Phone   = p.Phone.FmtFone();
                }
                else
                {
                    r.Address = pp.PrimaryAddress.Truncate(50);
                    r.City    = pp.PrimaryCity;
                    r.State   = pp.PrimaryState;
                    r.Zip     = pp.PrimaryZip;
                    r.Phone   = Util.PickFirst(pp.HomePhone, pp.CellPhone).FmtFone();
                }
            }
            return(r);
        }
Example #2
0
        public TransactionInfo GetTransactionInfo()
        {
            if (List.Count == 0)
                return null;
            var p = List[0];
            var pp = p.person;
            var r = new TransactionInfo();

            if (user != null && GetTransactionGateway() == "sage" && pp != null)
                r.payinfo = pp.PaymentInfos.FirstOrDefault();
            if (r.payinfo == null)
                r.payinfo = new PaymentInfo { MaskedAccount = "", MaskedCard = "" };

            if (user != null)
            {
                pp = user;
                r.First = pp.FirstName;
                r.Last = pp.LastName;
                r.Middle = pp.MiddleName.Truncate(1);
                r.Email = pp.EmailAddress;
                r.Suffix = pp.SuffixCode;
                r.Phone = (pp.HomePhone ?? pp.CellPhone).FmtFone();
            }
            else
            {
                r.Email = p.EmailAddress;
                r.Suffix = p.Suffix;
                r.First = p.FirstName;
                r.Middle = p.MiddleName;
                r.Last = p.LastName;
                r.Suffix = p.Suffix;
                r.Phone = p.HomePhone ?? p.Phone;
            }

            if (p.org != null && p.setting.AskVisible("AskParents"))
            {
                p.Suffix = "";
                var a = (p.fname ?? p.mname ?? "").Trim().Split(' ');
                if (a.Length > 1)
                {
                    r.First = a[0];
                    r.Last = a[1];
                }
                else
                    r.Last = a[0];
            }
            if (UserPeopleId.HasValue || p.IsNew)
            {
                if (pp == null)
                {
                    r.Address = p.AddressLineOne.Truncate(50);
                    r.City = p.City;
                    r.State = p.State;
                    r.Zip = p.ZipCode;
                    r.Phone = p.Phone.FmtFone();
                }
                else
                {
                    r.Address = pp.PrimaryAddress.Truncate(50);
                    r.City = pp.PrimaryCity;
                    r.State = pp.PrimaryState;
                    r.Zip = pp.PrimaryZip;
                    r.Phone = Util.PickFirst(pp.HomePhone, pp.CellPhone).FmtFone();
                }
            }
            return r;
        }