Using HidePaymentMethod

Monday, November 25, 2024 8:55:54 PM
  • Posted: Tuesday, May 5, 2020 7:22 PM
  • 4
Hello
I must prohibit access to a specific payment method if the amount of the order is less than a certain value.
I was thinking of using HidePaymentMethod (IList <ShoppingCartItem> cart) but the shoppingCartItem has no amount.
What is the best way to access the order and the total amount from HidePaymentMethod?
Thank you, sincerely,
Régis
0
  • Posted: Wednesday, May 6, 2020 10:11 PM
  • 2
Look at the top of the class and there are many services that are injected in the constructor that you can use.
To get the total within HidePaymentMethod you can just simply do

var total = await _orderTotalCalculationService.GetShoppingCartTotal(cart);
0
  • Posted: Thursday, May 7, 2020 7:47 AM
  • 4
Oh sorry, too easy !
Thank you !
0
back to top
Filters