@vibe-flats/booking-engine-common-server 1.0.75 → 1.0.78

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.
@@ -7,7 +7,12 @@ export declare const COMMON_SERVER: {
7
7
  monthly: number;
8
8
  };
9
9
  guesty: {
10
- fees: {
10
+ stripe: {
11
+ paymentProviderId: string;
12
+ };
13
+ invoiceItems: {
14
+ rent: string;
15
+ cleaning: string;
11
16
  utilities: string;
12
17
  discountMonthly: string;
13
18
  };
@@ -10,7 +10,12 @@ exports.COMMON_SERVER = {
10
10
  monthly: 30
11
11
  },
12
12
  guesty: {
13
- fees: {
13
+ stripe: {
14
+ paymentProviderId: '664d9dc85fadb20011ee5b04'
15
+ },
16
+ invoiceItems: {
17
+ rent: 'Accommodation fare',
18
+ cleaning: 'Cleaning fee',
14
19
  utilities: 'Utilities',
15
20
  discountMonthly: 'Discount (Monthly Stay)'
16
21
  }
@@ -5,4 +5,6 @@ export declare const guestyPrice: (unit: UnitDocument, stay: AvailabilityDocumen
5
5
  rent: number;
6
6
  cleaning: number;
7
7
  utilities: number;
8
+ total: number;
9
+ discount: number;
8
10
  };
@@ -10,7 +10,11 @@ const guestyPrice = (unit, stay) => {
10
10
  // Apply multiplier: Guesty's approach to monthly pricing
11
11
  const rent = +(stay.reduce((acc, stay) => acc + stay.price, 0) * multiplier).toFixed(0);
12
12
  const cleaning = unit.prices.cleaningFee;
13
- const utilities = (((_a = unit.fees.find(fee => fee.name.trim() === app_1.COMMON_SERVER.guesty.fees.utilities)) === null || _a === void 0 ? void 0 : _a.value) || 0) * nights;
14
- return { nights, rent, cleaning, utilities };
13
+ const utilities = (((_a = unit.fees.find(fee => fee.name.trim() === app_1.COMMON_SERVER.guesty.invoiceItems.utilities)) === null || _a === void 0 ? void 0 : _a.value) || 0) * nights;
14
+ const total = rent + utilities + cleaning;
15
+ const discount = nights >= app_1.COMMON_SERVER.priceFactor.monthly && unit.prices.monthlyPriceFactor !== 1
16
+ ? total * (1 - unit.prices.monthlyPriceFactor)
17
+ : 0;
18
+ return { nights, rent, cleaning, utilities, total, discount };
15
19
  };
16
20
  exports.guestyPrice = guestyPrice;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibe-flats/booking-engine-common-server",
3
- "version": "1.0.75",
3
+ "version": "1.0.78",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",