@pisell/pisellos 0.0.567 → 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/core/index.js +6 -9
- package/dist/model/strategy/adapter/promotion/evaluator.js +3 -2
- package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -2
- package/dist/model/strategy/adapter/walletPass/example.js +3 -26
- package/dist/model/strategy/adapter/walletPass/utils.js +7 -7
- package/dist/model/strategy/strategy-example.js +5 -19
- 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/index.js +0 -3
- package/dist/modules/Cart/utils/cartProduct.js +26 -6
- 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/Date/index.js +1 -5
- package/dist/modules/Discount/index.d.ts +2 -1
- package/dist/modules/Discount/index.js +37 -12
- package/dist/modules/Discount/types.d.ts +1 -0
- package/dist/modules/OpenData/index.d.ts +8 -0
- package/dist/modules/OpenData/index.js +35 -17
- package/dist/modules/Order/index.d.ts +449 -24
- package/dist/modules/Order/index.js +5437 -608
- 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 +508 -874
- 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 +48 -34
- 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 +219 -114
- 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/Schedule/utils.js +0 -1
- package/dist/modules/Step/index.js +0 -1
- 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/plugins/request.js +1 -4
- package/dist/plugins/window.js +2 -6
- package/dist/server/index.d.ts +462 -8
- package/dist/server/index.js +6137 -714
- 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/menu/index.js +32 -41
- 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 +1397 -540
- 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 +289 -86
- package/dist/server/modules/resource/index.d.ts +2 -3
- package/dist/server/modules/resource/index.js +105 -84
- package/dist/server/modules/schedule/index.d.ts +6 -4
- package/dist/server/modules/schedule/index.js +137 -114
- package/dist/server/test.json +713 -0
- package/dist/server/types.d.ts +2 -0
- package/dist/server/utils/product.js +2 -3
- 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.js +7 -59
- package/dist/solution/BookingByStep/utils/capacity.js +1 -11
- package/dist/solution/BookingByStep/utils/resources.js +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +2 -43
- package/dist/solution/BookingTicket/index.d.ts +393 -24
- package/dist/solution/BookingTicket/index.js +2506 -445
- 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 +36 -34
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +26 -18
- 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/BuyTickets/index.js +9 -12
- package/dist/solution/Checkout/index.d.ts +1 -0
- package/dist/solution/Checkout/index.js +199 -277
- package/dist/solution/Checkout/utils/index.js +8 -20
- package/dist/solution/RegisterAndLogin/config.js +2 -10
- package/dist/solution/RegisterAndLogin/index.js +30 -76
- 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 +509 -454
- 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 +6 -11
- 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 +34 -20
- package/dist/solution/VenueBooking/index.js +630 -505
- 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/dist/utils/task.js +15 -18
- package/dist/utils/watch.js +0 -1
- package/lib/apis/picoding.js +2 -0
- package/lib/core/index.js +130 -131
- package/lib/effects/index.js +46 -57
- package/lib/index.js +92 -53
- package/lib/model/index.js +14 -21
- package/lib/model/strategy/adapter/dataVariant/adapter.js +38 -50
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +162 -236
- package/lib/model/strategy/adapter/dataVariant/examples.js +229 -237
- package/lib/model/strategy/adapter/dataVariant/index.js +39 -34
- package/lib/model/strategy/adapter/dataVariant/type.js +57 -28
- package/lib/model/strategy/adapter/index.js +100 -64
- package/lib/model/strategy/adapter/itemRule/adapter.js +156 -144
- package/lib/model/strategy/adapter/itemRule/evaluator.js +36 -48
- package/lib/model/strategy/adapter/itemRule/examples.js +295 -225
- package/lib/model/strategy/adapter/itemRule/index.js +83 -57
- package/lib/model/strategy/adapter/itemRule/type.js +97 -36
- package/lib/model/strategy/adapter/promotion/adapter.js +84 -63
- package/lib/model/strategy/adapter/promotion/evaluator.js +383 -232
- package/lib/model/strategy/adapter/promotion/examples.js +139 -159
- package/lib/model/strategy/adapter/promotion/index.js +1 -49
- package/lib/model/strategy/adapter/promotion/type.js +199 -35
- package/lib/model/strategy/adapter/type.js +4 -16
- package/lib/model/strategy/adapter/walletPass/evaluator.js +180 -152
- package/lib/model/strategy/adapter/walletPass/example.js +217 -190
- package/lib/model/strategy/adapter/walletPass/index.js +75 -51
- package/lib/model/strategy/adapter/walletPass/locales.js +36 -58
- package/lib/model/strategy/adapter/walletPass/type.js +4 -16
- package/lib/model/strategy/adapter/walletPass/utils.js +654 -402
- package/lib/model/strategy/engine.js +270 -168
- package/lib/model/strategy/index.js +49 -34
- package/lib/model/strategy/strategy-example.js +243 -239
- package/lib/model/strategy/type.js +100 -40
- package/lib/modules/Account/index.js +39 -53
- package/lib/modules/Account/types.js +20 -33
- package/lib/modules/AccountList/index.js +116 -154
- package/lib/modules/AccountList/types.js +30 -31
- package/lib/modules/AccountList/utils.js +18 -30
- package/lib/modules/BaseModule.d.ts +2 -2
- package/lib/modules/BaseModule.js +26 -49
- 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/index.js +170 -124
- package/lib/modules/Cart/types.js +46 -51
- package/lib/modules/Cart/utils/cartAccount.js +40 -39
- package/lib/modules/Cart/utils/cartDate.js +56 -61
- package/lib/modules/Cart/utils/cartDiscount.js +28 -33
- package/lib/modules/Cart/utils/cartNote.js +27 -32
- package/lib/modules/Cart/utils/cartProduct.js +331 -244
- package/lib/modules/Cart/utils/cartRelationForms.js +29 -35
- package/lib/modules/Cart/utils/cartResource.js +72 -78
- package/lib/modules/Cart/utils/changePrice.js +37 -67
- package/lib/modules/Cart/utils/index.js +106 -48
- package/lib/modules/Customer/constants.js +13 -34
- package/lib/modules/Customer/index.d.ts +20 -0
- package/lib/modules/Customer/index.js +270 -154
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Customer/types.js +38 -35
- package/lib/modules/Date/index.js +116 -115
- package/lib/modules/Date/types.js +16 -28
- package/lib/modules/Date/utils.js +174 -123
- package/lib/modules/Discount/index.d.ts +2 -1
- package/lib/modules/Discount/index.js +133 -113
- package/lib/modules/Discount/types.d.ts +1 -0
- package/lib/modules/Discount/types.js +9 -31
- package/lib/modules/Guests/index.js +30 -56
- package/lib/modules/Guests/types.js +23 -33
- package/lib/modules/Holder/index.js +209 -189
- package/lib/modules/Holder/types.js +4 -16
- package/lib/modules/Holder/utils.js +20 -49
- package/lib/modules/OpenData/index.d.ts +8 -0
- package/lib/modules/OpenData/index.js +81 -74
- package/lib/modules/OpenData/types.js +4 -16
- package/lib/modules/OpenData/utils.js +44 -78
- package/lib/modules/Order/index.d.ts +449 -24
- package/lib/modules/Order/index.js +3834 -489
- package/lib/modules/Order/types.d.ts +693 -88
- package/lib/modules/Order/types.js +78 -33
- 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 +1247 -345
- package/lib/modules/Payment/cash.js +20 -33
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +145 -76
- package/lib/modules/Payment/eftpos.js +16 -30
- package/lib/modules/Payment/index.d.ts +10 -9
- package/lib/modules/Payment/index.js +542 -502
- package/lib/modules/Payment/mx51.js +1 -0
- package/lib/modules/Payment/types.d.ts +40 -16
- package/lib/modules/Payment/types.js +216 -107
- package/lib/modules/Payment/utils.d.ts +1 -1
- package/lib/modules/Payment/utils.js +53 -49
- package/lib/modules/Payment/walletpass.js +231 -203
- package/lib/modules/Product/index.js +51 -46
- package/lib/modules/Product/types.d.ts +29 -7
- package/lib/modules/Product/types.js +4 -16
- package/lib/modules/Product/utils.js +32 -33
- package/lib/modules/ProductList/index.d.ts +17 -13
- package/lib/modules/ProductList/index.js +160 -118
- package/lib/modules/ProductList/types.d.ts +17 -0
- package/lib/modules/ProductList/types.js +9 -31
- package/lib/modules/Quotation/index.d.ts +22 -2
- package/lib/modules/Quotation/index.js +123 -89
- package/lib/modules/Quotation/types.d.ts +19 -0
- package/lib/modules/Quotation/types.js +4 -16
- package/lib/modules/Resource/index.js +27 -59
- package/lib/modules/Resource/types.js +22 -32
- package/lib/modules/Resource/utils.js +30 -38
- 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 +1286 -894
- package/lib/modules/Rules/types.d.ts +14 -3
- package/lib/modules/Rules/types.js +17 -40
- package/lib/modules/SalesSummary/index.d.ts +23 -26
- package/lib/modules/SalesSummary/index.js +130 -71
- package/lib/modules/SalesSummary/types.d.ts +9 -1
- package/lib/modules/SalesSummary/types.js +4 -16
- package/lib/modules/SalesSummary/utils.d.ts +3 -22
- package/lib/modules/SalesSummary/utils.js +738 -250
- package/lib/modules/ScanOrderLogger/index.js +59 -79
- package/lib/modules/ScanOrderLogger/providers/feishu.js +54 -78
- package/lib/modules/ScanOrderLogger/providers/grafana.js +13 -36
- package/lib/modules/ScanOrderLogger/types.js +4 -16
- package/lib/modules/Schedule/getDateIsInSchedule.js +345 -171
- package/lib/modules/Schedule/index.d.ts +18 -5
- package/lib/modules/Schedule/index.js +139 -114
- package/lib/modules/Schedule/type.js +4 -16
- package/lib/modules/Schedule/types.d.ts +2 -0
- package/lib/modules/Schedule/types.js +4 -16
- package/lib/modules/Schedule/utils.js +433 -291
- package/lib/modules/Step/index.js +40 -52
- package/lib/modules/Step/tyeps.js +4 -16
- package/lib/modules/Summary/index.js +66 -70
- package/lib/modules/Summary/types.js +4 -16
- package/lib/modules/Summary/utils.js +782 -429
- 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 +245 -57
- package/lib/plugins/app.d.ts +2 -0
- package/lib/plugins/app.js +4 -16
- package/lib/plugins/index.js +36 -25
- package/lib/plugins/request.d.ts +1 -0
- package/lib/plugins/request.js +137 -126
- package/lib/plugins/shopStore.js +4 -16
- package/lib/plugins/user.js +4 -16
- package/lib/plugins/window.js +171 -179
- package/lib/server/index.d.ts +462 -8
- package/lib/server/index.js +4668 -713
- 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 +106 -59
- package/lib/server/modules/menu/index.js +146 -122
- package/lib/server/modules/menu/types.js +18 -31
- package/lib/server/modules/order/index.d.ts +207 -14
- package/lib/server/modules/order/index.js +1463 -316
- package/lib/server/modules/order/types.d.ts +76 -5
- package/lib/server/modules/order/types.js +117 -32
- package/lib/server/modules/order/utils/filterBookings.d.ts +7 -1
- package/lib/server/modules/order/utils/filterBookings.js +288 -146
- package/lib/server/modules/order/utils/filterOrders.js +318 -64
- 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 +969 -383
- package/lib/server/modules/products/types.d.ts +34 -1
- package/lib/server/modules/products/types.js +44 -34
- package/lib/server/modules/quotation/index.d.ts +39 -0
- package/lib/server/modules/quotation/index.js +220 -77
- package/lib/server/modules/quotation/types.js +21 -31
- package/lib/server/modules/resource/index.d.ts +2 -3
- package/lib/server/modules/resource/index.js +269 -214
- package/lib/server/modules/resource/types.js +42 -33
- package/lib/server/modules/schedule/index.d.ts +6 -4
- package/lib/server/modules/schedule/index.js +158 -132
- package/lib/server/modules/schedule/types.js +14 -21
- package/lib/server/modules/schedule/utils.js +334 -163
- package/lib/server/test.json +713 -0
- package/lib/server/types.d.ts +2 -0
- package/lib/server/types.js +4 -16
- package/lib/server/utils/index.js +25 -23
- package/lib/server/utils/product.js +197 -140
- package/lib/server/utils/schedule.js +34 -41
- package/lib/server/utils/small-ticket.d.ts +71 -0
- package/lib/server/utils/small-ticket.js +926 -0
- package/lib/server/utils/time.js +40 -49
- 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.js +1530 -1343
- package/lib/solution/BookingByStep/types.js +40 -99
- package/lib/solution/BookingByStep/utils/capacity.js +192 -160
- package/lib/solution/BookingByStep/utils/products.js +42 -52
- package/lib/solution/BookingByStep/utils/resources.js +527 -330
- package/lib/solution/BookingByStep/utils/stock.js +65 -44
- package/lib/solution/BookingByStep/utils/timeslots.js +129 -131
- package/lib/solution/BookingTicket/index.d.ts +393 -24
- package/lib/solution/BookingTicket/index.js +1459 -160
- package/lib/solution/BookingTicket/types.d.ts +191 -6
- package/lib/solution/BookingTicket/types.js +101 -66
- 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 +85 -80
- 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 +84 -80
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +103 -95
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +90 -43
- 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/BuyTickets/index.js +67 -70
- package/lib/solution/BuyTickets/types.js +22 -38
- package/lib/solution/Checkout/index.d.ts +1 -0
- package/lib/solution/Checkout/index.js +1461 -1169
- package/lib/solution/Checkout/types.js +91 -61
- package/lib/solution/Checkout/utils/index.js +228 -159
- package/lib/solution/PlaceOrder/index.js +55 -0
- package/lib/solution/RegisterAndLogin/config.js +495 -470
- package/lib/solution/RegisterAndLogin/index.js +633 -630
- package/lib/solution/RegisterAndLogin/types.js +189 -76
- package/lib/solution/RegisterAndLogin/utils.js +183 -125
- package/lib/solution/Sales/index.d.ts +50 -5
- package/lib/solution/Sales/index.js +495 -220
- package/lib/solution/Sales/types.d.ts +26 -2
- package/lib/solution/Sales/types.js +27 -33
- package/lib/solution/ScanOrder/index.d.ts +27 -21
- package/lib/solution/ScanOrder/index.js +908 -904
- package/lib/solution/ScanOrder/types.d.ts +33 -11
- package/lib/solution/ScanOrder/types.js +33 -34
- package/lib/solution/ScanOrder/utils.d.ts +4 -1
- package/lib/solution/ScanOrder/utils.js +457 -344
- package/lib/solution/ShopDiscount/index.js +230 -236
- package/lib/solution/ShopDiscount/types.js +15 -37
- package/lib/solution/ShopDiscount/utils.js +309 -172
- 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 +34 -20
- package/lib/solution/VenueBooking/index.js +982 -950
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- package/lib/solution/VenueBooking/types.js +20 -40
- package/lib/solution/VenueBooking/utils/dateSummary.js +22 -54
- package/lib/solution/VenueBooking/utils/resource.js +31 -54
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +96 -108
- package/lib/solution/VenueBooking/utils/smartPricing.js +112 -100
- package/lib/solution/VenueBooking/utils/timeSlot.js +133 -132
- package/lib/solution/VenueBooking/utils.js +130 -67
- package/lib/solution/index.d.ts +2 -0
- package/lib/solution/index.js +124 -37
- package/lib/store/createStore.js +32 -29
- package/lib/types/index.d.ts +11 -1
- package/lib/types/index.js +4 -16
- package/lib/utils/task.js +36 -36
- package/lib/utils/watch.js +81 -47
- package/package.json +2 -1
- package/dist/solution/Checkout/appointmentDemo.json +0 -1
- package/lib/solution/Checkout/appointmentDemo.json +0 -1
|
@@ -1,59 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// src/modules/Payment/walletpass.ts
|
|
20
|
-
var walletpass_exports = {};
|
|
21
|
-
__export(walletpass_exports, {
|
|
22
|
-
WalletPassPaymentImpl: () => WalletPassPaymentImpl
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
23
5
|
});
|
|
24
|
-
|
|
25
|
-
var
|
|
26
|
-
var
|
|
27
|
-
|
|
6
|
+
exports.WalletPassPaymentImpl = void 0;
|
|
7
|
+
var _types = require("./types");
|
|
8
|
+
var _utils = require("./utils");
|
|
9
|
+
/**
|
|
10
|
+
* 钱包支付实现
|
|
11
|
+
*/
|
|
12
|
+
class WalletPassPaymentImpl {
|
|
13
|
+
walletRecommendList = [];
|
|
14
|
+
userIdentificationCodes = [];
|
|
15
|
+
searchResults = [];
|
|
16
|
+
walletParams = null;
|
|
17
|
+
walletInitData = null;
|
|
28
18
|
constructor(paymentModule) {
|
|
29
19
|
this.paymentModule = paymentModule;
|
|
30
|
-
this.walletRecommendList = [];
|
|
31
|
-
this.userIdentificationCodes = [];
|
|
32
|
-
this.searchResults = [];
|
|
33
|
-
this.walletParams = null;
|
|
34
|
-
this.walletInitData = null;
|
|
35
20
|
}
|
|
21
|
+
|
|
36
22
|
/**
|
|
37
23
|
* 发送事件的辅助方法
|
|
38
24
|
* 支持使用WalletPassHooks或PaymentHooks
|
|
39
25
|
*/
|
|
40
26
|
emitEvent(hook, data) {
|
|
41
27
|
try {
|
|
42
|
-
|
|
28
|
+
// 提取事件名称,去掉模块前缀
|
|
29
|
+
const eventName = hook.split(':')[1] || hook.replace(/^[A-Z][a-z]+/, '').replace(/^On/, '').toLowerCase();
|
|
43
30
|
const fullEventName = `${this.paymentModule.name}:${eventName}`;
|
|
44
31
|
this.paymentModule.core.effects.emit(fullEventName, data);
|
|
45
32
|
} catch (error) {
|
|
46
|
-
this.paymentModule.logError(
|
|
47
|
-
hook
|
|
33
|
+
this.paymentModule.logError('[WalletPass] 发送事件失败', error, {
|
|
34
|
+
hook: hook
|
|
48
35
|
});
|
|
49
36
|
}
|
|
50
37
|
}
|
|
38
|
+
|
|
51
39
|
/**
|
|
52
40
|
* 生成钱包API默认参数
|
|
53
41
|
* 根据业务数据生成标准的钱包API参数,并存储在模块中
|
|
54
42
|
*/
|
|
55
43
|
generateWalletParams(businessData) {
|
|
56
|
-
var _a, _b;
|
|
57
44
|
const {
|
|
58
45
|
customer_id,
|
|
59
46
|
holder,
|
|
@@ -63,32 +50,36 @@ var WalletPassPaymentImpl = class {
|
|
|
63
50
|
payment_order_id,
|
|
64
51
|
is_price_include_tax
|
|
65
52
|
} = businessData;
|
|
53
|
+
|
|
54
|
+
// 转换金额为数字类型
|
|
66
55
|
const totalAmount = Number(amountInfo.totalAmount);
|
|
67
56
|
const subTotal = Number(amountInfo.subTotal);
|
|
68
57
|
const walletParams = {
|
|
69
58
|
is_price_include_tax,
|
|
70
|
-
sale_channel:
|
|
59
|
+
sale_channel: 'pos',
|
|
71
60
|
customer_id: customer_id || 0,
|
|
72
61
|
// 提供默认值,确保类型为 number
|
|
73
|
-
holder_id:
|
|
62
|
+
holder_id: holder?.form_record?.[0] || undefined,
|
|
74
63
|
order_expect_amount: totalAmount,
|
|
75
64
|
// 订单小计金额
|
|
76
65
|
order_product_amount: subTotal,
|
|
77
66
|
// 订单待支付金额
|
|
78
|
-
order_wait_pay_amount: order_wait_pay_amount || (
|
|
67
|
+
order_wait_pay_amount: order_wait_pay_amount || (amountInfo?.isDeposit ? Number(amountInfo?.depositAmount) : totalAmount),
|
|
79
68
|
// order_behavior_count_customer_id: 1,
|
|
80
69
|
products,
|
|
81
70
|
prepare_payments: [],
|
|
82
71
|
payment_order_id
|
|
83
72
|
};
|
|
73
|
+
|
|
74
|
+
// 存储生成的参数到模块中
|
|
84
75
|
this.walletParams = walletParams;
|
|
85
|
-
this.paymentModule.logInfo(
|
|
76
|
+
this.paymentModule.logInfo('[WalletPass] 钱包默认参数已生成并存储', {
|
|
86
77
|
customer_id: walletParams.customer_id,
|
|
87
78
|
holder_id: walletParams.holder_id,
|
|
88
79
|
order_expect_amount: walletParams.order_expect_amount,
|
|
89
80
|
order_product_amount: walletParams.order_product_amount,
|
|
90
81
|
order_wait_pay_amount: walletParams.order_wait_pay_amount,
|
|
91
|
-
products_count:
|
|
82
|
+
products_count: walletParams.products?.length || 0
|
|
92
83
|
});
|
|
93
84
|
this.walletInitData = {
|
|
94
85
|
transformList: [],
|
|
@@ -97,6 +88,7 @@ var WalletPassPaymentImpl = class {
|
|
|
97
88
|
};
|
|
98
89
|
return walletParams;
|
|
99
90
|
}
|
|
91
|
+
|
|
100
92
|
/**
|
|
101
93
|
* 获取已存储的钱包参数
|
|
102
94
|
* 返回之前生成并存储的钱包参数
|
|
@@ -104,23 +96,24 @@ var WalletPassPaymentImpl = class {
|
|
|
104
96
|
getStoredWalletParams() {
|
|
105
97
|
return this.walletParams;
|
|
106
98
|
}
|
|
99
|
+
|
|
107
100
|
/**
|
|
108
101
|
* 清理已存储的钱包参数
|
|
109
102
|
* 清除之前存储的钱包参数
|
|
110
103
|
*/
|
|
111
104
|
clearStoredWalletParams() {
|
|
112
105
|
this.walletParams = null;
|
|
113
|
-
this.paymentModule.logInfo(
|
|
106
|
+
this.paymentModule.logInfo('[WalletPass] 已存储的钱包参数已清理');
|
|
114
107
|
}
|
|
108
|
+
|
|
115
109
|
/**
|
|
116
110
|
* 从业务数据初始化钱包数据
|
|
117
111
|
* 内部生成参数,然后调用标准的初始化流程
|
|
118
112
|
*/
|
|
119
113
|
async initializeWalletDataFromBusinessAsync(businessData) {
|
|
120
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
121
114
|
const startTime = Date.now();
|
|
122
115
|
const walletParams = this.generateWalletParams(businessData);
|
|
123
|
-
if (Number(
|
|
116
|
+
if (Number(businessData?.amountInfo?.totalAmount || 0) < 0 || Number(businessData?.amountInfo?.subTotal || 0) < 0) {
|
|
124
117
|
return {
|
|
125
118
|
walletRecommendList: [],
|
|
126
119
|
userIdentificationCodes: [],
|
|
@@ -129,28 +122,36 @@ var WalletPassPaymentImpl = class {
|
|
|
129
122
|
products: []
|
|
130
123
|
};
|
|
131
124
|
}
|
|
132
|
-
if ([1, 0].includes(
|
|
125
|
+
if ([1, 0].includes(walletParams?.customer_id || 0)) {
|
|
133
126
|
return {
|
|
134
127
|
walletRecommendList: [],
|
|
135
128
|
userIdentificationCodes: []
|
|
136
129
|
};
|
|
137
130
|
}
|
|
138
|
-
|
|
131
|
+
|
|
132
|
+
// 发送初始化开始事件
|
|
133
|
+
this.emitEvent(_types.WalletPassHooks.OnWalletInitializationStarted, {
|
|
139
134
|
businessData,
|
|
140
135
|
startTime
|
|
141
136
|
});
|
|
142
|
-
this.paymentModule.logInfo(
|
|
137
|
+
this.paymentModule.logInfo('[WalletPass] 开始从业务数据初始化钱包数据', {
|
|
143
138
|
customer_id: businessData.customer_id,
|
|
144
|
-
totalAmount:
|
|
145
|
-
subTotal:
|
|
139
|
+
totalAmount: businessData.amountInfo?.totalAmount,
|
|
140
|
+
subTotal: businessData.amountInfo?.subTotal,
|
|
146
141
|
order_wait_pay_amount: businessData.order_wait_pay_amount,
|
|
147
|
-
products_count:
|
|
142
|
+
products_count: businessData.products?.length || 0
|
|
148
143
|
});
|
|
149
144
|
try {
|
|
145
|
+
// 生成钱包API参数
|
|
146
|
+
// const walletParams = this.generateWalletParams(businessData);
|
|
147
|
+
|
|
148
|
+
// 调用标准的初始化流程
|
|
150
149
|
const result = await this.initializeWalletDataAsync(walletParams);
|
|
151
150
|
const endTime = Date.now();
|
|
152
151
|
const duration = endTime - startTime;
|
|
153
|
-
|
|
152
|
+
|
|
153
|
+
// 发送初始化完成事件
|
|
154
|
+
this.emitEvent(_types.WalletPassHooks.OnWalletInitializationCompleted, {
|
|
154
155
|
businessData,
|
|
155
156
|
result,
|
|
156
157
|
startTime,
|
|
@@ -159,52 +160,50 @@ var WalletPassPaymentImpl = class {
|
|
|
159
160
|
});
|
|
160
161
|
this.paymentModule.logInfo(`[WalletPass] 从业务数据初始化钱包数据成功`, {
|
|
161
162
|
duration: `${duration}ms`,
|
|
162
|
-
walletRecommendList_count:
|
|
163
|
-
userIdentificationCodes_count:
|
|
163
|
+
walletRecommendList_count: result.walletRecommendList?.length || 0,
|
|
164
|
+
userIdentificationCodes_count: result.userIdentificationCodes?.length || 0
|
|
164
165
|
});
|
|
165
166
|
return result;
|
|
166
167
|
} catch (error) {
|
|
167
168
|
const endTime = Date.now();
|
|
168
169
|
const duration = endTime - startTime;
|
|
169
|
-
|
|
170
|
+
|
|
171
|
+
// 发送初始化失败事件
|
|
172
|
+
this.emitEvent(_types.WalletPassHooks.OnWalletInitializationFailed, {
|
|
170
173
|
businessData,
|
|
171
|
-
error,
|
|
174
|
+
error: error,
|
|
172
175
|
startTime,
|
|
173
176
|
endTime,
|
|
174
177
|
duration
|
|
175
178
|
});
|
|
176
|
-
this.paymentModule.logError(
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
customer_id: businessData.customer_id,
|
|
182
|
-
totalAmount: (_h = businessData.amountInfo) == null ? void 0 : _h.totalAmount
|
|
183
|
-
}
|
|
184
|
-
);
|
|
179
|
+
this.paymentModule.logError(`[WalletPass] 从业务数据初始化钱包数据失败`, error, {
|
|
180
|
+
duration: `${duration}ms`,
|
|
181
|
+
customer_id: businessData.customer_id,
|
|
182
|
+
totalAmount: businessData.amountInfo?.totalAmount
|
|
183
|
+
});
|
|
185
184
|
throw error;
|
|
186
185
|
}
|
|
187
186
|
}
|
|
187
|
+
|
|
188
188
|
/**
|
|
189
189
|
* 获取订单基础详情
|
|
190
190
|
*/
|
|
191
191
|
async getOrderBasicDetailAsync(orderId) {
|
|
192
192
|
try {
|
|
193
|
-
const response = await this.paymentModule.request.get(
|
|
194
|
-
|
|
195
|
-
);
|
|
196
|
-
return (response == null ? void 0 : response.data) || {};
|
|
193
|
+
const response = await this.paymentModule.request.get(`/order/order/${orderId}/basic-detail`);
|
|
194
|
+
return response?.data || {};
|
|
197
195
|
} catch (error) {
|
|
198
196
|
throw error;
|
|
199
197
|
}
|
|
200
198
|
}
|
|
199
|
+
|
|
201
200
|
/**
|
|
202
201
|
* 初始化钱包数据
|
|
203
202
|
* 先获取推荐列表,再获取用户识别码列表(顺序执行)
|
|
204
203
|
*/
|
|
205
204
|
async initializeWalletDataAsync(baseParams) {
|
|
206
|
-
var _a, _b;
|
|
207
205
|
try {
|
|
206
|
+
// 格式化用户识别码列表参数
|
|
208
207
|
const identificationParams = {
|
|
209
208
|
...baseParams,
|
|
210
209
|
available: 2,
|
|
@@ -212,11 +211,10 @@ var WalletPassPaymentImpl = class {
|
|
|
212
211
|
other_exact_codes: [],
|
|
213
212
|
filter_prepare_wallet_pass: 1
|
|
214
213
|
};
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
const walletPassEvaluator = (_b = (_a = this.paymentModule.window) == null ? void 0 : _a.getWalletPassEvaluator) == null ? void 0 : _b.call(_a);
|
|
214
|
+
|
|
215
|
+
// 并行获取用户识别码列表和订单详情
|
|
216
|
+
const [allList, orderBasicDetail] = await Promise.all([this.getUserIdentificationCodeListAsync(identificationParams), baseParams.payment_order_id && typeof baseParams.payment_order_id === 'string' && !baseParams.payment_order_id.startsWith('LOCAL_') ? this.getOrderBasicDetailAsync(baseParams.payment_order_id) : Promise.resolve(null)]);
|
|
217
|
+
const walletPassEvaluator = this.paymentModule.window?.getWalletPassEvaluator?.();
|
|
220
218
|
if (!walletPassEvaluator) {
|
|
221
219
|
return {
|
|
222
220
|
walletRecommendList: [],
|
|
@@ -226,29 +224,40 @@ var WalletPassPaymentImpl = class {
|
|
|
226
224
|
products: []
|
|
227
225
|
};
|
|
228
226
|
}
|
|
229
|
-
const products =
|
|
230
|
-
const res = walletPassEvaluator
|
|
227
|
+
const products = orderBasicDetail?.detail || baseParams.products;
|
|
228
|
+
const res = walletPassEvaluator?.getRecommendedVouchers({
|
|
231
229
|
orderTotalAmount: baseParams.order_wait_pay_amount,
|
|
232
|
-
products,
|
|
230
|
+
products: products,
|
|
233
231
|
vouchers: allList
|
|
234
232
|
});
|
|
235
|
-
const {
|
|
236
|
-
|
|
237
|
-
this.walletRecommendList = recommended;
|
|
238
|
-
this.walletInitData = {
|
|
233
|
+
const {
|
|
234
|
+
recommended,
|
|
239
235
|
transformList,
|
|
240
236
|
noApplicableVoucher,
|
|
237
|
+
recommendedAmount
|
|
238
|
+
} = res;
|
|
239
|
+
this.walletRecommendList = recommended;
|
|
240
|
+
|
|
241
|
+
// 存储初始化数据到内存中,供 useWalletPass 使用
|
|
242
|
+
this.walletInitData = {
|
|
243
|
+
transformList: transformList,
|
|
244
|
+
noApplicableVoucher: noApplicableVoucher,
|
|
241
245
|
products: products || []
|
|
242
246
|
};
|
|
247
|
+
|
|
248
|
+
// // 再获取用户识别码列表
|
|
249
|
+
// const userIdentificationCodes =
|
|
250
|
+
// await this.getUserIdentificationCodeListAsync(identificationParams);
|
|
251
|
+
|
|
243
252
|
return {
|
|
244
253
|
walletRecommendList: recommended,
|
|
245
254
|
userIdentificationCodes: allList,
|
|
246
|
-
transformList,
|
|
247
|
-
noApplicableVoucher,
|
|
255
|
+
transformList: transformList,
|
|
256
|
+
noApplicableVoucher: noApplicableVoucher,
|
|
248
257
|
products: products || []
|
|
249
258
|
};
|
|
250
259
|
} catch (error) {
|
|
251
|
-
this.paymentModule.logError(
|
|
260
|
+
this.paymentModule.logError('[WalletPass] 初始化钱包数据失败', error, {
|
|
252
261
|
customer_id: baseParams.customer_id,
|
|
253
262
|
order_expect_amount: baseParams.order_expect_amount
|
|
254
263
|
});
|
|
@@ -256,26 +265,27 @@ var WalletPassPaymentImpl = class {
|
|
|
256
265
|
}
|
|
257
266
|
}
|
|
258
267
|
async getWalletPassRecommendListAsync(params) {
|
|
259
|
-
var _a;
|
|
260
268
|
try {
|
|
261
|
-
this.paymentModule.logInfo(
|
|
269
|
+
this.paymentModule.logInfo('[WalletPass] 开始获取钱包推荐列表', {
|
|
262
270
|
customer_id: params.customer_id,
|
|
263
271
|
order_expect_amount: params.order_expect_amount,
|
|
264
272
|
sale_channel: params.sale_channel,
|
|
265
|
-
payment_order_id:
|
|
273
|
+
payment_order_id: this.walletParams?.payment_order_id
|
|
266
274
|
});
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
275
|
+
if (typeof params.payment_order_id === 'string' && params.payment_order_id.startsWith('LOCAL_')) {
|
|
276
|
+
params.payment_order_id = undefined;
|
|
277
|
+
}
|
|
278
|
+
const response = await this.paymentModule.request.post('/machinecode/prepare/deduction/recommend', params // 将 params 作为请求体数据
|
|
271
279
|
);
|
|
272
|
-
this.walletRecommendList =
|
|
273
|
-
|
|
280
|
+
this.walletRecommendList = response?.data || [];
|
|
281
|
+
|
|
282
|
+
// 发送钱包推荐列表更新事件(使用专用的WalletPassHooks)
|
|
283
|
+
this.emitEvent(_types.WalletPassHooks.OnWalletRecommendListUpdated, {
|
|
274
284
|
walletRecommendList: this.walletRecommendList
|
|
275
285
|
});
|
|
276
|
-
this.paymentModule.logInfo(
|
|
286
|
+
this.paymentModule.logInfo('[WalletPass] 钱包推荐列表已更新', {
|
|
277
287
|
count: this.walletRecommendList.length,
|
|
278
|
-
items: this.walletRecommendList.map(
|
|
288
|
+
items: this.walletRecommendList.map(item => ({
|
|
279
289
|
voucher_id: item.voucher_id,
|
|
280
290
|
name: item.name,
|
|
281
291
|
amount: item.amount,
|
|
@@ -284,43 +294,50 @@ var WalletPassPaymentImpl = class {
|
|
|
284
294
|
});
|
|
285
295
|
return this.walletRecommendList;
|
|
286
296
|
} catch (error) {
|
|
287
|
-
this.paymentModule.logError(
|
|
297
|
+
this.paymentModule.logError('[WalletPass] 获取钱包推荐列表失败', error, {
|
|
288
298
|
customer_id: params.customer_id,
|
|
289
299
|
order_expect_amount: params.order_expect_amount,
|
|
290
300
|
sale_channel: params.sale_channel
|
|
291
301
|
});
|
|
302
|
+
// throw error;
|
|
292
303
|
return [];
|
|
293
304
|
}
|
|
294
305
|
}
|
|
295
306
|
formatWalletPassList2PreparePayments(list) {
|
|
296
|
-
return (0,
|
|
307
|
+
return (0, _utils.formatWalletPassList2PreparePayments)(list);
|
|
297
308
|
}
|
|
298
309
|
async getUserIdentificationCodeListAsync(params) {
|
|
299
|
-
var _a, _b;
|
|
300
310
|
try {
|
|
301
311
|
const newParams = {
|
|
302
312
|
...this.walletParams,
|
|
303
313
|
...params
|
|
304
314
|
};
|
|
305
|
-
|
|
315
|
+
if (!newParams.products?.length) {
|
|
316
|
+
this.paymentModule.logInfo('[WalletPass] 商品列表为空,跳过获取用户识别码列表');
|
|
317
|
+
return [];
|
|
318
|
+
}
|
|
319
|
+
if (typeof newParams.payment_order_id === 'string' && newParams.payment_order_id.startsWith('LOCAL_')) {
|
|
320
|
+
newParams.payment_order_id = undefined;
|
|
321
|
+
}
|
|
322
|
+
this.paymentModule.logInfo('[WalletPass] 开始获取用户识别码列表', {
|
|
306
323
|
customer_id: newParams.customer_id,
|
|
307
324
|
available: newParams.available,
|
|
308
|
-
prepare_payments_count:
|
|
325
|
+
prepare_payments_count: newParams.prepare_payments?.length || 0,
|
|
309
326
|
filter_prepare_wallet_pass: newParams.filter_prepare_wallet_pass,
|
|
310
|
-
payment_order_id:
|
|
327
|
+
payment_order_id: this.walletParams?.payment_order_id
|
|
311
328
|
});
|
|
312
|
-
const response = await this.paymentModule.request.post(
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
);
|
|
316
|
-
const sortedData = (0, import_utils.sortUserIdentificationCodeList)((response == null ? void 0 : response.data) || []);
|
|
329
|
+
const response = await this.paymentModule.request.post('/machinecode/prepare/deduction', newParams);
|
|
330
|
+
// 对获取到的数据进行排序,将错误码为 500100、500200、500300 的项目排到最后
|
|
331
|
+
const sortedData = (0, _utils.sortUserIdentificationCodeList)(response?.data || []);
|
|
317
332
|
this.userIdentificationCodes = sortedData;
|
|
318
|
-
|
|
333
|
+
|
|
334
|
+
// 发送用户识别码列表更新事件(使用专用的WalletPassHooks)
|
|
335
|
+
this.emitEvent(_types.WalletPassHooks.OnUserIdentificationCodesUpdated, {
|
|
319
336
|
userIdentificationCodes: this.userIdentificationCodes
|
|
320
337
|
});
|
|
321
|
-
this.paymentModule.logInfo(
|
|
338
|
+
this.paymentModule.logInfo('[WalletPass] 用户识别码列表已更新', {
|
|
322
339
|
count: this.userIdentificationCodes.length,
|
|
323
|
-
sorted_items: this.userIdentificationCodes.slice(0, 5).map(
|
|
340
|
+
sorted_items: this.userIdentificationCodes.slice(0, 5).map(item => ({
|
|
324
341
|
code: item.code,
|
|
325
342
|
error_code: item.error_code,
|
|
326
343
|
error_msg: item.error_msg
|
|
@@ -328,17 +345,14 @@ var WalletPassPaymentImpl = class {
|
|
|
328
345
|
});
|
|
329
346
|
return this.userIdentificationCodes;
|
|
330
347
|
} catch (error) {
|
|
331
|
-
this.paymentModule.logError(
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
customer_id: params.customer_id,
|
|
336
|
-
available: params.available
|
|
337
|
-
}
|
|
338
|
-
);
|
|
348
|
+
this.paymentModule.logError('[WalletPass] 获取用户识别码列表失败', error, {
|
|
349
|
+
customer_id: params.customer_id,
|
|
350
|
+
available: params.available
|
|
351
|
+
});
|
|
339
352
|
return [];
|
|
340
353
|
}
|
|
341
354
|
}
|
|
355
|
+
|
|
342
356
|
/**
|
|
343
357
|
* 搜索识别码信息
|
|
344
358
|
* 通过识别码搜索相关的钱包通行证信息
|
|
@@ -346,109 +360,115 @@ var WalletPassPaymentImpl = class {
|
|
|
346
360
|
* 特殊逻辑:当识别码长度为9位且前3位为"000"时,调用 /wallet/detail/search 接口
|
|
347
361
|
*/
|
|
348
362
|
async searchIdentificationCodeAsync(params, config = {}) {
|
|
349
|
-
var _a;
|
|
350
363
|
try {
|
|
351
|
-
const {
|
|
352
|
-
|
|
353
|
-
|
|
364
|
+
const {
|
|
365
|
+
code
|
|
366
|
+
} = params;
|
|
367
|
+
this.paymentModule.logInfo('[WalletPass] 开始搜索识别码', {
|
|
368
|
+
code: code,
|
|
354
369
|
code_length: code.length,
|
|
355
370
|
noCache: config.noCache || false
|
|
356
371
|
});
|
|
357
|
-
|
|
372
|
+
|
|
373
|
+
// 新钱包规则
|
|
374
|
+
const isWalletCode = code.startsWith('WL') || code.startsWith('200') && code.length === 10;
|
|
358
375
|
if (isWalletCode) {
|
|
376
|
+
// 钱包识别码直接调用专门接口,不缓存,直接返回
|
|
359
377
|
const walletDetailParams = {
|
|
360
|
-
code,
|
|
378
|
+
code: code,
|
|
361
379
|
with_customer: 1,
|
|
362
|
-
with: [
|
|
380
|
+
with: ['wallet']
|
|
363
381
|
};
|
|
364
|
-
this.paymentModule.logInfo(
|
|
365
|
-
code,
|
|
382
|
+
this.paymentModule.logInfo('[WalletPass] 搜索钱包识别码', {
|
|
383
|
+
code: code,
|
|
366
384
|
with_customer: walletDetailParams.with_customer,
|
|
367
385
|
with: walletDetailParams.with
|
|
368
386
|
});
|
|
369
|
-
const
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
code,
|
|
376
|
-
results_count: searchResults2.length,
|
|
377
|
-
type: "walletCode"
|
|
387
|
+
const response = await this.paymentModule.request.post('/wallet/detail/search', walletDetailParams);
|
|
388
|
+
const searchResults = response?.data || [];
|
|
389
|
+
this.paymentModule.logInfo('[WalletPass] 钱包识别码搜索完成', {
|
|
390
|
+
code: code,
|
|
391
|
+
results_count: searchResults.length,
|
|
392
|
+
type: 'walletCode'
|
|
378
393
|
});
|
|
379
394
|
return {
|
|
380
|
-
type:
|
|
381
|
-
data:
|
|
395
|
+
type: 'walletCode',
|
|
396
|
+
data: searchResults
|
|
382
397
|
};
|
|
383
398
|
}
|
|
399
|
+
|
|
400
|
+
// 合并钱包参数和搜索参数
|
|
384
401
|
const baseWalletParams = this.walletParams;
|
|
402
|
+
|
|
403
|
+
// 构建完整的搜索参数,包含钱包扣款推荐的所有参数
|
|
385
404
|
const searchParams = {
|
|
386
405
|
// 基础钱包参数
|
|
387
|
-
sale_channel: params.sale_channel ||
|
|
388
|
-
customer_id: params.customer_id ||
|
|
389
|
-
order_expect_amount: params.order_expect_amount ||
|
|
390
|
-
order_product_amount: params.order_product_amount ||
|
|
391
|
-
order_wait_pay_amount: params.order_wait_pay_amount ||
|
|
392
|
-
order_behavior_count_customer_id: params.order_behavior_count_customer_id ||
|
|
393
|
-
products: params.products ||
|
|
394
|
-
prepare_payments: params.prepare_payments ||
|
|
406
|
+
sale_channel: params.sale_channel || baseWalletParams?.sale_channel || 'pos',
|
|
407
|
+
customer_id: params.customer_id || baseWalletParams?.customer_id,
|
|
408
|
+
order_expect_amount: params.order_expect_amount || baseWalletParams?.order_expect_amount,
|
|
409
|
+
order_product_amount: params.order_product_amount || baseWalletParams?.order_product_amount,
|
|
410
|
+
order_wait_pay_amount: params.order_wait_pay_amount || baseWalletParams?.order_wait_pay_amount,
|
|
411
|
+
order_behavior_count_customer_id: params.order_behavior_count_customer_id || baseWalletParams?.order_behavior_count_customer_id || params.customer_id || baseWalletParams?.customer_id,
|
|
412
|
+
products: params.products || baseWalletParams?.products,
|
|
413
|
+
prepare_payments: params.prepare_payments || baseWalletParams?.prepare_payments,
|
|
395
414
|
multiple: 1,
|
|
396
415
|
// 搜索特有参数
|
|
397
416
|
code: params.code,
|
|
398
|
-
payment_order_id: baseWalletParams
|
|
417
|
+
payment_order_id: baseWalletParams?.payment_order_id
|
|
399
418
|
};
|
|
400
|
-
this.paymentModule.logInfo(
|
|
419
|
+
this.paymentModule.logInfo('[WalletPass] 搜索普通识别码', {
|
|
401
420
|
code: searchParams.code,
|
|
402
421
|
customer_id: searchParams.customer_id,
|
|
403
422
|
order_expect_amount: searchParams.order_expect_amount,
|
|
404
423
|
multiple: searchParams.multiple,
|
|
405
|
-
payment_order_id: baseWalletParams
|
|
424
|
+
payment_order_id: baseWalletParams?.payment_order_id
|
|
406
425
|
});
|
|
426
|
+
if (typeof searchParams.payment_order_id === 'string' && searchParams.payment_order_id.startsWith('LOCAL_')) {
|
|
427
|
+
searchParams.payment_order_id = undefined;
|
|
428
|
+
}
|
|
407
429
|
let response;
|
|
408
|
-
if (!searchParams.products || (
|
|
430
|
+
if (!searchParams.products || (searchParams.products || [])?.length === 0) {
|
|
409
431
|
response = {
|
|
410
432
|
data: []
|
|
411
433
|
};
|
|
412
434
|
} else {
|
|
413
|
-
response = await this.paymentModule.request.post(
|
|
414
|
-
"/machinecode/prepare/deduction/search",
|
|
415
|
-
searchParams
|
|
416
|
-
);
|
|
435
|
+
response = await this.paymentModule.request.post('/machinecode/prepare/deduction/search', searchParams);
|
|
417
436
|
}
|
|
418
|
-
const searchResults =
|
|
437
|
+
const searchResults = response?.data || [];
|
|
419
438
|
if (config.noCache) {
|
|
420
439
|
return {
|
|
421
|
-
type:
|
|
440
|
+
type: 'normalCode',
|
|
422
441
|
data: searchResults
|
|
423
442
|
};
|
|
424
443
|
}
|
|
444
|
+
|
|
445
|
+
// 将搜索结果存储到缓存数组中
|
|
425
446
|
if (searchResults.length > 0) {
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
);
|
|
429
|
-
const newResults = searchResults.filter(
|
|
430
|
-
(item) => !existingCodes.has(item.code)
|
|
431
|
-
);
|
|
447
|
+
// 避免重复存储相同的识别码
|
|
448
|
+
const existingCodes = new Set(this.searchResults.map(item => item.code));
|
|
449
|
+
const newResults = searchResults.filter(item => !existingCodes.has(item.code));
|
|
432
450
|
this.searchResults.push(...newResults);
|
|
433
451
|
}
|
|
434
|
-
|
|
452
|
+
|
|
453
|
+
// 通过事件暴露当前搜索结果和缓存结果
|
|
454
|
+
this.emitEvent(_types.WalletPassHooks.OnSearchIdentificationCodeCompleted, {
|
|
435
455
|
searchCode: params.code,
|
|
436
456
|
currentSearchResults: searchResults,
|
|
437
457
|
cachedSearchResults: [...this.searchResults],
|
|
438
458
|
searchParams: params
|
|
439
459
|
});
|
|
440
|
-
this.paymentModule.logInfo(
|
|
460
|
+
this.paymentModule.logInfo('[WalletPass] 普通识别码搜索完成', {
|
|
441
461
|
code: params.code,
|
|
442
462
|
results_count: searchResults.length,
|
|
443
463
|
cached_results_count: this.searchResults.length,
|
|
444
|
-
type:
|
|
464
|
+
type: 'normalCode'
|
|
445
465
|
});
|
|
446
466
|
return {
|
|
447
|
-
type:
|
|
467
|
+
type: 'normalCode',
|
|
448
468
|
data: searchResults
|
|
449
469
|
};
|
|
450
470
|
} catch (error) {
|
|
451
|
-
this.paymentModule.logError(
|
|
471
|
+
this.paymentModule.logError('[WalletPass] 搜索识别码信息失败', error, {
|
|
452
472
|
code: params.code,
|
|
453
473
|
customer_id: params.customer_id,
|
|
454
474
|
order_expect_amount: params.order_expect_amount
|
|
@@ -457,19 +477,19 @@ var WalletPassPaymentImpl = class {
|
|
|
457
477
|
}
|
|
458
478
|
}
|
|
459
479
|
async processWalletPayment(amount, orderUuid, voucherId) {
|
|
460
|
-
this.paymentModule.logInfo(
|
|
461
|
-
amount,
|
|
462
|
-
orderUuid,
|
|
463
|
-
voucherId: voucherId ||
|
|
480
|
+
this.paymentModule.logInfo('[WalletPass] 开始处理钱包支付', {
|
|
481
|
+
amount: amount,
|
|
482
|
+
orderUuid: orderUuid,
|
|
483
|
+
voucherId: voucherId || 'none'
|
|
464
484
|
});
|
|
465
485
|
const walletMethod = await this.paymentModule.getWalletPaymentMethod();
|
|
466
486
|
if (!walletMethod) {
|
|
467
|
-
this.paymentModule.logError(
|
|
468
|
-
amount,
|
|
469
|
-
orderUuid,
|
|
470
|
-
voucherId
|
|
487
|
+
this.paymentModule.logError('[WalletPass] 钱包支付方式未找到', null, {
|
|
488
|
+
amount: amount,
|
|
489
|
+
orderUuid: orderUuid,
|
|
490
|
+
voucherId: voucherId
|
|
471
491
|
});
|
|
472
|
-
throw new Error(
|
|
492
|
+
throw new Error('钱包支付方式未找到');
|
|
473
493
|
}
|
|
474
494
|
const paymentItem = {
|
|
475
495
|
amount: amount.toString(),
|
|
@@ -477,83 +497,98 @@ var WalletPassPaymentImpl = class {
|
|
|
477
497
|
custom_payment_id: walletMethod.id,
|
|
478
498
|
name: walletMethod.name,
|
|
479
499
|
type: walletMethod.type,
|
|
480
|
-
voucher_id: voucherId ||
|
|
500
|
+
voucher_id: voucherId || ''
|
|
481
501
|
};
|
|
482
502
|
await this.paymentModule.addPaymentItemAsync(orderUuid, paymentItem);
|
|
483
|
-
this.paymentModule.logInfo(
|
|
484
|
-
amount,
|
|
485
|
-
orderUuid,
|
|
486
|
-
voucherId: voucherId ||
|
|
503
|
+
this.paymentModule.logInfo('[WalletPass] 钱包支付处理完成', {
|
|
504
|
+
amount: amount,
|
|
505
|
+
orderUuid: orderUuid,
|
|
506
|
+
voucherId: voucherId || 'none',
|
|
487
507
|
payment_method: walletMethod.name
|
|
488
508
|
});
|
|
489
509
|
}
|
|
490
510
|
async getWalletBalance(voucherId) {
|
|
511
|
+
// 获取钱包余额的逻辑
|
|
491
512
|
return 0;
|
|
492
513
|
}
|
|
514
|
+
|
|
493
515
|
/**
|
|
494
516
|
* 获取缓存的钱包推荐列表
|
|
495
517
|
*/
|
|
496
518
|
getWalletRecommendList() {
|
|
497
519
|
return this.walletRecommendList;
|
|
498
520
|
}
|
|
521
|
+
|
|
499
522
|
/**
|
|
500
523
|
* 获取缓存的用户识别码列表
|
|
501
524
|
*/
|
|
502
525
|
getUserIdentificationCodes() {
|
|
503
526
|
return this.userIdentificationCodes;
|
|
504
527
|
}
|
|
528
|
+
|
|
505
529
|
/**
|
|
506
530
|
* 清除钱包推荐列表
|
|
507
531
|
*/
|
|
508
532
|
clearWalletRecommendList() {
|
|
509
533
|
this.walletRecommendList = [];
|
|
510
|
-
|
|
511
|
-
|
|
534
|
+
|
|
535
|
+
// 发送钱包推荐列表清除事件
|
|
536
|
+
this.emitEvent(_types.WalletPassHooks.OnWalletRecommendListCleared, {
|
|
537
|
+
clearedTypes: ['walletRecommendList']
|
|
512
538
|
});
|
|
513
|
-
this.paymentModule.logInfo(
|
|
539
|
+
this.paymentModule.logInfo('[WalletPass] 钱包推荐列表已清除');
|
|
514
540
|
}
|
|
541
|
+
|
|
515
542
|
/**
|
|
516
543
|
* 清除用户识别码列表
|
|
517
544
|
*/
|
|
518
545
|
clearUserIdentificationCodes() {
|
|
519
546
|
this.userIdentificationCodes = [];
|
|
520
|
-
|
|
521
|
-
|
|
547
|
+
|
|
548
|
+
// 发送用户识别码列表清除事件
|
|
549
|
+
this.emitEvent(_types.WalletPassHooks.OnUserIdentificationCodesCleared, {
|
|
550
|
+
clearedTypes: ['userIdentificationCodes']
|
|
522
551
|
});
|
|
523
|
-
this.paymentModule.logInfo(
|
|
552
|
+
this.paymentModule.logInfo('[WalletPass] 用户识别码列表已清除');
|
|
524
553
|
}
|
|
554
|
+
|
|
525
555
|
/**
|
|
526
556
|
* 获取缓存的搜索结果列表
|
|
527
557
|
*/
|
|
528
558
|
getSearchResults() {
|
|
529
559
|
return this.searchResults;
|
|
530
560
|
}
|
|
561
|
+
|
|
531
562
|
/**
|
|
532
563
|
* 根据识别码查找搜索结果
|
|
533
564
|
*/
|
|
534
565
|
findSearchResultByCode(code) {
|
|
535
|
-
return this.searchResults.find(
|
|
566
|
+
return this.searchResults.find(item => item.code === code);
|
|
536
567
|
}
|
|
568
|
+
|
|
537
569
|
/**
|
|
538
570
|
* 清除搜索结果缓存
|
|
539
571
|
*/
|
|
540
572
|
clearSearchResults() {
|
|
541
573
|
this.searchResults = [];
|
|
542
|
-
this.paymentModule.logInfo(
|
|
574
|
+
this.paymentModule.logInfo('[WalletPass] 搜索结果缓存已清除');
|
|
543
575
|
}
|
|
576
|
+
|
|
544
577
|
/**
|
|
545
578
|
* 获取存储的钱包初始化数据
|
|
546
579
|
*/
|
|
547
580
|
getStoredWalletInitData() {
|
|
548
581
|
return this.walletInitData;
|
|
549
582
|
}
|
|
583
|
+
|
|
550
584
|
/**
|
|
551
585
|
* 清除存储的钱包初始化数据
|
|
552
586
|
*/
|
|
553
587
|
clearStoredWalletInitData() {
|
|
554
588
|
this.walletInitData = null;
|
|
555
|
-
this.paymentModule.logInfo(
|
|
589
|
+
this.paymentModule.logInfo('[WalletPass] 钱包初始化数据已清除');
|
|
556
590
|
}
|
|
591
|
+
|
|
557
592
|
/**
|
|
558
593
|
* 清除所有缓存数据
|
|
559
594
|
*/
|
|
@@ -563,21 +598,14 @@ var WalletPassPaymentImpl = class {
|
|
|
563
598
|
this.searchResults = [];
|
|
564
599
|
this.walletParams = null;
|
|
565
600
|
this.walletInitData = null;
|
|
566
|
-
|
|
567
|
-
|
|
601
|
+
|
|
602
|
+
// 发送所有缓存清除事件
|
|
603
|
+
this.emitEvent(_types.WalletPassHooks.OnWalletCacheCleared, {
|
|
604
|
+
clearedTypes: ['all']
|
|
568
605
|
});
|
|
569
|
-
this.paymentModule.logInfo(
|
|
570
|
-
cleared_types: [
|
|
571
|
-
"walletRecommendList",
|
|
572
|
-
"userIdentificationCodes",
|
|
573
|
-
"searchResults",
|
|
574
|
-
"walletParams",
|
|
575
|
-
"walletInitData"
|
|
576
|
-
]
|
|
606
|
+
this.paymentModule.logInfo('[WalletPass] 所有缓存数据已清除', {
|
|
607
|
+
cleared_types: ['walletRecommendList', 'userIdentificationCodes', 'searchResults', 'walletParams', 'walletInitData']
|
|
577
608
|
});
|
|
578
609
|
}
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
0 && (module.exports = {
|
|
582
|
-
WalletPassPaymentImpl
|
|
583
|
-
});
|
|
610
|
+
}
|
|
611
|
+
exports.WalletPassPaymentImpl = WalletPassPaymentImpl;
|