コード例 #1
0
        public async Task<ActionResult> PaymentSetting()
        {
            // Get payment info
            var model = new PaymentSettingModel()
            {
                Setting = CacheHelper.Settings,
                StripeClientID = CacheHelper.GetSettingDictionary(Enum_SettingKey.StripeClientID).Value,
                StripeApiKey = CacheHelper.GetSettingDictionary(Enum_SettingKey.StripeApiKey).Value,
                StripePublishableKey = CacheHelper.GetSettingDictionary(Enum_SettingKey.StripePublishableKey).Value
            };

            return View(model);
        }
コード例 #2
0
        public async Task<ActionResult> PaymentSettingUpdate(PaymentSettingModel model)
        {
            var setting = _settingService.Queryable().FirstOrDefault();

            setting.TransactionFeePercent = model.Setting.TransactionFeePercent;
            setting.TransactionMinimumFee = model.Setting.TransactionMinimumFee;
            setting.TransactionMinimumSize = model.Setting.TransactionMinimumSize;
            setting.LastUpdated = DateTime.Now;

            setting.ObjectState = Repository.Pattern.Infrastructure.ObjectState.Modified;

            _settingService.Update(setting);

            var stripeApiKey = await _settingDictionaryService.GetSettingDictionary(CacheHelper.Settings.ID, Enum_SettingKey.StripeApiKey);
            stripeApiKey.Value = model.StripeApiKey;
            _settingDictionaryService.SaveSettingDictionary(stripeApiKey);

            var stripeClientID = await _settingDictionaryService.GetSettingDictionary(CacheHelper.Settings.ID, Enum_SettingKey.StripeClientID);
            stripeClientID.Value = model.StripeClientID;
            _settingDictionaryService.SaveSettingDictionary(stripeClientID);

            var stripePublishableKey = await _settingDictionaryService.GetSettingDictionary(CacheHelper.Settings.ID, Enum_SettingKey.StripePublishableKey);
            stripePublishableKey.Value = model.StripePublishableKey;
            _settingDictionaryService.SaveSettingDictionary(stripePublishableKey);

            await _unitOfWorkAsync.SaveChangesAsync();

            _dataCacheService.RemoveCachedItem(CacheKeys.SettingDictionary);
            _dataCacheService.RemoveCachedItem(CacheKeys.Settings);

            return RedirectToAction("PaymentSetting");
        }
コード例 #3
0
        public async Task<ActionResult> PaymentSetting()
        {
            // Get payment info
            var model = new PaymentSettingModel()
            {
                Setting = CacheHelper.Settings,
                PaymentPlugins = _pluginFinder.GetPluginDescriptors(LoadPluginsMode.InstalledOnly, "Payment").ToList()
            };

            return View(model);
        }