protected string FormatPaymentMethodInfo(PaymentMethod paymentMethod) { decimal paymentMethodAdditionalFee = PaymentManager.GetAdditionalHandlingFee(paymentMethod.PaymentMethodId); decimal rateBase = TaxManager.GetPaymentMethodAdditionalFee(paymentMethodAdditionalFee, NopContext.Current.User); decimal rate = CurrencyManager.ConvertCurrency(rateBase, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency); if (rate > decimal.Zero) { string rateStr = PriceHelper.FormatPaymentMethodAdditionalFee(rate, true); return string.Format("({0})", rateStr); } else { return string.Empty; } }
protected PaymentMethod Save() { var paymentMethod = new PaymentMethod() { Name = txtName.Text, VisibleName = txtVisibleName.Text, Description = txtDescription.Text, ConfigureTemplatePath = txtConfigureTemplatePath.Text, UserTemplatePath = txtUserTemplatePath.Text, ClassName = txtClassName.Text, SystemKeyword = txtSystemKeyword.Text, IsActive = cbActive.Checked, DisplayOrder = txtDisplayOrder.Value }; this.PaymentService.InsertPaymentMethod(paymentMethod); return paymentMethod; }
private static PaymentMethod DBMapping(DBPaymentMethod dbItem) { if (dbItem == null) return null; PaymentMethod item = new PaymentMethod(); item.PaymentMethodID = dbItem.PaymentMethodID; item.Name = dbItem.Name; item.VisibleName = dbItem.VisibleName; item.Description = dbItem.Description; item.ConfigureTemplatePath = dbItem.ConfigureTemplatePath; item.UserTemplatePath = dbItem.UserTemplatePath; item.ClassName = dbItem.ClassName; item.SystemKeyword = dbItem.SystemKeyword; item.IsActive = dbItem.IsActive; item.DisplayOrder = dbItem.DisplayOrder; return item; }
/// <summary> /// Updates the payment method /// </summary> /// <param name="paymentMethod">Payment method</param> public void UpdatePaymentMethod(PaymentMethod paymentMethod) { if (paymentMethod == null) throw new ArgumentNullException("paymentMethod"); paymentMethod.Name = CommonHelper.EnsureNotNull(paymentMethod.Name); paymentMethod.Name = CommonHelper.EnsureMaximumLength(paymentMethod.Name, 100); paymentMethod.VisibleName = CommonHelper.EnsureNotNull(paymentMethod.VisibleName); paymentMethod.VisibleName = CommonHelper.EnsureMaximumLength(paymentMethod.VisibleName, 100); paymentMethod.Description = CommonHelper.EnsureNotNull(paymentMethod.Description); paymentMethod.Description = CommonHelper.EnsureMaximumLength(paymentMethod.Description, 4000); paymentMethod.ConfigureTemplatePath = CommonHelper.EnsureNotNull(paymentMethod.ConfigureTemplatePath); paymentMethod.ConfigureTemplatePath = CommonHelper.EnsureMaximumLength(paymentMethod.ConfigureTemplatePath, 500); paymentMethod.UserTemplatePath = CommonHelper.EnsureNotNull(paymentMethod.UserTemplatePath); paymentMethod.UserTemplatePath = CommonHelper.EnsureMaximumLength(paymentMethod.UserTemplatePath, 500); paymentMethod.ClassName = CommonHelper.EnsureNotNull(paymentMethod.ClassName); paymentMethod.ClassName = CommonHelper.EnsureMaximumLength(paymentMethod.ClassName, 500); paymentMethod.SystemKeyword = CommonHelper.EnsureNotNull(paymentMethod.SystemKeyword); paymentMethod.SystemKeyword = CommonHelper.EnsureMaximumLength(paymentMethod.SystemKeyword, 500); if (!_context.IsAttached(paymentMethod)) _context.PaymentMethods.Attach(paymentMethod); _context.SaveChanges(); if (this.CacheEnabled) { _cacheManager.RemoveByPattern(PAYMENTMETHODS_PATTERN_KEY); } }