Using HidePaymentMethod

Monday, May 6, 2024 5:24:44 AM
  • 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