@pisell/pisellos 2.2.244 → 2.2.246

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 (316) hide show
  1. package/dist/model/strategy/adapter/promotion/evaluator.js +3 -2
  2. package/dist/model/strategy/adapter/walletPass/utils.js +7 -4
  3. package/dist/modules/BookingContext/index.d.ts +48 -0
  4. package/dist/modules/BookingContext/index.js +566 -0
  5. package/dist/modules/BookingContext/types.d.ts +102 -0
  6. package/dist/modules/BookingContext/types.js +51 -0
  7. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  8. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +284 -0
  9. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  10. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +148 -0
  11. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
  12. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +218 -0
  13. package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
  14. package/dist/modules/BookingContext/utils/flexible.js +56 -0
  15. package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  16. package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
  17. package/dist/modules/BookingContext/utils/index.d.ts +11 -0
  18. package/dist/modules/BookingContext/utils/index.js +11 -0
  19. package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
  20. package/dist/modules/BookingContext/utils/noResource.js +77 -0
  21. package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
  22. package/dist/modules/BookingContext/utils/orderLineDisplay.js +36 -0
  23. package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
  24. package/dist/modules/BookingContext/utils/productExtend.js +339 -0
  25. package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  26. package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
  27. package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  28. package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
  29. package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
  30. package/dist/modules/BookingContext/utils/resources.js +486 -0
  31. package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  32. package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
  33. package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  34. package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
  35. package/dist/modules/Cart/utils/cartProduct.js +24 -3
  36. package/dist/modules/Cart/utils/changePrice.js +11 -11
  37. package/dist/modules/Customer/index.d.ts +20 -0
  38. package/dist/modules/Customer/index.js +172 -83
  39. package/dist/modules/Customer/types.d.ts +2 -0
  40. package/dist/modules/Discount/index.d.ts +1 -1
  41. package/dist/modules/Discount/index.js +13 -6
  42. package/dist/modules/Discount/types.d.ts +1 -0
  43. package/dist/modules/OpenData/index.d.ts +8 -0
  44. package/dist/modules/OpenData/index.js +37 -17
  45. package/dist/modules/Order/index.d.ts +277 -18
  46. package/dist/modules/Order/index.js +3581 -779
  47. package/dist/modules/Order/types.d.ts +286 -31
  48. package/dist/modules/Order/types.js +38 -0
  49. package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
  50. package/dist/modules/Order/utils/manualProductDiscount.js +210 -0
  51. package/dist/modules/Order/utils.d.ts +147 -5
  52. package/dist/modules/Order/utils.js +750 -104
  53. package/dist/modules/Payment/index.d.ts +10 -13
  54. package/dist/modules/Payment/index.js +467 -837
  55. package/dist/modules/Payment/types.d.ts +2 -0
  56. package/dist/modules/Payment/utils.js +2 -1
  57. package/dist/modules/Payment/walletpass.js +41 -25
  58. package/dist/modules/ProductList/index.d.ts +16 -12
  59. package/dist/modules/ProductList/index.js +133 -59
  60. package/dist/modules/ProductList/types.d.ts +14 -0
  61. package/dist/modules/Quotation/index.d.ts +0 -1
  62. package/dist/modules/Quotation/index.js +25 -22
  63. package/dist/modules/Rules/index.d.ts +4 -0
  64. package/dist/modules/Rules/index.js +97 -70
  65. package/dist/modules/Rules/types.d.ts +1 -0
  66. package/dist/modules/SalesSummary/index.d.ts +8 -25
  67. package/dist/modules/SalesSummary/index.js +86 -35
  68. package/dist/modules/SalesSummary/types.d.ts +4 -1
  69. package/dist/modules/SalesSummary/utils.d.ts +2 -25
  70. package/dist/modules/SalesSummary/utils.js +794 -162
  71. package/dist/modules/Schedule/index.d.ts +7 -0
  72. package/dist/modules/Schedule/index.js +24 -2
  73. package/dist/modules/Summary/index.js +4 -3
  74. package/dist/modules/SurchargeList/index.d.ts +16 -0
  75. package/dist/modules/SurchargeList/index.js +162 -0
  76. package/dist/modules/SurchargeList/types.d.ts +11 -0
  77. package/dist/modules/SurchargeList/types.js +1 -0
  78. package/dist/modules/index.d.ts +2 -0
  79. package/dist/modules/index.js +3 -1
  80. package/dist/plugins/request.d.ts +1 -0
  81. package/dist/server/index.d.ts +204 -1
  82. package/dist/server/index.js +3654 -922
  83. package/dist/server/modules/index.d.ts +2 -0
  84. package/dist/server/modules/index.js +2 -0
  85. package/dist/server/modules/order/index.d.ts +120 -3
  86. package/dist/server/modules/order/index.js +1762 -448
  87. package/dist/server/modules/order/types.d.ts +32 -3
  88. package/dist/server/modules/order/types.js +8 -0
  89. package/dist/server/modules/order/utils/filterBookings.js +26 -3
  90. package/dist/server/modules/order/utils/filterOrders.js +23 -8
  91. package/dist/server/modules/payment/index.d.ts +28 -0
  92. package/dist/server/modules/payment/index.js +305 -0
  93. package/dist/server/modules/payment/types.d.ts +9 -0
  94. package/dist/server/modules/payment/types.js +1 -0
  95. package/dist/server/modules/products/index.d.ts +34 -7
  96. package/dist/server/modules/products/index.js +631 -317
  97. package/dist/server/modules/resource/index.d.ts +2 -0
  98. package/dist/server/modules/resource/index.js +29 -3
  99. package/dist/server/modules/schedule/index.d.ts +4 -4
  100. package/dist/server/modules/schedule/index.js +111 -88
  101. package/dist/server/test.json +713 -0
  102. package/dist/server/utils/small-ticket.d.ts +71 -0
  103. package/dist/server/utils/small-ticket.js +840 -0
  104. package/dist/solution/BaseSales/index.d.ts +133 -10
  105. package/dist/solution/BaseSales/index.js +1950 -447
  106. package/dist/solution/BaseSales/types.d.ts +82 -6
  107. package/dist/solution/BaseSales/types.js +5 -4
  108. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
  109. package/dist/solution/BaseSales/utils/cartPromotion.js +1438 -0
  110. package/dist/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
  111. package/dist/solution/BaseSales/utils/quotationPrice.js +237 -0
  112. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
  113. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +105 -24
  114. package/dist/solution/BaseSales/utils.d.ts +1 -1
  115. package/dist/solution/BaseSales/utils.js +62 -21
  116. package/dist/solution/BookingByStep/index.d.ts +1 -1
  117. package/dist/solution/BookingTicket/index.d.ts +271 -11
  118. package/dist/solution/BookingTicket/index.js +1777 -242
  119. package/dist/solution/BookingTicket/types.d.ts +118 -1
  120. package/dist/solution/BookingTicket/types.js +41 -2
  121. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
  122. package/dist/solution/BookingTicket/utils/addProductDecision.js +346 -0
  123. package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
  124. package/dist/solution/BookingTicket/utils/addTimeAvailability.js +95 -0
  125. package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +40 -0
  126. package/dist/solution/BookingTicket/utils/bookingStatus.js +70 -0
  127. package/dist/solution/BookingTicket/utils/cartView.d.ts +9 -1
  128. package/dist/solution/BookingTicket/utils/cartView.js +94 -7
  129. package/dist/solution/BookingTicket/utils/exampleData.d.ts +123 -0
  130. package/dist/solution/BookingTicket/utils/exampleData.js +183 -0
  131. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
  132. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +438 -0
  133. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
  134. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +400 -0
  135. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
  136. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +56 -0
  137. package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
  138. package/dist/solution/BookingTicket/utils/scan/index.js +20 -8
  139. package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
  140. package/dist/solution/BookingTicket/utils/scan/scanProductValues.js +150 -0
  141. package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
  142. package/dist/solution/BookingTicket/utils/sessionCatalogStale.js +78 -0
  143. package/dist/solution/Checkout/index.d.ts +1 -0
  144. package/dist/solution/Checkout/index.js +10 -9
  145. package/dist/solution/RegisterAndLogin/config.js +2 -10
  146. package/dist/solution/ScanOrder/index.d.ts +9 -3
  147. package/dist/solution/ScanOrder/index.js +241 -134
  148. package/dist/solution/ScanOrder/types.d.ts +9 -5
  149. package/dist/solution/ScanOrder/types.js +2 -3
  150. package/dist/solution/ScanOrder/utils.d.ts +1 -1
  151. package/dist/solution/ScanOrder/utils.js +84 -22
  152. package/dist/solution/VenueBooking/index.d.ts +5 -2
  153. package/dist/solution/VenueBooking/index.js +110 -59
  154. package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -2
  155. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
  156. package/dist/solution/VenueBooking/utils/slotMerge.js +10 -0
  157. package/dist/types/index.d.ts +10 -0
  158. package/lib/model/strategy/adapter/promotion/evaluator.js +2 -1
  159. package/lib/model/strategy/adapter/promotion/index.js +49 -0
  160. package/lib/model/strategy/adapter/walletPass/utils.js +3 -2
  161. package/lib/modules/BookingContext/index.d.ts +48 -0
  162. package/lib/modules/BookingContext/index.js +368 -0
  163. package/lib/modules/BookingContext/types.d.ts +102 -0
  164. package/lib/modules/BookingContext/types.js +34 -0
  165. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  166. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +276 -0
  167. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  168. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +154 -0
  169. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
  170. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +201 -0
  171. package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
  172. package/lib/modules/BookingContext/utils/flexible.js +80 -0
  173. package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  174. package/lib/modules/BookingContext/utils/formatResourceList.js +50 -0
  175. package/lib/modules/BookingContext/utils/index.d.ts +11 -0
  176. package/lib/modules/BookingContext/utils/index.js +43 -0
  177. package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
  178. package/lib/modules/BookingContext/utils/noResource.js +90 -0
  179. package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
  180. package/lib/modules/BookingContext/utils/orderLineDisplay.js +56 -0
  181. package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
  182. package/lib/modules/BookingContext/utils/productExtend.js +283 -0
  183. package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  184. package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
  185. package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  186. package/lib/modules/BookingContext/utils/resourceSelection.js +46 -0
  187. package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
  188. package/lib/modules/BookingContext/utils/resources.js +377 -0
  189. package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  190. package/lib/modules/BookingContext/utils/serviceTimes.js +162 -0
  191. package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  192. package/lib/modules/BookingContext/utils/timeSlices.js +124 -0
  193. package/lib/modules/Cart/utils/cartProduct.js +20 -3
  194. package/lib/modules/Cart/utils/changePrice.js +12 -20
  195. package/lib/modules/Customer/index.d.ts +20 -0
  196. package/lib/modules/Customer/index.js +64 -11
  197. package/lib/modules/Customer/types.d.ts +2 -0
  198. package/lib/modules/Discount/index.d.ts +1 -1
  199. package/lib/modules/Discount/index.js +9 -1
  200. package/lib/modules/Discount/types.d.ts +1 -0
  201. package/lib/modules/OpenData/index.d.ts +8 -0
  202. package/lib/modules/OpenData/index.js +19 -5
  203. package/lib/modules/Order/index.d.ts +277 -18
  204. package/lib/modules/Order/index.js +2317 -337
  205. package/lib/modules/Order/types.d.ts +286 -31
  206. package/lib/modules/Order/types.js +1 -0
  207. package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
  208. package/lib/modules/Order/utils/manualProductDiscount.js +206 -0
  209. package/lib/modules/Order/utils.d.ts +147 -5
  210. package/lib/modules/Order/utils.js +615 -46
  211. package/lib/modules/Payment/index.d.ts +10 -13
  212. package/lib/modules/Payment/index.js +18 -150
  213. package/lib/modules/Payment/types.d.ts +2 -0
  214. package/lib/modules/Payment/utils.js +2 -1
  215. package/lib/modules/Payment/walletpass.js +16 -3
  216. package/lib/modules/ProductList/index.d.ts +16 -12
  217. package/lib/modules/ProductList/index.js +41 -4
  218. package/lib/modules/ProductList/types.d.ts +14 -0
  219. package/lib/modules/Quotation/index.d.ts +0 -1
  220. package/lib/modules/Quotation/index.js +19 -16
  221. package/lib/modules/Rules/index.d.ts +4 -0
  222. package/lib/modules/Rules/index.js +137 -120
  223. package/lib/modules/Rules/types.d.ts +1 -0
  224. package/lib/modules/SalesSummary/index.d.ts +8 -25
  225. package/lib/modules/SalesSummary/index.js +30 -4
  226. package/lib/modules/SalesSummary/types.d.ts +4 -1
  227. package/lib/modules/SalesSummary/utils.d.ts +2 -25
  228. package/lib/modules/SalesSummary/utils.js +645 -91
  229. package/lib/modules/Schedule/index.d.ts +7 -0
  230. package/lib/modules/Schedule/index.js +17 -1
  231. package/lib/modules/Summary/index.js +5 -4
  232. package/lib/modules/SurchargeList/index.d.ts +16 -0
  233. package/lib/modules/SurchargeList/index.js +89 -0
  234. package/lib/modules/SurchargeList/types.d.ts +11 -0
  235. package/lib/modules/SurchargeList/types.js +17 -0
  236. package/lib/modules/index.d.ts +2 -0
  237. package/lib/modules/index.js +5 -1
  238. package/lib/plugins/request.d.ts +1 -0
  239. package/lib/server/index.d.ts +204 -1
  240. package/lib/server/index.js +1891 -59
  241. package/lib/server/modules/index.d.ts +2 -0
  242. package/lib/server/modules/index.js +3 -0
  243. package/lib/server/modules/order/index.d.ts +120 -3
  244. package/lib/server/modules/order/index.js +887 -94
  245. package/lib/server/modules/order/types.d.ts +32 -3
  246. package/lib/server/modules/order/utils/filterBookings.js +24 -5
  247. package/lib/server/modules/order/utils/filterOrders.js +15 -6
  248. package/lib/server/modules/payment/index.d.ts +28 -0
  249. package/lib/server/modules/payment/index.js +192 -0
  250. package/lib/server/modules/payment/types.d.ts +9 -0
  251. package/lib/server/modules/payment/types.js +17 -0
  252. package/lib/server/modules/products/index.d.ts +34 -7
  253. package/lib/server/modules/products/index.js +189 -54
  254. package/lib/server/modules/resource/index.d.ts +2 -0
  255. package/lib/server/modules/resource/index.js +27 -3
  256. package/lib/server/modules/schedule/index.d.ts +4 -4
  257. package/lib/server/modules/schedule/index.js +47 -40
  258. package/lib/server/test.json +713 -0
  259. package/lib/server/utils/small-ticket.d.ts +71 -0
  260. package/lib/server/utils/small-ticket.js +800 -0
  261. package/lib/solution/BaseSales/index.d.ts +133 -10
  262. package/lib/solution/BaseSales/index.js +1111 -63
  263. package/lib/solution/BaseSales/types.d.ts +82 -6
  264. package/lib/solution/BaseSales/types.js +3 -1
  265. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
  266. package/lib/solution/BaseSales/utils/cartPromotion.js +992 -0
  267. package/lib/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
  268. package/lib/solution/BaseSales/utils/quotationPrice.js +277 -0
  269. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
  270. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +106 -18
  271. package/lib/solution/BaseSales/utils.d.ts +1 -1
  272. package/lib/solution/BaseSales/utils.js +54 -10
  273. package/lib/solution/BookingByStep/index.d.ts +1 -1
  274. package/lib/solution/BookingTicket/index.d.ts +271 -11
  275. package/lib/solution/BookingTicket/index.js +922 -29
  276. package/lib/solution/BookingTicket/types.d.ts +118 -1
  277. package/lib/solution/BookingTicket/types.js +11 -0
  278. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
  279. package/lib/solution/BookingTicket/utils/addProductDecision.js +318 -0
  280. package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
  281. package/lib/solution/BookingTicket/utils/addTimeAvailability.js +125 -0
  282. package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +40 -0
  283. package/lib/solution/BookingTicket/utils/bookingStatus.js +44 -2
  284. package/lib/solution/BookingTicket/utils/cartView.d.ts +9 -1
  285. package/lib/solution/BookingTicket/utils/cartView.js +61 -6
  286. package/lib/solution/BookingTicket/utils/exampleData.d.ts +123 -0
  287. package/lib/solution/BookingTicket/utils/exampleData.js +0 -0
  288. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
  289. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +254 -0
  290. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
  291. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +169 -0
  292. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
  293. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +51 -0
  294. package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
  295. package/lib/solution/BookingTicket/utils/scan/index.js +17 -3
  296. package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
  297. package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +127 -0
  298. package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
  299. package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +85 -0
  300. package/lib/solution/Checkout/index.d.ts +1 -0
  301. package/lib/solution/Checkout/index.js +1 -2
  302. package/lib/solution/RegisterAndLogin/config.js +2 -10
  303. package/lib/solution/ScanOrder/index.d.ts +9 -3
  304. package/lib/solution/ScanOrder/index.js +153 -70
  305. package/lib/solution/ScanOrder/types.d.ts +9 -5
  306. package/lib/solution/ScanOrder/utils.d.ts +1 -1
  307. package/lib/solution/ScanOrder/utils.js +83 -17
  308. package/lib/solution/VenueBooking/index.d.ts +5 -2
  309. package/lib/solution/VenueBooking/index.js +54 -17
  310. package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -2
  311. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
  312. package/lib/solution/VenueBooking/utils/slotMerge.js +10 -0
  313. package/lib/types/index.d.ts +10 -0
  314. package/package.json +1 -1
  315. package/dist/solution/Checkout/appointmentDemo.json +0 -1
  316. package/lib/solution/Checkout/appointmentDemo.json +0 -1
