@blackcode_sa/metaestetics-api 1.12.45 → 1.12.46

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.
package/dist/index.js CHANGED
@@ -1553,7 +1553,7 @@ function calculateItemSubtotal(item) {
1553
1553
  const price = item.price || 0;
1554
1554
  return price * quantity;
1555
1555
  }
1556
- function calculateFinalBilling(zonesData, taxRate = 0.2) {
1556
+ function calculateFinalBilling(zonesData, taxRate = 0.081) {
1557
1557
  let subtotalAll = 0;
1558
1558
  Object.values(zonesData).forEach((items) => {
1559
1559
  items.forEach((item) => {
@@ -1617,7 +1617,7 @@ async function addItemToZoneUtil(db, appointmentId, zoneId, item) {
1617
1617
  updatedAt: now
1618
1618
  };
1619
1619
  zonesData[zoneId].push(itemWithSubtotal);
1620
- const finalbilling = calculateFinalBilling(zonesData);
1620
+ const finalbilling = calculateFinalBilling(zonesData, 0.081);
1621
1621
  const appointmentRef = (0, import_firestore5.doc)(db, APPOINTMENTS_COLLECTION, appointmentId);
1622
1622
  await (0, import_firestore4.updateDoc)(appointmentRef, {
1623
1623
  "metadata.zonesData": zonesData,
@@ -1641,7 +1641,7 @@ async function removeItemFromZoneUtil(db, appointmentId, zoneId, itemIndex) {
1641
1641
  if (items.length === 0) {
1642
1642
  delete metadata.zonesData[zoneId];
1643
1643
  }
1644
- const finalbilling = calculateFinalBilling(metadata.zonesData);
1644
+ const finalbilling = calculateFinalBilling(metadata.zonesData, 0.081);
1645
1645
  const appointmentRef = (0, import_firestore5.doc)(db, APPOINTMENTS_COLLECTION, appointmentId);
1646
1646
  await (0, import_firestore4.updateDoc)(appointmentRef, {
1647
1647
  "metadata.zonesData": metadata.zonesData,
@@ -1678,7 +1678,7 @@ async function updateZoneItemUtil(db, appointmentId, zoneId, itemIndex, updates)
1678
1678
  itemIndex,
1679
1679
  newSubtotal: items[itemIndex].subtotal
1680
1680
  });
1681
- const finalbilling = calculateFinalBilling(metadata.zonesData);
1681
+ const finalbilling = calculateFinalBilling(metadata.zonesData, 0.081);
1682
1682
  const appointmentRef = (0, import_firestore5.doc)(db, APPOINTMENTS_COLLECTION, appointmentId);
1683
1683
  await (0, import_firestore4.updateDoc)(appointmentRef, {
1684
1684
  "metadata.zonesData": metadata.zonesData,
package/dist/index.mjs CHANGED
@@ -1452,7 +1452,7 @@ function calculateItemSubtotal(item) {
1452
1452
  const price = item.price || 0;
1453
1453
  return price * quantity;
1454
1454
  }
1455
- function calculateFinalBilling(zonesData, taxRate = 0.2) {
1455
+ function calculateFinalBilling(zonesData, taxRate = 0.081) {
1456
1456
  let subtotalAll = 0;
1457
1457
  Object.values(zonesData).forEach((items) => {
1458
1458
  items.forEach((item) => {
@@ -1516,7 +1516,7 @@ async function addItemToZoneUtil(db, appointmentId, zoneId, item) {
1516
1516
  updatedAt: now
1517
1517
  };
1518
1518
  zonesData[zoneId].push(itemWithSubtotal);
1519
- const finalbilling = calculateFinalBilling(zonesData);
1519
+ const finalbilling = calculateFinalBilling(zonesData, 0.081);
1520
1520
  const appointmentRef = doc3(db, APPOINTMENTS_COLLECTION, appointmentId);
1521
1521
  await updateDoc3(appointmentRef, {
1522
1522
  "metadata.zonesData": zonesData,
@@ -1540,7 +1540,7 @@ async function removeItemFromZoneUtil(db, appointmentId, zoneId, itemIndex) {
1540
1540
  if (items.length === 0) {
1541
1541
  delete metadata.zonesData[zoneId];
1542
1542
  }
1543
- const finalbilling = calculateFinalBilling(metadata.zonesData);
1543
+ const finalbilling = calculateFinalBilling(metadata.zonesData, 0.081);
1544
1544
  const appointmentRef = doc3(db, APPOINTMENTS_COLLECTION, appointmentId);
1545
1545
  await updateDoc3(appointmentRef, {
1546
1546
  "metadata.zonesData": metadata.zonesData,
@@ -1577,7 +1577,7 @@ async function updateZoneItemUtil(db, appointmentId, zoneId, itemIndex, updates)
1577
1577
  itemIndex,
1578
1578
  newSubtotal: items[itemIndex].subtotal
1579
1579
  });
1580
- const finalbilling = calculateFinalBilling(metadata.zonesData);
1580
+ const finalbilling = calculateFinalBilling(metadata.zonesData, 0.081);
1581
1581
  const appointmentRef = doc3(db, APPOINTMENTS_COLLECTION, appointmentId);
1582
1582
  await updateDoc3(appointmentRef, {
1583
1583
  "metadata.zonesData": metadata.zonesData,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@blackcode_sa/metaestetics-api",
3
3
  "private": false,
4
- "version": "1.12.45",
4
+ "version": "1.12.46",
5
5
  "description": "Firebase authentication service with anonymous upgrade support",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.mjs",
@@ -53,7 +53,7 @@ export function calculateItemSubtotal(item: Partial<ZoneItemData>): number {
53
53
  */
54
54
  export function calculateFinalBilling(
55
55
  zonesData: Record<string, ZoneItemData[]>,
56
- taxRate: number = 0.2,
56
+ taxRate: number = 0.081,
57
57
  ): FinalBilling {
58
58
  let subtotalAll = 0;
59
59
 
@@ -168,8 +168,8 @@ export async function addItemToZoneUtil(
168
168
  // Add item to zone
169
169
  zonesData[zoneId].push(itemWithSubtotal);
170
170
 
171
- // Recalculate final billing
172
- const finalbilling = calculateFinalBilling(zonesData); //TODO: add correct amount of tax
171
+ // Recalculate final billing with Swiss tax rate (8.1%)
172
+ const finalbilling = calculateFinalBilling(zonesData, 0.081);
173
173
 
174
174
  // Update appointment
175
175
  const appointmentRef = doc(db, APPOINTMENTS_COLLECTION, appointmentId);
@@ -219,8 +219,8 @@ export async function removeItemFromZoneUtil(
219
219
  delete metadata.zonesData[zoneId];
220
220
  }
221
221
 
222
- // Recalculate final billing
223
- const finalbilling = calculateFinalBilling(metadata.zonesData); //TODO: add correct amount of tax
222
+ // Recalculate final billing with Swiss tax rate (8.1%)
223
+ const finalbilling = calculateFinalBilling(metadata.zonesData, 0.081);
224
224
 
225
225
  // Update appointment
226
226
  const appointmentRef = doc(db, APPOINTMENTS_COLLECTION, appointmentId);
@@ -286,8 +286,8 @@ export async function updateZoneItemUtil(
286
286
  newSubtotal: items[itemIndex].subtotal,
287
287
  });
288
288
 
289
- // Recalculate final billing
290
- const finalbilling = calculateFinalBilling(metadata.zonesData); //TODO: add correct amount of tax
289
+ // Recalculate final billing with Swiss tax rate (8.1%)
290
+ const finalbilling = calculateFinalBilling(metadata.zonesData, 0.081);
291
291
 
292
292
  // Update appointment
293
293
  const appointmentRef = doc(db, APPOINTMENTS_COLLECTION, appointmentId);