additional fee on the payment method

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Il y a 12 ans
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
Il y a 12 ans
The work item is already created. Please vote here
Il y a 11 ans
How does this work in conjunction with recurring products? Would the Addtl Amount be charged every cycle or first one only?

Daniel
Il y a 11 ans
Every cycle
Il y a 11 ans
Andrei thanks for your quick reply!

Daniel
Il y a 11 ans
[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
Il y a 11 ans
its not wok for me...on the expression "var cart = _workContext.CurrentCustomer.ShoppingCartItems.Where(sci => sci.ShoppingCartType == ShoppingCartType.ShoppingCart).ToList(); " returned the error below

Error  1  'System.Collections.Generic.ICollection<Nop.Core.Domain.Orders.ShoppingCartItem>' does not contain a definition for 'Where' and no extension method 'Where' accepting a first argument of type 'System.Collections.Generic.ICollection<Nop.Core.Domain.Orders.ShoppingCartItem>' could be found (are you missing a using directive or an assembly reference?)  C:\Arquivos\Desenvolvimento_Escalena\Nova_Plataforma\trunk\Plugins\Nop.Plugin.Payments.BoletoNet\BoletoNetPaymentProcessor.cs  215  71  Nop.Plugin.Payments.BoletoNet
Il y a 11 ans
Be sure to have

using System.Collections.Generic;
using System.Linq;
Il y a 11 ans
Thanks for the quick answer...
Il y a 11 ans
Done. Please see changeset http://nopcommerce.codeplex.com/SourceControl/changeset/f7589c57943e

P.S. Currently implemented only for "Manual credit card" payment method. Support for the other ones will be added later.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.