[email protected] wrote:Hi
I'm using nopcommerce 2.5 and I have a suggestion in your new release. Can you change the additional fee on the payment method?. If i have read right now you can write only a value in the additional fee and not a percentage of the subtotal, but all the different kind of payments require a percentage of the payment so it should be more useful to let the opportunity to write a percentage in the additional fee
I hope this could be useful
Additional percentage fee:
Payment processor: public class PaymentServiceHook: PaymentService
{
public PaymentServiceHook(PaymentSettings paymentSettings, IPluginFinder pluginFinder, ShoppingCartSettings shoppingCartSettings) :
base (paymentSettings,pluginFinder,shoppingCartSettings)
{
}
public override decimal GetAdditionalHandlingFee(string paymentMethodSystemName)
{
return 0M;
}
}
Payment Processor constructor: public KandHPaymentGatewayProcessor(KandHPaymentGatewayPaymentSettings kandHPaymentGatewayPaymentSettings,
ISettingService settingService, ICurrencyService currencyService,
CurrencySettings currencySettings, ILanguageService languageService, IWorkContext workContext,
IOrderTotalCalculationService orderTotalCalculationService,
IWebHelper webHelper, HttpContextBase httpContext,
PaymentSettings paymentSettings,
IPluginFinder pluginFinder,
ShoppingCartSettings shoppingCartSettings,
IPriceCalculationService priceCalculationService,
ITaxService taxService,
IShippingService shippingService,
ICheckoutAttributeParser checkoutAttributeParser,
IDiscountService discountService,
IGiftCardService giftCardService,
IGenericAttributeService genericAttributeService,
TaxSettings taxSettings,
RewardPointsSettings rewardPointsSettings,
ShippingSettings shippingSettings,
CatalogSettings catalogSettings
)
{
this._kandHPaymentGatewayPaymentSettings = kandHPaymentGatewayPaymentSettings;
this._settingService = settingService;
this._currencyService = currencyService;
this._currencySettings = currencySettings;
this._languageService = languageService;
this._workContext = workContext;
this._orderTotalCalculationService = orderTotalCalculationService;
this._webHelper = webHelper;
this._httpContext = httpContext;
this._paymentSettings = paymentSettings;
this._pluginFinder = pluginFinder;
this._shoppingCartSettings = shoppingCartSettings;
this._priceCalculationService = priceCalculationService;
this._taxService = taxService;
this._shippingService=shippingService;
this._checkoutAttributeParser = checkoutAttributeParser;
this._discountService = discountService;
this._giftCardService = giftCardService;
this._genericAttributeService = genericAttributeService;
this._taxSettings = taxSettings;
this._rewardPointsSettings = rewardPointsSettings;
this._shippingSettings = shippingSettings;
this._catalogSettings = catalogSettings;
...
....
}
GetAdditionalHandlingFee: public decimal GetAdditionalHandlingFee()
{
var percentagefee = decimal.Zero;
var cart = _workContext.CurrentCustomer.ShoppingCartItems.Where(sci => sci.ShoppingCartType == ShoppingCartType.ShoppingCart).ToList();
if (cart.Count > 0)
{
var paymentService = new PaymentServiceHook(_paymentSettings, _pluginFinder, _shoppingCartSettings);
var orderTotalCalculationService = new OrderTotalCalculationService(_workContext, _priceCalculationService,
_taxService, _shippingService,
paymentService,
_checkoutAttributeParser,
_discountService,
_giftCardService,
_genericAttributeService,
_taxSettings,
_rewardPointsSettings,
_shippingSettings,
_shoppingCartSettings,
_catalogSettings);
var orderTotal = orderTotalCalculationService.GetShoppingCartTotal(cart);
// ToDo: Additional Fee with Tax, Ignore Rewards Points?
if (orderTotal != null)
{
percentagefee = (100 / (100 - _kandHPaymentGatewayPaymentSettings.AdditionalFeePercentage) - 1) * (decimal)orderTotal;
}
}
return _kandHPaymentGatewayPaymentSettings.AdditionalFee + percentagefee;
}
http://kepfeltoltes.hu/120823/feepercentage1_www.kepfeltoltes.hu_.jpg
http://kepfeltoltes.hu/120823/feepercentage2_www.kepfeltoltes.hu_.jpg