@unchainedshop/core 4.0.0-rc.2 → 4.0.0-rc.21
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/bulk-importer/createBulkImporter.d.ts +84 -0
- package/lib/bulk-importer/createBulkImporter.d.ts.map +1 -0
- package/lib/bulk-importer/createBulkImporter.js +142 -0
- package/lib/bulk-importer/createBulkImporter.js.map +1 -0
- package/lib/bulk-importer/handlers/assortment/create.d.ts +565 -0
- package/lib/bulk-importer/handlers/assortment/create.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/assortment/create.js +89 -0
- package/lib/bulk-importer/handlers/assortment/create.js.map +1 -0
- package/lib/bulk-importer/handlers/assortment/index.d.ts +4 -0
- package/lib/bulk-importer/handlers/assortment/index.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/assortment/index.js +4 -0
- package/lib/bulk-importer/handlers/assortment/index.js.map +1 -0
- package/lib/bulk-importer/handlers/assortment/remove.d.ts +30 -0
- package/lib/bulk-importer/handlers/assortment/remove.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/assortment/remove.js +18 -0
- package/lib/bulk-importer/handlers/assortment/remove.js.map +1 -0
- package/lib/bulk-importer/handlers/assortment/update.d.ts +566 -0
- package/lib/bulk-importer/handlers/assortment/update.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/assortment/update.js +98 -0
- package/lib/bulk-importer/handlers/assortment/update.js.map +1 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.d.ts +29 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.js +45 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.js.map +1 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.d.ts +29 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.js +41 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.js.map +1 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.d.ts +29 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.js +46 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.js.map +1 -0
- package/lib/bulk-importer/handlers/assortment/upsertMedia.d.ts +76 -0
- package/lib/bulk-importer/handlers/assortment/upsertMedia.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/assortment/upsertMedia.js +53 -0
- package/lib/bulk-importer/handlers/assortment/upsertMedia.js.map +1 -0
- package/lib/bulk-importer/handlers/filter/create.d.ts +138 -0
- package/lib/bulk-importer/handlers/filter/create.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/filter/create.js +80 -0
- package/lib/bulk-importer/handlers/filter/create.js.map +1 -0
- package/lib/bulk-importer/handlers/filter/index.d.ts +4 -0
- package/lib/bulk-importer/handlers/filter/index.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/filter/index.js +4 -0
- package/lib/bulk-importer/handlers/filter/index.js.map +1 -0
- package/lib/bulk-importer/handlers/filter/remove.d.ts +20 -0
- package/lib/bulk-importer/handlers/filter/remove.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/filter/remove.js +18 -0
- package/lib/bulk-importer/handlers/filter/remove.js.map +1 -0
- package/lib/bulk-importer/handlers/filter/update.d.ts +138 -0
- package/lib/bulk-importer/handlers/filter/update.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/filter/update.js +70 -0
- package/lib/bulk-importer/handlers/filter/update.js.map +1 -0
- package/lib/bulk-importer/handlers/product/create.d.ts +1330 -0
- package/lib/bulk-importer/handlers/product/create.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/product/create.js +132 -0
- package/lib/bulk-importer/handlers/product/create.js.map +1 -0
- package/lib/bulk-importer/handlers/product/index.d.ts +4 -0
- package/lib/bulk-importer/handlers/product/index.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/product/index.js +4 -0
- package/lib/bulk-importer/handlers/product/index.js.map +1 -0
- package/lib/bulk-importer/handlers/product/remove.d.ts +32 -0
- package/lib/bulk-importer/handlers/product/remove.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/product/remove.js +18 -0
- package/lib/bulk-importer/handlers/product/remove.js.map +1 -0
- package/lib/bulk-importer/handlers/product/transformSpecificationToProductStructure.d.ts +280 -0
- package/lib/bulk-importer/handlers/product/transformSpecificationToProductStructure.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/product/transformSpecificationToProductStructure.js +77 -0
- package/lib/bulk-importer/handlers/product/transformSpecificationToProductStructure.js.map +1 -0
- package/lib/bulk-importer/handlers/product/update.d.ts +1330 -0
- package/lib/bulk-importer/handlers/product/update.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/product/update.js +132 -0
- package/lib/bulk-importer/handlers/product/update.js.map +1 -0
- package/lib/bulk-importer/handlers/product/upsertMedia.d.ts +75 -0
- package/lib/bulk-importer/handlers/product/upsertMedia.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/product/upsertMedia.js +59 -0
- package/lib/bulk-importer/handlers/product/upsertMedia.js.map +1 -0
- package/lib/bulk-importer/handlers/product/upsertVariations.d.ts +79 -0
- package/lib/bulk-importer/handlers/product/upsertVariations.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/product/upsertVariations.js +72 -0
- package/lib/bulk-importer/handlers/product/upsertVariations.js.map +1 -0
- package/lib/bulk-importer/handlers/utils/convertTagsToLowerCase.d.ts +3 -0
- package/lib/bulk-importer/handlers/utils/convertTagsToLowerCase.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/utils/convertTagsToLowerCase.js +6 -0
- package/lib/bulk-importer/handlers/utils/convertTagsToLowerCase.js.map +1 -0
- package/lib/bulk-importer/handlers/utils/event-schema.d.ts +21 -0
- package/lib/bulk-importer/handlers/utils/event-schema.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/utils/event-schema.js +64 -0
- package/lib/bulk-importer/handlers/utils/event-schema.js.map +1 -0
- package/lib/bulk-importer/index.d.ts +4 -0
- package/lib/bulk-importer/index.d.ts.map +1 -0
- package/lib/bulk-importer/index.js +4 -0
- package/lib/bulk-importer/index.js.map +1 -0
- package/lib/bulk-importer/upsertAsset.d.ts +28 -0
- package/lib/bulk-importer/upsertAsset.d.ts.map +1 -0
- package/lib/bulk-importer/upsertAsset.js +41 -0
- package/lib/bulk-importer/upsertAsset.js.map +1 -0
- package/lib/core-index.d.ts +9 -6
- package/lib/core-index.d.ts.map +1 -1
- package/lib/core-index.js +5 -1
- package/lib/core-index.js.map +1 -1
- package/lib/directors/BaseDiscountAdapter.d.ts +4 -4
- package/lib/directors/BaseDiscountAdapter.d.ts.map +1 -1
- package/lib/directors/BaseDiscountAdapter.js +1 -1
- package/lib/directors/BaseDiscountAdapter.js.map +1 -1
- package/lib/directors/BaseDiscountDirector.d.ts +1 -1
- package/lib/directors/BaseDiscountDirector.d.ts.map +1 -1
- package/lib/directors/BaseDiscountDirector.js +1 -1
- package/lib/directors/BaseDiscountDirector.js.map +1 -1
- package/lib/directors/BasePricingAdapter.d.ts +2 -2
- package/lib/directors/BasePricingAdapter.d.ts.map +1 -1
- package/lib/directors/BasePricingDirector.d.ts.map +1 -1
- package/lib/directors/BasePricingDirector.js +3 -3
- package/lib/directors/BasePricingDirector.js.map +1 -1
- package/lib/directors/BasePricingSheet.js.map +1 -1
- package/lib/directors/BaseWorker.d.ts +3 -3
- package/lib/directors/BaseWorker.d.ts.map +1 -1
- package/lib/directors/BaseWorker.js +12 -12
- package/lib/directors/BaseWorker.js.map +1 -1
- package/lib/directors/DeliveryAdapter.d.ts +4 -5
- package/lib/directors/DeliveryAdapter.d.ts.map +1 -1
- package/lib/directors/DeliveryAdapter.js.map +1 -1
- package/lib/directors/DeliveryDirector.d.ts +3 -3
- package/lib/directors/DeliveryDirector.d.ts.map +1 -1
- package/lib/directors/DeliveryDirector.js +29 -16
- package/lib/directors/DeliveryDirector.js.map +1 -1
- package/lib/directors/DeliveryPricingAdapter.d.ts +1 -1
- package/lib/directors/DeliveryPricingAdapter.d.ts.map +1 -1
- package/lib/directors/DeliveryPricingDirector.d.ts.map +1 -1
- package/lib/directors/DeliveryPricingDirector.js +3 -4
- package/lib/directors/DeliveryPricingDirector.js.map +1 -1
- package/lib/directors/DeliveryPricingSheet.d.ts.map +1 -1
- package/lib/directors/DeliveryPricingSheet.js +2 -1
- package/lib/directors/DeliveryPricingSheet.js.map +1 -1
- package/lib/directors/EnrollmentAdapter.d.ts +7 -4
- package/lib/directors/EnrollmentAdapter.d.ts.map +1 -1
- package/lib/directors/EnrollmentAdapter.js +1 -4
- package/lib/directors/EnrollmentAdapter.js.map +1 -1
- package/lib/directors/EnrollmentDirector.d.ts +1 -1
- package/lib/directors/EnrollmentDirector.d.ts.map +1 -1
- package/lib/directors/EnrollmentDirector.js +1 -5
- package/lib/directors/EnrollmentDirector.js.map +1 -1
- package/lib/directors/EventListenerWorker.d.ts.map +1 -1
- package/lib/directors/EventListenerWorker.js +50 -18
- package/lib/directors/EventListenerWorker.js.map +1 -1
- package/lib/directors/FailedRescheduler.d.ts +2 -2
- package/lib/directors/FailedRescheduler.d.ts.map +1 -1
- package/lib/directors/FailedRescheduler.js +1 -1
- package/lib/directors/FailedRescheduler.js.map +1 -1
- package/lib/directors/FilterAdapter.d.ts +4 -4
- package/lib/directors/FilterAdapter.d.ts.map +1 -1
- package/lib/directors/FilterDirector.d.ts +1 -1
- package/lib/directors/FilterDirector.d.ts.map +1 -1
- package/lib/directors/FilterDirector.js +7 -8
- package/lib/directors/FilterDirector.js.map +1 -1
- package/lib/directors/IntervalWorker.d.ts.map +1 -1
- package/lib/directors/IntervalWorker.js +27 -9
- package/lib/directors/IntervalWorker.js.map +1 -1
- package/lib/directors/MessagingDirector.d.ts +2 -2
- package/lib/directors/MessagingDirector.d.ts.map +1 -1
- package/lib/directors/OrderDiscountAdapter.d.ts +1 -1
- package/lib/directors/OrderDiscountAdapter.d.ts.map +1 -1
- package/lib/directors/OrderDiscountAdapter.js.map +1 -1
- package/lib/directors/OrderPricingAdapter.d.ts +2 -2
- package/lib/directors/OrderPricingAdapter.d.ts.map +1 -1
- package/lib/directors/OrderPricingDirector.d.ts +2 -2
- package/lib/directors/OrderPricingDirector.d.ts.map +1 -1
- package/lib/directors/OrderPricingDirector.js +1 -1
- package/lib/directors/OrderPricingDirector.js.map +1 -1
- package/lib/directors/OrderPricingSheet.d.ts.map +1 -1
- package/lib/directors/OrderPricingSheet.js +2 -1
- package/lib/directors/OrderPricingSheet.js.map +1 -1
- package/lib/directors/PaymentAdapter.d.ts +2 -2
- package/lib/directors/PaymentAdapter.d.ts.map +1 -1
- package/lib/directors/PaymentDirector.d.ts +4 -4
- package/lib/directors/PaymentDirector.d.ts.map +1 -1
- package/lib/directors/PaymentDirector.js +24 -6
- package/lib/directors/PaymentDirector.js.map +1 -1
- package/lib/directors/PaymentPricingAdapter.d.ts +2 -2
- package/lib/directors/PaymentPricingAdapter.d.ts.map +1 -1
- package/lib/directors/PaymentPricingDirector.d.ts +1 -1
- package/lib/directors/PaymentPricingDirector.d.ts.map +1 -1
- package/lib/directors/PaymentPricingDirector.js +3 -5
- package/lib/directors/PaymentPricingDirector.js.map +1 -1
- package/lib/directors/PaymentPricingSheet.d.ts.map +1 -1
- package/lib/directors/PaymentPricingSheet.js +2 -1
- package/lib/directors/PaymentPricingSheet.js.map +1 -1
- package/lib/directors/ProductDiscountAdapter.d.ts +1 -1
- package/lib/directors/ProductDiscountAdapter.d.ts.map +1 -1
- package/lib/directors/ProductDiscountAdapter.js.map +1 -1
- package/lib/directors/ProductDiscountConfiguration.d.ts +1 -1
- package/lib/directors/ProductDiscountConfiguration.d.ts.map +1 -1
- package/lib/directors/ProductPricingAdapter.d.ts +1 -1
- package/lib/directors/ProductPricingAdapter.d.ts.map +1 -1
- package/lib/directors/ProductPricingDirector.d.ts +2 -2
- package/lib/directors/ProductPricingDirector.d.ts.map +1 -1
- package/lib/directors/ProductPricingDirector.js +3 -3
- package/lib/directors/ProductPricingDirector.js.map +1 -1
- package/lib/directors/ProductPricingSheet.d.ts +2 -2
- package/lib/directors/ProductPricingSheet.d.ts.map +1 -1
- package/lib/directors/ProductPricingSheet.js +2 -1
- package/lib/directors/ProductPricingSheet.js.map +1 -1
- package/lib/directors/QuotationAdapter.d.ts +2 -2
- package/lib/directors/QuotationAdapter.d.ts.map +1 -1
- package/lib/directors/QuotationDirector.js +2 -2
- package/lib/directors/WarehousingAdapter.d.ts +3 -4
- package/lib/directors/WarehousingAdapter.d.ts.map +1 -1
- package/lib/directors/WarehousingAdapter.js.map +1 -1
- package/lib/directors/WarehousingDirector.d.ts +5 -5
- package/lib/directors/WarehousingDirector.d.ts.map +1 -1
- package/lib/directors/WarehousingDirector.js +10 -13
- package/lib/directors/WarehousingDirector.js.map +1 -1
- package/lib/directors/WorkerAdapter.d.ts +3 -2
- package/lib/directors/WorkerAdapter.d.ts.map +1 -1
- package/lib/directors/WorkerAdapter.js +1 -1
- package/lib/directors/WorkerAdapter.js.map +1 -1
- package/lib/directors/WorkerDirector.d.ts +2 -2
- package/lib/directors/WorkerDirector.d.ts.map +1 -1
- package/lib/directors/WorkerDirector.js +2 -3
- package/lib/directors/WorkerDirector.js.map +1 -1
- package/lib/factory/index.d.ts +3 -0
- package/lib/factory/index.d.ts.map +1 -0
- package/lib/factory/index.js +3 -0
- package/lib/factory/index.js.map +1 -0
- package/lib/factory/registerProductDiscoverabilityFilter.d.ts +5 -0
- package/lib/factory/registerProductDiscoverabilityFilter.d.ts.map +1 -0
- package/lib/factory/registerProductDiscoverabilityFilter.js +27 -0
- package/lib/factory/registerProductDiscoverabilityFilter.js.map +1 -0
- package/lib/modules.d.ts +4 -5
- package/lib/modules.d.ts.map +1 -1
- package/lib/modules.js +3 -3
- package/lib/modules.js.map +1 -1
- package/lib/services/activateEnrollment.d.ts.map +1 -1
- package/lib/services/activateEnrollment.js +8 -12
- package/lib/services/activateEnrollment.js.map +1 -1
- package/lib/services/addMessage.d.ts +4 -0
- package/lib/services/addMessage.d.ts.map +1 -0
- package/lib/services/addMessage.js +15 -0
- package/lib/services/addMessage.js.map +1 -0
- package/lib/services/calculateDiscountTotal.js +2 -2
- package/lib/services/calculateDiscountTotal.js.map +1 -1
- package/lib/services/checkoutOrder.d.ts +1 -1
- package/lib/services/checkoutOrder.d.ts.map +1 -1
- package/lib/services/checkoutOrder.js +10 -4
- package/lib/services/checkoutOrder.js.map +1 -1
- package/lib/services/confirmOrder.d.ts +1 -1
- package/lib/services/confirmOrder.d.ts.map +1 -1
- package/lib/services/createDownloadStream.d.ts +1 -1
- package/lib/services/createDownloadStream.d.ts.map +1 -1
- package/lib/services/createDownloadStream.js +2 -0
- package/lib/services/createDownloadStream.js.map +1 -1
- package/lib/services/createEnrollmentFromCheckout.d.ts.map +1 -1
- package/lib/services/createEnrollmentFromCheckout.js +2 -2
- package/lib/services/createEnrollmentFromCheckout.js.map +1 -1
- package/lib/services/createManualOrderDiscount.d.ts +2 -2
- package/lib/services/createManualOrderDiscount.d.ts.map +1 -1
- package/lib/services/createSignedURL.d.ts.map +1 -1
- package/lib/services/createSignedURL.js +2 -0
- package/lib/services/createSignedURL.js.map +1 -1
- package/lib/services/deleteUser.d.ts +1 -1
- package/lib/services/deleteUser.d.ts.map +1 -1
- package/lib/services/deleteUser.js +4 -2
- package/lib/services/deleteUser.js.map +1 -1
- package/lib/services/discountedEntities.js.map +1 -1
- package/lib/services/findOrInitCart.d.ts +1 -2
- package/lib/services/findOrInitCart.d.ts.map +1 -1
- package/lib/services/findOrInitCart.js.map +1 -1
- package/lib/services/fullfillQuotation.d.ts +1 -1
- package/lib/services/fullfillQuotation.d.ts.map +1 -1
- package/lib/services/fullfillQuotation.js.map +1 -1
- package/lib/services/generateOrderFromEnrollment.d.ts +7 -0
- package/lib/services/generateOrderFromEnrollment.d.ts.map +1 -0
- package/lib/services/generateOrderFromEnrollment.js +34 -0
- package/lib/services/generateOrderFromEnrollment.js.map +1 -0
- package/lib/services/index.d.ts +6 -0
- package/lib/services/index.d.ts.map +1 -1
- package/lib/services/index.js +6 -0
- package/lib/services/index.js.map +1 -1
- package/lib/services/initCartProviders.d.ts.map +1 -1
- package/lib/services/initCartProviders.js +6 -2
- package/lib/services/initCartProviders.js.map +1 -1
- package/lib/services/initializeEnrollment.d.ts +1 -1
- package/lib/services/initializeEnrollment.d.ts.map +1 -1
- package/lib/services/initializeEnrollment.js +11 -12
- package/lib/services/initializeEnrollment.js.map +1 -1
- package/lib/services/linkFileService.d.ts +1 -1
- package/lib/services/linkFileService.d.ts.map +1 -1
- package/lib/services/linkFileService.js +3 -1
- package/lib/services/linkFileService.js.map +1 -1
- package/lib/services/loadFilterOptions.d.ts +2 -2
- package/lib/services/loadFilterOptions.d.ts.map +1 -1
- package/lib/services/migrateOrderCart.d.ts +1 -1
- package/lib/services/migrateOrderCart.d.ts.map +1 -1
- package/lib/services/nextUserCart.d.ts +1 -1
- package/lib/services/nextUserCart.d.ts.map +1 -1
- package/lib/services/nextUserCart.js +1 -1
- package/lib/services/nextUserCart.js.map +1 -1
- package/lib/services/processEnrollment.d.ts.map +1 -1
- package/lib/services/processEnrollment.js +13 -5
- package/lib/services/processEnrollment.js.map +1 -1
- package/lib/services/processOrder.d.ts.map +1 -1
- package/lib/services/processOrder.js +30 -30
- package/lib/services/processOrder.js.map +1 -1
- package/lib/services/processQuotation.d.ts.map +1 -1
- package/lib/services/processQuotation.js +10 -14
- package/lib/services/processQuotation.js.map +1 -1
- package/lib/services/proposeQuotation.d.ts +1 -1
- package/lib/services/proposeQuotation.d.ts.map +1 -1
- package/lib/services/proposeQuotation.js +2 -2
- package/lib/services/proposeQuotation.js.map +1 -1
- package/lib/services/registerPaymentCredentials.d.ts +1 -2
- package/lib/services/registerPaymentCredentials.d.ts.map +1 -1
- package/lib/services/registerPaymentCredentials.js +4 -6
- package/lib/services/registerPaymentCredentials.js.map +1 -1
- package/lib/services/rejectOrder.d.ts +1 -1
- package/lib/services/rejectOrder.d.ts.map +1 -1
- package/lib/services/rejectQuotation.d.ts +1 -1
- package/lib/services/rejectQuotation.d.ts.map +1 -1
- package/lib/services/rejectQuotation.js +2 -2
- package/lib/services/rejectQuotation.js.map +1 -1
- package/lib/services/removeFiles.js +2 -2
- package/lib/services/removeFiles.js.map +1 -1
- package/lib/services/removeProduct.d.ts.map +1 -1
- package/lib/services/removeProduct.js +4 -3
- package/lib/services/removeProduct.js.map +1 -1
- package/lib/services/searchAssortments.d.ts.map +1 -1
- package/lib/services/searchAssortments.js +3 -2
- package/lib/services/searchAssortments.js.map +1 -1
- package/lib/services/searchProducts.js +3 -3
- package/lib/services/searchProducts.js.map +1 -1
- package/lib/services/simulateProductDispatching.d.ts +1 -1
- package/lib/services/simulateProductDispatching.d.ts.map +1 -1
- package/lib/services/simulateProductInventory.d.ts +1 -1
- package/lib/services/simulateProductInventory.d.ts.map +1 -1
- package/lib/services/simulateProductInventory.js.map +1 -1
- package/lib/services/simulateProductPricing.d.ts +7 -4
- package/lib/services/simulateProductPricing.d.ts.map +1 -1
- package/lib/services/simulateProductPricing.js.map +1 -1
- package/lib/services/terminateEnrollment.d.ts.map +1 -1
- package/lib/services/terminateEnrollment.js +5 -9
- package/lib/services/terminateEnrollment.js.map +1 -1
- package/lib/services/updateCalculation.d.ts +2 -1
- package/lib/services/updateCalculation.d.ts.map +1 -1
- package/lib/services/updateCalculation.js +20 -12
- package/lib/services/updateCalculation.js.map +1 -1
- package/lib/services/updateScheduling.d.ts +1 -1
- package/lib/services/updateScheduling.d.ts.map +1 -1
- package/lib/services/updateScheduling.js +7 -11
- package/lib/services/updateScheduling.js.map +1 -1
- package/lib/services/updateUserAvatarAfterUpload.d.ts +1 -1
- package/lib/services/updateUserAvatarAfterUpload.d.ts.map +1 -1
- package/lib/services/updateUserAvatarAfterUpload.js.map +1 -1
- package/lib/services/uploadFileFromStream.d.ts +2 -2
- package/lib/services/uploadFileFromStream.d.ts.map +1 -1
- package/lib/services/uploadFileFromStream.js +6 -3
- package/lib/services/uploadFileFromStream.js.map +1 -1
- package/lib/services/uploadFileFromURL.d.ts +1 -2
- package/lib/services/uploadFileFromURL.d.ts.map +1 -1
- package/lib/services/uploadFileFromURL.js.map +1 -1
- package/lib/services/validateOrder.d.ts +1 -1
- package/lib/services/validateOrder.d.ts.map +1 -1
- package/lib/services/validateOrder.js +17 -24
- package/lib/services/validateOrder.js.map +1 -1
- package/lib/services/verifyQuotation.d.ts +1 -1
- package/lib/services/verifyQuotation.d.ts.map +1 -1
- package/lib/services/verifyQuotation.js +2 -2
- package/lib/services/verifyQuotation.js.map +1 -1
- package/package.json +23 -22
- package/src/bulk-importer/createBulkImporter.ts +205 -0
- package/src/bulk-importer/handlers/assortment/create.ts +118 -0
- package/src/bulk-importer/handlers/assortment/index.ts +3 -0
- package/src/bulk-importer/handlers/assortment/remove.ts +26 -0
- package/src/bulk-importer/handlers/assortment/update.ts +133 -0
- package/src/bulk-importer/handlers/assortment/upsertAssortmentChildren.ts +77 -0
- package/src/bulk-importer/handlers/assortment/upsertAssortmentFilters.ts +70 -0
- package/src/bulk-importer/handlers/assortment/upsertAssortmentProducts.ts +76 -0
- package/src/bulk-importer/handlers/assortment/upsertMedia.ts +76 -0
- package/src/bulk-importer/handlers/filter/create.ts +104 -0
- package/src/bulk-importer/handlers/filter/index.ts +3 -0
- package/src/bulk-importer/handlers/filter/remove.ts +25 -0
- package/src/bulk-importer/handlers/filter/update.ts +94 -0
- package/src/bulk-importer/handlers/product/create.ts +170 -0
- package/src/bulk-importer/handlers/product/index.ts +3 -0
- package/src/bulk-importer/handlers/product/remove.ts +27 -0
- package/src/bulk-importer/handlers/product/update.ts +175 -0
- package/src/bulk-importer/handlers/product/upsertMedia.ts +81 -0
- package/src/bulk-importer/handlers/product/upsertVariations.ts +110 -0
- package/src/bulk-importer/handlers/utils/convertTagsToLowerCase.ts +4 -0
- package/src/bulk-importer/index.ts +3 -0
- package/src/bulk-importer/upsertAsset.ts +50 -0
- package/src/core-index.ts +10 -7
- package/src/directors/BaseDiscountAdapter.test.ts +1 -1
- package/src/directors/BaseDiscountAdapter.ts +5 -5
- package/src/directors/BaseDiscountDirector.ts +2 -2
- package/src/directors/BasePricingAdapter.ts +2 -2
- package/src/directors/BasePricingDirector.ts +47 -44
- package/src/directors/BasePricingSheet.ts +1 -1
- package/src/directors/BaseWorker.ts +14 -13
- package/src/directors/DeliveryAdapter.ts +3 -5
- package/src/directors/DeliveryDirector.ts +33 -23
- package/src/directors/DeliveryPricingAdapter.ts +1 -1
- package/src/directors/DeliveryPricingDirector.ts +5 -6
- package/src/directors/DeliveryPricingSheet.ts +3 -2
- package/src/directors/EnrollmentAdapter.ts +9 -6
- package/src/directors/EnrollmentDirector.ts +9 -8
- package/src/directors/EventListenerWorker.ts +59 -19
- package/src/directors/FailedRescheduler.ts +2 -2
- package/src/directors/FilterAdapter.ts +4 -4
- package/src/directors/FilterDirector.ts +11 -12
- package/src/directors/IntervalWorker.ts +30 -9
- package/src/directors/MessagingDirector.ts +1 -1
- package/src/directors/OrderDiscountAdapter.ts +2 -2
- package/src/directors/OrderPricingAdapter.ts +2 -2
- package/src/directors/OrderPricingDirector.ts +3 -3
- package/src/directors/OrderPricingSheet.ts +3 -2
- package/src/directors/PaymentAdapter.ts +2 -2
- package/src/directors/PaymentDirector.ts +34 -10
- package/src/directors/PaymentPricingAdapter.ts +2 -2
- package/src/directors/PaymentPricingDirector.ts +6 -8
- package/src/directors/PaymentPricingSheet.ts +3 -2
- package/src/directors/ProductDiscountAdapter.ts +2 -2
- package/src/directors/ProductDiscountConfiguration.ts +1 -1
- package/src/directors/ProductPricingAdapter.ts +1 -1
- package/src/directors/ProductPricingDirector.ts +7 -7
- package/src/directors/ProductPricingSheet.ts +4 -3
- package/src/directors/QuotationAdapter.ts +2 -2
- package/src/directors/QuotationDirector.ts +2 -2
- package/src/directors/WarehousingAdapter.ts +3 -4
- package/src/directors/WarehousingDirector.ts +20 -23
- package/src/directors/WorkerAdapter.ts +9 -4
- package/src/directors/WorkerDirector.ts +5 -6
- package/src/factory/index.ts +3 -0
- package/src/factory/registerProductDiscoverabilityFilter.ts +36 -0
- package/src/modules.ts +6 -7
- package/src/services/activateEnrollment.ts +9 -13
- package/src/services/addMessage.ts +20 -0
- package/src/services/calculateDiscountTotal.ts +4 -4
- package/src/services/checkoutOrder.ts +10 -5
- package/src/services/createDownloadStream.ts +1 -0
- package/src/services/createEnrollmentFromCheckout.ts +22 -20
- package/src/services/createManualOrderDiscount.ts +2 -2
- package/src/services/createSignedURL.ts +1 -0
- package/src/services/deleteUser.ts +7 -2
- package/src/services/discountedEntities.ts +6 -6
- package/src/services/findOrInitCart.ts +1 -2
- package/src/services/fullfillQuotation.ts +1 -1
- package/src/services/generateOrderFromEnrollment.ts +54 -0
- package/src/services/index.ts +8 -0
- package/src/services/initCartProviders.ts +8 -10
- package/src/services/initializeEnrollment.ts +16 -13
- package/src/services/linkFileService.ts +3 -1
- package/src/services/nextUserCart.ts +1 -1
- package/src/services/processEnrollment.ts +18 -6
- package/src/services/processOrder.ts +37 -36
- package/src/services/processQuotation.ts +10 -14
- package/src/services/proposeQuotation.ts +2 -2
- package/src/services/registerPaymentCredentials.ts +6 -8
- package/src/services/rejectQuotation.ts +2 -2
- package/src/services/removeFiles.ts +2 -2
- package/src/services/removeProduct.ts +5 -3
- package/src/services/searchAssortments.ts +3 -2
- package/src/services/searchProducts.ts +3 -3
- package/src/services/simulateProductDispatching.ts +1 -1
- package/src/services/simulateProductInventory.ts +7 -3
- package/src/services/simulateProductPricing.ts +6 -3
- package/src/services/terminateEnrollment.ts +5 -9
- package/src/services/updateCalculation.ts +37 -20
- package/src/services/updateScheduling.ts +19 -20
- package/src/services/updateUserAvatarAfterUpload.ts +4 -1
- package/src/services/uploadFileFromStream.ts +17 -5
- package/src/services/uploadFileFromURL.ts +2 -2
- package/src/services/validateOrder.ts +34 -38
- package/src/services/verifyQuotation.ts +2 -2
|
@@ -6,11 +6,13 @@ export async function linkFileService(
|
|
|
6
6
|
{ fileId, size, type }: { fileId: string; size?: number; type?: string },
|
|
7
7
|
) {
|
|
8
8
|
const file = await this.files.findFile({ fileId });
|
|
9
|
+
if (!file) return null;
|
|
10
|
+
|
|
9
11
|
await this.files.update(file._id, {
|
|
10
12
|
size: size || file.size,
|
|
11
13
|
type: type || file.type,
|
|
12
|
-
expires: null,
|
|
13
14
|
});
|
|
15
|
+
await this.files.unexpire(file._id);
|
|
14
16
|
if (file?.expires) {
|
|
15
17
|
const callback = FileDirector.getFileUploadCallback(file.path);
|
|
16
18
|
if (callback) {
|
|
@@ -30,7 +30,7 @@ export async function nextUserCartService(
|
|
|
30
30
|
|
|
31
31
|
const countryObject = await this.countries.findCountry({ isoCode: countryCode });
|
|
32
32
|
const currencies = await this.currencies.findCurrencies({ includeInactive: false });
|
|
33
|
-
const currencyCode = resolveBestCurrency(countryObject
|
|
33
|
+
const currencyCode = resolveBestCurrency(countryObject?.defaultCurrencyCode || null, currencies);
|
|
34
34
|
|
|
35
35
|
const order = await this.orders.create({
|
|
36
36
|
userId: user._id,
|
|
@@ -2,9 +2,18 @@ import { Enrollment, EnrollmentStatus } from '@unchainedshop/core-enrollments';
|
|
|
2
2
|
import { Modules } from '../modules.js';
|
|
3
3
|
import { EnrollmentDirector } from '../core-index.js';
|
|
4
4
|
|
|
5
|
-
const findNextStatus = async (
|
|
5
|
+
const findNextStatus = async (
|
|
6
|
+
enrollment: Enrollment,
|
|
7
|
+
modules: Modules,
|
|
8
|
+
): Promise<EnrollmentStatus | null> => {
|
|
6
9
|
let status = enrollment.status;
|
|
7
|
-
const
|
|
10
|
+
const product = await modules.products.findProduct({
|
|
11
|
+
productId: enrollment.productId,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
if (!product) throw new Error('Product not found for enrollment');
|
|
15
|
+
|
|
16
|
+
const director = await EnrollmentDirector.actions({ enrollment, product }, { modules });
|
|
8
17
|
|
|
9
18
|
if (status === EnrollmentStatus.INITIAL || status === EnrollmentStatus.PAUSED) {
|
|
10
19
|
if (await director.isValidForActivation()) {
|
|
@@ -30,8 +39,11 @@ export async function processEnrollmentService(this: Modules, enrollment: Enroll
|
|
|
30
39
|
// status = await findNextStatus(nextEnrollment, unchainedAPI);
|
|
31
40
|
}
|
|
32
41
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
42
|
+
if (status) {
|
|
43
|
+
return this.enrollments.updateStatus(enrollment._id, {
|
|
44
|
+
status,
|
|
45
|
+
info: 'enrollment processed',
|
|
46
|
+
}) as Promise<Enrollment>;
|
|
47
|
+
}
|
|
48
|
+
return enrollment;
|
|
37
49
|
}
|
|
@@ -4,11 +4,12 @@ import {
|
|
|
4
4
|
OrderDeliveryStatus,
|
|
5
5
|
OrderPayment,
|
|
6
6
|
OrderPaymentStatus,
|
|
7
|
+
OrderPosition,
|
|
7
8
|
OrderStatus,
|
|
8
9
|
} from '@unchainedshop/core-orders';
|
|
9
10
|
import { Modules } from '../modules.js';
|
|
10
11
|
import { createEnrollmentFromCheckoutService } from './createEnrollmentFromCheckout.js';
|
|
11
|
-
import { ProductTypes } from '@unchainedshop/core-products';
|
|
12
|
+
import { Product, ProductTypes } from '@unchainedshop/core-products';
|
|
12
13
|
import { WarehousingProviderType } from '@unchainedshop/core-warehousing';
|
|
13
14
|
import { WarehousingDirector, DeliveryDirector, PaymentDirector } from '../directors/index.js';
|
|
14
15
|
import { fullfillQuotationService } from './fullfillQuotation.js';
|
|
@@ -24,10 +25,12 @@ const isAutoConfirmationEnabled = async (
|
|
|
24
25
|
modules: Modules,
|
|
25
26
|
) => {
|
|
26
27
|
if (orderPayment.status !== OrderPaymentStatus.PAID) {
|
|
27
|
-
const
|
|
28
|
+
const paymentProvider = await modules.payment.paymentProviders.findProvider({
|
|
28
29
|
paymentProviderId: orderPayment.paymentProviderId,
|
|
29
30
|
});
|
|
30
|
-
|
|
31
|
+
if (!paymentProvider)
|
|
32
|
+
throw new Error('Payment provider not found: ' + orderPayment.paymentProviderId);
|
|
33
|
+
const actions = await PaymentDirector.actions(paymentProvider, {}, { modules });
|
|
31
34
|
if (!actions.isPayLaterAllowed()) return false;
|
|
32
35
|
}
|
|
33
36
|
|
|
@@ -35,6 +38,8 @@ const isAutoConfirmationEnabled = async (
|
|
|
35
38
|
const deliveryProvider = await modules.delivery.findProvider({
|
|
36
39
|
deliveryProviderId: orderDelivery.deliveryProviderId,
|
|
37
40
|
});
|
|
41
|
+
if (!deliveryProvider)
|
|
42
|
+
throw new Error('Delivery provider not found: ' + orderDelivery.deliveryProviderId);
|
|
38
43
|
const director = await DeliveryDirector.actions(deliveryProvider, {}, { modules });
|
|
39
44
|
if (!director.isAutoReleaseAllowed()) return false;
|
|
40
45
|
}
|
|
@@ -56,14 +61,18 @@ const findNextStatus = async (
|
|
|
56
61
|
return status;
|
|
57
62
|
}
|
|
58
63
|
|
|
59
|
-
const orderPayment =
|
|
60
|
-
|
|
61
|
-
|
|
64
|
+
const orderPayment =
|
|
65
|
+
order.paymentId &&
|
|
66
|
+
(await modules.orders.payments.findOrderPayment({
|
|
67
|
+
orderPaymentId: order.paymentId,
|
|
68
|
+
}));
|
|
62
69
|
if (!orderPayment) return status;
|
|
63
70
|
|
|
64
|
-
const orderDelivery =
|
|
65
|
-
|
|
66
|
-
|
|
71
|
+
const orderDelivery =
|
|
72
|
+
order.deliveryId &&
|
|
73
|
+
(await modules.orders.deliveries.findDelivery({
|
|
74
|
+
orderDeliveryId: order.deliveryId,
|
|
75
|
+
}));
|
|
67
76
|
if (!orderDelivery) return status;
|
|
68
77
|
|
|
69
78
|
// Ok, we have a payment and a delivery and the correct status,
|
|
@@ -108,26 +117,18 @@ export async function processOrderService(
|
|
|
108
117
|
|
|
109
118
|
if (nextStatus === OrderStatus.PENDING) {
|
|
110
119
|
// auto charge during transition to pending
|
|
111
|
-
const orderPayment = await this.orders.payments.findOrderPayment({
|
|
112
|
-
orderPaymentId: order.paymentId,
|
|
113
|
-
});
|
|
114
|
-
|
|
115
120
|
await PaymentDirector.chargeOrderPayment(
|
|
116
|
-
|
|
121
|
+
order,
|
|
117
122
|
{ userId: order.userId, transactionContext: paymentContext },
|
|
118
123
|
{ modules: this },
|
|
119
124
|
);
|
|
120
|
-
|
|
121
125
|
nextStatus = await findNextStatus(nextStatus, order, this);
|
|
122
126
|
}
|
|
123
127
|
|
|
124
128
|
if (nextStatus === OrderStatus.REJECTED) {
|
|
125
129
|
// auto cancel during transition to rejected
|
|
126
|
-
const orderPayment = await this.orders.payments.findOrderPayment({
|
|
127
|
-
orderPaymentId: order.paymentId,
|
|
128
|
-
});
|
|
129
130
|
await PaymentDirector.cancelOrderPayment(
|
|
130
|
-
|
|
131
|
+
order,
|
|
131
132
|
{ userId: order.userId, transactionContext: paymentContext },
|
|
132
133
|
{ modules: this },
|
|
133
134
|
);
|
|
@@ -135,11 +136,8 @@ export async function processOrderService(
|
|
|
135
136
|
|
|
136
137
|
if (nextStatus === OrderStatus.CONFIRMED) {
|
|
137
138
|
// confirm pre-authorized payments
|
|
138
|
-
const orderPayment = await this.orders.payments.findOrderPayment({
|
|
139
|
-
orderPaymentId: order.paymentId,
|
|
140
|
-
});
|
|
141
139
|
await PaymentDirector.confirmOrderPayment(
|
|
142
|
-
|
|
140
|
+
order,
|
|
143
141
|
{ userId: order.userId, transactionContext: paymentContext },
|
|
144
142
|
{ modules: this },
|
|
145
143
|
);
|
|
@@ -147,23 +145,23 @@ export async function processOrderService(
|
|
|
147
145
|
// we have to stop here shortly to complete the confirmation
|
|
148
146
|
// before auto delivery is started, else we have no chance to create
|
|
149
147
|
// numbers that are needed for delivery
|
|
150
|
-
order = await this.orders.updateStatus(orderId, {
|
|
148
|
+
order = (await this.orders.updateStatus(orderId, {
|
|
151
149
|
status: OrderStatus.CONFIRMED,
|
|
152
150
|
info: comment,
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
const orderDelivery = await this.orders.deliveries.findDelivery({
|
|
156
|
-
orderDeliveryId: order.deliveryId,
|
|
157
|
-
});
|
|
151
|
+
})) as Order;
|
|
158
152
|
|
|
159
|
-
|
|
153
|
+
// TODO: What happens if this THROWS?
|
|
154
|
+
// Tokenization would be skipped?
|
|
155
|
+
// Enrollments will not be there?
|
|
156
|
+
// Quotations would not fulfil?
|
|
157
|
+
await DeliveryDirector.sendOrderDelivery(order, deliveryContext, { modules: this });
|
|
160
158
|
|
|
161
159
|
const orderPositions = await this.orders.positions.findOrderPositions({ orderId });
|
|
162
160
|
const mappedProductOrderPositions = await Promise.all(
|
|
163
161
|
orderPositions.map(async (orderPosition) => {
|
|
164
|
-
const product = await this.products.findProduct({
|
|
162
|
+
const product = (await this.products.findProduct({
|
|
165
163
|
productId: orderPosition.productId,
|
|
166
|
-
});
|
|
164
|
+
})) as Product;
|
|
167
165
|
return {
|
|
168
166
|
orderPosition,
|
|
169
167
|
product,
|
|
@@ -172,7 +170,8 @@ export async function processOrderService(
|
|
|
172
170
|
);
|
|
173
171
|
const tokenizedItems = mappedProductOrderPositions.filter(
|
|
174
172
|
(item) => item.product?.type === ProductTypes.TokenizedProduct,
|
|
175
|
-
);
|
|
173
|
+
) as { orderPosition: OrderPosition; product: Product }[];
|
|
174
|
+
|
|
176
175
|
if (tokenizedItems.length > 0) {
|
|
177
176
|
// Give virtual warehouse a chance to instantiate new virtual objects
|
|
178
177
|
const virtualProviders = (await this.warehousing.allProviders()).filter(
|
|
@@ -180,7 +179,7 @@ export async function processOrderService(
|
|
|
180
179
|
);
|
|
181
180
|
|
|
182
181
|
// It's very important to do this in a series and not in Promise.all
|
|
183
|
-
// TODO: Actually, only createTokens should decide on the unique
|
|
182
|
+
// TODO: Actually, only createTokens should decide on the unique tokenSerialNumber
|
|
184
183
|
// and the tokens should be created with a distributed Lock to not assign the same id multiple times!
|
|
185
184
|
for (const { orderPosition, product } of tokenizedItems) {
|
|
186
185
|
for (const virtualProvider of virtualProviders) {
|
|
@@ -221,12 +220,14 @@ export async function processOrderService(
|
|
|
221
220
|
// Quotations: If we came here, the checkout succeeded, so we can fullfill underlying quotations
|
|
222
221
|
const quotationItems = mappedProductOrderPositions.filter(
|
|
223
222
|
(item) => item.orderPosition.quotationId,
|
|
224
|
-
);
|
|
223
|
+
) as { orderPosition: OrderPosition & { quotationId: string }; product: Product }[];
|
|
224
|
+
|
|
225
225
|
await Promise.all(
|
|
226
226
|
quotationItems.map(async ({ orderPosition }) => {
|
|
227
227
|
const quotation = await this.quotations.findQuotation({
|
|
228
228
|
quotationId: orderPosition.quotationId,
|
|
229
229
|
});
|
|
230
|
+
if (!quotation) return; // TODO: What happens then?
|
|
230
231
|
await fullfillQuotationService.bind(this)(quotation, {
|
|
231
232
|
orderId,
|
|
232
233
|
orderPositionId: orderPosition._id,
|
|
@@ -238,5 +239,5 @@ export async function processOrderService(
|
|
|
238
239
|
nextStatus = await findNextStatus(nextStatus, order, this);
|
|
239
240
|
}
|
|
240
241
|
|
|
241
|
-
return this.orders.updateStatus(order._id, { status: nextStatus, info: comment });
|
|
242
|
+
return (await this.orders.updateStatus(order._id, { status: nextStatus, info: comment })) as Order;
|
|
242
243
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Quotation, QuotationStatus } from '@unchainedshop/core-quotations';
|
|
2
2
|
import { Modules } from '../modules.js';
|
|
3
3
|
import { QuotationDirector } from '../core-index.js';
|
|
4
|
+
import { addMessageService } from './addMessage.js';
|
|
4
5
|
|
|
5
6
|
const findNextStatus = async (quotation: Quotation, modules: Modules): Promise<QuotationStatus> => {
|
|
6
7
|
let status = quotation.status as QuotationStatus;
|
|
@@ -33,42 +34,37 @@ export async function processQuotationService(
|
|
|
33
34
|
await director.submitRequest(params.quotationContext);
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
quotation = await this.quotations.findQuotation({ quotationId });
|
|
37
|
+
quotation = (await this.quotations.findQuotation({ quotationId })) as Quotation;
|
|
37
38
|
nextStatus = await findNextStatus(quotation, this);
|
|
38
39
|
if (nextStatus !== QuotationStatus.PROCESSING) {
|
|
39
40
|
await director.verifyRequest(params.quotationContext);
|
|
40
41
|
}
|
|
41
42
|
|
|
42
|
-
quotation = await this.quotations.findQuotation({ quotationId });
|
|
43
|
+
quotation = (await this.quotations.findQuotation({ quotationId })) as Quotation;
|
|
43
44
|
nextStatus = await findNextStatus(quotation, this);
|
|
44
45
|
if (nextStatus === QuotationStatus.REJECTED) {
|
|
45
46
|
await director.rejectRequest(params.quotationContext);
|
|
46
47
|
}
|
|
47
48
|
|
|
48
|
-
quotation = await this.quotations.findQuotation({ quotationId });
|
|
49
|
+
quotation = (await this.quotations.findQuotation({ quotationId })) as Quotation;
|
|
49
50
|
nextStatus = await findNextStatus(quotation, this);
|
|
50
51
|
if (nextStatus === QuotationStatus.PROPOSED) {
|
|
51
52
|
const proposal = await director.quote();
|
|
52
|
-
quotation = await this.quotations.updateProposal(quotation._id, proposal);
|
|
53
|
+
quotation = (await this.quotations.updateProposal(quotation._id, proposal)) as Quotation;
|
|
53
54
|
nextStatus = await findNextStatus(quotation, this);
|
|
54
55
|
}
|
|
55
56
|
|
|
56
|
-
const updatedQuotation = await this.quotations.updateStatus(quotation._id, {
|
|
57
|
+
const updatedQuotation = (await this.quotations.updateStatus(quotation._id, {
|
|
57
58
|
status: nextStatus,
|
|
58
59
|
info: 'quotation processed',
|
|
59
|
-
});
|
|
60
|
+
})) as Quotation;
|
|
60
61
|
|
|
61
62
|
const user = await this.users.findUserById(updatedQuotation.userId);
|
|
62
63
|
const locale = this.users.userLocale(user);
|
|
63
64
|
|
|
64
|
-
await
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
input: {
|
|
68
|
-
locale: locale.baseName,
|
|
69
|
-
template: 'QUOTATION_STATUS',
|
|
70
|
-
quotationId: updatedQuotation._id,
|
|
71
|
-
},
|
|
65
|
+
await addMessageService.bind(this)('QUOTATION_STATUS', {
|
|
66
|
+
locale: locale.baseName,
|
|
67
|
+
quotationId: updatedQuotation._id,
|
|
72
68
|
});
|
|
73
69
|
|
|
74
70
|
return updatedQuotation;
|
|
@@ -9,10 +9,10 @@ export async function proposeQuotationService(
|
|
|
9
9
|
) {
|
|
10
10
|
if (quotation.status !== QuotationStatus.PROCESSING) return quotation;
|
|
11
11
|
|
|
12
|
-
const updatedQuotation = await this.quotations.updateStatus(quotation._id, {
|
|
12
|
+
const updatedQuotation = (await this.quotations.updateStatus(quotation._id, {
|
|
13
13
|
status: QuotationStatus.PROPOSED,
|
|
14
14
|
info: 'proposed manually',
|
|
15
|
-
});
|
|
15
|
+
})) as Quotation;
|
|
16
16
|
|
|
17
17
|
return processQuotationService.bind(this)(updatedQuotation, { quotationContext });
|
|
18
18
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { PaymentCredentials } from '@unchainedshop/core-payment';
|
|
2
1
|
import { PaymentContext } from '../directors/PaymentAdapter.js';
|
|
3
2
|
import { PaymentDirector } from '../directors/PaymentDirector.js';
|
|
4
3
|
import { Modules } from '../modules.js';
|
|
@@ -7,24 +6,23 @@ export async function registerPaymentCredentialsService(
|
|
|
7
6
|
this: Modules,
|
|
8
7
|
paymentProviderId: string,
|
|
9
8
|
paymentContext: PaymentContext,
|
|
10
|
-
)
|
|
9
|
+
) {
|
|
11
10
|
const paymentProvider = await this.payment.paymentProviders.findProvider({
|
|
12
11
|
paymentProviderId,
|
|
13
12
|
});
|
|
13
|
+
|
|
14
|
+
if (!paymentProvider) return null;
|
|
15
|
+
|
|
14
16
|
const actions = await PaymentDirector.actions(paymentProvider, paymentContext, { modules: this });
|
|
15
17
|
const registration = await actions.register();
|
|
16
18
|
|
|
17
19
|
if (!registration) return null;
|
|
18
20
|
|
|
19
|
-
const
|
|
21
|
+
const paymentCredentials = await this.payment.paymentCredentials.upsertCredentials({
|
|
20
22
|
userId: paymentContext.userId,
|
|
21
23
|
paymentProviderId,
|
|
22
24
|
...registration,
|
|
23
25
|
});
|
|
24
26
|
|
|
25
|
-
return
|
|
26
|
-
paymentCredentialsId,
|
|
27
|
-
userId: paymentContext.userId,
|
|
28
|
-
paymentProviderId,
|
|
29
|
-
});
|
|
27
|
+
return paymentCredentials;
|
|
30
28
|
}
|
|
@@ -9,10 +9,10 @@ export async function rejectQuotationService(
|
|
|
9
9
|
) {
|
|
10
10
|
if (quotation.status === QuotationStatus.FULLFILLED) return quotation;
|
|
11
11
|
|
|
12
|
-
const updatedQuotation = await this.quotations.updateStatus(quotation._id, {
|
|
12
|
+
const updatedQuotation = (await this.quotations.updateStatus(quotation._id, {
|
|
13
13
|
status: QuotationStatus.REJECTED,
|
|
14
14
|
info: 'rejected manually',
|
|
15
|
-
});
|
|
15
|
+
})) as Quotation;
|
|
16
16
|
|
|
17
17
|
return processQuotationService.bind(this)(updatedQuotation, { quotationContext });
|
|
18
18
|
}
|
|
@@ -13,8 +13,8 @@ export async function removeFilesService(this: Modules, { fileIds }: { fileIds:
|
|
|
13
13
|
|
|
14
14
|
try {
|
|
15
15
|
await fileUploadAdapter.removeFiles(fileObjects, { modules: this });
|
|
16
|
-
} catch
|
|
17
|
-
|
|
16
|
+
} catch {
|
|
17
|
+
/**/
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
const fileIdsToDelete = fileObjects.map((f) => f._id).filter(Boolean);
|
|
@@ -7,7 +7,8 @@ export async function removeProductService(
|
|
|
7
7
|
{ productId }: { productId: string },
|
|
8
8
|
): Promise<boolean> {
|
|
9
9
|
const product = await this.products.findProduct({ productId });
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
switch (product?.status) {
|
|
11
12
|
case ProductStatus.ACTIVE:
|
|
12
13
|
await this.products.unpublish(product);
|
|
13
14
|
// falls through
|
|
@@ -15,7 +16,8 @@ export async function removeProductService(
|
|
|
15
16
|
case ProductStatus.DRAFT:
|
|
16
17
|
{
|
|
17
18
|
await this.bookmarks.deleteByProductId(productId);
|
|
18
|
-
await this.assortments.products.
|
|
19
|
+
await this.assortments.products.deleteMany({ productId });
|
|
20
|
+
await this.products.removeAllAssignmentsAndBundleItems(productId);
|
|
19
21
|
const orderIdsToRecalculate =
|
|
20
22
|
await this.orders.positions.removeProductByIdFromAllOpenPositions(productId);
|
|
21
23
|
await Promise.all(
|
|
@@ -27,7 +29,7 @@ export async function removeProductService(
|
|
|
27
29
|
}
|
|
28
30
|
break;
|
|
29
31
|
default:
|
|
30
|
-
throw new Error(`Invalid status
|
|
32
|
+
throw new Error(`Invalid status: ${product?.status}`);
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
return true;
|
|
@@ -29,14 +29,15 @@ export async function searchAssortmentsService(
|
|
|
29
29
|
filterSelector,
|
|
30
30
|
assortmentSelector,
|
|
31
31
|
sortStage,
|
|
32
|
-
forceLiveCollection,
|
|
32
|
+
forceLiveCollection: !!forceLiveCollection,
|
|
33
33
|
locale,
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
const assortmentIds = await searchQuery.assortmentIds;
|
|
37
37
|
|
|
38
38
|
const totalAssortmentIds =
|
|
39
|
-
(await filterActions.searchAssortments({ assortmentIds }, searchConfiguration)) ||
|
|
39
|
+
(await filterActions.searchAssortments({ assortmentIds }, searchConfiguration)) ||
|
|
40
|
+
(await this.assortments.findAssortmentIds({ includeInactive: searchQuery.includeInactive }));
|
|
40
41
|
|
|
41
42
|
return {
|
|
42
43
|
searchConfiguration,
|
|
@@ -32,7 +32,7 @@ export async function searchProductsService(
|
|
|
32
32
|
filterSelector,
|
|
33
33
|
productSelector,
|
|
34
34
|
sortStage,
|
|
35
|
-
forceLiveCollection,
|
|
35
|
+
forceLiveCollection: !!forceLiveCollection,
|
|
36
36
|
locale,
|
|
37
37
|
};
|
|
38
38
|
|
|
@@ -47,9 +47,9 @@ export async function searchProductsService(
|
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
const productIds = await searchQuery.productIds;
|
|
51
50
|
const totalProductIds =
|
|
52
|
-
(await filterActions.searchProducts(
|
|
51
|
+
(await filterActions.searchProducts(searchQuery, searchConfiguration)) ||
|
|
52
|
+
(await this.products.findProductIds({ includeDrafts: searchQuery.includeInactive }));
|
|
53
53
|
|
|
54
54
|
const filteredProductIds = await FilterDirector.productFacetedSearch(
|
|
55
55
|
totalProductIds,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Modules } from '../modules.js';
|
|
2
2
|
import { supportedWarehousingProvidersService } from './supportedWarehousingProviders.js';
|
|
3
3
|
import { Product } from '@unchainedshop/core-products';
|
|
4
|
-
import {
|
|
4
|
+
import { WarehousingDirector } from '../directors/WarehousingDirector.js';
|
|
5
5
|
import { WarehousingContext } from '../directors/WarehousingAdapter.js';
|
|
6
6
|
import { WarehousingProvider } from '@unchainedshop/core-warehousing';
|
|
7
7
|
|
|
@@ -18,7 +18,11 @@ export async function simulateProductInventoryService(
|
|
|
18
18
|
const deliveryProviders = await this.delivery.allProviders();
|
|
19
19
|
|
|
20
20
|
return deliveryProviders.reduce<
|
|
21
|
-
Promise<
|
|
21
|
+
Promise<
|
|
22
|
+
(WarehousingContext & { quantity?: number } & {
|
|
23
|
+
warehousingProvider: WarehousingProvider;
|
|
24
|
+
})[]
|
|
25
|
+
>
|
|
22
26
|
>(async (oldResult, deliveryProvider) => {
|
|
23
27
|
const result = await oldResult;
|
|
24
28
|
|
|
@@ -31,7 +35,7 @@ export async function simulateProductInventoryService(
|
|
|
31
35
|
|
|
32
36
|
const mappedWarehousingProviders = await Promise.all(
|
|
33
37
|
warehousingProviders.map(async (warehousingProvider) => {
|
|
34
|
-
const warehousingContext
|
|
38
|
+
const warehousingContext = {
|
|
35
39
|
deliveryProvider,
|
|
36
40
|
product,
|
|
37
41
|
referenceDate,
|
|
@@ -2,16 +2,19 @@ import { Product, ProductConfiguration } from '@unchainedshop/core-products';
|
|
|
2
2
|
import { ProductPricingDirector } from '../core-index.js';
|
|
3
3
|
import { User } from '@unchainedshop/core-users';
|
|
4
4
|
import { Modules } from '../modules.js';
|
|
5
|
+
import { Order, OrderDiscount } from '@unchainedshop/core-orders';
|
|
5
6
|
|
|
6
7
|
export async function simulateProductPricingService(
|
|
7
8
|
this: Modules,
|
|
8
9
|
pricingContext: {
|
|
9
|
-
product: Product;
|
|
10
|
-
user: User;
|
|
11
|
-
countryCode: string;
|
|
12
10
|
currencyCode: string;
|
|
11
|
+
countryCode: string;
|
|
13
12
|
quantity: number;
|
|
13
|
+
discounts: OrderDiscount[];
|
|
14
|
+
order?: Order;
|
|
15
|
+
product: Product;
|
|
14
16
|
configuration?: ProductConfiguration[];
|
|
17
|
+
user?: User;
|
|
15
18
|
},
|
|
16
19
|
) {
|
|
17
20
|
const calculated = await ProductPricingDirector.rebuildCalculation(pricingContext, { modules: this });
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Enrollment, EnrollmentStatus } from '@unchainedshop/core-enrollments';
|
|
2
2
|
import { processEnrollmentService } from './processEnrollment.js';
|
|
3
|
+
import { addMessageService } from './addMessage.js';
|
|
3
4
|
|
|
4
5
|
export async function terminateEnrollmentService(enrollment: Enrollment) {
|
|
5
6
|
if (enrollment.status === EnrollmentStatus.TERMINATED) return enrollment;
|
|
@@ -14,15 +15,10 @@ export async function terminateEnrollmentService(enrollment: Enrollment) {
|
|
|
14
15
|
const user = await this.users.findUserById(enrollment.userId);
|
|
15
16
|
const locale = this.users.userLocale(user);
|
|
16
17
|
|
|
17
|
-
await
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
reason: 'status_change',
|
|
22
|
-
locale: locale.baseName,
|
|
23
|
-
template: 'ENROLLMENT_STATUS',
|
|
24
|
-
enrollmentId: updatedEnrollment._id,
|
|
25
|
-
},
|
|
18
|
+
await addMessageService.bind(this)('ENROLLMENT_STATUS', {
|
|
19
|
+
reason: 'status_change',
|
|
20
|
+
locale: locale.baseName,
|
|
21
|
+
enrollmentId: updatedEnrollment._id,
|
|
26
22
|
});
|
|
27
23
|
|
|
28
24
|
return updatedEnrollment;
|