Exemplo n.º 1
0
        public AuthorizeNetGateway(CMSDataContext db, bool testing, PaymentProcessTypes ProcessType)
        {
            this.db = db;
            IsLive  = !(testing || MultipleGatewayUtils.GatewayTesting(db, ProcessType));
            if (!IsLive)
            {
                _login = "******";
                _key   = "9wE4j7M372ehz6Fy";
            }
            else
            {
                _login = MultipleGatewayUtils.Setting(db, "x_login", "", (int)ProcessType);
                _key   = MultipleGatewayUtils.Setting(db, "x_tran_key", "", (int)ProcessType);

                if (string.IsNullOrWhiteSpace(_login))
                {
                    throw new Exception("x_login setting not found, which is required for Authorize.net.");
                }

                if (string.IsNullOrWhiteSpace(_key))
                {
                    throw new Exception("x_tran_key setting not found, which is required for Authorize.net.");
                }
            }
        }
Exemplo n.º 2
0
        public SageGateway(CMSDataContext db, bool testing, PaymentProcessTypes ProcessType)
        {
            this.db = db;
            var gatewayTesting = MultipleGatewayUtils.GatewayTesting(db, ProcessType);

            if (testing || gatewayTesting)
            {
                _id           = "856423594649";
                _key          = "M5Q4C9P2T4N5";
                _originatorId = "1111111111";
            }
            else
            {
                _id  = MultipleGatewayUtils.Setting(db, "M_ID", "", (int)ProcessType);
                _key = MultipleGatewayUtils.Setting(db, "M_KEY", "", (int)ProcessType);

                if (string.IsNullOrWhiteSpace(_id))
                {
                    throw new Exception("M_ID setting not found, which is required for Sage.");
                }
                if (string.IsNullOrWhiteSpace(_key))
                {
                    throw new Exception("M_KEY setting not found, which is required for Sage.");
                }

                _originatorId = MultipleGatewayUtils.Setting(db, "SageOriginatorId", "", (int)ProcessType);
            }
        }
Exemplo n.º 3
0
        public AcceptivaGateway(CMSDataContext db, bool testing, PaymentProcessTypes ProcessType)
        {
            this.db          = db;
            this.ProcessType = ProcessType;

            if (testing || MultipleGatewayUtils.GatewayTesting(db, ProcessType))
            {
                _apiKey       = "CZDWp7dXCo4W3xTA7LtWAijidvPdj2wa";
                _merch_ach_id = "dKdDFtqC";
                _merch_cc_id  = "R6MLUevR";
                _isTesting    = true;
                //If this setting exists we settle transactions manually, so we can refund.
                //For live environment settlements are automatic 1 day later
                _automaticSettle = db.Setting("AutomaticSettle");
            }
            else
            {
                _apiKey       = MultipleGatewayUtils.Setting(db, "AcceptivaApiKey", "", (int)ProcessType);
                _merch_ach_id = MultipleGatewayUtils.Setting(db, "AcceptivaAchId", "", (int)ProcessType);
                _merch_cc_id  = MultipleGatewayUtils.Setting(db, "AcceptivaCCId", "", (int)ProcessType);

                if (string.IsNullOrWhiteSpace(_apiKey))
                {
                    throw new Exception("AcceptivaApiKey setting not found, which is required for Acceptiva.");
                }
                if (string.IsNullOrWhiteSpace(_merch_ach_id))
                {
                    throw new Exception("AcceptivaAcctId setting not found, which is required for Acceptiva.");
                }
                if (string.IsNullOrWhiteSpace(_merch_cc_id))
                {
                    throw new Exception("AcceptivaCCId setting not found, which is required for Acceptiva.");
                }
            }
        }
Exemplo n.º 4
0
        private string AchType(int?pid)
        {
            var type = "checking";

            if (pid.HasValue)
            {
                var usesaving = MultipleGatewayUtils.Setting(db, "UseSavingAccounts", (int)ProcessType);
                if (usesaving)
                {
                    if (Person.GetExtraValue(db, pid.Value, "AchSaving")?.BitValue == true)
                    {
                        type = "savings";
                    }
                }
            }
            return(type);
        }
