tripstorekrabi-shared 1.13.58 → 1.13.60

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.
Files changed (2) hide show
  1. package/booking.js +13 -7
  2. package/package.json +1 -1
package/booking.js CHANGED
@@ -2,7 +2,7 @@ import dayjs from "dayjs";
2
2
  import advancedFormat from 'dayjs/plugin/advancedFormat.js';
3
3
  import utc from "dayjs/plugin/utc.js";
4
4
  import timezone from "dayjs/plugin/timezone.js";
5
- import { calculateTotalOperatorPrice } from './price.js';
5
+ import { PAY_ON_TOUR, calculateTotalOperatorPrice } from './price.js';
6
6
 
7
7
  dayjs.extend(advancedFormat);
8
8
  dayjs.extend(utc);
@@ -225,16 +225,17 @@ export function getStartingPointMessage(booking, product) {
225
225
  booking.specialRequirements.toUpperCase();
226
226
  }
227
227
 
228
- if (booking.nationalParkFee == 'Pay on tour') {
229
- text += '\n\nAs stated on the website, there is an entrance fee';
228
+ let payOnTour = [];
229
+ if (booking.nationalParkFee == PAY_ON_TOUR) {
230
+ let item = 'As stated on the website, there is an entrance fee';
230
231
 
231
232
  if (product?.nationalPark) {
232
- text += ' to ' + product?.nationalPark.title;
233
+ item += ' to ' + product?.nationalPark.title;
233
234
  }
234
235
 
235
236
  if (product?.nationalPark?.pricing
236
237
  ) {
237
- text +=
238
+ item +=
238
239
  ' of ' +
239
240
  product.nationalPark.pricing.adult +
240
241
  ' THB per adult and ' +
@@ -242,8 +243,13 @@ export function getStartingPointMessage(booking, product) {
242
243
  ' THB per child';
243
244
  }
244
245
 
245
- text +=
246
- ' to be paid at point of entry. Please bring the required amount in cash to the trip.';
246
+ payOnTour.push(` • ${item}`);
247
+ }
248
+
249
+ let extraPayments = Object.values(booking.extraPayments).filter((item) => !item.disabled && item.paymentMethod === PAY_ON_TOUR).map((item) => ` • ${item.description}: ${item.price} THB`);
250
+ payOnTour = [...payOnTour, ...extraPayments];
251
+ if (payOnTour.length > 0) {
252
+ text += '\n\nTO BE PAID ON TOUR:\n' + payOnTour.join("\n");
247
253
  }
248
254
 
249
255
  return text;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tripstorekrabi-shared",
3
- "version": "1.13.58",
3
+ "version": "1.13.60",
4
4
  "description": "Shared library for Trip Store Krabi",
5
5
  "author": "Stefan Sommer <tonprince@gmail.com>",
6
6
  "repository": {