@@ -29,67 +29,450 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
29
29
  // src/modules/Order/utils.ts
30
30
  var utils_exports = {};
31
31
  __export(utils_exports, {
32
+ buildManualProductDiscountItem: () => import_manualProductDiscount.buildManualProductDiscountItem,
32
33
  buildSubmitPayload: () => buildSubmitPayload,
34
+ calculateOrderProductsDeposit: () => calculateOrderProductsDeposit,
35
+ clearTempOrderHolderAssignments: () => clearTempOrderHolderAssignments,
33
36
  composeLinePrice: () => composeLinePrice,
34
37
  createDefaultOrderRulesHooks: () => createDefaultOrderRulesHooks,
35
38
  createDefaultTempOrder: () => createDefaultTempOrder,
36
39
  createEmptySummary: () => import_utils2.createEmptySummary,
37
40
  createUuidV4: () => createUuidV4,
41
+ ensureManualProductDiscountList: () => import_manualProductDiscount.ensureManualProductDiscountList,
42
+ ensureProductSku: () => ensureProductSku,
43
+ findManualProductDiscountItem: () => import_manualProductDiscount.findManualProductDiscountItem,
38
44
  formatDateTime: () => formatDateTime,
39
45
  formatV1Product: () => formatV1Product,
40
46
  generateDuration: () => generateDuration,
41
47
  getAllDiscountList: () => getAllDiscountList,
48
+ getBundleSellingMagnitude: () => getBundleSellingMagnitude,
49
+ getBundleSignedUnit: () => getBundleSignedUnit,
50
+ getOrderProductLineUid: () => getOrderProductLineUid,
51
+ getProductSkuOptions: () => getProductSkuOptions,
52
+ hasAssignedHolderId: () => hasAssignedHolderId,
53
+ indexOrderProductsByUid: () => indexOrderProductsByUid,
54
+ isEmptyOrderProductDisplayValue: () => isEmptyOrderProductDisplayValue,
55
+ isMarkdownBundle: () => isMarkdownBundle,
42
56
  isTempOrder: () => isTempOrder,
43
57
  mapPaymentItemToOrderPayment: () => mapPaymentItemToOrderPayment,
44
58
  mapPaymentItemsToOrderPayments: () => mapPaymentItemsToOrderPayments,
59
+ mergeManualProductDiscountIntoList: () => import_manualProductDiscount.mergeManualProductDiscountIntoList,
60
+ mergeOrderProductDisplayFields: () => mergeOrderProductDisplayFields,
45
61
  mergeRelationForms: () => mergeRelationForms,
46
62
  normalizeBookingIsAll: () => normalizeBookingIsAll,
47
63
  normalizeBookingSubType: () => normalizeBookingSubType,
64
+ normalizeOrderProductDiscountList: () => normalizeOrderProductDiscountList,
65
+ normalizeProductSkuOptions: () => normalizeProductSkuOptions,
48
66
  normalizeSubmitBooking: () => normalizeSubmitBooking,
49
67
  normalizeSubmitCollectPaxValue: () => normalizeSubmitCollectPaxValue,
68
+ resolveEffectivePerUnitDiscount: () => resolveEffectivePerUnitDiscount,
69
+ resolveManualDiscountMessage: () => import_manualProductDiscount.resolveManualDiscountMessage,
70
+ resolveManualDiscountOriginTotal: () => import_manualProductDiscount.resolveManualDiscountOriginTotal,
71
+ resolveManualDiscountReasonFromSources: () => import_manualProductDiscount.resolveManualDiscountReasonFromSources,
72
+ resolveManualOverrideLineOriginalPrice: () => resolveManualOverrideLineOriginalPrice,
73
+ resolveRulesManualDiscountFlag: () => resolveRulesManualDiscountFlag,
74
+ resolveSafeProductNum: () => import_manualProductDiscount.resolveSafeProductNum,
50
75
  resolveSubmitCollectPax: () => resolveSubmitCollectPax,
51
- sumOptionUnitPrice: () => sumOptionUnitPrice
76
+ shouldBuildManualProductDiscount: () => import_manualProductDiscount.shouldBuildManualProductDiscount,
77
+ stripManualProductDiscountItems: () => import_manualProductDiscount.stripManualProductDiscountItems,
78
+ sumOptionUnitPrice: () => sumOptionUnitPrice,
79
+ syncManualProductDiscountProductNum: () => import_manualProductDiscount.syncManualProductDiscountProductNum
52
80
  });