Exemplo n.º 5
0
        public BluePayGateway(CMSDataContext db, bool testing, PaymentProcessTypes ProcessType)
        {
            this.db = db;
            IsLive  = !(testing || MultipleGatewayUtils.GatewayTesting(db, ProcessType));

            _login = MultipleGatewayUtils.Setting(db, "bluepay_accountId", "", (int)ProcessType);
            _key   = MultipleGatewayUtils.Setting(db, "bluepay_secretKey", "", (int)ProcessType);

            if (string.IsNullOrWhiteSpace(_login))
            {
                throw new Exception("bluepay_accountId setting not found, which is required for BluePay.");
            }

            if (string.IsNullOrWhiteSpace(_key))
            {
                throw new Exception("bluepay_secretKey setting not found, which is required for BluePay.");
            }
        }
Exemplo n.º 6
0
        public PushpayController(IRequestManager requestManager) : base(requestManager)
        {
            PaymentProcessTypes processType = PaymentProcessTypes.OneTimeGiving;

            try
            {
                processType = (PaymentProcessTypes)int.Parse(requestManager.SessionProvider.Get <string>("PaymentProcessType"));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }


            _pushpay = new PushpayConnection(
                CurrentDatabase.GetSetting("PushPayAccessToken", ""),
                CurrentDatabase.GetSetting("PushPayRefreshToken", ""),
                CurrentDatabase,
                Configuration.Current.PushpayAPIBaseUrl,
                Configuration.Current.PushpayClientID,
                Configuration.Current.PushpayClientSecret,
                Configuration.Current.OAuth2TokenEndpoint,
                Configuration.Current.TouchpointAuthServer,
                Configuration.Current.OAuth2AuthorizeEndpoint);

            _pushpayPayment        = new PushpayPayment(_pushpay, CurrentDatabase, processType);
            _resolver              = new PushpayResolver(_pushpay, CurrentDatabase);
            _defaultMerchantHandle = _pushpayPayment._defaultMerchantHandle;
            _givingLink            = Configuration.Current.PushpayGivingLinkBase;
            _state = CurrentDatabase.Host;

            isTesting = MultipleGatewayUtils.Setting(CurrentDatabase, "GatewayTesting", (int)processType);
            if (isTesting)
            {
                _ru = "touchpointest";
            }
            else
            {
                _ru = Configuration.Current.PushpayRU;
            }
        }
Exemplo n.º 7
0
        public TransNationalGateway(CMSDataContext db, bool testing, PaymentProcessTypes ProcessType)
        {
            this.db = db;

            if (testing || MultipleGatewayUtils.GatewayTesting(db, ProcessType))
            {
                _userName = "******";
                _password = "******";
            }
            else
            {
                _userName = MultipleGatewayUtils.Setting(db, "TNBUsername", "", (int)ProcessType);
                _password = MultipleGatewayUtils.Setting(db, "TNBPassword", "", (int)ProcessType);

                if (string.IsNullOrWhiteSpace(_userName))
                {
                    throw new Exception("TNBUsername setting not found, which is required for TransNational.");
                }
                if (string.IsNullOrWhiteSpace(_password))
                {
                    throw new Exception("TNBPassword setting not found, which is required for TransNational.");
                }
            }
        }
