@unchainedshop/core 3.0.0-alpha7 → 3.0.0-rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/core-index.d.ts +8 -61
- package/lib/core-index.d.ts.map +1 -1
- package/lib/core-index.js +9 -140
- package/lib/core-index.js.map +1 -1
- package/lib/core-index_BACKUP_57582.d.ts +26 -0
- package/lib/core-index_BACKUP_57582.d.ts.map +1 -0
- package/lib/core-index_BACKUP_57582.js +30 -0
- package/lib/core-index_BACKUP_57582.js.map +1 -0
- package/lib/core-index_BASE_57582.d.ts +74 -0
- package/lib/core-index_BASE_57582.d.ts.map +1 -0
- package/lib/core-index_BASE_57582.js +145 -0
- package/lib/core-index_BASE_57582.js.map +1 -0
- package/lib/core-index_LOCAL_57582.d.ts +26 -0
- package/lib/core-index_LOCAL_57582.d.ts.map +1 -0
- package/lib/core-index_LOCAL_57582.js +31 -0
- package/lib/core-index_LOCAL_57582.js.map +1 -0
- package/lib/core-index_REMOTE_57582.d.ts +74 -0
- package/lib/core-index_REMOTE_57582.d.ts.map +1 -0
- package/lib/core-index_REMOTE_57582.js +146 -0
- package/lib/core-index_REMOTE_57582.js.map +1 -0
- package/lib/directors/BaseDiscountAdapter.d.ts +38 -0
- package/lib/directors/BaseDiscountAdapter.d.ts.map +1 -0
- package/lib/directors/BaseDiscountAdapter.js +48 -0
- package/lib/directors/BaseDiscountAdapter.js.map +1 -0
- package/lib/directors/BaseDiscountDirector.d.ts +12 -0
- package/lib/directors/BaseDiscountDirector.d.ts.map +1 -0
- package/lib/directors/BaseDiscountDirector.js +45 -0
- package/lib/directors/BaseDiscountDirector.js.map +1 -0
- package/lib/directors/BasePricingAdapter.d.ts +39 -0
- package/lib/directors/BasePricingAdapter.d.ts.map +1 -0
- package/lib/directors/BasePricingAdapter.js +25 -0
- package/lib/directors/BasePricingAdapter.js.map +1 -0
- package/lib/directors/BasePricingDirector.d.ts +17 -0
- package/lib/directors/BasePricingDirector.d.ts.map +1 -0
- package/lib/directors/BasePricingDirector.js +70 -0
- package/lib/directors/BasePricingDirector.js.map +1 -0
- package/lib/directors/BasePricingSheet.d.ts +46 -0
- package/lib/directors/BasePricingSheet.d.ts.map +1 -0
- package/lib/directors/BasePricingSheet.js +74 -0
- package/lib/directors/BasePricingSheet.js.map +1 -0
- package/lib/directors/DeliveryAdapter.d.ts +46 -0
- package/lib/directors/DeliveryAdapter.d.ts.map +1 -0
- package/lib/directors/DeliveryAdapter.js +50 -0
- package/lib/directors/DeliveryAdapter.js.map +1 -0
- package/lib/directors/DeliveryDirector.d.ts +15 -0
- package/lib/directors/DeliveryDirector.d.ts.map +1 -0
- package/lib/directors/DeliveryDirector.js +96 -0
- package/lib/directors/DeliveryDirector.js.map +1 -0
- package/lib/directors/DeliveryPricingAdapter.d.ts +49 -0
- package/lib/directors/DeliveryPricingAdapter.d.ts.map +1 -0
- package/lib/directors/DeliveryPricingAdapter.js +25 -0
- package/lib/directors/DeliveryPricingAdapter.js.map +1 -0
- package/lib/directors/DeliveryPricingDirector.d.ts +20 -0
- package/lib/directors/DeliveryPricingDirector.d.ts.map +1 -0
- package/lib/directors/DeliveryPricingDirector.js +50 -0
- package/lib/directors/DeliveryPricingDirector.js.map +1 -0
- package/lib/directors/DeliveryPricingSheet.d.ts +10 -0
- package/lib/directors/DeliveryPricingSheet.d.ts.map +1 -0
- package/lib/directors/DeliveryPricingSheet.js +75 -0
- package/lib/directors/DeliveryPricingSheet.js.map +1 -0
- package/lib/directors/EnrollmentAdapter.d.ts +27 -0
- package/lib/directors/EnrollmentAdapter.d.ts.map +1 -0
- package/lib/directors/EnrollmentAdapter.js +73 -0
- package/lib/directors/EnrollmentAdapter.js.map +1 -0
- package/lib/directors/EnrollmentDirector.d.ts +14 -0
- package/lib/directors/EnrollmentDirector.d.ts.map +1 -0
- package/lib/directors/EnrollmentDirector.js +44 -0
- package/lib/directors/EnrollmentDirector.js.map +1 -0
- package/lib/directors/FilterAdapter.d.ts +54 -0
- package/lib/directors/FilterAdapter.d.ts.map +1 -0
- package/lib/directors/FilterAdapter.js +38 -0
- package/lib/directors/FilterAdapter.js.map +1 -0
- package/lib/directors/FilterDirector.d.ts +40 -0
- package/lib/directors/FilterDirector.d.ts.map +1 -0
- package/lib/directors/FilterDirector.js +173 -0
- package/lib/directors/FilterDirector.js.map +1 -0
- package/lib/directors/MessagingDirector.d.ts +46 -0
- package/lib/directors/MessagingDirector.d.ts.map +1 -0
- package/lib/directors/MessagingDirector.js +10 -0
- package/lib/directors/MessagingDirector.js.map +1 -0
- package/lib/directors/OrderDiscountAdapter.d.ts +3 -0
- package/lib/directors/OrderDiscountAdapter.d.ts.map +1 -0
- package/lib/directors/OrderDiscountAdapter.js +3 -0
- package/lib/directors/OrderDiscountAdapter.js.map +1 -0
- package/lib/directors/OrderDiscountConfiguration.d.ts +6 -0
- package/lib/directors/OrderDiscountConfiguration.d.ts.map +1 -0
- package/lib/directors/OrderDiscountConfiguration.js +2 -0
- package/lib/directors/OrderDiscountConfiguration.js.map +1 -0
- package/lib/directors/OrderDiscountDirector.d.ts +3 -0
- package/lib/directors/OrderDiscountDirector.d.ts.map +1 -0
- package/lib/directors/OrderDiscountDirector.js +3 -0
- package/lib/directors/OrderDiscountDirector.js.map +1 -0
- package/lib/directors/OrderPricingAdapter.d.ts +18 -0
- package/lib/directors/OrderPricingAdapter.d.ts.map +1 -0
- package/lib/directors/OrderPricingAdapter.js +24 -0
- package/lib/directors/OrderPricingAdapter.js.map +1 -0
- package/lib/directors/OrderPricingDirector.d.ts +18 -0
- package/lib/directors/OrderPricingDirector.d.ts.map +1 -0
- package/lib/directors/OrderPricingDirector.js +31 -0
- package/lib/directors/OrderPricingDirector.js.map +1 -0
- package/lib/directors/OrderPricingSheet.d.ts +37 -0
- package/lib/directors/OrderPricingSheet.d.ts.map +1 -0
- package/lib/directors/OrderPricingSheet.js +108 -0
- package/lib/directors/OrderPricingSheet.js.map +1 -0
- package/lib/directors/PaymentAdapter.d.ts +50 -0
- package/lib/directors/PaymentAdapter.d.ts.map +1 -0
- package/lib/directors/PaymentAdapter.js +55 -0
- package/lib/directors/PaymentAdapter.js.map +1 -0
- package/lib/directors/PaymentDirector.d.ts +21 -0
- package/lib/directors/PaymentDirector.d.ts.map +1 -0
- package/lib/directors/PaymentDirector.js +172 -0
- package/lib/directors/PaymentDirector.js.map +1 -0
- package/lib/directors/PaymentPricingAdapter.d.ts +48 -0
- package/lib/directors/PaymentPricingAdapter.d.ts.map +1 -0
- package/lib/directors/PaymentPricingAdapter.js +25 -0
- package/lib/directors/PaymentPricingAdapter.js.map +1 -0
- package/lib/directors/PaymentPricingDirector.d.ts +18 -0
- package/lib/directors/PaymentPricingDirector.d.ts.map +1 -0
- package/lib/directors/PaymentPricingDirector.js +51 -0
- package/lib/directors/PaymentPricingDirector.js.map +1 -0
- package/lib/directors/PaymentPricingSheet.d.ts +9 -0
- package/lib/directors/PaymentPricingSheet.d.ts.map +1 -0
- package/lib/directors/PaymentPricingSheet.js +75 -0
- package/lib/directors/PaymentPricingSheet.js.map +1 -0
- package/lib/directors/ProductDiscountAdapter.d.ts +3 -0
- package/lib/directors/ProductDiscountAdapter.d.ts.map +1 -0
- package/lib/directors/ProductDiscountAdapter.js +3 -0
- package/lib/directors/ProductDiscountAdapter.js.map +1 -0
- package/lib/directors/ProductDiscountConfiguration.d.ts +13 -0
- package/lib/directors/ProductDiscountConfiguration.d.ts.map +1 -0
- package/lib/directors/ProductDiscountConfiguration.js +2 -0
- package/lib/directors/ProductDiscountConfiguration.js.map +1 -0
- package/lib/directors/ProductDiscountDirector.d.ts +3 -0
- package/lib/directors/ProductDiscountDirector.d.ts.map +1 -0
- package/lib/directors/ProductDiscountDirector.js +3 -0
- package/lib/directors/ProductDiscountDirector.js.map +1 -0
- package/lib/directors/ProductPricingAdapter.d.ts +17 -0
- package/lib/directors/ProductPricingAdapter.d.ts.map +1 -0
- package/lib/directors/ProductPricingAdapter.js +24 -0
- package/lib/directors/ProductPricingAdapter.js.map +1 -0
- package/lib/directors/ProductPricingDirector.d.ts +21 -0
- package/lib/directors/ProductPricingDirector.d.ts.map +1 -0
- package/lib/directors/ProductPricingDirector.js +52 -0
- package/lib/directors/ProductPricingDirector.js.map +1 -0
- package/lib/directors/ProductPricingSheet.d.ts +38 -0
- package/lib/directors/ProductPricingSheet.d.ts.map +1 -0
- package/lib/directors/ProductPricingSheet.js +83 -0
- package/lib/directors/ProductPricingSheet.js.map +1 -0
- package/lib/directors/QuotationAdapter.d.ts +28 -0
- package/lib/directors/QuotationAdapter.d.ts.map +1 -0
- package/lib/directors/QuotationAdapter.js +46 -0
- package/lib/directors/QuotationAdapter.js.map +1 -0
- package/lib/directors/QuotationDirector.d.ts +7 -0
- package/lib/directors/QuotationDirector.d.ts.map +1 -0
- package/lib/directors/QuotationDirector.js +84 -0
- package/lib/directors/QuotationDirector.js.map +1 -0
- package/lib/directors/WarehousingAdapter.d.ts +40 -0
- package/lib/directors/WarehousingAdapter.d.ts.map +1 -0
- package/lib/directors/WarehousingAdapter.js +32 -0
- package/lib/directors/WarehousingAdapter.js.map +1 -0
- package/lib/directors/WarehousingDirector.d.ts +38 -0
- package/lib/directors/WarehousingDirector.d.ts.map +1 -0
- package/lib/directors/WarehousingDirector.js +169 -0
- package/lib/directors/WarehousingDirector.js.map +1 -0
- package/lib/directors/WorkerAdapter.d.ts +17 -0
- package/lib/directors/WorkerAdapter.d.ts.map +1 -0
- package/lib/directors/WorkerAdapter.js +11 -0
- package/lib/directors/WorkerAdapter.js.map +1 -0
- package/lib/directors/WorkerDirector.d.ts +26 -0
- package/lib/directors/WorkerDirector.d.ts.map +1 -0
- package/lib/directors/WorkerDirector.js +102 -0
- package/lib/directors/WorkerDirector.js.map +1 -0
- package/lib/directors/index.d.ts +39 -0
- package/lib/directors/index.d.ts.map +1 -0
- package/lib/directors/index.js +39 -0
- package/lib/directors/index.js.map +1 -0
- package/lib/modules.d.ts +61 -0
- package/lib/modules.d.ts.map +1 -0
- package/lib/modules.js +132 -0
- package/lib/modules.js.map +1 -0
- package/lib/services/activateEnrollment.d.ts +4 -0
- package/lib/services/activateEnrollment.d.ts.map +1 -0
- package/lib/services/activateEnrollment.js +25 -0
- package/lib/services/activateEnrollment.js.map +1 -0
- package/lib/services/calculateDiscountTotal.d.ts +7 -0
- package/lib/services/calculateDiscountTotal.d.ts.map +1 -0
- package/lib/services/calculateDiscountTotal.js +49 -0
- package/lib/services/calculateDiscountTotal.js.map +1 -0
- package/lib/services/checkoutOrder.d.ts +9 -0
- package/lib/services/checkoutOrder.d.ts.map +1 -0
- package/lib/services/checkoutOrder.js +28 -0
- package/lib/services/checkoutOrder.js.map +1 -0
- package/lib/services/confirmOrder.d.ts +9 -0
- package/lib/services/confirmOrder.d.ts.map +1 -0
- package/lib/services/confirmOrder.js +17 -0
- package/lib/services/confirmOrder.js.map +1 -0
- package/lib/services/createDownloadStream.d.ts +5 -0
- package/lib/services/createDownloadStream.d.ts.map +1 -0
- package/lib/services/createDownloadStream.js +8 -0
- package/lib/services/createDownloadStream.js.map +1 -0
- package/lib/services/createDownloadStreamService.d.ts +11 -0
- package/lib/services/createDownloadStreamService.d.ts.map +1 -0
- package/lib/services/createDownloadStreamService.js +9 -0
- package/lib/services/createDownloadStreamService.js.map +1 -0
- package/lib/services/createEnrollmentFromCheckout.d.ts +15 -0
- package/lib/services/createEnrollmentFromCheckout.d.ts.map +1 -0
- package/lib/services/createEnrollmentFromCheckout.js +40 -0
- package/lib/services/createEnrollmentFromCheckout.js.map +1 -0
- package/lib/services/createManualOrderDiscount.d.ts +7 -0
- package/lib/services/createManualOrderDiscount.d.ts.map +1 -0
- package/lib/services/createManualOrderDiscount.js +47 -0
- package/lib/services/createManualOrderDiscount.js.map +1 -0
- package/lib/services/createSignedURL.d.ts +8 -0
- package/lib/services/createSignedURL.d.ts.map +1 -0
- package/lib/services/createSignedURL.js +15 -0
- package/lib/services/createSignedURL.js.map +1 -0
- package/lib/services/createSignedURLService.d.ts +13 -0
- package/lib/services/createSignedURLService.d.ts.map +1 -0
- package/lib/services/createSignedURLService.js +14 -0
- package/lib/services/createSignedURLService.js.map +1 -0
- package/lib/services/deleteUser.d.ts +5 -0
- package/lib/services/deleteUser.d.ts.map +1 -0
- package/lib/services/deleteUser.js +26 -0
- package/lib/services/deleteUser.js.map +1 -0
- package/lib/services/deleteUserCartService.d.ts +6 -0
- package/lib/services/deleteUserCartService.d.ts.map +1 -0
- package/lib/services/deleteUserCartService.js +20 -0
- package/lib/services/deleteUserCartService.js.map +1 -0
- package/lib/services/deleteUserCarts.d.ts +5 -0
- package/lib/services/deleteUserCarts.d.ts.map +1 -0
- package/lib/services/deleteUserCarts.js +18 -0
- package/lib/services/deleteUserCarts.js.map +1 -0
- package/lib/services/deleteUserCartsService.d.ts +5 -0
- package/lib/services/deleteUserCartsService.d.ts.map +1 -0
- package/lib/services/deleteUserCartsService.js +18 -0
- package/lib/services/deleteUserCartsService.js.map +1 -0
- package/lib/services/discountedEntities.d.ts +5 -0
- package/lib/services/discountedEntities.d.ts.map +1 -0
- package/lib/services/discountedEntities.js +61 -0
- package/lib/services/discountedEntities.js.map +1 -0
- package/lib/services/ercMetadata.d.ts +7 -0
- package/lib/services/ercMetadata.d.ts.map +1 -0
- package/lib/services/ercMetadata.js +22 -0
- package/lib/services/ercMetadata.js.map +1 -0
- package/lib/services/fullfillQuotation.d.ts +4 -0
- package/lib/services/fullfillQuotation.d.ts.map +1 -0
- package/lib/services/fullfillQuotation.js +12 -0
- package/lib/services/fullfillQuotation.js.map +1 -0
- package/lib/services/index.d.ts +110 -0
- package/lib/services/index.d.ts.map +1 -0
- package/lib/services/index.js +124 -0
- package/lib/services/index.js.map +1 -0
- package/lib/services/index_BACKUP_58089.d.ts +246 -0
- package/lib/services/index_BACKUP_58089.d.ts.map +1 -0
- package/lib/services/index_BACKUP_58089.js +103 -0
- package/lib/services/index_BACKUP_58089.js.map +1 -0
- package/lib/services/index_BASE_58089.d.ts +31 -0
- package/lib/services/index_BASE_58089.d.ts.map +1 -0
- package/lib/services/index_BASE_58089.js +42 -0
- package/lib/services/index_BASE_58089.js.map +1 -0
- package/lib/services/index_LOCAL_58089.d.ts +246 -0
- package/lib/services/index_LOCAL_58089.d.ts.map +1 -0
- package/lib/services/index_LOCAL_58089.js +103 -0
- package/lib/services/index_LOCAL_58089.js.map +1 -0
- package/lib/services/index_REMOTE_58089.d.ts +34 -0
- package/lib/services/index_REMOTE_58089.d.ts.map +1 -0
- package/lib/services/index_REMOTE_58089.js +44 -0
- package/lib/services/index_REMOTE_58089.js.map +1 -0
- package/lib/services/initCartProviders.d.ts +4 -0
- package/lib/services/initCartProviders.d.ts.map +1 -0
- package/lib/services/initCartProviders.js +55 -0
- package/lib/services/initCartProviders.js.map +1 -0
- package/lib/services/initializeEnrollment.d.ts +7 -0
- package/lib/services/initializeEnrollment.d.ts.map +1 -0
- package/lib/services/initializeEnrollment.js +28 -0
- package/lib/services/initializeEnrollment.js.map +1 -0
- package/lib/services/invalidateFilterCache.d.ts +3 -0
- package/lib/services/invalidateFilterCache.d.ts.map +1 -0
- package/lib/services/invalidateFilterCache.js +12 -0
- package/lib/services/invalidateFilterCache.js.map +1 -0
- package/lib/services/linkFileService.d.ts +7 -0
- package/lib/services/linkFileService.d.ts.map +1 -0
- package/lib/services/linkFileService.js +18 -0
- package/lib/services/linkFileService.js.map +1 -0
- package/lib/services/loadFilterOptions.d.ts +14 -0
- package/lib/services/loadFilterOptions.d.ts.map +1 -0
- package/lib/services/loadFilterOptions.js +30 -0
- package/lib/services/loadFilterOptions.js.map +1 -0
- package/lib/services/loadFilters.d.ts +14 -0
- package/lib/services/loadFilters.d.ts.map +1 -0
- package/lib/services/loadFilters.js +36 -0
- package/lib/services/loadFilters.js.map +1 -0
- package/lib/services/migrateBookmarks.d.ts +8 -0
- package/lib/services/migrateBookmarks.d.ts.map +1 -0
- package/lib/services/migrateBookmarks.js +26 -0
- package/lib/services/migrateBookmarks.js.map +1 -0
- package/lib/services/migrateBookmarksService.d.ts +13 -0
- package/lib/services/migrateBookmarksService.d.ts.map +1 -0
- package/lib/services/migrateBookmarksService.js +26 -0
- package/lib/services/migrateBookmarksService.js.map +1 -0
- package/lib/services/migrateOrderCart.d.ts +8 -0
- package/lib/services/migrateOrderCart.d.ts.map +1 -0
- package/lib/services/migrateOrderCart.js +32 -0
- package/lib/services/migrateOrderCart.js.map +1 -0
- package/lib/services/migrateOrderCartService.d.ts +23 -0
- package/lib/services/migrateOrderCartService.d.ts.map +1 -0
- package/lib/services/migrateOrderCartService.js +32 -0
- package/lib/services/migrateOrderCartService.js.map +1 -0
- package/lib/services/migrateUserData.d.ts +2 -0
- package/lib/services/migrateUserData.d.ts.map +1 -0
- package/lib/services/migrateUserData.js +20 -0
- package/lib/services/migrateUserData.js.map +1 -0
- package/lib/services/migrateUserDataService.d.ts +19 -0
- package/lib/services/migrateUserDataService.d.ts.map +1 -0
- package/lib/services/migrateUserDataService.js +18 -0
- package/lib/services/migrateUserDataService.js.map +1 -0
- package/lib/services/nextUserCart.d.ts +9 -0
- package/lib/services/nextUserCart.d.ts.map +1 -0
- package/lib/services/nextUserCart.js +34 -0
- package/lib/services/nextUserCart.js.map +1 -0
- package/lib/services/nextUserCartService.d.ts +22 -0
- package/lib/services/nextUserCartService.d.ts.map +1 -0
- package/lib/services/nextUserCartService.js +35 -0
- package/lib/services/nextUserCartService.js.map +1 -0
- package/lib/services/processEnrollment.d.ts +4 -0
- package/lib/services/processEnrollment.d.ts.map +1 -0
- package/lib/services/processEnrollment.js +33 -0
- package/lib/services/processEnrollment.js.map +1 -0
- package/lib/services/processOrder.d.ts +9 -0
- package/lib/services/processOrder.d.ts.map +1 -0
- package/lib/services/processOrder.js +161 -0
- package/lib/services/processOrder.js.map +1 -0
- package/lib/services/processQuotation.d.ts +6 -0
- package/lib/services/processQuotation.d.ts.map +1 -0
- package/lib/services/processQuotation.js +60 -0
- package/lib/services/processQuotation.js.map +1 -0
- package/lib/services/proposeQuotation.d.ts +6 -0
- package/lib/services/proposeQuotation.d.ts.map +1 -0
- package/lib/services/proposeQuotation.js +12 -0
- package/lib/services/proposeQuotation.js.map +1 -0
- package/lib/services/registerPaymentCredentials.d.ts +5 -0
- package/lib/services/registerPaymentCredentials.d.ts.map +1 -0
- package/lib/services/registerPaymentCredentials.js +21 -0
- package/lib/services/registerPaymentCredentials.js.map +1 -0
- package/lib/services/rejectOrder.d.ts +9 -0
- package/lib/services/rejectOrder.d.ts.map +1 -0
- package/lib/services/rejectOrder.js +17 -0
- package/lib/services/rejectOrder.js.map +1 -0
- package/lib/services/rejectQuotation.d.ts +6 -0
- package/lib/services/rejectQuotation.d.ts.map +1 -0
- package/lib/services/rejectQuotation.js +12 -0
- package/lib/services/rejectQuotation.js.map +1 -0
- package/lib/services/removeFiles.d.ts +5 -0
- package/lib/services/removeFiles.d.ts.map +1 -0
- package/lib/services/removeFiles.js +19 -0
- package/lib/services/removeFiles.js.map +1 -0
- package/lib/services/removeFilesService.d.ts +10 -0
- package/lib/services/removeFilesService.d.ts.map +1 -0
- package/lib/services/removeFilesService.js +20 -0
- package/lib/services/removeFilesService.js.map +1 -0
- package/lib/services/removeProduct.d.ts +5 -0
- package/lib/services/removeProduct.d.ts.map +1 -0
- package/lib/services/removeProduct.js +26 -0
- package/lib/services/removeProduct.js.map +1 -0
- package/lib/services/removeProductService.d.ts +20 -0
- package/lib/services/removeProductService.d.ts.map +1 -0
- package/lib/services/removeProductService.js +27 -0
- package/lib/services/removeProductService.js.map +1 -0
- package/lib/services/searchAssortments.d.ts +19 -0
- package/lib/services/searchAssortments.d.ts.map +1 -0
- package/lib/services/searchAssortments.js +33 -0
- package/lib/services/searchAssortments.js.map +1 -0
- package/lib/services/searchProducts.d.ts +16 -0
- package/lib/services/searchProducts.d.ts.map +1 -0
- package/lib/services/searchProducts.js +41 -0
- package/lib/services/searchProducts.js.map +1 -0
- package/lib/services/supportedDeliveryProviders.d.ts +5 -0
- package/lib/services/supportedDeliveryProviders.d.ts.map +1 -0
- package/lib/services/supportedDeliveryProviders.js +14 -0
- package/lib/services/supportedDeliveryProviders.js.map +1 -0
- package/lib/services/supportedPaymentProviders.d.ts +5 -0
- package/lib/services/supportedPaymentProviders.d.ts.map +1 -0
- package/lib/services/supportedPaymentProviders.js +14 -0
- package/lib/services/supportedPaymentProviders.js.map +1 -0
- package/lib/services/supportedWarehousingProviders.d.ts +5 -0
- package/lib/services/supportedWarehousingProviders.d.ts.map +1 -0
- package/lib/services/supportedWarehousingProviders.js +10 -0
- package/lib/services/supportedWarehousingProviders.js.map +1 -0
- package/lib/services/terminateEnrollment.d.ts +3 -0
- package/lib/services/terminateEnrollment.d.ts.map +1 -0
- package/lib/services/terminateEnrollment.js +25 -0
- package/lib/services/terminateEnrollment.js.map +1 -0
- package/lib/services/updateCalculation.d.ts +3 -0
- package/lib/services/updateCalculation.d.ts.map +1 -0
- package/lib/services/updateCalculation.js +101 -0
- package/lib/services/updateCalculation.js.map +1 -0
- package/lib/services/updateCalculationService.d.ts +17 -0
- package/lib/services/updateCalculationService.d.ts.map +1 -0
- package/lib/services/updateCalculationService.js +68 -0
- package/lib/services/updateCalculationService.js.map +1 -0
- package/lib/services/updateScheduling.d.ts +8 -0
- package/lib/services/updateScheduling.d.ts.map +1 -0
- package/lib/services/updateScheduling.js +42 -0
- package/lib/services/updateScheduling.js.map +1 -0
- package/lib/services/updateUserAvatarAfterUpload.d.ts +6 -0
- package/lib/services/updateUserAvatarAfterUpload.d.ts.map +1 -0
- package/lib/services/updateUserAvatarAfterUpload.js +25 -0
- package/lib/services/updateUserAvatarAfterUpload.js.map +1 -0
- package/lib/services/updateUserAvatarAfterUploadService.d.ts +18 -0
- package/lib/services/updateUserAvatarAfterUploadService.d.ts.map +1 -0
- package/lib/services/updateUserAvatarAfterUploadService.js +25 -0
- package/lib/services/updateUserAvatarAfterUploadService.js.map +1 -0
- package/lib/services/uploadFileFromStream.d.ts +8 -0
- package/lib/services/uploadFileFromStream.d.ts.map +1 -0
- package/lib/services/uploadFileFromStream.js +11 -0
- package/lib/services/uploadFileFromStream.js.map +1 -0
- package/lib/services/uploadFileFromStreamService.d.ts +12 -0
- package/lib/services/uploadFileFromStreamService.d.ts.map +1 -0
- package/lib/services/uploadFileFromStreamService.js +10 -0
- package/lib/services/uploadFileFromStreamService.js.map +1 -0
- package/lib/services/uploadFileFromURL.d.ts +13 -0
- package/lib/services/uploadFileFromURL.d.ts.map +1 -0
- package/lib/services/uploadFileFromURL.js +11 -0
- package/lib/services/uploadFileFromURL.js.map +1 -0
- package/lib/services/uploadFileFromURLService.d.ts +17 -0
- package/lib/services/uploadFileFromURLService.d.ts.map +1 -0
- package/lib/services/uploadFileFromURLService.js +10 -0
- package/lib/services/uploadFileFromURLService.js.map +1 -0
- package/lib/services/validateOrder.d.ts +4 -0
- package/lib/services/validateOrder.d.ts.map +1 -0
- package/lib/services/validateOrder.js +45 -0
- package/lib/services/validateOrder.js.map +1 -0
- package/lib/services/verifyQuotation.d.ts +6 -0
- package/lib/services/verifyQuotation.d.ts.map +1 -0
- package/lib/services/verifyQuotation.js +12 -0
- package/lib/services/verifyQuotation.js.map +1 -0
- package/package.json +28 -28
- package/src/core-index.ts +14 -241
- package/src/directors/BaseDiscountAdapter.test.ts +49 -0
- package/src/directors/BaseDiscountAdapter.ts +91 -0
- package/src/directors/BaseDiscountDirector.ts +72 -0
- package/src/directors/BasePricingAdapter.ts +82 -0
- package/src/directors/BasePricingDirector.ts +136 -0
- package/src/directors/BasePricingSheet.test.ts +43 -0
- package/src/directors/BasePricingSheet.ts +140 -0
- package/src/directors/DeliveryAdapter.ts +110 -0
- package/src/directors/DeliveryDirector.ts +135 -0
- package/src/directors/DeliveryPricingAdapter.ts +87 -0
- package/src/directors/DeliveryPricingDirector.ts +92 -0
- package/src/directors/DeliveryPricingSheet.ts +86 -0
- package/src/directors/EnrollmentAdapter.ts +109 -0
- package/src/directors/EnrollmentDirector.ts +70 -0
- package/src/directors/FilterAdapter.ts +103 -0
- package/src/directors/FilterDirector.ts +309 -0
- package/src/directors/MessagingDirector.test.ts +5 -0
- package/src/directors/MessagingDirector.ts +59 -0
- package/src/directors/OrderDiscountAdapter.ts +10 -0
- package/src/directors/OrderDiscountConfiguration.ts +5 -0
- package/src/directors/OrderDiscountDirector.ts +6 -0
- package/src/directors/OrderPricingAdapter.ts +63 -0
- package/src/directors/OrderPricingDirector.ts +74 -0
- package/src/directors/OrderPricingSheet.ts +147 -0
- package/src/directors/PaymentAdapter.ts +118 -0
- package/src/directors/PaymentDirector.ts +275 -0
- package/src/directors/PaymentPricingAdapter.ts +86 -0
- package/src/directors/PaymentPricingDirector.ts +94 -0
- package/src/directors/PaymentPricingSheet.ts +91 -0
- package/src/directors/ProductDiscountAdapter.ts +10 -0
- package/src/directors/ProductDiscountConfiguration.ts +18 -0
- package/src/directors/ProductDiscountDirector.ts +5 -0
- package/src/directors/ProductPricingAdapter.ts +56 -0
- package/src/directors/ProductPricingDirector.ts +100 -0
- package/src/directors/ProductPricingSheet.test.ts +129 -0
- package/src/directors/ProductPricingSheet.ts +127 -0
- package/src/directors/QuotationAdapter.ts +86 -0
- package/src/directors/QuotationDirector.ts +105 -0
- package/src/directors/WarehousingAdapter.ts +83 -0
- package/src/directors/WarehousingDirector.ts +235 -0
- package/src/directors/WorkerAdapter.ts +30 -0
- package/src/directors/WorkerDirector.ts +154 -0
- package/src/directors/index.ts +49 -0
- package/src/directors/periodForReferenceDate.test.ts +23 -0
- package/src/modules.ts +215 -0
- package/src/services/activateEnrollment.ts +30 -0
- package/src/services/calculateDiscountTotal.ts +71 -0
- package/src/services/checkoutOrder.ts +43 -0
- package/src/services/confirmOrder.ts +26 -0
- package/src/services/createDownloadStream.ts +16 -0
- package/src/services/createEnrollmentFromCheckout.ts +66 -0
- package/src/services/createManualOrderDiscount.ts +56 -0
- package/src/services/createSignedURL.ts +20 -0
- package/src/services/deleteUser.ts +33 -0
- package/src/services/discountedEntities.ts +81 -0
- package/src/services/ercMetadata.ts +33 -0
- package/src/services/fullfillQuotation.ts +14 -0
- package/src/services/index.ts +154 -0
- package/src/services/initCartProviders.ts +86 -0
- package/src/services/initializeEnrollment.ts +38 -0
- package/src/services/invalidateFilterCache.ts +16 -0
- package/src/services/linkFileService.ts +22 -0
- package/src/services/loadFilterOptions.ts +50 -0
- package/src/services/loadFilters.ts +52 -0
- package/src/services/migrateBookmarks.ts +39 -0
- package/src/services/migrateOrderCart.ts +52 -0
- package/src/services/migrateUserData.ts +22 -0
- package/src/services/nextUserCart.ts +52 -0
- package/src/services/processEnrollment.ts +37 -0
- package/src/services/processOrder.ts +241 -0
- package/src/services/processQuotation.ts +75 -0
- package/src/services/proposeQuotation.ts +18 -0
- package/src/services/registerPaymentCredentials.ts +30 -0
- package/src/services/rejectOrder.ts +26 -0
- package/src/services/rejectQuotation.ts +18 -0
- package/src/services/removeFiles.ts +25 -0
- package/src/services/removeProduct.ts +34 -0
- package/src/services/searchAssortments.ts +58 -0
- package/src/services/searchProducts.ts +73 -0
- package/src/services/supportedDeliveryProviders.ts +24 -0
- package/src/services/supportedPaymentProviders.ts +25 -0
- package/src/services/supportedWarehousingProviders.ts +18 -0
- package/src/services/terminateEnrollment.ts +29 -0
- package/src/services/updateCalculation.ts +143 -0
- package/src/services/updateScheduling.ts +64 -0
- package/src/services/updateUserAvatarAfterUpload.ts +30 -0
- package/src/services/uploadFileFromStream.ts +15 -0
- package/src/services/uploadFileFromURL.ts +29 -0
- package/src/services/validateOrder.ts +53 -0
- package/src/services/verifyQuotation.ts +18 -0
- package/tsconfig.json +5 -7
- package/src/types.ts +0 -7
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Order,
|
|
3
|
+
OrderDelivery,
|
|
4
|
+
OrderDeliveryStatus,
|
|
5
|
+
OrderPayment,
|
|
6
|
+
OrderPaymentStatus,
|
|
7
|
+
OrderStatus,
|
|
8
|
+
} from '@unchainedshop/core-orders';
|
|
9
|
+
import { Modules } from '../modules.js';
|
|
10
|
+
import { createEnrollmentFromCheckoutService } from './createEnrollmentFromCheckout.js';
|
|
11
|
+
import { ProductTypes } from '@unchainedshop/core-products';
|
|
12
|
+
import { WarehousingProviderType } from '@unchainedshop/core-warehousing';
|
|
13
|
+
import { WarehousingDirector, DeliveryDirector, PaymentDirector } from '../directors/index.js';
|
|
14
|
+
import { fullfillQuotationService } from './fullfillQuotation.js';
|
|
15
|
+
|
|
16
|
+
const isAutoConfirmationEnabled = async (
|
|
17
|
+
{
|
|
18
|
+
orderPayment,
|
|
19
|
+
orderDelivery,
|
|
20
|
+
}: {
|
|
21
|
+
orderPayment: OrderPayment;
|
|
22
|
+
orderDelivery: OrderDelivery;
|
|
23
|
+
},
|
|
24
|
+
modules: Modules,
|
|
25
|
+
) => {
|
|
26
|
+
if (orderPayment.status !== OrderPaymentStatus.PAID) {
|
|
27
|
+
const provider = await modules.payment.paymentProviders.findProvider({
|
|
28
|
+
paymentProviderId: orderPayment.paymentProviderId,
|
|
29
|
+
});
|
|
30
|
+
const actions = await PaymentDirector.actions(provider, {}, { modules });
|
|
31
|
+
if (!actions.isPayLaterAllowed()) return false;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (orderDelivery.status !== OrderDeliveryStatus.DELIVERED) {
|
|
35
|
+
const deliveryProvider = await modules.delivery.findProvider({
|
|
36
|
+
deliveryProviderId: orderDelivery.deliveryProviderId,
|
|
37
|
+
});
|
|
38
|
+
const director = await DeliveryDirector.actions(deliveryProvider, {}, { modules });
|
|
39
|
+
if (!director.isAutoReleaseAllowed()) return false;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return true;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const findNextStatus = async (
|
|
46
|
+
status: OrderStatus | null,
|
|
47
|
+
order: Order,
|
|
48
|
+
modules: Modules,
|
|
49
|
+
): Promise<OrderStatus | null> => {
|
|
50
|
+
if (status === null) {
|
|
51
|
+
return OrderStatus.PENDING;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (status === OrderStatus.FULLFILLED || status === OrderStatus.REJECTED) {
|
|
55
|
+
// Final!
|
|
56
|
+
return status;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const orderPayment = await modules.orders.payments.findOrderPayment({
|
|
60
|
+
orderPaymentId: order.paymentId,
|
|
61
|
+
});
|
|
62
|
+
if (!orderPayment) return status;
|
|
63
|
+
|
|
64
|
+
const orderDelivery = await modules.orders.deliveries.findDelivery({
|
|
65
|
+
orderDeliveryId: order.deliveryId,
|
|
66
|
+
});
|
|
67
|
+
if (!orderDelivery) return status;
|
|
68
|
+
|
|
69
|
+
// Ok, we have a payment and a delivery and the correct status,
|
|
70
|
+
// let's check if we can auto-confirm or auto-fulfill
|
|
71
|
+
if (status === OrderStatus.PENDING) {
|
|
72
|
+
if (await isAutoConfirmationEnabled({ orderPayment, orderDelivery }, modules)) {
|
|
73
|
+
return OrderStatus.CONFIRMED;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (status === OrderStatus.CONFIRMED) {
|
|
77
|
+
const readyForFullfillment =
|
|
78
|
+
orderDelivery.status === OrderDeliveryStatus.DELIVERED &&
|
|
79
|
+
orderPayment.status === OrderPaymentStatus.PAID;
|
|
80
|
+
if (readyForFullfillment) {
|
|
81
|
+
return OrderStatus.FULLFILLED;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return status;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export async function processOrderService(
|
|
89
|
+
this: Modules,
|
|
90
|
+
initialOrder: Order,
|
|
91
|
+
orderTransactionContext: {
|
|
92
|
+
paymentContext?: any;
|
|
93
|
+
deliveryContext?: any;
|
|
94
|
+
comment?: string;
|
|
95
|
+
nextStatus?: OrderStatus;
|
|
96
|
+
},
|
|
97
|
+
) {
|
|
98
|
+
const {
|
|
99
|
+
paymentContext,
|
|
100
|
+
deliveryContext,
|
|
101
|
+
nextStatus: forceNextStatus,
|
|
102
|
+
comment,
|
|
103
|
+
} = orderTransactionContext;
|
|
104
|
+
|
|
105
|
+
const orderId = initialOrder._id;
|
|
106
|
+
let order = initialOrder;
|
|
107
|
+
let nextStatus = forceNextStatus || (await findNextStatus(initialOrder.status, order, this));
|
|
108
|
+
|
|
109
|
+
if (nextStatus === OrderStatus.PENDING) {
|
|
110
|
+
// auto charge during transition to pending
|
|
111
|
+
const orderPayment = await this.orders.payments.findOrderPayment({
|
|
112
|
+
orderPaymentId: order.paymentId,
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
await PaymentDirector.chargeOrderPayment(
|
|
116
|
+
orderPayment,
|
|
117
|
+
{ userId: order.userId, transactionContext: paymentContext },
|
|
118
|
+
{ modules: this },
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
nextStatus = await findNextStatus(nextStatus, order, this);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (nextStatus === OrderStatus.REJECTED) {
|
|
125
|
+
// auto cancel during transition to rejected
|
|
126
|
+
const orderPayment = await this.orders.payments.findOrderPayment({
|
|
127
|
+
orderPaymentId: order.paymentId,
|
|
128
|
+
});
|
|
129
|
+
await PaymentDirector.cancelOrderPayment(
|
|
130
|
+
orderPayment,
|
|
131
|
+
{ userId: order.userId, transactionContext: paymentContext },
|
|
132
|
+
{ modules: this },
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (nextStatus === OrderStatus.CONFIRMED) {
|
|
137
|
+
// confirm pre-authorized payments
|
|
138
|
+
const orderPayment = await this.orders.payments.findOrderPayment({
|
|
139
|
+
orderPaymentId: order.paymentId,
|
|
140
|
+
});
|
|
141
|
+
await PaymentDirector.confirmOrderPayment(
|
|
142
|
+
orderPayment,
|
|
143
|
+
{ userId: order.userId, transactionContext: paymentContext },
|
|
144
|
+
{ modules: this },
|
|
145
|
+
);
|
|
146
|
+
if (order.status !== OrderStatus.CONFIRMED) {
|
|
147
|
+
// we have to stop here shortly to complete the confirmation
|
|
148
|
+
// before auto delivery is started, else we have no chance to create
|
|
149
|
+
// numbers that are needed for delivery
|
|
150
|
+
order = await this.orders.updateStatus(orderId, {
|
|
151
|
+
status: OrderStatus.CONFIRMED,
|
|
152
|
+
info: comment,
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
const orderDelivery = await this.orders.deliveries.findDelivery({
|
|
156
|
+
orderDeliveryId: order.deliveryId,
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
await DeliveryDirector.sendOrderDelivery(orderDelivery, deliveryContext, { modules: this });
|
|
160
|
+
|
|
161
|
+
const orderPositions = await this.orders.positions.findOrderPositions({ orderId });
|
|
162
|
+
const mappedProductOrderPositions = await Promise.all(
|
|
163
|
+
orderPositions.map(async (orderPosition) => {
|
|
164
|
+
const product = await this.products.findProduct({
|
|
165
|
+
productId: orderPosition.productId,
|
|
166
|
+
});
|
|
167
|
+
return {
|
|
168
|
+
orderPosition,
|
|
169
|
+
product,
|
|
170
|
+
};
|
|
171
|
+
}),
|
|
172
|
+
);
|
|
173
|
+
const tokenizedItems = mappedProductOrderPositions.filter(
|
|
174
|
+
(item) => item.product?.type === ProductTypes.TokenizedProduct,
|
|
175
|
+
);
|
|
176
|
+
if (tokenizedItems.length > 0) {
|
|
177
|
+
// Give virtual warehouse a chance to instantiate new virtual objects
|
|
178
|
+
const virtualProviders = await this.warehousing.findProviders({
|
|
179
|
+
type: WarehousingProviderType.VIRTUAL,
|
|
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 chainTokenId
|
|
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
|
+
);
|
|
224
|
+
await Promise.all(
|
|
225
|
+
quotationItems.map(async ({ orderPosition }) => {
|
|
226
|
+
const quotation = await this.quotations.findQuotation({
|
|
227
|
+
quotationId: orderPosition.quotationId,
|
|
228
|
+
});
|
|
229
|
+
await fullfillQuotationService.bind(this)(quotation, {
|
|
230
|
+
orderId,
|
|
231
|
+
orderPositionId: orderPosition._id,
|
|
232
|
+
});
|
|
233
|
+
}),
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
nextStatus = await findNextStatus(nextStatus, order, this);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
return this.orders.updateStatus(order._id, { status: nextStatus, info: comment });
|
|
241
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Quotation, QuotationStatus } from '@unchainedshop/core-quotations';
|
|
2
|
+
import { Modules } from '../modules.js';
|
|
3
|
+
import { QuotationDirector } from '../core-index.js';
|
|
4
|
+
|
|
5
|
+
const findNextStatus = async (quotation: Quotation, modules: Modules): Promise<QuotationStatus> => {
|
|
6
|
+
let status = quotation.status as QuotationStatus;
|
|
7
|
+
const director = await QuotationDirector.actions({ quotation }, { modules });
|
|
8
|
+
|
|
9
|
+
if (status === QuotationStatus.REQUESTED) {
|
|
10
|
+
if (!(await director.isManualRequestVerificationRequired())) {
|
|
11
|
+
status = QuotationStatus.PROCESSING;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
if (status === QuotationStatus.PROCESSING) {
|
|
15
|
+
if (!(await director.isManualProposalRequired())) {
|
|
16
|
+
status = QuotationStatus.PROPOSED;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return status;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export async function processQuotationService(
|
|
23
|
+
this: Modules,
|
|
24
|
+
initialQuotation: Quotation,
|
|
25
|
+
params: { quotationContext?: any },
|
|
26
|
+
) {
|
|
27
|
+
const quotationId = initialQuotation._id;
|
|
28
|
+
let quotation = initialQuotation;
|
|
29
|
+
let nextStatus = await findNextStatus(quotation, this);
|
|
30
|
+
const director = await QuotationDirector.actions({ quotation }, { modules: this });
|
|
31
|
+
|
|
32
|
+
if (quotation.status === QuotationStatus.REQUESTED && nextStatus !== QuotationStatus.REQUESTED) {
|
|
33
|
+
await director.submitRequest(params.quotationContext);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
quotation = await this.quotations.findQuotation({ quotationId });
|
|
37
|
+
nextStatus = await findNextStatus(quotation, this);
|
|
38
|
+
if (nextStatus !== QuotationStatus.PROCESSING) {
|
|
39
|
+
await director.verifyRequest(params.quotationContext);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
quotation = await this.quotations.findQuotation({ quotationId });
|
|
43
|
+
nextStatus = await findNextStatus(quotation, this);
|
|
44
|
+
if (nextStatus === QuotationStatus.REJECTED) {
|
|
45
|
+
await director.rejectRequest(params.quotationContext);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
quotation = await this.quotations.findQuotation({ quotationId });
|
|
49
|
+
nextStatus = await findNextStatus(quotation, this);
|
|
50
|
+
if (nextStatus === QuotationStatus.PROPOSED) {
|
|
51
|
+
const proposal = await director.quote();
|
|
52
|
+
quotation = await this.quotations.updateProposal(quotation._id, proposal);
|
|
53
|
+
nextStatus = await findNextStatus(quotation, this);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const updatedQuotation = await this.quotations.updateStatus(quotation._id, {
|
|
57
|
+
status: nextStatus,
|
|
58
|
+
info: 'quotation processed',
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const user = await this.users.findUserById(updatedQuotation.userId);
|
|
62
|
+
const locale = this.users.userLocale(user);
|
|
63
|
+
|
|
64
|
+
await this.worker.addWork({
|
|
65
|
+
type: 'MESSAGE',
|
|
66
|
+
retries: 0,
|
|
67
|
+
input: {
|
|
68
|
+
locale,
|
|
69
|
+
template: 'QUOTATION_STATUS',
|
|
70
|
+
quotationId: updatedQuotation._id,
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
return updatedQuotation;
|
|
75
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
});
|
|
16
|
+
|
|
17
|
+
return processQuotationService.bind(this)(updatedQuotation, { quotationContext });
|
|
18
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { PaymentCredentials } from '@unchainedshop/core-payment';
|
|
2
|
+
import { PaymentContext } from '../directors/PaymentAdapter.js';
|
|
3
|
+
import { PaymentDirector } from '../directors/PaymentDirector.js';
|
|
4
|
+
import { Modules } from '../modules.js';
|
|
5
|
+
|
|
6
|
+
export async function registerPaymentCredentialsService(
|
|
7
|
+
this: Modules,
|
|
8
|
+
paymentProviderId: string,
|
|
9
|
+
paymentContext: PaymentContext,
|
|
10
|
+
): Promise<PaymentCredentials> {
|
|
11
|
+
const paymentProvider = await this.payment.paymentProviders.findProvider({
|
|
12
|
+
paymentProviderId,
|
|
13
|
+
});
|
|
14
|
+
const actions = await PaymentDirector.actions(paymentProvider, paymentContext, { modules: this });
|
|
15
|
+
const registration = await actions.register();
|
|
16
|
+
|
|
17
|
+
if (!registration) return null;
|
|
18
|
+
|
|
19
|
+
const paymentCredentialsId = await this.payment.paymentCredentials.upsertCredentials({
|
|
20
|
+
userId: paymentContext.userId,
|
|
21
|
+
paymentProviderId,
|
|
22
|
+
...registration,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
return this.payment.paymentCredentials.findPaymentCredential({
|
|
26
|
+
paymentCredentialsId,
|
|
27
|
+
userId: paymentContext.userId,
|
|
28
|
+
paymentProviderId,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
});
|
|
16
|
+
|
|
17
|
+
return processQuotationService.bind(this)(updatedQuotation, { quotationContext });
|
|
18
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { getFileAdapter } from '@unchainedshop/core-files';
|
|
2
|
+
import { Modules } from '../modules.js';
|
|
3
|
+
|
|
4
|
+
export async function removeFilesService(this: Modules, { fileIds }: { fileIds: Array<string> }) {
|
|
5
|
+
if (fileIds && typeof fileIds !== 'string' && !Array.isArray(fileIds))
|
|
6
|
+
throw Error('Media id/s to be removed not provided as a string or array');
|
|
7
|
+
|
|
8
|
+
const fileUploadAdapter = getFileAdapter();
|
|
9
|
+
|
|
10
|
+
const fileObjects = await this.files.findFiles({
|
|
11
|
+
_id: { $in: fileIds },
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
try {
|
|
15
|
+
await fileUploadAdapter.removeFiles(fileObjects, { modules: this });
|
|
16
|
+
} catch (e) {
|
|
17
|
+
console.warn(e); // eslint-disable-line
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const fileIdsToDelete = fileObjects.map((f) => f._id).filter(Boolean);
|
|
21
|
+
|
|
22
|
+
await this.files.deleteMany(fileIdsToDelete);
|
|
23
|
+
|
|
24
|
+
return fileIdsToDelete.length;
|
|
25
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ProductStatus } from '@unchainedshop/core-products';
|
|
2
|
+
import { updateCalculationService } from './updateCalculation.js';
|
|
3
|
+
import { Modules } from '../modules.js';
|
|
4
|
+
|
|
5
|
+
export async function removeProductService(
|
|
6
|
+
this: Modules,
|
|
7
|
+
{ productId }: { productId: string },
|
|
8
|
+
): Promise<boolean> {
|
|
9
|
+
const product = await this.products.findProduct({ productId });
|
|
10
|
+
switch (product.status) {
|
|
11
|
+
case ProductStatus.ACTIVE:
|
|
12
|
+
await this.products.unpublish(product);
|
|
13
|
+
// falls through
|
|
14
|
+
case null:
|
|
15
|
+
case ProductStatus.DRAFT:
|
|
16
|
+
{
|
|
17
|
+
await this.bookmarks.deleteByProductId(productId);
|
|
18
|
+
await this.assortments.products.delete(productId);
|
|
19
|
+
const orderIdsToRecalculate =
|
|
20
|
+
await this.orders.positions.removeProductByIdFromAllOpenPositions(productId);
|
|
21
|
+
await Promise.all(
|
|
22
|
+
[...new Set(orderIdsToRecalculate)].map(async (orderIdToRecalculate) => {
|
|
23
|
+
await updateCalculationService.bind(this)(orderIdToRecalculate);
|
|
24
|
+
}),
|
|
25
|
+
);
|
|
26
|
+
await this.products.delete(productId);
|
|
27
|
+
}
|
|
28
|
+
break;
|
|
29
|
+
default:
|
|
30
|
+
throw new Error(`Invalid status', ${product.status}`);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Assortment } from '@unchainedshop/core-assortments';
|
|
2
|
+
import {
|
|
3
|
+
defaultAssortmentSelector,
|
|
4
|
+
defaultFilterSelector,
|
|
5
|
+
defaultSortStage,
|
|
6
|
+
SearchConfiguration,
|
|
7
|
+
SearchQuery,
|
|
8
|
+
} from '@unchainedshop/core-filters';
|
|
9
|
+
import { mongodb } from '@unchainedshop/mongodb';
|
|
10
|
+
import { Modules } from '../modules.js';
|
|
11
|
+
import { FilterDirector } from '../directors/index.js';
|
|
12
|
+
export interface SearchAssortmentConfiguration extends SearchConfiguration {
|
|
13
|
+
assortmentSelector: mongodb.Filter<Assortment>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export async function searchAssortmentsService(
|
|
17
|
+
this: Modules,
|
|
18
|
+
searchQuery: SearchQuery,
|
|
19
|
+
{ forceLiveCollection }: { forceLiveCollection?: boolean },
|
|
20
|
+
) {
|
|
21
|
+
const filterActions = await FilterDirector.actions({ searchQuery }, { modules: this });
|
|
22
|
+
|
|
23
|
+
const filterSelector = await filterActions.transformFilterSelector(defaultFilterSelector(searchQuery));
|
|
24
|
+
const assortmentSelector = defaultAssortmentSelector(searchQuery);
|
|
25
|
+
const sortStage = await filterActions.transformSortStage(defaultSortStage(searchQuery));
|
|
26
|
+
|
|
27
|
+
const searchConfiguration: SearchAssortmentConfiguration = {
|
|
28
|
+
searchQuery,
|
|
29
|
+
filterSelector,
|
|
30
|
+
assortmentSelector,
|
|
31
|
+
sortStage,
|
|
32
|
+
forceLiveCollection,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const assortmentIds = await searchQuery.assortmentIds;
|
|
36
|
+
|
|
37
|
+
const totalAssortmentIds =
|
|
38
|
+
(await filterActions.searchAssortments({ assortmentIds }, searchConfiguration)) || [];
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
searchConfiguration,
|
|
42
|
+
totalAssortmentIds,
|
|
43
|
+
|
|
44
|
+
assortmentsCount: async () =>
|
|
45
|
+
this.assortments.count({
|
|
46
|
+
assortmentSelector,
|
|
47
|
+
assortmentIds: totalAssortmentIds,
|
|
48
|
+
}),
|
|
49
|
+
assortments: async ({ offset, limit }) =>
|
|
50
|
+
this.assortments.search.findFilteredAssortments({
|
|
51
|
+
limit,
|
|
52
|
+
offset,
|
|
53
|
+
assortmentIds: totalAssortmentIds,
|
|
54
|
+
assortmentSelector,
|
|
55
|
+
sort: sortStage,
|
|
56
|
+
}),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defaultFilterSelector,
|
|
3
|
+
defaultProductSelector,
|
|
4
|
+
defaultSortStage,
|
|
5
|
+
SearchConfiguration,
|
|
6
|
+
SearchQuery,
|
|
7
|
+
} from '@unchainedshop/core-filters';
|
|
8
|
+
import { Product } from '@unchainedshop/core-products';
|
|
9
|
+
import { mongodb } from '@unchainedshop/mongodb';
|
|
10
|
+
import { Modules } from '../modules.js';
|
|
11
|
+
import { FilterDirector } from '../directors/index.js';
|
|
12
|
+
export interface SearchProductConfiguration extends SearchConfiguration {
|
|
13
|
+
productSelector: mongodb.Filter<Product>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export async function searchProductsService(
|
|
17
|
+
this: Modules,
|
|
18
|
+
searchQuery: SearchQuery,
|
|
19
|
+
{ forceLiveCollection }: { forceLiveCollection?: boolean },
|
|
20
|
+
) {
|
|
21
|
+
const filterActions = await FilterDirector.actions({ searchQuery }, { modules: this });
|
|
22
|
+
|
|
23
|
+
const filterSelector = await filterActions.transformFilterSelector(defaultFilterSelector(searchQuery));
|
|
24
|
+
const productSelector = await filterActions.transformProductSelector(
|
|
25
|
+
defaultProductSelector(searchQuery, { modules: this }),
|
|
26
|
+
{},
|
|
27
|
+
);
|
|
28
|
+
const sortStage = await filterActions.transformSortStage(defaultSortStage(searchQuery));
|
|
29
|
+
|
|
30
|
+
const searchConfiguration: SearchProductConfiguration = {
|
|
31
|
+
searchQuery,
|
|
32
|
+
filterSelector,
|
|
33
|
+
productSelector,
|
|
34
|
+
sortStage,
|
|
35
|
+
forceLiveCollection,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
if (searchQuery.productIds?.length === 0) {
|
|
39
|
+
// Restricted to an empty array of products
|
|
40
|
+
// will always lead to an empty result
|
|
41
|
+
return {
|
|
42
|
+
searchConfiguration,
|
|
43
|
+
aggregatedTotalProductIds: [],
|
|
44
|
+
aggregatedFilteredProductIds: [],
|
|
45
|
+
totalProductIds: [],
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const productIds = await searchQuery.productIds;
|
|
50
|
+
const totalProductIds =
|
|
51
|
+
(await filterActions.searchProducts({ productIds }, searchConfiguration)) || [];
|
|
52
|
+
|
|
53
|
+
const filteredProductIds = await FilterDirector.productFacetedSearch(
|
|
54
|
+
totalProductIds,
|
|
55
|
+
searchConfiguration,
|
|
56
|
+
{ modules: this },
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
const aggregatedTotalProductIds = filterActions.aggregateProductIds({
|
|
60
|
+
productIds: totalProductIds,
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const aggregatedFilteredProductIds = filterActions.aggregateProductIds({
|
|
64
|
+
productIds: filteredProductIds,
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
searchConfiguration,
|
|
69
|
+
totalProductIds,
|
|
70
|
+
aggregatedTotalProductIds,
|
|
71
|
+
aggregatedFilteredProductIds,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { DeliveryProvider, deliverySettings } from '@unchainedshop/core-delivery';
|
|
2
|
+
import { Modules } from '../modules.js';
|
|
3
|
+
import { DeliveryContext, DeliveryDirector } from '../directors/index.js';
|
|
4
|
+
|
|
5
|
+
export async function supportedDeliveryProvidersService(this: Modules, params: DeliveryContext) {
|
|
6
|
+
const allProviders = await this.delivery.findProviders({});
|
|
7
|
+
|
|
8
|
+
const providers = (
|
|
9
|
+
await Promise.all(
|
|
10
|
+
allProviders.map(async (provider: DeliveryProvider) => {
|
|
11
|
+
const adapter = await DeliveryDirector.actions(provider, params, { modules: this });
|
|
12
|
+
return adapter.isActive() ? [provider] : [];
|
|
13
|
+
}),
|
|
14
|
+
)
|
|
15
|
+
).flat();
|
|
16
|
+
|
|
17
|
+
return deliverySettings.filterSupportedProviders(
|
|
18
|
+
{
|
|
19
|
+
providers,
|
|
20
|
+
order: params.order,
|
|
21
|
+
},
|
|
22
|
+
{ modules: this },
|
|
23
|
+
);
|
|
24
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { PaymentProvider, paymentSettings } from '@unchainedshop/core-payment';
|
|
2
|
+
import { PaymentDirector } from '../directors/PaymentDirector.js';
|
|
3
|
+
import { PaymentContext } from '../directors/PaymentAdapter.js';
|
|
4
|
+
import { Modules } from '../modules.js';
|
|
5
|
+
|
|
6
|
+
export async function supportedPaymentProvidersService(this: Modules, params: PaymentContext) {
|
|
7
|
+
const allProviders = await this.payment.paymentProviders.findProviders({});
|
|
8
|
+
|
|
9
|
+
const providers = (
|
|
10
|
+
await Promise.all(
|
|
11
|
+
allProviders.map(async (provider: PaymentProvider) => {
|
|
12
|
+
const adapter = await PaymentDirector.actions(provider, params, { modules: this });
|
|
13
|
+
return adapter.isActive() ? [provider] : [];
|
|
14
|
+
}),
|
|
15
|
+
)
|
|
16
|
+
).flat();
|
|
17
|
+
|
|
18
|
+
return paymentSettings.filterSupportedProviders(
|
|
19
|
+
{
|
|
20
|
+
providers,
|
|
21
|
+
order: params.order,
|
|
22
|
+
},
|
|
23
|
+
{ modules: this },
|
|
24
|
+
);
|
|
25
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { WarehousingProvider } from '@unchainedshop/core-warehousing';
|
|
2
|
+
import { WarehousingContext, WarehousingDirector } from '../directors/index.js';
|
|
3
|
+
import { Modules } from '../modules.js';
|
|
4
|
+
|
|
5
|
+
export async function supportedWarehousingProvidersService(this: Modules, params: WarehousingContext) {
|
|
6
|
+
const allProviders = await this.warehousing.findProviders({});
|
|
7
|
+
|
|
8
|
+
const providers = (
|
|
9
|
+
await Promise.all(
|
|
10
|
+
allProviders.map(async (provider: WarehousingProvider) => {
|
|
11
|
+
const adapter = await WarehousingDirector.actions(provider, params, { modules: this });
|
|
12
|
+
return adapter.isActive() ? [provider] : [];
|
|
13
|
+
}),
|
|
14
|
+
)
|
|
15
|
+
).flat();
|
|
16
|
+
|
|
17
|
+
return providers;
|
|
18
|
+
}
|