Skip to content

Commit 192a839

Browse files
committed
Merge pull request #501 from ivanrusso/2.x
GetAdditionalHandlingFee added to PayPalStandardProvider
2 parents e7c9435 + 5ef6aab commit 192a839

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

src/Plugins/SmartStore.PayPal/Providers/PayPalStandardProvider.cs

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public partial class PayPalStandardProvider : PaymentPluginBase, IConfigurable
4242

4343
private readonly ICurrencyService _currencyService;
4444
private readonly CurrencySettings _currencySettings;
45+
private readonly IOrderTotalCalculationService _orderTotalCalculationService;
4546
private readonly ICheckoutAttributeParser _checkoutAttributeParser;
4647
private readonly ITaxService _taxService;
4748
private readonly HttpContextBase _httpContext;
@@ -53,13 +54,19 @@ public partial class PayPalStandardProvider : PaymentPluginBase, IConfigurable
5354

5455
#region Ctor
5556

56-
public PayPalStandardProvider(ICurrencyService currencyService, HttpContextBase httpContext,
57-
CurrencySettings currencySettings, ICheckoutAttributeParser checkoutAttributeParser,
58-
ITaxService taxService, PayPalStandardSettings paypalStandardSettings,
59-
ICommonServices commonServices, ILogger logger)
57+
public PayPalStandardProvider(ICurrencyService currencyService,
58+
HttpContextBase httpContext,
59+
CurrencySettings currencySettings,
60+
IOrderTotalCalculationService orderTotalCalculationService,
61+
ICheckoutAttributeParser checkoutAttributeParser,
62+
ITaxService taxService,
63+
PayPalStandardSettings paypalStandardSettings,
64+
ICommonServices commonServices,
65+
ILogger logger)
6066
{
6167
_currencyService = currencyService;
6268
_currencySettings = currencySettings;
69+
_orderTotalCalculationService = orderTotalCalculationService;
6370
_checkoutAttributeParser = checkoutAttributeParser;
6471
_taxService = taxService;
6572
_httpContext = httpContext;
@@ -290,6 +297,18 @@ public override void PostProcessPayment(PostProcessPaymentRequest postProcessPay
290297
_httpContext.Response.Redirect(builder.ToString());
291298
}
292299

300+
/// <summary>
301+
/// Gets additional handling fee
302+
/// </summary>
303+
/// <param name="cart">Shoping cart</param>
304+
/// <returns>Additional handling fee</returns>
305+
public override decimal GetAdditionalHandlingFee(IList<OrganizedShoppingCartItem> cart)
306+
{
307+
var result = this.CalculateAdditionalFee(_orderTotalCalculationService, cart,
308+
_paypalStandardSettings.AdditionalFee, _paypalStandardSettings.AdditionalFeePercentage);
309+
return result;
310+
}
311+
293312
/// <summary>
294313
/// Gets a value indicating whether customers can complete a payment after order is placed but not completed (for redirection payment methods)
295314
/// </summary>

0 commit comments

Comments
 (0)