Skip to content

Commit

Permalink
compatible about grand_total in 2.4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
leon-zhang-awx committed Apr 11, 2024
1 parent 5e47eaa commit af49877
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,15 @@ define(
},

getGrandTotal() {
return parseFloat(quote.totals().grand_total).toFixed(2)
let res = 0
for (let i = 0; i < this.totalsData.total_segments.length; i++) {
let el = this.totalsData.total_segments[i];
if (el.code === 'grand_total') {
res = el.value
break
}
}
return parseFloat(res).toFixed(2)
},

getCurrencyCode() {
Expand Down Expand Up @@ -175,6 +183,7 @@ define(
}
} else {
this.isExpressLoaded = false
Airwallex.destroyElement('googlePayButton');
}
}
}
Expand All @@ -186,7 +195,6 @@ define(
},

loadPayment() {
console.log(this.paymentConfig)
this.isExpressLoaded = true

this.recaptcha = cardMethodRecaptcha();
Expand Down Expand Up @@ -243,7 +251,6 @@ define(
processPlaceOrderError: function (response) {
fullScreenLoader.stopLoader();
$('body').trigger('processStop');

if (response?.getResponseHeader) {
errorProcessor.process(response, this.messageContainer);
const redirectURL = response.getResponseHeader('errorRedirectAction');
Expand Down Expand Up @@ -340,6 +347,7 @@ define(
}
}).catch(
self.processPlaceOrderError.bind(self)

).finally(
function () {
self.recaptcha.reset();
Expand All @@ -348,6 +356,7 @@ define(
_.each(placeOrderHooks.afterRequestListeners, function (listener) {
listener();
});

}
);
},
Expand Down

0 comments on commit af49877

Please sign in to comment.