@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,60 +0,0 @@
|
|
|
1
|
-
import { SearchQuery, defaultFilterSelector } from '@unchainedshop/core-filters';
|
|
2
|
-
import { Modules } from '../modules.js';
|
|
3
|
-
import { FilterDirector } from '../directors/FilterDirector.js';
|
|
4
|
-
|
|
5
|
-
export async function loadFiltersService(
|
|
6
|
-
this: Modules,
|
|
7
|
-
searchQuery: SearchQuery,
|
|
8
|
-
options: {
|
|
9
|
-
productIds: string[];
|
|
10
|
-
forceLiveCollection?: boolean;
|
|
11
|
-
locale?: Intl.Locale;
|
|
12
|
-
userId?: string;
|
|
13
|
-
},
|
|
14
|
-
) {
|
|
15
|
-
const filterActions = await FilterDirector.actions({ searchQuery }, { modules: this });
|
|
16
|
-
const filterSelector = await filterActions.transformFilterSelector(
|
|
17
|
-
defaultFilterSelector(searchQuery),
|
|
18
|
-
options,
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
if (!filterSelector) return [];
|
|
22
|
-
|
|
23
|
-
const otherFilters = await this.filters.findFilters({
|
|
24
|
-
...filterSelector,
|
|
25
|
-
limit: 0,
|
|
26
|
-
includeInactive: true,
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const extractedFilterIds = (filterSelector?._id as any)?.$in || [];
|
|
30
|
-
const sortedFilters = otherFilters.toSorted((left, right) => {
|
|
31
|
-
const leftIndex = extractedFilterIds.indexOf(left._id);
|
|
32
|
-
const rightIndex = extractedFilterIds.indexOf(right._id);
|
|
33
|
-
return leftIndex - rightIndex;
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
return Promise.all(
|
|
37
|
-
sortedFilters.map(async (filter) => {
|
|
38
|
-
const { examinedProductIdSet, filteredByOtherFiltersSet, filteredByThisFilterSet } =
|
|
39
|
-
await FilterDirector.filterFacets(
|
|
40
|
-
filter,
|
|
41
|
-
{
|
|
42
|
-
searchQuery,
|
|
43
|
-
forceLiveCollection: !!options.forceLiveCollection,
|
|
44
|
-
allProductIds: options.productIds,
|
|
45
|
-
otherFilters: sortedFilters,
|
|
46
|
-
},
|
|
47
|
-
{ modules: this },
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
return {
|
|
51
|
-
forceLiveCollection: !!options.forceLiveCollection,
|
|
52
|
-
searchQuery,
|
|
53
|
-
filter,
|
|
54
|
-
examinedProductIdSet,
|
|
55
|
-
filteredByOtherFiltersSet,
|
|
56
|
-
filteredByThisFilterSet,
|
|
57
|
-
};
|
|
58
|
-
}),
|
|
59
|
-
);
|
|
60
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { Modules } from '../modules.js';
|
|
2
|
-
|
|
3
|
-
const hashBookmark = (bookmark) => {
|
|
4
|
-
return `${bookmark.productId}:${bookmark.userId}:${JSON.stringify(bookmark.meta || {})}`;
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export async function migrateBookmarksService(
|
|
8
|
-
this: Modules,
|
|
9
|
-
{
|
|
10
|
-
fromUserId,
|
|
11
|
-
toUserId,
|
|
12
|
-
shouldMerge,
|
|
13
|
-
}: {
|
|
14
|
-
fromUserId: string;
|
|
15
|
-
toUserId: string;
|
|
16
|
-
shouldMerge: boolean;
|
|
17
|
-
countryCode: string;
|
|
18
|
-
},
|
|
19
|
-
) {
|
|
20
|
-
const fromBookmarks = await this.bookmarks.findBookmarks({ userId: fromUserId });
|
|
21
|
-
if (!fromBookmarks) {
|
|
22
|
-
// No bookmarks no copy needed
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
if (!shouldMerge) {
|
|
26
|
-
await this.bookmarks.deleteByUserId(toUserId);
|
|
27
|
-
await this.bookmarks.replaceUserId(fromUserId, toUserId);
|
|
28
|
-
} else {
|
|
29
|
-
const toBookmarks = await this.bookmarks.findBookmarks({ userId: toUserId });
|
|
30
|
-
const toBookmarkHashes = toBookmarks.map(hashBookmark);
|
|
31
|
-
const newBookmarkIds = fromBookmarks
|
|
32
|
-
.filter((fromBookmark) => {
|
|
33
|
-
const hash = hashBookmark(fromBookmark);
|
|
34
|
-
return !toBookmarkHashes.includes(hash);
|
|
35
|
-
})
|
|
36
|
-
.map((bookmark) => bookmark._id);
|
|
37
|
-
await this.bookmarks.replaceUserId(fromUserId, toUserId, newBookmarkIds);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { updateCalculationService } from './updateCalculation.js';
|
|
2
|
-
import { Modules } from '../modules.js';
|
|
3
|
-
|
|
4
|
-
export async function migrateOrderCartsService(
|
|
5
|
-
this: Modules,
|
|
6
|
-
{
|
|
7
|
-
fromUserId,
|
|
8
|
-
toUserId,
|
|
9
|
-
shouldMerge,
|
|
10
|
-
countryCode,
|
|
11
|
-
}: {
|
|
12
|
-
fromUserId: string;
|
|
13
|
-
toUserId: string;
|
|
14
|
-
shouldMerge: boolean;
|
|
15
|
-
countryCode: string;
|
|
16
|
-
},
|
|
17
|
-
) {
|
|
18
|
-
const fromCart = await this.orders.cart({
|
|
19
|
-
countryCode,
|
|
20
|
-
userId: fromUserId,
|
|
21
|
-
});
|
|
22
|
-
const toCart = await this.orders.cart({
|
|
23
|
-
countryCode,
|
|
24
|
-
userId: toUserId,
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
if (!fromCart) {
|
|
28
|
-
// No cart, don't copy
|
|
29
|
-
return toCart;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (!toCart || !shouldMerge) {
|
|
33
|
-
// No destination cart, move whole cart
|
|
34
|
-
this.orders.setCartOwner({ orderId: fromCart._id, userId: toUserId });
|
|
35
|
-
return updateCalculationService.bind(this)(fromCart._id);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Move positions
|
|
39
|
-
this.orders.moveCartPositions({ fromOrderId: fromCart._id, toOrderId: toCart._id });
|
|
40
|
-
|
|
41
|
-
// Move billing address if target order has none
|
|
42
|
-
if (fromCart.billingAddress && !toCart.billingAddress) {
|
|
43
|
-
await this.orders.updateBillingAddress(toCart._id, fromCart.billingAddress);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Move contact data if target order has none
|
|
47
|
-
if (fromCart.contact && !toCart.contact) {
|
|
48
|
-
await this.orders.updateContact(toCart._id, fromCart.contact);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return updateCalculationService.bind(this)(toCart._id);
|
|
52
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { userSettings } from '@unchainedshop/core-users';
|
|
2
|
-
import { migrateBookmarksService } from './migrateBookmarks.js';
|
|
3
|
-
import { migrateOrderCartsService } from './migrateOrderCart.js';
|
|
4
|
-
|
|
5
|
-
export async function migrateUserDataService(userIdBeforeLogin: string, userId: string) {
|
|
6
|
-
const user = await this.users.findUserById(userId);
|
|
7
|
-
const userBeforeLogin = await this.users.findUserById(userIdBeforeLogin);
|
|
8
|
-
|
|
9
|
-
await migrateOrderCartsService.bind(this)({
|
|
10
|
-
fromUserId: userIdBeforeLogin,
|
|
11
|
-
toUserId: userId,
|
|
12
|
-
shouldMerge: userSettings.mergeUserCartsOnLogin,
|
|
13
|
-
countryCode: userBeforeLogin?.lastLogin?.countryCode || user?.lastLogin?.countryCode,
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
await migrateBookmarksService.bind(this)({
|
|
17
|
-
fromUserId: userIdBeforeLogin,
|
|
18
|
-
toUserId: userId,
|
|
19
|
-
shouldMerge: userSettings.mergeUserCartsOnLogin,
|
|
20
|
-
countryCode: userBeforeLogin?.lastLogin?.countryCode || user?.lastLogin?.countryCode,
|
|
21
|
-
});
|
|
22
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { resolveBestCurrency } from '@unchainedshop/utils';
|
|
2
|
-
import { User } from '@unchainedshop/core-users';
|
|
3
|
-
import { ordersSettings } from '@unchainedshop/core-orders';
|
|
4
|
-
import { initCartProvidersService } from './initCartProviders.js';
|
|
5
|
-
import { Modules } from '../modules.js';
|
|
6
|
-
|
|
7
|
-
export async function nextUserCartService(
|
|
8
|
-
this: Modules,
|
|
9
|
-
{
|
|
10
|
-
user,
|
|
11
|
-
orderNumber,
|
|
12
|
-
countryCode,
|
|
13
|
-
forceCartCreation,
|
|
14
|
-
}: {
|
|
15
|
-
user: User;
|
|
16
|
-
orderNumber?: string;
|
|
17
|
-
countryCode: string;
|
|
18
|
-
forceCartCreation?: boolean;
|
|
19
|
-
},
|
|
20
|
-
) {
|
|
21
|
-
const cart = await this.orders.cart({
|
|
22
|
-
countryCode,
|
|
23
|
-
orderNumber,
|
|
24
|
-
userId: user._id,
|
|
25
|
-
});
|
|
26
|
-
if (cart) return cart;
|
|
27
|
-
|
|
28
|
-
const shouldCreateNewCart = forceCartCreation || ordersSettings.ensureUserHasCart;
|
|
29
|
-
if (!shouldCreateNewCart) return null;
|
|
30
|
-
|
|
31
|
-
const countryObject = await this.countries.findCountry({ isoCode: countryCode });
|
|
32
|
-
const currencies = await this.currencies.findCurrencies({ includeInactive: false });
|
|
33
|
-
const currencyCode = resolveBestCurrency(countryObject?.defaultCurrencyCode || null, currencies);
|
|
34
|
-
|
|
35
|
-
const order = await this.orders.create({
|
|
36
|
-
userId: user._id,
|
|
37
|
-
orderNumber,
|
|
38
|
-
currencyCode,
|
|
39
|
-
countryCode,
|
|
40
|
-
billingAddress: user.lastBillingAddress || user.profile?.address,
|
|
41
|
-
contact:
|
|
42
|
-
user.lastContact ||
|
|
43
|
-
(!user.guest
|
|
44
|
-
? {
|
|
45
|
-
telNumber: user.profile?.phoneMobile,
|
|
46
|
-
emailAddress: this.users.primaryEmail(user)?.address,
|
|
47
|
-
}
|
|
48
|
-
: {}),
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
return initCartProvidersService.bind(this)(order);
|
|
52
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { Enrollment, EnrollmentStatus } from '@unchainedshop/core-enrollments';
|
|
2
|
-
import { Modules } from '../modules.js';
|
|
3
|
-
import { EnrollmentDirector } from '../core-index.js';
|
|
4
|
-
|
|
5
|
-
const findNextStatus = async (
|
|
6
|
-
enrollment: Enrollment,
|
|
7
|
-
modules: Modules,
|
|
8
|
-
): Promise<EnrollmentStatus | null> => {
|
|
9
|
-
let status = enrollment.status;
|
|
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 });
|
|
17
|
-
|
|
18
|
-
if (status === EnrollmentStatus.INITIAL || status === EnrollmentStatus.PAUSED) {
|
|
19
|
-
if (await director.isValidForActivation()) {
|
|
20
|
-
status = EnrollmentStatus.ACTIVE;
|
|
21
|
-
}
|
|
22
|
-
} else if (status === EnrollmentStatus.ACTIVE) {
|
|
23
|
-
if (await director.isOverdue()) {
|
|
24
|
-
status = EnrollmentStatus.PAUSED;
|
|
25
|
-
}
|
|
26
|
-
} else if (modules.enrollments.isExpired(enrollment, {})) {
|
|
27
|
-
status = EnrollmentStatus.TERMINATED;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return status;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export async function processEnrollmentService(this: Modules, enrollment: Enrollment) {
|
|
34
|
-
const status = await findNextStatus(enrollment, this);
|
|
35
|
-
|
|
36
|
-
if (status === EnrollmentStatus.ACTIVE) {
|
|
37
|
-
// const nextEnrollment = await reactivateEnrollment(enrollment);
|
|
38
|
-
// TODO: Reactivate!
|
|
39
|
-
// status = await findNextStatus(nextEnrollment, unchainedAPI);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (status) {
|
|
43
|
-
return this.enrollments.updateStatus(enrollment._id, {
|
|
44
|
-
status,
|
|
45
|
-
info: 'enrollment processed',
|
|
46
|
-
}) as Promise<Enrollment>;
|
|
47
|
-
}
|
|
48
|
-
return enrollment;
|
|
49
|
-
}
|
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Order,
|
|
3
|
-
OrderDelivery,
|
|
4
|
-
OrderDeliveryStatus,
|
|
5
|
-
OrderPayment,
|
|
6
|
-
OrderPaymentStatus,
|
|
7
|
-
OrderPosition,
|
|
8
|
-
OrderStatus,
|
|
9
|
-
} from '@unchainedshop/core-orders';
|
|
10
|
-
import { Modules } from '../modules.js';
|
|
11
|
-
import { createEnrollmentFromCheckoutService } from './createEnrollmentFromCheckout.js';
|
|
12
|
-
import { Product, ProductTypes } from '@unchainedshop/core-products';
|
|
13
|
-
import { WarehousingProviderType } from '@unchainedshop/core-warehousing';
|
|
14
|
-
import { WarehousingDirector, DeliveryDirector, PaymentDirector } from '../directors/index.js';
|
|
15
|
-
import { fullfillQuotationService } from './fullfillQuotation.js';
|
|
16
|
-
|
|
17
|
-
const isAutoConfirmationEnabled = async (
|
|
18
|
-
{
|
|
19
|
-
orderPayment,
|
|
20
|
-
orderDelivery,
|
|
21
|
-
}: {
|
|
22
|
-
orderPayment: OrderPayment;
|
|
23
|
-
orderDelivery: OrderDelivery;
|
|
24
|
-
},
|
|
25
|
-
modules: Modules,
|
|
26
|
-
) => {
|
|
27
|
-
if (orderPayment.status !== OrderPaymentStatus.PAID) {
|
|
28
|
-
const paymentProvider = await modules.payment.paymentProviders.findProvider({
|
|
29
|
-
paymentProviderId: orderPayment.paymentProviderId,
|
|
30
|
-
});
|
|
31
|
-
if (!paymentProvider)
|
|
32
|
-
throw new Error('Payment provider not found: ' + orderPayment.paymentProviderId);
|
|
33
|
-
const actions = await PaymentDirector.actions(paymentProvider, {}, { modules });
|
|
34
|
-
if (!actions.isPayLaterAllowed()) return false;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (orderDelivery.status !== OrderDeliveryStatus.DELIVERED) {
|
|
38
|
-
const deliveryProvider = await modules.delivery.findProvider({
|
|
39
|
-
deliveryProviderId: orderDelivery.deliveryProviderId,
|
|
40
|
-
});
|
|
41
|
-
if (!deliveryProvider)
|
|
42
|
-
throw new Error('Delivery provider not found: ' + orderDelivery.deliveryProviderId);
|
|
43
|
-
const director = await DeliveryDirector.actions(deliveryProvider, {}, { modules });
|
|
44
|
-
if (!director.isAutoReleaseAllowed()) return false;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return true;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const findNextStatus = async (
|
|
51
|
-
status: OrderStatus | null,
|
|
52
|
-
order: Order,
|
|
53
|
-
modules: Modules,
|
|
54
|
-
): Promise<OrderStatus | null> => {
|
|
55
|
-
if (status === null) {
|
|
56
|
-
return OrderStatus.PENDING;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (status === OrderStatus.FULLFILLED || status === OrderStatus.REJECTED) {
|
|
60
|
-
// Final!
|
|
61
|
-
return status;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const orderPayment =
|
|
65
|
-
order.paymentId &&
|
|
66
|
-
(await modules.orders.payments.findOrderPayment({
|
|
67
|
-
orderPaymentId: order.paymentId,
|
|
68
|
-
}));
|
|
69
|
-
if (!orderPayment) return status;
|
|
70
|
-
|
|
71
|
-
const orderDelivery =
|
|
72
|
-
order.deliveryId &&
|
|
73
|
-
(await modules.orders.deliveries.findDelivery({
|
|
74
|
-
orderDeliveryId: order.deliveryId,
|
|
75
|
-
}));
|
|
76
|
-
if (!orderDelivery) return status;
|
|
77
|
-
|
|
78
|
-
// Ok, we have a payment and a delivery and the correct status,
|
|
79
|
-
// let's check if we can auto-confirm or auto-fulfill
|
|
80
|
-
if (status === OrderStatus.PENDING) {
|
|
81
|
-
if (await isAutoConfirmationEnabled({ orderPayment, orderDelivery }, modules)) {
|
|
82
|
-
return OrderStatus.CONFIRMED;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
if (status === OrderStatus.CONFIRMED) {
|
|
86
|
-
const readyForFullfillment =
|
|
87
|
-
orderDelivery.status === OrderDeliveryStatus.DELIVERED &&
|
|
88
|
-
orderPayment.status === OrderPaymentStatus.PAID;
|
|
89
|
-
if (readyForFullfillment) {
|
|
90
|
-
return OrderStatus.FULLFILLED;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
return status;
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
export async function processOrderService(
|
|
98
|
-
this: Modules,
|
|
99
|
-
initialOrder: Order,
|
|
100
|
-
orderTransactionContext: {
|
|
101
|
-
paymentContext?: any;
|
|
102
|
-
deliveryContext?: any;
|
|
103
|
-
comment?: string;
|
|
104
|
-
nextStatus?: OrderStatus;
|
|
105
|
-
},
|
|
106
|
-
) {
|
|
107
|
-
const {
|
|
108
|
-
paymentContext,
|
|
109
|
-
deliveryContext,
|
|
110
|
-
nextStatus: forceNextStatus,
|
|
111
|
-
comment,
|
|
112
|
-
} = orderTransactionContext;
|
|
113
|
-
|
|
114
|
-
const orderId = initialOrder._id;
|
|
115
|
-
let order = initialOrder;
|
|
116
|
-
let nextStatus = forceNextStatus || (await findNextStatus(initialOrder.status, order, this));
|
|
117
|
-
|
|
118
|
-
if (nextStatus === OrderStatus.PENDING) {
|
|
119
|
-
// auto charge during transition to pending
|
|
120
|
-
await PaymentDirector.chargeOrderPayment(
|
|
121
|
-
order,
|
|
122
|
-
{ userId: order.userId, transactionContext: paymentContext },
|
|
123
|
-
{ modules: this },
|
|
124
|
-
);
|
|
125
|
-
nextStatus = await findNextStatus(nextStatus, order, this);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if (nextStatus === OrderStatus.REJECTED) {
|
|
129
|
-
// auto cancel during transition to rejected
|
|
130
|
-
await PaymentDirector.cancelOrderPayment(
|
|
131
|
-
order,
|
|
132
|
-
{ userId: order.userId, transactionContext: paymentContext },
|
|
133
|
-
{ modules: this },
|
|
134
|
-
);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (nextStatus === OrderStatus.CONFIRMED) {
|
|
138
|
-
// confirm pre-authorized payments
|
|
139
|
-
await PaymentDirector.confirmOrderPayment(
|
|
140
|
-
order,
|
|
141
|
-
{ userId: order.userId, transactionContext: paymentContext },
|
|
142
|
-
{ modules: this },
|
|
143
|
-
);
|
|
144
|
-
if (order.status !== OrderStatus.CONFIRMED) {
|
|
145
|
-
// we have to stop here shortly to complete the confirmation
|
|
146
|
-
// before auto delivery is started, else we have no chance to create
|
|
147
|
-
// numbers that are needed for delivery
|
|
148
|
-
order = (await this.orders.updateStatus(orderId, {
|
|
149
|
-
status: OrderStatus.CONFIRMED,
|
|
150
|
-
info: comment,
|
|
151
|
-
})) as Order;
|
|
152
|
-
|
|
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 });
|
|
158
|
-
|
|
159
|
-
const orderPositions = await this.orders.positions.findOrderPositions({ orderId });
|
|
160
|
-
const mappedProductOrderPositions = await Promise.all(
|
|
161
|
-
orderPositions.map(async (orderPosition) => {
|
|
162
|
-
const product = (await this.products.findProduct({
|
|
163
|
-
productId: orderPosition.productId,
|
|
164
|
-
})) as Product;
|
|
165
|
-
return {
|
|
166
|
-
orderPosition,
|
|
167
|
-
product,
|
|
168
|
-
};
|
|
169
|
-
}),
|
|
170
|
-
);
|
|
171
|
-
const tokenizedItems = mappedProductOrderPositions.filter(
|
|
172
|
-
(item) => item.product?.type === ProductTypes.TokenizedProduct,
|
|
173
|
-
) as { orderPosition: OrderPosition; product: Product }[];
|
|
174
|
-
|
|
175
|
-
if (tokenizedItems.length > 0) {
|
|
176
|
-
// Give virtual warehouse a chance to instantiate new virtual objects
|
|
177
|
-
const virtualProviders = (await this.warehousing.allProviders()).filter(
|
|
178
|
-
({ type }) => type === WarehousingProviderType.VIRTUAL,
|
|
179
|
-
);
|
|
180
|
-
|
|
181
|
-
// It's very important to do this in a series and not in Promise.all
|
|
182
|
-
// TODO: Actually, only createTokens should decide on the unique tokenSerialNumber
|
|
183
|
-
// and the tokens should be created with a distributed Lock to not assign the same id multiple times!
|
|
184
|
-
for (const { orderPosition, product } of tokenizedItems) {
|
|
185
|
-
for (const virtualProvider of virtualProviders) {
|
|
186
|
-
const adapterActions = await WarehousingDirector.actions(
|
|
187
|
-
virtualProvider,
|
|
188
|
-
{
|
|
189
|
-
order,
|
|
190
|
-
orderPosition,
|
|
191
|
-
product,
|
|
192
|
-
quantity: orderPosition.quantity,
|
|
193
|
-
referenceDate: order.ordered,
|
|
194
|
-
},
|
|
195
|
-
{ modules: this },
|
|
196
|
-
);
|
|
197
|
-
const isActive = await adapterActions.isActive();
|
|
198
|
-
if (isActive) {
|
|
199
|
-
const tokens = await adapterActions.tokenize();
|
|
200
|
-
await this.warehousing.createTokens(tokens);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
// Enrollments: Generate enrollments for plan products
|
|
207
|
-
const planItems = mappedProductOrderPositions.filter(
|
|
208
|
-
(item) => item.product?.type === ProductTypes.PlanProduct && !order.originEnrollmentId,
|
|
209
|
-
);
|
|
210
|
-
if (planItems.length > 0) {
|
|
211
|
-
await createEnrollmentFromCheckoutService.bind(this)(order, {
|
|
212
|
-
items: planItems,
|
|
213
|
-
context: {
|
|
214
|
-
paymentContext,
|
|
215
|
-
deliveryContext,
|
|
216
|
-
},
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
// Quotations: If we came here, the checkout succeeded, so we can fullfill underlying quotations
|
|
221
|
-
const quotationItems = mappedProductOrderPositions.filter(
|
|
222
|
-
(item) => item.orderPosition.quotationId,
|
|
223
|
-
) as { orderPosition: OrderPosition & { quotationId: string }; product: Product }[];
|
|
224
|
-
|
|
225
|
-
await Promise.all(
|
|
226
|
-
quotationItems.map(async ({ orderPosition }) => {
|
|
227
|
-
const quotation = await this.quotations.findQuotation({
|
|
228
|
-
quotationId: orderPosition.quotationId,
|
|
229
|
-
});
|
|
230
|
-
if (!quotation) return; // TODO: What happens then?
|
|
231
|
-
await fullfillQuotationService.bind(this)(quotation, {
|
|
232
|
-
orderId,
|
|
233
|
-
orderPositionId: orderPosition._id,
|
|
234
|
-
});
|
|
235
|
-
}),
|
|
236
|
-
);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
nextStatus = await findNextStatus(nextStatus, order, this);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
return (await this.orders.updateStatus(order._id, { status: nextStatus, info: comment })) as Order;
|
|
243
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { Quotation, QuotationStatus } from '@unchainedshop/core-quotations';
|
|
2
|
-
import { Modules } from '../modules.js';
|
|
3
|
-
import { QuotationDirector } from '../core-index.js';
|
|
4
|
-
import { addMessageService } from './addMessage.js';
|
|
5
|
-
|
|
6
|
-
const findNextStatus = async (quotation: Quotation, modules: Modules): Promise<QuotationStatus> => {
|
|
7
|
-
let status = quotation.status as QuotationStatus;
|
|
8
|
-
const director = await QuotationDirector.actions({ quotation }, { modules });
|
|
9
|
-
|
|
10
|
-
if (status === QuotationStatus.REQUESTED) {
|
|
11
|
-
if (!(await director.isManualRequestVerificationRequired())) {
|
|
12
|
-
status = QuotationStatus.PROCESSING;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
if (status === QuotationStatus.PROCESSING) {
|
|
16
|
-
if (!(await director.isManualProposalRequired())) {
|
|
17
|
-
status = QuotationStatus.PROPOSED;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return status;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export async function processQuotationService(
|
|
24
|
-
this: Modules,
|
|
25
|
-
initialQuotation: Quotation,
|
|
26
|
-
params: { quotationContext?: any },
|
|
27
|
-
) {
|
|
28
|
-
const quotationId = initialQuotation._id;
|
|
29
|
-
let quotation = initialQuotation;
|
|
30
|
-
let nextStatus = await findNextStatus(quotation, this);
|
|
31
|
-
const director = await QuotationDirector.actions({ quotation }, { modules: this });
|
|
32
|
-
|
|
33
|
-
if (quotation.status === QuotationStatus.REQUESTED && nextStatus !== QuotationStatus.REQUESTED) {
|
|
34
|
-
await director.submitRequest(params.quotationContext);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
quotation = (await this.quotations.findQuotation({ quotationId })) as Quotation;
|
|
38
|
-
nextStatus = await findNextStatus(quotation, this);
|
|
39
|
-
if (nextStatus !== QuotationStatus.PROCESSING) {
|
|
40
|
-
await director.verifyRequest(params.quotationContext);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
quotation = (await this.quotations.findQuotation({ quotationId })) as Quotation;
|
|
44
|
-
nextStatus = await findNextStatus(quotation, this);
|
|
45
|
-
if (nextStatus === QuotationStatus.REJECTED) {
|
|
46
|
-
await director.rejectRequest(params.quotationContext);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
quotation = (await this.quotations.findQuotation({ quotationId })) as Quotation;
|
|
50
|
-
nextStatus = await findNextStatus(quotation, this);
|
|
51
|
-
if (nextStatus === QuotationStatus.PROPOSED) {
|
|
52
|
-
const proposal = await director.quote();
|
|
53
|
-
quotation = (await this.quotations.updateProposal(quotation._id, proposal)) as Quotation;
|
|
54
|
-
nextStatus = await findNextStatus(quotation, this);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const updatedQuotation = (await this.quotations.updateStatus(quotation._id, {
|
|
58
|
-
status: nextStatus,
|
|
59
|
-
info: 'quotation processed',
|
|
60
|
-
})) as Quotation;
|
|
61
|
-
|
|
62
|
-
const user = await this.users.findUserById(updatedQuotation.userId);
|
|
63
|
-
const locale = this.users.userLocale(user);
|
|
64
|
-
|
|
65
|
-
await addMessageService.bind(this)('QUOTATION_STATUS', {
|
|
66
|
-
locale: locale.baseName,
|
|
67
|
-
quotationId: updatedQuotation._id,
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
return updatedQuotation;
|
|
71
|
-
}
|
|
@@ -1,18 +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 proposeQuotationService(
|
|
6
|
-
this: Modules,
|
|
7
|
-
quotation: Quotation,
|
|
8
|
-
{ quotationContext }: { quotationContext?: any },
|
|
9
|
-
) {
|
|
10
|
-
if (quotation.status !== QuotationStatus.PROCESSING) return quotation;
|
|
11
|
-
|
|
12
|
-
const updatedQuotation = (await this.quotations.updateStatus(quotation._id, {
|
|
13
|
-
status: QuotationStatus.PROPOSED,
|
|
14
|
-
info: 'proposed manually',
|
|
15
|
-
})) as Quotation;
|
|
16
|
-
|
|
17
|
-
return processQuotationService.bind(this)(updatedQuotation, { quotationContext });
|
|
18
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { PaymentContext } from '../directors/PaymentAdapter.js';
|
|
2
|
-
import { PaymentDirector } from '../directors/PaymentDirector.js';
|
|
3
|
-
import { Modules } from '../modules.js';
|
|
4
|
-
|
|
5
|
-
export async function registerPaymentCredentialsService(
|
|
6
|
-
this: Modules,
|
|
7
|
-
paymentProviderId: string,
|
|
8
|
-
paymentContext: PaymentContext,
|
|
9
|
-
) {
|
|
10
|
-
const paymentProvider = await this.payment.paymentProviders.findProvider({
|
|
11
|
-
paymentProviderId,
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
if (!paymentProvider) return null;
|
|
15
|
-
|
|
16
|
-
const actions = await PaymentDirector.actions(paymentProvider, paymentContext, { modules: this });
|
|
17
|
-
const registration = await actions.register();
|
|
18
|
-
|
|
19
|
-
if (!registration) return null;
|
|
20
|
-
|
|
21
|
-
const paymentCredentials = await this.payment.paymentCredentials.upsertCredentials({
|
|
22
|
-
userId: paymentContext.userId,
|
|
23
|
-
paymentProviderId,
|
|
24
|
-
...registration,
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
return paymentCredentials;
|
|
28
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Order, OrderStatus } from '@unchainedshop/core-orders';
|
|
2
|
-
import { Modules } from '../modules.js';
|
|
3
|
-
import { processOrderService } from './processOrder.js';
|
|
4
|
-
|
|
5
|
-
export async function rejectOrderService(
|
|
6
|
-
this: Modules,
|
|
7
|
-
order: Order,
|
|
8
|
-
transactionContext: {
|
|
9
|
-
paymentContext?: any;
|
|
10
|
-
deliveryContext?: any;
|
|
11
|
-
comment?: string;
|
|
12
|
-
nextStatus?: OrderStatus;
|
|
13
|
-
},
|
|
14
|
-
) {
|
|
15
|
-
if (order.status !== OrderStatus.PENDING) return order;
|
|
16
|
-
|
|
17
|
-
const lock = await this.orders.acquireLock(order._id, 'confirm-reject', 1500);
|
|
18
|
-
try {
|
|
19
|
-
return await processOrderService.bind(this)(order, {
|
|
20
|
-
...transactionContext,
|
|
21
|
-
nextStatus: OrderStatus.REJECTED,
|
|
22
|
-
});
|
|
23
|
-
} finally {
|
|
24
|
-
await lock.release();
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,18 +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 rejectQuotationService(
|
|
6
|
-
this: Modules,
|
|
7
|
-
quotation: Quotation,
|
|
8
|
-
{ quotationContext }: { quotationContext?: any },
|
|
9
|
-
) {
|
|
10
|
-
if (quotation.status === QuotationStatus.FULLFILLED) return quotation;
|
|
11
|
-
|
|
12
|
-
const updatedQuotation = (await this.quotations.updateStatus(quotation._id, {
|
|
13
|
-
status: QuotationStatus.REJECTED,
|
|
14
|
-
info: 'rejected manually',
|
|
15
|
-
})) as Quotation;
|
|
16
|
-
|
|
17
|
-
return processQuotationService.bind(this)(updatedQuotation, { quotationContext });
|
|
18
|
-
}
|