Exemplo n.º 8
0
        public ActionResult OnePageGiving(int id, bool?testing, string source)
        {
            Response.NoCache();
            try
            {
                var m = new OnlineRegModel(Request, CurrentDatabase, id, testing, null, null, source);

                var pid = Util.UserPeopleId;
                if (pid.HasValue)
                {
                    PrePopulate(m, pid.Value);
                }

                SetHeaders(m);
                m.CheckRegisterLink(null);

                if (m.NotActive())
                {
                    return(View("OnePageGiving/NotActive", m));
                }

                if ((m.org.IsMissionTrip.IsNotNull() && m.org.IsMissionTrip == true) ? true : false)
                {
                    m.ProcessType = PaymentProcessTypes.OneTimeGiving;
                }
                else
                {
                    m.ProcessType = (m.org.RegistrationTypeId.IsNull() || m.org.RegistrationTypeId == RegistrationTypeCode.OnlineGiving)
                        ? PaymentProcessTypes.OneTimeGiving
                        : PaymentProcessTypes.OnlineRegistration;
                }

                int?GatewayId = MultipleGatewayUtils.GatewayId(CurrentDatabase, m.ProcessType);

                if (GatewayId == (int)GatewayTypes.Pushpay && m.OnlineGiving())
                {
                    ViewBag.Header = "One Page Giving";
                    if (string.IsNullOrEmpty(MultipleGatewayUtils.Setting(CurrentDatabase, "PushpayMerchant", "", (int)m.ProcessType)))
                    {
                        return(View("OnePageGiving/NotConfigured"));
                    }

                    return(Redirect($"/Pushpay/OnePage"));
                }

                var pf = PaymentForm.CreatePaymentForm(m);
                pf.AmtToPay = null;

                if (string.IsNullOrWhiteSpace(pf.Type))
                {
                    pf.Type = pf.NoCreditCardsAllowed ? "B" : "C";
                }

#if DEBUG
                if (!pid.HasValue)
                {
                    pf.First      = "Otis";
                    pf.Last       = "Sukamotis";
                    pf.Email      = "*****@*****.**";
                    pf.Address    = "135 Riveredge Cv";
                    pf.Zip        = "";
                    pf.CreditCard = "3111111111111111";
                    pf.Expires    = "1018";
                    pf.CVV        = "123";
                    pf.AmtToPay   = 23M;
                }
#endif

                var p = m.List[0];
                if (pf.ShowCampusOnePageGiving)
                {
                    pf.Campuses = p.Campuses().ToList();
                }

                var designatedFund = p.DesignatedDonationFund().FirstOrDefault();
                pf.Description = designatedFund != null ? designatedFund.Text : m.DescriptionForPayment;

                SetInstructions(m);

                return(View("OnePageGiving/Index", new OnePageGivingModel()
                {
                    OnlineRegPersonModel = m.List[0], PaymentForm = pf
                }));
            }
            catch (Exception ex)
            {
                if (ex is BadRegistrationException)
                {
                    return(Message(ex.Message));
                }
                throw;
            }
        }
Exemplo n.º 9
0
        public ActionResult PayAmtDue(string q)
        {
            // reached by the paylink in the confirmation email
            // which is produced in EnrollAndConfirm
            Response.NoCache();

            if (!Util.HasValue(q))
            {
                return(Message("unknown"));
            }

            var id = Util.Decrypt(q).ToInt2();
            var qq = from t in CurrentDatabase.Transactions
                     where t.OriginalId == id || t.Id == id
                     orderby t.Id descending
                     select new { t, email = t.TransactionPeople.FirstOrDefault().Person.EmailAddress };
            var i = qq.FirstOrDefault();

            if (i == null)
            {
                return(Message("no outstanding transaction"));
            }

            var ti     = i.t;
            var email  = i.email;
            var amtdue = PaymentForm.AmountDueTrans(CurrentDatabase, ti);

            if (amtdue == 0)
            {
                return(Message("no outstanding transaction"));
            }

            int?GatewayId = MultipleGatewayUtils.GatewayId(CurrentDatabase, PaymentProcessTypes.OnlineRegistration);

            if ((int)GatewayTypes.Pushpay == GatewayId)
            {
                ViewBag.Header = "Payment Process";
                if (string.IsNullOrEmpty(MultipleGatewayUtils.Setting(CurrentDatabase, "PushpayMerchant", "", (int)PaymentProcessTypes.OnlineRegistration)))
                {
                    return(View("OnePageGiving/NotConfigured"));
                }

                Session["PaymentProcessType"] = PaymentProcessTypes.OnlineRegistration;
                return(Redirect($"/Pushpay/PayAmtDue/{ti.Id}/{amtdue}"));
            }
#if DEBUG
            ti.Testing = true;
            if (!Util.HasValue(ti.Address))
            {
                ti.Address = "235 Riveredge";
                ti.City    = "Cordova";
                ti.Zip     = "38018";
                ti.State   = "TN";
            }
#endif
            var pf = PaymentForm.CreatePaymentFormForBalanceDue(CurrentDatabase, ti, amtdue, email);
            pf.ProcessType = PaymentProcessTypes.OnlineRegistration;

            SetHeaders(pf.OrgId ?? 0);

            DbUtil.LogActivity("OnlineReg PayDueStart", ti.OrgId, ti.LoginPeopleId ?? ti.FirstTransactionPeopleId());
            return(View("Payment/Process", pf));
        }
