@unchainedshop/core 4.3.5 → 4.4.0
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/README.md +614 -2
- package/lib/bulk-importer/createBulkImporter.d.ts +5 -6
- package/lib/bulk-importer/createBulkImporter.js +6 -5
- package/lib/bulk-importer/handlers/assortment/create.d.ts +2 -3
- package/lib/bulk-importer/handlers/assortment/create.js +6 -8
- package/lib/bulk-importer/handlers/assortment/index.d.ts +3 -4
- package/lib/bulk-importer/handlers/assortment/index.js +3 -4
- package/lib/bulk-importer/handlers/assortment/remove.d.ts +1 -2
- package/lib/bulk-importer/handlers/assortment/remove.js +0 -1
- package/lib/bulk-importer/handlers/assortment/update.d.ts +2 -3
- package/lib/bulk-importer/handlers/assortment/update.js +7 -9
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.d.ts +1 -2
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.js +1 -2
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.d.ts +1 -2
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.js +1 -2
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.d.ts +1 -2
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.js +1 -2
- package/lib/bulk-importer/handlers/assortment/upsertMedia.d.ts +2 -3
- package/lib/bulk-importer/handlers/assortment/upsertMedia.js +2 -4
- package/lib/bulk-importer/handlers/filter/create.d.ts +7 -3
- package/lib/bulk-importer/handlers/filter/create.js +3 -4
- package/lib/bulk-importer/handlers/filter/index.d.ts +3 -4
- package/lib/bulk-importer/handlers/filter/index.js +3 -4
- package/lib/bulk-importer/handlers/filter/remove.d.ts +1 -2
- package/lib/bulk-importer/handlers/filter/remove.js +0 -1
- package/lib/bulk-importer/handlers/filter/update.d.ts +1 -2
- package/lib/bulk-importer/handlers/filter/update.js +2 -4
- package/lib/bulk-importer/handlers/product/create.d.ts +23 -6
- package/lib/bulk-importer/handlers/product/create.js +10 -12
- package/lib/bulk-importer/handlers/product/index.d.ts +3 -4
- package/lib/bulk-importer/handlers/product/index.js +3 -4
- package/lib/bulk-importer/handlers/product/remove.d.ts +2 -3
- package/lib/bulk-importer/handlers/product/remove.js +0 -1
- package/lib/bulk-importer/handlers/product/update.d.ts +2 -3
- package/lib/bulk-importer/handlers/product/update.js +8 -11
- package/lib/bulk-importer/handlers/product/upsertMedia.d.ts +2 -3
- package/lib/bulk-importer/handlers/product/upsertMedia.js +4 -6
- package/lib/bulk-importer/handlers/product/upsertVariations.d.ts +1 -2
- package/lib/bulk-importer/handlers/product/upsertVariations.js +2 -5
- package/lib/bulk-importer/handlers/utils/convertTagsToLowerCase.d.ts +0 -1
- package/lib/bulk-importer/handlers/utils/convertTagsToLowerCase.js +0 -1
- package/lib/bulk-importer/index.d.ts +2 -3
- package/lib/bulk-importer/index.js +2 -3
- package/lib/bulk-importer/upsertAsset.d.ts +2 -3
- package/lib/bulk-importer/upsertAsset.js +4 -4
- package/lib/core-index.d.ts +9 -10
- package/lib/core-index.js +9 -10
- package/lib/directors/BaseDiscountAdapter.d.ts +5 -6
- package/lib/directors/BaseDiscountAdapter.js +0 -17
- package/lib/directors/BaseDiscountDirector.d.ts +3 -4
- package/lib/directors/BaseDiscountDirector.js +0 -1
- package/lib/directors/BasePricingAdapter.d.ts +4 -5
- package/lib/directors/BasePricingAdapter.js +1 -2
- package/lib/directors/BasePricingDirector.d.ts +4 -5
- package/lib/directors/BasePricingDirector.js +1 -6
- package/lib/directors/BasePricingSheet.d.ts +1 -2
- package/lib/directors/BasePricingSheet.js +0 -4
- package/lib/directors/BaseWorker.d.ts +1 -2
- package/lib/directors/BaseWorker.js +2 -5
- package/lib/directors/DeliveryAdapter.d.ts +8 -8
- package/lib/directors/DeliveryAdapter.js +6 -15
- package/lib/directors/DeliveryDirector.d.ts +5 -6
- package/lib/directors/DeliveryDirector.js +1 -2
- package/lib/directors/DeliveryPricingAdapter.d.ts +6 -7
- package/lib/directors/DeliveryPricingAdapter.js +2 -3
- package/lib/directors/DeliveryPricingDirector.d.ts +3 -4
- package/lib/directors/DeliveryPricingDirector.js +2 -2
- package/lib/directors/DeliveryPricingSheet.d.ts +9 -9
- package/lib/directors/DeliveryPricingSheet.js +7 -9
- package/lib/directors/EnrollmentAdapter.d.ts +2 -3
- package/lib/directors/EnrollmentAdapter.js +0 -1
- package/lib/directors/EnrollmentDirector.d.ts +3 -4
- package/lib/directors/EnrollmentDirector.js +0 -1
- package/lib/directors/EventListenerWorker.d.ts +1 -2
- package/lib/directors/EventListenerWorker.js +2 -11
- package/lib/directors/FailedRescheduler.d.ts +1 -2
- package/lib/directors/FailedRescheduler.js +0 -3
- package/lib/directors/FilterAdapter.d.ts +5 -6
- package/lib/directors/FilterAdapter.js +1 -5
- package/lib/directors/FilterDirector.d.ts +6 -7
- package/lib/directors/FilterDirector.js +13 -19
- package/lib/directors/IntervalWorker.d.ts +2 -3
- package/lib/directors/IntervalWorker.js +3 -5
- package/lib/directors/MessagingDirector.d.ts +0 -1
- package/lib/directors/MessagingDirector.js +0 -1
- package/lib/directors/OrderDiscountAdapter.d.ts +1 -2
- package/lib/directors/OrderDiscountAdapter.js +1 -2
- package/lib/directors/OrderDiscountConfiguration.d.ts +0 -1
- package/lib/directors/OrderDiscountConfiguration.js +0 -1
- package/lib/directors/OrderDiscountDirector.d.ts +2 -3
- package/lib/directors/OrderDiscountDirector.js +1 -2
- package/lib/directors/OrderPricingAdapter.d.ts +4 -5
- package/lib/directors/OrderPricingAdapter.js +1 -2
- package/lib/directors/OrderPricingDirector.d.ts +2 -3
- package/lib/directors/OrderPricingDirector.js +1 -2
- package/lib/directors/OrderPricingSheet.d.ts +10 -10
- package/lib/directors/OrderPricingSheet.js +8 -12
- package/lib/directors/PaymentAdapter.d.ts +8 -8
- package/lib/directors/PaymentAdapter.js +6 -12
- package/lib/directors/PaymentDirector.d.ts +4 -5
- package/lib/directors/PaymentDirector.js +1 -2
- package/lib/directors/PaymentPricingAdapter.d.ts +6 -7
- package/lib/directors/PaymentPricingAdapter.js +2 -3
- package/lib/directors/PaymentPricingDirector.d.ts +4 -5
- package/lib/directors/PaymentPricingDirector.js +2 -3
- package/lib/directors/PaymentPricingSheet.d.ts +8 -8
- package/lib/directors/PaymentPricingSheet.js +7 -9
- package/lib/directors/ProductDiscountAdapter.d.ts +1 -2
- package/lib/directors/ProductDiscountAdapter.js +1 -2
- package/lib/directors/ProductDiscountConfiguration.d.ts +1 -2
- package/lib/directors/ProductDiscountConfiguration.js +0 -1
- package/lib/directors/ProductDiscountDirector.d.ts +2 -3
- package/lib/directors/ProductDiscountDirector.js +1 -2
- package/lib/directors/ProductPricingAdapter.d.ts +5 -6
- package/lib/directors/ProductPricingAdapter.js +1 -2
- package/lib/directors/ProductPricingDirector.d.ts +4 -5
- package/lib/directors/ProductPricingDirector.js +1 -2
- package/lib/directors/ProductPricingSheet.d.ts +8 -8
- package/lib/directors/ProductPricingSheet.js +6 -8
- package/lib/directors/QuotationAdapter.d.ts +9 -9
- package/lib/directors/QuotationAdapter.js +6 -8
- package/lib/directors/QuotationDirector.d.ts +2 -3
- package/lib/directors/QuotationDirector.js +1 -2
- package/lib/directors/WarehousingAdapter.d.ts +12 -12
- package/lib/directors/WarehousingAdapter.js +6 -8
- package/lib/directors/WarehousingDirector.d.ts +4 -5
- package/lib/directors/WarehousingDirector.js +1 -4
- package/lib/directors/WorkerAdapter.d.ts +5 -6
- package/lib/directors/WorkerAdapter.js +0 -1
- package/lib/directors/WorkerDirector.d.ts +5 -6
- package/lib/directors/WorkerDirector.js +0 -3
- package/lib/directors/index.d.ts +42 -43
- package/lib/directors/index.js +42 -43
- package/lib/factory/index.d.ts +9 -10
- package/lib/factory/index.js +9 -10
- package/lib/factory/registerAssortmentSearchFilter.d.ts +1 -2
- package/lib/factory/registerAssortmentSearchFilter.js +1 -2
- package/lib/factory/registerInvoicePayment.d.ts +2 -3
- package/lib/factory/registerInvoicePayment.js +1 -2
- package/lib/factory/registerPhysicalWarehousing.d.ts +2 -3
- package/lib/factory/registerPhysicalWarehousing.js +1 -2
- package/lib/factory/registerPickUpDelivery.d.ts +3 -4
- package/lib/factory/registerPickUpDelivery.js +1 -2
- package/lib/factory/registerProductDiscoverabilityFilter.d.ts +0 -1
- package/lib/factory/registerProductDiscoverabilityFilter.js +1 -2
- package/lib/factory/registerProductSearchFilter.d.ts +1 -2
- package/lib/factory/registerProductSearchFilter.js +1 -2
- package/lib/factory/registerShippingDelivery.d.ts +3 -4
- package/lib/factory/registerShippingDelivery.js +1 -2
- package/lib/factory/registerVirtualWarehousing.d.ts +2 -3
- package/lib/factory/registerVirtualWarehousing.js +1 -2
- package/lib/factory/registerWorker.d.ts +0 -1
- package/lib/factory/registerWorker.js +1 -2
- package/lib/modules.d.ts +18 -19
- package/lib/modules.js +5 -5
- package/lib/services/activateEnrollment.d.ts +2 -3
- package/lib/services/activateEnrollment.js +2 -3
- package/lib/services/addMessage.d.ts +2 -3
- package/lib/services/addMessage.js +2 -3
- package/lib/services/calculateDiscountTotal.d.ts +2 -3
- package/lib/services/calculateDiscountTotal.js +1 -6
- package/lib/services/checkoutOrder.d.ts +1 -2
- package/lib/services/checkoutOrder.js +4 -6
- package/lib/services/confirmOrder.d.ts +2 -3
- package/lib/services/confirmOrder.js +1 -2
- package/lib/services/createDownloadStream.d.ts +2 -3
- package/lib/services/createDownloadStream.js +0 -1
- package/lib/services/createEnrollmentFromCheckout.d.ts +4 -5
- package/lib/services/createEnrollmentFromCheckout.js +2 -3
- package/lib/services/createManualOrderDiscount.d.ts +2 -3
- package/lib/services/createManualOrderDiscount.js +1 -3
- package/lib/services/createSignedURL.d.ts +2 -3
- package/lib/services/createSignedURL.js +0 -1
- package/lib/services/deleteUser.d.ts +1 -2
- package/lib/services/deleteUser.js +0 -1
- package/lib/services/discountedEntities.d.ts +3 -4
- package/lib/services/discountedEntities.js +1 -7
- package/lib/services/ercMetadata.d.ts +3 -4
- package/lib/services/ercMetadata.js +1 -2
- package/lib/services/findOrInitCart.d.ts +2 -3
- package/lib/services/findOrInitCart.js +1 -2
- package/lib/services/fullfillQuotation.d.ts +2 -3
- package/lib/services/fullfillQuotation.js +1 -2
- package/lib/services/generateOrderFromEnrollment.d.ts +2 -3
- package/lib/services/generateOrderFromEnrollment.js +2 -3
- package/lib/services/index.d.ts +48 -49
- package/lib/services/index.js +47 -51
- package/lib/services/initCartProviders.d.ts +2 -3
- package/lib/services/initCartProviders.js +2 -5
- package/lib/services/initializeEnrollment.d.ts +2 -3
- package/lib/services/initializeEnrollment.js +3 -4
- package/lib/services/invalidateFilterCache.d.ts +1 -2
- package/lib/services/invalidateFilterCache.js +1 -2
- package/lib/services/linkFileService.d.ts +1 -2
- package/lib/services/linkFileService.js +0 -1
- package/lib/services/loadFilterOptions.d.ts +2 -3
- package/lib/services/loadFilterOptions.js +2 -3
- package/lib/services/loadFilters.d.ts +2 -3
- package/lib/services/loadFilters.js +3 -3
- package/lib/services/migrateBookmarks.d.ts +1 -2
- package/lib/services/migrateBookmarks.js +0 -2
- package/lib/services/migrateOrderCart.d.ts +1 -2
- package/lib/services/migrateOrderCart.js +1 -7
- package/lib/services/migrateUserData.d.ts +0 -1
- package/lib/services/migrateUserData.js +2 -3
- package/lib/services/nextUserCart.d.ts +2 -3
- package/lib/services/nextUserCart.js +1 -2
- package/lib/services/processEnrollment.d.ts +2 -3
- package/lib/services/processEnrollment.js +1 -5
- package/lib/services/processOrder.d.ts +2 -3
- package/lib/services/processOrder.js +7 -27
- package/lib/services/processQuotation.d.ts +2 -3
- package/lib/services/processQuotation.js +2 -3
- package/lib/services/proposeQuotation.d.ts +2 -3
- package/lib/services/proposeQuotation.js +1 -2
- package/lib/services/registerPaymentCredentials.d.ts +2 -3
- package/lib/services/registerPaymentCredentials.js +1 -2
- package/lib/services/rejectOrder.d.ts +2 -3
- package/lib/services/rejectOrder.js +1 -2
- package/lib/services/rejectQuotation.d.ts +2 -3
- package/lib/services/rejectQuotation.js +1 -2
- package/lib/services/removeFiles.d.ts +1 -2
- package/lib/services/removeFiles.js +0 -2
- package/lib/services/removeProduct.d.ts +1 -2
- package/lib/services/removeProduct.js +1 -4
- package/lib/services/searchAssortments.d.ts +3 -4
- package/lib/services/searchAssortments.js +1 -2
- package/lib/services/searchProducts.d.ts +3 -4
- package/lib/services/searchProducts.js +1 -4
- package/lib/services/simulateProductDispatching.d.ts +5 -6
- package/lib/services/simulateProductDispatching.js +2 -3
- package/lib/services/simulateProductInventory.d.ts +4 -5
- package/lib/services/simulateProductInventory.js +2 -3
- package/lib/services/simulateProductPricing.d.ts +5 -6
- package/lib/services/simulateProductPricing.js +1 -2
- package/lib/services/supportedDeliveryProviders.d.ts +3 -4
- package/lib/services/supportedDeliveryProviders.js +1 -2
- package/lib/services/supportedPaymentProviders.d.ts +3 -4
- package/lib/services/supportedPaymentProviders.js +1 -2
- package/lib/services/supportedWarehousingProviders.d.ts +3 -4
- package/lib/services/supportedWarehousingProviders.js +1 -2
- package/lib/services/terminateEnrollment.d.ts +1 -2
- package/lib/services/terminateEnrollment.js +2 -3
- package/lib/services/updateCalculation.d.ts +2 -3
- package/lib/services/updateCalculation.js +3 -20
- package/lib/services/updateScheduling.d.ts +2 -3
- package/lib/services/updateScheduling.js +2 -4
- package/lib/services/updateUserAvatarAfterUpload.d.ts +2 -3
- package/lib/services/updateUserAvatarAfterUpload.js +1 -3
- package/lib/services/uploadFileFromStream.d.ts +2 -3
- package/lib/services/uploadFileFromStream.js +0 -1
- package/lib/services/uploadFileFromURL.d.ts +1 -2
- package/lib/services/uploadFileFromURL.js +0 -1
- package/lib/services/validateOrder.d.ts +2 -3
- package/lib/services/validateOrder.js +0 -1
- package/lib/services/verifyQuotation.d.ts +2 -3
- package/lib/services/verifyQuotation.js +1 -2
- package/package.json +27 -26
- package/lib/bulk-importer/createBulkImporter.d.ts.map +0 -1
- package/lib/bulk-importer/createBulkImporter.js.map +0 -1
- package/lib/bulk-importer/handlers/assortment/create.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/assortment/create.js.map +0 -1
- package/lib/bulk-importer/handlers/assortment/index.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/assortment/index.js.map +0 -1
- package/lib/bulk-importer/handlers/assortment/remove.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/assortment/remove.js.map +0 -1
- package/lib/bulk-importer/handlers/assortment/update.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/assortment/update.js.map +0 -1
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.js.map +0 -1
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.js.map +0 -1
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.js.map +0 -1
- package/lib/bulk-importer/handlers/assortment/upsertMedia.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/assortment/upsertMedia.js.map +0 -1
- package/lib/bulk-importer/handlers/filter/create.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/filter/create.js.map +0 -1
- package/lib/bulk-importer/handlers/filter/index.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/filter/index.js.map +0 -1
- package/lib/bulk-importer/handlers/filter/remove.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/filter/remove.js.map +0 -1
- package/lib/bulk-importer/handlers/filter/update.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/filter/update.js.map +0 -1
- package/lib/bulk-importer/handlers/product/create.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/product/create.js.map +0 -1
- package/lib/bulk-importer/handlers/product/index.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/product/index.js.map +0 -1
- package/lib/bulk-importer/handlers/product/remove.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/product/remove.js.map +0 -1
- package/lib/bulk-importer/handlers/product/update.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/product/update.js.map +0 -1
- package/lib/bulk-importer/handlers/product/upsertMedia.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/product/upsertMedia.js.map +0 -1
- package/lib/bulk-importer/handlers/product/upsertVariations.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/product/upsertVariations.js.map +0 -1
- package/lib/bulk-importer/handlers/utils/convertTagsToLowerCase.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/utils/convertTagsToLowerCase.js.map +0 -1
- package/lib/bulk-importer/index.d.ts.map +0 -1
- package/lib/bulk-importer/index.js.map +0 -1
- package/lib/bulk-importer/upsertAsset.d.ts.map +0 -1
- package/lib/bulk-importer/upsertAsset.js.map +0 -1
- package/lib/core-index.d.ts.map +0 -1
- package/lib/core-index.js.map +0 -1
- package/lib/directors/BaseDiscountAdapter.d.ts.map +0 -1
- package/lib/directors/BaseDiscountAdapter.js.map +0 -1
- package/lib/directors/BaseDiscountDirector.d.ts.map +0 -1
- package/lib/directors/BaseDiscountDirector.js.map +0 -1
- package/lib/directors/BasePricingAdapter.d.ts.map +0 -1
- package/lib/directors/BasePricingAdapter.js.map +0 -1
- package/lib/directors/BasePricingDirector.d.ts.map +0 -1
- package/lib/directors/BasePricingDirector.js.map +0 -1
- package/lib/directors/BasePricingSheet.d.ts.map +0 -1
- package/lib/directors/BasePricingSheet.js.map +0 -1
- package/lib/directors/BaseWorker.d.ts.map +0 -1
- package/lib/directors/BaseWorker.js.map +0 -1
- package/lib/directors/DeliveryAdapter.d.ts.map +0 -1
- package/lib/directors/DeliveryAdapter.js.map +0 -1
- package/lib/directors/DeliveryDirector.d.ts.map +0 -1
- package/lib/directors/DeliveryDirector.js.map +0 -1
- package/lib/directors/DeliveryPricingAdapter.d.ts.map +0 -1
- package/lib/directors/DeliveryPricingAdapter.js.map +0 -1
- package/lib/directors/DeliveryPricingDirector.d.ts.map +0 -1
- package/lib/directors/DeliveryPricingDirector.js.map +0 -1
- package/lib/directors/DeliveryPricingSheet.d.ts.map +0 -1
- package/lib/directors/DeliveryPricingSheet.js.map +0 -1
- package/lib/directors/EnrollmentAdapter.d.ts.map +0 -1
- package/lib/directors/EnrollmentAdapter.js.map +0 -1
- package/lib/directors/EnrollmentDirector.d.ts.map +0 -1
- package/lib/directors/EnrollmentDirector.js.map +0 -1
- package/lib/directors/EventListenerWorker.d.ts.map +0 -1
- package/lib/directors/EventListenerWorker.js.map +0 -1
- package/lib/directors/FailedRescheduler.d.ts.map +0 -1
- package/lib/directors/FailedRescheduler.js.map +0 -1
- package/lib/directors/FilterAdapter.d.ts.map +0 -1
- package/lib/directors/FilterAdapter.js.map +0 -1
- package/lib/directors/FilterDirector.d.ts.map +0 -1
- package/lib/directors/FilterDirector.js.map +0 -1
- package/lib/directors/IntervalWorker.d.ts.map +0 -1
- package/lib/directors/IntervalWorker.js.map +0 -1
- package/lib/directors/MessagingDirector.d.ts.map +0 -1
- package/lib/directors/MessagingDirector.js.map +0 -1
- package/lib/directors/OrderDiscountAdapter.d.ts.map +0 -1
- package/lib/directors/OrderDiscountAdapter.js.map +0 -1
- package/lib/directors/OrderDiscountConfiguration.d.ts.map +0 -1
- package/lib/directors/OrderDiscountConfiguration.js.map +0 -1
- package/lib/directors/OrderDiscountDirector.d.ts.map +0 -1
- package/lib/directors/OrderDiscountDirector.js.map +0 -1
- package/lib/directors/OrderPricingAdapter.d.ts.map +0 -1
- package/lib/directors/OrderPricingAdapter.js.map +0 -1
- package/lib/directors/OrderPricingDirector.d.ts.map +0 -1
- package/lib/directors/OrderPricingDirector.js.map +0 -1
- package/lib/directors/OrderPricingSheet.d.ts.map +0 -1
- package/lib/directors/OrderPricingSheet.js.map +0 -1
- package/lib/directors/PaymentAdapter.d.ts.map +0 -1
- package/lib/directors/PaymentAdapter.js.map +0 -1
- package/lib/directors/PaymentDirector.d.ts.map +0 -1
- package/lib/directors/PaymentDirector.js.map +0 -1
- package/lib/directors/PaymentPricingAdapter.d.ts.map +0 -1
- package/lib/directors/PaymentPricingAdapter.js.map +0 -1
- package/lib/directors/PaymentPricingDirector.d.ts.map +0 -1
- package/lib/directors/PaymentPricingDirector.js.map +0 -1
- package/lib/directors/PaymentPricingSheet.d.ts.map +0 -1
- package/lib/directors/PaymentPricingSheet.js.map +0 -1
- package/lib/directors/ProductDiscountAdapter.d.ts.map +0 -1
- package/lib/directors/ProductDiscountAdapter.js.map +0 -1
- package/lib/directors/ProductDiscountConfiguration.d.ts.map +0 -1
- package/lib/directors/ProductDiscountConfiguration.js.map +0 -1
- package/lib/directors/ProductDiscountDirector.d.ts.map +0 -1
- package/lib/directors/ProductDiscountDirector.js.map +0 -1
- package/lib/directors/ProductPricingAdapter.d.ts.map +0 -1
- package/lib/directors/ProductPricingAdapter.js.map +0 -1
- package/lib/directors/ProductPricingDirector.d.ts.map +0 -1
- package/lib/directors/ProductPricingDirector.js.map +0 -1
- package/lib/directors/ProductPricingSheet.d.ts.map +0 -1
- package/lib/directors/ProductPricingSheet.js.map +0 -1
- package/lib/directors/QuotationAdapter.d.ts.map +0 -1
- package/lib/directors/QuotationAdapter.js.map +0 -1
- package/lib/directors/QuotationDirector.d.ts.map +0 -1
- package/lib/directors/QuotationDirector.js.map +0 -1
- package/lib/directors/WarehousingAdapter.d.ts.map +0 -1
- package/lib/directors/WarehousingAdapter.js.map +0 -1
- package/lib/directors/WarehousingDirector.d.ts.map +0 -1
- package/lib/directors/WarehousingDirector.js.map +0 -1
- package/lib/directors/WorkerAdapter.d.ts.map +0 -1
- package/lib/directors/WorkerAdapter.js.map +0 -1
- package/lib/directors/WorkerDirector.d.ts.map +0 -1
- package/lib/directors/WorkerDirector.js.map +0 -1
- package/lib/directors/index.d.ts.map +0 -1
- package/lib/directors/index.js.map +0 -1
- package/lib/factory/index.d.ts.map +0 -1
- package/lib/factory/index.js.map +0 -1
- package/lib/factory/registerAssortmentSearchFilter.d.ts.map +0 -1
- package/lib/factory/registerAssortmentSearchFilter.js.map +0 -1
- package/lib/factory/registerInvoicePayment.d.ts.map +0 -1
- package/lib/factory/registerInvoicePayment.js.map +0 -1
- package/lib/factory/registerPhysicalWarehousing.d.ts.map +0 -1
- package/lib/factory/registerPhysicalWarehousing.js.map +0 -1
- package/lib/factory/registerPickUpDelivery.d.ts.map +0 -1
- package/lib/factory/registerPickUpDelivery.js.map +0 -1
- package/lib/factory/registerProductDiscoverabilityFilter.d.ts.map +0 -1
- package/lib/factory/registerProductDiscoverabilityFilter.js.map +0 -1
- package/lib/factory/registerProductSearchFilter.d.ts.map +0 -1
- package/lib/factory/registerProductSearchFilter.js.map +0 -1
- package/lib/factory/registerShippingDelivery.d.ts.map +0 -1
- package/lib/factory/registerShippingDelivery.js.map +0 -1
- package/lib/factory/registerVirtualWarehousing.d.ts.map +0 -1
- package/lib/factory/registerVirtualWarehousing.js.map +0 -1
- package/lib/factory/registerWorker.d.ts.map +0 -1
- package/lib/factory/registerWorker.js.map +0 -1
- package/lib/modules.d.ts.map +0 -1
- package/lib/modules.js.map +0 -1
- package/lib/services/activateEnrollment.d.ts.map +0 -1
- package/lib/services/activateEnrollment.js.map +0 -1
- package/lib/services/addMessage.d.ts.map +0 -1
- package/lib/services/addMessage.js.map +0 -1
- package/lib/services/calculateDiscountTotal.d.ts.map +0 -1
- package/lib/services/calculateDiscountTotal.js.map +0 -1
- package/lib/services/checkoutOrder.d.ts.map +0 -1
- package/lib/services/checkoutOrder.js.map +0 -1
- package/lib/services/confirmOrder.d.ts.map +0 -1
- package/lib/services/confirmOrder.js.map +0 -1
- package/lib/services/createDownloadStream.d.ts.map +0 -1
- package/lib/services/createDownloadStream.js.map +0 -1
- package/lib/services/createEnrollmentFromCheckout.d.ts.map +0 -1
- package/lib/services/createEnrollmentFromCheckout.js.map +0 -1
- package/lib/services/createManualOrderDiscount.d.ts.map +0 -1
- package/lib/services/createManualOrderDiscount.js.map +0 -1
- package/lib/services/createSignedURL.d.ts.map +0 -1
- package/lib/services/createSignedURL.js.map +0 -1
- package/lib/services/deleteUser.d.ts.map +0 -1
- package/lib/services/deleteUser.js.map +0 -1
- package/lib/services/discountedEntities.d.ts.map +0 -1
- package/lib/services/discountedEntities.js.map +0 -1
- package/lib/services/ercMetadata.d.ts.map +0 -1
- package/lib/services/ercMetadata.js.map +0 -1
- package/lib/services/findOrInitCart.d.ts.map +0 -1
- package/lib/services/findOrInitCart.js.map +0 -1
- package/lib/services/fullfillQuotation.d.ts.map +0 -1
- package/lib/services/fullfillQuotation.js.map +0 -1
- package/lib/services/generateOrderFromEnrollment.d.ts.map +0 -1
- package/lib/services/generateOrderFromEnrollment.js.map +0 -1
- package/lib/services/index.d.ts.map +0 -1
- package/lib/services/index.js.map +0 -1
- package/lib/services/initCartProviders.d.ts.map +0 -1
- package/lib/services/initCartProviders.js.map +0 -1
- package/lib/services/initializeEnrollment.d.ts.map +0 -1
- package/lib/services/initializeEnrollment.js.map +0 -1
- package/lib/services/invalidateFilterCache.d.ts.map +0 -1
- package/lib/services/invalidateFilterCache.js.map +0 -1
- package/lib/services/linkFileService.d.ts.map +0 -1
- package/lib/services/linkFileService.js.map +0 -1
- package/lib/services/loadFilterOptions.d.ts.map +0 -1
- package/lib/services/loadFilterOptions.js.map +0 -1
- package/lib/services/loadFilters.d.ts.map +0 -1
- package/lib/services/loadFilters.js.map +0 -1
- package/lib/services/migrateBookmarks.d.ts.map +0 -1
- package/lib/services/migrateBookmarks.js.map +0 -1
- package/lib/services/migrateOrderCart.d.ts.map +0 -1
- package/lib/services/migrateOrderCart.js.map +0 -1
- package/lib/services/migrateUserData.d.ts.map +0 -1
- package/lib/services/migrateUserData.js.map +0 -1
- package/lib/services/nextUserCart.d.ts.map +0 -1
- package/lib/services/nextUserCart.js.map +0 -1
- package/lib/services/processEnrollment.d.ts.map +0 -1
- package/lib/services/processEnrollment.js.map +0 -1
- package/lib/services/processOrder.d.ts.map +0 -1
- package/lib/services/processOrder.js.map +0 -1
- package/lib/services/processQuotation.d.ts.map +0 -1
- package/lib/services/processQuotation.js.map +0 -1
- package/lib/services/proposeQuotation.d.ts.map +0 -1
- package/lib/services/proposeQuotation.js.map +0 -1
- package/lib/services/registerPaymentCredentials.d.ts.map +0 -1
- package/lib/services/registerPaymentCredentials.js.map +0 -1
- package/lib/services/rejectOrder.d.ts.map +0 -1
- package/lib/services/rejectOrder.js.map +0 -1
- package/lib/services/rejectQuotation.d.ts.map +0 -1
- package/lib/services/rejectQuotation.js.map +0 -1
- package/lib/services/removeFiles.d.ts.map +0 -1
- package/lib/services/removeFiles.js.map +0 -1
- package/lib/services/removeProduct.d.ts.map +0 -1
- package/lib/services/removeProduct.js.map +0 -1
- package/lib/services/searchAssortments.d.ts.map +0 -1
- package/lib/services/searchAssortments.js.map +0 -1
- package/lib/services/searchProducts.d.ts.map +0 -1
- package/lib/services/searchProducts.js.map +0 -1
- package/lib/services/simulateProductDispatching.d.ts.map +0 -1
- package/lib/services/simulateProductDispatching.js.map +0 -1
- package/lib/services/simulateProductInventory.d.ts.map +0 -1
- package/lib/services/simulateProductInventory.js.map +0 -1
- package/lib/services/simulateProductPricing.d.ts.map +0 -1
- package/lib/services/simulateProductPricing.js.map +0 -1
- package/lib/services/supportedDeliveryProviders.d.ts.map +0 -1
- package/lib/services/supportedDeliveryProviders.js.map +0 -1
- package/lib/services/supportedPaymentProviders.d.ts.map +0 -1
- package/lib/services/supportedPaymentProviders.js.map +0 -1
- package/lib/services/supportedWarehousingProviders.d.ts.map +0 -1
- package/lib/services/supportedWarehousingProviders.js.map +0 -1
- package/lib/services/terminateEnrollment.d.ts.map +0 -1
- package/lib/services/terminateEnrollment.js.map +0 -1
- package/lib/services/updateCalculation.d.ts.map +0 -1
- package/lib/services/updateCalculation.js.map +0 -1
- package/lib/services/updateScheduling.d.ts.map +0 -1
- package/lib/services/updateScheduling.js.map +0 -1
- package/lib/services/updateUserAvatarAfterUpload.d.ts.map +0 -1
- package/lib/services/updateUserAvatarAfterUpload.js.map +0 -1
- package/lib/services/uploadFileFromStream.d.ts.map +0 -1
- package/lib/services/uploadFileFromStream.js.map +0 -1
- package/lib/services/uploadFileFromURL.d.ts.map +0 -1
- package/lib/services/uploadFileFromURL.js.map +0 -1
- package/lib/services/validateOrder.d.ts.map +0 -1
- package/lib/services/validateOrder.js.map +0 -1
- package/lib/services/verifyQuotation.d.ts.map +0 -1
- package/lib/services/verifyQuotation.js.map +0 -1
- package/src/bulk-importer/createBulkImporter.ts +0 -205
- package/src/bulk-importer/handlers/assortment/create.ts +0 -118
- package/src/bulk-importer/handlers/assortment/index.ts +0 -3
- package/src/bulk-importer/handlers/assortment/remove.ts +0 -26
- package/src/bulk-importer/handlers/assortment/update.ts +0 -133
- package/src/bulk-importer/handlers/assortment/upsertAssortmentChildren.ts +0 -77
- package/src/bulk-importer/handlers/assortment/upsertAssortmentFilters.ts +0 -70
- package/src/bulk-importer/handlers/assortment/upsertAssortmentProducts.ts +0 -76
- package/src/bulk-importer/handlers/assortment/upsertMedia.ts +0 -76
- package/src/bulk-importer/handlers/filter/create.ts +0 -104
- package/src/bulk-importer/handlers/filter/index.ts +0 -3
- package/src/bulk-importer/handlers/filter/remove.ts +0 -25
- package/src/bulk-importer/handlers/filter/update.ts +0 -94
- package/src/bulk-importer/handlers/product/create.ts +0 -170
- package/src/bulk-importer/handlers/product/index.ts +0 -3
- package/src/bulk-importer/handlers/product/remove.ts +0 -27
- package/src/bulk-importer/handlers/product/update.ts +0 -175
- package/src/bulk-importer/handlers/product/upsertMedia.ts +0 -81
- package/src/bulk-importer/handlers/product/upsertVariations.ts +0 -110
- package/src/bulk-importer/handlers/utils/convertTagsToLowerCase.ts +0 -4
- package/src/bulk-importer/index.ts +0 -3
- package/src/bulk-importer/upsertAsset.ts +0 -50
- package/src/core-index.ts +0 -103
- package/src/directors/BaseDiscountAdapter.test.ts +0 -52
- package/src/directors/BaseDiscountAdapter.ts +0 -86
- package/src/directors/BaseDiscountDirector.ts +0 -73
- package/src/directors/BasePricingAdapter.ts +0 -74
- package/src/directors/BasePricingDirector.ts +0 -136
- package/src/directors/BasePricingSheet.test.ts +0 -45
- package/src/directors/BasePricingSheet.ts +0 -141
- package/src/directors/BaseWorker.ts +0 -117
- package/src/directors/DeliveryAdapter.ts +0 -106
- package/src/directors/DeliveryDirector.ts +0 -143
- package/src/directors/DeliveryPricingAdapter.ts +0 -87
- package/src/directors/DeliveryPricingDirector.ts +0 -91
- package/src/directors/DeliveryPricingSheet.ts +0 -87
- package/src/directors/EnrollmentAdapter.ts +0 -108
- package/src/directors/EnrollmentDirector.ts +0 -71
- package/src/directors/EventListenerWorker.ts +0 -101
- package/src/directors/FailedRescheduler.ts +0 -73
- package/src/directors/FilterAdapter.ts +0 -106
- package/src/directors/FilterDirector.ts +0 -315
- package/src/directors/IntervalWorker.ts +0 -75
- package/src/directors/MessagingDirector.test.ts +0 -8
- package/src/directors/MessagingDirector.ts +0 -52
- package/src/directors/OrderDiscountAdapter.ts +0 -10
- package/src/directors/OrderDiscountConfiguration.ts +0 -5
- package/src/directors/OrderDiscountDirector.ts +0 -5
- package/src/directors/OrderPricingAdapter.ts +0 -63
- package/src/directors/OrderPricingDirector.ts +0 -74
- package/src/directors/OrderPricingSheet.ts +0 -148
- package/src/directors/PaymentAdapter.ts +0 -118
- package/src/directors/PaymentDirector.ts +0 -297
- package/src/directors/PaymentPricingAdapter.ts +0 -86
- package/src/directors/PaymentPricingDirector.ts +0 -92
- package/src/directors/PaymentPricingSheet.ts +0 -92
- package/src/directors/ProductDiscountAdapter.ts +0 -10
- package/src/directors/ProductDiscountConfiguration.ts +0 -18
- package/src/directors/ProductDiscountDirector.ts +0 -4
- package/src/directors/ProductPricingAdapter.ts +0 -58
- package/src/directors/ProductPricingDirector.ts +0 -100
- package/src/directors/ProductPricingSheet.test.ts +0 -140
- package/src/directors/ProductPricingSheet.ts +0 -125
- package/src/directors/QuotationAdapter.ts +0 -82
- package/src/directors/QuotationDirector.ts +0 -105
- package/src/directors/WarehousingAdapter.ts +0 -77
- package/src/directors/WarehousingDirector.ts +0 -233
- package/src/directors/WorkerAdapter.ts +0 -31
- package/src/directors/WorkerDirector.ts +0 -149
- package/src/directors/index.ts +0 -53
- package/src/directors/periodForReferenceDate.test.ts +0 -25
- package/src/factory/index.ts +0 -21
- package/src/factory/registerAssortmentSearchFilter.ts +0 -36
- package/src/factory/registerInvoicePayment.ts +0 -61
- package/src/factory/registerPhysicalWarehousing.ts +0 -92
- package/src/factory/registerPickUpDelivery.ts +0 -81
- package/src/factory/registerProductDiscoverabilityFilter.ts +0 -36
- package/src/factory/registerProductSearchFilter.ts +0 -36
- package/src/factory/registerShippingDelivery.ts +0 -65
- package/src/factory/registerVirtualWarehousing.ts +0 -100
- package/src/factory/registerWorker.ts +0 -46
- package/src/modules.ts +0 -207
- package/src/services/activateEnrollment.ts +0 -26
- package/src/services/addMessage.ts +0 -20
- package/src/services/calculateDiscountTotal.ts +0 -71
- package/src/services/checkoutOrder.ts +0 -48
- package/src/services/confirmOrder.ts +0 -26
- package/src/services/createDownloadStream.ts +0 -17
- package/src/services/createEnrollmentFromCheckout.ts +0 -68
- package/src/services/createManualOrderDiscount.ts +0 -56
- package/src/services/createSignedURL.ts +0 -21
- package/src/services/deleteUser.ts +0 -48
- package/src/services/discountedEntities.ts +0 -81
- package/src/services/ercMetadata.ts +0 -25
- package/src/services/findOrInitCart.ts +0 -28
- package/src/services/fullfillQuotation.ts +0 -14
- package/src/services/generateOrderFromEnrollment.ts +0 -54
- package/src/services/index.ts +0 -173
- package/src/services/initCartProviders.ts +0 -84
- package/src/services/initializeEnrollment.ts +0 -41
- package/src/services/invalidateFilterCache.ts +0 -16
- package/src/services/linkFileService.ts +0 -24
- package/src/services/loadFilterOptions.ts +0 -49
- package/src/services/loadFilters.ts +0 -60
- package/src/services/migrateBookmarks.ts +0 -39
- package/src/services/migrateOrderCart.ts +0 -52
- package/src/services/migrateUserData.ts +0 -22
- package/src/services/nextUserCart.ts +0 -52
- package/src/services/processEnrollment.ts +0 -49
- package/src/services/processOrder.ts +0 -243
- package/src/services/processQuotation.ts +0 -71
- package/src/services/proposeQuotation.ts +0 -18
- package/src/services/registerPaymentCredentials.ts +0 -28
- package/src/services/rejectOrder.ts +0 -26
- package/src/services/rejectQuotation.ts +0 -18
- package/src/services/removeFiles.ts +0 -25
- package/src/services/removeProduct.ts +0 -39
- package/src/services/searchAssortments.ts +0 -57
- package/src/services/searchProducts.ts +0 -71
- package/src/services/simulateProductDispatching.ts +0 -58
- package/src/services/simulateProductInventory.ts +0 -59
- package/src/services/simulateProductPricing.ts +0 -23
- package/src/services/supportedDeliveryProviders.ts +0 -24
- package/src/services/supportedPaymentProviders.ts +0 -25
- package/src/services/supportedWarehousingProviders.ts +0 -18
- package/src/services/terminateEnrollment.ts +0 -25
- package/src/services/updateCalculation.ts +0 -159
- package/src/services/updateScheduling.ts +0 -63
- package/src/services/updateUserAvatarAfterUpload.ts +0 -33
- package/src/services/uploadFileFromStream.ts +0 -27
- package/src/services/uploadFileFromURL.ts +0 -29
- package/src/services/validateOrder.ts +0 -49
- package/src/services/verifyQuotation.ts +0 -18
- package/tsconfig.json +0 -9
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { getFileFromFileData, getFileAdapter, SignedFileUpload } from '@unchainedshop/core-files';
|
|
2
|
-
import { Modules } from '../modules.js';
|
|
3
|
-
|
|
4
|
-
export async function createSignedURLService(
|
|
5
|
-
this: Modules,
|
|
6
|
-
{ directoryName, fileName, meta }: { directoryName: string; fileName: string; meta?: any },
|
|
7
|
-
) {
|
|
8
|
-
const fileUploadAdapter = getFileAdapter();
|
|
9
|
-
const preparedFileData = await fileUploadAdapter.createSignedURL(directoryName, fileName, {
|
|
10
|
-
modules: this,
|
|
11
|
-
});
|
|
12
|
-
if (!preparedFileData) throw new Error('Could not prepare signed URL');
|
|
13
|
-
const fileData = getFileFromFileData(preparedFileData, meta);
|
|
14
|
-
const fileId = await this.files.create(fileData);
|
|
15
|
-
const file = await this.files.findFile({ fileId });
|
|
16
|
-
|
|
17
|
-
return {
|
|
18
|
-
...file,
|
|
19
|
-
putURL: preparedFileData.putURL as string,
|
|
20
|
-
} as SignedFileUpload;
|
|
21
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { Modules } from '../modules.js';
|
|
2
|
-
|
|
3
|
-
export async function deleteUserService(this: Modules, { userId }: { userId: string }) {
|
|
4
|
-
const user = await this.users.markDeleted(userId);
|
|
5
|
-
|
|
6
|
-
if (!user) return null;
|
|
7
|
-
|
|
8
|
-
await this.bookmarks.deleteByUserId(userId);
|
|
9
|
-
await this.quotations.deleteRequestedUserQuotations(userId);
|
|
10
|
-
await this.enrollments.deleteInactiveUserEnrollments(userId);
|
|
11
|
-
await this.payment.paymentCredentials.deleteUserPaymentCredentials(userId);
|
|
12
|
-
|
|
13
|
-
if (user.username) {
|
|
14
|
-
await this.users.webAuthn.deleteUserWebAuthnCredentials(user.username);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const carts = (await this.orders.findOrders({ userId, includeCarts: true })).filter(
|
|
18
|
-
(c) => c.status === null,
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
await Array.fromAsync(carts, async (userCart) => {
|
|
22
|
-
await this.orders.positions.deleteOrderPositions(userCart?._id);
|
|
23
|
-
await this.orders.payments.deleteOrderPayments(userCart?._id);
|
|
24
|
-
await this.orders.deliveries.deleteOrderDeliveries(userCart?._id);
|
|
25
|
-
await this.orders.discounts.deleteOrderDiscounts(userCart?._id);
|
|
26
|
-
await this.orders.delete(userCart?._id);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const ordersCount = await this.orders.count({ userId, includeCarts: true });
|
|
30
|
-
const quotationsCount = await this.quotations.count({ userId });
|
|
31
|
-
const reviewsCount = await this.products.reviews.count({ authorId: userId });
|
|
32
|
-
const enrollmentsCount = await this.enrollments.count({ userId });
|
|
33
|
-
const tokens = await this.warehousing.findTokensForUser({ userId });
|
|
34
|
-
const paymentCredentials = await this.payment.paymentCredentials.count({ userId });
|
|
35
|
-
|
|
36
|
-
if (
|
|
37
|
-
!ordersCount &&
|
|
38
|
-
!reviewsCount &&
|
|
39
|
-
!enrollmentsCount &&
|
|
40
|
-
!quotationsCount &&
|
|
41
|
-
!tokens?.length &&
|
|
42
|
-
!paymentCredentials
|
|
43
|
-
) {
|
|
44
|
-
await this.users.deletePermanently({ userId });
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return user;
|
|
48
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { Order, OrderDiscount } from '@unchainedshop/core-orders';
|
|
2
|
-
import {
|
|
3
|
-
DeliveryPricingSheet,
|
|
4
|
-
OrderPricingDiscount,
|
|
5
|
-
OrderPricingSheet,
|
|
6
|
-
PaymentPricingSheet,
|
|
7
|
-
ProductPricingSheet,
|
|
8
|
-
} from '../directors/index.js';
|
|
9
|
-
import { Modules } from '../modules.js';
|
|
10
|
-
|
|
11
|
-
export async function discountedEntitiesService(
|
|
12
|
-
this: Modules,
|
|
13
|
-
order: Order,
|
|
14
|
-
orderDiscount: OrderDiscount,
|
|
15
|
-
): Promise<OrderPricingDiscount[]> {
|
|
16
|
-
// Delivery discounts
|
|
17
|
-
const orderDelivery = await this.orders.deliveries.findDelivery({
|
|
18
|
-
orderDeliveryId: order.deliveryId!,
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
const deliveryPricingSheet = DeliveryPricingSheet({
|
|
22
|
-
calculation: orderDelivery!.calculation || [],
|
|
23
|
-
currencyCode: order.currencyCode,
|
|
24
|
-
});
|
|
25
|
-
const orderDeliveryDiscounts = deliveryPricingSheet
|
|
26
|
-
.discountPrices(orderDiscount._id)
|
|
27
|
-
.map((discount) => ({
|
|
28
|
-
delivery: orderDelivery!,
|
|
29
|
-
...discount,
|
|
30
|
-
}));
|
|
31
|
-
|
|
32
|
-
// Payment discounts
|
|
33
|
-
const orderPayment = await this.orders.payments.findOrderPayment({
|
|
34
|
-
orderPaymentId: order.paymentId!,
|
|
35
|
-
});
|
|
36
|
-
const paymentPricingSheet = PaymentPricingSheet({
|
|
37
|
-
calculation: orderPayment!.calculation || [],
|
|
38
|
-
currencyCode: order.currencyCode,
|
|
39
|
-
});
|
|
40
|
-
const orderPaymentDiscounts = paymentPricingSheet
|
|
41
|
-
.discountPrices(orderDiscount._id)
|
|
42
|
-
.map((discount) => ({
|
|
43
|
-
payment: orderPayment!,
|
|
44
|
-
...discount,
|
|
45
|
-
}));
|
|
46
|
-
|
|
47
|
-
// Position discounts
|
|
48
|
-
const orderPositions = await this.orders.positions.findOrderPositions({
|
|
49
|
-
orderId: order._id,
|
|
50
|
-
});
|
|
51
|
-
const orderPositionDiscounts = orderPositions.flatMap((orderPosition) =>
|
|
52
|
-
ProductPricingSheet({
|
|
53
|
-
calculation: orderPosition.calculation,
|
|
54
|
-
currencyCode: order.currencyCode,
|
|
55
|
-
quantity: orderPosition.quantity,
|
|
56
|
-
})
|
|
57
|
-
.discountPrices(orderDiscount._id)
|
|
58
|
-
.map((discount) => ({
|
|
59
|
-
item: orderPosition,
|
|
60
|
-
...discount,
|
|
61
|
-
})),
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
// order discounts
|
|
65
|
-
const orderDiscounts = OrderPricingSheet({
|
|
66
|
-
calculation: order.calculation || [],
|
|
67
|
-
currencyCode: order.currencyCode,
|
|
68
|
-
})
|
|
69
|
-
.discountPrices(orderDiscount._id)
|
|
70
|
-
.map((discount) => ({ order, ...discount }));
|
|
71
|
-
|
|
72
|
-
// All discounts
|
|
73
|
-
const discounted = [
|
|
74
|
-
...orderPaymentDiscounts,
|
|
75
|
-
...orderDeliveryDiscounts,
|
|
76
|
-
...orderPositionDiscounts,
|
|
77
|
-
...orderDiscounts,
|
|
78
|
-
].filter(Boolean);
|
|
79
|
-
|
|
80
|
-
return discounted;
|
|
81
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { TokenSurrogate, WarehousingProviderType } from '@unchainedshop/core-warehousing';
|
|
2
|
-
import { Product } from '@unchainedshop/core-products';
|
|
3
|
-
import { WarehousingDirector } from '../directors/WarehousingDirector.js';
|
|
4
|
-
import { Modules } from '../modules.js';
|
|
5
|
-
|
|
6
|
-
export async function ercMetadataService(
|
|
7
|
-
this: Modules,
|
|
8
|
-
{ product, token, locale }: { product: Product; token: TokenSurrogate; locale: Intl.Locale },
|
|
9
|
-
) {
|
|
10
|
-
const virtualProviders = (await this.warehousing.allProviders()).filter(
|
|
11
|
-
({ type }) => type === WarehousingProviderType.VIRTUAL,
|
|
12
|
-
);
|
|
13
|
-
|
|
14
|
-
return await WarehousingDirector.tokenMetadata(
|
|
15
|
-
virtualProviders,
|
|
16
|
-
{
|
|
17
|
-
product,
|
|
18
|
-
token,
|
|
19
|
-
locale,
|
|
20
|
-
quantity: token?.quantity || 1,
|
|
21
|
-
referenceDate: new Date(),
|
|
22
|
-
},
|
|
23
|
-
{ modules: this },
|
|
24
|
-
);
|
|
25
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { User } from '@unchainedshop/core-users';
|
|
2
|
-
import { Modules } from '../modules.js';
|
|
3
|
-
import { nextUserCartService } from './nextUserCart.js';
|
|
4
|
-
|
|
5
|
-
export async function findOrInitCartService(
|
|
6
|
-
this: Modules,
|
|
7
|
-
{
|
|
8
|
-
user,
|
|
9
|
-
countryCode,
|
|
10
|
-
orderId,
|
|
11
|
-
}: {
|
|
12
|
-
user: User;
|
|
13
|
-
countryCode: string;
|
|
14
|
-
orderId?: string;
|
|
15
|
-
},
|
|
16
|
-
) {
|
|
17
|
-
if (orderId) {
|
|
18
|
-
const order = await this.orders.findOrder({ orderId });
|
|
19
|
-
if (!order) return null;
|
|
20
|
-
return order;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return nextUserCartService.bind(this)({
|
|
24
|
-
user,
|
|
25
|
-
countryCode,
|
|
26
|
-
forceCartCreation: true,
|
|
27
|
-
});
|
|
28
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Quotation, QuotationStatus } from '@unchainedshop/core-quotations';
|
|
2
|
-
import { Modules } from '../modules.js';
|
|
3
|
-
import { processQuotationService } from './processQuotation.js';
|
|
4
|
-
|
|
5
|
-
export async function fullfillQuotationService(this: Modules, quotation: Quotation, info) {
|
|
6
|
-
if (quotation.status === QuotationStatus.FULLFILLED) return quotation;
|
|
7
|
-
|
|
8
|
-
const updatedQuotation = await this.quotations.updateStatus(quotation._id, {
|
|
9
|
-
status: QuotationStatus.FULLFILLED,
|
|
10
|
-
info: JSON.stringify(info),
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
return processQuotationService.bind(this)(updatedQuotation!, {});
|
|
14
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { Modules } from '../modules.js';
|
|
2
|
-
import { Enrollment, EnrollmentOrderPositionTemplate } from '@unchainedshop/core-enrollments';
|
|
3
|
-
import { updateCalculationService } from './updateCalculation.js';
|
|
4
|
-
import { checkoutOrderService } from './checkoutOrder.js';
|
|
5
|
-
|
|
6
|
-
export async function generateOrderFromEnrollmentService(
|
|
7
|
-
this: Modules,
|
|
8
|
-
enrollment: Enrollment,
|
|
9
|
-
{
|
|
10
|
-
orderPositionTemplates,
|
|
11
|
-
orderContext,
|
|
12
|
-
}: {
|
|
13
|
-
orderPositionTemplates: EnrollmentOrderPositionTemplate[];
|
|
14
|
-
orderContext?: any;
|
|
15
|
-
},
|
|
16
|
-
) {
|
|
17
|
-
if (!enrollment.payment || !enrollment.delivery) return null;
|
|
18
|
-
|
|
19
|
-
const order = await this.orders.create({
|
|
20
|
-
userId: enrollment.userId,
|
|
21
|
-
currencyCode: enrollment.currencyCode,
|
|
22
|
-
countryCode: enrollment.countryCode,
|
|
23
|
-
contact: enrollment.contact,
|
|
24
|
-
billingAddress: enrollment.billingAddress,
|
|
25
|
-
originEnrollmentId: enrollment._id,
|
|
26
|
-
context: orderContext,
|
|
27
|
-
});
|
|
28
|
-
const orderId = order._id;
|
|
29
|
-
|
|
30
|
-
await Promise.all(
|
|
31
|
-
orderPositionTemplates.map((orderPositionTemplate) =>
|
|
32
|
-
this.orders.positions.addProductItem({
|
|
33
|
-
...orderPositionTemplate,
|
|
34
|
-
orderId: order._id,
|
|
35
|
-
}),
|
|
36
|
-
),
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
const { paymentProviderId, context: paymentContext } = enrollment.payment;
|
|
40
|
-
if (paymentProviderId) {
|
|
41
|
-
await this.orders.setPaymentProvider(orderId, paymentProviderId);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const { deliveryProviderId, context: deliveryContext } = enrollment.delivery;
|
|
45
|
-
if (deliveryProviderId) {
|
|
46
|
-
await this.orders.setDeliveryProvider(orderId, deliveryProviderId);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
await updateCalculationService.bind(this)(orderId);
|
|
50
|
-
return checkoutOrderService.bind(this)(order._id, {
|
|
51
|
-
deliveryContext,
|
|
52
|
-
paymentContext,
|
|
53
|
-
});
|
|
54
|
-
}
|
package/src/services/index.ts
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import { Modules } from '../modules.js';
|
|
2
|
-
import { migrateUserDataService } from './migrateUserData.js';
|
|
3
|
-
import { updateUserAvatarAfterUploadService } from './updateUserAvatarAfterUpload.js';
|
|
4
|
-
import { linkFileService } from './linkFileService.js';
|
|
5
|
-
import { createSignedURLService } from './createSignedURL.js';
|
|
6
|
-
import { uploadFileFromURLService } from './uploadFileFromURL.js';
|
|
7
|
-
import { uploadFileFromStreamService } from './uploadFileFromStream.js';
|
|
8
|
-
import { removeFilesService } from './removeFiles.js';
|
|
9
|
-
import { createDownloadStreamService } from './createDownloadStream.js';
|
|
10
|
-
import { migrateBookmarksService } from './migrateBookmarks.js';
|
|
11
|
-
import { migrateOrderCartsService } from './migrateOrderCart.js';
|
|
12
|
-
import { nextUserCartService } from './nextUserCart.js';
|
|
13
|
-
import { removeProductService } from './removeProduct.js';
|
|
14
|
-
import { initCartProvidersService } from './initCartProviders.js';
|
|
15
|
-
import { updateCalculationService } from './updateCalculation.js';
|
|
16
|
-
import { supportedDeliveryProvidersService } from './supportedDeliveryProviders.js';
|
|
17
|
-
import { deleteUserService } from './deleteUser.js';
|
|
18
|
-
import { supportedPaymentProvidersService } from './supportedPaymentProviders.js';
|
|
19
|
-
import { supportedWarehousingProvidersService } from './supportedWarehousingProviders.js';
|
|
20
|
-
import { createEnrollmentFromCheckoutService } from './createEnrollmentFromCheckout.js';
|
|
21
|
-
import { searchAssortmentsService } from './searchAssortments.js';
|
|
22
|
-
import { searchProductsService } from './searchProducts.js';
|
|
23
|
-
import { calculateDiscountTotalService } from './calculateDiscountTotal.js';
|
|
24
|
-
import { registerPaymentCredentialsService } from './registerPaymentCredentials.js';
|
|
25
|
-
import { processOrderService } from './processOrder.js';
|
|
26
|
-
import { checkoutOrderService } from './checkoutOrder.js';
|
|
27
|
-
import { confirmOrderService } from './confirmOrder.js';
|
|
28
|
-
import { rejectOrderService } from './rejectOrder.js';
|
|
29
|
-
import { discountedEntitiesService } from './discountedEntities.js';
|
|
30
|
-
import { createManualOrderDiscountService } from './createManualOrderDiscount.js';
|
|
31
|
-
import { initializeEnrollmentService } from './initializeEnrollment.js';
|
|
32
|
-
import { activateEnrollmentService } from './activateEnrollment.js';
|
|
33
|
-
import { terminateEnrollmentService } from './terminateEnrollment.js';
|
|
34
|
-
import { invalidateFilterCacheService } from './invalidateFilterCache.js';
|
|
35
|
-
import { fullfillQuotationService } from './fullfillQuotation.js';
|
|
36
|
-
import { processQuotationService } from './processQuotation.js';
|
|
37
|
-
import { proposeQuotationService } from './proposeQuotation.js';
|
|
38
|
-
import { rejectQuotationService } from './rejectQuotation.js';
|
|
39
|
-
import { verifyQuotationService } from './verifyQuotation.js';
|
|
40
|
-
import { loadFiltersService } from './loadFilters.js';
|
|
41
|
-
import { loadFilterOptionsService } from './loadFilterOptions.js';
|
|
42
|
-
import { ercMetadataService } from './ercMetadata.js';
|
|
43
|
-
import { simulateProductPricingService } from './simulateProductPricing.js';
|
|
44
|
-
import { simulateProductDispatchingService } from './simulateProductDispatching.js';
|
|
45
|
-
import { simulateProductInventoryService } from './simulateProductInventory.js';
|
|
46
|
-
import { findOrInitCartService } from './findOrInitCart.js';
|
|
47
|
-
import { addMessageService } from './addMessage.js';
|
|
48
|
-
import { generateOrderFromEnrollmentService } from './generateOrderFromEnrollment.js';
|
|
49
|
-
|
|
50
|
-
// Auto-Inject Unchained API as last parameter
|
|
51
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy
|
|
52
|
-
|
|
53
|
-
function bindMethodsToModules(modules: Modules) {
|
|
54
|
-
return {
|
|
55
|
-
get(target, prop, receiver) {
|
|
56
|
-
const value = target[prop];
|
|
57
|
-
if (value instanceof Function) {
|
|
58
|
-
return value.bind(modules);
|
|
59
|
-
} else if (value instanceof Object) {
|
|
60
|
-
return new Proxy(value, bindMethodsToModules(modules));
|
|
61
|
-
}
|
|
62
|
-
return Reflect.get(target, prop, receiver);
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export type ServiceInterface = (this: Modules, ...args: any[]) => Promise<any> | any;
|
|
68
|
-
|
|
69
|
-
export type Bound<T extends ServiceInterface> = OmitThisParameter<T>;
|
|
70
|
-
|
|
71
|
-
export type CustomServices = Record<string, ServiceInterface | Record<string, ServiceInterface>>;
|
|
72
|
-
|
|
73
|
-
export default function initServices(modules: Modules, customServices: CustomServices = {}) {
|
|
74
|
-
const services = {
|
|
75
|
-
bookmarks: {
|
|
76
|
-
migrateBookmarks: migrateBookmarksService as Bound<typeof migrateBookmarksService>,
|
|
77
|
-
},
|
|
78
|
-
files: {
|
|
79
|
-
linkFile: linkFileService as Bound<typeof linkFileService>,
|
|
80
|
-
createSignedURL: createSignedURLService as Bound<typeof createSignedURLService>,
|
|
81
|
-
uploadFileFromURL: uploadFileFromURLService as Bound<typeof uploadFileFromURLService>,
|
|
82
|
-
uploadFileFromStream: uploadFileFromStreamService as Bound<typeof uploadFileFromStreamService>,
|
|
83
|
-
removeFiles: removeFilesService as Bound<typeof removeFilesService>,
|
|
84
|
-
createDownloadStream: createDownloadStreamService as Bound<typeof createDownloadStreamService>,
|
|
85
|
-
},
|
|
86
|
-
orders: {
|
|
87
|
-
registerPaymentCredentials: registerPaymentCredentialsService as Bound<
|
|
88
|
-
typeof registerPaymentCredentialsService
|
|
89
|
-
>,
|
|
90
|
-
calculateDiscountTotal: calculateDiscountTotalService as Bound<
|
|
91
|
-
typeof calculateDiscountTotalService
|
|
92
|
-
>,
|
|
93
|
-
migrateOrderCarts: migrateOrderCartsService as Bound<typeof migrateOrderCartsService>,
|
|
94
|
-
nextUserCart: nextUserCartService as Bound<typeof nextUserCartService>,
|
|
95
|
-
findOrInitCart: findOrInitCartService as Bound<typeof findOrInitCartService>,
|
|
96
|
-
initCartProviders: initCartProvidersService as Bound<typeof initCartProvidersService>,
|
|
97
|
-
updateCalculation: updateCalculationService as Bound<typeof updateCalculationService>,
|
|
98
|
-
supportedDeliveryProviders: supportedDeliveryProvidersService as Bound<
|
|
99
|
-
typeof supportedDeliveryProvidersService
|
|
100
|
-
>,
|
|
101
|
-
supportedPaymentProviders: supportedPaymentProvidersService as Bound<
|
|
102
|
-
typeof supportedPaymentProvidersService
|
|
103
|
-
>,
|
|
104
|
-
supportedWarehousingProviders: supportedWarehousingProvidersService as Bound<
|
|
105
|
-
typeof supportedWarehousingProvidersService
|
|
106
|
-
>,
|
|
107
|
-
processOrder: processOrderService as Bound<typeof processOrderService>,
|
|
108
|
-
checkoutOrder: checkoutOrderService as Bound<typeof checkoutOrderService>,
|
|
109
|
-
confirmOrder: confirmOrderService as Bound<typeof confirmOrderService>,
|
|
110
|
-
rejectOrder: rejectOrderService as Bound<typeof rejectOrderService>,
|
|
111
|
-
discountedEntities: discountedEntitiesService as Bound<typeof discountedEntitiesService>,
|
|
112
|
-
createManualOrderDiscount: createManualOrderDiscountService as Bound<
|
|
113
|
-
typeof createManualOrderDiscountService
|
|
114
|
-
>,
|
|
115
|
-
},
|
|
116
|
-
products: {
|
|
117
|
-
simulateProductPricing: simulateProductPricingService as Bound<
|
|
118
|
-
typeof simulateProductPricingService
|
|
119
|
-
>,
|
|
120
|
-
simulateProductDispatching: simulateProductDispatchingService as Bound<
|
|
121
|
-
typeof simulateProductDispatchingService
|
|
122
|
-
>,
|
|
123
|
-
simulateProductInventory: simulateProductInventoryService as Bound<
|
|
124
|
-
typeof simulateProductInventoryService
|
|
125
|
-
>,
|
|
126
|
-
removeProduct: removeProductService as Bound<typeof removeProductService>,
|
|
127
|
-
},
|
|
128
|
-
users: {
|
|
129
|
-
migrateUserData: migrateUserDataService as Bound<typeof migrateUserDataService>,
|
|
130
|
-
updateUserAvatarAfterUpload: updateUserAvatarAfterUploadService as Bound<
|
|
131
|
-
typeof updateUserAvatarAfterUploadService
|
|
132
|
-
>,
|
|
133
|
-
deleteUser: deleteUserService as Bound<typeof deleteUserService>,
|
|
134
|
-
},
|
|
135
|
-
enrollments: {
|
|
136
|
-
createEnrollmentFromCheckout: createEnrollmentFromCheckoutService as Bound<
|
|
137
|
-
typeof createEnrollmentFromCheckoutService
|
|
138
|
-
>,
|
|
139
|
-
generateOrderFromEnrollment: generateOrderFromEnrollmentService as Bound<
|
|
140
|
-
typeof generateOrderFromEnrollmentService
|
|
141
|
-
>,
|
|
142
|
-
processEnrollment: processOrderService as Bound<typeof processOrderService>,
|
|
143
|
-
initializeEnrollment: initializeEnrollmentService as Bound<typeof initializeEnrollmentService>,
|
|
144
|
-
activateEnrollment: activateEnrollmentService as Bound<typeof activateEnrollmentService>,
|
|
145
|
-
terminateEnrollment: terminateEnrollmentService as Bound<typeof terminateEnrollmentService>,
|
|
146
|
-
},
|
|
147
|
-
quotations: {
|
|
148
|
-
fullfillQuotation: fullfillQuotationService as Bound<typeof fullfillQuotationService>,
|
|
149
|
-
processQuotation: processQuotationService as Bound<typeof processQuotationService>,
|
|
150
|
-
proposeQuotation: proposeQuotationService as Bound<typeof proposeQuotationService>,
|
|
151
|
-
rejectQuotation: rejectQuotationService as Bound<typeof rejectQuotationService>,
|
|
152
|
-
verifyQuotation: verifyQuotationService as Bound<typeof verifyQuotationService>,
|
|
153
|
-
},
|
|
154
|
-
filters: {
|
|
155
|
-
searchAssortments: searchAssortmentsService as Bound<typeof searchAssortmentsService>,
|
|
156
|
-
searchProducts: searchProductsService as Bound<typeof searchProductsService>,
|
|
157
|
-
invalidateFilterCache: invalidateFilterCacheService as Bound<typeof invalidateFilterCacheService>,
|
|
158
|
-
loadFilters: loadFiltersService as Bound<typeof loadFiltersService>,
|
|
159
|
-
loadFilterOptions: loadFilterOptionsService as Bound<typeof loadFilterOptionsService>,
|
|
160
|
-
},
|
|
161
|
-
warehousing: {
|
|
162
|
-
ercMetadata: ercMetadataService as Bound<typeof ercMetadataService>,
|
|
163
|
-
},
|
|
164
|
-
worker: {
|
|
165
|
-
addMessage: addMessageService as Bound<typeof addMessageService>,
|
|
166
|
-
},
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
// This Proxy Binds all services to the Modules Object
|
|
170
|
-
return new Proxy<typeof services>({ ...services, ...customServices }, bindMethodsToModules(modules));
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
export type Services = ReturnType<typeof initServices>;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { Order } from '@unchainedshop/core-orders';
|
|
2
|
-
import { deliverySettings } from '@unchainedshop/core-delivery';
|
|
3
|
-
import { paymentSettings } from '@unchainedshop/core-payment';
|
|
4
|
-
import { supportedDeliveryProvidersService } from './supportedDeliveryProviders.js';
|
|
5
|
-
import { supportedPaymentProvidersService } from './supportedPaymentProviders.js';
|
|
6
|
-
import { Modules } from '../modules.js';
|
|
7
|
-
|
|
8
|
-
export async function initCartProvidersService(this: Modules, order: Order) {
|
|
9
|
-
let updatedOrder = order;
|
|
10
|
-
|
|
11
|
-
// Init delivery provider
|
|
12
|
-
const supportedDeliveryProviders = await supportedDeliveryProvidersService.bind(this)({
|
|
13
|
-
order: updatedOrder,
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
const orderDelivery = await this.orders.deliveries.findDelivery({
|
|
17
|
-
orderDeliveryId: updatedOrder.deliveryId!,
|
|
18
|
-
});
|
|
19
|
-
const deliveryProviderId = orderDelivery?.deliveryProviderId;
|
|
20
|
-
|
|
21
|
-
const isAlreadyInitializedWithSupportedDeliveryProvider = supportedDeliveryProviders?.some(
|
|
22
|
-
(provider) => {
|
|
23
|
-
return provider._id === deliveryProviderId;
|
|
24
|
-
},
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
if (supportedDeliveryProviders?.length > 0 && !isAlreadyInitializedWithSupportedDeliveryProvider) {
|
|
28
|
-
const defaultOrderDeliveryProvider = await deliverySettings.determineDefaultProvider(
|
|
29
|
-
{
|
|
30
|
-
providers: supportedDeliveryProviders,
|
|
31
|
-
order: updatedOrder,
|
|
32
|
-
},
|
|
33
|
-
{ modules: this },
|
|
34
|
-
);
|
|
35
|
-
if (defaultOrderDeliveryProvider) {
|
|
36
|
-
updatedOrder =
|
|
37
|
-
(await this.orders.setDeliveryProvider(updatedOrder._id, defaultOrderDeliveryProvider._id)) ||
|
|
38
|
-
updatedOrder;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Init payment provider
|
|
43
|
-
const supportedPaymentProviders = await supportedPaymentProvidersService.bind(this)({
|
|
44
|
-
order: updatedOrder,
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
const orderPayment = await this.orders.payments.findOrderPayment({
|
|
48
|
-
orderPaymentId: updatedOrder.paymentId!,
|
|
49
|
-
});
|
|
50
|
-
const paymentProviderId = orderPayment?.paymentProviderId;
|
|
51
|
-
|
|
52
|
-
const isAlreadyInitializedWithSupportedPaymentProvider = supportedPaymentProviders?.some(
|
|
53
|
-
(provider) => {
|
|
54
|
-
return provider._id === paymentProviderId;
|
|
55
|
-
},
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
if (supportedPaymentProviders?.length > 0 && !isAlreadyInitializedWithSupportedPaymentProvider) {
|
|
59
|
-
const paymentCredentials = await this.payment.paymentCredentials.findPaymentCredentials(
|
|
60
|
-
{ userId: updatedOrder.userId, isPreferred: true },
|
|
61
|
-
{
|
|
62
|
-
sort: {
|
|
63
|
-
created: -1,
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
const defaultOrderPaymentProvider = await paymentSettings.determineDefaultProvider(
|
|
69
|
-
{
|
|
70
|
-
providers: supportedPaymentProviders,
|
|
71
|
-
order: updatedOrder,
|
|
72
|
-
paymentCredentials,
|
|
73
|
-
},
|
|
74
|
-
{ modules: this },
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
if (defaultOrderPaymentProvider) {
|
|
78
|
-
updatedOrder =
|
|
79
|
-
(await this.orders.setPaymentProvider(updatedOrder._id, defaultOrderPaymentProvider._id)) ||
|
|
80
|
-
updatedOrder;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return updatedOrder;
|
|
84
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Enrollment } from '@unchainedshop/core-enrollments';
|
|
2
|
-
import { EnrollmentDirector } from '../core-index.js';
|
|
3
|
-
import { processEnrollmentService } from './processEnrollment.js';
|
|
4
|
-
import { Modules } from '../modules.js';
|
|
5
|
-
import { addMessageService } from './addMessage.js';
|
|
6
|
-
|
|
7
|
-
export async function initializeEnrollmentService(
|
|
8
|
-
this: Modules,
|
|
9
|
-
enrollment: Enrollment,
|
|
10
|
-
params: { orderIdForFirstPeriod?: string; reason: string },
|
|
11
|
-
) {
|
|
12
|
-
const product = await this.products.findProduct({
|
|
13
|
-
productId: enrollment.productId,
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
const director = await EnrollmentDirector.actions(
|
|
17
|
-
{ enrollment, product: product! },
|
|
18
|
-
{ modules: this },
|
|
19
|
-
);
|
|
20
|
-
const period = await director.nextPeriod();
|
|
21
|
-
|
|
22
|
-
let updatedEnrollment = enrollment;
|
|
23
|
-
if (period && (params.orderIdForFirstPeriod || period.isTrial)) {
|
|
24
|
-
updatedEnrollment = (await this.enrollments.addEnrollmentPeriod(enrollment._id, {
|
|
25
|
-
...period,
|
|
26
|
-
orderId: params.orderIdForFirstPeriod,
|
|
27
|
-
})) as Enrollment;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const processedEnrollment = await processEnrollmentService.bind(this)(updatedEnrollment);
|
|
31
|
-
const user = await this.users.findUserById(enrollment.userId);
|
|
32
|
-
const locale = this.users.userLocale(user!);
|
|
33
|
-
|
|
34
|
-
await addMessageService.bind(this)('ENROLLMENT_STATUS', {
|
|
35
|
-
reason: 'status_change',
|
|
36
|
-
locale: locale.baseName,
|
|
37
|
-
enrollmentId: processedEnrollment._id,
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
return processedEnrollment;
|
|
41
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Modules } from '../modules.js';
|
|
2
|
-
import { FilterDirector } from '../core-index.js';
|
|
3
|
-
import { createLogger } from '@unchainedshop/logger';
|
|
4
|
-
|
|
5
|
-
const logger = createLogger('unchained:core');
|
|
6
|
-
|
|
7
|
-
export async function invalidateFilterCacheService(this: Modules) {
|
|
8
|
-
logger.debug('Filters: Start invalidating filter caches');
|
|
9
|
-
|
|
10
|
-
const filters = await this.filters.findFilters({ includeInactive: true });
|
|
11
|
-
|
|
12
|
-
await filters.reduce(async (lastPromise, filter) => {
|
|
13
|
-
await lastPromise;
|
|
14
|
-
return FilterDirector.invalidateProductIdCache(filter, { modules: this });
|
|
15
|
-
}, Promise.resolve(undefined));
|
|
16
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { FileDirector } from '@unchainedshop/file-upload';
|
|
2
|
-
import { Modules } from '../modules.js';
|
|
3
|
-
|
|
4
|
-
export async function linkFileService(
|
|
5
|
-
this: Modules,
|
|
6
|
-
{ fileId, size, type }: { fileId: string; size?: number; type?: string },
|
|
7
|
-
) {
|
|
8
|
-
const file = await this.files.findFile({ fileId });
|
|
9
|
-
if (!file) return null;
|
|
10
|
-
|
|
11
|
-
await this.files.update(file._id, {
|
|
12
|
-
size: size || file.size,
|
|
13
|
-
type: type || file.type,
|
|
14
|
-
});
|
|
15
|
-
await this.files.unexpire(file._id);
|
|
16
|
-
if (file?.expires) {
|
|
17
|
-
const callback = FileDirector.getFileUploadCallback(file.path);
|
|
18
|
-
if (callback) {
|
|
19
|
-
await callback(file, { modules: this });
|
|
20
|
-
}
|
|
21
|
-
return this.files.findFile({ fileId });
|
|
22
|
-
}
|
|
23
|
-
return file;
|
|
24
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { FilterType, Filter, SearchQuery } from '@unchainedshop/core-filters';
|
|
2
|
-
import { Modules } from '../modules.js';
|
|
3
|
-
import { FilterDirector, parseQueryArray } from '../directors/FilterDirector.js';
|
|
4
|
-
|
|
5
|
-
export async function loadFilterOptionsService(
|
|
6
|
-
this: Modules,
|
|
7
|
-
filter: Filter,
|
|
8
|
-
params: {
|
|
9
|
-
searchQuery: SearchQuery;
|
|
10
|
-
forceLiveCollection: boolean;
|
|
11
|
-
productIdSet: Set<string>;
|
|
12
|
-
},
|
|
13
|
-
) {
|
|
14
|
-
const { forceLiveCollection, productIdSet, searchQuery } = params;
|
|
15
|
-
|
|
16
|
-
const filterQueryParsed = parseQueryArray(searchQuery?.filterQuery);
|
|
17
|
-
const values = filterQueryParsed[filter.key];
|
|
18
|
-
|
|
19
|
-
const allOptions = (filter.type === FilterType.SWITCH && ['true', 'false']) || filter.options || [];
|
|
20
|
-
const mappedOptions = await Promise.all(
|
|
21
|
-
allOptions.map(async (value) => {
|
|
22
|
-
const filterOptionProductIds = await FilterDirector.filterProductIds(
|
|
23
|
-
filter,
|
|
24
|
-
{
|
|
25
|
-
values: [value],
|
|
26
|
-
forceLiveCollection,
|
|
27
|
-
},
|
|
28
|
-
{ modules: this },
|
|
29
|
-
);
|
|
30
|
-
const filteredProductIdSet = productIdSet.intersection(new Set(filterOptionProductIds));
|
|
31
|
-
|
|
32
|
-
const normalizedValues = values && this.filters.parse(filter, values, [value]);
|
|
33
|
-
const isSelected = normalizedValues && normalizedValues.indexOf(value) !== -1;
|
|
34
|
-
|
|
35
|
-
if (!filteredProductIdSet.size && !isSelected) {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return {
|
|
40
|
-
filteredProductIdSet,
|
|
41
|
-
searchQuery,
|
|
42
|
-
value,
|
|
43
|
-
filter,
|
|
44
|
-
isSelected,
|
|
45
|
-
};
|
|
46
|
-
}),
|
|
47
|
-
);
|
|
48
|
-
return mappedOptions.filter(Boolean);
|
|
49
|
-
}
|