@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,161 @@
|
|
|
1
|
+
import { OrderDeliveryStatus, OrderPaymentStatus, OrderStatus, } from '@unchainedshop/core-orders';
|
|
2
|
+
import { createEnrollmentFromCheckoutService } from './createEnrollmentFromCheckout.js';
|
|
3
|
+
import { ProductTypes } from '@unchainedshop/core-products';
|
|
4
|
+
import { WarehousingProviderType } from '@unchainedshop/core-warehousing';
|
|
5
|
+
import { WarehousingDirector, DeliveryDirector, PaymentDirector } from '../directors/index.js';
|
|
6
|
+
import { fullfillQuotationService } from './fullfillQuotation.js';
|
|
7
|
+
const isAutoConfirmationEnabled = async ({ orderPayment, orderDelivery, }, modules) => {
|
|
8
|
+
if (orderPayment.status !== OrderPaymentStatus.PAID) {
|
|
9
|
+
const provider = await modules.payment.paymentProviders.findProvider({
|
|
10
|
+
paymentProviderId: orderPayment.paymentProviderId,
|
|
11
|
+
});
|
|
12
|
+
const actions = await PaymentDirector.actions(provider, {}, { modules });
|
|
13
|
+
if (!actions.isPayLaterAllowed())
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
if (orderDelivery.status !== OrderDeliveryStatus.DELIVERED) {
|
|
17
|
+
const deliveryProvider = await modules.delivery.findProvider({
|
|
18
|
+
deliveryProviderId: orderDelivery.deliveryProviderId,
|
|
19
|
+
});
|
|
20
|
+
const director = await DeliveryDirector.actions(deliveryProvider, {}, { modules });
|
|
21
|
+
if (!director.isAutoReleaseAllowed())
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
return true;
|
|
25
|
+
};
|
|
26
|
+
const findNextStatus = async (status, order, modules) => {
|
|
27
|
+
if (status === null) {
|
|
28
|
+
return OrderStatus.PENDING;
|
|
29
|
+
}
|
|
30
|
+
if (status === OrderStatus.FULLFILLED || status === OrderStatus.REJECTED) {
|
|
31
|
+
// Final!
|
|
32
|
+
return status;
|
|
33
|
+
}
|
|
34
|
+
const orderPayment = await modules.orders.payments.findOrderPayment({
|
|
35
|
+
orderPaymentId: order.paymentId,
|
|
36
|
+
});
|
|
37
|
+
if (!orderPayment)
|
|
38
|
+
return status;
|
|
39
|
+
const orderDelivery = await modules.orders.deliveries.findDelivery({
|
|
40
|
+
orderDeliveryId: order.deliveryId,
|
|
41
|
+
});
|
|
42
|
+
if (!orderDelivery)
|
|
43
|
+
return status;
|
|
44
|
+
// Ok, we have a payment and a delivery and the correct status,
|
|
45
|
+
// let's check if we can auto-confirm or auto-fulfill
|
|
46
|
+
if (status === OrderStatus.PENDING) {
|
|
47
|
+
if (await isAutoConfirmationEnabled({ orderPayment, orderDelivery }, modules)) {
|
|
48
|
+
return OrderStatus.CONFIRMED;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (status === OrderStatus.CONFIRMED) {
|
|
52
|
+
const readyForFullfillment = orderDelivery.status === OrderDeliveryStatus.DELIVERED &&
|
|
53
|
+
orderPayment.status === OrderPaymentStatus.PAID;
|
|
54
|
+
if (readyForFullfillment) {
|
|
55
|
+
return OrderStatus.FULLFILLED;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return status;
|
|
59
|
+
};
|
|
60
|
+
export async function processOrderService(initialOrder, orderTransactionContext) {
|
|
61
|
+
const { paymentContext, deliveryContext, nextStatus: forceNextStatus, comment, } = orderTransactionContext;
|
|
62
|
+
const orderId = initialOrder._id;
|
|
63
|
+
let order = initialOrder;
|
|
64
|
+
let nextStatus = forceNextStatus || (await findNextStatus(initialOrder.status, order, this));
|
|
65
|
+
if (nextStatus === OrderStatus.PENDING) {
|
|
66
|
+
// auto charge during transition to pending
|
|
67
|
+
const orderPayment = await this.orders.payments.findOrderPayment({
|
|
68
|
+
orderPaymentId: order.paymentId,
|
|
69
|
+
});
|
|
70
|
+
await PaymentDirector.chargeOrderPayment(orderPayment, { userId: order.userId, transactionContext: paymentContext }, { modules: this });
|
|
71
|
+
nextStatus = await findNextStatus(nextStatus, order, this);
|
|
72
|
+
}
|
|
73
|
+
if (nextStatus === OrderStatus.REJECTED) {
|
|
74
|
+
// auto cancel during transition to rejected
|
|
75
|
+
const orderPayment = await this.orders.payments.findOrderPayment({
|
|
76
|
+
orderPaymentId: order.paymentId,
|
|
77
|
+
});
|
|
78
|
+
await PaymentDirector.cancelOrderPayment(orderPayment, { userId: order.userId, transactionContext: paymentContext }, { modules: this });
|
|
79
|
+
}
|
|
80
|
+
if (nextStatus === OrderStatus.CONFIRMED) {
|
|
81
|
+
// confirm pre-authorized payments
|
|
82
|
+
const orderPayment = await this.orders.payments.findOrderPayment({
|
|
83
|
+
orderPaymentId: order.paymentId,
|
|
84
|
+
});
|
|
85
|
+
await PaymentDirector.confirmOrderPayment(orderPayment, { userId: order.userId, transactionContext: paymentContext }, { modules: this });
|
|
86
|
+
if (order.status !== OrderStatus.CONFIRMED) {
|
|
87
|
+
// we have to stop here shortly to complete the confirmation
|
|
88
|
+
// before auto delivery is started, else we have no chance to create
|
|
89
|
+
// numbers that are needed for delivery
|
|
90
|
+
order = await this.orders.updateStatus(orderId, {
|
|
91
|
+
status: OrderStatus.CONFIRMED,
|
|
92
|
+
info: comment,
|
|
93
|
+
});
|
|
94
|
+
const orderDelivery = await this.orders.deliveries.findDelivery({
|
|
95
|
+
orderDeliveryId: order.deliveryId,
|
|
96
|
+
});
|
|
97
|
+
await DeliveryDirector.sendOrderDelivery(orderDelivery, deliveryContext, { modules: this });
|
|
98
|
+
const orderPositions = await this.orders.positions.findOrderPositions({ orderId });
|
|
99
|
+
const mappedProductOrderPositions = await Promise.all(orderPositions.map(async (orderPosition) => {
|
|
100
|
+
const product = await this.products.findProduct({
|
|
101
|
+
productId: orderPosition.productId,
|
|
102
|
+
});
|
|
103
|
+
return {
|
|
104
|
+
orderPosition,
|
|
105
|
+
product,
|
|
106
|
+
};
|
|
107
|
+
}));
|
|
108
|
+
const tokenizedItems = mappedProductOrderPositions.filter((item) => item.product?.type === ProductTypes.TokenizedProduct);
|
|
109
|
+
if (tokenizedItems.length > 0) {
|
|
110
|
+
// Give virtual warehouse a chance to instantiate new virtual objects
|
|
111
|
+
const virtualProviders = await this.warehousing.findProviders({
|
|
112
|
+
type: WarehousingProviderType.VIRTUAL,
|
|
113
|
+
});
|
|
114
|
+
// It's very important to do this in a series and not in Promise.all
|
|
115
|
+
// TODO: Actually, only createTokens should decide on the unique chainTokenId
|
|
116
|
+
// and the tokens should be created with a distributed Lock to not assign the same id multiple times!
|
|
117
|
+
for (const { orderPosition, product } of tokenizedItems) {
|
|
118
|
+
for (const virtualProvider of virtualProviders) {
|
|
119
|
+
const adapterActions = await WarehousingDirector.actions(virtualProvider, {
|
|
120
|
+
order,
|
|
121
|
+
orderPosition,
|
|
122
|
+
product,
|
|
123
|
+
quantity: orderPosition.quantity,
|
|
124
|
+
referenceDate: order.ordered,
|
|
125
|
+
}, { modules: this });
|
|
126
|
+
const isActive = await adapterActions.isActive();
|
|
127
|
+
if (isActive) {
|
|
128
|
+
const tokens = await adapterActions.tokenize();
|
|
129
|
+
await this.warehousing.createTokens(tokens);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
// Enrollments: Generate enrollments for plan products
|
|
135
|
+
const planItems = mappedProductOrderPositions.filter((item) => item.product?.type === ProductTypes.PlanProduct && !order.originEnrollmentId);
|
|
136
|
+
if (planItems.length > 0) {
|
|
137
|
+
await createEnrollmentFromCheckoutService.bind(this)(order, {
|
|
138
|
+
items: planItems,
|
|
139
|
+
context: {
|
|
140
|
+
paymentContext,
|
|
141
|
+
deliveryContext,
|
|
142
|
+
},
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
// Quotations: If we came here, the checkout succeeded, so we can fullfill underlying quotations
|
|
146
|
+
const quotationItems = mappedProductOrderPositions.filter((item) => item.orderPosition.quotationId);
|
|
147
|
+
await Promise.all(quotationItems.map(async ({ orderPosition }) => {
|
|
148
|
+
const quotation = await this.quotations.findQuotation({
|
|
149
|
+
quotationId: orderPosition.quotationId,
|
|
150
|
+
});
|
|
151
|
+
await fullfillQuotationService.bind(this)(quotation, {
|
|
152
|
+
orderId,
|
|
153
|
+
orderPositionId: orderPosition._id,
|
|
154
|
+
});
|
|
155
|
+
}));
|
|
156
|
+
}
|
|
157
|
+
nextStatus = await findNextStatus(nextStatus, order, this);
|
|
158
|
+
}
|
|
159
|
+
return this.orders.updateStatus(order._id, { status: nextStatus, info: comment });
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=processOrder.js.map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0,0 +1,6 @@
|
|
|
1
|
+
import { Quotation } from '@unchainedshop/core-quotations';
|
|
2
|
+
import { Modules } from '../modules.js';
|
|
3
|
+
export declare function processQuotationService(this: Modules, initialQuotation: Quotation, params: {
|
|
4
|
+
quotationContext?: any;
|
|
5
|
+
}): Promise<Quotation>;
|
|
6
|
+
//# sourceMappingURL=processQuotation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processQuotation.d.ts","sourceRoot":"","sources":["../../src/services/processQuotation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAmB,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAoBxC,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,OAAO,EACb,gBAAgB,EAAE,SAAS,EAC3B,MAAM,EAAE;IAAE,gBAAgB,CAAC,EAAE,GAAG,CAAA;CAAE,sBAkDnC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { QuotationStatus } from '@unchainedshop/core-quotations';
|
|
2
|
+
import { QuotationDirector } from '../core-index.js';
|
|
3
|
+
const findNextStatus = async (quotation, modules) => {
|
|
4
|
+
let status = quotation.status;
|
|
5
|
+
const director = await QuotationDirector.actions({ quotation }, { modules });
|
|
6
|
+
if (status === QuotationStatus.REQUESTED) {
|
|
7
|
+
if (!(await director.isManualRequestVerificationRequired())) {
|
|
8
|
+
status = QuotationStatus.PROCESSING;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
if (status === QuotationStatus.PROCESSING) {
|
|
12
|
+
if (!(await director.isManualProposalRequired())) {
|
|
13
|
+
status = QuotationStatus.PROPOSED;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return status;
|
|
17
|
+
};
|
|
18
|
+
export async function processQuotationService(initialQuotation, params) {
|
|
19
|
+
const quotationId = initialQuotation._id;
|
|
20
|
+
let quotation = initialQuotation;
|
|
21
|
+
let nextStatus = await findNextStatus(quotation, this);
|
|
22
|
+
const director = await QuotationDirector.actions({ quotation }, { modules: this });
|
|
23
|
+
if (quotation.status === QuotationStatus.REQUESTED && nextStatus !== QuotationStatus.REQUESTED) {
|
|
24
|
+
await director.submitRequest(params.quotationContext);
|
|
25
|
+
}
|
|
26
|
+
quotation = await this.quotations.findQuotation({ quotationId });
|
|
27
|
+
nextStatus = await findNextStatus(quotation, this);
|
|
28
|
+
if (nextStatus !== QuotationStatus.PROCESSING) {
|
|
29
|
+
await director.verifyRequest(params.quotationContext);
|
|
30
|
+
}
|
|
31
|
+
quotation = await this.quotations.findQuotation({ quotationId });
|
|
32
|
+
nextStatus = await findNextStatus(quotation, this);
|
|
33
|
+
if (nextStatus === QuotationStatus.REJECTED) {
|
|
34
|
+
await director.rejectRequest(params.quotationContext);
|
|
35
|
+
}
|
|
36
|
+
quotation = await this.quotations.findQuotation({ quotationId });
|
|
37
|
+
nextStatus = await findNextStatus(quotation, this);
|
|
38
|
+
if (nextStatus === QuotationStatus.PROPOSED) {
|
|
39
|
+
const proposal = await director.quote();
|
|
40
|
+
quotation = await this.quotations.updateProposal(quotation._id, proposal);
|
|
41
|
+
nextStatus = await findNextStatus(quotation, this);
|
|
42
|
+
}
|
|
43
|
+
const updatedQuotation = await this.quotations.updateStatus(quotation._id, {
|
|
44
|
+
status: nextStatus,
|
|
45
|
+
info: 'quotation processed',
|
|
46
|
+
});
|
|
47
|
+
const user = await this.users.findUserById(updatedQuotation.userId);
|
|
48
|
+
const locale = this.users.userLocale(user);
|
|
49
|
+
await this.worker.addWork({
|
|
50
|
+
type: 'MESSAGE',
|
|
51
|
+
retries: 0,
|
|
52
|
+
input: {
|
|
53
|
+
locale,
|
|
54
|
+
template: 'QUOTATION_STATUS',
|
|
55
|
+
quotationId: updatedQuotation._id,
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
return updatedQuotation;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=processQuotation.js.map
|
|
@@ -0,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B,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,SAAS,CAAC,GAAG,EAAE;QACzE,MAAM,EAAE,UAAU;QAClB,IAAI,EAAE,qBAAqB;KAC5B,CAAC,CAAC;IAEH,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,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;QACxB,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,CAAC;QACV,KAAK,EAAE;YACL,MAAM;YACN,QAAQ,EAAE,kBAAkB;YAC5B,WAAW,EAAE,gBAAgB,CAAC,GAAG;SAClC;KACF,CAAC,CAAC;IAEH,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Quotation } from '@unchainedshop/core-quotations';
|
|
2
|
+
import { Modules } from '../modules.js';
|
|
3
|
+
export declare function proposeQuotationService(this: Modules, quotation: Quotation, { quotationContext }: {
|
|
4
|
+
quotationContext?: any;
|
|
5
|
+
}): Promise<any>;
|
|
6
|
+
//# sourceMappingURL=proposeQuotation.d.ts.map
|
|
@@ -0,0 +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,gBAUjD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { QuotationStatus } from '@unchainedshop/core-quotations';
|
|
2
|
+
import { processQuotationService } from './processQuotation.js';
|
|
3
|
+
export async function proposeQuotationService(quotation, { quotationContext }) {
|
|
4
|
+
if (quotation.status !== QuotationStatus.PROCESSING)
|
|
5
|
+
return quotation;
|
|
6
|
+
const updatedQuotation = await this.quotations.updateStatus(quotation._id, {
|
|
7
|
+
status: QuotationStatus.PROPOSED,
|
|
8
|
+
info: 'proposed manually',
|
|
9
|
+
});
|
|
10
|
+
return processQuotationService.bind(this)(updatedQuotation, { quotationContext });
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=proposeQuotation.js.map
|
|
@@ -0,0 +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;QACzE,MAAM,EAAE,eAAe,CAAC,QAAQ;QAChC,IAAI,EAAE,mBAAmB;KAC1B,CAAC,CAAC;IAEH,OAAO,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,gBAAgB,EAAE,EAAE,gBAAgB,EAAE,CAAC,CAAC;AACpF,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { PaymentCredentials } from '@unchainedshop/core-payment';
|
|
2
|
+
import { PaymentContext } from '../directors/PaymentAdapter.js';
|
|
3
|
+
import { Modules } from '../modules.js';
|
|
4
|
+
export declare function registerPaymentCredentialsService(this: Modules, paymentProviderId: string, paymentContext: PaymentContext): Promise<PaymentCredentials>;
|
|
5
|
+
//# sourceMappingURL=registerPaymentCredentials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerPaymentCredentials.d.ts","sourceRoot":"","sources":["../../src/services/registerPaymentCredentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,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,GAC7B,OAAO,CAAC,kBAAkB,CAAC,CAoB7B"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { PaymentDirector } from '../directors/PaymentDirector.js';
|
|
2
|
+
export async function registerPaymentCredentialsService(paymentProviderId, paymentContext) {
|
|
3
|
+
const paymentProvider = await this.payment.paymentProviders.findProvider({
|
|
4
|
+
paymentProviderId,
|
|
5
|
+
});
|
|
6
|
+
const actions = await PaymentDirector.actions(paymentProvider, paymentContext, { modules: this });
|
|
7
|
+
const registration = await actions.register();
|
|
8
|
+
if (!registration)
|
|
9
|
+
return null;
|
|
10
|
+
const paymentCredentialsId = await this.payment.paymentCredentials.upsertCredentials({
|
|
11
|
+
userId: paymentContext.userId,
|
|
12
|
+
paymentProviderId,
|
|
13
|
+
...registration,
|
|
14
|
+
});
|
|
15
|
+
return this.payment.paymentCredentials.findPaymentCredential({
|
|
16
|
+
paymentCredentialsId,
|
|
17
|
+
userId: paymentContext.userId,
|
|
18
|
+
paymentProviderId,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=registerPaymentCredentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerPaymentCredentials.js","sourceRoot":"","sources":["../../src/services/registerPaymentCredentials.ts"],"names":[],"mappings":"AAEA,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;IACH,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,oBAAoB,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,iBAAiB,CAAC;QACnF,MAAM,EAAE,cAAc,CAAC,MAAM;QAC7B,iBAAiB;QACjB,GAAG,YAAY;KAChB,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,qBAAqB,CAAC;QAC3D,oBAAoB;QACpB,MAAM,EAAE,cAAc,CAAC,MAAM;QAC7B,iBAAiB;KAClB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Order, OrderStatus } from '@unchainedshop/core-orders';
|
|
2
|
+
import { Modules } from '../modules.js';
|
|
3
|
+
export declare function rejectOrderService(this: Modules, order: Order, transactionContext: {
|
|
4
|
+
paymentContext?: any;
|
|
5
|
+
deliveryContext?: any;
|
|
6
|
+
comment?: string;
|
|
7
|
+
nextStatus?: OrderStatus;
|
|
8
|
+
}): Promise<any>;
|
|
9
|
+
//# sourceMappingURL=rejectOrder.d.ts.map
|
|
@@ -0,0 +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,gBAaF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { OrderStatus } from '@unchainedshop/core-orders';
|
|
2
|
+
import { processOrderService } from './processOrder.js';
|
|
3
|
+
export async function rejectOrderService(order, transactionContext) {
|
|
4
|
+
if (order.status !== OrderStatus.PENDING)
|
|
5
|
+
return order;
|
|
6
|
+
const lock = await this.orders.acquireLock(order._id, 'confirm-reject', 1500);
|
|
7
|
+
try {
|
|
8
|
+
return await processOrderService.bind(this)(order, {
|
|
9
|
+
...transactionContext,
|
|
10
|
+
nextStatus: OrderStatus.REJECTED,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
finally {
|
|
14
|
+
await lock.release();
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=rejectOrder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rejectOrder.js","sourceRoot":"","sources":["../../src/services/rejectOrder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAEtC,KAAY,EACZ,kBAKC;IAED,IAAI,KAAK,CAAC,MAAM,KAAK,WAAW,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IAEvD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,EAAE,gBAAgB,EAAE,IAAI,CAAC,CAAC;IAC9E,IAAI,CAAC;QACH,OAAO,MAAM,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE;YACjD,GAAG,kBAAkB;YACrB,UAAU,EAAE,WAAW,CAAC,QAAQ;SACjC,CAAC,CAAC;IACL,CAAC;YAAS,CAAC;QACT,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;IACvB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Quotation } from '@unchainedshop/core-quotations';
|
|
2
|
+
import { Modules } from '../modules.js';
|
|
3
|
+
export declare function rejectQuotationService(this: Modules, quotation: Quotation, { quotationContext }: {
|
|
4
|
+
quotationContext?: any;
|
|
5
|
+
}): Promise<any>;
|
|
6
|
+
//# sourceMappingURL=rejectQuotation.d.ts.map
|
|
@@ -0,0 +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,gBAUjD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { QuotationStatus } from '@unchainedshop/core-quotations';
|
|
2
|
+
import { processQuotationService } from './processQuotation.js';
|
|
3
|
+
export async function rejectQuotationService(quotation, { quotationContext }) {
|
|
4
|
+
if (quotation.status === QuotationStatus.FULLFILLED)
|
|
5
|
+
return quotation;
|
|
6
|
+
const updatedQuotation = await this.quotations.updateStatus(quotation._id, {
|
|
7
|
+
status: QuotationStatus.REJECTED,
|
|
8
|
+
info: 'rejected manually',
|
|
9
|
+
});
|
|
10
|
+
return processQuotationService.bind(this)(updatedQuotation, { quotationContext });
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=rejectQuotation.js.map
|
|
@@ -0,0 +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;QACzE,MAAM,EAAE,eAAe,CAAC,QAAQ;QAChC,IAAI,EAAE,mBAAmB;KAC1B,CAAC,CAAC;IAEH,OAAO,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,gBAAgB,EAAE,EAAE,gBAAgB,EAAE,CAAC,CAAC;AACpF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removeFiles.d.ts","sourceRoot":"","sources":["../../src/services/removeFiles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;CAAE,mBAqB9F"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getFileAdapter } from '@unchainedshop/core-files';
|
|
2
|
+
export async function removeFilesService({ fileIds }) {
|
|
3
|
+
if (fileIds && typeof fileIds !== 'string' && !Array.isArray(fileIds))
|
|
4
|
+
throw Error('Media id/s to be removed not provided as a string or array');
|
|
5
|
+
const fileUploadAdapter = getFileAdapter();
|
|
6
|
+
const fileObjects = await this.files.findFiles({
|
|
7
|
+
_id: { $in: fileIds },
|
|
8
|
+
});
|
|
9
|
+
try {
|
|
10
|
+
await fileUploadAdapter.removeFiles(fileObjects, { modules: this });
|
|
11
|
+
}
|
|
12
|
+
catch (e) {
|
|
13
|
+
console.warn(e); // eslint-disable-line
|
|
14
|
+
}
|
|
15
|
+
const fileIdsToDelete = fileObjects.map((f) => f._id).filter(Boolean);
|
|
16
|
+
await this.files.deleteMany(fileIdsToDelete);
|
|
17
|
+
return fileIdsToDelete.length;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=removeFiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removeFiles.js","sourceRoot":"","sources":["../../src/services/removeFiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAG3D,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAgB,EAAE,OAAO,EAA8B;IAC7F,IAAI,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;QACnE,MAAM,KAAK,CAAC,4DAA4D,CAAC,CAAC;IAE5E,MAAM,iBAAiB,GAAG,cAAc,EAAE,CAAC;IAE3C,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;QAC7C,GAAG,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE;KACtB,CAAC,CAAC;IAEH,IAAI,CAAC;QACH,MAAM,iBAAiB,CAAC,WAAW,CAAC,WAAW,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IACtE,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,sBAAsB;IACzC,CAAC;IAED,MAAM,eAAe,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAEtE,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;IAE7C,OAAO,eAAe,CAAC,MAAM,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FilesModule } from '@unchainedshop/core-files';
|
|
2
|
+
export type RemoveFilesService = (params: {
|
|
3
|
+
fileIds: Array<string>;
|
|
4
|
+
}, unchainedAPI: {
|
|
5
|
+
modules: {
|
|
6
|
+
files: FilesModule;
|
|
7
|
+
};
|
|
8
|
+
}) => Promise<number>;
|
|
9
|
+
export declare const removeFilesService: RemoveFilesService;
|
|
10
|
+
//# sourceMappingURL=removeFilesService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removeFilesService.d.ts","sourceRoot":"","sources":["../../src/services/removeFilesService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,2BAA2B,CAAC;AAExE,MAAM,MAAM,kBAAkB,GAAG,CAC/B,MAAM,EAAE;IAAE,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;CAAE,EAClC,YAAY,EAAE;IAAE,OAAO,EAAE;QAAE,KAAK,EAAE,WAAW,CAAA;KAAE,CAAA;CAAE,KAC9C,OAAO,CAAC,MAAM,CAAC,CAAC;AAErB,eAAO,MAAM,kBAAkB,EAAE,kBAyBhC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { getFileAdapter } from '@unchainedshop/core-files';
|
|
2
|
+
export const removeFilesService = async ({ fileIds }, unchainedAPI) => {
|
|
3
|
+
const { modules: { files }, } = unchainedAPI;
|
|
4
|
+
if (fileIds && typeof fileIds !== 'string' && !Array.isArray(fileIds))
|
|
5
|
+
throw Error('Media id/s to be removed not provided as a string or array');
|
|
6
|
+
const fileUploadAdapter = getFileAdapter();
|
|
7
|
+
const fileObjects = await files.findFiles({
|
|
8
|
+
_id: { $in: fileIds },
|
|
9
|
+
});
|
|
10
|
+
try {
|
|
11
|
+
await fileUploadAdapter.removeFiles(fileObjects, unchainedAPI);
|
|
12
|
+
}
|
|
13
|
+
catch (e) {
|
|
14
|
+
console.warn(e); // eslint-disable-line
|
|
15
|
+
}
|
|
16
|
+
const fileIdsToDelete = fileObjects.map((f) => f._id).filter(Boolean);
|
|
17
|
+
await files.deleteMany(fileIdsToDelete);
|
|
18
|
+
return fileIdsToDelete.length;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=removeFilesService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removeFilesService.js","sourceRoot":"","sources":["../../src/services/removeFilesService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAOxE,MAAM,CAAC,MAAM,kBAAkB,GAAuB,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,YAAY,EAAE,EAAE;IACxF,MAAM,EACJ,OAAO,EAAE,EAAE,KAAK,EAAE,GACnB,GAAG,YAAY,CAAC;IAEjB,IAAI,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;QACnE,MAAM,KAAK,CAAC,4DAA4D,CAAC,CAAC;IAE5E,MAAM,iBAAiB,GAAG,cAAc,EAAE,CAAC;IAE3C,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,SAAS,CAAC;QACxC,GAAG,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE;KACtB,CAAC,CAAC;IAEH,IAAI,CAAC;QACH,MAAM,iBAAiB,CAAC,WAAW,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IACjE,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,sBAAsB;IACzC,CAAC;IAED,MAAM,eAAe,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAEtE,MAAM,KAAK,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;IAExC,OAAO,eAAe,CAAC,MAAM,CAAC;AAChC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removeProduct.d.ts","sourceRoot":"","sources":["../../src/services/removeProduct.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,OAAO,EACb,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GACnC,OAAO,CAAC,OAAO,CAAC,CA0BlB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ProductStatus } from '@unchainedshop/core-products';
|
|
2
|
+
import { updateCalculationService } from './updateCalculation.js';
|
|
3
|
+
export async function removeProductService({ productId }) {
|
|
4
|
+
const product = await this.products.findProduct({ productId });
|
|
5
|
+
switch (product.status) {
|
|
6
|
+
case ProductStatus.ACTIVE:
|
|
7
|
+
await this.products.unpublish(product);
|
|
8
|
+
// falls through
|
|
9
|
+
case null:
|
|
10
|
+
case ProductStatus.DRAFT:
|
|
11
|
+
{
|
|
12
|
+
await this.bookmarks.deleteByProductId(productId);
|
|
13
|
+
await this.assortments.products.delete(productId);
|
|
14
|
+
const orderIdsToRecalculate = await this.orders.positions.removeProductByIdFromAllOpenPositions(productId);
|
|
15
|
+
await Promise.all([...new Set(orderIdsToRecalculate)].map(async (orderIdToRecalculate) => {
|
|
16
|
+
await updateCalculationService.bind(this)(orderIdToRecalculate);
|
|
17
|
+
}));
|
|
18
|
+
await this.products.delete(productId);
|
|
19
|
+
}
|
|
20
|
+
break;
|
|
21
|
+
default:
|
|
22
|
+
throw new Error(`Invalid status', ${product.status}`);
|
|
23
|
+
}
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=removeProduct.js.map
|
|
@@ -0,0 +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;IAC/D,QAAQ,OAAO,CAAC,MAAM,EAAE,CAAC;QACvB,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,MAAM,CAAC,SAAS,CAAC,CAAC;gBAClD,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,oBAAoB,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC1D,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AssortmentsModule } from '@unchainedshop/core-assortments';
|
|
2
|
+
import { BookmarksModule } from '@unchainedshop/core-bookmarks';
|
|
3
|
+
import { OrdersModule } from '@unchainedshop/core-orders';
|
|
4
|
+
import { ProductsModule } from '@unchainedshop/core-products';
|
|
5
|
+
import { DeliveryModule } from '@unchainedshop/core-delivery';
|
|
6
|
+
import { PaymentModule } from '@unchainedshop/core-payment';
|
|
7
|
+
export type RemoveProductService = (params: {
|
|
8
|
+
productId: string;
|
|
9
|
+
}, unchainedAPI: {
|
|
10
|
+
modules: {
|
|
11
|
+
products: ProductsModule;
|
|
12
|
+
bookmarks: BookmarksModule;
|
|
13
|
+
assortments: AssortmentsModule;
|
|
14
|
+
orders: OrdersModule;
|
|
15
|
+
delivery: DeliveryModule;
|
|
16
|
+
payment: PaymentModule;
|
|
17
|
+
};
|
|
18
|
+
}) => Promise<boolean>;
|
|
19
|
+
export declare const removeProductService: RemoveProductService;
|
|
20
|
+
//# sourceMappingURL=removeProductService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removeProductService.d.ts","sourceRoot":"","sources":["../../src/services/removeProductService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAiB,MAAM,8BAA8B,CAAC;AAE7E,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,MAAM,MAAM,oBAAoB,GAAG,CACjC,MAAM,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,EAC7B,YAAY,EAAE;IACZ,OAAO,EAAE;QACP,QAAQ,EAAE,cAAc,CAAC;QACzB,SAAS,EAAE,eAAe,CAAC;QAC3B,WAAW,EAAE,iBAAiB,CAAC;QAC/B,MAAM,EAAE,YAAY,CAAC;QACrB,QAAQ,EAAE,cAAc,CAAC;QACzB,OAAO,EAAE,aAAa,CAAC;KACxB,CAAC;CACH,KACE,OAAO,CAAC,OAAO,CAAC,CAAC;AAEtB,eAAO,MAAM,oBAAoB,EAAE,oBA2BlC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ProductStatus } from '@unchainedshop/core-products';
|
|
2
|
+
import { updateCalculationService } from './updateCalculationService.js';
|
|
3
|
+
export const removeProductService = async ({ productId }, unchainedAPI) => {
|
|
4
|
+
const { modules } = unchainedAPI;
|
|
5
|
+
const product = await modules.products.findProduct({ productId });
|
|
6
|
+
switch (product.status) {
|
|
7
|
+
case ProductStatus.ACTIVE:
|
|
8
|
+
await modules.products.unpublish(product);
|
|
9
|
+
// falls through
|
|
10
|
+
case null:
|
|
11
|
+
case ProductStatus.DRAFT:
|
|
12
|
+
{
|
|
13
|
+
await modules.bookmarks.deleteByProductId(productId);
|
|
14
|
+
await modules.assortments.products.delete(productId);
|
|
15
|
+
const orderIdsToRecalculate = await modules.orders.positions.removeProductByIdFromAllOpenPositions(productId);
|
|
16
|
+
await Promise.all([...new Set(orderIdsToRecalculate)].map(async (orderIdToRecalculate) => {
|
|
17
|
+
await updateCalculationService(orderIdToRecalculate, unchainedAPI);
|
|
18
|
+
}));
|
|
19
|
+
await modules.products.delete(productId);
|
|
20
|
+
}
|
|
21
|
+
break;
|
|
22
|
+
default:
|
|
23
|
+
throw new Error(`Invalid status', ${product.status}`);
|
|
24
|
+
}
|
|
25
|
+
return true;
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=removeProductService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removeProductService.js","sourceRoot":"","sources":["../../src/services/removeProductService.ts"],"names":[],"mappings":"AAGA,OAAO,EAAkB,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAkBzE,MAAM,CAAC,MAAM,oBAAoB,GAAyB,KAAK,EAAE,EAAE,SAAS,EAAE,EAAE,YAAY,EAAE,EAAE;IAC9F,MAAM,EAAE,OAAO,EAAE,GAAG,YAAY,CAAC;IACjC,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;IAClE,QAAQ,OAAO,CAAC,MAAM,EAAE,CAAC;QACvB,KAAK,aAAa,CAAC,MAAM;YACvB,MAAM,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAC5C,gBAAgB;QAChB,KAAK,IAAI,CAAC;QACV,KAAK,aAAa,CAAC,KAAK;YACtB,CAAC;gBACC,MAAM,OAAO,CAAC,SAAS,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;gBACrD,MAAM,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;gBACrD,MAAM,qBAAqB,GACzB,MAAM,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,qCAAqC,CAAC,SAAS,CAAC,CAAC;gBAClF,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,oBAAoB,EAAE,YAAY,CAAC,CAAC;gBACrE,CAAC,CAAC,CACH,CAAC;gBACF,MAAM,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAC3C,CAAC;YACD,MAAM;QACR;YACE,MAAM,IAAI,KAAK,CAAC,oBAAoB,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC1D,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Assortment } from '@unchainedshop/core-assortments';
|
|
2
|
+
import { SearchConfiguration, SearchQuery } from '@unchainedshop/core-filters';
|
|
3
|
+
import { mongodb } from '@unchainedshop/mongodb';
|
|
4
|
+
import { Modules } from '../modules.js';
|
|
5
|
+
export interface SearchAssortmentConfiguration extends SearchConfiguration {
|
|
6
|
+
assortmentSelector: mongodb.Filter<Assortment>;
|
|
7
|
+
}
|
|
8
|
+
export declare function searchAssortmentsService(this: Modules, searchQuery: SearchQuery, { forceLiveCollection }: {
|
|
9
|
+
forceLiveCollection?: boolean;
|
|
10
|
+
}): Promise<{
|
|
11
|
+
searchConfiguration: SearchAssortmentConfiguration;
|
|
12
|
+
totalAssortmentIds: string[];
|
|
13
|
+
assortmentsCount: () => Promise<number>;
|
|
14
|
+
assortments: ({ offset, limit }: {
|
|
15
|
+
offset: any;
|
|
16
|
+
limit: any;
|
|
17
|
+
}) => Promise<Assortment[]>;
|
|
18
|
+
}>;
|
|
19
|
+
//# sourceMappingURL=searchAssortments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"searchAssortments.d.ts","sourceRoot":"","sources":["../../src/services/searchAssortments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAIL,mBAAmB,EACnB,WAAW,EACZ,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,WAAW,6BAA8B,SAAQ,mBAAmB;IACxE,kBAAkB,EAAE,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;CAChD;AAED,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,OAAO,EACb,WAAW,EAAE,WAAW,EACxB,EAAE,mBAAmB,EAAE,EAAE;IAAE,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAAE;;;;;;;;GAuC3D"}
|