Exemplo n.º 10
0
 public PushpayPayment(PushpayConnection Pushpay, CMSDataContext db, PaymentProcessTypes processType)
 {
     _pushpay        = Pushpay;
     _db             = db;
     _merchantHandle = MultipleGatewayUtils.Setting(db, "PushpayMerchant", "", (int)processType);
 }
Exemplo n.º 11
0
        public ActionResult Index(int?id, bool?testing, string email, bool?login, string registertag, bool?showfamily, int?goerid, int?gsid, string source, int?pledgeFund)
        {
            Response.NoCache();

            var m             = new OnlineRegModel(Request, CurrentDatabase, id, testing, email, login, source);
            var isMissionTrip = (m.org?.IsMissionTrip).GetValueOrDefault();

            if (isMissionTrip)
            {
                m.ProcessType = PaymentProcessTypes.OnlineRegistration;
            }
            else
            {
                AssignPaymentProcessType(ref m);
            }

            if (pledgeFund != null)
            {
                m.pledgeFundId = pledgeFund.Value;
            }

            SetHeaders(m);

            int?GatewayId       = MultipleGatewayUtils.GatewayId(CurrentDatabase, m.ProcessType);
            var gatewayRequired = (m.PayAmount() > 0 || m.ProcessType == PaymentProcessTypes.OneTimeGiving || m.ProcessType == PaymentProcessTypes.RecurringGiving);

            if (GatewayId.IsNull() && gatewayRequired)
            {
                return(View("OnePageGiving/NotConfigured"));
            }

            if ((int)GatewayTypes.Pushpay == GatewayId && string.IsNullOrEmpty(MultipleGatewayUtils.Setting(CurrentDatabase, "PushpayMerchant", "", (int)m.ProcessType)))
            {
                ViewBag.Header       = m.Header;
                ViewBag.Instructions = m.Instructions;
                return(View("OnePageGiving/NotConfigured"));
            }

            if (m.ManageGiving())
            {
                Session[$"Campus-{m.Orgid}"] =
                    m.Campus            = Request.QueryString["campus"];
                Session["DefaultFunds"] = Request.QueryString["funds"];
                m.DefaultFunds          = Session["DefaultFunds"]?.ToString();
            }

            if (isMissionTrip)
            {
                if (gsid != null || goerid != null)
                {
                    m.PrepareMissionTrip(gsid, goerid);
                }
            }

            var pid = m.CheckRegisterLink(registertag);

            if (m.NotActive())
            {
                return(View("OnePageGiving/NotActive", m));
            }
            if (m.MissionTripSelfSupportPaylink.HasValue() && m.GoerId > 0)
            {
                return(Redirect(m.MissionTripSelfSupportPaylink));
            }

            return(RouteRegistration(m, pid, showfamily));
        }
Exemplo n.º 12
0
        public JsonResult GetGatewayConfig(int ProcessType, string Key)
        {
            string PushpayMerchant = MultipleGatewayUtils.Setting(CurrentDatabase, Key, "", ProcessType);

            return(Json(PushpayMerchant, JsonRequestBehavior.AllowGet));
        }