0

I need refresh PaymentMethod when GrandTotal is Rs.0?

I have added my js below.

    define(
                [
                    'jquery',   
                    'mage/url',
                    'Magento_Checkout/js/action/get-totals',
                    'Magento_Checkout/js/model/full-screen-loader',
                    'Magento_Checkout/js/action/get-payment-information',
                ],
                function (
                        $,
                        urlBuilder,
                        getTotalsAction,
                        fullScreenLoader,
                        getPaymentInformationAction
                        ) {
                    'use strict';

                    return function (isLoading, newValue) {
                        if (newValue) {
                            var use_wallet = 1;
                        } else {
                            var use_wallet = 0;
                        }

                        var serviceUrl = urlBuilder.build('wallet/checkout/totals');
                        jQuery.ajax({
                            url: serviceUrl,
                            type: "POST",
                            data: {use_wallet: use_wallet},
                            success: function (response) {

                                if (response) {
                                    var deferred = $.Deferred();
                                    isLoading(false);
                                    getTotalsAction([], deferred);



getPaymentInformationAction().done(function () {
    fullScreenLoader.stopLoader();
    return true
});
                                }
                            },
                            error: function (error) {
                                isLoading(false);
                            }
                        });
                    }
                }
        );
Ramanathan
  • 309
  • 3
  • 12

1 Answers1

0

You can reload payment method by using below JS code

define([
    'Magento_Checkout/js/action/get-payment-information'
]



getPaymentInformationAction().done(function () {
    fullScreenLoader.stopLoader();
    return true
});
Suresh Chikani
  • 15,836
  • 11
  • 62
  • 99