Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PLATS-25: checkout value does not include taxes #366

Merged
merged 2 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading