@pisell/pisellos 0.0.568 → 0.0.569
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.
- package/dist/model/strategy/adapter/promotion/evaluator.js +3 -2
- package/dist/model/strategy/adapter/walletPass/utils.js +7 -4
- package/dist/modules/BaseModule.d.ts +2 -2
- package/dist/modules/BaseModule.js +4 -4
- package/dist/modules/BookingContext/index.d.ts +48 -0
- package/dist/modules/BookingContext/index.js +566 -0
- package/dist/modules/BookingContext/types.d.ts +102 -0
- package/dist/modules/BookingContext/types.js +51 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +302 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +149 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +249 -0
- package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/dist/modules/BookingContext/utils/flexible.js +56 -0
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
- package/dist/modules/BookingContext/utils/index.d.ts +11 -0
- package/dist/modules/BookingContext/utils/index.js +11 -0
- package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/dist/modules/BookingContext/utils/noResource.js +77 -0
- package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
- package/dist/modules/BookingContext/utils/orderLineDisplay.js +36 -0
- package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/dist/modules/BookingContext/utils/productExtend.js +339 -0
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
- package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
- package/dist/modules/BookingContext/utils/resources.js +486 -0
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
- package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
- package/dist/modules/Cart/utils/cartProduct.js +26 -5
- package/dist/modules/Cart/utils/changePrice.js +27 -20
- package/dist/modules/Customer/index.d.ts +20 -0
- package/dist/modules/Customer/index.js +172 -83
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Discount/index.d.ts +2 -1
- package/dist/modules/Discount/index.js +37 -9
- package/dist/modules/Discount/types.d.ts +1 -0
- package/dist/modules/OpenData/index.d.ts +8 -0
- package/dist/modules/OpenData/index.js +36 -16
- package/dist/modules/Order/index.d.ts +448 -23
- package/dist/modules/Order/index.js +5417 -561
- package/dist/modules/Order/types.d.ts +693 -88
- package/dist/modules/Order/types.js +68 -1
- package/dist/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/dist/modules/Order/utils/bundleDiscountHydration.js +144 -0
- package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/dist/modules/Order/utils/manualProductDiscount.js +210 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +405 -0
- package/dist/modules/Order/utils.d.ts +167 -18
- package/dist/modules/Order/utils.js +960 -165
- package/dist/modules/Payment/index.d.ts +10 -9
- package/dist/modules/Payment/index.js +465 -703
- package/dist/modules/Payment/types.d.ts +40 -16
- package/dist/modules/Payment/utils.d.ts +1 -1
- package/dist/modules/Payment/utils.js +4 -3
- package/dist/modules/Payment/walletpass.js +44 -29
- package/dist/modules/Product/types.d.ts +29 -7
- package/dist/modules/ProductList/index.d.ts +17 -13
- package/dist/modules/ProductList/index.js +184 -74
- package/dist/modules/ProductList/types.d.ts +17 -0
- package/dist/modules/Quotation/index.d.ts +22 -2
- package/dist/modules/Quotation/index.js +108 -42
- package/dist/modules/Quotation/types.d.ts +19 -0
- package/dist/modules/ResourcePlanner/index.d.ts +24 -0
- package/dist/modules/ResourcePlanner/index.js +181 -0
- package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
- package/dist/modules/ResourcePlanner/planner.js +1069 -0
- package/dist/modules/ResourcePlanner/types.d.ts +227 -0
- package/dist/modules/ResourcePlanner/types.js +1 -0
- package/dist/modules/Rules/index.d.ts +8 -10
- package/dist/modules/Rules/index.js +221 -109
- package/dist/modules/Rules/types.d.ts +14 -3
- package/dist/modules/SalesSummary/index.d.ts +23 -26
- package/dist/modules/SalesSummary/index.js +152 -46
- package/dist/modules/SalesSummary/types.d.ts +9 -1
- package/dist/modules/SalesSummary/utils.d.ts +3 -22
- package/dist/modules/SalesSummary/utils.js +803 -163
- package/dist/modules/Schedule/getDateIsInSchedule.js +14 -7
- package/dist/modules/Schedule/index.d.ts +18 -5
- package/dist/modules/Schedule/index.js +78 -24
- package/dist/modules/Schedule/types.d.ts +2 -0
- package/dist/modules/Summary/index.js +4 -3
- package/dist/modules/SurchargeList/index.d.ts +18 -0
- package/dist/modules/SurchargeList/index.js +185 -0
- package/dist/modules/SurchargeList/types.d.ts +15 -0
- package/dist/modules/SurchargeList/types.js +1 -0
- package/dist/modules/index.d.ts +3 -0
- package/dist/modules/index.js +4 -1
- package/dist/plugins/app.d.ts +2 -0
- package/dist/plugins/request.d.ts +1 -0
- package/dist/server/index.d.ts +462 -8
- package/dist/server/index.js +6112 -656
- package/dist/server/modules/floor-plan/index.d.ts +39 -0
- package/dist/server/modules/floor-plan/index.js +595 -0
- package/dist/server/modules/floor-plan/types.d.ts +43 -0
- package/dist/server/modules/floor-plan/types.js +13 -0
- package/dist/server/modules/index.d.ts +7 -2
- package/dist/server/modules/index.js +6 -0
- package/dist/server/modules/order/index.d.ts +207 -14
- package/dist/server/modules/order/index.js +2326 -379
- package/dist/server/modules/order/types.d.ts +76 -5
- package/dist/server/modules/order/types.js +14 -1
- package/dist/server/modules/order/utils/filterBookings.d.ts +7 -1
- package/dist/server/modules/order/utils/filterBookings.js +118 -11
- package/dist/server/modules/order/utils/filterOrders.js +242 -14
- package/dist/server/modules/payment/index.d.ts +28 -0
- package/dist/server/modules/payment/index.js +305 -0
- package/dist/server/modules/payment/types.d.ts +9 -0
- package/dist/server/modules/payment/types.js +1 -0
- package/dist/server/modules/products/index.d.ts +105 -14
- package/dist/server/modules/products/index.js +1393 -516
- package/dist/server/modules/products/types.d.ts +34 -1
- package/dist/server/modules/products/types.js +4 -0
- package/dist/server/modules/quotation/index.d.ts +39 -0
- package/dist/server/modules/quotation/index.js +278 -66
- package/dist/server/modules/resource/index.d.ts +2 -3
- package/dist/server/modules/resource/index.js +108 -86
- package/dist/server/modules/schedule/index.d.ts +6 -4
- package/dist/server/modules/schedule/index.js +116 -85
- package/dist/server/test.json +713 -0
- package/dist/server/types.d.ts +2 -0
- package/dist/server/utils/product.js +2 -2
- package/dist/server/utils/small-ticket.d.ts +71 -0
- package/dist/server/utils/small-ticket.js +963 -0
- package/dist/solution/BaseSales/index.d.ts +378 -0
- package/dist/solution/BaseSales/index.js +4006 -0
- package/dist/solution/BaseSales/types.d.ts +394 -0
- package/dist/solution/BaseSales/types.js +40 -0
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
- package/dist/solution/BaseSales/utils/cartPromotion.js +1450 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +144 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +157 -0
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +18 -0
- package/dist/solution/BaseSales/utils/quotationPrice.js +250 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +63 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +218 -0
- package/dist/solution/BaseSales/utils.d.ts +40 -0
- package/dist/solution/BaseSales/utils.js +263 -0
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +394 -25
- package/dist/solution/BookingTicket/index.js +2506 -443
- package/dist/solution/BookingTicket/types.d.ts +191 -6
- package/dist/solution/BookingTicket/types.js +83 -10
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.js +346 -0
- package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
- package/dist/solution/BookingTicket/utils/addTimeAvailability.js +95 -0
- package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
- package/dist/solution/BookingTicket/utils/bookingStatus.js +136 -0
- package/dist/solution/BookingTicket/utils/cartView.d.ts +29 -0
- package/dist/solution/BookingTicket/utils/cartView.js +209 -0
- package/dist/solution/BookingTicket/utils/exampleData.d.ts +123 -0
- package/dist/solution/BookingTicket/utils/exampleData.js +183 -0
- package/dist/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
- package/dist/solution/BookingTicket/utils/orderCustomer.js +31 -0
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +438 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +400 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +4 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +41 -1
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +56 -0
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +11 -3
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +20 -8
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.js +150 -0
- package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
- package/dist/solution/BookingTicket/utils/sessionCatalogStale.js +78 -0
- package/dist/solution/Checkout/index.d.ts +1 -0
- package/dist/solution/Checkout/index.js +25 -34
- package/dist/solution/Checkout/utils/index.js +4 -4
- package/dist/solution/RegisterAndLogin/config.js +2 -10
- package/dist/solution/Sales/index.d.ts +50 -5
- package/dist/solution/Sales/index.js +484 -92
- package/dist/solution/Sales/types.d.ts +26 -2
- package/dist/solution/ScanOrder/index.d.ts +27 -21
- package/dist/solution/ScanOrder/index.js +499 -434
- package/dist/solution/ScanOrder/types.d.ts +33 -11
- package/dist/solution/ScanOrder/types.js +4 -5
- package/dist/solution/ScanOrder/utils.d.ts +4 -1
- package/dist/solution/ScanOrder/utils.js +109 -34
- package/dist/solution/ShopDiscount/index.js +4 -4
- package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/dist/solution/UnifiedBookingSales/index.js +1871 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/dist/solution/UnifiedBookingSales/types.js +11 -0
- package/dist/solution/VenueBooking/index.d.ts +29 -20
- package/dist/solution/VenueBooking/index.js +301 -213
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +9 -3
- package/dist/solution/index.d.ts +2 -0
- package/dist/solution/index.js +3 -1
- package/dist/types/index.d.ts +11 -1
- package/lib/model/strategy/adapter/promotion/evaluator.js +3 -2
- package/lib/model/strategy/adapter/walletPass/utils.js +6 -4
- package/lib/modules/BaseModule.d.ts +2 -2
- package/lib/modules/BaseModule.js +4 -4
- package/lib/modules/BookingContext/index.d.ts +48 -0
- package/lib/modules/BookingContext/index.js +390 -0
- package/lib/modules/BookingContext/types.d.ts +102 -0
- package/lib/modules/BookingContext/types.js +48 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +286 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +148 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +242 -0
- package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/lib/modules/BookingContext/utils/flexible.js +63 -0
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/lib/modules/BookingContext/utils/formatResourceList.js +35 -0
- package/lib/modules/BookingContext/utils/index.d.ts +11 -0
- package/lib/modules/BookingContext/utils/index.js +126 -0
- package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/lib/modules/BookingContext/utils/noResource.js +78 -0
- package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
- package/lib/modules/BookingContext/utils/orderLineDisplay.js +29 -0
- package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/lib/modules/BookingContext/utils/productExtend.js +330 -0
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/lib/modules/BookingContext/utils/resourceSelection.js +24 -0
- package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
- package/lib/modules/BookingContext/utils/resources.js +419 -0
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/lib/modules/BookingContext/utils/serviceTimes.js +161 -0
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/lib/modules/BookingContext/utils/timeSlices.js +114 -0
- package/lib/modules/Cart/utils/cartProduct.js +27 -5
- package/lib/modules/Cart/utils/changePrice.js +20 -14
- package/lib/modules/Customer/index.d.ts +20 -0
- package/lib/modules/Customer/index.js +63 -10
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Discount/index.d.ts +2 -1
- package/lib/modules/Discount/index.js +18 -2
- package/lib/modules/Discount/types.d.ts +1 -0
- package/lib/modules/OpenData/index.d.ts +8 -0
- package/lib/modules/OpenData/index.js +21 -3
- package/lib/modules/Order/index.d.ts +448 -23
- package/lib/modules/Order/index.js +3641 -308
- package/lib/modules/Order/types.d.ts +693 -88
- package/lib/modules/Order/types.js +55 -1
- package/lib/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/lib/modules/Order/utils/bundleDiscountHydration.js +106 -0
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/lib/modules/Order/utils/manualProductDiscount.js +207 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +353 -0
- package/lib/modules/Order/utils.d.ts +167 -18
- package/lib/modules/Order/utils.js +974 -138
- package/lib/modules/Payment/index.d.ts +10 -9
- package/lib/modules/Payment/index.js +30 -124
- package/lib/modules/Payment/types.d.ts +40 -16
- package/lib/modules/Payment/utils.d.ts +1 -1
- package/lib/modules/Payment/utils.js +4 -3
- package/lib/modules/Payment/walletpass.js +16 -6
- package/lib/modules/Product/types.d.ts +29 -7
- package/lib/modules/ProductList/index.d.ts +17 -13
- package/lib/modules/ProductList/index.js +92 -51
- package/lib/modules/ProductList/types.d.ts +17 -0
- package/lib/modules/Quotation/index.d.ts +22 -2
- package/lib/modules/Quotation/index.js +76 -20
- package/lib/modules/Quotation/types.d.ts +19 -0
- package/lib/modules/ResourcePlanner/index.d.ts +24 -0
- package/lib/modules/ResourcePlanner/index.js +147 -0
- package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
- package/lib/modules/ResourcePlanner/planner.js +895 -0
- package/lib/modules/ResourcePlanner/types.d.ts +227 -0
- package/lib/modules/ResourcePlanner/types.js +5 -0
- package/lib/modules/Rules/index.d.ts +8 -10
- package/lib/modules/Rules/index.js +152 -60
- package/lib/modules/Rules/types.d.ts +14 -3
- package/lib/modules/SalesSummary/index.d.ts +23 -26
- package/lib/modules/SalesSummary/index.js +84 -16
- package/lib/modules/SalesSummary/types.d.ts +9 -1
- package/lib/modules/SalesSummary/utils.d.ts +3 -22
- package/lib/modules/SalesSummary/utils.js +616 -111
- package/lib/modules/Schedule/getDateIsInSchedule.js +14 -7
- package/lib/modules/Schedule/index.d.ts +18 -5
- package/lib/modules/Schedule/index.js +49 -14
- package/lib/modules/Schedule/types.d.ts +2 -0
- package/lib/modules/Summary/index.js +2 -2
- package/lib/modules/SurchargeList/index.d.ts +18 -0
- package/lib/modules/SurchargeList/index.js +95 -0
- package/lib/modules/SurchargeList/types.d.ts +15 -0
- package/lib/modules/SurchargeList/types.js +5 -0
- package/lib/modules/index.d.ts +3 -0
- package/lib/modules/index.js +33 -0
- package/lib/plugins/app.d.ts +2 -0
- package/lib/plugins/request.d.ts +1 -0
- package/lib/server/index.d.ts +462 -8
- package/lib/server/index.js +3901 -205
- package/lib/server/modules/floor-plan/index.d.ts +39 -0
- package/lib/server/modules/floor-plan/index.js +306 -0
- package/lib/server/modules/floor-plan/types.d.ts +43 -0
- package/lib/server/modules/floor-plan/types.js +19 -0
- package/lib/server/modules/index.d.ts +7 -2
- package/lib/server/modules/index.js +21 -0
- package/lib/server/modules/order/index.d.ts +207 -14
- package/lib/server/modules/order/index.js +1324 -141
- package/lib/server/modules/order/types.d.ts +76 -5
- package/lib/server/modules/order/types.js +11 -1
- package/lib/server/modules/order/utils/filterBookings.d.ts +7 -1
- package/lib/server/modules/order/utils/filterBookings.js +119 -11
- package/lib/server/modules/order/utils/filterOrders.js +238 -13
- package/lib/server/modules/payment/index.d.ts +28 -0
- package/lib/server/modules/payment/index.js +168 -0
- package/lib/server/modules/payment/types.d.ts +9 -0
- package/lib/server/modules/payment/types.js +5 -0
- package/lib/server/modules/products/index.d.ts +105 -14
- package/lib/server/modules/products/index.js +588 -97
- package/lib/server/modules/products/types.d.ts +34 -1
- package/lib/server/modules/products/types.js +3 -0
- package/lib/server/modules/quotation/index.d.ts +39 -0
- package/lib/server/modules/quotation/index.js +145 -1
- package/lib/server/modules/resource/index.d.ts +2 -3
- package/lib/server/modules/resource/index.js +71 -45
- package/lib/server/modules/schedule/index.d.ts +6 -4
- package/lib/server/modules/schedule/index.js +55 -44
- package/lib/server/test.json +713 -0
- package/lib/server/types.d.ts +2 -0
- package/lib/server/utils/product.js +2 -2
- package/lib/server/utils/small-ticket.d.ts +71 -0
- package/lib/server/utils/small-ticket.js +926 -0
- package/lib/solution/BaseSales/index.d.ts +378 -0
- package/lib/solution/BaseSales/index.js +2367 -0
- package/lib/solution/BaseSales/types.d.ts +394 -0
- package/lib/solution/BaseSales/types.js +47 -0
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
- package/lib/solution/BaseSales/utils/cartPromotion.js +1155 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +144 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +140 -0
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +18 -0
- package/lib/solution/BaseSales/utils/quotationPrice.js +231 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +63 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +215 -0
- package/lib/solution/BaseSales/utils.d.ts +40 -0
- package/lib/solution/BaseSales/utils.js +259 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +394 -25
- package/lib/solution/BookingTicket/index.js +1350 -76
- package/lib/solution/BookingTicket/types.d.ts +191 -6
- package/lib/solution/BookingTicket/types.js +71 -10
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.js +353 -0
- package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
- package/lib/solution/BookingTicket/utils/addTimeAvailability.js +94 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.js +136 -0
- package/lib/solution/BookingTicket/utils/cartView.d.ts +29 -0
- package/lib/solution/BookingTicket/utils/cartView.js +200 -0
- package/lib/solution/BookingTicket/utils/exampleData.d.ts +123 -0
- package/lib/solution/BookingTicket/utils/exampleData.js +185 -0
- package/lib/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
- package/lib/solution/BookingTicket/utils/orderCustomer.js +35 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +387 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +220 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +4 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +24 -3
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +64 -0
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +4 -2
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +14 -2
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +115 -0
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +83 -0
- package/lib/solution/Checkout/index.d.ts +1 -0
- package/lib/solution/Checkout/index.js +18 -19
- package/lib/solution/Checkout/utils/index.js +4 -4
- package/lib/solution/RegisterAndLogin/config.js +2 -10
- package/lib/solution/Sales/index.d.ts +50 -5
- package/lib/solution/Sales/index.js +296 -39
- package/lib/solution/Sales/types.d.ts +26 -2
- package/lib/solution/ScanOrder/index.d.ts +27 -21
- package/lib/solution/ScanOrder/index.js +144 -103
- package/lib/solution/ScanOrder/types.d.ts +33 -11
- package/lib/solution/ScanOrder/types.js +4 -5
- package/lib/solution/ScanOrder/utils.d.ts +4 -1
- package/lib/solution/ScanOrder/utils.js +98 -26
- package/lib/solution/ShopDiscount/index.js +3 -3
- package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/lib/solution/UnifiedBookingSales/index.js +1050 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/lib/solution/UnifiedBookingSales/types.js +14 -0
- package/lib/solution/VenueBooking/index.d.ts +29 -20
- package/lib/solution/VenueBooking/index.js +169 -94
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +9 -3
- package/lib/solution/index.d.ts +2 -0
- package/lib/solution/index.js +22 -0
- package/lib/types/index.d.ts +11 -1
- package/package.json +1 -1
- package/dist/solution/Checkout/appointmentDemo.json +0 -1
- 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
|
-
|
|
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 =
|
|
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
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
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
|
-
|
|
169
|
-
|
|
170
|
-
|
|
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 };
|