53
81
  module.exports = __toCommonJS(utils_exports);
54
82
  var import_dayjs = __toESM(require("dayjs"));
55
83
  var import_decimal = __toESM(require("decimal.js"));
56
84
  var import_utils = require("../../solution/ScanOrder/utils");
57
85
  var import_utils2 = require("../../solution/ScanOrder/utils");
86
+ var import_manualProductDiscount = require("./utils/manualProductDiscount");
58
87
  function composeLinePrice(params) {
59
88
  const { mainPrice, bundle, useOriginalBundle } = params;
60
89
  let total = new import_decimal.default(Number(mainPrice) || 0);
61
90
  if (Array.isArray(bundle)) {
62
91
  for (const item of bundle) {
63
- const rawPrice = useOriginalBundle ? (item == null ? void 0 : item.original_price) ?? (item == null ? void 0 : item.product_price) ?? (item == null ? void 0 : item.price) : (item == null ? void 0 : item.bundle_selling_price) ?? (item == null ? void 0 : item.price);
64
- const price = new import_decimal.default(Number(rawPrice) || 0);
92
+ const signedUnit = getBundleSignedUnit(item, { useOriginal: useOriginalBundle });
65
93
  const rawNum = (item == null ? void 0 : item.num) ?? (item == null ? void 0 : item.quantity) ?? 1;
66
94
  const num = new import_decimal.default(Number(rawNum) || 0);
67
- total = total.plus(price.times(num));
95
+ total = total.plus(signedUnit.times(num));
68
96
  }
69
97
  }
70
98
  return total.toDecimalPlaces(2).toFixed(2);
71
99
  }
100
+ function normalizeProductSkuOptions(options) {
101
+ if (!Array.isArray(options))
102
+ return [];
103
+ return options.map((option) => {
104
+ const normalized = {
105
+ ...option && typeof option === "object" ? option : {}
106
+ };
107
+ const addPrice = normalized.add_price ?? normalized.price;
108
+ if (addPrice !== void 0)
109
+ normalized.add_price = addPrice;
110
+ delete normalized.price;
111
+ return normalized;
112
+ });
113
+ }
114
+ function ensureProductSku(product) {
115
+ const rawSku = (product == null ? void 0 : product.product_sku) && typeof product.product_sku === "object" ? product.product_sku : {};
116
+ return {
117
+ ...rawSku,
118
+ option: normalizeProductSkuOptions(rawSku.option)
119
+ };
120
+ }
121
+ function getProductSkuOptions(product) {
122
+ return ensureProductSku(product).option;
123
+ }
72
124
  function sumOptionUnitPrice(options) {
73
125
  let total = new import_decimal.default(0);
74
126
  if (!Array.isArray(options))
75
127
  return total;
76
128
  for (const opt of options) {
77
- const price = new import_decimal.default(Number(opt == null ? void 0 : opt.price) || 0);
129
+ const price = new import_decimal.default(Number((opt == null ? void 0 : opt.add_price) ?? (opt == null ? void 0 : opt.price)) || 0);
78
130
  const num = new import_decimal.default(Number(opt == null ? void 0 : opt.num) || 0);
79
131
  total = total.plus(price.times(num));
80
132
  }
81
133
  return total;
82
134
  }
