Skip to content

Commit

Permalink
fix: checkout value does not include taxes
Browse files Browse the repository at this point in the history
PLATS-25: checkout value does not include taxes
  • Loading branch information
fabiano-mallmann authored Oct 30, 2024
2 parents d8046f2 + 4011904 commit 7ac8026
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions view/frontend/web/js/core/checkout/PaymentMethodController.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ define([
totalAmount += parseFloat(amount);
}

if (totalAmount === _self.platformConfig.updateTotals.getTotals()().grand_total) {
if (totalAmount === _self.platformConfig.updateTotals.getTotals()().base_grand_total) {
return;
}

Expand Down Expand Up @@ -392,7 +392,7 @@ define([
formObject.inputAmount.on('keyup', function () {
const element = $(this);

const originalValue = paymentMethodController.platformConfig.updateTotals.getTotals()().grand_total;
const originalValue = paymentMethodController.platformConfig.updateTotals.getTotals()().base_grand_total;
let orderAmount = (originalValue).toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
orderAmount = orderAmount.replace(/[^0-9]/g, '');
orderAmount = Number(orderAmount);
Expand Down Expand Up @@ -754,7 +754,7 @@ define([
}

fillCardAmount(formObject, count, card = null) {
const orderAmount = this.platformConfig.updateTotals.getTotals()().grand_total / count;
const orderAmount = this.platformConfig.updateTotals.getTotals()().base_grand_total / count;

let amount = orderAmount.toFixed(this.platformConfig.currency.precision);
const separator = ".";
Expand All @@ -763,7 +763,7 @@ define([

if (card === 1) {
const orderAmountOriginal = amount.replace(this.platformConfig.currency.decimalSeparator, ".");
const amountBalance = (this.platformConfig.updateTotals.getTotals()().grand_total - orderAmountOriginal).toFixed(2);
const amountBalance = (this.platformConfig.updateTotals.getTotals()().base_grand_total - orderAmountOriginal).toFixed(2);
formObject.inputAmount.val(amountBalance.replace(".", this.platformConfig.currency.decimalSeparator));
return;
}
Expand Down
2 changes: 1 addition & 1 deletion view/frontend/web/js/core/checkout/Tds.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ define([
phones : customerPhones,
card_expiry_date : cardExpiryDate,
purchase : {
amount : quote.totals().grand_total * 100,
amount : quote.totals().base_grand_total * 100,
date :
new Date().toISOString()
,
Expand Down
2 changes: 1 addition & 1 deletion view/frontend/web/js/core/models/CreditCardModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ define([
const configCard = window.checkoutConfig.payment.pagarme_creditcard;

return configCard['tds_active'] === true
&& quote.totals().grand_total * 100 >= configCard['tds_min_amount'] * 100
&& quote.totals().base_grand_total * 100 >= configCard['tds_min_amount'] * 100
&& this.brandIsVisaOrMaster();
}
brandIsVisaOrMaster() {
Expand Down
2 changes: 1 addition & 1 deletion view/frontend/web/js/view/payment/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ define(
const platFormConfig = window.checkoutConfig;
platFormConfig.moduleUrls = {};
const installmentsUrl = installmentsAction();
platFormConfig.grand_total = quote.getTotals()().grand_total;
platFormConfig.grand_total = quote.getTotals()().base_grand_total;

const baseUrl = platFormConfig.payment.ccform.base_url;

Expand Down
2 changes: 1 addition & 1 deletion view/frontend/web/js/view/payment/googlepay.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ define([
countryCode: "BR",
currencyCode: quote.totals().base_currency_code,
totalPriceStatus: "FINAL",
totalPrice: quote.totals().grand_total.toFixed(2),
totalPrice: quote.totals().base_grand_total.toFixed(2),
};
},

Expand Down

0 comments on commit 7ac8026

Please sign in to comment.