foodbot-cart-calculations 1.0.15 → 1.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -251,10 +251,15 @@ function calculatePackageItemTax(cart, itemIndex, element, tax_settings, afterDi
251
251
  function calculateModiTax(cart, itemIndex, element, tax_settings, afterDicsount, taxType) {
252
252
  return new Promise(async (resolve, reject) => {
253
253
  if (element && element.item_modifiers && element.item_modifiers.length > 0) {
254
- let itemModiTotalTax = 0
254
+
255
255
  element.item_modifiers.forEach((modi, modiIndex) => {
256
+ let itemModiTotalTax = 0
256
257
  let taxId = []
257
- let iepsTax;
258
+ let iepsTax;
259
+ //code commented for test
260
+
261
+ //code gain commented for push
262
+
258
263
  if (modi.is_tax_rate_same == 1) {
259
264
  if (modi.linked_product && modi.linked_product.product_tax_id) {
260
265
  taxId = modi.linked_product.product_tax_id
@@ -333,7 +338,7 @@ function calculateModiTax(cart, itemIndex, element, tax_settings, afterDicsount,
333
338
  element.item_modifiers[modiIndex].tax_array = tax_array;
334
339
  cart = await setTaxes(cart, JSON.parse(JSON.stringify(modiItemTaxArray)));
335
340
 
336
- element.item_modifiers[modiIndex].tax_amount = parseFloat(element.item_modifiers[modiIndex].tax_amount) + parseFloat(taxAmount);
341
+ element.item_modifiers[modiIndex].tax_amount = parseFloat(itemModiTotalTax).toFixed(2);
337
342
  element.item_modifiers[modiIndex].tax_amount = parseFloat(element.item_modifiers[modiIndex].tax_amount).toFixed(6)
338
343
  element.tax_amount_modifier = parseFloat(element.tax_amount_modifier) + parseFloat(taxAmount)
339
344
  element.tax_amount_modifier = parseFloat(element.tax_amount_modifier).toFixed(6)
@@ -368,8 +373,9 @@ function calculatePackageModiTax(cart, itemIndex, element, tax_settings, afterDi
368
373
  element.package_items.forEach((packageItem, packageItemIndex) => {
369
374
  element.package_items[packageItemIndex].tax_amount_modifier = 0
370
375
  if (packageItem.modifiers.length > 0) {
371
- let itemModiTotalTax = 0
376
+
372
377
  packageItem.modifiers.forEach((modi, modiIndex) => {
378
+ let itemModiTotalTax = 0;
373
379
  let taxId = []
374
380
  let iepsTax;
375
381
  if (modi.is_tax_rate_same == 1) {
@@ -451,7 +457,7 @@ function calculatePackageModiTax(cart, itemIndex, element, tax_settings, afterDi
451
457
  element.package_items[packageItemIndex].modifiers[modiIndex].tax_array = tax_array;
452
458
  cart = await setTaxes(cart, JSON.parse(JSON.stringify(modiItemTaxArray)))
453
459
 
454
- element.package_items[packageItemIndex].modifiers[modiIndex].tax_amount = parseFloat(element.package_items[packageItemIndex].modifiers[modiIndex].tax_amount) + parseFloat(taxAmount)
460
+ element.package_items[packageItemIndex].modifiers[modiIndex].tax_amount = parseFloat(itemModiTotalTax).toFixed(2);
455
461
  element.package_items[packageItemIndex].tax_amount_modifier = (parseFloat(element.package_items[packageItemIndex].tax_amount_modifier) + parseFloat(taxAmount)).toFixed(6)
456
462
  element.package_items[packageItemIndex].total_tax_amount = (parseFloat(element.package_items[packageItemIndex].total_tax_amount) + parseFloat(taxAmount)).toFixed(6)
457
463
  element.tax_amount_modifier = (parseFloat(element.tax_amount_modifier) + parseFloat(taxAmount)).toFixed(6)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foodbot-cart-calculations",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "description": "Package for cart calculations in which it performs discount distribution and tax distribution on order",
5
5
  "main": "index.js",
6
6
  "scripts": {