135
+ function getSafeOrderProductNum(num) {
136
+ const parsedNum = Number(num ?? 1);
137
+ if (!Number.isFinite(parsedNum) || parsedNum < 1)
138
+ return 1;
139
+ return Math.floor(parsedNum);
140
+ }
141
+ function getOrderProductDepositUnitTotal(product) {
142
+ const metadata = product.metadata || {};
143
+ const paymentPrice = metadata.main_product_attached_bundle_payment_price;
144
+ const mainSellingPrice = metadata.main_product_selling_price;
145
+ const fallbackPrice = product.selling_price;
146
+ return new import_decimal.default(Number(paymentPrice ?? mainSellingPrice ?? fallbackPrice) || 0);
147
+ }
148
+ function normalizeDepositProtocols(protocols) {
149
+ if (!Array.isArray(protocols))
150
+ return [];
151
+ return protocols.reduce((result, protocol) => {
152
+ const id = Number(protocol == null ? void 0 : protocol.id);
153
+ if (!Number.isFinite(id))
154
+ return result;
155
+ result.push({
156
+ id: Math.floor(id),
157
+ title: String((protocol == null ? void 0 : protocol.title) || "")
158
+ });
159
+ return result;
160
+ }, []);
161
+ }
162
+ function getDepositPolicyIds(depositData) {
163
+ const ids = [
164
+ ...Array.isArray(depositData == null ? void 0 : depositData.self_deposit_policy_ids) ? depositData.self_deposit_policy_ids : [],
165
+ ...Array.isArray(depositData == null ? void 0 : depositData.deposit_policy_ids) ? depositData.deposit_policy_ids : []
166
+ ];
167
+ return ids.reduce((result, id) => {
168
+ const normalizedId = Number(id);
169
+ if (!Number.isFinite(normalizedId))
170
+ return result;
171
+ result.push(Math.floor(normalizedId));
172
+ return result;
173
+ }, []);
174
+ }
175
+ function handleOrderProductDeposit(params) {
176
+ const { depositData, total, num } = params;
177
+ if (!depositData)
178
+ return { result: false, depositTotal: new import_decimal.default(0) };
179
+ const { deposit_fixed, deposit_percentage } = depositData;
180
+ if (typeof deposit_fixed !== "string" || typeof deposit_percentage !== "string") {
181
+ return { result: false, depositTotal: new import_decimal.default(0) };
182
+ }
183
+ const depositFixed = new import_decimal.default(deposit_fixed || 0);
184
+ const depositPercent = new import_decimal.default(deposit_percentage || 0);
185
+ const productTotalPrice = new import_decimal.default(total || 0);
186
+ const deposit = depositFixed.plus(depositPercent.times(productTotalPrice));
187
+ return { depositTotal: deposit.times(num), result: true };
188
+ }
189
+ function resolveOrderProductDepositSource(product, runtimeOrigin) {
190
+ const record = product;
191
+ const origin = record._origin || runtimeOrigin || {};
192
+ const originProduct = origin.product || {};
193
+ return {
194
+ ...originProduct,
195
+ ...origin,
196
+ ...record,
197
+ custom_deposit_data: record.custom_deposit_data ?? origin.custom_deposit_data ?? originProduct.custom_deposit_data,
198
+ variant: record.variant ?? origin.variant ?? originProduct.variant
199
+ };
200
+ }
201
+ function getOrderProductDeposit(product, runtimeOrigin) {
202
+ const depositProduct = resolveOrderProductDepositSource(product, runtimeOrigin);
203
+ const depositData = depositProduct.custom_deposit_data;
204
+ if ((depositData == null ? void 0 : depositData.has_deposit) != 1)
205
+ return null;
206
+ const num = getSafeOrderProductNum(product.num);
207
+ const total = getOrderProductDepositUnitTotal(product).times(num);
208
+ const allProtocols = normalizeDepositProtocols(depositData.deposit_policy_data);
209
+ const protocolIds = [];
210
+ let depositTotal = new import_decimal.default(0);
211
+ let hasDeposit = false;
212
+ if (typeof depositData.deposit_fixed === "string" && typeof depositData.deposit_percentage === "string") {
213
+ const result = handleOrderProductDeposit({
214
+ depositData,
215
+ total,
216
+ num
217
+ });
218
+ if (result.result) {
219
+ depositTotal = result.depositTotal;
220
+ protocolIds.push(...getDepositPolicyIds({
221
+ self_deposit_policy_ids: depositData.self_deposit_policy_ids
222
+ }));
223
+ hasDeposit = true;
224
+ }
225
+ } else {
226
+ const productVariantId = depositProduct.product_variant_id ?? product.product_variant_id;
227
+ if (productVariantId) {
228
+ const variantProduct = (depositProduct.variant || []).find(
229
+ (item) => (item == null ? void 0 : item.id) === productVariantId
230
+ );
231
+ const variantDepositData = variantProduct == null ? void 0 : variantProduct.custom_deposit_data;
232
+ const result = handleOrderProductDeposit({
233
+ depositData: variantDepositData,
234
+ total,
235
+ num
236
+ });
237
+ if (result.result) {
238
+ depositTotal = result.depositTotal;
239
+ protocolIds.push(...getDepositPolicyIds({
240
+ self_deposit_policy_ids: variantDepositData == null ? void 0 : variantDepositData.self_deposit_policy_ids
241
+ }));
242
+ hasDeposit = true;
243
+ }
244
+ }
245
+ if (Array.isArray(product.product_bundle) && product.product_bundle.length) {
246
+ depositTotal = product.product_bundle.reduce((accumulator, bundleProduct) => {
247
+ const bundleDepositData = bundleProduct == null ? void 0 : bundleProduct.custom_deposit_data;
248
+ const result = handleOrderProductDeposit({
249
+ depositData: bundleDepositData,
250
+ total: bundleProduct == null ? void 0 : bundleProduct.price,
251
+ num: getSafeOrderProductNum((bundleProduct == null ? void 0 : bundleProduct.num) || 1)
252
+ });
253
+ if (!result.result)
254
+ return accumulator;
255
+ protocolIds.push(...getDepositPolicyIds({
256
+ self_deposit_policy_ids: bundleDepositData == null ? void 0 : bundleDepositData.self_deposit_policy_ids
257
+ }));
258
+ hasDeposit = true;
259
+ return accumulator.plus(result.depositTotal);
260
+ }, new import_decimal.default(0));
261
+ }
262
+ }
263
+ if (!hasDeposit)
264
+ return null;
265
+ const protocolIdSet = new Set(protocolIds);
266
+ const protocols = allProtocols.filter((protocol) => protocolIdSet.has(protocol.id));
267
+ return {
268
+ total: depositTotal.toNumber(),
269
+ protocols
270
+ };
271
+ }
272
+ function calculateOrderProductsDeposit(products = [], options) {
273
+ var _a, _b, _c;
274
+ const protocolMap = /* @__PURE__ */ new Map();
275
+ let total = new import_decimal.default(0);
276
+ let hasDeposit = false;
277
+ for (const product of products || []) {
278
+ const productUid = (_a = product.metadata) == null ? void 0 : _a.unique_identification_number;
279
+ const runtimeOrigin = productUid ? (_c = (_b = options == null ? void 0 : options.productsByUid) == null ? void 0 : _b[productUid]) == null ? void 0 : _c.origin : void 0;
280
+ const deposit = getOrderProductDeposit(product, runtimeOrigin);
281
+ product.deposit = deposit;
282
+ if (!(deposit == null ? void 0 : deposit.total) || Number(deposit.total) <= 0)
283
+ continue;
284
+ total = total.plus(deposit.total);
285
+ for (const discount of product.discount_list || []) {
286
+ total = total.minus((discount == null ? void 0 : discount.amount) || 0);
287
+ }
288
+ for (const protocol of deposit.protocols || []) {
289
+ if (!protocolMap.has(protocol.id))
290
+ protocolMap.set(protocol.id, protocol);
291
+ }
292
+ hasDeposit = true;
293
+ }
294
+ const roundedTotal = total.toDecimalPlaces(2, import_decimal.default.ROUND_HALF_UP);
295
+ const protocols = [...protocolMap.values()];
296
+ return {
297
+ total: roundedTotal.toNumber(),
298
+ totalText: roundedTotal.toFixed(2),
299
+ protocols,
300
+ deposit_policy_ids: protocols.map((protocol) => protocol.id),
301
+ hasDeposit
302
+ };
303
+ }
304
+ function isMarkdownBundle(bundle) {
305
+ if (!bundle || typeof bundle !== "object")
306
+ return false;
307
+ const ext = bundle.price_type_ext ?? bundle.custom_price_type_ext;
308
+ const type = bundle.price_type ?? bundle.custom_price_type;
309
+ return type === "markdown" && ext !== "product_price";
310
+ }
311
+ function getBundleSignedUnit(bundle, options) {
312
+ if (!bundle || typeof bundle !== "object")
313
+ return new import_decimal.default(0);
314
+ const useOriginal = (options == null ? void 0 : options.useOriginal) ?? false;
315
+ if (isMarkdownBundle(bundle)) {
316
+ const catalog = useOriginal ? bundle.original_price ?? bundle.product_price ?? bundle.custom_price ?? bundle.base_price ?? bundle.price : bundle.custom_price ?? bundle.product_price ?? bundle.original_price ?? bundle.base_price ?? bundle.price;
317
+ if (catalog !== void 0 && catalog !== null && catalog !== "") {
318
+ const raw = new import_decimal.default(Number(catalog) || 0);
319
+ if (raw.lt(0))
320
+ return raw;
321
+ return raw.minus(sumOptionUnitPrice(bundle.option)).negated();
322
+ }
323
+ return new import_decimal.default(Number(bundle.bundle_selling_price) || 0).abs().negated();
324
+ }
325
+ const rawPrice = useOriginal ? bundle.original_price ?? bundle.product_price ?? bundle.price : bundle.bundle_selling_price ?? bundle.price;
326
+ return new import_decimal.default(Number(rawPrice) || 0);
327
+ }
328
+ function getBundleSellingMagnitude(bundle) {
329
+ return getBundleSignedUnit(bundle).abs();
330
+ }
331
+ function resolveRulesManualDiscountFlag(metadata) {
332
+ if (!metadata)
333
+ return void 0;
334
+ if (metadata.is_manual_discount === true || metadata.is_manual_discount === 1) {
335
+ return true;
336
+ }
337
+ const priceOverride = metadata.price_override;
338
+ if (priceOverride !== void 0 && priceOverride !== null && priceOverride !== "") {
339
+ return true;
340
+ }
341
+ return void 0;
342
+ }
343
+ function normalizeOrderProductDiscountAmount(amount) {
344
+ if (amount === void 0 || amount === null)
345
+ return void 0;
346
+ return String(amount);
347
+ }
348
+ function normalizeOrderProductDiscountList(discountList) {
349
+ if (!Array.isArray(discountList))
350
+ return [];
351
+ return discountList.filter((item) => !!item && typeof item === "object").map((item) => {
352
+ const normalized = {
353
+ discount_id: Number.isFinite(Number(item.discount_id)) ? Number(item.discount_id) : 0
354
+ };
355
+ if (item.order_discount_id === null) {
356
+ normalized.order_discount_id = null;
357
+ } else if (item.order_discount_id !== void 0) {
358
+ const orderDiscountId = Number(item.order_discount_id);
359
+ if (Number.isFinite(orderDiscountId)) {
360
+ normalized.order_discount_id = orderDiscountId;
361
+ }
362
+ }
363
+ if (item.type !== void 0)
364
+ normalized.type = item.type;
365
+ const amount = normalizeOrderProductDiscountAmount(item.amount);
366
+ if (amount !== void 0)
367
+ normalized.amount = amount;
368
+ if (item.discount && typeof item.discount === "object") {
369
+ normalized.discount = { ...item.discount };
370
+ }
371
+ if (item.metadata === null) {
372
+ normalized.metadata = null;
373
+ } else if (item.metadata && typeof item.metadata === "object") {
374
+ normalized.metadata = { ...item.metadata };
375
+ }
376
+ return normalized;
377
+ });
378
+ }
379
+ function resolveManualOverrideLineOriginalPrice(params, fallbackCompositeOriginal) {
380
+ var _a, _b;
381
+ const metadata = params.metadata || {};
382
+ const priceOverride = metadata.price_override;
383
+ if (priceOverride === void 0 || priceOverride === null || priceOverride === "") {
384
+ return fallbackCompositeOriginal;
385
+ }
386
+ const refTotal = (_b = (_a = metadata.origin) == null ? void 0 : _a._extend) == null ? void 0 : _b.origin_total;
387
+ if (refTotal !== void 0 && refTotal !== null && refTotal !== "") {
388
+ const parsed = Number(refTotal);
389
+ if (Number.isFinite(parsed)) {
390
+ return new import_decimal.default(parsed).toDecimalPlaces(2).toFixed(2);
391
+ }
392
+ }
393
+ const lineOriginal = params.lineOriginalPrice;
394
+ if (lineOriginal !== void 0 && lineOriginal !== null && lineOriginal !== "") {
395
+ const parsedLine = Number(lineOriginal);
396
+ const parsedFallback = Number(fallbackCompositeOriginal);
397
+ if (Number.isFinite(parsedLine) && Number.isFinite(parsedFallback) && parsedLine > parsedFallback) {
398
+ return new import_decimal.default(parsedLine).toDecimalPlaces(2).toFixed(2);
399
+ }
400
+ }
401
+ return fallbackCompositeOriginal;
402
+ }
403
+ function resolveEffectivePerUnitDiscount(product) {
404
+ const discountList = Array.isArray(product == null ? void 0 : product.discount_list) ? product.discount_list : [];
405
+ const fromList = discountList.reduce(
406
+ (sum, discount) => sum + Number((discount == null ? void 0 : discount.amount) || 0),
407
+ 0
408
+ );
409
+ const hasPromoDiscountItem = discountList.some((item) => (item == null ? void 0 : item.type) === "promotion");
410
+ if (hasPromoDiscountItem)
411
+ return fromList;
412
+ const metadata = (product == null ? void 0 : product.metadata) || {};
413
+ const promo = metadata._promotion;
414
+ if ((promo == null ? void 0 : promo.inPromotion) !== true)
415
+ return fromList;
416
+ const optionSum = sumOptionUnitPrice(getProductSkuOptions(product)).toNumber();
417
+ if (!discountList.length && metadata.source_product_price != null && metadata.main_product_selling_price != null) {
418
+ const source = Number(metadata.source_product_price);
419
+ const selling = Number(metadata.main_product_selling_price) - optionSum;
420
+ if (Number.isFinite(source) && Number.isFinite(selling) && source !== selling) {
421
+ return fromList + (source - selling);
422
+ }
423
+ }
424
+ const originalPrice = Number(promo.originalPrice);
425
+ const finalPrice = Number(promo.finalPrice);
426
+ if (!Number.isFinite(originalPrice) || !Number.isFinite(finalPrice))
427
+ return fromList;
428
+ return fromList + (originalPrice - finalPrice);
429
+ }
83
430
  function createDefaultOrderRulesHooks() {
84
431
  const toUnitPriceString = (totalLike, num) => {
85
432
  const effectiveNum = Number(num) > 0 ? Number(num) : 1;
86
433
  return new import_decimal.default(Number(totalLike) || 0).dividedBy(effectiveNum).toDecimalPlaces(2).toString();
87
434
  };
435
+ const getBundleIdentity = (bundle) => {
436
+ return [
437
+ bundle.bundle_id ?? bundle.id ?? "",
438
+ bundle.bundle_product_id ?? bundle._bundle_product_id ?? bundle.product_id ?? "",
439
+ bundle.bundle_variant_id ?? bundle.variant_id ?? bundle.product_variant_id ?? 0,
440
+ bundle.bundle_group_id ?? bundle.group_id ?? ""
441
+ ].join("|");
442
+ };
443
+ const mergeRulesBundlePrices = (currentBundle, rulesBundle) => {
444
+ if (!Array.isArray(rulesBundle))
445
+ return rulesBundle;
446
+ const currentByIdentity = /* @__PURE__ */ new Map();
447
+ (currentBundle || []).forEach((bundle) => {
448
+ if (!bundle || typeof bundle !== "object")
449
+ return;
450
+ currentByIdentity.set(getBundleIdentity(bundle), bundle);
451
+ });
452
+ return rulesBundle.map((bundle) => {
453
+ if (!bundle || typeof bundle !== "object")
454
+ return bundle;
455
+ const current = currentByIdentity.get(getBundleIdentity(bundle));
456
+ if (!current)
457
+ return bundle;
458
+ const isProductPriceBundle = (bundle.price_type_ext ?? current.price_type_ext) === "product_price";
459
+ if (!isProductPriceBundle)
460
+ return bundle;
461
+ const sourcePrice = current.price ?? current.custom_price ?? current.original_price ?? current.bundle_selling_price;
462
+ const originalPrice = current.original_price ?? current.product_price ?? current.price ?? current.custom_price ?? sourcePrice;
463
+ return {
464
+ ...bundle,
465
+ ...sourcePrice !== void 0 ? { price: sourcePrice } : {},
466
+ ...originalPrice !== void 0 ? { original_price: originalPrice } : {},
467
+ ...current.original_total !== void 0 ? { original_total: current.original_total } : {}
468
+ };
469
+ });
470
+ };
88
471
  return {
89
472
  getProduct: (product) => {
90
473
  var _a, _b, _c, _d, _e, _f;
91
474
  const metadataAny = product.metadata || {};
92
- const optionSum = sumOptionUnitPrice(product.product_option_item);
475
+ const optionSum = sumOptionUnitPrice(getProductSkuOptions(product));
93
476
  let sourcePrice;
94
477
  if (metadataAny.source_product_price !== void 0) {
95
478
  sourcePrice = String(metadataAny.source_product_price);
@@ -114,10 +497,10 @@ function createDefaultOrderRulesHooks() {
114
497
  id: product.product_id,
115
498
  // Rules 引擎用 _id 作为 processedProductsMap 键;必须与购物车行级 identity 一致,
116
499
  // 否则同 SKU 不同小料会在 calcDiscount 重组时互相覆盖。
117
- // 不透明 identity 契约下,normalizeOrderProduct / restoreTempOrderFromStorage 已保证唯一值存在;
500
+ // 不透明 identity 契约下,normalizeOrderProduct / hydrate 已保证唯一值存在;
118
501
  // 留 fingerprint 分支仅作 Rules 单测里直接传裸 product 时的兜底。
119
502
  _id: ((_a = product.metadata) == null ? void 0 : _a.unique_identification_number) ? `${product.product_id}_${product.product_variant_id}_${product.metadata.unique_identification_number}` : `${product.product_id}_${product.product_variant_id}_${(0, import_utils.buildProductLineFingerprint)(
120
- product.product_option_item,
503
+ getProductSkuOptions(product),
121
504
  product.product_bundle
122
505
  )}`,
123
506
  // Rules 内部 getProductTotalPrice / getProductOriginTotalPrice 会各自再叠加 bundle + option,
@@ -135,22 +518,27 @@ function createDefaultOrderRulesHooks() {
135
518
  bundle: product.product_bundle || [],
136
519
  booking_id: ((_b = product.metadata) == null ? void 0 : _b.booking_id) || null,
137
520
  isClient: false,
138
- isManualDiscount: ((_c = product.metadata) == null ? void 0 : _c.is_manual_discount) || false,
139
- holder_id: (_d = product.metadata) == null ? void 0 : _d.holder_id,
140
- startDate: ((_e = product.metadata) == null ? void 0 : _e.start_date) || ((_f = product.metadata) == null ? void 0 : _f.startDate)
521
+ // 勿写死 false:否则 Rules 不会走 total≠origin_total 的手动价推断,
522
+ // 无券时会把 bundle 价还原成 original_price(手动改价套餐会从 20 回到 30)。
523
+ isManualDiscount: resolveRulesManualDiscountFlag(metadataAny),
524
+ holder_id: (_c = product.metadata) == null ? void 0 : _c.holder_id,
525
+ startDate: ((_d = product.metadata) == null ? void 0 : _d.start_date) || ((_e = product.metadata) == null ? void 0 : _e.startDate),
526
+ main_product_selling_price: metadataAny.main_product_selling_price !== void 0 ? new import_decimal.default(Number(metadataAny.main_product_selling_price) || 0).minus(optionSum).toDecimalPlaces(2).toString() : void 0,
527
+ inPromotion: ((_f = metadataAny._promotion) == null ? void 0 : _f.inPromotion) === true,
528
+ _promotion: metadataAny._promotion
141
529
  };
142
530
  },
143
531
  setProduct: (product, values) => {
144
532
  const nextNum = Number(values.quantity ?? product.num ?? 1) || 1;
145
533
  const metadataAny = product.metadata || {};
146
534
  const existedSource = metadataAny.source_product_price ?? product.selling_price ?? "0";
147
- const nextOptions = product.product_option_item;
535
+ const nextOptions = getProductSkuOptions(product);
148
536
  const optionSum = sumOptionUnitPrice(nextOptions);
149
537
  const nextSourceSellingPrice = values.main_product_selling_price !== void 0 ? String(values.main_product_selling_price) : values.price !== void 0 ? String(values.price) : values.total !== void 0 ? toUnitPriceString(values.total, nextNum) : String(existedSource);
150
538
  const nextSourceOriginalPrice = values.original_price !== void 0 ? String(values.original_price) : String(existedSource);
151
539
  const nextMainSellingPrice = new import_decimal.default(Number(nextSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
152
540
  const nextMainOriginalPrice = new import_decimal.default(Number(nextSourceOriginalPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
153
- const nextBundle = values.bundle ?? product.product_bundle;
541
+ const nextBundle = values.bundle !== void 0 ? mergeRulesBundlePrices(product.product_bundle, values.bundle) : product.product_bundle;
154
542
  const composedSellingPrice = composeLinePrice({
155
543
  mainPrice: nextMainSellingPrice,
156
544
  bundle: nextBundle
@@ -160,10 +548,14 @@ function createDefaultOrderRulesHooks() {
160
548
  bundle: nextBundle,
161
549
  useOriginalBundle: true
162
550
  });
551
+ const finalOriginalPrice = resolveManualOverrideLineOriginalPrice(
552
+ { num: nextNum, metadata: metadataAny, lineOriginalPrice: product.original_price },
553
+ composedOriginalPrice
554
+ );
163
555
  return {
164
556
  ...product,
165
557
  selling_price: composedSellingPrice,
166
- original_price: composedOriginalPrice,
558
+ original_price: finalOriginalPrice,
167
559
  discount_list: values.discount_list ?? product.discount_list,
168
560
  num: values.quantity ?? product.num,
169
561
  product_bundle: nextBundle,
@@ -249,6 +641,7 @@ function formatSubmitOptionItems(options) {
249
641
  return [];
250
642
  return options.map((d) => {
251
643
  const option = {
644
+ ...d && typeof d === "object" ? d : {},
252
645
  num: d == null ? void 0 : d.num,
253
646
  option_group_item_id: d == null ? void 0 : d.option_group_item_id,
254
647
  option_group_id: d == null ? void 0 : d.option_group_id
@@ -256,6 +649,7 @@ function formatSubmitOptionItems(options) {
256
649
  const addPrice = (d == null ? void 0 : d.add_price) ?? (d == null ? void 0 : d.price);
257
650
  if (addPrice !== void 0)
258
651
  option.add_price = String(addPrice);
652
+ delete option.price;
259
653
  return option;
260
654
  });
261
655
  }
@@ -277,9 +671,8 @@ function formatSubmitBundleItems(bundle) {
277
671
  return bundle.map((b) => {
278
672
  const rawBundle = b && typeof b === "object" ? b : {};
279
673
  const existedMetadata = rawBundle.metadata && typeof rawBundle.metadata === "object" ? rawBundle.metadata : {};
280
- const sellingPrice = toMoneyString(
281
- rawBundle.bundle_selling_price ?? rawBundle.price
282
- );
674
+ const sellingPrice = getBundleSellingMagnitude(rawBundle).toFixed(2);
675
+ const paymentPrice = rawBundle.bundle_payment_price !== void 0 && rawBundle.bundle_payment_price !== null && rawBundle.bundle_payment_price !== "" ? toMoneyString(rawBundle.bundle_payment_price) : sellingPrice;
283
676
  const priceValue = rawBundle.price ?? rawBundle.custom_price ?? rawBundle.bundle_selling_price;
284
677
  const relationSurchargeIds = Array.isArray(rawBundle.relation_surcharge_ids) ? rawBundle.relation_surcharge_ids : Array.isArray(existedMetadata.relation_surcharge_ids) ? existedMetadata.relation_surcharge_ids : [];
285
678
  const surchargeFee = toMoneyString(
@@ -301,6 +694,7 @@ function formatSubmitBundleItems(bundle) {
301
694
  price_type: rawBundle.price_type ?? rawBundle.custom_price_type ?? "",
302
695
  price_type_ext: rawBundle.price_type_ext ?? rawBundle.custom_price_type_ext ?? "",
303
696
  bundle_selling_price: sellingPrice,
697
+ bundle_payment_price: paymentPrice,
304
698
  option: formatSubmitOptionItems(rawBundle.option),
305
699
  bundle_group_id: (rawBundle == null ? void 0 : rawBundle.bundle_group_id) ?? (rawBundle == null ? void 0 : rawBundle.group_id),
306
700
  bundle_id: (rawBundle == null ? void 0 : rawBundle.bundle_id) ?? (rawBundle == null ? void 0 : rawBundle.id),
@@ -319,10 +713,15 @@ function normalizeSubmitProduct(product) {
319
713
  const { unique_identification_number: _runtimeUid, ...submitProduct } = product;
320
714
  const {
321
715
  num,
322
- product_option_item: productOptionItem,
323
716
  surcharge_fee: _productSurchargeFee,
717
+ discount_amount: _deprecatedDiscountAmount,
718
+ discount_type: _deprecatedDiscountType,
719
+ discountway: _deprecatedDiscountway,
720
+ product_discount_reason: _deprecatedProductDiscountReason,
721
+ discount_per: _deprecatedDiscountPer,
324
722
  ...productRest
325
723
  } = submitProduct;
724
+ delete productRest[`product_${"option"}_item`];
326
725
  const rawMetadata = submitProduct.metadata || {};
327
726
  const bookingUid = rawMetadata.booking_uid;
328
727
  const cleanMetadata = {};
@@ -332,6 +731,9 @@ function normalizeSubmitProduct(product) {
332
731
  const priceMetaKeys = [
333
732
  "main_product_original_price",
334
733
  "main_product_selling_price",
734
+ "main_product_attached_bundle_selling_price",
735
+ "main_product_attached_bundle_payment_price",
736
+ "average_discount_amount_rate",
335
737
  "source_product_price",
336
738
  "main_product_attached_bundle_surcharge_fee",
337
739
  "main_product_attached_bundle_tax_fee",
@@ -356,21 +758,19 @@ function normalizeSubmitProduct(product) {
356
758
  }
357
759
  const productSku = {
358
760
  ...submitProduct.product_sku && typeof submitProduct.product_sku === "object" ? submitProduct.product_sku : {},
359
- option: formatSubmitOptionItems(
360
- (productOptionItem == null ? void 0 : productOptionItem.length) ? productOptionItem : (_a = submitProduct.product_sku) == null ? void 0 : _a.option
361
- )
761
+ option: formatSubmitOptionItems((_a = submitProduct.product_sku) == null ? void 0 : _a.option)
362
762
  };
363
763
  return {
364
764
  ...productRest,
365
765
  ...bookingUid ? { booking_uid: bookingUid } : {},
366
766
  product_quantity: toBundleNumber(num ?? submitProduct.product_quantity, 1),
367
767
  product_sku: productSku,
368
- discount_list: submitProduct.discount_list || [],
768
+ discount_list: normalizeOrderProductDiscountList(submitProduct.discount_list),
369
769
  product_bundle: formatSubmitBundleItems(submitProduct.product_bundle),
370
770
  metadata: cleanMetadata,
371
- // 出站兼容:后端消费 payment_price 字段,这里从 selling_price 直接派生。
372
- // 新语义下 selling_price 是 composite(含 option/bundle),payment_price 同语义。
373
- payment_price: submitProduct.selling_price
771
+ // 出站兼容:后端消费 payment_price 字段(行 composite 已减整单折扣均摊)。
772
+ // 由整单折扣均摊层产出;缺省(无折扣)时与 selling_price 同义。
773
+ payment_price: submitProduct.payment_price ?? submitProduct.selling_price
374
774
  };
375
775
  }
376
776
  var SUBMIT_BOOKING_METADATA_WHITELIST = [
@@ -378,7 +778,8 @@ var SUBMIT_BOOKING_METADATA_WHITELIST = [
378
778
  "collect_pax",
379
779
  "capacity",
380
780
  "holder_id",
381
- "resource_select_type"
781
+ "resource_select_type",
782
+ "holder"
382
783
  ];
383
784
  function normalizeBookingIsAll(booking) {
384
785
  return booking.is_all === true || booking.is_all === 1 || booking.is_all === "1" || booking.is_all === "true" ? 1 : 0;
@@ -425,22 +826,23 @@ function createDefaultTempOrder(params) {
425
826
  return {
426
827
  order_id: null,
427
828
  external_sale_number: "",
428
- order_number: "",
429
- shop_order_number: "",
430
- shop_full_order_number: "",
431
- type: "appointment_booking",
432
- business_code: "appointment_booking",
829
+ order_number: null,
830
+ shop_order_number: null,
831
+ shop_full_order_number: null,
832
+ type: "",
833
+ business_code: void 0,
433
834
  platform: "h5",
434
835
  sales_channel: "my_pisel",
435
836
  order_sales_channel: "online_store",
436
837
  status: "normal",
437
838
  payment_status: "payment_processing",
438
839
  shipping_status: "unfulfilled",
439
- customer_id: null,
840
+ customer_id: 0,
440
841
  customer_name: "",
441
842
  country_calling_code: "",
442
843
  phone: "",
443
844
  email: "",
845
+ customer: null,
444
846
  is_price_include_tax: 1,
445
847
  tax_title: "",
446
848
  tax_country_code: "",
@@ -453,14 +855,13 @@ function createDefaultTempOrder(params) {
453
855
  surcharge_fee: "0.00",
454
856
  note: "",
455
857
  schedule_date: params.now,
456
- created_at: params.now,
858
+ created_at: void 0,
457
859
  request_unique_idempotency_token: "",
458
860
  vouchers: [],
459
861
  products: [],
460
862
  bookings: [],
461
863
  payments: [],
462
864
  surcharges: [],
463
- discount_list: [],
464
865
  relation_forms: [],
465
866
  contacts: [],
466
867
  contacts_info: null,
@@ -472,6 +873,7 @@ function createDefaultTempOrder(params) {
472
873
  };
473
874
  }
474
875
  function buildSubmitPayload(params) {
876
+ var _a;
475
877
  const {
476
878
  tempOrder,
477
879
  cacheId,
@@ -480,6 +882,7 @@ function buildSubmitPayload(params) {
480
882
  businessCode,
481
883
  channel,
482
884
  type,
885
+ summary,
483
886
  enhance
484
887
  } = params;
485
888
  const scheduleDate = tempOrder.schedule_date || tempOrder.created_at || formatDateTime(now);
@@ -497,7 +900,7 @@ function buildSubmitPayload(params) {
497
900
  shop_service_type: _shopServiceType,
498
901
  start_time: _startTime,
499
902
  customer: _customer,
500
- shop_full_order_number: _shopFullOrderNumber,
903
+ discount_list: _discountList,
501
904
  tax_fee: _rootTaxFee,
502
905
  total_amount: _totalAmount,
503
906
  total_refund_amount: _totalRefundAmount,
@@ -505,12 +908,25 @@ function buildSubmitPayload(params) {
505
908
  holder_id: _holderId,
506
909
  ...tempOrderRest
507
910
  } = tempOrder;
911
+ let submitType = type ?? tempOrder.type;
912
+ if (!submitType) {
913
+ if ((_a = tempOrder == null ? void 0 : tempOrder.bookings) == null ? void 0 : _a.length) {
914
+ submitType = "appointment_booking";
915
+ } else {
916
+ submitType = "virtual";
917
+ }
918
+ }
508
919
  const payload = {
509
920
  ...tempOrderRest,
921
+ customer_id: tempOrder.customer_id ?? 1,
922
+ customer_name: tempOrder.customer_name || "Walk-In",
923
+ order_number: tempOrder.order_number ?? null,
924
+ shop_order_number: tempOrder.shop_order_number ?? null,
925
+ shop_full_order_number: tempOrder.shop_full_order_number ?? null,
510
926
  platform: normalizeSubmitPlatform(platform),
511
- request_unique_idempotency_token: tempOrder.request_unique_idempotency_token || `${tempOrder.external_sale_number}_${now.getTime()}`,
512
- type: type ?? tempOrder.type ?? "table-order",
513
- business_code: businessCode ?? tempOrder.business_code ?? "table-order",
927
+ request_unique_idempotency_token: (params == null ? void 0 : params.request_unique_idempotency_token) || tempOrder.request_unique_idempotency_token || `${tempOrder.external_sale_number}_${now.getTime()}`,
928
+ type: submitType,
929
+ business_code: businessCode ?? tempOrder.business_code,
514
930
  sales_channel: tempOrder.sales_channel || "my_pisel",
515
931
  order_sales_channel: channel ?? tempOrder.order_sales_channel ?? "online_store",
516
932
  status: tempOrder.status || "normal",
@@ -525,17 +941,16 @@ function buildSubmitPayload(params) {
525
941
  note: tempOrder.note || "",
526
942
  delivery_type: tempOrder.delivery_type || "nil",
527
943
  schedule_date: scheduleDate,
528
- created_at: tempOrder.created_at || formatDateTime(now),
944
+ // created_at: tempOrder.created_at || formatDateTime(now), 和后端协定这个字段先不提交到接口
529
945
  bookings: (tempOrder.bookings || []).filter(
530
- (booking) => Number(booking.parent_id ?? 0) !== 0
946
+ (booking) => Number(booking.parent_id) !== 0
531
947
  ).map((booking) => normalizeSubmitBooking(booking)),
532
948
  payments: tempOrder.payments || [],
533
- // discount_list: tempOrder.discount_list || [],
534
949
  relation_forms: tempOrder.relation_forms || [],
535
950
  // contacts: tempOrder.contacts || [],
536
951
  contacts_info: tempOrder.contacts_info && !Array.isArray(tempOrder.contacts_info) ? tempOrder.contacts_info : null,
537
952
  // holder: tempOrder.holder || null,
538
- // summary,
953
+ summary: summary || tempOrder.summary || (0, import_utils.createEmptySummary)(),
539
954
  metadata: (() => {
540
955
  const {
541
956
  collect_pax: _collectPax,
@@ -548,7 +963,13 @@ function buildSubmitPayload(params) {
548
963
  (product) => normalizeSubmitProduct(product)
549
964
  )
550
965
  };
551
- return enhance ? enhance(payload, { tempOrder, bookingUuid, now }) : payload;
966
+ if (!enhance)
967
+ return payload;
968
+ const enhancedPayload = enhance(payload, { tempOrder, bookingUuid, now });
969
+ return {
970
+ ...enhancedPayload,
971
+ summary: enhancedPayload.summary ?? payload.summary
972
+ };
552
973
  }
553
974
  function mapPaymentItemToOrderPayment(paymentItem) {
554
975
  const item = paymentItem;
@@ -568,24 +989,30 @@ function mapPaymentItemToOrderPayment(paymentItem) {
568
989
  metadata[key] = item[key];
569
990
  }
570
991
  }
992
+ const timestamp = (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss");
993
+ const paymentTime = item.payment_time ?? timestamp;
994
+ const createdAt = item.created_at ?? timestamp;
571
995
  return {
996
+ ...item.order_payment_id !== void 0 ? { order_payment_id: item.order_payment_id } : {},
572
997
  amount: String(item.amount ?? "0.00"),
573
998
  code: String(item.code || ""),
574
999
  custom_payment_id: Number(customPaymentId ?? 0),
1000
+ ...item.custom_payment_type !== void 0 ? { custom_payment_type: String(item.custom_payment_type) } : {},
575
1001
  name: String(item.name || ""),
576
1002
  type: String(item.type || ""),
577
1003
  ...item.voucher_id !== void 0 ? { voucher_id: item.voucher_id } : {},
578
1004
  ...item.origin_amount !== void 0 ? { origin_amount: String(item.origin_amount) } : {},
579
1005
  ...item.service_fee !== void 0 ? { service_fee: String(item.service_fee) } : {},
580
1006
  ...item.status !== void 0 ? { status: item.status } : {},
581
- ...item.payment_time !== void 0 ? { payment_time: item.payment_time } : {},
1007
+ payment_time: paymentTime,
1008
+ created_at: createdAt,
582
1009
  ...item.wallet_pass_usage_unit !== void 0 ? { wallet_pass_usage_unit: item.wallet_pass_usage_unit } : {},
583
1010
  ...item.wallet_pass_use_value !== void 0 ? { wallet_pass_use_value: item.wallet_pass_use_value } : {},
1011
+ ...item.fund_record && typeof item.fund_record === "object" && !Array.isArray(item.fund_record) ? { fund_record: { ...item.fund_record } } : {},
584
1012
  metadata,
585
1013
  ...item.rounding_amount !== void 0 ? { rounding_amount: String(item.rounding_amount) } : {},
586
1014
  ...item.service_charge !== void 0 ? { service_charge: item.service_charge } : {},
587
1015
  ...item.order_payment_type !== void 0 ? { order_payment_type: item.order_payment_type } : {},
588
- ...item.created_at !== void 0 ? { created_at: item.created_at } : {},
589
1016
  ...item.updated_at !== void 0 ? { updated_at: item.updated_at } : {}
590
1017
  };
591
1018
  }
@@ -611,26 +1038,168 @@ function formatV1Product(products) {
611
1038
  };
612
1039
  });
613
1040
  }
1041
+ function hasAssignedHolderId(value) {
1042
+ if (value === void 0 || value === null || value === "")
1043
+ return false;
1044
+ if (Array.isArray(value))
1045
+ return value.length > 0;
1046
+ return true;
1047
+ }
1048
+ function clearTempOrderHolderAssignments(tempOrder) {
1049
+ var _a;
1050
+ let changed = false;
1051
+ const resetHolderField = (target, key = "holder_id") => {
1052
+ if (!hasAssignedHolderId(target[key]))
1053
+ return;
1054
+ target[key] = null;
1055
+ changed = true;
1056
+ };
1057
+ for (const product of tempOrder.products || []) {
1058
+ if (product.metadata && typeof product.metadata === "object") {
1059
+ resetHolderField(product.metadata);
1060
+ }
1061
+ }
1062
+ for (const booking of tempOrder.bookings || []) {
1063
+ const bookingRecord = booking;
1064
+ if (booking.metadata && typeof booking.metadata === "object") {
1065
+ resetHolderField(booking.metadata);
1066
+ }
1067
+ if (bookingRecord.holder !== void 0 && bookingRecord.holder !== null) {
1068
+ delete bookingRecord.holder;
1069
+ changed = true;
1070
+ }
1071
+ }
1072
+ const productsByUid = (_a = tempOrder._extend) == null ? void 0 : _a.productsByUid;
1073
+ if (productsByUid && typeof productsByUid === "object") {
1074
+ for (const entry of Object.values(productsByUid)) {
1075
+ const origin = entry == null ? void 0 : entry.origin;
1076
+ if (!origin || typeof origin !== "object")
1077
+ continue;
1078
+ if (origin.metadata && typeof origin.metadata === "object") {
1079
+ resetHolderField(origin.metadata);
1080
+ }
1081
+ if (origin._extend && typeof origin._extend === "object") {
1082
+ resetHolderField(origin._extend);
1083
+ }
1084
+ }
1085
+ }
1086
+ return changed;
1087
+ }
1088
+ function getOrderProductLineUid(product) {
1089
+ var _a;
1090
+ if (!product || typeof product !== "object")
1091
+ return null;
1092
+ const uid = ((_a = product.metadata) == null ? void 0 : _a.unique_identification_number) ?? product.unique_identification_number;
1093
+ if (uid === void 0 || uid === null || uid === "")
1094
+ return null;
1095
+ return String(uid);
1096
+ }
1097
+ function isEmptyOrderProductDisplayValue(value) {
1098
+ if (value === void 0 || value === null)
1099
+ return true;
1100
+ if (typeof value === "string")
1101
+ return value.trim() === "";
1102
+ if (typeof value === "object") {
1103
+ const record = value;
1104
+ return !Object.values(record).some(
1105
+ (item) => typeof item === "string" && item.trim() !== ""
1106
+ );
1107
+ }
1108
+ return false;
1109
+ }
1110
+ function mergeOrderProductDisplayFields(previous, next) {
1111
+ const merged = { ...next };
1112
+ const displayFields = [
1113
+ "product_title",
1114
+ "product_name",
1115
+ "product_cover",
1116
+ "cover",
1117
+ "variant_title",
1118
+ "product_sku",
1119
+ "payment_price"
1120
+ ];
1121
+ displayFields.forEach((field) => {
1122
+ if (isEmptyOrderProductDisplayValue(merged[field]) && !isEmptyOrderProductDisplayValue(previous[field])) {
1123
+ merged[field] = previous[field];
1124
+ }
1125
+ });
1126
+ if (previous.metadata || next.metadata) {
1127
+ merged.metadata = {
1128
+ ...previous.metadata || {},
1129
+ ...next.metadata || {}
1130
+ };
1131
+ ["product_title", "product_name"].forEach((field) => {
1132
+ var _a;
1133
+ if (isEmptyOrderProductDisplayValue(merged.metadata[field]) && !isEmptyOrderProductDisplayValue((_a = previous.metadata) == null ? void 0 : _a[field])) {
1134
+ merged.metadata[field] = previous.metadata[field];
1135
+ }
1136
+ });
1137
+ }
1138
+ if (previous._extend && !merged._extend) {
1139
+ merged._extend = previous._extend;
1140
+ }
1141
+ return merged;
1142
+ }
1143
+ function indexOrderProductsByUid(products) {
1144
+ const map = /* @__PURE__ */ new Map();
1145
+ (products || []).forEach((product, index) => {
1146
+ const uid = getOrderProductLineUid(product);
1147
+ if (uid) {
1148
+ map.set(uid, product);
1149
+ return;
1150
+ }
1151
+ map.set(`__index__:${index}`, product);
1152
+ });
1153
+ return map;
1154
+ }
614
1155
  // Annotate the CommonJS export names for ESM import in node:
615
1156
  0 && (module.exports = {
1157
+ buildManualProductDiscountItem,
616
1158
  buildSubmitPayload,
1159
+ calculateOrderProductsDeposit,
1160
+ clearTempOrderHolderAssignments,
617
1161
  composeLinePrice,
618
1162
  createDefaultOrderRulesHooks,
619
1163
  createDefaultTempOrder,
620
1164
  createEmptySummary,
621
1165
  createUuidV4,
1166
+ ensureManualProductDiscountList,
1167
+ ensureProductSku,
1168
+ findManualProductDiscountItem,
622
1169
  formatDateTime,
623
1170
  formatV1Product,
624
1171
  generateDuration,
625
1172
  getAllDiscountList,
1173
+ getBundleSellingMagnitude,
1174
+ getBundleSignedUnit,
1175
+ getOrderProductLineUid,
1176
+ getProductSkuOptions,
1177
+ hasAssignedHolderId,
1178
+ indexOrderProductsByUid,
1179
+ isEmptyOrderProductDisplayValue,
1180
+ isMarkdownBundle,
626
1181
  isTempOrder,
627
1182
  mapPaymentItemToOrderPayment,
628
1183
  mapPaymentItemsToOrderPayments,
1184
+ mergeManualProductDiscountIntoList,
1185
+ mergeOrderProductDisplayFields,
629
1186
  mergeRelationForms,
630
1187
  normalizeBookingIsAll,
631
1188
  normalizeBookingSubType,
1189
+ normalizeOrderProductDiscountList,
1190
+ normalizeProductSkuOptions,
632
1191
  normalizeSubmitBooking,
633
1192
  normalizeSubmitCollectPaxValue,
1193
+ resolveEffectivePerUnitDiscount,
1194
+ resolveManualDiscountMessage,
1195
+ resolveManualDiscountOriginTotal,
1196
+ resolveManualDiscountReasonFromSources,
1197
+ resolveManualOverrideLineOriginalPrice,
1198
+ resolveRulesManualDiscountFlag,
1199
+ resolveSafeProductNum,
634
1200
  resolveSubmitCollectPax,
635
- sumOptionUnitPrice
1201
+ shouldBuildManualProductDiscount,
1202
+ stripManualProductDiscountItems,
1203
+ sumOptionUnitPrice,
1204
+ syncManualProductDiscountProductNum
636
1205
  });