I have a mixin for
'Magento_Checkout/js/view/payment'
. So when payment method is selected I call 'Magento_Checkout/js/action/get-totals'
to refresh totals area.
Reason of this is because I will apply additional fee according to selected method and show it in same page. So when getTotalsAction is called it does GET
to V1/carts/mine/totals
. For that I have MagentoQuoteModelCartCartTotalRepository afterGet plugin.
Inside plugin I use MagentoCheckoutModelSession
through DI. To get selected payment method
$paymentMethod = $this->checkoutSession->getQuote()->getPayment()->getMethod();
But problem is on first request it returns correct payment method, on second and so on it still returns same payment method even if I select different one. Is there a different approach I could solve this?