@pisell/pisellos 0.0.568 → 0.0.570

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 (455) hide show
  1. package/dist/effects/index.d.ts +2 -2
  2. package/dist/model/strategy/adapter/dataVariant/type.d.ts +3 -3
  3. package/dist/model/strategy/adapter/itemRule/type.d.ts +6 -6
  4. package/dist/model/strategy/adapter/promotion/evaluator.js +3 -2
  5. package/dist/model/strategy/adapter/promotion/type.d.ts +5 -5
  6. package/dist/model/strategy/adapter/walletPass/utils.js +7 -4
  7. package/dist/model/strategy/type.d.ts +1 -1
  8. package/dist/modules/BaseModule.d.ts +2 -2
  9. package/dist/modules/BaseModule.js +4 -4
  10. package/dist/modules/BookingContext/index.d.ts +48 -0
  11. package/dist/modules/BookingContext/index.js +566 -0
  12. package/dist/modules/BookingContext/types.d.ts +102 -0
  13. package/dist/modules/BookingContext/types.js +51 -0
  14. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  15. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +302 -0
  16. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  17. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +149 -0
  18. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
  19. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +249 -0
  20. package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
  21. package/dist/modules/BookingContext/utils/flexible.js +56 -0
  22. package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  23. package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
  24. package/dist/modules/BookingContext/utils/index.d.ts +11 -0
  25. package/dist/modules/BookingContext/utils/index.js +11 -0
  26. package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
  27. package/dist/modules/BookingContext/utils/noResource.js +77 -0
  28. package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
  29. package/dist/modules/BookingContext/utils/orderLineDisplay.js +36 -0
  30. package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
  31. package/dist/modules/BookingContext/utils/productExtend.js +339 -0
  32. package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  33. package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
  34. package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  35. package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
  36. package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
  37. package/dist/modules/BookingContext/utils/resources.js +486 -0
  38. package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  39. package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
  40. package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  41. package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
  42. package/dist/modules/Cart/utils/cartProduct.js +26 -5
  43. package/dist/modules/Cart/utils/changePrice.js +27 -20
  44. package/dist/modules/Customer/index.d.ts +20 -0
  45. package/dist/modules/Customer/index.js +172 -83
  46. package/dist/modules/Customer/types.d.ts +3 -1
  47. package/dist/modules/Discount/index.d.ts +2 -1
  48. package/dist/modules/Discount/index.js +37 -9
  49. package/dist/modules/Discount/types.d.ts +2 -1
  50. package/dist/modules/Holder/types.d.ts +1 -1
  51. package/dist/modules/OpenData/index.d.ts +8 -0
  52. package/dist/modules/OpenData/index.js +36 -16
  53. package/dist/modules/OpenData/types.d.ts +1 -1
  54. package/dist/modules/Order/index.d.ts +448 -23
  55. package/dist/modules/Order/index.js +5417 -561
  56. package/dist/modules/Order/types.d.ts +693 -88
  57. package/dist/modules/Order/types.js +68 -1
  58. package/dist/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
  59. package/dist/modules/Order/utils/bundleDiscountHydration.js +144 -0
  60. package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
  61. package/dist/modules/Order/utils/manualProductDiscount.js +210 -0
  62. package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
  63. package/dist/modules/Order/utils/orderCollectionIdentity.js +405 -0
  64. package/dist/modules/Order/utils.d.ts +167 -18
  65. package/dist/modules/Order/utils.js +960 -165
  66. package/dist/modules/Payment/index.d.ts +10 -9
  67. package/dist/modules/Payment/index.js +465 -703
  68. package/dist/modules/Payment/types.d.ts +47 -23
  69. package/dist/modules/Payment/utils.d.ts +1 -1
  70. package/dist/modules/Payment/utils.js +4 -3
  71. package/dist/modules/Payment/walletpass.js +44 -29
  72. package/dist/modules/Product/index.d.ts +1 -1
  73. package/dist/modules/Product/types.d.ts +29 -7
  74. package/dist/modules/ProductList/index.d.ts +17 -13
  75. package/dist/modules/ProductList/index.js +184 -74
  76. package/dist/modules/ProductList/types.d.ts +17 -0
  77. package/dist/modules/Quotation/index.d.ts +22 -2
  78. package/dist/modules/Quotation/index.js +108 -42
  79. package/dist/modules/Quotation/types.d.ts +19 -0
  80. package/dist/modules/ResourcePlanner/index.d.ts +24 -0
  81. package/dist/modules/ResourcePlanner/index.js +181 -0
  82. package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
  83. package/dist/modules/ResourcePlanner/planner.js +1069 -0
  84. package/dist/modules/ResourcePlanner/types.d.ts +227 -0
  85. package/dist/modules/ResourcePlanner/types.js +1 -0
  86. package/dist/modules/Rules/index.d.ts +8 -10
  87. package/dist/modules/Rules/index.js +222 -109
  88. package/dist/modules/Rules/types.d.ts +15 -4
  89. package/dist/modules/SalesSummary/index.d.ts +23 -26
  90. package/dist/modules/SalesSummary/index.js +152 -46
  91. package/dist/modules/SalesSummary/types.d.ts +9 -1
  92. package/dist/modules/SalesSummary/utils.d.ts +3 -22
  93. package/dist/modules/SalesSummary/utils.js +803 -163
  94. package/dist/modules/ScanOrderLogger/types.d.ts +2 -2
  95. package/dist/modules/Schedule/getDateIsInSchedule.d.ts +1 -1
  96. package/dist/modules/Schedule/getDateIsInSchedule.js +14 -7
  97. package/dist/modules/Schedule/index.d.ts +18 -5
  98. package/dist/modules/Schedule/index.js +78 -24
  99. package/dist/modules/Schedule/type.d.ts +7 -7
  100. package/dist/modules/Schedule/types.d.ts +11 -9
  101. package/dist/modules/Summary/index.js +4 -3
  102. package/dist/modules/SurchargeList/index.d.ts +18 -0
  103. package/dist/modules/SurchargeList/index.js +185 -0
  104. package/dist/modules/SurchargeList/types.d.ts +15 -0
  105. package/dist/modules/SurchargeList/types.js +1 -0
  106. package/dist/modules/index.d.ts +3 -0
  107. package/dist/modules/index.js +4 -1
  108. package/dist/plugins/app.d.ts +2 -0
  109. package/dist/plugins/request.d.ts +3 -2
  110. package/dist/server/index.d.ts +462 -8
  111. package/dist/server/index.js +6112 -656
  112. package/dist/server/modules/floor-plan/index.d.ts +39 -0
  113. package/dist/server/modules/floor-plan/index.js +595 -0
  114. package/dist/server/modules/floor-plan/types.d.ts +43 -0
  115. package/dist/server/modules/floor-plan/types.js +13 -0
  116. package/dist/server/modules/index.d.ts +7 -2
  117. package/dist/server/modules/index.js +6 -0
  118. package/dist/server/modules/menu/types.d.ts +1 -1
  119. package/dist/server/modules/order/index.d.ts +207 -14
  120. package/dist/server/modules/order/index.js +2326 -379
  121. package/dist/server/modules/order/types.d.ts +91 -20
  122. package/dist/server/modules/order/types.js +14 -1
  123. package/dist/server/modules/order/utils/filterBookings.d.ts +7 -1
  124. package/dist/server/modules/order/utils/filterBookings.js +118 -11
  125. package/dist/server/modules/order/utils/filterOrders.js +242 -14
  126. package/dist/server/modules/payment/index.d.ts +28 -0
  127. package/dist/server/modules/payment/index.js +305 -0
  128. package/dist/server/modules/payment/types.d.ts +9 -0
  129. package/dist/server/modules/payment/types.js +1 -0
  130. package/dist/server/modules/products/index.d.ts +105 -14
  131. package/dist/server/modules/products/index.js +1393 -516
  132. package/dist/server/modules/products/types.d.ts +35 -2
  133. package/dist/server/modules/products/types.js +4 -0
  134. package/dist/server/modules/quotation/index.d.ts +39 -0
  135. package/dist/server/modules/quotation/index.js +278 -66
  136. package/dist/server/modules/resource/index.d.ts +2 -3
  137. package/dist/server/modules/resource/index.js +108 -86
  138. package/dist/server/modules/resource/types.d.ts +1 -1
  139. package/dist/server/modules/schedule/index.d.ts +6 -4
  140. package/dist/server/modules/schedule/index.js +116 -85
  141. package/dist/server/modules/schedule/utils.d.ts +1 -1
  142. package/dist/server/test.json +713 -0
  143. package/dist/server/types.d.ts +6 -4
  144. package/dist/server/utils/product.js +2 -2
  145. package/dist/server/utils/small-ticket.d.ts +71 -0
  146. package/dist/server/utils/small-ticket.js +963 -0
  147. package/dist/solution/BaseSales/index.d.ts +378 -0
  148. package/dist/solution/BaseSales/index.js +4006 -0
  149. package/dist/solution/BaseSales/types.d.ts +394 -0
  150. package/dist/solution/BaseSales/types.js +40 -0
  151. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
  152. package/dist/solution/BaseSales/utils/cartPromotion.js +1450 -0
  153. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +144 -0
  154. package/dist/solution/BaseSales/utils/parseSalesResponse.js +157 -0
  155. package/dist/solution/BaseSales/utils/quotationPrice.d.ts +18 -0
  156. package/dist/solution/BaseSales/utils/quotationPrice.js +250 -0
  157. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +63 -0
  158. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +218 -0
  159. package/dist/solution/BaseSales/utils.d.ts +40 -0
  160. package/dist/solution/BaseSales/utils.js +263 -0
  161. package/dist/solution/BookingByStep/index.d.ts +2 -2
  162. package/dist/solution/BookingByStep/utils/resources.d.ts +1 -1
  163. package/dist/solution/BookingTicket/index.d.ts +382 -25
  164. package/dist/solution/BookingTicket/index.js +2506 -443
  165. package/dist/solution/BookingTicket/types.d.ts +191 -6
  166. package/dist/solution/BookingTicket/types.js +83 -10
  167. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
  168. package/dist/solution/BookingTicket/utils/addProductDecision.js +346 -0
  169. package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
  170. package/dist/solution/BookingTicket/utils/addTimeAvailability.js +95 -0
  171. package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
  172. package/dist/solution/BookingTicket/utils/bookingStatus.js +136 -0
  173. package/dist/solution/BookingTicket/utils/cartView.d.ts +29 -0
  174. package/dist/solution/BookingTicket/utils/cartView.js +209 -0
  175. package/dist/solution/BookingTicket/utils/exampleData.d.ts +123 -0
  176. package/dist/solution/BookingTicket/utils/exampleData.js +183 -0
  177. package/dist/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
  178. package/dist/solution/BookingTicket/utils/orderCustomer.js +31 -0
  179. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
  180. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +438 -0
  181. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
  182. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +400 -0
  183. package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +4 -0
  184. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +41 -1
  185. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
  186. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +56 -0
  187. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
  188. package/dist/solution/BookingTicket/utils/scan/handleScan.js +11 -3
  189. package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
  190. package/dist/solution/BookingTicket/utils/scan/index.js +20 -8
  191. package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
  192. package/dist/solution/BookingTicket/utils/scan/scanProductValues.js +150 -0
  193. package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
  194. package/dist/solution/BookingTicket/utils/sessionCatalogStale.js +78 -0
  195. package/dist/solution/Checkout/index.d.ts +1 -0
  196. package/dist/solution/Checkout/index.js +25 -34
  197. package/dist/solution/Checkout/utils/index.js +4 -4
  198. package/dist/solution/RegisterAndLogin/config.js +2 -10
  199. package/dist/solution/Sales/index.d.ts +50 -5
  200. package/dist/solution/Sales/index.js +484 -92
  201. package/dist/solution/Sales/types.d.ts +29 -5
  202. package/dist/solution/ScanOrder/index.d.ts +27 -21
  203. package/dist/solution/ScanOrder/index.js +499 -434
  204. package/dist/solution/ScanOrder/types.d.ts +38 -16
  205. package/dist/solution/ScanOrder/types.js +4 -5
  206. package/dist/solution/ScanOrder/utils.d.ts +4 -1
  207. package/dist/solution/ScanOrder/utils.js +109 -34
  208. package/dist/solution/ShopDiscount/index.js +4 -4
  209. package/dist/solution/ShopDiscount/types.d.ts +1 -1
  210. package/dist/solution/ShopDiscount/utils.d.ts +2 -2
  211. package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
  212. package/dist/solution/UnifiedBookingSales/index.js +1871 -0
  213. package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
  214. package/dist/solution/UnifiedBookingSales/types.js +11 -0
  215. package/dist/solution/VenueBooking/index.d.ts +29 -20
  216. package/dist/solution/VenueBooking/index.js +301 -213
  217. package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -2
  218. package/dist/solution/VenueBooking/types.d.ts +1 -1
  219. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
  220. package/dist/solution/VenueBooking/utils/slotMerge.js +9 -3
  221. package/dist/solution/index.d.ts +2 -0
  222. package/dist/solution/index.js +3 -1
  223. package/dist/types/index.d.ts +12 -2
  224. package/dist/utils/task.d.ts +2 -2
  225. package/dist/utils/watch.d.ts +2 -2
  226. package/lib/effects/index.d.ts +2 -2
  227. package/lib/model/strategy/adapter/dataVariant/type.d.ts +3 -3
  228. package/lib/model/strategy/adapter/itemRule/type.d.ts +6 -6
  229. package/lib/model/strategy/adapter/promotion/evaluator.js +3 -2
  230. package/lib/model/strategy/adapter/promotion/type.d.ts +5 -5
  231. package/lib/model/strategy/adapter/walletPass/utils.js +6 -4
  232. package/lib/model/strategy/type.d.ts +1 -1
  233. package/lib/modules/BaseModule.d.ts +2 -2
  234. package/lib/modules/BaseModule.js +4 -4
  235. package/lib/modules/BookingContext/index.d.ts +48 -0
  236. package/lib/modules/BookingContext/index.js +390 -0
  237. package/lib/modules/BookingContext/types.d.ts +102 -0
  238. package/lib/modules/BookingContext/types.js +48 -0
  239. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  240. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +286 -0
  241. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  242. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +148 -0
  243. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
  244. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +242 -0
  245. package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
  246. package/lib/modules/BookingContext/utils/flexible.js +63 -0
  247. package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  248. package/lib/modules/BookingContext/utils/formatResourceList.js +35 -0
  249. package/lib/modules/BookingContext/utils/index.d.ts +11 -0
  250. package/lib/modules/BookingContext/utils/index.js +126 -0
  251. package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
  252. package/lib/modules/BookingContext/utils/noResource.js +78 -0
  253. package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
  254. package/lib/modules/BookingContext/utils/orderLineDisplay.js +29 -0
  255. package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
  256. package/lib/modules/BookingContext/utils/productExtend.js +330 -0
  257. package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  258. package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
  259. package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  260. package/lib/modules/BookingContext/utils/resourceSelection.js +24 -0
  261. package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
  262. package/lib/modules/BookingContext/utils/resources.js +419 -0
  263. package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  264. package/lib/modules/BookingContext/utils/serviceTimes.js +161 -0
  265. package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  266. package/lib/modules/BookingContext/utils/timeSlices.js +114 -0
  267. package/lib/modules/Cart/utils/cartProduct.js +27 -5
  268. package/lib/modules/Cart/utils/changePrice.js +20 -14
  269. package/lib/modules/Customer/index.d.ts +20 -0
  270. package/lib/modules/Customer/index.js +63 -10
  271. package/lib/modules/Customer/types.d.ts +3 -1
  272. package/lib/modules/Discount/index.d.ts +2 -1
  273. package/lib/modules/Discount/index.js +18 -2
  274. package/lib/modules/Discount/types.d.ts +2 -1
  275. package/lib/modules/Holder/types.d.ts +1 -1
  276. package/lib/modules/OpenData/index.d.ts +8 -0
  277. package/lib/modules/OpenData/index.js +21 -3
  278. package/lib/modules/OpenData/types.d.ts +1 -1
  279. package/lib/modules/Order/index.d.ts +448 -23
  280. package/lib/modules/Order/index.js +3641 -308
  281. package/lib/modules/Order/types.d.ts +693 -88
  282. package/lib/modules/Order/types.js +55 -1
  283. package/lib/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
  284. package/lib/modules/Order/utils/bundleDiscountHydration.js +106 -0
  285. package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
  286. package/lib/modules/Order/utils/manualProductDiscount.js +207 -0
  287. package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
  288. package/lib/modules/Order/utils/orderCollectionIdentity.js +353 -0
  289. package/lib/modules/Order/utils.d.ts +167 -18
  290. package/lib/modules/Order/utils.js +974 -138
  291. package/lib/modules/Payment/index.d.ts +10 -9
  292. package/lib/modules/Payment/index.js +30 -124
  293. package/lib/modules/Payment/types.d.ts +47 -23
  294. package/lib/modules/Payment/utils.d.ts +1 -1
  295. package/lib/modules/Payment/utils.js +4 -3
  296. package/lib/modules/Payment/walletpass.js +16 -6
  297. package/lib/modules/Product/index.d.ts +1 -1
  298. package/lib/modules/Product/types.d.ts +29 -7
  299. package/lib/modules/ProductList/index.d.ts +17 -13
  300. package/lib/modules/ProductList/index.js +92 -51
  301. package/lib/modules/ProductList/types.d.ts +17 -0
  302. package/lib/modules/Quotation/index.d.ts +22 -2
  303. package/lib/modules/Quotation/index.js +76 -20
  304. package/lib/modules/Quotation/types.d.ts +19 -0
  305. package/lib/modules/ResourcePlanner/index.d.ts +24 -0
  306. package/lib/modules/ResourcePlanner/index.js +147 -0
  307. package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
  308. package/lib/modules/ResourcePlanner/planner.js +895 -0
  309. package/lib/modules/ResourcePlanner/types.d.ts +227 -0
  310. package/lib/modules/ResourcePlanner/types.js +5 -0
  311. package/lib/modules/Rules/index.d.ts +8 -10
  312. package/lib/modules/Rules/index.js +153 -61
  313. package/lib/modules/Rules/types.d.ts +15 -4
  314. package/lib/modules/SalesSummary/index.d.ts +23 -26
  315. package/lib/modules/SalesSummary/index.js +84 -16
  316. package/lib/modules/SalesSummary/types.d.ts +9 -1
  317. package/lib/modules/SalesSummary/utils.d.ts +3 -22
  318. package/lib/modules/SalesSummary/utils.js +616 -111
  319. package/lib/modules/ScanOrderLogger/types.d.ts +2 -2
  320. package/lib/modules/Schedule/getDateIsInSchedule.d.ts +1 -1
  321. package/lib/modules/Schedule/getDateIsInSchedule.js +14 -7
  322. package/lib/modules/Schedule/index.d.ts +18 -5
  323. package/lib/modules/Schedule/index.js +49 -14
  324. package/lib/modules/Schedule/type.d.ts +7 -7
  325. package/lib/modules/Schedule/types.d.ts +11 -9
  326. package/lib/modules/Summary/index.js +2 -2
  327. package/lib/modules/SurchargeList/index.d.ts +18 -0
  328. package/lib/modules/SurchargeList/index.js +95 -0
  329. package/lib/modules/SurchargeList/types.d.ts +15 -0
  330. package/lib/modules/SurchargeList/types.js +5 -0
  331. package/lib/modules/index.d.ts +3 -0
  332. package/lib/modules/index.js +33 -0
  333. package/lib/plugins/app.d.ts +2 -0
  334. package/lib/plugins/request.d.ts +3 -2
  335. package/lib/server/index.d.ts +462 -8
  336. package/lib/server/index.js +3901 -205
  337. package/lib/server/modules/floor-plan/index.d.ts +39 -0
  338. package/lib/server/modules/floor-plan/index.js +306 -0
  339. package/lib/server/modules/floor-plan/types.d.ts +43 -0
  340. package/lib/server/modules/floor-plan/types.js +19 -0
  341. package/lib/server/modules/index.d.ts +7 -2
  342. package/lib/server/modules/index.js +21 -0
  343. package/lib/server/modules/menu/types.d.ts +1 -1
  344. package/lib/server/modules/order/index.d.ts +207 -14
  345. package/lib/server/modules/order/index.js +1324 -141
  346. package/lib/server/modules/order/types.d.ts +91 -20
  347. package/lib/server/modules/order/types.js +11 -1
  348. package/lib/server/modules/order/utils/filterBookings.d.ts +7 -1
  349. package/lib/server/modules/order/utils/filterBookings.js +119 -11
  350. package/lib/server/modules/order/utils/filterOrders.js +238 -13
  351. package/lib/server/modules/payment/index.d.ts +28 -0
  352. package/lib/server/modules/payment/index.js +168 -0
  353. package/lib/server/modules/payment/types.d.ts +9 -0
  354. package/lib/server/modules/payment/types.js +5 -0
  355. package/lib/server/modules/products/index.d.ts +105 -14
  356. package/lib/server/modules/products/index.js +588 -97
  357. package/lib/server/modules/products/types.d.ts +35 -2
  358. package/lib/server/modules/products/types.js +3 -0
  359. package/lib/server/modules/quotation/index.d.ts +39 -0
  360. package/lib/server/modules/quotation/index.js +145 -1
  361. package/lib/server/modules/resource/index.d.ts +2 -3
  362. package/lib/server/modules/resource/index.js +71 -45
  363. package/lib/server/modules/resource/types.d.ts +1 -1
  364. package/lib/server/modules/schedule/index.d.ts +6 -4
  365. package/lib/server/modules/schedule/index.js +55 -44
  366. package/lib/server/modules/schedule/utils.d.ts +1 -1
  367. package/lib/server/test.json +713 -0
  368. package/lib/server/types.d.ts +6 -4
  369. package/lib/server/utils/product.js +2 -2
  370. package/lib/server/utils/small-ticket.d.ts +71 -0
  371. package/lib/server/utils/small-ticket.js +926 -0
  372. package/lib/solution/BaseSales/index.d.ts +378 -0
  373. package/lib/solution/BaseSales/index.js +2367 -0
  374. package/lib/solution/BaseSales/types.d.ts +394 -0
  375. package/lib/solution/BaseSales/types.js +47 -0
  376. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
  377. package/lib/solution/BaseSales/utils/cartPromotion.js +1155 -0
  378. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +144 -0
  379. package/lib/solution/BaseSales/utils/parseSalesResponse.js +140 -0
  380. package/lib/solution/BaseSales/utils/quotationPrice.d.ts +18 -0
  381. package/lib/solution/BaseSales/utils/quotationPrice.js +231 -0
  382. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +63 -0
  383. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +215 -0
  384. package/lib/solution/BaseSales/utils.d.ts +40 -0
  385. package/lib/solution/BaseSales/utils.js +259 -0
  386. package/lib/solution/BookingByStep/index.d.ts +2 -2
  387. package/lib/solution/BookingByStep/utils/resources.d.ts +1 -1
  388. package/lib/solution/BookingTicket/index.d.ts +382 -25
  389. package/lib/solution/BookingTicket/index.js +1350 -76
  390. package/lib/solution/BookingTicket/types.d.ts +191 -6
  391. package/lib/solution/BookingTicket/types.js +71 -10
  392. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
  393. package/lib/solution/BookingTicket/utils/addProductDecision.js +353 -0
  394. package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
  395. package/lib/solution/BookingTicket/utils/addTimeAvailability.js +94 -0
  396. package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
  397. package/lib/solution/BookingTicket/utils/bookingStatus.js +136 -0
  398. package/lib/solution/BookingTicket/utils/cartView.d.ts +29 -0
  399. package/lib/solution/BookingTicket/utils/cartView.js +200 -0
  400. package/lib/solution/BookingTicket/utils/exampleData.d.ts +123 -0
  401. package/lib/solution/BookingTicket/utils/exampleData.js +185 -0
  402. package/lib/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
  403. package/lib/solution/BookingTicket/utils/orderCustomer.js +35 -0
  404. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
  405. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +387 -0
  406. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
  407. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +220 -0
  408. package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +4 -0
  409. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +24 -3
  410. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
  411. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +64 -0
  412. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
  413. package/lib/solution/BookingTicket/utils/scan/handleScan.js +4 -2
  414. package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
  415. package/lib/solution/BookingTicket/utils/scan/index.js +14 -2
  416. package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
  417. package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +115 -0
  418. package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
  419. package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +83 -0
  420. package/lib/solution/Checkout/index.d.ts +1 -0
  421. package/lib/solution/Checkout/index.js +18 -19
  422. package/lib/solution/Checkout/utils/index.js +4 -4
  423. package/lib/solution/RegisterAndLogin/config.js +2 -10
  424. package/lib/solution/Sales/index.d.ts +50 -5
  425. package/lib/solution/Sales/index.js +296 -39
  426. package/lib/solution/Sales/types.d.ts +29 -5
  427. package/lib/solution/ScanOrder/index.d.ts +27 -21
  428. package/lib/solution/ScanOrder/index.js +144 -103
  429. package/lib/solution/ScanOrder/types.d.ts +38 -16
  430. package/lib/solution/ScanOrder/types.js +4 -5
  431. package/lib/solution/ScanOrder/utils.d.ts +4 -1
  432. package/lib/solution/ScanOrder/utils.js +98 -26
  433. package/lib/solution/ShopDiscount/index.js +3 -3
  434. package/lib/solution/ShopDiscount/types.d.ts +1 -1
  435. package/lib/solution/ShopDiscount/utils.d.ts +2 -2
  436. package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
  437. package/lib/solution/UnifiedBookingSales/index.js +1050 -0
  438. package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
  439. package/lib/solution/UnifiedBookingSales/types.js +14 -0
  440. package/lib/solution/VenueBooking/index.d.ts +29 -20
  441. package/lib/solution/VenueBooking/index.js +169 -94
  442. package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -2
  443. package/lib/solution/VenueBooking/types.d.ts +1 -1
  444. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
  445. package/lib/solution/VenueBooking/utils/slotMerge.js +9 -3
  446. package/lib/solution/index.d.ts +2 -0
  447. package/lib/solution/index.js +22 -0
  448. package/lib/types/index.d.ts +12 -2
  449. package/lib/utils/task.d.ts +2 -2
  450. package/lib/utils/watch.d.ts +2 -2
  451. package/package.json +18 -19
  452. package/dist/model/strategy/adapter/promotion/index.d.ts +0 -4
  453. package/dist/solution/Checkout/appointmentDemo.json +0 -1
  454. package/lib/model/strategy/adapter/promotion/index.d.ts +0 -4
  455. package/lib/solution/Checkout/appointmentDemo.json +0 -1
