diff --git a/view/frontend/requirejs-config.js b/view/frontend/requirejs-config.js index 85945ce2..b5d1354f 100755 --- a/view/frontend/requirejs-config.js +++ b/view/frontend/requirejs-config.js @@ -7,6 +7,9 @@ var config = { "Magento_Bundle/js/price-bundle": { 'Rvvup_Payments/js/bundle/price-bundle-mixin' : true }, + "Magento_Checkout/js/model/cart/totals-processor/default": { + 'Rvvup_Payments/js/clearpay/clearpay-price-mixin' : true + }, } } }; diff --git a/view/frontend/web/js/clearpay/clearpay-price-mixin.js b/view/frontend/web/js/clearpay/clearpay-price-mixin.js new file mode 100644 index 00000000..42e5ac6c --- /dev/null +++ b/view/frontend/web/js/clearpay/clearpay-price-mixin.js @@ -0,0 +1,17 @@ +define(['mage/utils/wrapper'], + function (wrapper) { + 'use strict'; + + return function (superEstimateTotals) { + superEstimateTotals.estimateTotals = wrapper.wrapSuper(superEstimateTotals.estimateTotals, function (address) { + this._super(address).done(function (result) { + let clearpaySummaryElement = document.getElementById('clearpay-summary'); + + if (clearpaySummaryElement !== null && clearpaySummaryElement.length !== 0) { + clearpaySummaryElement.dataset.amount = result['base_grand_total']; + } + }); + }); + return superEstimateTotals; + }; + });