tripstorekrabi-shared 1.24.7 → 1.24.9

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 +26 -4
  2. package/package.json +2 -2
package/booking.js CHANGED
@@ -57,7 +57,7 @@ export function addBookingFromInvoice(
57
57
  description: comment.trim(),
58
58
  visibility: [],
59
59
  lastModified: dayjs().toDate(),
60
- lastModifiedBy: 'Trip Store Krabi Next',
60
+ lastModifiedBy: 'System Auto-generated'
61
61
  };
62
62
  }
63
63
 
@@ -66,7 +66,26 @@ export function addBookingFromInvoice(
66
66
  description: invoice.comment.trim(),
67
67
  visibility: [],
68
68
  lastModified: dayjs().toDate(),
69
- lastModifiedBy: 'Trip Store Krabi Next',
69
+ lastModifiedBy: 'System Auto-generated'
70
+ };
71
+ }
72
+
73
+ if (invoice.message) {
74
+ notes[nanoid()] = {
75
+ description: invoice.message.trim(),
76
+ visibility: ['Customer'],
77
+ lastModified: dayjs().toDate(),
78
+ lastModifiedBy: 'System Auto-generated'
79
+ };
80
+ }
81
+
82
+ if (item.comment) {
83
+ notes[nanoid()] = {
84
+ description: item.comment.trim(),
85
+ visibility: [],
86
+ important: true,
87
+ lastModified: dayjs().toDate(),
88
+ lastModifiedBy: 'System Auto-generated'
70
89
  };
71
90
  }
72
91
 
@@ -113,7 +132,6 @@ export function addBookingFromInvoice(
113
132
 
114
133
  if (item.startingPointId) data.startingPointId = item.startingPointId;
115
134
  if (item.dropoffHotel && item.dropoffHotel.length > 0) data.dropoffHotel = item.dropoffHotel;
116
- if (i > 0) data.partnerNetPrice = 0;
117
135
  if (item.nationalParkFee) data.nationalParkFee = item.nationalParkFee;
118
136
  if (item.tourGuideLanguage) data.tourGuideLanguage = item.tourGuideLanguage;
119
137
 
@@ -126,13 +144,17 @@ export function addBookingFromInvoice(
126
144
  }
127
145
  if (endPointId) data.endPointId = endPointId;
128
146
 
147
+ data = { ...data, ...paymentData };
148
+
129
149
  if (productSnapshot) {
130
150
  data.operatorNetPrice = calculateTotalOperatorPrice(data, productSnapshot.data());
131
151
  } else {
132
152
  data.operatorNetPrice = 0;
133
153
  }
134
154
 
135
- data = { ...data, ...paymentData };
155
+ if (i > 0) {
156
+ data.partnerNetPrice = 0;
157
+ }
136
158
 
137
159
  let doc = firestore.collection('bookings').doc();
138
160
  transaction.set(doc, data);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tripstorekrabi-shared",
3
- "version": "1.24.7",
3
+ "version": "1.24.9",
4
4
  "description": "Shared library for Trip Store Krabi",
5
5
  "author": "Stefan Sommer <tonprince@gmail.com>",
6
6
  "repository": {
@@ -19,7 +19,7 @@
19
19
  "dependencies": {
20
20
  "dayjs": "^1.11.21",
21
21
  "libphonenumber-js": "^1.13.10",
22
- "nanoid": "^6.0.0",
22
+ "nanoid": "^6.0.1",
23
23
  "firebase-admin": "^14.2.0"
24
24
  },
25
25
  "scripts": {