@unchainedshop/core 3.0.0-alpha7 → 3.0.0-rc10
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/lib/core-index.d.ts +8 -61
- package/lib/core-index.d.ts.map +1 -1
- package/lib/core-index.js +9 -140
- package/lib/core-index.js.map +1 -1
- package/lib/directors/BaseDiscountAdapter.d.ts +36 -0
- package/lib/directors/BaseDiscountAdapter.d.ts.map +1 -0
- package/lib/directors/BaseDiscountAdapter.js +48 -0
- package/lib/directors/BaseDiscountAdapter.js.map +1 -0
- package/lib/directors/BaseDiscountDirector.d.ts +15 -0
- package/lib/directors/BaseDiscountDirector.d.ts.map +1 -0
- package/lib/directors/BaseDiscountDirector.js +45 -0
- package/lib/directors/BaseDiscountDirector.js.map +1 -0
- package/lib/directors/BasePricingAdapter.d.ts +34 -0
- package/lib/directors/BasePricingAdapter.d.ts.map +1 -0
- package/lib/directors/BasePricingAdapter.js +25 -0
- package/lib/directors/BasePricingAdapter.js.map +1 -0
- package/lib/directors/BasePricingDirector.d.ts +17 -0
- package/lib/directors/BasePricingDirector.d.ts.map +1 -0
- package/lib/directors/BasePricingDirector.js +70 -0
- package/lib/directors/BasePricingDirector.js.map +1 -0
- package/lib/directors/BasePricingSheet.d.ts +46 -0
- package/lib/directors/BasePricingSheet.d.ts.map +1 -0
- package/lib/directors/BasePricingSheet.js +74 -0
- package/lib/directors/BasePricingSheet.js.map +1 -0
- package/lib/directors/DeliveryAdapter.d.ts +46 -0
- package/lib/directors/DeliveryAdapter.d.ts.map +1 -0
- package/lib/directors/DeliveryAdapter.js +50 -0
- package/lib/directors/DeliveryAdapter.js.map +1 -0
- package/lib/directors/DeliveryDirector.d.ts +15 -0
- package/lib/directors/DeliveryDirector.d.ts.map +1 -0
- package/lib/directors/DeliveryDirector.js +96 -0
- package/lib/directors/DeliveryDirector.js.map +1 -0
- package/lib/directors/DeliveryPricingAdapter.d.ts +49 -0
- package/lib/directors/DeliveryPricingAdapter.d.ts.map +1 -0
- package/lib/directors/DeliveryPricingAdapter.js +25 -0
- package/lib/directors/DeliveryPricingAdapter.js.map +1 -0
- package/lib/directors/DeliveryPricingDirector.d.ts +20 -0
- package/lib/directors/DeliveryPricingDirector.d.ts.map +1 -0
- package/lib/directors/DeliveryPricingDirector.js +50 -0
- package/lib/directors/DeliveryPricingDirector.js.map +1 -0
- package/lib/directors/DeliveryPricingSheet.d.ts +10 -0
- package/lib/directors/DeliveryPricingSheet.d.ts.map +1 -0
- package/lib/directors/DeliveryPricingSheet.js +75 -0
- package/lib/directors/DeliveryPricingSheet.js.map +1 -0
- package/lib/directors/EnrollmentAdapter.d.ts +27 -0
- package/lib/directors/EnrollmentAdapter.d.ts.map +1 -0
- package/lib/directors/EnrollmentAdapter.js +73 -0
- package/lib/directors/EnrollmentAdapter.js.map +1 -0
- package/lib/directors/EnrollmentDirector.d.ts +14 -0
- package/lib/directors/EnrollmentDirector.d.ts.map +1 -0
- package/lib/directors/EnrollmentDirector.js +44 -0
- package/lib/directors/EnrollmentDirector.js.map +1 -0
- package/lib/directors/FilterAdapter.d.ts +54 -0
- package/lib/directors/FilterAdapter.d.ts.map +1 -0
- package/lib/directors/FilterAdapter.js +38 -0
- package/lib/directors/FilterAdapter.js.map +1 -0
- package/lib/directors/FilterDirector.d.ts +40 -0
- package/lib/directors/FilterDirector.d.ts.map +1 -0
- package/lib/directors/FilterDirector.js +173 -0
- package/lib/directors/FilterDirector.js.map +1 -0
- package/lib/directors/MessagingDirector.d.ts +46 -0
- package/lib/directors/MessagingDirector.d.ts.map +1 -0
- package/lib/directors/MessagingDirector.js +10 -0
- package/lib/directors/MessagingDirector.js.map +1 -0
- package/lib/directors/OrderDiscountAdapter.d.ts +3 -0
- package/lib/directors/OrderDiscountAdapter.d.ts.map +1 -0
- package/lib/directors/OrderDiscountAdapter.js +3 -0
- package/lib/directors/OrderDiscountAdapter.js.map +1 -0
- package/lib/directors/OrderDiscountConfiguration.d.ts +6 -0
- package/lib/directors/OrderDiscountConfiguration.d.ts.map +1 -0
- package/lib/directors/OrderDiscountConfiguration.js +2 -0
- package/lib/directors/OrderDiscountConfiguration.js.map +1 -0
- package/lib/directors/OrderDiscountDirector.d.ts +3 -0
- package/lib/directors/OrderDiscountDirector.d.ts.map +1 -0
- package/lib/directors/OrderDiscountDirector.js +3 -0
- package/lib/directors/OrderDiscountDirector.js.map +1 -0
- package/lib/directors/OrderPricingAdapter.d.ts +18 -0
- package/lib/directors/OrderPricingAdapter.d.ts.map +1 -0
- package/lib/directors/OrderPricingAdapter.js +24 -0
- package/lib/directors/OrderPricingAdapter.js.map +1 -0
- package/lib/directors/OrderPricingDirector.d.ts +18 -0
- package/lib/directors/OrderPricingDirector.d.ts.map +1 -0
- package/lib/directors/OrderPricingDirector.js +31 -0
- package/lib/directors/OrderPricingDirector.js.map +1 -0
- package/lib/directors/OrderPricingSheet.d.ts +37 -0
- package/lib/directors/OrderPricingSheet.d.ts.map +1 -0
- package/lib/directors/OrderPricingSheet.js +108 -0
- package/lib/directors/OrderPricingSheet.js.map +1 -0
- package/lib/directors/PaymentAdapter.d.ts +50 -0
- package/lib/directors/PaymentAdapter.d.ts.map +1 -0
- package/lib/directors/PaymentAdapter.js +55 -0
- package/lib/directors/PaymentAdapter.js.map +1 -0
- package/lib/directors/PaymentDirector.d.ts +21 -0
- package/lib/directors/PaymentDirector.d.ts.map +1 -0
- package/lib/directors/PaymentDirector.js +172 -0
- package/lib/directors/PaymentDirector.js.map +1 -0
- package/lib/directors/PaymentPricingAdapter.d.ts +48 -0
- package/lib/directors/PaymentPricingAdapter.d.ts.map +1 -0
- package/lib/directors/PaymentPricingAdapter.js +25 -0
- package/lib/directors/PaymentPricingAdapter.js.map +1 -0
- package/lib/directors/PaymentPricingDirector.d.ts +18 -0
- package/lib/directors/PaymentPricingDirector.d.ts.map +1 -0
- package/lib/directors/PaymentPricingDirector.js +51 -0
- package/lib/directors/PaymentPricingDirector.js.map +1 -0
- package/lib/directors/PaymentPricingSheet.d.ts +9 -0
- package/lib/directors/PaymentPricingSheet.d.ts.map +1 -0
- package/lib/directors/PaymentPricingSheet.js +75 -0
- package/lib/directors/PaymentPricingSheet.js.map +1 -0
- package/lib/directors/ProductDiscountAdapter.d.ts +3 -0
- package/lib/directors/ProductDiscountAdapter.d.ts.map +1 -0
- package/lib/directors/ProductDiscountAdapter.js +3 -0
- package/lib/directors/ProductDiscountAdapter.js.map +1 -0
- package/lib/directors/ProductDiscountConfiguration.d.ts +13 -0
- package/lib/directors/ProductDiscountConfiguration.d.ts.map +1 -0
- package/lib/directors/ProductDiscountConfiguration.js +2 -0
- package/lib/directors/ProductDiscountConfiguration.js.map +1 -0
- package/lib/directors/ProductDiscountDirector.d.ts +3 -0
- package/lib/directors/ProductDiscountDirector.d.ts.map +1 -0
- package/lib/directors/ProductDiscountDirector.js +3 -0
- package/lib/directors/ProductDiscountDirector.js.map +1 -0
- package/lib/directors/ProductPricingAdapter.d.ts +19 -0
- package/lib/directors/ProductPricingAdapter.d.ts.map +1 -0
- package/lib/directors/ProductPricingAdapter.js +24 -0
- package/lib/directors/ProductPricingAdapter.js.map +1 -0
- package/lib/directors/ProductPricingDirector.d.ts +21 -0
- package/lib/directors/ProductPricingDirector.d.ts.map +1 -0
- package/lib/directors/ProductPricingDirector.js +52 -0
- package/lib/directors/ProductPricingDirector.js.map +1 -0
- package/lib/directors/ProductPricingSheet.d.ts +35 -0
- package/lib/directors/ProductPricingSheet.d.ts.map +1 -0
- package/lib/directors/ProductPricingSheet.js +83 -0
- package/lib/directors/ProductPricingSheet.js.map +1 -0
- package/lib/directors/QuotationAdapter.d.ts +28 -0
- package/lib/directors/QuotationAdapter.d.ts.map +1 -0
- package/lib/directors/QuotationAdapter.js +46 -0
- package/lib/directors/QuotationAdapter.js.map +1 -0
- package/lib/directors/QuotationDirector.d.ts +7 -0
- package/lib/directors/QuotationDirector.d.ts.map +1 -0
- package/lib/directors/QuotationDirector.js +84 -0
- package/lib/directors/QuotationDirector.js.map +1 -0
- package/lib/directors/WarehousingAdapter.d.ts +40 -0
- package/lib/directors/WarehousingAdapter.d.ts.map +1 -0
- package/lib/directors/WarehousingAdapter.js +32 -0
- package/lib/directors/WarehousingAdapter.js.map +1 -0
- package/lib/directors/WarehousingDirector.d.ts +41 -0
- package/lib/directors/WarehousingDirector.d.ts.map +1 -0
- package/lib/directors/WarehousingDirector.js +169 -0
- package/lib/directors/WarehousingDirector.js.map +1 -0
- package/lib/directors/WorkerAdapter.d.ts +17 -0
- package/lib/directors/WorkerAdapter.d.ts.map +1 -0
- package/lib/directors/WorkerAdapter.js +11 -0
- package/lib/directors/WorkerAdapter.js.map +1 -0
- package/lib/directors/WorkerDirector.d.ts +26 -0
- package/lib/directors/WorkerDirector.d.ts.map +1 -0
- package/lib/directors/WorkerDirector.js +102 -0
- package/lib/directors/WorkerDirector.js.map +1 -0
- package/lib/directors/index.d.ts +39 -0
- package/lib/directors/index.d.ts.map +1 -0
- package/lib/directors/index.js +39 -0
- package/lib/directors/index.js.map +1 -0
- package/lib/modules.d.ts +59 -0
- package/lib/modules.d.ts.map +1 -0
- package/lib/modules.js +126 -0
- package/lib/modules.js.map +1 -0
- package/lib/services/activateEnrollment.d.ts +4 -0
- package/lib/services/activateEnrollment.d.ts.map +1 -0
- package/lib/services/activateEnrollment.js +25 -0
- package/lib/services/activateEnrollment.js.map +1 -0
- package/lib/services/calculateDiscountTotal.d.ts +7 -0
- package/lib/services/calculateDiscountTotal.d.ts.map +1 -0
- package/lib/services/calculateDiscountTotal.js +49 -0
- package/lib/services/calculateDiscountTotal.js.map +1 -0
- package/lib/services/checkoutOrder.d.ts +9 -0
- package/lib/services/checkoutOrder.d.ts.map +1 -0
- package/lib/services/checkoutOrder.js +28 -0
- package/lib/services/checkoutOrder.js.map +1 -0
- package/lib/services/confirmOrder.d.ts +9 -0
- package/lib/services/confirmOrder.d.ts.map +1 -0
- package/lib/services/confirmOrder.js +17 -0
- package/lib/services/confirmOrder.js.map +1 -0
- package/lib/services/createDownloadStream.d.ts +5 -0
- package/lib/services/createDownloadStream.d.ts.map +1 -0
- package/lib/services/createDownloadStream.js +8 -0
- package/lib/services/createDownloadStream.js.map +1 -0
- package/lib/services/createEnrollmentFromCheckout.d.ts +15 -0
- package/lib/services/createEnrollmentFromCheckout.d.ts.map +1 -0
- package/lib/services/createEnrollmentFromCheckout.js +40 -0
- package/lib/services/createEnrollmentFromCheckout.js.map +1 -0
- package/lib/services/createManualOrderDiscount.d.ts +7 -0
- package/lib/services/createManualOrderDiscount.d.ts.map +1 -0
- package/lib/services/createManualOrderDiscount.js +47 -0
- package/lib/services/createManualOrderDiscount.js.map +1 -0
- package/lib/services/createSignedURL.d.ts +8 -0
- package/lib/services/createSignedURL.d.ts.map +1 -0
- package/lib/services/createSignedURL.js +15 -0
- package/lib/services/createSignedURL.js.map +1 -0
- package/lib/services/deleteUser.d.ts +5 -0
- package/lib/services/deleteUser.d.ts.map +1 -0
- package/lib/services/deleteUser.js +26 -0
- package/lib/services/deleteUser.js.map +1 -0
- package/lib/services/discountedEntities.d.ts +5 -0
- package/lib/services/discountedEntities.d.ts.map +1 -0
- package/lib/services/discountedEntities.js +61 -0
- package/lib/services/discountedEntities.js.map +1 -0
- package/lib/services/ercMetadata.d.ts +7 -0
- package/lib/services/ercMetadata.d.ts.map +1 -0
- package/lib/services/ercMetadata.js +22 -0
- package/lib/services/ercMetadata.js.map +1 -0
- package/lib/services/findOrInitCart.d.ts +9 -0
- package/lib/services/findOrInitCart.d.ts.map +1 -0
- package/lib/services/findOrInitCart.js +15 -0
- package/lib/services/findOrInitCart.js.map +1 -0
- package/lib/services/fullfillQuotation.d.ts +4 -0
- package/lib/services/fullfillQuotation.d.ts.map +1 -0
- package/lib/services/fullfillQuotation.js +12 -0
- package/lib/services/fullfillQuotation.js.map +1 -0
- package/lib/services/index.d.ts +118 -0
- package/lib/services/index.d.ts.map +1 -0
- package/lib/services/index.js +132 -0
- package/lib/services/index.js.map +1 -0
- package/lib/services/initCartProviders.d.ts +4 -0
- package/lib/services/initCartProviders.d.ts.map +1 -0
- package/lib/services/initCartProviders.js +55 -0
- package/lib/services/initCartProviders.js.map +1 -0
- package/lib/services/initializeEnrollment.d.ts +7 -0
- package/lib/services/initializeEnrollment.d.ts.map +1 -0
- package/lib/services/initializeEnrollment.js +28 -0
- package/lib/services/initializeEnrollment.js.map +1 -0
- package/lib/services/invalidateFilterCache.d.ts +3 -0
- package/lib/services/invalidateFilterCache.d.ts.map +1 -0
- package/lib/services/invalidateFilterCache.js +12 -0
- package/lib/services/invalidateFilterCache.js.map +1 -0
- package/lib/services/linkFileService.d.ts +7 -0
- package/lib/services/linkFileService.d.ts.map +1 -0
- package/lib/services/linkFileService.js +18 -0
- package/lib/services/linkFileService.js.map +1 -0
- package/lib/services/loadFilterOptions.d.ts +14 -0
- package/lib/services/loadFilterOptions.d.ts.map +1 -0
- package/lib/services/loadFilterOptions.js +29 -0
- package/lib/services/loadFilterOptions.js.map +1 -0
- package/lib/services/loadFilters.d.ts +14 -0
- package/lib/services/loadFilters.d.ts.map +1 -0
- package/lib/services/loadFilters.js +36 -0
- package/lib/services/loadFilters.js.map +1 -0
- package/lib/services/migrateBookmarks.d.ts +8 -0
- package/lib/services/migrateBookmarks.d.ts.map +1 -0
- package/lib/services/migrateBookmarks.js +26 -0
- package/lib/services/migrateBookmarks.js.map +1 -0
- package/lib/services/migrateOrderCart.d.ts +8 -0
- package/lib/services/migrateOrderCart.d.ts.map +1 -0
- package/lib/services/migrateOrderCart.js +32 -0
- package/lib/services/migrateOrderCart.js.map +1 -0
- package/lib/services/migrateUserData.d.ts +2 -0
- package/lib/services/migrateUserData.d.ts.map +1 -0
- package/lib/services/migrateUserData.js +20 -0
- package/lib/services/migrateUserData.js.map +1 -0
- package/lib/services/nextUserCart.d.ts +9 -0
- package/lib/services/nextUserCart.d.ts.map +1 -0
- package/lib/services/nextUserCart.js +34 -0
- package/lib/services/nextUserCart.js.map +1 -0
- package/lib/services/processEnrollment.d.ts +4 -0
- package/lib/services/processEnrollment.d.ts.map +1 -0
- package/lib/services/processEnrollment.js +33 -0
- package/lib/services/processEnrollment.js.map +1 -0
- package/lib/services/processOrder.d.ts +9 -0
- package/lib/services/processOrder.d.ts.map +1 -0
- package/lib/services/processOrder.js +161 -0
- package/lib/services/processOrder.js.map +1 -0
- package/lib/services/processQuotation.d.ts +6 -0
- package/lib/services/processQuotation.d.ts.map +1 -0
- package/lib/services/processQuotation.js +60 -0
- package/lib/services/processQuotation.js.map +1 -0
- package/lib/services/proposeQuotation.d.ts +6 -0
- package/lib/services/proposeQuotation.d.ts.map +1 -0
- package/lib/services/proposeQuotation.js +12 -0
- package/lib/services/proposeQuotation.js.map +1 -0
- package/lib/services/registerPaymentCredentials.d.ts +5 -0
- package/lib/services/registerPaymentCredentials.d.ts.map +1 -0
- package/lib/services/registerPaymentCredentials.js +21 -0
- package/lib/services/registerPaymentCredentials.js.map +1 -0
- package/lib/services/rejectOrder.d.ts +9 -0
- package/lib/services/rejectOrder.d.ts.map +1 -0
- package/lib/services/rejectOrder.js +17 -0
- package/lib/services/rejectOrder.js.map +1 -0
- package/lib/services/rejectQuotation.d.ts +6 -0
- package/lib/services/rejectQuotation.d.ts.map +1 -0
- package/lib/services/rejectQuotation.js +12 -0
- package/lib/services/rejectQuotation.js.map +1 -0
- package/lib/services/removeFiles.d.ts +5 -0
- package/lib/services/removeFiles.d.ts.map +1 -0
- package/lib/services/removeFiles.js +19 -0
- package/lib/services/removeFiles.js.map +1 -0
- package/lib/services/removeProduct.d.ts +5 -0
- package/lib/services/removeProduct.d.ts.map +1 -0
- package/lib/services/removeProduct.js +26 -0
- package/lib/services/removeProduct.js.map +1 -0
- package/lib/services/searchAssortments.d.ts +19 -0
- package/lib/services/searchAssortments.d.ts.map +1 -0
- package/lib/services/searchAssortments.js +33 -0
- package/lib/services/searchAssortments.js.map +1 -0
- package/lib/services/searchProducts.d.ts +16 -0
- package/lib/services/searchProducts.d.ts.map +1 -0
- package/lib/services/searchProducts.js +41 -0
- package/lib/services/searchProducts.js.map +1 -0
- package/lib/services/simulateProductDispatching.d.ts +15 -0
- package/lib/services/simulateProductDispatching.d.ts.map +1 -0
- package/lib/services/simulateProductDispatching.js +30 -0
- package/lib/services/simulateProductDispatching.js.map +1 -0
- package/lib/services/simulateProductInventory.d.ts +15 -0
- package/lib/services/simulateProductInventory.d.ts.map +1 -0
- package/lib/services/simulateProductInventory.js +29 -0
- package/lib/services/simulateProductInventory.js.map +1 -0
- package/lib/services/simulateProductPricing.d.ts +12 -0
- package/lib/services/simulateProductPricing.d.ts.map +1 -0
- package/lib/services/simulateProductPricing.js +8 -0
- package/lib/services/simulateProductPricing.js.map +1 -0
- package/lib/services/supportedDeliveryProviders.d.ts +5 -0
- package/lib/services/supportedDeliveryProviders.d.ts.map +1 -0
- package/lib/services/supportedDeliveryProviders.js +14 -0
- package/lib/services/supportedDeliveryProviders.js.map +1 -0
- package/lib/services/supportedPaymentProviders.d.ts +5 -0
- package/lib/services/supportedPaymentProviders.d.ts.map +1 -0
- package/lib/services/supportedPaymentProviders.js +14 -0
- package/lib/services/supportedPaymentProviders.js.map +1 -0
- package/lib/services/supportedWarehousingProviders.d.ts +5 -0
- package/lib/services/supportedWarehousingProviders.d.ts.map +1 -0
- package/lib/services/supportedWarehousingProviders.js +10 -0
- package/lib/services/supportedWarehousingProviders.js.map +1 -0
- package/lib/services/terminateEnrollment.d.ts +3 -0
- package/lib/services/terminateEnrollment.d.ts.map +1 -0
- package/lib/services/terminateEnrollment.js +25 -0
- package/lib/services/terminateEnrollment.js.map +1 -0
- package/lib/services/updateCalculation.d.ts +3 -0
- package/lib/services/updateCalculation.d.ts.map +1 -0
- package/lib/services/updateCalculation.js +101 -0
- package/lib/services/updateCalculation.js.map +1 -0
- package/lib/services/updateScheduling.d.ts +8 -0
- package/lib/services/updateScheduling.d.ts.map +1 -0
- package/lib/services/updateScheduling.js +42 -0
- package/lib/services/updateScheduling.js.map +1 -0
- package/lib/services/updateUserAvatarAfterUpload.d.ts +6 -0
- package/lib/services/updateUserAvatarAfterUpload.d.ts.map +1 -0
- package/lib/services/updateUserAvatarAfterUpload.js +25 -0
- package/lib/services/updateUserAvatarAfterUpload.js.map +1 -0
- package/lib/services/uploadFileFromStream.d.ts +8 -0
- package/lib/services/uploadFileFromStream.d.ts.map +1 -0
- package/lib/services/uploadFileFromStream.js +11 -0
- package/lib/services/uploadFileFromStream.js.map +1 -0
- package/lib/services/uploadFileFromURL.d.ts +13 -0
- package/lib/services/uploadFileFromURL.d.ts.map +1 -0
- package/lib/services/uploadFileFromURL.js +11 -0
- package/lib/services/uploadFileFromURL.js.map +1 -0
- package/lib/services/validateOrder.d.ts +4 -0
- package/lib/services/validateOrder.d.ts.map +1 -0
- package/lib/services/validateOrder.js +45 -0
- package/lib/services/validateOrder.js.map +1 -0
- package/lib/services/verifyQuotation.d.ts +6 -0
- package/lib/services/verifyQuotation.d.ts.map +1 -0
- package/lib/services/verifyQuotation.js +12 -0
- package/lib/services/verifyQuotation.js.map +1 -0
- package/package.json +30 -29
- package/src/core-index.ts +14 -241
- package/src/directors/BaseDiscountAdapter.test.ts +49 -0
- package/src/directors/BaseDiscountAdapter.ts +90 -0
- package/src/directors/BaseDiscountDirector.ts +73 -0
- package/src/directors/BasePricingAdapter.ts +80 -0
- package/src/directors/BasePricingDirector.ts +137 -0
- package/src/directors/BasePricingSheet.test.ts +43 -0
- package/src/directors/BasePricingSheet.ts +140 -0
- package/src/directors/DeliveryAdapter.ts +110 -0
- package/src/directors/DeliveryDirector.ts +135 -0
- package/src/directors/DeliveryPricingAdapter.ts +87 -0
- package/src/directors/DeliveryPricingDirector.ts +92 -0
- package/src/directors/DeliveryPricingSheet.ts +86 -0
- package/src/directors/EnrollmentAdapter.ts +113 -0
- package/src/directors/EnrollmentDirector.ts +70 -0
- package/src/directors/FilterAdapter.ts +103 -0
- package/src/directors/FilterDirector.ts +309 -0
- package/src/directors/MessagingDirector.test.ts +5 -0
- package/src/directors/MessagingDirector.ts +59 -0
- package/src/directors/OrderDiscountAdapter.ts +10 -0
- package/src/directors/OrderDiscountConfiguration.ts +5 -0
- package/src/directors/OrderDiscountDirector.ts +5 -0
- package/src/directors/OrderPricingAdapter.ts +63 -0
- package/src/directors/OrderPricingDirector.ts +74 -0
- package/src/directors/OrderPricingSheet.ts +147 -0
- package/src/directors/PaymentAdapter.ts +118 -0
- package/src/directors/PaymentDirector.ts +275 -0
- package/src/directors/PaymentPricingAdapter.ts +86 -0
- package/src/directors/PaymentPricingDirector.ts +94 -0
- package/src/directors/PaymentPricingSheet.ts +91 -0
- package/src/directors/ProductDiscountAdapter.ts +10 -0
- package/src/directors/ProductDiscountConfiguration.ts +18 -0
- package/src/directors/ProductDiscountDirector.ts +4 -0
- package/src/directors/ProductPricingAdapter.ts +58 -0
- package/src/directors/ProductPricingDirector.ts +100 -0
- package/src/directors/ProductPricingSheet.test.ts +129 -0
- package/src/directors/ProductPricingSheet.ts +124 -0
- package/src/directors/QuotationAdapter.ts +86 -0
- package/src/directors/QuotationDirector.ts +105 -0
- package/src/directors/WarehousingAdapter.ts +83 -0
- package/src/directors/WarehousingDirector.ts +236 -0
- package/src/directors/WorkerAdapter.ts +30 -0
- package/src/directors/WorkerDirector.ts +154 -0
- package/src/directors/index.ts +49 -0
- package/src/directors/periodForReferenceDate.test.ts +23 -0
- package/src/modules.ts +208 -0
- package/src/services/activateEnrollment.ts +30 -0
- package/src/services/calculateDiscountTotal.ts +71 -0
- package/src/services/checkoutOrder.ts +43 -0
- package/src/services/confirmOrder.ts +26 -0
- package/src/services/createDownloadStream.ts +16 -0
- package/src/services/createEnrollmentFromCheckout.ts +66 -0
- package/src/services/createManualOrderDiscount.ts +56 -0
- package/src/services/createSignedURL.ts +20 -0
- package/src/services/deleteUser.ts +33 -0
- package/src/services/discountedEntities.ts +81 -0
- package/src/services/ercMetadata.ts +33 -0
- package/src/services/findOrInitCart.ts +29 -0
- package/src/services/fullfillQuotation.ts +14 -0
- package/src/services/index.ts +168 -0
- package/src/services/initCartProviders.ts +86 -0
- package/src/services/initializeEnrollment.ts +38 -0
- package/src/services/invalidateFilterCache.ts +16 -0
- package/src/services/linkFileService.ts +22 -0
- package/src/services/loadFilterOptions.ts +49 -0
- package/src/services/loadFilters.ts +52 -0
- package/src/services/migrateBookmarks.ts +39 -0
- package/src/services/migrateOrderCart.ts +52 -0
- package/src/services/migrateUserData.ts +22 -0
- package/src/services/nextUserCart.ts +52 -0
- package/src/services/processEnrollment.ts +37 -0
- package/src/services/processOrder.ts +241 -0
- package/src/services/processQuotation.ts +75 -0
- package/src/services/proposeQuotation.ts +18 -0
- package/src/services/registerPaymentCredentials.ts +30 -0
- package/src/services/rejectOrder.ts +26 -0
- package/src/services/rejectQuotation.ts +18 -0
- package/src/services/removeFiles.ts +25 -0
- package/src/services/removeProduct.ts +34 -0
- package/src/services/searchAssortments.ts +58 -0
- package/src/services/searchProducts.ts +73 -0
- package/src/services/simulateProductDispatching.ts +59 -0
- package/src/services/simulateProductInventory.ts +56 -0
- package/src/services/simulateProductPricing.ts +20 -0
- package/src/services/supportedDeliveryProviders.ts +24 -0
- package/src/services/supportedPaymentProviders.ts +25 -0
- package/src/services/supportedWarehousingProviders.ts +18 -0
- package/src/services/terminateEnrollment.ts +29 -0
- package/src/services/updateCalculation.ts +143 -0
- package/src/services/updateScheduling.ts +64 -0
- package/src/services/updateUserAvatarAfterUpload.ts +30 -0
- package/src/services/uploadFileFromStream.ts +15 -0
- package/src/services/uploadFileFromURL.ts +29 -0
- package/src/services/validateOrder.ts +53 -0
- package/src/services/verifyQuotation.ts +18 -0
- package/tsconfig.json +5 -7
- package/lib/types.d.ts +0 -4
- package/lib/types.d.ts.map +0 -1
- package/lib/types.js +0 -5
- package/lib/types.js.map +0 -1
- package/src/types.ts +0 -7
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Quotation } from '@unchainedshop/core-quotations';
|
|
2
|
+
import { Modules } from '../modules.js';
|
|
3
|
+
export declare function verifyQuotationService(this: Modules, quotation: Quotation, { quotationContext }: {
|
|
4
|
+
quotationContext?: any;
|
|
5
|
+
}): Promise<any>;
|
|
6
|
+
//# sourceMappingURL=verifyQuotation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verifyQuotation.d.ts","sourceRoot":"","sources":["../../src/services/verifyQuotation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAmB,MAAM,gCAAgC,CAAC;AAE5E,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,OAAO,EACb,SAAS,EAAE,SAAS,EACpB,EAAE,gBAAgB,EAAE,EAAE;IAAE,gBAAgB,CAAC,EAAE,GAAG,CAAA;CAAE,gBAUjD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { QuotationStatus } from '@unchainedshop/core-quotations';
|
|
2
|
+
import { processQuotationService } from './processQuotation.js';
|
|
3
|
+
export async function verifyQuotationService(quotation, { quotationContext }) {
|
|
4
|
+
if (quotation.status !== QuotationStatus.REQUESTED)
|
|
5
|
+
return quotation;
|
|
6
|
+
const updatedQuotation = await this.quotations.updateStatus(quotation._id, {
|
|
7
|
+
status: QuotationStatus.PROCESSING,
|
|
8
|
+
info: 'verified elligibility manually',
|
|
9
|
+
});
|
|
10
|
+
return await processQuotationService.bind(this)(updatedQuotation, { quotationContext });
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=verifyQuotation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verifyQuotation.js","sourceRoot":"","sources":["../../src/services/verifyQuotation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAGhE,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAE1C,SAAoB,EACpB,EAAE,gBAAgB,EAA8B;IAEhD,IAAI,SAAS,CAAC,MAAM,KAAK,eAAe,CAAC,SAAS;QAAE,OAAO,SAAS,CAAC;IAErE,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,SAAS,CAAC,GAAG,EAAE;QACzE,MAAM,EAAE,eAAe,CAAC,UAAU;QAClC,IAAI,EAAE,gCAAgC;KACvC,CAAC,CAAC;IAEH,OAAO,MAAM,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,gBAAgB,EAAE,EAAE,gBAAgB,EAAE,CAAC,CAAC;AAC1F,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unchainedshop/core",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-rc10",
|
|
4
4
|
"main": "lib/core-index.js",
|
|
5
|
-
"exports": {
|
|
6
|
-
".": "./lib/core-index.js",
|
|
7
|
-
"./*": "./lib/*"
|
|
8
|
-
},
|
|
9
5
|
"types": "lib/core-index.d.ts",
|
|
10
6
|
"type": "module",
|
|
11
7
|
"scripts": {
|
|
12
|
-
"clean": "
|
|
13
|
-
"
|
|
8
|
+
"clean": "tsc -b --clean",
|
|
9
|
+
"build": "tsc -b",
|
|
10
|
+
"prepublishOnly": "npm run clean && npm run build",
|
|
14
11
|
"watch": "tsc -w ",
|
|
15
12
|
"test": "NODE_OPTIONS=--experimental-vm-modules jest --detectOpenHandles --forceExit",
|
|
16
13
|
"test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch --detectOpenHandles --forceExit"
|
|
@@ -24,37 +21,41 @@
|
|
|
24
21
|
"ecommerce",
|
|
25
22
|
"core"
|
|
26
23
|
],
|
|
27
|
-
"
|
|
24
|
+
"authors": [
|
|
25
|
+
"Joël Meiller",
|
|
26
|
+
"Pascal Kaufmann"
|
|
27
|
+
],
|
|
28
28
|
"license": "EUPL-1.2",
|
|
29
29
|
"bugs": {
|
|
30
30
|
"url": "https://github.com/unchainedshop/unchained/issues"
|
|
31
31
|
},
|
|
32
32
|
"homepage": "https://github.com/unchainedshop/unchained#readme",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@
|
|
35
|
-
"@unchainedshop/core-
|
|
36
|
-
"@unchainedshop/core-
|
|
37
|
-
"@unchainedshop/core-
|
|
38
|
-
"@unchainedshop/core-
|
|
39
|
-
"@unchainedshop/core-
|
|
40
|
-
"@unchainedshop/core-
|
|
41
|
-
"@unchainedshop/core-
|
|
42
|
-
"@unchainedshop/core-
|
|
43
|
-
"@unchainedshop/core-
|
|
44
|
-
"@unchainedshop/core-
|
|
45
|
-
"@unchainedshop/core-orders": "^3.0.0-
|
|
46
|
-
"@unchainedshop/core-payment": "^3.0.0-
|
|
47
|
-
"@unchainedshop/core-products": "^3.0.0-
|
|
48
|
-
"@unchainedshop/core-quotations": "^3.0.0-
|
|
49
|
-
"@unchainedshop/core-users": "^3.0.0-
|
|
50
|
-
"@unchainedshop/core-warehousing": "^3.0.0-
|
|
51
|
-
"@unchainedshop/core-worker": "^3.0.0-
|
|
52
|
-
"@unchainedshop/logger": "^3.0.0-
|
|
34
|
+
"@breejs/later": "^4.2.0",
|
|
35
|
+
"@unchainedshop/core-assortments": "^3.0.0-rc10",
|
|
36
|
+
"@unchainedshop/core-bookmarks": "^3.0.0-rc10",
|
|
37
|
+
"@unchainedshop/core-countries": "^3.0.0-rc10",
|
|
38
|
+
"@unchainedshop/core-currencies": "^3.0.0-rc10",
|
|
39
|
+
"@unchainedshop/core-delivery": "^3.0.0-rc10",
|
|
40
|
+
"@unchainedshop/core-enrollments": "^3.0.0-rc10",
|
|
41
|
+
"@unchainedshop/core-events": "^3.0.0-rc10",
|
|
42
|
+
"@unchainedshop/core-files": "^3.0.0-rc10",
|
|
43
|
+
"@unchainedshop/core-filters": "^3.0.0-rc10",
|
|
44
|
+
"@unchainedshop/core-languages": "^3.0.0-rc10",
|
|
45
|
+
"@unchainedshop/core-orders": "^3.0.0-rc10",
|
|
46
|
+
"@unchainedshop/core-payment": "^3.0.0-rc10",
|
|
47
|
+
"@unchainedshop/core-products": "^3.0.0-rc10",
|
|
48
|
+
"@unchainedshop/core-quotations": "^3.0.0-rc10",
|
|
49
|
+
"@unchainedshop/core-users": "^3.0.0-rc10",
|
|
50
|
+
"@unchainedshop/core-warehousing": "^3.0.0-rc10",
|
|
51
|
+
"@unchainedshop/core-worker": "^3.0.0-rc10",
|
|
52
|
+
"@unchainedshop/logger": "^3.0.0-rc10",
|
|
53
|
+
"@unchainedshop/utils": "^3.0.0-rc10"
|
|
53
54
|
},
|
|
54
55
|
"devDependencies": {
|
|
55
|
-
"@types/node": "^22.
|
|
56
|
+
"@types/node": "^22.10.2",
|
|
56
57
|
"jest": "^29.7.0",
|
|
57
58
|
"ts-jest": "^29.2.5",
|
|
58
|
-
"typescript": "^5.
|
|
59
|
+
"typescript": "^5.7.2"
|
|
59
60
|
}
|
|
60
61
|
}
|
package/src/core-index.ts
CHANGED
|
@@ -1,91 +1,12 @@
|
|
|
1
|
-
import { BulkImporter } from './types.js';
|
|
2
|
-
import {
|
|
3
|
-
AssortmentsModule,
|
|
4
|
-
AssortmentsSettingsOptions,
|
|
5
|
-
configureAssortmentsModule,
|
|
6
|
-
} from '@unchainedshop/core-assortments';
|
|
7
|
-
import {
|
|
8
|
-
BookmarkServices,
|
|
9
|
-
bookmarkServices,
|
|
10
|
-
BookmarksModule,
|
|
11
|
-
configureBookmarksModule,
|
|
12
|
-
} from '@unchainedshop/core-bookmarks';
|
|
13
|
-
import { configureCountriesModule, CountriesModule } from '@unchainedshop/core-countries';
|
|
14
|
-
import { configureCurrenciesModule, CurrenciesModule } from '@unchainedshop/core-currencies';
|
|
15
|
-
import {
|
|
16
|
-
configureDeliveryModule,
|
|
17
|
-
DeliveryModule,
|
|
18
|
-
DeliverySettingsOptions,
|
|
19
|
-
} from '@unchainedshop/core-delivery';
|
|
20
|
-
import {
|
|
21
|
-
configureEnrollmentsModule,
|
|
22
|
-
EnrollmentsModule,
|
|
23
|
-
EnrollmentsSettingsOptions,
|
|
24
|
-
} from '@unchainedshop/core-enrollments';
|
|
25
|
-
import { configureEventsModule, EventsModule } from '@unchainedshop/core-events';
|
|
26
|
-
import {
|
|
27
|
-
configureFilesModule,
|
|
28
|
-
FileServices,
|
|
29
|
-
fileServices,
|
|
30
|
-
FilesModule,
|
|
31
|
-
FilesSettingsOptions,
|
|
32
|
-
} from '@unchainedshop/core-files';
|
|
33
|
-
import {
|
|
34
|
-
configureFiltersModule,
|
|
35
|
-
FiltersModule,
|
|
36
|
-
FiltersSettingsOptions,
|
|
37
|
-
} from '@unchainedshop/core-filters';
|
|
38
|
-
import { configureLanguagesModule, LanguagesModule } from '@unchainedshop/core-languages';
|
|
39
|
-
import { configureMessagingModule, MessagingModule } from '@unchainedshop/core-messaging';
|
|
40
|
-
import {
|
|
41
|
-
configureOrdersModule,
|
|
42
|
-
OrderServices,
|
|
43
|
-
orderServices,
|
|
44
|
-
OrdersModule,
|
|
45
|
-
OrdersSettingsOptions,
|
|
46
|
-
} from '@unchainedshop/core-orders';
|
|
47
|
-
import {
|
|
48
|
-
configurePaymentModule,
|
|
49
|
-
PaymentModule,
|
|
50
|
-
PaymentSettingsOptions,
|
|
51
|
-
} from '@unchainedshop/core-payment';
|
|
52
|
-
import {
|
|
53
|
-
configureProductsModule,
|
|
54
|
-
ProductServices,
|
|
55
|
-
productServices,
|
|
56
|
-
ProductsModule,
|
|
57
|
-
ProductsSettingsOptions,
|
|
58
|
-
} from '@unchainedshop/core-products';
|
|
59
|
-
import {
|
|
60
|
-
configureQuotationsModule,
|
|
61
|
-
QuotationsModule,
|
|
62
|
-
QuotationsSettingsOptions,
|
|
63
|
-
} from '@unchainedshop/core-quotations';
|
|
64
|
-
import {
|
|
65
|
-
configureUsersModule,
|
|
66
|
-
UserServices,
|
|
67
|
-
userServices,
|
|
68
|
-
UserSettingsOptions,
|
|
69
|
-
UsersModule,
|
|
70
|
-
} from '@unchainedshop/core-users';
|
|
71
|
-
import { configureWarehousingModule, WarehousingModule } from '@unchainedshop/core-warehousing';
|
|
72
|
-
import { configureWorkerModule, WorkerModule, WorkerSettingsOptions } from '@unchainedshop/core-worker';
|
|
73
1
|
import { mongodb, MigrationRepository, ModuleInput } from '@unchainedshop/mongodb';
|
|
2
|
+
import initServices, { Services } from './services/index.js';
|
|
3
|
+
import initModules, { Modules, ModuleOptions } from './modules.js';
|
|
74
4
|
|
|
75
|
-
export * from './
|
|
5
|
+
export * from './services/index.js';
|
|
6
|
+
export * from './directors/index.js';
|
|
76
7
|
|
|
77
|
-
export interface
|
|
78
|
-
|
|
79
|
-
products?: ProductsSettingsOptions;
|
|
80
|
-
delivery?: DeliverySettingsOptions;
|
|
81
|
-
filters?: FiltersSettingsOptions;
|
|
82
|
-
enrollments?: EnrollmentsSettingsOptions;
|
|
83
|
-
orders?: OrdersSettingsOptions;
|
|
84
|
-
quotations?: QuotationsSettingsOptions;
|
|
85
|
-
files?: FilesSettingsOptions;
|
|
86
|
-
payment?: PaymentSettingsOptions;
|
|
87
|
-
worker?: WorkerSettingsOptions;
|
|
88
|
-
users?: UserSettingsOptions;
|
|
8
|
+
export interface BulkImporter {
|
|
9
|
+
createBulkImporter: (options: any) => any;
|
|
89
10
|
}
|
|
90
11
|
|
|
91
12
|
export interface UnchainedCoreOptions {
|
|
@@ -98,39 +19,10 @@ export interface UnchainedCoreOptions {
|
|
|
98
19
|
configure: (params: ModuleInput<any>) => any;
|
|
99
20
|
}
|
|
100
21
|
>;
|
|
101
|
-
services?: Record<string, any>;
|
|
22
|
+
services?: Record<string, (this: Modules, ...args) => any>;
|
|
102
23
|
options?: ModuleOptions;
|
|
103
24
|
}
|
|
104
25
|
|
|
105
|
-
export interface Modules {
|
|
106
|
-
assortments: AssortmentsModule;
|
|
107
|
-
bookmarks: BookmarksModule;
|
|
108
|
-
countries: CountriesModule;
|
|
109
|
-
currencies: CurrenciesModule;
|
|
110
|
-
delivery: DeliveryModule;
|
|
111
|
-
enrollments: EnrollmentsModule;
|
|
112
|
-
events: EventsModule;
|
|
113
|
-
files: FilesModule;
|
|
114
|
-
filters: FiltersModule;
|
|
115
|
-
languages: LanguagesModule;
|
|
116
|
-
messaging: MessagingModule;
|
|
117
|
-
orders: OrdersModule;
|
|
118
|
-
payment: PaymentModule;
|
|
119
|
-
products: ProductsModule;
|
|
120
|
-
quotations: QuotationsModule;
|
|
121
|
-
users: UsersModule;
|
|
122
|
-
warehousing: WarehousingModule;
|
|
123
|
-
worker: WorkerModule;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export interface Services {
|
|
127
|
-
bookmarks: BookmarkServices;
|
|
128
|
-
files: FileServices;
|
|
129
|
-
orders: OrderServices;
|
|
130
|
-
products: ProductServices;
|
|
131
|
-
users: UserServices;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
26
|
export interface UnchainedCore {
|
|
135
27
|
modules: Modules;
|
|
136
28
|
services: Services;
|
|
@@ -142,137 +34,18 @@ export const initCore = async ({
|
|
|
142
34
|
db,
|
|
143
35
|
migrationRepository,
|
|
144
36
|
bulkImporter,
|
|
145
|
-
modules = {},
|
|
146
|
-
services = {},
|
|
37
|
+
modules: customModules = {},
|
|
38
|
+
services: customServices = {},
|
|
147
39
|
options = {},
|
|
148
40
|
}: UnchainedCoreOptions): Promise<UnchainedCore> => {
|
|
149
|
-
const assortments = await configureAssortmentsModule({
|
|
150
|
-
db,
|
|
151
|
-
options: options.assortments,
|
|
152
|
-
migrationRepository,
|
|
153
|
-
});
|
|
154
|
-
const bookmarks = await configureBookmarksModule({
|
|
155
|
-
db,
|
|
156
|
-
migrationRepository,
|
|
157
|
-
});
|
|
158
|
-
const countries = await configureCountriesModule({
|
|
159
|
-
db,
|
|
160
|
-
migrationRepository,
|
|
161
|
-
});
|
|
162
|
-
const currencies = await configureCurrenciesModule({
|
|
163
|
-
db,
|
|
164
|
-
migrationRepository,
|
|
165
|
-
});
|
|
166
|
-
const delivery = await configureDeliveryModule({
|
|
167
|
-
db,
|
|
168
|
-
options: options.delivery,
|
|
169
|
-
migrationRepository,
|
|
170
|
-
});
|
|
171
|
-
const enrollments = await configureEnrollmentsModule({
|
|
172
|
-
db,
|
|
173
|
-
options: options.enrollments,
|
|
174
|
-
migrationRepository,
|
|
175
|
-
});
|
|
176
|
-
const events = await configureEventsModule({
|
|
177
|
-
db,
|
|
178
|
-
migrationRepository,
|
|
179
|
-
});
|
|
180
|
-
const files = await configureFilesModule({
|
|
181
|
-
db,
|
|
182
|
-
options: options.files,
|
|
183
|
-
migrationRepository,
|
|
184
|
-
});
|
|
185
|
-
const filters = await configureFiltersModule({
|
|
186
|
-
db,
|
|
187
|
-
options: options.filters,
|
|
188
|
-
migrationRepository,
|
|
189
|
-
});
|
|
190
|
-
const languages = await configureLanguagesModule({
|
|
191
|
-
db,
|
|
192
|
-
migrationRepository,
|
|
193
|
-
});
|
|
194
|
-
const messaging = await configureMessagingModule({
|
|
195
|
-
db,
|
|
196
|
-
migrationRepository,
|
|
197
|
-
});
|
|
198
|
-
const orders = await configureOrdersModule({
|
|
199
|
-
db,
|
|
200
|
-
options: options.orders,
|
|
201
|
-
migrationRepository,
|
|
202
|
-
});
|
|
203
|
-
const payment = await configurePaymentModule({
|
|
204
|
-
db,
|
|
205
|
-
options: options.payment,
|
|
206
|
-
migrationRepository,
|
|
207
|
-
});
|
|
208
|
-
const products = await configureProductsModule({
|
|
209
|
-
db,
|
|
210
|
-
migrationRepository,
|
|
211
|
-
});
|
|
212
|
-
const quotations = await configureQuotationsModule({
|
|
213
|
-
db,
|
|
214
|
-
options: options.quotations,
|
|
215
|
-
migrationRepository,
|
|
216
|
-
});
|
|
217
|
-
const users = await configureUsersModule({
|
|
218
|
-
db,
|
|
219
|
-
migrationRepository,
|
|
220
|
-
});
|
|
221
|
-
const warehousing = await configureWarehousingModule({
|
|
222
|
-
db,
|
|
223
|
-
migrationRepository,
|
|
224
|
-
});
|
|
225
|
-
const worker = await configureWorkerModule({
|
|
226
|
-
db,
|
|
227
|
-
options: options.worker,
|
|
228
|
-
migrationRepository,
|
|
229
|
-
});
|
|
230
|
-
|
|
231
41
|
// Configure custom modules
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
...(await modulesPromise),
|
|
236
|
-
[key]: await customModule.configure({
|
|
237
|
-
db,
|
|
238
|
-
options: options?.[key],
|
|
239
|
-
migrationRepository,
|
|
240
|
-
}),
|
|
241
|
-
};
|
|
242
|
-
},
|
|
243
|
-
Promise.resolve({}),
|
|
244
|
-
);
|
|
42
|
+
|
|
43
|
+
const modules = await initModules({ db, migrationRepository, options }, customModules);
|
|
44
|
+
const services = initServices(modules, customServices);
|
|
245
45
|
|
|
246
46
|
return {
|
|
247
|
-
modules
|
|
248
|
-
|
|
249
|
-
bookmarks,
|
|
250
|
-
countries,
|
|
251
|
-
currencies,
|
|
252
|
-
delivery,
|
|
253
|
-
enrollments,
|
|
254
|
-
events,
|
|
255
|
-
files,
|
|
256
|
-
filters,
|
|
257
|
-
languages,
|
|
258
|
-
messaging,
|
|
259
|
-
orders,
|
|
260
|
-
payment,
|
|
261
|
-
products,
|
|
262
|
-
quotations,
|
|
263
|
-
users,
|
|
264
|
-
warehousing,
|
|
265
|
-
worker,
|
|
266
|
-
...customModules,
|
|
267
|
-
},
|
|
268
|
-
services: {
|
|
269
|
-
bookmarks: bookmarkServices,
|
|
270
|
-
files: fileServices,
|
|
271
|
-
orders: orderServices,
|
|
272
|
-
products: productServices,
|
|
273
|
-
users: userServices,
|
|
274
|
-
...services,
|
|
275
|
-
},
|
|
47
|
+
modules,
|
|
48
|
+
services,
|
|
276
49
|
bulkImporter,
|
|
277
50
|
options,
|
|
278
51
|
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { BaseDiscountAdapter } from './BaseDiscountAdapter.js';
|
|
2
|
+
|
|
3
|
+
describe('BaseDiscountAdapter instantiation', () => {
|
|
4
|
+
const adapter = BaseDiscountAdapter;
|
|
5
|
+
const context = null as any;
|
|
6
|
+
it('should initialize with default values', async () => {
|
|
7
|
+
expect(adapter.orderIndex).toEqual(0);
|
|
8
|
+
expect(adapter.log).toEqual(expect.any(Function));
|
|
9
|
+
expect(await adapter.isManualAdditionAllowed('')).toEqual(false);
|
|
10
|
+
expect(await adapter.isManualRemovalAllowed()).toEqual(false);
|
|
11
|
+
expect(await adapter.actions(context)).toEqual({
|
|
12
|
+
isValidForSystemTriggering: expect.any(Function),
|
|
13
|
+
reserve: expect.any(Function),
|
|
14
|
+
release: expect.any(Function),
|
|
15
|
+
isValidForCodeTriggering: expect.any(Function),
|
|
16
|
+
discountForPricingAdapterKey: expect.any(Function),
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
describe('actions', () => {
|
|
21
|
+
it('isValidForSystemTriggering', async () => {
|
|
22
|
+
const result = await adapter.actions(context);
|
|
23
|
+
expect(await result.isValidForSystemTriggering()).toEqual(false);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('reserve', async () => {
|
|
27
|
+
const result = await adapter.actions(context);
|
|
28
|
+
expect(await result.reserve({ code: '' })).toEqual({});
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('release', async () => {
|
|
32
|
+
const result = await adapter.actions(context);
|
|
33
|
+
expect(await result.release()).toEqual(null);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('isValidForCodeTriggering', async () => {
|
|
37
|
+
const result = await adapter.actions(context);
|
|
38
|
+
expect(await result.isValidForCodeTriggering({ code: '' })).toEqual(false);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('discountForPricingAdapterKey', async () => {
|
|
42
|
+
const result = await adapter.actions(context);
|
|
43
|
+
const calculationSheet = {};
|
|
44
|
+
expect(
|
|
45
|
+
await result.discountForPricingAdapterKey({ calculationSheet, pricingAdapterKey: 'key' } as any),
|
|
46
|
+
).toEqual(null);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { log, LogLevel } from '@unchainedshop/logger';
|
|
2
|
+
import { IBaseAdapter } from '@unchainedshop/utils';
|
|
3
|
+
import { IPricingSheet } from './BasePricingSheet.js';
|
|
4
|
+
import { PricingCalculation } from '@unchainedshop/utils';
|
|
5
|
+
import { Order, OrderDiscount } from '@unchainedshop/core-orders';
|
|
6
|
+
import { Modules } from '../modules.js';
|
|
7
|
+
export interface DiscountContext {
|
|
8
|
+
code?: string;
|
|
9
|
+
orderDiscount?: OrderDiscount;
|
|
10
|
+
order?: Order;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type IDiscountAdapter<DiscountConfiguration> = IBaseAdapter & {
|
|
14
|
+
orderIndex: number;
|
|
15
|
+
|
|
16
|
+
isManualAdditionAllowed: (code: string) => Promise<boolean>;
|
|
17
|
+
isManualRemovalAllowed: () => Promise<boolean>;
|
|
18
|
+
|
|
19
|
+
actions: (params: {
|
|
20
|
+
context: DiscountContext & { modules: Modules };
|
|
21
|
+
}) => Promise<DiscountAdapterActions<DiscountConfiguration>>;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export interface DiscountAdapterActions<DiscountConfiguration> {
|
|
25
|
+
isValidForSystemTriggering: () => Promise<boolean>;
|
|
26
|
+
isValidForCodeTriggering: (params: { code: string }) => Promise<boolean>;
|
|
27
|
+
|
|
28
|
+
discountForPricingAdapterKey: (params: {
|
|
29
|
+
pricingAdapterKey: string;
|
|
30
|
+
calculationSheet: IPricingSheet<PricingCalculation>;
|
|
31
|
+
}) => DiscountConfiguration;
|
|
32
|
+
|
|
33
|
+
reserve: (params: { code: string }) => Promise<any>;
|
|
34
|
+
release: () => Promise<void>;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const BaseDiscountAdapter: Omit<IDiscountAdapter<unknown>, 'key' | 'label' | 'version'> = {
|
|
38
|
+
orderIndex: 0,
|
|
39
|
+
|
|
40
|
+
isManualAdditionAllowed: async () => {
|
|
41
|
+
return false;
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
// return true if a discount is allowed to get removed manually by a user
|
|
45
|
+
isManualRemovalAllowed: async () => {
|
|
46
|
+
return false;
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
actions: async () => ({
|
|
50
|
+
// return true if a discount is valid to be part of the order
|
|
51
|
+
// without input of a user. that could be a time based global discount
|
|
52
|
+
// like a 10% discount day
|
|
53
|
+
// if you return false, this discount will
|
|
54
|
+
// get removed from the order before any price calculation
|
|
55
|
+
// takes place.
|
|
56
|
+
// eslint-disable-next-line
|
|
57
|
+
isValidForSystemTriggering: async () => {
|
|
58
|
+
return false;
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
// return an arbitrary JSON serializable object with reservation data
|
|
62
|
+
// this method is called when a discount is added through a manual code and let's
|
|
63
|
+
// you manually deduct expendable discounts (coupon balances for ex.) before checkout
|
|
64
|
+
reserve: async () => {
|
|
65
|
+
return {};
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
// return void, allows you to free up any reservations in backend systems
|
|
69
|
+
release: async () => {
|
|
70
|
+
return null;
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
// return true if a discount is valid to be part of the order.
|
|
74
|
+
// if you return false, this discount will
|
|
75
|
+
// get removed from the order before any price calculation
|
|
76
|
+
// takes place.
|
|
77
|
+
isValidForCodeTriggering: async () => {
|
|
78
|
+
return false;
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
// returns the appropriate discount context for a calculation adapter
|
|
82
|
+
discountForPricingAdapterKey() {
|
|
83
|
+
return null;
|
|
84
|
+
},
|
|
85
|
+
}),
|
|
86
|
+
|
|
87
|
+
log(message: string, { level = LogLevel.Debug, ...options } = {}) {
|
|
88
|
+
return log(message, { level, ...options });
|
|
89
|
+
},
|
|
90
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { BaseDirector, IBaseDirector } from '@unchainedshop/utils';
|
|
2
|
+
import { DiscountContext, IDiscountAdapter } from './BaseDiscountAdapter.js';
|
|
3
|
+
import { Modules } from '../modules.js';
|
|
4
|
+
|
|
5
|
+
export type IDiscountDirector<DiscountConfiguration> = IBaseDirector<
|
|
6
|
+
IDiscountAdapter<DiscountConfiguration>
|
|
7
|
+
> & {
|
|
8
|
+
actions: (
|
|
9
|
+
discountContext: DiscountContext,
|
|
10
|
+
unchainedAPI: { modules: Modules },
|
|
11
|
+
) => Promise<{
|
|
12
|
+
resolveDiscountAdapterFromStaticCode: (params: {
|
|
13
|
+
code: string;
|
|
14
|
+
}) => Promise<IDiscountAdapter<DiscountConfiguration>>;
|
|
15
|
+
findSystemDiscounts: () => Promise<Array<string>>;
|
|
16
|
+
}>;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const BaseDiscountDirector = <DiscountConfigurationType>(
|
|
20
|
+
directorName: string,
|
|
21
|
+
): IDiscountDirector<DiscountConfigurationType> => {
|
|
22
|
+
const baseDirector = BaseDirector<IDiscountAdapter<DiscountConfigurationType>>(directorName, {
|
|
23
|
+
adapterSortKey: 'orderIndex',
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
...baseDirector,
|
|
28
|
+
|
|
29
|
+
actions: async (discountContext, unchainedAPI) => {
|
|
30
|
+
const context = { ...discountContext, ...unchainedAPI };
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
resolveDiscountAdapterFromStaticCode: async (options) => {
|
|
34
|
+
if (!context.order) return null;
|
|
35
|
+
|
|
36
|
+
const discounts = await Promise.all(
|
|
37
|
+
baseDirector
|
|
38
|
+
.getAdapters()
|
|
39
|
+
.filter((Adapter) => Adapter.isManualAdditionAllowed(options?.code))
|
|
40
|
+
.map(async (Adapter) => {
|
|
41
|
+
const adapter = await Adapter.actions({ context });
|
|
42
|
+
return {
|
|
43
|
+
Adapter,
|
|
44
|
+
isValid: await adapter.isValidForCodeTriggering(options),
|
|
45
|
+
};
|
|
46
|
+
}),
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
return discounts.find(({ isValid }) => isValid === true)?.Adapter;
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
async findSystemDiscounts() {
|
|
53
|
+
if (!context.order) return [];
|
|
54
|
+
const discounts = await Promise.all(
|
|
55
|
+
baseDirector.getAdapters().map(async (Adapter) => {
|
|
56
|
+
const adapter = await Adapter.actions({ context });
|
|
57
|
+
return {
|
|
58
|
+
key: Adapter.key,
|
|
59
|
+
isValid: await adapter.isValidForSystemTriggering(),
|
|
60
|
+
};
|
|
61
|
+
}),
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
const validDiscounts = discounts
|
|
65
|
+
.filter(({ isValid }) => isValid === true)
|
|
66
|
+
.map(({ key }) => key);
|
|
67
|
+
|
|
68
|
+
return validDiscounts;
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { createLogger } from '@unchainedshop/logger';
|
|
2
|
+
import { IPricingSheet } from './BasePricingSheet.js';
|
|
3
|
+
import { IBaseAdapter, PricingCalculation } from '@unchainedshop/utils';
|
|
4
|
+
import { Discount } from './BasePricingDirector.js';
|
|
5
|
+
import { Order, OrderDiscount } from '@unchainedshop/core-orders';
|
|
6
|
+
|
|
7
|
+
const logger = createLogger('unchained:core');
|
|
8
|
+
|
|
9
|
+
interface IDiscountableItem {
|
|
10
|
+
_id?: string;
|
|
11
|
+
orderId?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface BasePricingAdapterContext {
|
|
15
|
+
order?: Order;
|
|
16
|
+
discounts: Array<OrderDiscount>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type BasePricingContext =
|
|
20
|
+
| {
|
|
21
|
+
order?: Order;
|
|
22
|
+
discounts?: Array<OrderDiscount>;
|
|
23
|
+
}
|
|
24
|
+
| {
|
|
25
|
+
item: IDiscountableItem;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export interface IPricingAdapterActions<
|
|
29
|
+
Calculation extends PricingCalculation,
|
|
30
|
+
Sheet extends IPricingSheet<Calculation>,
|
|
31
|
+
> {
|
|
32
|
+
calculate: () => Promise<Array<Calculation>>;
|
|
33
|
+
resultSheet: () => Sheet;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type IPricingAdapter<
|
|
37
|
+
PricingAdapterContext extends BasePricingAdapterContext,
|
|
38
|
+
Calculation extends PricingCalculation,
|
|
39
|
+
Sheet extends IPricingSheet<Calculation>,
|
|
40
|
+
DiscountConfiguration = unknown,
|
|
41
|
+
> = IBaseAdapter & {
|
|
42
|
+
orderIndex: number;
|
|
43
|
+
|
|
44
|
+
isActivatedFor: (context: PricingAdapterContext) => boolean;
|
|
45
|
+
|
|
46
|
+
actions: (params: {
|
|
47
|
+
context: PricingAdapterContext;
|
|
48
|
+
calculationSheet: Sheet;
|
|
49
|
+
discounts: Array<Discount<DiscountConfiguration>>;
|
|
50
|
+
}) => IPricingAdapterActions<Calculation, Sheet>;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const BasePricingAdapter = <
|
|
54
|
+
PricingAdapterContext extends BasePricingAdapterContext,
|
|
55
|
+
Calculation extends PricingCalculation,
|
|
56
|
+
>(): IPricingAdapter<PricingAdapterContext, Calculation, IPricingSheet<Calculation>> => ({
|
|
57
|
+
key: '',
|
|
58
|
+
label: '',
|
|
59
|
+
version: '',
|
|
60
|
+
orderIndex: 0,
|
|
61
|
+
|
|
62
|
+
isActivatedFor: () => {
|
|
63
|
+
return false;
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
actions: () => {
|
|
67
|
+
return {
|
|
68
|
+
calculate: async () => {
|
|
69
|
+
throw new Error('Method not implemented.');
|
|
70
|
+
},
|
|
71
|
+
resultSheet: () => {
|
|
72
|
+
throw new Error('Method not implemented.');
|
|
73
|
+
}, // abstract
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
log(message: string, options) {
|
|
78
|
+
return logger.debug(message, options);
|
|
79
|
+
},
|
|
80
|
+
});
|