@@ -4,6 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.filterOrders = filterOrders;
7
+ var _dayjs = _interopRequireDefault(require("dayjs"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+ /** 从订单 payments 提取支付方式 code,与 UI 筛选选项及 filterBookings 一致 */
10
+ function getOrderPaymentCodes(order) {
11
+ const payments = order.payments;
12
+ if (!Array.isArray(payments) || payments.length === 0) {
13
+ return [];
14
+ }
15
+ return payments.map(item => item?.code).filter(code => typeof code === 'string' && code.length > 0);
16
+ }
17
+
7
18
  /**
8
19
  * 订单过滤函数
9
20
  * @param orders 原始订单列表
@@ -24,19 +35,45 @@ function filterOrders(orders, filters) {
24
35
  list: [],
25
36
  count: 0,
26
37
  size: 0,
27
- skip: 0
38
+ skip: 0,
39
+ rejected: []
28
40
  };
29
41
  }
30
42
 
31
43
  // 默认分页参数
32
44
  const size = safeFilters.num || 20;
33
45
  const page = safeFilters.skip || 1;
46
+ const rejected = [];
34
47
 
35
48
  // 1. 过滤
36
49
  let filteredList = orders.filter(order => {
50
+ if (safeFilters.keyword) {
51
+ if (!JSON.stringify(order).toLowerCase().includes(safeFilters.keyword.toLowerCase())) {
52
+ rejected.push({
53
+ order_id: order.order_id,
54
+ order_number: order.order_number,
55
+ reason: {
56
+ field: 'keyword',
57
+ actual: '',
58
+ expected: safeFilters.keyword
59
+ }
60
+ });
61
+ return false;
62
+ }
63
+ }
64
+
37
65
  // status - 订单状态
38
66
  if (safeFilters.status && safeFilters.status.length > 0) {
39
67
  if (!order.status || !safeFilters.status.includes(order.status)) {
68
+ rejected.push({
69
+ order_id: order.order_id,
70
+ order_number: order.order_number,
71
+ reason: {
72
+ field: 'status',
73
+ actual: order.status,
74
+ expected: safeFilters.status
75
+ }
76
+ });
40
77
  return false;
41
78
  }
42
79
  }
@@ -44,6 +81,15 @@ function filterOrders(orders, filters) {
44
81
  // payment_status - 支付状态
45
82
  if (safeFilters.payment_status && safeFilters.payment_status.length > 0) {
46
83
  if (!order.payment_status || !safeFilters.payment_status.includes(order.payment_status)) {
84
+ rejected.push({
85
+ order_id: order.order_id,
86
+ order_number: order.order_number,
87
+ reason: {
88
+ field: 'payment_status',
89
+ actual: order.payment_status,
90
+ expected: safeFilters.payment_status
91
+ }
92
+ });
47
93
  return false;
48
94
  }
49
95
  }
@@ -51,6 +97,15 @@ function filterOrders(orders, filters) {
51
97
  // shipping_status - 处理状态
52
98
  if (safeFilters.shipping_status && safeFilters.shipping_status.length > 0) {
53
99
  if (!order.shipping_status || !safeFilters.shipping_status.includes(order.shipping_status)) {
100
+ rejected.push({
101
+ order_id: order.order_id,
102
+ order_number: order.order_number,
103
+ reason: {
104
+ field: 'shipping_status',
105
+ actual: order.shipping_status,
106
+ expected: safeFilters.shipping_status
107
+ }
108
+ });
54
109
  return false;
55
110
  }
56
111
  }
@@ -58,6 +113,15 @@ function filterOrders(orders, filters) {
58
113
  // customer_id - 客户ID(精确匹配)
59
114
  if (safeFilters.customer_id !== undefined && safeFilters.customer_id !== null) {
60
115
  if (String(order.customer_id) !== String(safeFilters.customer_id)) {
116
+ rejected.push({
117
+ order_id: order.order_id,
118
+ order_number: order.order_number,
119
+ reason: {
120
+ field: 'customer_id',
121
+ actual: order.customer_id,
122
+ expected: safeFilters.customer_id
123
+ }
124
+ });
61
125
  return false;
62
126
  }
63
127
  }
@@ -65,17 +129,45 @@ function filterOrders(orders, filters) {
65
129
  // order_sales_channel - 销售渠道
66
130
  if (safeFilters.order_sales_channel && safeFilters.order_sales_channel.length > 0) {
67
131
  if (!order.order_sales_channel || !safeFilters.order_sales_channel.includes(order.order_sales_channel)) {
132
+ rejected.push({
133
+ order_id: order.order_id,
134
+ order_number: order.order_number,
135
+ reason: {
136
+ field: 'order_sales_channel',
137
+ actual: order.order_sales_channel,
138
+ expected: safeFilters.order_sales_channel
139
+ }
140
+ });
68
141
  return false;
69
142
  }
70
143
  }
71
144
 
72
- // payment_methods - 支付方式
145
+ // payment_methods - 支付方式(按 payments[].code 匹配,不再使用 order.payment_methods)
73
146
  if (safeFilters.payment_methods && safeFilters.payment_methods.length > 0) {
74
- if (!order.payment_methods || !Array.isArray(order.payment_methods) || order.payment_methods.length === 0) {
147
+ const orderPaymentCodes = getOrderPaymentCodes(order);
148
+ if (orderPaymentCodes.length === 0) {
149
+ rejected.push({
150
+ order_id: order.order_id,
151
+ order_number: order.order_number,
152
+ reason: {
153
+ field: 'payment_methods',
154
+ actual: order.payments,
155
+ expected: safeFilters.payment_methods
156
+ }
157
+ });
75
158
  return false;
76
159
  }
77
- const hasMatch = order.payment_methods.some(pm => safeFilters.payment_methods.includes(pm));
160
+ const hasMatch = orderPaymentCodes.some(code => safeFilters.payment_methods.includes(code));
78
161
  if (!hasMatch) {
162
+ rejected.push({
163
+ order_id: order.order_id,
164
+ order_number: order.order_number,
165
+ reason: {
166
+ field: 'payment_methods',
167
+ actual: orderPaymentCodes,
168
+ expected: safeFilters.payment_methods
169
+ }
170
+ });
79
171
  return false;
80
172
  }
81
173
  }
@@ -84,9 +176,27 @@ function filterOrders(orders, filters) {
84
176
  if (safeFilters.min_total_amount !== undefined || safeFilters.max_total_amount !== undefined) {
85
177
  const orderAmount = parseFloat(String(order.total_amount || 0));
86
178
  if (safeFilters.min_total_amount !== undefined && orderAmount < safeFilters.min_total_amount) {
179
+ rejected.push({
180
+ order_id: order.order_id,
181
+ order_number: order.order_number,
182
+ reason: {
183
+ field: 'min_total_amount',
184
+ actual: order.total_amount,
185
+ expected: safeFilters.min_total_amount
186
+ }
187
+ });
87
188
  return false;
88
189
  }
89
190
  if (safeFilters.max_total_amount !== undefined && orderAmount > safeFilters.max_total_amount) {
191
+ rejected.push({
192
+ order_id: order.order_id,
193
+ order_number: order.order_number,
194
+ reason: {
195
+ field: 'max_total_amount',
196
+ actual: order.total_amount,
197
+ expected: safeFilters.max_total_amount
198
+ }
199
+ });
90
200
  return false;
91
201
  }
92
202
  }
@@ -94,11 +204,29 @@ function filterOrders(orders, filters) {
94
204
  // tag_ids - 标签(统一 String 比较,兼容 number/string)
95
205
  if (safeFilters.tag_ids && safeFilters.tag_ids.length > 0) {
96
206
  if (!order.tag_ids || !Array.isArray(order.tag_ids) || order.tag_ids.length === 0) {
207
+ rejected.push({
208
+ order_id: order.order_id,
209
+ order_number: order.order_number,
210
+ reason: {
211
+ field: 'tag_ids',
212
+ actual: order.tag_ids,
213
+ expected: safeFilters.tag_ids
214
+ }
215
+ });
97
216
  return false;
98
217
  }
99
218
  const filterTagSet = new Set(safeFilters.tag_ids.map(String));
100
219
  const hasMatch = order.tag_ids.some(tag => filterTagSet.has(String(tag)));
101
220
  if (!hasMatch) {
221
+ rejected.push({
222
+ order_id: order.order_id,
223
+ order_number: order.order_number,
224
+ reason: {
225
+ field: 'tag_ids',
226
+ actual: order.tag_ids,
227
+ expected: safeFilters.tag_ids
228
+ }
229
+ });
102
230
  return false;
103
231
  }
104
232
  }
@@ -106,6 +234,15 @@ function filterOrders(orders, filters) {
106
234
  // shipping_type - 配送方式
107
235
  if (safeFilters.shipping_type && safeFilters.shipping_type.length > 0) {
108
236
  if (!order.shipping_type || !safeFilters.shipping_type.includes(order.shipping_type)) {
237
+ rejected.push({
238
+ order_id: order.order_id,
239
+ order_number: order.order_number,
240
+ reason: {
241
+ field: 'shipping_type',
242
+ actual: order.shipping_type,
243
+ expected: safeFilters.shipping_type
244
+ }
245
+ });
109
246
  return false;
110
247
  }
111
248
  }
@@ -113,6 +250,15 @@ function filterOrders(orders, filters) {
113
250
  // delivery_zone_name - 配送区域(模糊匹配)
114
251
  if (safeFilters.delivery_zone_name !== undefined && safeFilters.delivery_zone_name !== null && safeFilters.delivery_zone_name !== '') {
115
252
  if (!order.delivery_zone_name || !order.delivery_zone_name.toLowerCase().includes(safeFilters.delivery_zone_name.toLowerCase())) {
253
+ rejected.push({
254
+ order_id: order.order_id,
255
+ order_number: order.order_number,
256
+ reason: {
257
+ field: 'delivery_zone_name',
258
+ actual: order.delivery_zone_name,
259
+ expected: safeFilters.delivery_zone_name
260
+ }
261
+ });
116
262
  return false;
117
263
  }
118
264
  }
@@ -120,6 +266,15 @@ function filterOrders(orders, filters) {
120
266
  // location_id - 取货地点(精确匹配)
121
267
  if (safeFilters.location_id !== undefined && safeFilters.location_id !== null) {
122
268
  if (String(order.location_id) !== String(safeFilters.location_id)) {
269
+ rejected.push({
270
+ order_id: order.order_id,
271
+ order_number: order.order_number,
272
+ reason: {
273
+ field: 'location_id',
274
+ actual: order.location_id,
275
+ expected: safeFilters.location_id
276
+ }
277
+ });
123
278
  return false;
124
279
  }
125
280
  }
@@ -127,6 +282,15 @@ function filterOrders(orders, filters) {
127
282
  // shipping_order_number - 物流单号(模糊匹配)
128
283
  if (safeFilters.shipping_order_number !== undefined && safeFilters.shipping_order_number !== null && safeFilters.shipping_order_number !== '') {
129
284
  if (!order.shipping_order_number || !order.shipping_order_number.toLowerCase().includes(safeFilters.shipping_order_number.toLowerCase())) {
285
+ rejected.push({
286
+ order_id: order.order_id,
287
+ order_number: order.order_number,
288
+ reason: {
289
+ field: 'shipping_order_number',
290
+ actual: order.shipping_order_number,
291
+ expected: safeFilters.shipping_order_number
292
+ }
293
+ });
130
294
  return false;
131
295
  }
132
296
  }
@@ -134,11 +298,29 @@ function filterOrders(orders, filters) {
134
298
  // logistics_company_id - 物流公司
135
299
  if (safeFilters.logistics_company_id && safeFilters.logistics_company_id.length > 0) {
136
300
  if (!order.logistics_company_id) {
301
+ rejected.push({
302
+ order_id: order.order_id,
303
+ order_number: order.order_number,
304
+ reason: {
305
+ field: 'logistics_company_id',
306
+ actual: order.logistics_company_id,
307
+ expected: safeFilters.logistics_company_id
308
+ }
309
+ });
137
310
  return false;
138
311
  }
139
312
  const orderLogisticsId = String(order.logistics_company_id);
140
313
  const hasMatch = safeFilters.logistics_company_id.some(id => String(id) === orderLogisticsId);
141
314
  if (!hasMatch) {
315
+ rejected.push({
316
+ order_id: order.order_id,
317
+ order_number: order.order_number,
318
+ reason: {
319
+ field: 'logistics_company_id',
320
+ actual: order.logistics_company_id,
321
+ expected: safeFilters.logistics_company_id
322
+ }
323
+ });
142
324
  return false;
143
325
  }
144
326
  }
@@ -146,6 +328,15 @@ function filterOrders(orders, filters) {
146
328
  // zip - 邮编(模糊匹配)
147
329
  if (safeFilters.zip !== undefined && safeFilters.zip !== null && safeFilters.zip !== '') {
148
330
  if (!order.zip || !order.zip.toLowerCase().includes(safeFilters.zip.toLowerCase())) {
331
+ rejected.push({
332
+ order_id: order.order_id,
333
+ order_number: order.order_number,
334
+ reason: {
335
+ field: 'zip',
336
+ actual: order.zip,
337
+ expected: safeFilters.zip
338
+ }
339
+ });
149
340
  return false;
150
341
  }
151
342
  }
@@ -153,21 +344,54 @@ function filterOrders(orders, filters) {
153
344
  // business_code - 业务类型(精确匹配)
154
345
  if (safeFilters.business_code) {
155
346
  if (!order.business_code || order.business_code !== safeFilters.business_code) {
347
+ rejected.push({
348
+ order_id: order.order_id,
349
+ order_number: order.order_number,
350
+ reason: {
351
+ field: 'business_code',
352
+ actual: order.business_code,
353
+ expected: safeFilters.business_code
354
+ }
355
+ });
156
356
  return false;
157
357
  }
158
358
  }
159
359
 
160
360
  // start_time / end_time - 创建时间范围
161
361
  if (safeFilters.start_time || safeFilters.end_time) {
162
- const orderTime = order.created_at ? typeof order.created_at === 'number' ? order.created_at : new Date(String(order.created_at)).getTime() : 0;
163
- if (safeFilters.start_time) {
164
- const startTs = new Date(safeFilters.start_time).getTime();
165
- if (orderTime < startTs) return false;
362
+ const isCreatedIsUndefined = order.created_at === undefined;
363
+ // 统一用 dayjs 按本地时区解析,避免 new Date("YYYY-MM-DD") 被当作 UTC 0 点
364
+ // 与含时分的本地时间字符串比较时产生时区错位
365
+ const orderTime = order.created_at ? typeof order.created_at === 'number' ? order.created_at : (0, _dayjs.default)(String(order.created_at)).valueOf() : 0;
366
+ if (safeFilters.start_time && !isCreatedIsUndefined) {
367
+ const startTs = (0, _dayjs.default)(safeFilters.start_time).startOf('day').valueOf();
368
+ if (orderTime < startTs) {
369
+ rejected.push({
370
+ order_id: order.order_id,
371
+ order_number: order.order_number,
372
+ reason: {
373
+ field: 'start_time',
374
+ actual: order.created_at,
375
+ expected: safeFilters.start_time
376
+ }
377
+ });
378
+ return false;
379
+ }
166
380
  }
167
- if (safeFilters.end_time) {
168
- // end_time 为当天结束(23:59:59.999)
169
- const endTs = new Date(safeFilters.end_time).getTime() + 86400000 - 1;
170
- if (orderTime > endTs) return false;
381
+ if (safeFilters.end_time && !isCreatedIsUndefined) {
382
+ const endTs = (0, _dayjs.default)(safeFilters.end_time).endOf('day').valueOf();
383
+ if (orderTime > endTs) {
384
+ rejected.push({
385
+ order_id: order.order_id,
386
+ order_number: order.order_number,
387
+ reason: {
388
+ field: 'end_time',
389
+ actual: order.created_at,
390
+ expected: safeFilters.end_time
391
+ }
392
+ });
393
+ return false;
394
+ }
171
395
  }
172
396
  }
173
397
  return true;
@@ -221,6 +445,7 @@ function filterOrders(orders, filters) {
221
445
  list: paginatedList,
222
446
  count: totalCount,
223
447
  size,
224
- skip: page
448
+ skip: page,
449
+ rejected
225
450
  };
226
451
  }
@@ -0,0 +1,28 @@
1
+ import { Module, ModuleOptions, PisellCore } from '../../../types';
2
+ import { BaseModule } from '../../../modules/BaseModule';
3
+ import type { PaymentMethod } from './types';
4
+ export declare class PaymentServerModule extends BaseModule implements Module {
5
+ protected defaultName: string;
6
+ protected defaultVersion: string;
7
+ private request;
8
+ private app;
9
+ private logger;
10
+ private store;
11
+ private payMethodMemoryCache;
12
+ private payMethodListInFlight;
13
+ constructor(name?: string, version?: string);
14
+ initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
15
+ getPayMethodListAsync(options?: {
16
+ shouldFilter?: boolean;
17
+ }): Promise<PaymentMethod[]>;
18
+ clearPayMethodCache(): void;
19
+ private loadPayMethodListAsync;
20
+ private fetchRemotePayMethods;
21
+ private shouldFilterPayMethods;
22
+ private resolvePayMethods;
23
+ private filterPayMethods;
24
+ private setPayMethodCache;
25
+ private logInfo;
26
+ private logWarning;
27
+ private logError;
28
+ }
@@ -0,0 +1,168 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.PaymentServerModule = void 0;
7
+ var _BaseModule = require("../../../modules/BaseModule");
8
+ const WALLET_PASS_CODE = 'WALLET_PASS';
9
+ const WALLET_DEPENDENT_CODES = new Set(['PRODUCTVOUCHER', 'GIFTCARD', 'POINTCARD']);
10
+ const PAYMENT_METHODS_LOADED_EVENT = 'payment:onPaymentMethodsLoaded';
11
+ class PaymentServerModule extends _BaseModule.BaseModule {
12
+ defaultName = 'payment';
13
+ defaultVersion = '1.0.0';
14
+ request;
15
+ app;
16
+ logger;
17
+ store;
18
+ payMethodMemoryCache = null;
19
+ payMethodListInFlight = null;
20
+ constructor(name, version) {
21
+ super(name || 'payment', version);
22
+ }
23
+ async initialize(core, options) {
24
+ this.core = core;
25
+ this.store = options?.store;
26
+ if (!this.store) this.store = {
27
+ payMethods: []
28
+ };
29
+ if (!Array.isArray(this.store.payMethods)) this.store.payMethods = [];
30
+ this.request = core.getPlugin('request');
31
+ const appPlugin = core.getPlugin('app');
32
+ this.app = appPlugin?.getApp();
33
+ this.logger = this.app?.logger;
34
+ if (!this.request && !this.app?.request) {
35
+ throw new Error('PaymentServerModule 需要 request 插件或 app.request 支持');
36
+ }
37
+ this.logInfo('PaymentServerModule initialized successfully', {
38
+ hasAppRequest: !!this.app?.request
39
+ });
40
+ }
41
+
42
+ // getRoutes(): RouteDefinition[] {
43
+ // return [
44
+ // {
45
+ // method: 'get',
46
+ // path: '/pay/custom-payment/all',
47
+ // handler: async ({ data, config }) => {
48
+ // const payMethods = await this.getPayMethodListAsync({
49
+ // shouldFilter: this.shouldFilterPayMethods(data, config),
50
+ // });
51
+ // return {
52
+ // code: 200,
53
+ // status: true,
54
+ // data: payMethods,
55
+ // };
56
+ // },
57
+ // },
58
+ // ];
59
+ // }
60
+
61
+ async getPayMethodListAsync(options = {}) {
62
+ this.logInfo('Starting getPayMethodListAsync');
63
+ if (this.payMethodMemoryCache?.length) {
64
+ return this.resolvePayMethods(this.payMethodMemoryCache, options);
65
+ }
66
+ if (this.payMethodListInFlight) {
67
+ const payMethods = await this.payMethodListInFlight;
68
+ return this.resolvePayMethods(payMethods, options);
69
+ }
70
+ this.payMethodListInFlight = this.loadPayMethodListAsync().finally(() => {
71
+ this.payMethodListInFlight = null;
72
+ });
73
+ const payMethods = await this.payMethodListInFlight;
74
+ return this.resolvePayMethods(payMethods, options);
75
+ }
76
+ clearPayMethodCache() {
77
+ this.payMethodMemoryCache = null;
78
+ this.store.payMethods = [];
79
+ }
80
+ async loadPayMethodListAsync() {
81
+ try {
82
+ const payMethods = await this.fetchRemotePayMethods();
83
+ this.setPayMethodCache(payMethods);
84
+ await this.core.effects.emit(PAYMENT_METHODS_LOADED_EVENT, payMethods);
85
+ this.logInfo('getPayMethodListAsync completed successfully', {
86
+ payMethods
87
+ });
88
+ return payMethods;
89
+ } catch (error) {
90
+ console.error('[PaymentServerModule] 获取支付方式列表失败', error);
91
+ this.logError('getPayMethodListAsync failed', error);
92
+ return [];
93
+ }
94
+ }
95
+ async fetchRemotePayMethods() {
96
+ const requester = this.app?.request || this.request;
97
+ const response = await requester.get('/shop/pay/custom-payment/all', undefined);
98
+ const payMethods = response?.data || response || [];
99
+ return Array.isArray(payMethods) ? payMethods : [];
100
+ }
101
+ shouldFilterPayMethods(data, config) {
102
+ return data?.filterPaymentMethods === true || config?.filterPaymentMethods === true;
103
+ }
104
+ resolvePayMethods(payMethods, options) {
105
+ if (!options.shouldFilter) return payMethods;
106
+ return this.filterPayMethods(payMethods);
107
+ }
108
+ filterPayMethods(payMethods) {
109
+ if (!Array.isArray(payMethods)) return [];
110
+ let availableMethods = payMethods.filter(method => method.status === 1 && method.disable === 0);
111
+ const walletPassMethod = availableMethods.find(method => method.code === WALLET_PASS_CODE);
112
+ if (!walletPassMethod) {
113
+ return availableMethods.filter(method => !WALLET_DEPENDENT_CODES.has(method.code));
114
+ }
115
+ availableMethods = availableMethods.map(method => {
116
+ if (!WALLET_DEPENDENT_CODES.has(method.code)) return method;
117
+ return {
118
+ ...method,
119
+ channel_application: walletPassMethod.channel_application
120
+ };
121
+ });
122
+ return availableMethods;
123
+ }
124
+ setPayMethodCache(payMethods) {
125
+ this.payMethodMemoryCache = payMethods;
126
+ this.store.payMethods = payMethods;
127
+ }
128
+ logInfo(title, metadata) {
129
+ try {
130
+ if (this.logger) {
131
+ this.logger.addLog({
132
+ type: 'info',
133
+ title: `[PaymentServerModule] ${title}`,
134
+ metadata: metadata || {}
135
+ });
136
+ }
137
+ } catch {
138
+ // 日志记录失败不影响主流程
139
+ }
140
+ }
141
+ logWarning(title, metadata) {
142
+ try {
143
+ if (this.logger) {
144
+ this.logger.addLog({
145
+ type: 'warning',
146
+ title: `[PaymentServerModule] ${title}`,
147
+ metadata: metadata || {}
148
+ });
149
+ }
150
+ } catch {
151
+ // 日志记录失败不影响主流程
152
+ }
153
+ }
154
+ logError(title, metadata) {
155
+ try {
156
+ if (this.logger) {
157
+ this.logger.addLog({
158
+ type: 'error',
159
+ title: `[PaymentServerModule] ${title}`,
160
+ metadata: metadata || {}
161
+ });
162
+ }
163
+ } catch {
164
+ // 日志记录失败不影响主流程
165
+ }
166
+ }
167
+ }
168
+ exports.PaymentServerModule = PaymentServerModule;
@@ -0,0 +1,9 @@
1
+ import type { PaymentMethod } from '../../../modules/Payment/types';
2
+ export interface PaymentServerState {
3
+ payMethods: PaymentMethod[];
4
+ }
5
+ export interface PaymentMethodsChangedEventData {
6
+ oldMethods: PaymentMethod[];
7
+ newMethods: PaymentMethod[];
8
+ }
9
+ export type { PaymentMethod };
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });