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, 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 }; pf.AllowSaveProgress = m.AllowSaveProgress(); pf.NoCreditCardsAllowed = m.NoCreditCardsAllowed(); pf.UseBootstrap = m.UseBootstrap; 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 = "B"; // bank account only } else if (pf.NoEChecksAllowed) { pf.Type = "C"; // credit card only } pf.Type = pf.NoEChecksAllowed ? "C" : pf.Type; pf.DatumId = m.DatumId ?? 0; return(pf); }
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, 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 }; pf.NoCreditCardsAllowed = m.NoCreditCardsAllowed(); pf.UseBootstrap = m.UseBootstrap; 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 = "B"; // bank account only else if (pf.NoEChecksAllowed) pf.Type = "C"; // credit card only pf.Type = pf.NoEChecksAllowed ? "C" : pf.Type; return pf; }