@managesome/eposmatic-toolkit 0.2.229 → 0.2.230
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.
|
@@ -382,43 +382,41 @@ function calculateCartOrderInfoAndSyncData(data, courses, listnerSettings, calcu
|
|
|
382
382
|
// So in actual, payable price is the price of all items after applying all discounts and surcharges
|
|
383
383
|
const payablePrice = subtotal - orderDiscount;
|
|
384
384
|
const isDineInOrder = constants_1.PLATFORMS_BY_ORDER_TYPE[constants_1.ORDER_TYPE_ENUM.DINE_IN].includes(data.platform);
|
|
385
|
-
const isDeliveryOrder = constants_1.PLATFORMS_BY_ORDER_TYPE.DELIVERY.includes(data.platform);
|
|
385
|
+
const isDeliveryOrder = constants_1.PLATFORMS_BY_ORDER_TYPE[constants_1.ORDER_TYPE_ENUM.DELIVERY].includes(data.platform);
|
|
386
386
|
const isTakeawayOrder = constants_1.PLATFORMS_BY_ORDER_TYPE[constants_1.ORDER_TYPE_ENUM.TAKE_AWAY].includes(data.platform);
|
|
387
387
|
const isPackagingOrder = isDeliveryOrder || isTakeawayOrder;
|
|
388
388
|
let service_fee = data.service_fee ?? 0;
|
|
389
|
-
if (
|
|
390
|
-
if (
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
service_fee = listnerSettings.dinein_service_fee ?? service_fee;
|
|
389
|
+
if (isDineInOrder) {
|
|
390
|
+
if (listnerSettings != null) {
|
|
391
|
+
if (listnerSettings.min_service_fee_order_value > 0 &&
|
|
392
|
+
payablePrice < listnerSettings.min_service_fee_order_value) {
|
|
393
|
+
service_fee = 0;
|
|
394
|
+
}
|
|
395
|
+
else if (listnerSettings.dinein_service_fee > 0) {
|
|
396
|
+
service_fee = listnerSettings.dinein_service_fee;
|
|
397
|
+
}
|
|
399
398
|
}
|
|
400
399
|
}
|
|
401
|
-
else
|
|
400
|
+
else {
|
|
402
401
|
service_fee = 0;
|
|
403
402
|
}
|
|
404
403
|
let packaging_charges = data.packaging_charges ?? 0;
|
|
405
|
-
if (
|
|
406
|
-
if (
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
packaging_charges
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
packaging_charges = listnerSettings.packaging_charges ?? packaging_charges;
|
|
404
|
+
if (isPackagingOrder) {
|
|
405
|
+
if (listnerSettings != null) {
|
|
406
|
+
if (listnerSettings.min_packaging_charges_order_value > 0 &&
|
|
407
|
+
payablePrice < listnerSettings.min_packaging_charges_order_value) {
|
|
408
|
+
packaging_charges = 0;
|
|
409
|
+
}
|
|
410
|
+
else if (listnerSettings.packaging_charges_free_over > 0 &&
|
|
411
|
+
payablePrice >= listnerSettings.packaging_charges_free_over) {
|
|
412
|
+
packaging_charges = 0;
|
|
413
|
+
}
|
|
414
|
+
else if (listnerSettings.packaging_charges > 0) {
|
|
415
|
+
packaging_charges = listnerSettings.packaging_charges;
|
|
416
|
+
}
|
|
419
417
|
}
|
|
420
418
|
}
|
|
421
|
-
else
|
|
419
|
+
else {
|
|
422
420
|
packaging_charges = 0;
|
|
423
421
|
}
|
|
424
422
|
// Original items price is the price of all items without any discount
|
|
@@ -36,7 +36,7 @@ function calculateTotalAmountWithCharges({ bank_percentage_charges, bank_fixed_c
|
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
function getDeliveryAmt({ platform, delivery_free_over, delivery_min_cost, contemporary_delivery_cost, payable_price, }) {
|
|
39
|
-
if (!constants_1.PLATFORMS_BY_ORDER_TYPE.DELIVERY.includes(platform))
|
|
39
|
+
if (!constants_1.PLATFORMS_BY_ORDER_TYPE[constants_1.ORDER_TYPE_ENUM.DELIVERY].includes(platform))
|
|
40
40
|
return 0;
|
|
41
41
|
else if (delivery_free_over > 0 && payable_price > delivery_free_over) {
|
|
42
42
|
return 0;
|