rerobe-js-orm 3.6.5 → 3.6.6

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.
@@ -353,9 +353,16 @@ class OrderHelpers {
353
353
  return 0;
354
354
  }
355
355
  const cumsum = productsFullInfoWithQuantity
356
- .map((i) => {
357
- const price = i.product.isOnSale && i.product.clearanceTimestamp ? i.product.salePrice : i.product.price;
358
- return Number(price || 0) * Number(i.quantity);
356
+ .map((item) => {
357
+ // Determine if the product is on sale and set the price accordingly
358
+ const price = item.product.isOnSale && item.product.clearanceTimestamp ? item.product.salePrice : item.product.price;
359
+ const basePrice = Number(price || 0) * Number(item.quantity);
360
+ // Apply tax if the item is taxable
361
+ if (item.isTaxable && item.taxRate) {
362
+ const taxAmount = basePrice * Number(item.taxRate); // Calculate the tax based on the base price
363
+ return basePrice + taxAmount; // Return the total including tax
364
+ }
365
+ return basePrice; // Return the price without tax for non-taxable items
359
366
  })
360
367
  .reduce((a, b) => a + b, 0);
361
368
  return Number(this.toFixedPointPrice(cumsum));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rerobe-js-orm",
3
- "version": "3.6.5",
3
+ "version": "3.6.6",
4
4
  "description": "ReRobe's Javascript ORM Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",