@vibe-flats/booking-engine-common-server 1.0.78 → 1.0.80
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AvailabilityDocument } from '../models/availability';
|
|
2
2
|
import { UnitDocument } from '../models/units';
|
|
3
|
-
export declare const guestyPrice: (unit: UnitDocument, stay: AvailabilityDocument[]) => {
|
|
3
|
+
export declare const guestyPrice: (unit: UnitDocument, stay: AvailabilityDocument[], excludeCleaning?: boolean) => {
|
|
4
4
|
nights: number;
|
|
5
5
|
rent: number;
|
|
6
6
|
cleaning: number;
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.guestyPrice = void 0;
|
|
4
4
|
const app_1 = require("../config/app");
|
|
5
|
-
const guestyPrice = (unit, stay) => {
|
|
5
|
+
const guestyPrice = (unit, stay, excludeCleaning) => {
|
|
6
6
|
var _a;
|
|
7
7
|
//
|
|
8
8
|
const nights = stay.length;
|
|
9
9
|
const multiplier = nights >= app_1.COMMON_SERVER.priceFactor.monthly ? unit.prices.monthlyPriceFactor : 1;
|
|
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
|
-
const cleaning = unit.prices.cleaningFee;
|
|
12
|
+
const cleaning = excludeCleaning ? 0 : unit.prices.cleaningFee;
|
|
13
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
14
|
const total = rent + utilities + cleaning;
|
|
15
15
|
const discount = nights >= app_1.COMMON_SERVER.priceFactor.monthly && unit.prices.monthlyPriceFactor !== 1
|