@unchainedshop/core 4.0.0-rc.16 → 4.0.0-rc.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/bulk-importer/createBulkImporter.d.ts +29 -6
- package/lib/bulk-importer/createBulkImporter.d.ts.map +1 -1
- package/lib/bulk-importer/createBulkImporter.js +26 -19
- package/lib/bulk-importer/createBulkImporter.js.map +1 -1
- package/lib/bulk-importer/handlers/assortment/create.d.ts +552 -2
- package/lib/bulk-importer/handlers/assortment/create.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/assortment/create.js +32 -5
- package/lib/bulk-importer/handlers/assortment/create.js.map +1 -1
- package/lib/bulk-importer/handlers/assortment/remove.d.ts +20 -2
- package/lib/bulk-importer/handlers/assortment/remove.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/assortment/remove.js +7 -2
- package/lib/bulk-importer/handlers/assortment/remove.js.map +1 -1
- package/lib/bulk-importer/handlers/assortment/update.d.ts +552 -2
- package/lib/bulk-importer/handlers/assortment/update.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/assortment/update.js +43 -7
- package/lib/bulk-importer/handlers/assortment/update.js.map +1 -1
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.d.ts +23 -3
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.js +14 -6
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.js.map +1 -1
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.d.ts +23 -3
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.js +15 -6
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.js.map +1 -1
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.d.ts +23 -3
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.js +17 -8
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.js.map +1 -1
- package/lib/bulk-importer/handlers/assortment/upsertMedia.d.ts +67 -2
- package/lib/bulk-importer/handlers/assortment/upsertMedia.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/assortment/upsertMedia.js +18 -4
- package/lib/bulk-importer/handlers/assortment/upsertMedia.js.map +1 -1
- package/lib/bulk-importer/handlers/filter/create.d.ts +125 -0
- package/lib/bulk-importer/handlers/filter/create.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/filter/create.js +22 -0
- package/lib/bulk-importer/handlers/filter/create.js.map +1 -1
- package/lib/bulk-importer/handlers/filter/remove.d.ts +10 -2
- package/lib/bulk-importer/handlers/filter/remove.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/filter/remove.js +4 -0
- package/lib/bulk-importer/handlers/filter/remove.js.map +1 -1
- package/lib/bulk-importer/handlers/filter/update.d.ts +125 -0
- package/lib/bulk-importer/handlers/filter/update.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/filter/update.js +22 -0
- package/lib/bulk-importer/handlers/filter/update.js.map +1 -1
- package/lib/bulk-importer/handlers/product/create.d.ts +1317 -2
- package/lib/bulk-importer/handlers/product/create.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/product/create.js +87 -8
- package/lib/bulk-importer/handlers/product/create.js.map +1 -1
- package/lib/bulk-importer/handlers/product/remove.d.ts +20 -2
- package/lib/bulk-importer/handlers/product/remove.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/product/remove.js +5 -0
- package/lib/bulk-importer/handlers/product/remove.js.map +1 -1
- package/lib/bulk-importer/handlers/product/transformSpecificationToProductStructure.d.ts +278 -1
- package/lib/bulk-importer/handlers/product/transformSpecificationToProductStructure.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/product/transformSpecificationToProductStructure.js +64 -3
- package/lib/bulk-importer/handlers/product/transformSpecificationToProductStructure.js.map +1 -1
- package/lib/bulk-importer/handlers/product/update.d.ts +1317 -2
- package/lib/bulk-importer/handlers/product/update.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/product/update.js +89 -5
- package/lib/bulk-importer/handlers/product/update.js.map +1 -1
- package/lib/bulk-importer/handlers/product/upsertMedia.d.ts +67 -2
- package/lib/bulk-importer/handlers/product/upsertMedia.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/product/upsertMedia.js +16 -2
- package/lib/bulk-importer/handlers/product/upsertMedia.js.map +1 -1
- package/lib/bulk-importer/handlers/product/upsertVariations.d.ts +73 -2
- package/lib/bulk-importer/handlers/product/upsertVariations.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/product/upsertVariations.js +26 -2
- package/lib/bulk-importer/handlers/product/upsertVariations.js.map +1 -1
- package/lib/bulk-importer/handlers/utils/convertTagsToLowerCase.d.ts +1 -1
- package/lib/bulk-importer/handlers/utils/convertTagsToLowerCase.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/utils/convertTagsToLowerCase.js.map +1 -1
- package/lib/bulk-importer/handlers/utils/event-schema.d.ts +21 -0
- package/lib/bulk-importer/handlers/utils/event-schema.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/utils/event-schema.js +64 -0
- package/lib/bulk-importer/handlers/utils/event-schema.js.map +1 -0
- package/lib/bulk-importer/index.d.ts +4 -0
- package/lib/bulk-importer/index.d.ts.map +1 -0
- package/lib/bulk-importer/index.js +4 -0
- package/lib/bulk-importer/index.js.map +1 -0
- package/lib/bulk-importer/upsertAsset.d.ts +21 -5
- package/lib/bulk-importer/upsertAsset.d.ts.map +1 -1
- package/lib/bulk-importer/upsertAsset.js +8 -0
- package/lib/bulk-importer/upsertAsset.js.map +1 -1
- package/lib/core-index.d.ts +4 -3
- package/lib/core-index.d.ts.map +1 -1
- package/lib/core-index.js +2 -2
- package/lib/core-index.js.map +1 -1
- package/lib/directors/BaseDiscountAdapter.d.ts +4 -4
- package/lib/directors/BaseDiscountAdapter.d.ts.map +1 -1
- package/lib/directors/BaseDiscountAdapter.js +1 -1
- package/lib/directors/BaseDiscountAdapter.js.map +1 -1
- package/lib/directors/BaseDiscountDirector.d.ts +1 -1
- package/lib/directors/BaseDiscountDirector.d.ts.map +1 -1
- package/lib/directors/BaseDiscountDirector.js +1 -1
- package/lib/directors/BaseDiscountDirector.js.map +1 -1
- package/lib/directors/BasePricingAdapter.d.ts +2 -2
- package/lib/directors/BasePricingAdapter.d.ts.map +1 -1
- package/lib/directors/BasePricingDirector.d.ts.map +1 -1
- package/lib/directors/BasePricingDirector.js +3 -3
- package/lib/directors/BasePricingDirector.js.map +1 -1
- package/lib/directors/BasePricingSheet.js.map +1 -1
- package/lib/directors/BaseWorker.js +1 -1
- package/lib/directors/BaseWorker.js.map +1 -1
- package/lib/directors/DeliveryAdapter.d.ts +3 -3
- package/lib/directors/DeliveryAdapter.d.ts.map +1 -1
- package/lib/directors/DeliveryDirector.d.ts +3 -3
- package/lib/directors/DeliveryDirector.d.ts.map +1 -1
- package/lib/directors/DeliveryDirector.js +29 -16
- package/lib/directors/DeliveryDirector.js.map +1 -1
- package/lib/directors/DeliveryPricingAdapter.d.ts +1 -1
- package/lib/directors/DeliveryPricingAdapter.d.ts.map +1 -1
- package/lib/directors/DeliveryPricingDirector.d.ts.map +1 -1
- package/lib/directors/DeliveryPricingDirector.js +3 -4
- package/lib/directors/DeliveryPricingDirector.js.map +1 -1
- package/lib/directors/DeliveryPricingSheet.d.ts.map +1 -1
- package/lib/directors/DeliveryPricingSheet.js +2 -1
- package/lib/directors/DeliveryPricingSheet.js.map +1 -1
- package/lib/directors/EnrollmentAdapter.d.ts +7 -4
- package/lib/directors/EnrollmentAdapter.d.ts.map +1 -1
- package/lib/directors/EnrollmentAdapter.js +1 -4
- package/lib/directors/EnrollmentAdapter.js.map +1 -1
- package/lib/directors/EnrollmentDirector.d.ts +1 -1
- package/lib/directors/EnrollmentDirector.d.ts.map +1 -1
- package/lib/directors/EnrollmentDirector.js +1 -5
- package/lib/directors/EnrollmentDirector.js.map +1 -1
- package/lib/directors/FilterAdapter.d.ts +3 -3
- package/lib/directors/FilterAdapter.d.ts.map +1 -1
- package/lib/directors/FilterDirector.d.ts +1 -1
- package/lib/directors/FilterDirector.d.ts.map +1 -1
- package/lib/directors/FilterDirector.js +1 -1
- package/lib/directors/FilterDirector.js.map +1 -1
- package/lib/directors/MessagingDirector.d.ts +1 -1
- package/lib/directors/OrderDiscountAdapter.d.ts +1 -1
- package/lib/directors/OrderDiscountAdapter.d.ts.map +1 -1
- package/lib/directors/OrderDiscountAdapter.js.map +1 -1
- package/lib/directors/OrderPricingAdapter.d.ts +2 -2
- package/lib/directors/OrderPricingAdapter.d.ts.map +1 -1
- package/lib/directors/OrderPricingDirector.d.ts +2 -2
- package/lib/directors/OrderPricingDirector.d.ts.map +1 -1
- package/lib/directors/OrderPricingDirector.js +1 -1
- package/lib/directors/OrderPricingDirector.js.map +1 -1
- package/lib/directors/OrderPricingSheet.d.ts.map +1 -1
- package/lib/directors/OrderPricingSheet.js +2 -1
- package/lib/directors/OrderPricingSheet.js.map +1 -1
- package/lib/directors/PaymentAdapter.d.ts +2 -2
- package/lib/directors/PaymentAdapter.d.ts.map +1 -1
- package/lib/directors/PaymentDirector.d.ts +4 -4
- package/lib/directors/PaymentDirector.d.ts.map +1 -1
- package/lib/directors/PaymentDirector.js +22 -4
- package/lib/directors/PaymentDirector.js.map +1 -1
- package/lib/directors/PaymentPricingAdapter.d.ts +2 -2
- package/lib/directors/PaymentPricingAdapter.d.ts.map +1 -1
- package/lib/directors/PaymentPricingDirector.d.ts +1 -1
- package/lib/directors/PaymentPricingDirector.d.ts.map +1 -1
- package/lib/directors/PaymentPricingDirector.js +3 -5
- package/lib/directors/PaymentPricingDirector.js.map +1 -1
- package/lib/directors/PaymentPricingSheet.d.ts.map +1 -1
- package/lib/directors/PaymentPricingSheet.js +2 -1
- package/lib/directors/PaymentPricingSheet.js.map +1 -1
- package/lib/directors/ProductDiscountAdapter.d.ts +1 -1
- package/lib/directors/ProductDiscountAdapter.d.ts.map +1 -1
- package/lib/directors/ProductDiscountAdapter.js.map +1 -1
- package/lib/directors/ProductDiscountConfiguration.d.ts +1 -1
- package/lib/directors/ProductDiscountConfiguration.d.ts.map +1 -1
- package/lib/directors/ProductPricingAdapter.d.ts +1 -1
- package/lib/directors/ProductPricingAdapter.d.ts.map +1 -1
- package/lib/directors/ProductPricingDirector.d.ts +2 -2
- package/lib/directors/ProductPricingDirector.d.ts.map +1 -1
- package/lib/directors/ProductPricingDirector.js +3 -3
- package/lib/directors/ProductPricingDirector.js.map +1 -1
- package/lib/directors/ProductPricingSheet.d.ts +2 -2
- package/lib/directors/ProductPricingSheet.d.ts.map +1 -1
- package/lib/directors/ProductPricingSheet.js +2 -1
- package/lib/directors/ProductPricingSheet.js.map +1 -1
- package/lib/directors/QuotationAdapter.d.ts +2 -2
- package/lib/directors/QuotationAdapter.d.ts.map +1 -1
- package/lib/directors/QuotationDirector.js +2 -2
- package/lib/directors/WarehousingAdapter.d.ts +3 -4
- package/lib/directors/WarehousingAdapter.d.ts.map +1 -1
- package/lib/directors/WarehousingAdapter.js.map +1 -1
- package/lib/directors/WarehousingDirector.d.ts +5 -5
- package/lib/directors/WarehousingDirector.d.ts.map +1 -1
- package/lib/directors/WarehousingDirector.js +10 -13
- package/lib/directors/WarehousingDirector.js.map +1 -1
- package/lib/directors/WorkerAdapter.d.ts +1 -1
- package/lib/directors/WorkerAdapter.d.ts.map +1 -1
- package/lib/directors/WorkerAdapter.js +1 -1
- package/lib/directors/WorkerAdapter.js.map +1 -1
- package/lib/directors/WorkerDirector.d.ts +2 -2
- package/lib/directors/WorkerDirector.d.ts.map +1 -1
- package/lib/directors/WorkerDirector.js +2 -3
- package/lib/directors/WorkerDirector.js.map +1 -1
- package/lib/modules.d.ts +1 -1
- package/lib/modules.d.ts.map +1 -1
- package/lib/services/activateEnrollment.js +3 -3
- package/lib/services/activateEnrollment.js.map +1 -1
- package/lib/services/calculateDiscountTotal.js +2 -2
- package/lib/services/calculateDiscountTotal.js.map +1 -1
- package/lib/services/checkoutOrder.d.ts +1 -1
- package/lib/services/checkoutOrder.d.ts.map +1 -1
- package/lib/services/checkoutOrder.js +9 -3
- package/lib/services/checkoutOrder.js.map +1 -1
- package/lib/services/confirmOrder.d.ts +1 -1
- package/lib/services/confirmOrder.d.ts.map +1 -1
- package/lib/services/createDownloadStream.d.ts +1 -1
- package/lib/services/createDownloadStream.d.ts.map +1 -1
- package/lib/services/createDownloadStream.js +2 -0
- package/lib/services/createDownloadStream.js.map +1 -1
- package/lib/services/createEnrollmentFromCheckout.d.ts.map +1 -1
- package/lib/services/createEnrollmentFromCheckout.js +2 -2
- package/lib/services/createEnrollmentFromCheckout.js.map +1 -1
- package/lib/services/createManualOrderDiscount.d.ts +2 -2
- package/lib/services/createManualOrderDiscount.d.ts.map +1 -1
- package/lib/services/createSignedURL.d.ts.map +1 -1
- package/lib/services/createSignedURL.js +2 -0
- package/lib/services/createSignedURL.js.map +1 -1
- package/lib/services/deleteUser.d.ts +1 -1
- package/lib/services/deleteUser.d.ts.map +1 -1
- package/lib/services/deleteUser.js +4 -2
- package/lib/services/deleteUser.js.map +1 -1
- package/lib/services/discountedEntities.js.map +1 -1
- package/lib/services/findOrInitCart.d.ts +1 -2
- package/lib/services/findOrInitCart.d.ts.map +1 -1
- package/lib/services/findOrInitCart.js.map +1 -1
- package/lib/services/fullfillQuotation.d.ts +1 -1
- package/lib/services/fullfillQuotation.d.ts.map +1 -1
- package/lib/services/fullfillQuotation.js.map +1 -1
- package/lib/services/generateOrderFromEnrollment.d.ts +7 -0
- package/lib/services/generateOrderFromEnrollment.d.ts.map +1 -0
- package/lib/services/generateOrderFromEnrollment.js +34 -0
- package/lib/services/generateOrderFromEnrollment.js.map +1 -0
- package/lib/services/index.d.ts +2 -0
- package/lib/services/index.d.ts.map +1 -1
- package/lib/services/index.js +2 -0
- package/lib/services/index.js.map +1 -1
- package/lib/services/initCartProviders.js.map +1 -1
- package/lib/services/initializeEnrollment.d.ts +1 -1
- package/lib/services/initializeEnrollment.d.ts.map +1 -1
- package/lib/services/initializeEnrollment.js +6 -3
- package/lib/services/initializeEnrollment.js.map +1 -1
- package/lib/services/linkFileService.d.ts +1 -1
- package/lib/services/linkFileService.d.ts.map +1 -1
- package/lib/services/linkFileService.js +3 -1
- package/lib/services/linkFileService.js.map +1 -1
- package/lib/services/loadFilterOptions.d.ts +2 -2
- package/lib/services/loadFilterOptions.d.ts.map +1 -1
- package/lib/services/migrateOrderCart.d.ts +1 -1
- package/lib/services/migrateOrderCart.d.ts.map +1 -1
- package/lib/services/nextUserCart.d.ts +1 -1
- package/lib/services/nextUserCart.d.ts.map +1 -1
- package/lib/services/nextUserCart.js +1 -1
- package/lib/services/nextUserCart.js.map +1 -1
- package/lib/services/processEnrollment.d.ts.map +1 -1
- package/lib/services/processEnrollment.js +13 -5
- package/lib/services/processEnrollment.js.map +1 -1
- package/lib/services/processOrder.d.ts.map +1 -1
- package/lib/services/processOrder.js +26 -30
- package/lib/services/processOrder.js.map +1 -1
- package/lib/services/processQuotation.js +6 -6
- package/lib/services/processQuotation.js.map +1 -1
- package/lib/services/proposeQuotation.d.ts +1 -1
- package/lib/services/proposeQuotation.d.ts.map +1 -1
- package/lib/services/proposeQuotation.js +2 -2
- package/lib/services/proposeQuotation.js.map +1 -1
- package/lib/services/registerPaymentCredentials.d.ts +1 -2
- package/lib/services/registerPaymentCredentials.d.ts.map +1 -1
- package/lib/services/registerPaymentCredentials.js +4 -6
- package/lib/services/registerPaymentCredentials.js.map +1 -1
- package/lib/services/rejectOrder.d.ts +1 -1
- package/lib/services/rejectOrder.d.ts.map +1 -1
- package/lib/services/rejectQuotation.d.ts +1 -1
- package/lib/services/rejectQuotation.d.ts.map +1 -1
- package/lib/services/rejectQuotation.js +2 -2
- package/lib/services/rejectQuotation.js.map +1 -1
- package/lib/services/removeProduct.js +3 -3
- package/lib/services/removeProduct.js.map +1 -1
- package/lib/services/searchAssortments.js +1 -1
- package/lib/services/searchAssortments.js.map +1 -1
- package/lib/services/searchProducts.js +1 -1
- package/lib/services/searchProducts.js.map +1 -1
- package/lib/services/simulateProductDispatching.d.ts +1 -1
- package/lib/services/simulateProductDispatching.d.ts.map +1 -1
- package/lib/services/simulateProductInventory.d.ts +1 -1
- package/lib/services/simulateProductInventory.d.ts.map +1 -1
- package/lib/services/simulateProductInventory.js.map +1 -1
- package/lib/services/simulateProductPricing.d.ts +7 -4
- package/lib/services/simulateProductPricing.d.ts.map +1 -1
- package/lib/services/simulateProductPricing.js.map +1 -1
- package/lib/services/updateCalculation.d.ts +2 -1
- package/lib/services/updateCalculation.d.ts.map +1 -1
- package/lib/services/updateCalculation.js +16 -10
- package/lib/services/updateCalculation.js.map +1 -1
- package/lib/services/updateScheduling.d.ts +1 -1
- package/lib/services/updateScheduling.d.ts.map +1 -1
- package/lib/services/updateScheduling.js +7 -11
- package/lib/services/updateScheduling.js.map +1 -1
- package/lib/services/updateUserAvatarAfterUpload.d.ts +1 -1
- package/lib/services/updateUserAvatarAfterUpload.d.ts.map +1 -1
- package/lib/services/updateUserAvatarAfterUpload.js.map +1 -1
- package/lib/services/uploadFileFromStream.d.ts.map +1 -1
- package/lib/services/uploadFileFromStream.js +4 -1
- package/lib/services/uploadFileFromStream.js.map +1 -1
- package/lib/services/uploadFileFromURL.d.ts +1 -2
- package/lib/services/uploadFileFromURL.d.ts.map +1 -1
- package/lib/services/uploadFileFromURL.js.map +1 -1
- package/lib/services/validateOrder.d.ts +1 -1
- package/lib/services/validateOrder.d.ts.map +1 -1
- package/lib/services/validateOrder.js +17 -24
- package/lib/services/validateOrder.js.map +1 -1
- package/lib/services/verifyQuotation.d.ts +1 -1
- package/lib/services/verifyQuotation.d.ts.map +1 -1
- package/lib/services/verifyQuotation.js +2 -2
- package/lib/services/verifyQuotation.js.map +1 -1
- package/package.json +20 -20
- package/src/bulk-importer/createBulkImporter.ts +34 -22
- package/src/bulk-importer/handlers/assortment/create.ts +38 -7
- package/src/bulk-importer/handlers/assortment/remove.ts +14 -3
- package/src/bulk-importer/handlers/assortment/update.ts +53 -9
- package/src/bulk-importer/handlers/assortment/upsertAssortmentChildren.ts +44 -19
- package/src/bulk-importer/handlers/assortment/upsertAssortmentFilters.ts +37 -9
- package/src/bulk-importer/handlers/assortment/upsertAssortmentProducts.ts +35 -9
- package/src/bulk-importer/handlers/assortment/upsertMedia.ts +23 -5
- package/src/bulk-importer/handlers/filter/create.ts +28 -0
- package/src/bulk-importer/handlers/filter/remove.ts +6 -1
- package/src/bulk-importer/handlers/filter/update.ts +28 -1
- package/src/bulk-importer/handlers/product/create.ts +109 -9
- package/src/bulk-importer/handlers/product/remove.ts +7 -1
- package/src/bulk-importer/handlers/product/update.ts +117 -8
- package/src/bulk-importer/handlers/product/upsertMedia.ts +20 -3
- package/src/bulk-importer/handlers/product/upsertVariations.ts +43 -4
- package/src/bulk-importer/handlers/utils/convertTagsToLowerCase.ts +1 -1
- package/src/bulk-importer/index.ts +3 -0
- package/src/bulk-importer/upsertAsset.ts +10 -2
- package/src/core-index.ts +4 -6
- package/src/directors/BaseDiscountAdapter.test.ts +1 -1
- package/src/directors/BaseDiscountAdapter.ts +5 -5
- package/src/directors/BaseDiscountDirector.ts +2 -2
- package/src/directors/BasePricingAdapter.ts +2 -2
- package/src/directors/BasePricingDirector.ts +47 -44
- package/src/directors/BasePricingSheet.ts +1 -1
- package/src/directors/BaseWorker.ts +1 -1
- package/src/directors/DeliveryAdapter.ts +3 -3
- package/src/directors/DeliveryDirector.ts +33 -23
- package/src/directors/DeliveryPricingAdapter.ts +1 -1
- package/src/directors/DeliveryPricingDirector.ts +5 -6
- package/src/directors/DeliveryPricingSheet.ts +3 -2
- package/src/directors/EnrollmentAdapter.ts +9 -6
- package/src/directors/EnrollmentDirector.ts +9 -8
- package/src/directors/FilterAdapter.ts +3 -3
- package/src/directors/FilterDirector.ts +5 -5
- package/src/directors/OrderDiscountAdapter.ts +2 -2
- package/src/directors/OrderPricingAdapter.ts +2 -2
- package/src/directors/OrderPricingDirector.ts +3 -3
- package/src/directors/OrderPricingSheet.ts +3 -2
- package/src/directors/PaymentAdapter.ts +2 -2
- package/src/directors/PaymentDirector.ts +32 -8
- package/src/directors/PaymentPricingAdapter.ts +2 -2
- package/src/directors/PaymentPricingDirector.ts +6 -8
- package/src/directors/PaymentPricingSheet.ts +3 -2
- package/src/directors/ProductDiscountAdapter.ts +2 -2
- package/src/directors/ProductDiscountConfiguration.ts +1 -1
- package/src/directors/ProductPricingAdapter.ts +1 -1
- package/src/directors/ProductPricingDirector.ts +7 -7
- package/src/directors/ProductPricingSheet.ts +4 -3
- package/src/directors/QuotationAdapter.ts +2 -2
- package/src/directors/QuotationDirector.ts +2 -2
- package/src/directors/WarehousingAdapter.ts +3 -4
- package/src/directors/WarehousingDirector.ts +20 -23
- package/src/directors/WorkerAdapter.ts +2 -2
- package/src/directors/WorkerDirector.ts +5 -6
- package/src/modules.ts +1 -1
- package/src/services/activateEnrollment.ts +5 -5
- package/src/services/calculateDiscountTotal.ts +4 -4
- package/src/services/checkoutOrder.ts +9 -4
- package/src/services/createDownloadStream.ts +1 -0
- package/src/services/createEnrollmentFromCheckout.ts +22 -20
- package/src/services/createManualOrderDiscount.ts +2 -2
- package/src/services/createSignedURL.ts +1 -0
- package/src/services/deleteUser.ts +7 -2
- package/src/services/discountedEntities.ts +6 -6
- package/src/services/findOrInitCart.ts +1 -2
- package/src/services/fullfillQuotation.ts +1 -1
- package/src/services/generateOrderFromEnrollment.ts +54 -0
- package/src/services/index.ts +4 -0
- package/src/services/initCartProviders.ts +2 -2
- package/src/services/initializeEnrollment.ts +11 -4
- package/src/services/linkFileService.ts +3 -1
- package/src/services/nextUserCart.ts +1 -1
- package/src/services/processEnrollment.ts +18 -6
- package/src/services/processOrder.ts +33 -36
- package/src/services/processQuotation.ts +6 -6
- package/src/services/proposeQuotation.ts +2 -2
- package/src/services/registerPaymentCredentials.ts +6 -8
- package/src/services/rejectQuotation.ts +2 -2
- package/src/services/removeProduct.ts +3 -3
- package/src/services/searchAssortments.ts +1 -1
- package/src/services/searchProducts.ts +1 -1
- package/src/services/simulateProductDispatching.ts +1 -1
- package/src/services/simulateProductInventory.ts +7 -3
- package/src/services/simulateProductPricing.ts +6 -3
- package/src/services/updateCalculation.ts +33 -18
- package/src/services/updateScheduling.ts +19 -20
- package/src/services/updateUserAvatarAfterUpload.ts +4 -1
- package/src/services/uploadFileFromStream.ts +3 -1
- package/src/services/uploadFileFromURL.ts +2 -2
- package/src/services/validateOrder.ts +34 -38
- package/src/services/verifyQuotation.ts +2 -2
- package/lib/factory/registerProductDiscoverabilityFilter copy.d.ts +0 -5
- package/lib/factory/registerProductDiscoverabilityFilter copy.d.ts.map +0 -1
- package/lib/factory/registerProductDiscoverabilityFilter copy.js +0 -28
- package/lib/factory/registerProductDiscoverabilityFilter copy.js.map +0 -1
- package/src/bulk-importer/handlers/product/transformSpecificationToProductStructure.ts +0 -22
|
@@ -6,10 +6,12 @@ import { WarehousingDirector, DeliveryDirector, PaymentDirector } from '../direc
|
|
|
6
6
|
import { fullfillQuotationService } from './fullfillQuotation.js';
|
|
7
7
|
const isAutoConfirmationEnabled = async ({ orderPayment, orderDelivery, }, modules) => {
|
|
8
8
|
if (orderPayment.status !== OrderPaymentStatus.PAID) {
|
|
9
|
-
const
|
|
9
|
+
const paymentProvider = await modules.payment.paymentProviders.findProvider({
|
|
10
10
|
paymentProviderId: orderPayment.paymentProviderId,
|
|
11
11
|
});
|
|
12
|
-
|
|
12
|
+
if (!paymentProvider)
|
|
13
|
+
throw new Error('Payment provider not found: ' + orderPayment.paymentProviderId);
|
|
14
|
+
const actions = await PaymentDirector.actions(paymentProvider, {}, { modules });
|
|
13
15
|
if (!actions.isPayLaterAllowed())
|
|
14
16
|
return false;
|
|
15
17
|
}
|
|
@@ -17,6 +19,8 @@ const isAutoConfirmationEnabled = async ({ orderPayment, orderDelivery, }, modul
|
|
|
17
19
|
const deliveryProvider = await modules.delivery.findProvider({
|
|
18
20
|
deliveryProviderId: orderDelivery.deliveryProviderId,
|
|
19
21
|
});
|
|
22
|
+
if (!deliveryProvider)
|
|
23
|
+
throw new Error('Delivery provider not found: ' + orderDelivery.deliveryProviderId);
|
|
20
24
|
const director = await DeliveryDirector.actions(deliveryProvider, {}, { modules });
|
|
21
25
|
if (!director.isAutoReleaseAllowed())
|
|
22
26
|
return false;
|
|
@@ -31,14 +35,16 @@ const findNextStatus = async (status, order, modules) => {
|
|
|
31
35
|
// Final!
|
|
32
36
|
return status;
|
|
33
37
|
}
|
|
34
|
-
const orderPayment =
|
|
35
|
-
|
|
36
|
-
|
|
38
|
+
const orderPayment = order.paymentId &&
|
|
39
|
+
(await modules.orders.payments.findOrderPayment({
|
|
40
|
+
orderPaymentId: order.paymentId,
|
|
41
|
+
}));
|
|
37
42
|
if (!orderPayment)
|
|
38
43
|
return status;
|
|
39
|
-
const orderDelivery =
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
const orderDelivery = order.deliveryId &&
|
|
45
|
+
(await modules.orders.deliveries.findDelivery({
|
|
46
|
+
orderDeliveryId: order.deliveryId,
|
|
47
|
+
}));
|
|
42
48
|
if (!orderDelivery)
|
|
43
49
|
return status;
|
|
44
50
|
// Ok, we have a payment and a delivery and the correct status,
|
|
@@ -64,46 +70,34 @@ export async function processOrderService(initialOrder, orderTransactionContext)
|
|
|
64
70
|
let nextStatus = forceNextStatus || (await findNextStatus(initialOrder.status, order, this));
|
|
65
71
|
if (nextStatus === OrderStatus.PENDING) {
|
|
66
72
|
// auto charge during transition to pending
|
|
67
|
-
|
|
68
|
-
orderPaymentId: order.paymentId,
|
|
69
|
-
});
|
|
70
|
-
await PaymentDirector.chargeOrderPayment(orderPayment, { userId: order.userId, transactionContext: paymentContext }, { modules: this });
|
|
73
|
+
await PaymentDirector.chargeOrderPayment(order, { userId: order.userId, transactionContext: paymentContext }, { modules: this });
|
|
71
74
|
nextStatus = await findNextStatus(nextStatus, order, this);
|
|
72
75
|
}
|
|
73
76
|
if (nextStatus === OrderStatus.REJECTED) {
|
|
74
77
|
// auto cancel during transition to rejected
|
|
75
|
-
|
|
76
|
-
orderPaymentId: order.paymentId,
|
|
77
|
-
});
|
|
78
|
-
await PaymentDirector.cancelOrderPayment(orderPayment, { userId: order.userId, transactionContext: paymentContext }, { modules: this });
|
|
78
|
+
await PaymentDirector.cancelOrderPayment(order, { userId: order.userId, transactionContext: paymentContext }, { modules: this });
|
|
79
79
|
}
|
|
80
80
|
if (nextStatus === OrderStatus.CONFIRMED) {
|
|
81
81
|
// confirm pre-authorized payments
|
|
82
|
-
|
|
83
|
-
orderPaymentId: order.paymentId,
|
|
84
|
-
});
|
|
85
|
-
await PaymentDirector.confirmOrderPayment(orderPayment, { userId: order.userId, transactionContext: paymentContext }, { modules: this });
|
|
82
|
+
await PaymentDirector.confirmOrderPayment(order, { userId: order.userId, transactionContext: paymentContext }, { modules: this });
|
|
86
83
|
if (order.status !== OrderStatus.CONFIRMED) {
|
|
87
84
|
// we have to stop here shortly to complete the confirmation
|
|
88
85
|
// before auto delivery is started, else we have no chance to create
|
|
89
86
|
// numbers that are needed for delivery
|
|
90
|
-
order = await this.orders.updateStatus(orderId, {
|
|
87
|
+
order = (await this.orders.updateStatus(orderId, {
|
|
91
88
|
status: OrderStatus.CONFIRMED,
|
|
92
89
|
info: comment,
|
|
93
|
-
});
|
|
94
|
-
const orderDelivery = await this.orders.deliveries.findDelivery({
|
|
95
|
-
orderDeliveryId: order.deliveryId,
|
|
96
|
-
});
|
|
90
|
+
}));
|
|
97
91
|
// TODO: What happens if this THROWS?
|
|
98
92
|
// Tokenization would be skipped?
|
|
99
93
|
// Enrollments will not be there?
|
|
100
94
|
// Quotations would not fulfil?
|
|
101
|
-
await DeliveryDirector.sendOrderDelivery(
|
|
95
|
+
await DeliveryDirector.sendOrderDelivery(order, deliveryContext, { modules: this });
|
|
102
96
|
const orderPositions = await this.orders.positions.findOrderPositions({ orderId });
|
|
103
97
|
const mappedProductOrderPositions = await Promise.all(orderPositions.map(async (orderPosition) => {
|
|
104
|
-
const product = await this.products.findProduct({
|
|
98
|
+
const product = (await this.products.findProduct({
|
|
105
99
|
productId: orderPosition.productId,
|
|
106
|
-
});
|
|
100
|
+
}));
|
|
107
101
|
return {
|
|
108
102
|
orderPosition,
|
|
109
103
|
product,
|
|
@@ -114,7 +108,7 @@ export async function processOrderService(initialOrder, orderTransactionContext)
|
|
|
114
108
|
// Give virtual warehouse a chance to instantiate new virtual objects
|
|
115
109
|
const virtualProviders = (await this.warehousing.allProviders()).filter(({ type }) => type === WarehousingProviderType.VIRTUAL);
|
|
116
110
|
// It's very important to do this in a series and not in Promise.all
|
|
117
|
-
// TODO: Actually, only createTokens should decide on the unique
|
|
111
|
+
// TODO: Actually, only createTokens should decide on the unique tokenSerialNumber
|
|
118
112
|
// and the tokens should be created with a distributed Lock to not assign the same id multiple times!
|
|
119
113
|
for (const { orderPosition, product } of tokenizedItems) {
|
|
120
114
|
for (const virtualProvider of virtualProviders) {
|
|
@@ -150,6 +144,8 @@ export async function processOrderService(initialOrder, orderTransactionContext)
|
|
|
150
144
|
const quotation = await this.quotations.findQuotation({
|
|
151
145
|
quotationId: orderPosition.quotationId,
|
|
152
146
|
});
|
|
147
|
+
if (!quotation)
|
|
148
|
+
return; // TODO: What happens then?
|
|
153
149
|
await fullfillQuotationService.bind(this)(quotation, {
|
|
154
150
|
orderId,
|
|
155
151
|
orderPositionId: orderPosition._id,
|
|
@@ -158,6 +154,6 @@ export async function processOrderService(initialOrder, orderTransactionContext)
|
|
|
158
154
|
}
|
|
159
155
|
nextStatus = await findNextStatus(nextStatus, order, this);
|
|
160
156
|
}
|
|
161
|
-
return this.orders.updateStatus(order._id, { status: nextStatus, info: comment });
|
|
157
|
+
return (await this.orders.updateStatus(order._id, { status: nextStatus, info: comment }));
|
|
162
158
|
}
|
|
163
159
|
//# sourceMappingURL=processOrder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processOrder.js","sourceRoot":"","sources":["../../src/services/processOrder.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,mBAAmB,EAEnB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"processOrder.js","sourceRoot":"","sources":["../../src/services/processOrder.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,mBAAmB,EAEnB,kBAAkB,EAElB,WAAW,GACZ,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,mCAAmC,EAAE,MAAM,mCAAmC,CAAC;AACxF,OAAO,EAAW,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC/F,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAElE,MAAM,yBAAyB,GAAG,KAAK,EACrC,EACE,YAAY,EACZ,aAAa,GAId,EACD,OAAgB,EAChB,EAAE;IACF,IAAI,YAAY,CAAC,MAAM,KAAK,kBAAkB,CAAC,IAAI,EAAE,CAAC;QACpD,MAAM,eAAe,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC,YAAY,CAAC;YAC1E,iBAAiB,EAAE,YAAY,CAAC,iBAAiB;SAClD,CAAC,CAAC;QACH,IAAI,CAAC,eAAe;YAClB,MAAM,IAAI,KAAK,CAAC,8BAA8B,GAAG,YAAY,CAAC,iBAAiB,CAAC,CAAC;QACnF,MAAM,OAAO,GAAG,MAAM,eAAe,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QAChF,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE;YAAE,OAAO,KAAK,CAAC;IACjD,CAAC;IAED,IAAI,aAAa,CAAC,MAAM,KAAK,mBAAmB,CAAC,SAAS,EAA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EAAE,CAAC,CAAU,CAAC;AACrG,CAAC"}
|
|
@@ -24,27 +24,27 @@ export async function processQuotationService(initialQuotation, params) {
|
|
|
24
24
|
if (quotation.status === QuotationStatus.REQUESTED && nextStatus !== QuotationStatus.REQUESTED) {
|
|
25
25
|
await director.submitRequest(params.quotationContext);
|
|
26
26
|
}
|
|
27
|
-
quotation = await this.quotations.findQuotation({ quotationId });
|
|
27
|
+
quotation = (await this.quotations.findQuotation({ quotationId }));
|
|
28
28
|
nextStatus = await findNextStatus(quotation, this);
|
|
29
29
|
if (nextStatus !== QuotationStatus.PROCESSING) {
|
|
30
30
|
await director.verifyRequest(params.quotationContext);
|
|
31
31
|
}
|
|
32
|
-
quotation = await this.quotations.findQuotation({ quotationId });
|
|
32
|
+
quotation = (await this.quotations.findQuotation({ quotationId }));
|
|
33
33
|
nextStatus = await findNextStatus(quotation, this);
|
|
34
34
|
if (nextStatus === QuotationStatus.REJECTED) {
|
|
35
35
|
await director.rejectRequest(params.quotationContext);
|
|
36
36
|
}
|
|
37
|
-
quotation = await this.quotations.findQuotation({ quotationId });
|
|
37
|
+
quotation = (await this.quotations.findQuotation({ quotationId }));
|
|
38
38
|
nextStatus = await findNextStatus(quotation, this);
|
|
39
39
|
if (nextStatus === QuotationStatus.PROPOSED) {
|
|
40
40
|
const proposal = await director.quote();
|
|
41
|
-
quotation = await this.quotations.updateProposal(quotation._id, proposal);
|
|
41
|
+
quotation = (await this.quotations.updateProposal(quotation._id, proposal));
|
|
42
42
|
nextStatus = await findNextStatus(quotation, this);
|
|
43
43
|
}
|
|
44
|
-
const updatedQuotation = await this.quotations.updateStatus(quotation._id, {
|
|
44
|
+
const updatedQuotation = (await this.quotations.updateStatus(quotation._id, {
|
|
45
45
|
status: nextStatus,
|
|
46
46
|
info: 'quotation processed',
|
|
47
|
-
});
|
|
47
|
+
}));
|
|
48
48
|
const user = await this.users.findUserById(updatedQuotation.userId);
|
|
49
49
|
const locale = this.users.userLocale(user);
|
|
50
50
|
await addMessageService.bind(this)('QUOTATION_STATUS', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processQuotation.js","sourceRoot":"","sources":["../../src/services/processQuotation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAE5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD,MAAM,cAAc,GAAG,KAAK,EAAE,SAAoB,EAAE,OAAgB,EAA4B,EAAE;IAChG,IAAI,MAAM,GAAG,SAAS,CAAC,MAAyB,CAAC;IACjD,MAAM,QAAQ,GAAG,MAAM,iBAAiB,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IAE7E,IAAI,MAAM,KAAK,eAAe,CAAC,SAAS,EAAE,CAAC;QACzC,IAAI,CAAC,CAAC,MAAM,QAAQ,CAAC,mCAAmC,EAAE,CAAC,EAAE,CAAC;YAC5D,MAAM,GAAG,eAAe,CAAC,UAAU,CAAC;QACtC,CAAC;IACH,CAAC;IACD,IAAI,MAAM,KAAK,eAAe,CAAC,UAAU,EAAE,CAAC;QAC1C,IAAI,CAAC,CAAC,MAAM,QAAQ,CAAC,wBAAwB,EAAE,CAAC,EAAE,CAAC;YACjD,MAAM,GAAG,eAAe,CAAC,QAAQ,CAAC;QACpC,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAE3C,gBAA2B,EAC3B,MAAkC;IAElC,MAAM,WAAW,GAAG,gBAAgB,CAAC,GAAG,CAAC;IACzC,IAAI,SAAS,GAAG,gBAAgB,CAAC;IACjC,IAAI,UAAU,GAAG,MAAM,cAAc,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACvD,MAAM,QAAQ,GAAG,MAAM,iBAAiB,CAAC,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aAAa,CAAC,EAAE,WAAW,EAAE,CAAC,CAAc,CAAC;IAChF,UAAU,GAAG,MAAM,cAAc,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACnD,IAAI,UAAU,KAAK,eAAe,CAAC,QAAQ,EAAE,CAAC;QAC5C,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,KAAK,EAAE,CAAC;QACxC,SAAS,GAAG,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,SAAS,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAc,CAAC;QACzF,UAAU,GAAG,MAAM,cAAc,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACrD,CAAC;IAED,MAAM,gBAAgB,GAAG,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,SAAS,CAAC,GAAG,EAAE;QAC1E,MAAM,EAAE,UAAU;QAClB,IAAI,EAAE,qBAAqB;KAC5B,CAAC,CAAc,CAAC;IAEjB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACpE,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAE3C,MAAM,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,kBAAkB,EAAE;QACrD,MAAM,EAAE,MAAM,CAAC,QAAQ;QACvB,WAAW,EAAE,gBAAgB,CAAC,GAAG;KAClC,CAAC,CAAC;IAEH,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
|
|
@@ -2,5 +2,5 @@ import { Quotation } from '@unchainedshop/core-quotations';
|
|
|
2
2
|
import { Modules } from '../modules.js';
|
|
3
3
|
export declare function proposeQuotationService(this: Modules, quotation: Quotation, { quotationContext }: {
|
|
4
4
|
quotationContext?: any;
|
|
5
|
-
}): Promise<
|
|
5
|
+
}): Promise<Quotation>;
|
|
6
6
|
//# sourceMappingURL=proposeQuotation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proposeQuotation.d.ts","sourceRoot":"","sources":["../../src/services/proposeQuotation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAmB,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,OAAO,EACb,SAAS,EAAE,SAAS,EACpB,EAAE,gBAAgB,EAAE,EAAE;IAAE,gBAAgB,CAAC,EAAE,GAAG,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"proposeQuotation.d.ts","sourceRoot":"","sources":["../../src/services/proposeQuotation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAmB,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,OAAO,EACb,SAAS,EAAE,SAAS,EACpB,EAAE,gBAAgB,EAAE,EAAE;IAAE,gBAAgB,CAAC,EAAE,GAAG,CAAA;CAAE,sBAUjD"}
|
|
@@ -3,10 +3,10 @@ import { processQuotationService } from './processQuotation.js';
|
|
|
3
3
|
export async function proposeQuotationService(quotation, { quotationContext }) {
|
|
4
4
|
if (quotation.status !== QuotationStatus.PROCESSING)
|
|
5
5
|
return quotation;
|
|
6
|
-
const updatedQuotation = await this.quotations.updateStatus(quotation._id, {
|
|
6
|
+
const updatedQuotation = (await this.quotations.updateStatus(quotation._id, {
|
|
7
7
|
status: QuotationStatus.PROPOSED,
|
|
8
8
|
info: 'proposed manually',
|
|
9
|
-
});
|
|
9
|
+
}));
|
|
10
10
|
return processQuotationService.bind(this)(updatedQuotation, { quotationContext });
|
|
11
11
|
}
|
|
12
12
|
//# sourceMappingURL=proposeQuotation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proposeQuotation.js","sourceRoot":"","sources":["../../src/services/proposeQuotation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAE5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAE3C,SAAoB,EACpB,EAAE,gBAAgB,EAA8B;IAEhD,IAAI,SAAS,CAAC,MAAM,KAAK,eAAe,CAAC,UAAU;QAAE,OAAO,SAAS,CAAC;IAEtE,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,SAAS,CAAC,GAAG,EAAE;
|
|
1
|
+
{"version":3,"file":"proposeQuotation.js","sourceRoot":"","sources":["../../src/services/proposeQuotation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAE5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAE3C,SAAoB,EACpB,EAAE,gBAAgB,EAA8B;IAEhD,IAAI,SAAS,CAAC,MAAM,KAAK,eAAe,CAAC,UAAU;QAAE,OAAO,SAAS,CAAC;IAEtE,MAAM,gBAAgB,GAAG,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,SAAS,CAAC,GAAG,EAAE;QAC1E,MAAM,EAAE,eAAe,CAAC,QAAQ;QAChC,IAAI,EAAE,mBAAmB;KAC1B,CAAC,CAAc,CAAC;IAEjB,OAAO,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,gBAAgB,EAAE,EAAE,gBAAgB,EAAE,CAAC,CAAC;AACpF,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { PaymentCredentials } from '@unchainedshop/core-payment';
|
|
2
1
|
import { PaymentContext } from '../directors/PaymentAdapter.js';
|
|
3
2
|
import { Modules } from '../modules.js';
|
|
4
|
-
export declare function registerPaymentCredentialsService(this: Modules, paymentProviderId: string, paymentContext: PaymentContext): Promise<PaymentCredentials>;
|
|
3
|
+
export declare function registerPaymentCredentialsService(this: Modules, paymentProviderId: string, paymentContext: PaymentContext): Promise<import("@unchainedshop/core-payment").PaymentCredentials | null>;
|
|
5
4
|
//# sourceMappingURL=registerPaymentCredentials.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerPaymentCredentials.d.ts","sourceRoot":"","sources":["../../src/services/registerPaymentCredentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"registerPaymentCredentials.d.ts","sourceRoot":"","sources":["../../src/services/registerPaymentCredentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAEhE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,wBAAsB,iCAAiC,CACrD,IAAI,EAAE,OAAO,EACb,iBAAiB,EAAE,MAAM,EACzB,cAAc,EAAE,cAAc,4EAoB/B"}
|
|
@@ -3,19 +3,17 @@ export async function registerPaymentCredentialsService(paymentProviderId, payme
|
|
|
3
3
|
const paymentProvider = await this.payment.paymentProviders.findProvider({
|
|
4
4
|
paymentProviderId,
|
|
5
5
|
});
|
|
6
|
+
if (!paymentProvider)
|
|
7
|
+
return null;
|
|
6
8
|
const actions = await PaymentDirector.actions(paymentProvider, paymentContext, { modules: this });
|
|
7
9
|
const registration = await actions.register();
|
|
8
10
|
if (!registration)
|
|
9
11
|
return null;
|
|
10
|
-
const
|
|
12
|
+
const paymentCredentials = await this.payment.paymentCredentials.upsertCredentials({
|
|
11
13
|
userId: paymentContext.userId,
|
|
12
14
|
paymentProviderId,
|
|
13
15
|
...registration,
|
|
14
16
|
});
|
|
15
|
-
return
|
|
16
|
-
paymentCredentialsId,
|
|
17
|
-
userId: paymentContext.userId,
|
|
18
|
-
paymentProviderId,
|
|
19
|
-
});
|
|
17
|
+
return paymentCredentials;
|
|
20
18
|
}
|
|
21
19
|
//# sourceMappingURL=registerPaymentCredentials.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerPaymentCredentials.js","sourceRoot":"","sources":["../../src/services/registerPaymentCredentials.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registerPaymentCredentials.js","sourceRoot":"","sources":["../../src/services/registerPaymentCredentials.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAGlE,MAAM,CAAC,KAAK,UAAU,iCAAiC,CAErD,iBAAyB,EACzB,cAA8B;IAE9B,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,YAAY,CAAC;QACvE,iBAAiB;KAClB,CAAC,CAAC;IAEH,IAAI,CAAC,eAAe;QAAE,OAAO,IAAI,CAAC;IAElC,MAAM,OAAO,GAAG,MAAM,eAAe,CAAC,OAAO,CAAC,eAAe,EAAE,cAAc,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAClG,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,QAAQ,EAAE,CAAC;IAE9C,IAAI,CAAC,YAAY;QAAE,OAAO,IAAI,CAAC;IAE/B,MAAM,kBAAkB,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,iBAAiB,CAAC;QACjF,MAAM,EAAE,cAAc,CAAC,MAAM;QAC7B,iBAAiB;QACjB,GAAG,YAAY;KAChB,CAAC,CAAC;IAEH,OAAO,kBAAkB,CAAC;AAC5B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rejectOrder.d.ts","sourceRoot":"","sources":["../../src/services/rejectOrder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,KAAK,EACZ,kBAAkB,EAAE;IAClB,cAAc,CAAC,EAAE,GAAG,CAAC;IACrB,eAAe,CAAC,EAAE,GAAG,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,WAAW,CAAC;CAC1B,
|
|
1
|
+
{"version":3,"file":"rejectOrder.d.ts","sourceRoot":"","sources":["../../src/services/rejectOrder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,KAAK,EACZ,kBAAkB,EAAE;IAClB,cAAc,CAAC,EAAE,GAAG,CAAC;IACrB,eAAe,CAAC,EAAE,GAAG,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,WAAW,CAAC;CAC1B,kBAaF"}
|
|
@@ -2,5 +2,5 @@ import { Quotation } from '@unchainedshop/core-quotations';
|
|
|
2
2
|
import { Modules } from '../modules.js';
|
|
3
3
|
export declare function rejectQuotationService(this: Modules, quotation: Quotation, { quotationContext }: {
|
|
4
4
|
quotationContext?: any;
|
|
5
|
-
}): Promise<
|
|
5
|
+
}): Promise<Quotation>;
|
|
6
6
|
//# sourceMappingURL=rejectQuotation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rejectQuotation.d.ts","sourceRoot":"","sources":["../../src/services/rejectQuotation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAmB,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,OAAO,EACb,SAAS,EAAE,SAAS,EACpB,EAAE,gBAAgB,EAAE,EAAE;IAAE,gBAAgB,CAAC,EAAE,GAAG,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"rejectQuotation.d.ts","sourceRoot":"","sources":["../../src/services/rejectQuotation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAmB,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,OAAO,EACb,SAAS,EAAE,SAAS,EACpB,EAAE,gBAAgB,EAAE,EAAE;IAAE,gBAAgB,CAAC,EAAE,GAAG,CAAA;CAAE,sBAUjD"}
|
|
@@ -3,10 +3,10 @@ import { processQuotationService } from './processQuotation.js';
|
|
|
3
3
|
export async function rejectQuotationService(quotation, { quotationContext }) {
|
|
4
4
|
if (quotation.status === QuotationStatus.FULLFILLED)
|
|
5
5
|
return quotation;
|
|
6
|
-
const updatedQuotation = await this.quotations.updateStatus(quotation._id, {
|
|
6
|
+
const updatedQuotation = (await this.quotations.updateStatus(quotation._id, {
|
|
7
7
|
status: QuotationStatus.REJECTED,
|
|
8
8
|
info: 'rejected manually',
|
|
9
|
-
});
|
|
9
|
+
}));
|
|
10
10
|
return processQuotationService.bind(this)(updatedQuotation, { quotationContext });
|
|
11
11
|
}
|
|
12
12
|
//# sourceMappingURL=rejectQuotation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rejectQuotation.js","sourceRoot":"","sources":["../../src/services/rejectQuotation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAE5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAE1C,SAAoB,EACpB,EAAE,gBAAgB,EAA8B;IAEhD,IAAI,SAAS,CAAC,MAAM,KAAK,eAAe,CAAC,UAAU;QAAE,OAAO,SAAS,CAAC;IAEtE,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,SAAS,CAAC,GAAG,EAAE;
|
|
1
|
+
{"version":3,"file":"rejectQuotation.js","sourceRoot":"","sources":["../../src/services/rejectQuotation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAE5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAE1C,SAAoB,EACpB,EAAE,gBAAgB,EAA8B;IAEhD,IAAI,SAAS,CAAC,MAAM,KAAK,eAAe,CAAC,UAAU;QAAE,OAAO,SAAS,CAAC;IAEtE,MAAM,gBAAgB,GAAG,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,SAAS,CAAC,GAAG,EAAE;QAC1E,MAAM,EAAE,eAAe,CAAC,QAAQ;QAChC,IAAI,EAAE,mBAAmB;KAC1B,CAAC,CAAc,CAAC;IAEjB,OAAO,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,gBAAgB,EAAE,EAAE,gBAAgB,EAAE,CAAC,CAAC;AACpF,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { ProductStatus } from '@unchainedshop/core-products';
|
|
|
2
2
|
import { updateCalculationService } from './updateCalculation.js';
|
|
3
3
|
export async function removeProductService({ productId }) {
|
|
4
4
|
const product = await this.products.findProduct({ productId });
|
|
5
|
-
switch (product
|
|
5
|
+
switch (product?.status) {
|
|
6
6
|
case ProductStatus.ACTIVE:
|
|
7
7
|
await this.products.unpublish(product);
|
|
8
8
|
// falls through
|
|
@@ -10,7 +10,7 @@ export async function removeProductService({ productId }) {
|
|
|
10
10
|
case ProductStatus.DRAFT:
|
|
11
11
|
{
|
|
12
12
|
await this.bookmarks.deleteByProductId(productId);
|
|
13
|
-
await this.assortments.products.
|
|
13
|
+
await this.assortments.products.deleteMany({ productId });
|
|
14
14
|
await this.products.removeAllAssignmentsAndBundleItems(productId);
|
|
15
15
|
const orderIdsToRecalculate = await this.orders.positions.removeProductByIdFromAllOpenPositions(productId);
|
|
16
16
|
await Promise.all([...new Set(orderIdsToRecalculate)].map(async (orderIdToRecalculate) => {
|
|
@@ -20,7 +20,7 @@ export async function removeProductService({ productId }) {
|
|
|
20
20
|
}
|
|
21
21
|
break;
|
|
22
22
|
default:
|
|
23
|
-
throw new Error(`Invalid status
|
|
23
|
+
throw new Error(`Invalid status: ${product?.status}`);
|
|
24
24
|
}
|
|
25
25
|
return true;
|
|
26
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"removeProduct.js","sourceRoot":"","sources":["../../src/services/removeProduct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAGlE,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAExC,EAAE,SAAS,EAAyB;IAEpC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;IAE/D,QAAQ,OAAO,
|
|
1
|
+
{"version":3,"file":"removeProduct.js","sourceRoot":"","sources":["../../src/services/removeProduct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAGlE,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAExC,EAAE,SAAS,EAAyB;IAEpC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;IAE/D,QAAQ,OAAO,EAAE,MAAM,EAAE,CAAC;QACxB,KAAK,aAAa,CAAC,MAAM;YACvB,MAAM,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACzC,gBAAgB;QAChB,KAAK,IAAI,CAAC;QACV,KAAK,aAAa,CAAC,KAAK;YACtB,CAAC;gBACC,MAAM,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;gBAClD,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;gBAC1D,MAAM,IAAI,CAAC,QAAQ,CAAC,kCAAkC,CAAC,SAAS,CAAC,CAAC;gBAClE,MAAM,qBAAqB,GACzB,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,qCAAqC,CAAC,SAAS,CAAC,CAAC;gBAC/E,MAAM,OAAO,CAAC,GAAG,CACf,CAAC,GAAG,IAAI,GAAG,CAAC,qBAAqB,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,oBAAoB,EAAE,EAAE;oBACrE,MAAM,wBAAwB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,oBAAoB,CAAC,CAAC;gBAClE,CAAC,CAAC,CACH,CAAC;gBACF,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YACxC,CAAC;YACD,MAAM;QACR;YACE,MAAM,IAAI,KAAK,CAAC,mBAAmB,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IAC1D,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -10,7 +10,7 @@ export async function searchAssortmentsService(searchQuery, { forceLiveCollectio
|
|
|
10
10
|
filterSelector,
|
|
11
11
|
assortmentSelector,
|
|
12
12
|
sortStage,
|
|
13
|
-
forceLiveCollection,
|
|
13
|
+
forceLiveCollection: !!forceLiveCollection,
|
|
14
14
|
locale,
|
|
15
15
|
};
|
|
16
16
|
const assortmentIds = await searchQuery.assortmentIds;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"searchAssortments.js","sourceRoot":"","sources":["../../src/services/searchAssortments.ts"],"names":[],"mappings":"AACA,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,gBAAgB,GAGjB,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAKvD,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAE5C,WAAwB,EACxB,EAAE,mBAAmB,EAAE,MAAM,EAA0D;IAEvF,MAAM,aAAa,GAAG,MAAM,cAAc,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAEvF,MAAM,cAAc,GAAG,MAAM,aAAa,CAAC,uBAAuB,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC,CAAC;IACvG,MAAM,kBAAkB,GAAG,yBAAyB,CAAC,WAAW,CAAC,CAAC;IAClE,MAAM,SAAS,GAAG,MAAM,aAAa,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAAC;IAExF,MAAM,mBAAmB,GAAkC;QACzD,WAAW;QACX,cAAc;QACd,kBAAkB;QAClB,SAAS;QACT,mBAAmB;
|
|
1
|
+
{"version":3,"file":"searchAssortments.js","sourceRoot":"","sources":["../../src/services/searchAssortments.ts"],"names":[],"mappings":"AACA,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,gBAAgB,GAGjB,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAKvD,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAE5C,WAAwB,EACxB,EAAE,mBAAmB,EAAE,MAAM,EAA0D;IAEvF,MAAM,aAAa,GAAG,MAAM,cAAc,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAEvF,MAAM,cAAc,GAAG,MAAM,aAAa,CAAC,uBAAuB,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC,CAAC;IACvG,MAAM,kBAAkB,GAAG,yBAAyB,CAAC,WAAW,CAAC,CAAC;IAClE,MAAM,SAAS,GAAG,MAAM,aAAa,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAAC;IAExF,MAAM,mBAAmB,GAAkC;QACzD,WAAW;QACX,cAAc;QACd,kBAAkB;QAClB,SAAS;QACT,mBAAmB,EAAE,CAAC,CAAC,mBAAmB;QAC1C,MAAM;KACP,CAAC;IAEF,MAAM,aAAa,GAAG,MAAM,WAAW,CAAC,aAAa,CAAC;IAEtD,MAAM,kBAAkB,GACtB,CAAC,MAAM,aAAa,CAAC,iBAAiB,CAAC,EAAE,aAAa,EAAE,EAAE,mBAAmB,CAAC,CAAC;QAC/E,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,EAAE,eAAe,EAAE,WAAW,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC;IAE/F,OAAO;QACL,mBAAmB;QACnB,kBAAkB;QAElB,gBAAgB,EAAE,KAAK,IAAI,EAAE,CAC3B,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;YACrB,kBAAkB;YAClB,aAAa,EAAE,kBAAkB;SAClC,CAAC;QACJ,WAAW,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,CACvC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,uBAAuB,CAAC;YAC9C,KAAK;YACL,MAAM;YACN,aAAa,EAAE,kBAAkB;YACjC,kBAAkB;YAClB,IAAI,EAAE,SAAS;SAChB,CAAC;KACL,CAAC;AACJ,CAAC"}
|
|
@@ -10,7 +10,7 @@ export async function searchProductsService(searchQuery, { forceLiveCollection,
|
|
|
10
10
|
filterSelector,
|
|
11
11
|
productSelector,
|
|
12
12
|
sortStage,
|
|
13
|
-
forceLiveCollection,
|
|
13
|
+
forceLiveCollection: !!forceLiveCollection,
|
|
14
14
|
locale,
|
|
15
15
|
};
|
|
16
16
|
if (searchQuery.productIds?.length === 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"searchProducts.js","sourceRoot":"","sources":["../../src/services/searchProducts.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,gBAAgB,GAGjB,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAKvD,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAEzC,WAAwB,EACxB,EAAE,mBAAmB,EAAE,MAAM,EAA0D;IAEvF,MAAM,aAAa,GAAG,MAAM,cAAc,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAEvF,MAAM,cAAc,GAAG,MAAM,aAAa,CAAC,uBAAuB,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC,CAAC;IACvG,MAAM,eAAe,GAAG,MAAM,aAAa,CAAC,wBAAwB,CAClE,sBAAsB,CAAC,WAAW,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,EACtD,EAAE,CACH,CAAC;IACF,MAAM,SAAS,GAAG,MAAM,aAAa,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAAC;IAExF,MAAM,mBAAmB,GAA+B;QACtD,WAAW;QACX,cAAc;QACd,eAAe;QACf,SAAS;QACT,mBAAmB;
|
|
1
|
+
{"version":3,"file":"searchProducts.js","sourceRoot":"","sources":["../../src/services/searchProducts.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,gBAAgB,GAGjB,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAKvD,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAEzC,WAAwB,EACxB,EAAE,mBAAmB,EAAE,MAAM,EAA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5B,CAAC,CAAC;IAEH,MAAM,4BAA4B,GAAG,aAAa,CAAC,mBAAmB,CAAC;QACrE,UAAU,EAAE,kBAAkB;KAC/B,CAAC,CAAC;IAEH,OAAO;QACL,mBAAmB;QACnB,eAAe;QACf,yBAAyB;QACzB,4BAA4B;KAC7B,CAAC;AACJ,CAAC"}
|
|
@@ -5,7 +5,7 @@ import { WarehousingContext } from '../directors/WarehousingAdapter.js';
|
|
|
5
5
|
import { WarehousingProvider } from '@unchainedshop/core-warehousing';
|
|
6
6
|
export declare function simulateProductDispatchingService(this: Modules, { product, quantity, referenceDate, }: {
|
|
7
7
|
product: Product;
|
|
8
|
-
quantity
|
|
8
|
+
quantity: number;
|
|
9
9
|
referenceDate?: Date;
|
|
10
10
|
}): Promise<(WarehousingContext & EstimatedDispatch & {
|
|
11
11
|
warehousingProvider: WarehousingProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simulateProductDispatching.d.ts","sourceRoot":"","sources":["../../src/services/simulateProductDispatching.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAuB,MAAM,qCAAqC,CAAC;AAC7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,wBAAsB,iCAAiC,CACrD,IAAI,EAAE,OAAO,EACb,EACE,OAAO,EACP,QAAQ,EACR,aAAa,GACd,EAAE;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,
|
|
1
|
+
{"version":3,"file":"simulateProductDispatching.d.ts","sourceRoot":"","sources":["../../src/services/simulateProductDispatching.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAuB,MAAM,qCAAqC,CAAC;AAC7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,wBAAsB,iCAAiC,CACrD,IAAI,EAAE,OAAO,EACb,EACE,OAAO,EACP,QAAQ,EACR,aAAa,GACd,EAAE;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,IAAI,CAAC;CACtB;yBAK0E,mBAAmB;MAmC/F"}
|
|
@@ -6,7 +6,7 @@ export declare function simulateProductInventoryService(this: Modules, { product
|
|
|
6
6
|
product: Product;
|
|
7
7
|
referenceDate?: Date;
|
|
8
8
|
}): Promise<(WarehousingContext & {
|
|
9
|
-
quantity
|
|
9
|
+
quantity?: number;
|
|
10
10
|
} & {
|
|
11
11
|
warehousingProvider: WarehousingProvider;
|
|
12
12
|
})[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simulateProductInventory.d.ts","sourceRoot":"","sources":["../../src/services/simulateProductInventory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,wBAAsB,+BAA+B,CACnD,IAAI,EAAE,OAAO,EACb,EACE,OAAO,EACP,aAAa,GACd,EAAE;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,IAAI,CAAC;CACtB
|
|
1
|
+
{"version":3,"file":"simulateProductInventory.d.ts","sourceRoot":"","sources":["../../src/services/simulateProductInventory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,wBAAsB,+BAA+B,CACnD,IAAI,EAAE,OAAO,EACb,EACE,OAAO,EACP,aAAa,GACd,EAAE;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,IAAI,CAAC;CACtB;eAMsC,MAAM;;yBAClB,mBAAmB;MAoC/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simulateProductInventory.js","sourceRoot":"","sources":["../../src/services/simulateProductInventory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oCAAoC,EAAE,MAAM,oCAAoC,CAAC;AAE1F,OAAO,
|
|
1
|
+
{"version":3,"file":"simulateProductInventory.js","sourceRoot":"","sources":["../../src/services/simulateProductInventory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oCAAoC,EAAE,MAAM,oCAAoC,CAAC;AAE1F,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAI1E,MAAM,CAAC,KAAK,UAAU,+BAA+B,CAEnD,EACE,OAAO,EACP,aAAa,GAId;IAED,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC;IAE7D,OAAO,iBAAiB,CAAC,MAAM,CAM7B,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,EAAE;QACtC,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC;QAE/B,MAAM,oBAAoB,GAA0B,MAAM,oCAAoC,CAAC,IAAI,CACjG,IAAI,CACL,CAAC;YACA,OAAO;YACP,gBAAgB;SACjB,CAAC,CAAC;QAEH,MAAM,0BAA0B,GAAG,MAAM,OAAO,CAAC,GAAG,CAClD,oBAAoB,CAAC,GAAG,CAAC,KAAK,EAAE,mBAAmB,EAAE,EAAE;YACrD,MAAM,kBAAkB,GAAG;gBACzB,gBAAgB;gBAChB,OAAO;gBACP,aAAa;aACd,CAAC;YAEF,MAAM,QAAQ,GAAG,MAAM,mBAAmB,CAAC,OAAO,CAAC,mBAAmB,EAAE,kBAAkB,EAAE;gBAC1F,OAAO,EAAE,IAAI;aACd,CAAC,CAAC;YACH,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,cAAc,EAAE,CAAC;YAE9C,OAAO;gBACL,mBAAmB;gBACnB,GAAG,kBAAkB;gBACrB,GAAG,KAAK;aACT,CAAC;QACJ,CAAC,CAAC,CACH,CAAC;QAEF,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAAC;IAC3D,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { Product, ProductConfiguration } from '@unchainedshop/core-products';
|
|
2
2
|
import { User } from '@unchainedshop/core-users';
|
|
3
3
|
import { Modules } from '../modules.js';
|
|
4
|
+
import { Order, OrderDiscount } from '@unchainedshop/core-orders';
|
|
4
5
|
export declare function simulateProductPricingService(this: Modules, pricingContext: {
|
|
5
|
-
product: Product;
|
|
6
|
-
user: User;
|
|
7
|
-
countryCode: string;
|
|
8
6
|
currencyCode: string;
|
|
7
|
+
countryCode: string;
|
|
9
8
|
quantity: number;
|
|
9
|
+
discounts: OrderDiscount[];
|
|
10
|
+
order?: Order;
|
|
11
|
+
product: Product;
|
|
10
12
|
configuration?: ProductConfiguration[];
|
|
11
|
-
|
|
13
|
+
user?: User;
|
|
14
|
+
}): Promise<import("../core-index.js").IProductPricingSheet | null>;
|
|
12
15
|
//# sourceMappingURL=simulateProductPricing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simulateProductPricing.d.ts","sourceRoot":"","sources":["../../src/services/simulateProductPricing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAE7E,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"simulateProductPricing.d.ts","sourceRoot":"","sources":["../../src/services/simulateProductPricing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAE7E,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAElE,wBAAsB,6BAA6B,CACjD,IAAI,EAAE,OAAO,EACb,cAAc,EAAE;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACvC,IAAI,CAAC,EAAE,IAAI,CAAC;CACb,mEAKF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simulateProductPricing.js","sourceRoot":"","sources":["../../src/services/simulateProductPricing.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"simulateProductPricing.js","sourceRoot":"","sources":["../../src/services/simulateProductPricing.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAK1D,MAAM,CAAC,KAAK,UAAU,6BAA6B,CAEjD,cASC;IAED,MAAM,UAAU,GAAG,MAAM,sBAAsB,CAAC,kBAAkB,CAAC,cAAc,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IACtG,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACnD,OAAO,sBAAsB,CAAC,gBAAgB,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;AAC7E,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Order } from '@unchainedshop/core-orders';
|
|
1
2
|
import { Modules } from '../modules.js';
|
|
2
|
-
export declare function updateCalculationService(this: Modules, orderId: string): Promise<
|
|
3
|
+
export declare function updateCalculationService(this: Modules, orderId: string): Promise<Order>;
|
|
3
4
|
//# sourceMappingURL=updateCalculation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateCalculation.d.ts","sourceRoot":"","sources":["../../src/services/updateCalculation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"updateCalculation.d.ts","sourceRoot":"","sources":["../../src/services/updateCalculation.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,EAEN,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAUxC,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,kBA4I5E"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { OrderDiscountTrigger } from '@unchainedshop/core-orders';
|
|
1
|
+
import { OrderDiscountTrigger, } from '@unchainedshop/core-orders';
|
|
2
2
|
import { initCartProvidersService } from './initCartProviders.js';
|
|
3
3
|
import { updateSchedulingService } from './updateScheduling.js';
|
|
4
4
|
import { OrderDiscountDirector, OrderPricingDirector, DeliveryPricingDirector, ProductPricingDirector, PaymentPricingDirector, } from '../directors/index.js';
|
|
5
5
|
export async function updateCalculationService(orderId) {
|
|
6
6
|
let order = await this.orders.findOrder({ orderId });
|
|
7
|
+
if (!order)
|
|
8
|
+
throw new Error('Order not found');
|
|
7
9
|
// Don't recalculate orders, only carts
|
|
8
10
|
if (order.status !== null)
|
|
9
11
|
return order;
|
|
@@ -17,13 +19,17 @@ export async function updateCalculationService(orderId) {
|
|
|
17
19
|
if (!Adapter)
|
|
18
20
|
return null;
|
|
19
21
|
const adapter = await Adapter.actions({
|
|
20
|
-
context: { order, orderDiscount, code: orderDiscount.code, modules: this },
|
|
22
|
+
context: { order: order, orderDiscount, code: orderDiscount.code, modules: this },
|
|
21
23
|
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
let isValid = false;
|
|
25
|
+
if (orderDiscount.trigger === OrderDiscountTrigger.SYSTEM) {
|
|
26
|
+
isValid = await adapter.isValidForSystemTriggering();
|
|
27
|
+
}
|
|
28
|
+
else if (orderDiscount.trigger === OrderDiscountTrigger.USER && orderDiscount.code) {
|
|
29
|
+
isValid = await adapter.isValidForCodeTriggering({
|
|
25
30
|
code: orderDiscount.code,
|
|
26
31
|
});
|
|
32
|
+
}
|
|
27
33
|
if (!isValid) {
|
|
28
34
|
if (orderDiscount.trigger === OrderDiscountTrigger.USER) {
|
|
29
35
|
await adapter.release();
|
|
@@ -36,7 +42,7 @@ export async function updateCalculationService(orderId) {
|
|
|
36
42
|
orderId: order._id,
|
|
37
43
|
});
|
|
38
44
|
const currentDiscountKeys = cleanedDiscounts.map(({ discountKey }) => discountKey);
|
|
39
|
-
const director = await OrderDiscountDirector.actions({ order
|
|
45
|
+
const director = await OrderDiscountDirector.actions({ order }, { modules: this });
|
|
40
46
|
const systemDiscounts = await director.findSystemDiscounts();
|
|
41
47
|
await Promise.all(systemDiscounts
|
|
42
48
|
.filter((key) => currentDiscountKeys.indexOf(key) === -1)
|
|
@@ -54,7 +60,7 @@ export async function updateCalculationService(orderId) {
|
|
|
54
60
|
quantity: orderPosition.quantity,
|
|
55
61
|
item: orderPosition,
|
|
56
62
|
}, { modules: this });
|
|
57
|
-
return this.orders.positions.updateCalculation(orderPosition._id, positionCalculation);
|
|
63
|
+
return (await this.orders.positions.updateCalculation(orderPosition._id, positionCalculation));
|
|
58
64
|
}));
|
|
59
65
|
let orderDelivery = await this.orders.deliveries.findDelivery({
|
|
60
66
|
orderDeliveryId: order.deliveryId,
|
|
@@ -64,7 +70,7 @@ export async function updateCalculationService(orderId) {
|
|
|
64
70
|
currencyCode: order.currencyCode,
|
|
65
71
|
item: orderDelivery,
|
|
66
72
|
}, { modules: this });
|
|
67
|
-
orderDelivery = await this.orders.deliveries.updateCalculation(orderDelivery._id, deliveryCalculation);
|
|
73
|
+
orderDelivery = (await this.orders.deliveries.updateCalculation(orderDelivery._id, deliveryCalculation));
|
|
68
74
|
}
|
|
69
75
|
let orderPayment = await this.orders.payments.findOrderPayment({
|
|
70
76
|
orderPaymentId: order.paymentId,
|
|
@@ -74,7 +80,7 @@ export async function updateCalculationService(orderId) {
|
|
|
74
80
|
currencyCode: order.currencyCode,
|
|
75
81
|
item: orderPayment,
|
|
76
82
|
}, { modules: this });
|
|
77
|
-
orderPayment = await this.orders.payments.updateCalculation(orderPayment._id, paymentCalculation);
|
|
83
|
+
orderPayment = (await this.orders.payments.updateCalculation(orderPayment._id, paymentCalculation));
|
|
78
84
|
}
|
|
79
85
|
orderPositions = await updateSchedulingService.bind(this)({
|
|
80
86
|
order,
|
|
@@ -83,7 +89,7 @@ export async function updateCalculationService(orderId) {
|
|
|
83
89
|
});
|
|
84
90
|
const calculation = await OrderPricingDirector.rebuildCalculation({ currencyCode: order.currencyCode, order, orderPositions, orderDelivery, orderPayment }, { modules: this });
|
|
85
91
|
if (JSON.stringify(order.calculation) !== JSON.stringify(calculation)) {
|
|
86
|
-
order = await this.orders.updateCalculationSheet(orderId, calculation);
|
|
92
|
+
order = (await this.orders.updateCalculationSheet(orderId, calculation));
|
|
87
93
|
}
|
|
88
94
|
/*
|
|
89
95
|
// We have to do initCartProviders after calculation, only then filterSupportedProviders will work correctly and has access to recent pricing
|