Example #1
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);
            }
        }
Example #2
0
        public PushpayController(IRequestManager requestManager) : base(requestManager)
        {
            PaymentProcessTypes processType = PaymentProcessTypes.OneTimeGiving;

            try
            {
                processType = (PaymentProcessTypes)requestManager.CurrentHttpContext.Session["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);

            _merchantHandle = _pushpayPayment._merchantHandle;
            _givingLink     = $"{Configuration.Current.PushpayGivingLinkBase}/{_merchantHandle}";
        }
Example #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.");
                }
            }
        }
Example #4
0
        public static GatewayAccount CreateMockPaymentProcessor(CMSDataContext db, PaymentProcessTypes processType, GatewayTypes gatewayType)
        {
            GatewayAccount account        = null;
            var            paymentProcess = db.PaymentProcess.Single(x => x.ProcessId == (int)processType);

            if (paymentProcess.GatewayAccountId.HasValue)
            {
                account = db.GatewayAccount.First(a => a.GatewayAccountId == paymentProcess.GatewayAccountId);
            }
            if (account == null)
            {
                account = db.GatewayAccount.First(a => a.GatewayAccountId == (int)gatewayType);
                paymentProcess.GatewayAccountId = account.GatewayAccountId;
                var details = db.GatewayDetails.Where(d => d.GatewayAccountId == account.GatewayAccountId).ToList();
                foreach (var d in details)
                {
                    if (d.GatewayDetailName == "GatewayTesting")
                    {
                        d.GatewayDetailValue = "true";
                    }
                    else if (!d.IsBoolean && !d.GatewayDetailValue.HasValue())
                    {
                        d.GatewayDetailValue = DatabaseTestBase.RandomString();
                    }
                }
                db.SubmitChanges();
            }
            return(account);
        }
        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.");
                }
            }
        }
Example #6
0
 public static GatewayAccount GetAccount(CMSDataContext db, PaymentProcessTypes processType)
 {
     return((from e in db.PaymentProcess
             join d in db.GatewayAccount on e.GatewayAccountId equals d.GatewayAccountId into gj
             from sub in gj.DefaultIfEmpty()
             where e.ProcessId == (int)processType
             select sub).FirstOrDefault());
 }
Example #7
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.");
            }
        }
Example #8
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;
            }
        }
        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.");
                }
            }
        }
Example #10
0
 private bool CheckIfIsGatewayTesting(bool testing, PaymentProcessTypes processType)
 {
     return(testing || MultipleGatewayUtils.GatewayTesting(CurrentDatabase, ProcessType));
 }
Example #11
0
 public PushpayPayment(PushpayConnection Pushpay, CMSDataContext db, PaymentProcessTypes processType)
 {
     _pushpay        = Pushpay;
     _db             = db;
     _merchantHandle = MultipleGatewayUtils.Setting(db, "PushpayMerchant", "", (int)processType);
 }
Example #12
0
 public static GatewayAccount GetTransactionGateway(PaymentProcessTypes processType = PaymentProcessTypes.OnlineRegistration)
 {
     return(MultipleGatewayUtils.GetAccount(DbUtil.Db, processType));
 }
Example #13
0
 public static GatewayAccount GetTransactionGateway(CMSDataContext db, PaymentProcessTypes processType = PaymentProcessTypes.OnlineRegistration)
 {
     return(MultipleGatewayUtils.GetAccount(db, processType));
 }
Example #14
0
        public static bool GatewayTesting(CMSDataContext db, PaymentProcessTypes processType)
        {
            var User = db.Users.SingleOrDefault(us => us.UserId == Util.UserId);

            return((User != null && User.InRole("Developer")) ? Setting(db, "GatewayTesting", (int)processType) : false);
        }