Skip to content

Commit d50c69c

Browse files
committed
[REF] customer_wallet_pos: replace var by const / let
1 parent 536dfd6 commit d50c69c

1 file changed

Lines changed: 21 additions & 21 deletions

File tree

customer_wallet_pos/static/src/js/Screens/PaymentScreen/PaymentScreen.esm.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ const WalletPaymentScreen = (OriginalPaymentScreen) =>
2121
*/
2222
async validateOrder(isForceValidate) {
2323
/* eslint-enable no-unused-vars */
24-
var partner = this.currentOrder.get_partner();
25-
var [payment_wallet_amount, payment_lines_qty] =
24+
const partner = this.currentOrder.get_partner();
25+
const [payment_wallet_amount, payment_lines_qty] =
2626
this.get_amount_debit_with_customer_wallet_journal();
27-
var [product_wallet_amount, product_lines_qty] =
27+
const [product_wallet_amount, product_lines_qty] =
2828
this.get_amount_credit_with_customer_wallet_product();
2929

30-
var wallet_amount = payment_wallet_amount - product_wallet_amount;
30+
const wallet_amount = payment_wallet_amount - product_wallet_amount;
3131

3232
if (!partner) {
3333
if (payment_lines_qty > 0) {
@@ -41,7 +41,7 @@ const WalletPaymentScreen = (OriginalPaymentScreen) =>
4141
}
4242
if (product_lines_qty > 0) {
4343
var wallet_product_names = [];
44-
var wallet_products = this.find_customer_wallet_products();
44+
const wallet_products = this.find_customer_wallet_products();
4545
wallet_products.forEach(function (product) {
4646
wallet_product_names.push(product.display_name);
4747
});
@@ -86,13 +86,13 @@ const WalletPaymentScreen = (OriginalPaymentScreen) =>
8686
* of the current customer, if defined.
8787
*/
8888
async _finalizeValidation() {
89-
var partner = this.currentOrder.get_partner();
89+
const partner = this.currentOrder.get_partner();
9090
if (partner) {
91-
var payment_wallet_amount =
91+
const payment_wallet_amount =
9292
this.get_amount_debit_with_customer_wallet_journal()[0];
93-
var product_wallet_amount =
93+
const product_wallet_amount =
9494
this.get_amount_credit_with_customer_wallet_product()[0];
95-
var wallet_amount = payment_wallet_amount - product_wallet_amount;
95+
const wallet_amount = payment_wallet_amount - product_wallet_amount;
9696
partner.customer_wallet_balance -= wallet_amount;
9797
}
9898

@@ -113,11 +113,11 @@ const WalletPaymentScreen = (OriginalPaymentScreen) =>
113113
* @returns {Number} New balance.
114114
*/
115115
get new_wallet_amount() {
116-
var partner = this.currentOrder.get_partner();
116+
const partner = this.currentOrder.get_partner();
117117
if (partner) {
118-
var payment_wallet_amount =
118+
const payment_wallet_amount =
119119
this.get_amount_debit_with_customer_wallet_journal()[0];
120-
var product_wallet_amount =
120+
const product_wallet_amount =
121121
this.get_amount_credit_with_customer_wallet_product()[0];
122122
return (
123123
partner.customer_wallet_balance -
@@ -136,7 +136,7 @@ const WalletPaymentScreen = (OriginalPaymentScreen) =>
136136
*/
137137
find_customer_wallet_payment_method() {
138138
// This is fairly naive.
139-
for (var i = 0; i < this.payment_methods_from_config.length; i++) {
139+
for (let i = 0; i < this.payment_methods_from_config.length; i++) {
140140
if (this.payment_methods_from_config[i].is_customer_wallet_method) {
141141
return this.payment_methods_from_config[i];
142142
}
@@ -168,10 +168,10 @@ const WalletPaymentScreen = (OriginalPaymentScreen) =>
168168
* element is the number of payment lines.
169169
*/
170170
get_amount_debit_with_customer_wallet_journal() {
171-
var order = this.currentOrder;
172-
var method = this.find_customer_wallet_payment_method();
173-
var wallet_amount = 0;
174-
var lines_qty = 0;
171+
const order = this.currentOrder;
172+
const method = this.find_customer_wallet_payment_method();
173+
let wallet_amount = 0;
174+
let lines_qty = 0;
175175
order.paymentlines.forEach((item) => {
176176
if (item.payment_method === method) {
177177
wallet_amount += item.amount;
@@ -189,14 +189,14 @@ const WalletPaymentScreen = (OriginalPaymentScreen) =>
189189
* is the number of order lines.
190190
*/
191191
get_amount_credit_with_customer_wallet_product() {
192-
var order = this.currentOrder;
192+
const order = this.currentOrder;
193193
var wallet_product_ids = [];
194-
var wallet_products = this.find_customer_wallet_products();
194+
const wallet_products = this.find_customer_wallet_products();
195195
wallet_products.forEach(function (product) {
196196
wallet_product_ids.push(product.id);
197197
});
198-
var wallet_amount = 0;
199-
var lines_qty = 0;
198+
let wallet_amount = 0;
199+
let lines_qty = 0;
200200

201201
order.orderlines.forEach((orderline) => {
202202
if (wallet_product_ids.includes(orderline.product.id)) {

0 commit comments

Comments
 (0)