@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,56 @@
|
|
|
1
|
+
import { Product, ProductConfiguration } from '@unchainedshop/core-products';
|
|
2
|
+
import { Order } from '@unchainedshop/core-orders';
|
|
3
|
+
import {
|
|
4
|
+
IProductPricingSheet,
|
|
5
|
+
ProductPricingCalculation,
|
|
6
|
+
ProductPricingSheet,
|
|
7
|
+
BasePricingAdapter,
|
|
8
|
+
BasePricingAdapterContext,
|
|
9
|
+
IPricingAdapter,
|
|
10
|
+
} from '../directors/index.js';
|
|
11
|
+
import { Modules } from '../modules.js';
|
|
12
|
+
|
|
13
|
+
export interface ProductPricingAdapterContext extends BasePricingAdapterContext {
|
|
14
|
+
country: string;
|
|
15
|
+
currency: string;
|
|
16
|
+
product: Product;
|
|
17
|
+
quantity: number;
|
|
18
|
+
configuration: Array<ProductConfiguration>;
|
|
19
|
+
order?: Order;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type IProductPricingAdapter<DiscountConfiguration = unknown> = IPricingAdapter<
|
|
23
|
+
ProductPricingAdapterContext & { modules: Modules },
|
|
24
|
+
ProductPricingCalculation,
|
|
25
|
+
IProductPricingSheet,
|
|
26
|
+
DiscountConfiguration
|
|
27
|
+
>;
|
|
28
|
+
|
|
29
|
+
const basePricingAdapter = BasePricingAdapter<ProductPricingAdapterContext, ProductPricingCalculation>();
|
|
30
|
+
|
|
31
|
+
export const ProductPricingAdapter: IProductPricingAdapter = {
|
|
32
|
+
...basePricingAdapter,
|
|
33
|
+
|
|
34
|
+
isActivatedFor: () => {
|
|
35
|
+
return false;
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
actions: (params) => {
|
|
39
|
+
const { context } = params;
|
|
40
|
+
const { currency, quantity } = context;
|
|
41
|
+
const baseActions = basePricingAdapter.actions(params);
|
|
42
|
+
const resultSheet = ProductPricingSheet({ currency, quantity });
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
...baseActions,
|
|
46
|
+
calculate: async () => {
|
|
47
|
+
const resultRaw = resultSheet.getRawPricingSheet();
|
|
48
|
+
resultRaw.forEach(({ amount, category }) =>
|
|
49
|
+
basePricingAdapter.log(`Product Item Calculation -> ${category} ${amount}`),
|
|
50
|
+
);
|
|
51
|
+
return resultRaw;
|
|
52
|
+
},
|
|
53
|
+
resultSheet: () => resultSheet,
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { Product, ProductConfiguration } from '@unchainedshop/core-products';
|
|
2
|
+
import { User } from '@unchainedshop/core-users';
|
|
3
|
+
import { Order, OrderDiscount, OrderPosition } from '@unchainedshop/core-orders';
|
|
4
|
+
import {
|
|
5
|
+
IProductPricingSheet,
|
|
6
|
+
ProductPricingCalculation,
|
|
7
|
+
ProductPricingSheet,
|
|
8
|
+
IProductPricingAdapter,
|
|
9
|
+
ProductPricingAdapterContext,
|
|
10
|
+
BasePricingDirector,
|
|
11
|
+
IPricingDirector,
|
|
12
|
+
} from '../directors/index.js';
|
|
13
|
+
|
|
14
|
+
export type ProductPricingContext =
|
|
15
|
+
| {
|
|
16
|
+
currency: string;
|
|
17
|
+
quantity: number;
|
|
18
|
+
country?: string;
|
|
19
|
+
discounts?: Array<OrderDiscount>;
|
|
20
|
+
order?: Order;
|
|
21
|
+
product?: Product;
|
|
22
|
+
configuration?: Array<ProductConfiguration>;
|
|
23
|
+
user?: User;
|
|
24
|
+
}
|
|
25
|
+
| {
|
|
26
|
+
currency: string;
|
|
27
|
+
quantity: number;
|
|
28
|
+
item: OrderPosition;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const baseDirector = BasePricingDirector<
|
|
32
|
+
ProductPricingContext,
|
|
33
|
+
ProductPricingAdapterContext,
|
|
34
|
+
ProductPricingCalculation,
|
|
35
|
+
IProductPricingAdapter
|
|
36
|
+
>('ProductPricingDirector');
|
|
37
|
+
|
|
38
|
+
export type IProductPricingDirector<DiscountConfiguration = unknown> = IPricingDirector<
|
|
39
|
+
ProductPricingContext,
|
|
40
|
+
ProductPricingCalculation,
|
|
41
|
+
ProductPricingAdapterContext,
|
|
42
|
+
IProductPricingSheet,
|
|
43
|
+
IProductPricingAdapter<DiscountConfiguration>
|
|
44
|
+
>;
|
|
45
|
+
|
|
46
|
+
export const ProductPricingDirector: IProductPricingDirector<any> = {
|
|
47
|
+
...baseDirector,
|
|
48
|
+
|
|
49
|
+
async buildPricingContext(context, unchainedAPI) {
|
|
50
|
+
const { modules } = unchainedAPI;
|
|
51
|
+
const { quantity = 1, currency } = context;
|
|
52
|
+
|
|
53
|
+
if ('item' in context) {
|
|
54
|
+
const { item } = context;
|
|
55
|
+
|
|
56
|
+
const product = await modules.products.findProduct({
|
|
57
|
+
productId: item.productId,
|
|
58
|
+
});
|
|
59
|
+
const order = await modules.orders.findOrder({
|
|
60
|
+
orderId: item.orderId,
|
|
61
|
+
});
|
|
62
|
+
const user = await modules.users.findUserById(order.userId);
|
|
63
|
+
const discounts = await modules.orders.discounts.findOrderDiscounts({
|
|
64
|
+
orderId: item.orderId,
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
...unchainedAPI,
|
|
69
|
+
country: order.countryCode,
|
|
70
|
+
currency,
|
|
71
|
+
discounts,
|
|
72
|
+
order,
|
|
73
|
+
product,
|
|
74
|
+
quantity,
|
|
75
|
+
configuration: item.configuration,
|
|
76
|
+
user,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return {
|
|
81
|
+
...unchainedAPI,
|
|
82
|
+
country: context.country,
|
|
83
|
+
currency,
|
|
84
|
+
discounts: [],
|
|
85
|
+
order: context.order,
|
|
86
|
+
product: context.product,
|
|
87
|
+
quantity,
|
|
88
|
+
configuration: context.configuration,
|
|
89
|
+
user: context.user,
|
|
90
|
+
};
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
calculationSheet(pricingContext, calculation) {
|
|
94
|
+
return ProductPricingSheet({
|
|
95
|
+
calculation,
|
|
96
|
+
currency: pricingContext.currency,
|
|
97
|
+
quantity: pricingContext.quantity ?? 1,
|
|
98
|
+
});
|
|
99
|
+
},
|
|
100
|
+
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { ProductPricingSheet } from './ProductPricingSheet.js';
|
|
2
|
+
|
|
3
|
+
const TAX = { category: 'TAX', amount: 50, isNetPrice: false, isTaxable: false };
|
|
4
|
+
const TAX2 = { category: 'TAX', amount: 25, isNetPrice: false, isTaxable: false };
|
|
5
|
+
const DISCOUNT = {
|
|
6
|
+
category: 'DISCOUNT',
|
|
7
|
+
amount: 20,
|
|
8
|
+
isNetPrice: false,
|
|
9
|
+
isTaxable: false,
|
|
10
|
+
discountId: 'for-all',
|
|
11
|
+
};
|
|
12
|
+
const DISCOUNT2 = {
|
|
13
|
+
category: 'DISCOUNT',
|
|
14
|
+
amount: 20,
|
|
15
|
+
isNetPrice: false,
|
|
16
|
+
isTaxable: false,
|
|
17
|
+
discountId: 'for-all',
|
|
18
|
+
};
|
|
19
|
+
const DISCOUNT3 = {
|
|
20
|
+
category: 'DISCOUNT',
|
|
21
|
+
amount: 20,
|
|
22
|
+
isNetPrice: false,
|
|
23
|
+
isTaxable: false,
|
|
24
|
+
discountId: 'special',
|
|
25
|
+
};
|
|
26
|
+
const ITEM1 = { category: 'ITEM', amount: 200, isNetPrice: true, isTaxable: false };
|
|
27
|
+
const ITEM2 = { category: 'ITEM', amount: 200, isNetPrice: true, isTaxable: false };
|
|
28
|
+
const calculations = [TAX, TAX2, DISCOUNT, DISCOUNT2, DISCOUNT3, ITEM1, ITEM2];
|
|
29
|
+
|
|
30
|
+
describe('ProductPricingSheet', () => {
|
|
31
|
+
let pricingSheet;
|
|
32
|
+
|
|
33
|
+
const pricingSheetParams = {
|
|
34
|
+
calculation: calculations,
|
|
35
|
+
currency: 'CHF',
|
|
36
|
+
quantity: 2,
|
|
37
|
+
};
|
|
38
|
+
beforeEach(() => {
|
|
39
|
+
pricingSheet = ProductPricingSheet(pricingSheetParams);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('should return an object that implements the IProductPricingSheet interface', () => {
|
|
43
|
+
expect(pricingSheet).toBeDefined();
|
|
44
|
+
expect(pricingSheet.quantity).toEqual(2);
|
|
45
|
+
expect(pricingSheet.currency).toEqual('CHF');
|
|
46
|
+
expect(typeof pricingSheet.addItem).toBe('function');
|
|
47
|
+
expect(typeof pricingSheet.addDiscount).toBe('function');
|
|
48
|
+
expect(typeof pricingSheet.addTax).toBe('function');
|
|
49
|
+
expect(typeof pricingSheet.taxSum).toBe('function');
|
|
50
|
+
expect(typeof pricingSheet.unitPrice).toBe('function');
|
|
51
|
+
expect(typeof pricingSheet.discountPrices).toBe('function');
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('gross() should return the GROSS sum of all ProductPricingCalculation', () => {
|
|
55
|
+
expect(pricingSheet.gross()).toEqual(535);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('net() should return the NET sum of all ProductPricingCalculation (i.e before TAX)', () => {
|
|
59
|
+
expect(pricingSheet.net()).toEqual(460);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
describe('total()', () => {
|
|
63
|
+
it('should return sum of all ProductPricingCalculations ', () => {
|
|
64
|
+
expect(pricingSheet.total()).toEqual({ amount: 535, currency: 'CHF' });
|
|
65
|
+
expect(pricingSheet.total()).toEqual({ amount: pricingSheet.gross(), currency: 'CHF' });
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('should return sum of all ProductPricingCalculations ', () => {
|
|
69
|
+
expect(pricingSheet.total({ useNetPrice: true })).toEqual({ amount: 460, currency: 'CHF' });
|
|
70
|
+
expect(pricingSheet.total({ useNetPrice: true })).toEqual({
|
|
71
|
+
amount: pricingSheet.net(),
|
|
72
|
+
currency: 'CHF',
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it('should return sum of all ProductPricingCalculations for the provided category ', () => {
|
|
77
|
+
expect(pricingSheet.total({ category: 'ITEM' })).toEqual({ amount: 400, currency: 'CHF' });
|
|
78
|
+
expect(pricingSheet.total({ category: 'DISCOUNT' })).toEqual({ amount: 60, currency: 'CHF' });
|
|
79
|
+
expect(pricingSheet.total({ category: 'TAX' })).toEqual({ amount: 75, currency: 'CHF' });
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
describe('isValid()', () => {
|
|
84
|
+
it('should return true if there is at least 1 registered ProductPricingCalculation ', () => {
|
|
85
|
+
expect(pricingSheet.isValid()).toEqual(true);
|
|
86
|
+
});
|
|
87
|
+
it('should return false if there is no registered ProductPricingCalculation ', () => {
|
|
88
|
+
const sheet = ProductPricingSheet({ ...pricingSheetParams, calculation: [] });
|
|
89
|
+
expect(sheet.isValid()).toEqual(false);
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
describe('getRawPricingSheet', () => {
|
|
94
|
+
it('should return all registered ProductPricingCalculation', () => {
|
|
95
|
+
expect(pricingSheet.getRawPricingSheet()).toEqual(calculations);
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
describe('taxSum', () => {
|
|
100
|
+
it('should return the sum of TAX calculation registered on the adapter', () => {
|
|
101
|
+
expect(pricingSheet.taxSum()).toEqual(75);
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
describe('unitPrice', () => {
|
|
106
|
+
it('should return the GROSS sum for a product price useNetPrice:false', () => {
|
|
107
|
+
expect(pricingSheet.unitPrice({ useNetPrice: false })).toEqual({ amount: 268, currency: 'CHF' });
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it('should return the NET sum for a product price when useNetPrice:true', () => {
|
|
111
|
+
expect(pricingSheet.unitPrice({ useNetPrice: true })).toEqual({ amount: 230, currency: 'CHF' });
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
describe('discountPrices', () => {
|
|
116
|
+
it('should return the sum of all discounts registered on the price sheet based on discountId', () => {
|
|
117
|
+
expect(pricingSheet.discountPrices('for-all')).toEqual([
|
|
118
|
+
{ amount: 40, currency: 'CHF', discountId: 'for-all' },
|
|
119
|
+
]);
|
|
120
|
+
expect(pricingSheet.discountPrices('special')).toEqual([
|
|
121
|
+
{ amount: 20, currency: 'CHF', discountId: 'special' },
|
|
122
|
+
]);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it('should return empty array if discount with the provided discountId is not found', () => {
|
|
126
|
+
expect(pricingSheet.discountPrices('non-existing')).toEqual([]);
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
});
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { PricingCalculation } from '@unchainedshop/utils';
|
|
2
|
+
|
|
3
|
+
import { BasePricingSheet, IPricingSheet, PricingSheetParams } from '../directors/index.js';
|
|
4
|
+
|
|
5
|
+
export interface ProductPricingCalculation extends PricingCalculation {
|
|
6
|
+
discountId?: string;
|
|
7
|
+
isTaxable: boolean;
|
|
8
|
+
isNetPrice: boolean;
|
|
9
|
+
rate?: number;
|
|
10
|
+
}
|
|
11
|
+
export enum ProductPricingRowCategory {
|
|
12
|
+
Item = 'ITEM',
|
|
13
|
+
Discount = 'DISCOUNT',
|
|
14
|
+
Tax = 'TAX',
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface IProductPricingSheet extends IPricingSheet<ProductPricingCalculation> {
|
|
18
|
+
addItem: (params: Omit<ProductPricingCalculation, 'category' | 'discountId'>) => void;
|
|
19
|
+
|
|
20
|
+
addTax: (params: {
|
|
21
|
+
amount: number;
|
|
22
|
+
rate: number;
|
|
23
|
+
baseCategory?: string;
|
|
24
|
+
discountId?: string;
|
|
25
|
+
meta?: any;
|
|
26
|
+
}) => void;
|
|
27
|
+
|
|
28
|
+
addDiscount: (params: {
|
|
29
|
+
amount: number;
|
|
30
|
+
isTaxable: boolean;
|
|
31
|
+
isNetPrice: boolean;
|
|
32
|
+
discountId: string;
|
|
33
|
+
meta?: any;
|
|
34
|
+
}) => void;
|
|
35
|
+
|
|
36
|
+
unitPrice: (params?: { useNetPrice: boolean }) => {
|
|
37
|
+
amount: number;
|
|
38
|
+
currency: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const ProductPricingSheet = (
|
|
43
|
+
params: PricingSheetParams<ProductPricingCalculation>,
|
|
44
|
+
): IProductPricingSheet => {
|
|
45
|
+
const basePricingSheet = BasePricingSheet<ProductPricingCalculation>(params);
|
|
46
|
+
|
|
47
|
+
const pricingSheet: IProductPricingSheet = {
|
|
48
|
+
...basePricingSheet,
|
|
49
|
+
|
|
50
|
+
addDiscount({ amount, isTaxable, isNetPrice, discountId, meta }) {
|
|
51
|
+
basePricingSheet.calculation.push({
|
|
52
|
+
category: ProductPricingRowCategory.Discount,
|
|
53
|
+
amount,
|
|
54
|
+
isTaxable,
|
|
55
|
+
isNetPrice,
|
|
56
|
+
discountId,
|
|
57
|
+
meta,
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
addItem({ amount, isTaxable, isNetPrice, meta }) {
|
|
62
|
+
basePricingSheet.calculation.push({
|
|
63
|
+
category: ProductPricingRowCategory.Item,
|
|
64
|
+
amount,
|
|
65
|
+
isTaxable,
|
|
66
|
+
isNetPrice,
|
|
67
|
+
meta,
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
addTax({ amount, baseCategory, rate, meta, discountId }) {
|
|
72
|
+
basePricingSheet.calculation.push({
|
|
73
|
+
category: ProductPricingRowCategory.Tax,
|
|
74
|
+
baseCategory,
|
|
75
|
+
discountId,
|
|
76
|
+
amount,
|
|
77
|
+
isTaxable: false,
|
|
78
|
+
isNetPrice: false,
|
|
79
|
+
rate,
|
|
80
|
+
meta,
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
taxSum(filter) {
|
|
85
|
+
return basePricingSheet.sum({
|
|
86
|
+
category: ProductPricingRowCategory.Tax,
|
|
87
|
+
...(filter || {}),
|
|
88
|
+
});
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
unitPrice(unitPriceParams) {
|
|
92
|
+
const amount = unitPriceParams?.useNetPrice ? this.net() : this.gross();
|
|
93
|
+
return {
|
|
94
|
+
amount: Math.round(amount / (this.quantity ?? 1)),
|
|
95
|
+
currency: this.currency,
|
|
96
|
+
};
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
discountPrices(explicitDiscountId) {
|
|
100
|
+
const discountIds = pricingSheet
|
|
101
|
+
.filterBy({
|
|
102
|
+
category: ProductPricingRowCategory.Discount,
|
|
103
|
+
discountId: explicitDiscountId,
|
|
104
|
+
})
|
|
105
|
+
.map(({ discountId }) => discountId);
|
|
106
|
+
|
|
107
|
+
return [...new Set(discountIds)]
|
|
108
|
+
.map((discountId) => {
|
|
109
|
+
const amount = basePricingSheet.sum({
|
|
110
|
+
category: ProductPricingRowCategory.Discount,
|
|
111
|
+
discountId,
|
|
112
|
+
});
|
|
113
|
+
if (!amount) {
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
discountId,
|
|
118
|
+
amount: Math.round(amount),
|
|
119
|
+
currency: basePricingSheet.currency,
|
|
120
|
+
};
|
|
121
|
+
})
|
|
122
|
+
.filter(Boolean);
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
return pricingSheet;
|
|
127
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Quotation,
|
|
3
|
+
QuotationItemConfiguration,
|
|
4
|
+
QuotationProposal,
|
|
5
|
+
} from '@unchainedshop/core-quotations';
|
|
6
|
+
import { log, LogLevel } from '@unchainedshop/logger';
|
|
7
|
+
import { IBaseAdapter } from '@unchainedshop/utils';
|
|
8
|
+
|
|
9
|
+
export type QuotationContext = {
|
|
10
|
+
quotation?: Quotation;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export interface QuotationAdapterActions {
|
|
14
|
+
configurationError: () => QuotationError;
|
|
15
|
+
isManualProposalRequired: () => Promise<boolean>;
|
|
16
|
+
isManualRequestVerificationRequired: () => Promise<boolean>;
|
|
17
|
+
quote: () => Promise<QuotationProposal>;
|
|
18
|
+
rejectRequest: (unchainedAPI?: any) => Promise<boolean>;
|
|
19
|
+
submitRequest: (unchainedAPI?: any) => Promise<boolean>;
|
|
20
|
+
verifyRequest: (unchainedAPI?: any) => Promise<boolean>;
|
|
21
|
+
|
|
22
|
+
transformItemConfiguration: (
|
|
23
|
+
params: QuotationItemConfiguration,
|
|
24
|
+
) => Promise<QuotationItemConfiguration>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type IQuotationAdapter = IBaseAdapter & {
|
|
28
|
+
orderIndex: number;
|
|
29
|
+
isActivatedFor: (quotationContext: QuotationContext, unchainedAPI) => boolean;
|
|
30
|
+
actions: (params: QuotationContext) => QuotationAdapterActions;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export enum QuotationError {
|
|
34
|
+
ADAPTER_NOT_FOUND = 'ADAPTER_NOT_FOUND',
|
|
35
|
+
NOT_IMPLEMENTED = 'NOT_IMPLEMENTED',
|
|
36
|
+
INCOMPLETE_CONFIGURATION = 'INCOMPLETE_CONFIGURATION',
|
|
37
|
+
WRONG_CREDENTIALS = 'WRONG_CREDENTIALS',
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const QuotationAdapter: Omit<IQuotationAdapter, 'key' | 'label' | 'version'> = {
|
|
41
|
+
orderIndex: 0,
|
|
42
|
+
|
|
43
|
+
isActivatedFor: () => {
|
|
44
|
+
return false;
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
actions: () => {
|
|
48
|
+
return {
|
|
49
|
+
configurationError: () => {
|
|
50
|
+
return QuotationError.NOT_IMPLEMENTED;
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
isManualRequestVerificationRequired: async () => {
|
|
54
|
+
return true;
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
isManualProposalRequired: async () => {
|
|
58
|
+
return true;
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
quote: async () => {
|
|
62
|
+
return {};
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
rejectRequest: async () => {
|
|
66
|
+
return true;
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
submitRequest: async () => {
|
|
70
|
+
return true;
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
verifyRequest: async () => {
|
|
74
|
+
return true;
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
transformItemConfiguration: async ({ quantity, configuration }) => {
|
|
78
|
+
return { quantity, configuration };
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
log(message: string, { level = LogLevel.Debug, ...options } = {}) {
|
|
84
|
+
return log(message, { level, ...options });
|
|
85
|
+
},
|
|
86
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { BaseDirector, IBaseDirector } from '@unchainedshop/utils';
|
|
2
|
+
import {
|
|
3
|
+
QuotationError,
|
|
4
|
+
IQuotationAdapter,
|
|
5
|
+
QuotationAdapterActions,
|
|
6
|
+
QuotationContext,
|
|
7
|
+
} from './QuotationAdapter.js';
|
|
8
|
+
import { createLogger } from '@unchainedshop/logger';
|
|
9
|
+
|
|
10
|
+
const logger = createLogger('unchained:core');
|
|
11
|
+
|
|
12
|
+
export type IQuotationDirector = IBaseDirector<IQuotationAdapter> & {
|
|
13
|
+
actions: (quotationContext: QuotationContext, unchainedAPI) => Promise<QuotationAdapterActions>;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const baseDirector = BaseDirector<IQuotationAdapter>('QuotationDirector', {
|
|
17
|
+
adapterSortKey: 'orderIndex',
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const findAppropriateAdapters = (quotationContext: QuotationContext, unchainedAPI) =>
|
|
21
|
+
baseDirector.getAdapters({
|
|
22
|
+
adapterFilter: (Adapter: IQuotationAdapter) => {
|
|
23
|
+
const activated = Adapter.isActivatedFor(quotationContext, unchainedAPI);
|
|
24
|
+
if (!activated) {
|
|
25
|
+
logger.warn(`Quotation Director -> ${Adapter.key} (${Adapter.version}) skipped`);
|
|
26
|
+
}
|
|
27
|
+
return activated;
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export const QuotationDirector: IQuotationDirector = {
|
|
32
|
+
...baseDirector,
|
|
33
|
+
|
|
34
|
+
actions: async (quotationContext, unchainedAPI) => {
|
|
35
|
+
const context = { ...quotationContext, ...unchainedAPI };
|
|
36
|
+
|
|
37
|
+
const Adapter = findAppropriateAdapters(quotationContext, unchainedAPI)?.shift();
|
|
38
|
+
|
|
39
|
+
if (!Adapter) {
|
|
40
|
+
throw new Error('No suitable quotation plugin available for this context');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const adapter = Adapter.actions(context);
|
|
44
|
+
|
|
45
|
+
return {
|
|
46
|
+
configurationError: () => {
|
|
47
|
+
try {
|
|
48
|
+
return adapter.configurationError();
|
|
49
|
+
} catch (error) {
|
|
50
|
+
logger.warn('QuotationDirector -> Error while checking for configurationError', {
|
|
51
|
+
...error,
|
|
52
|
+
});
|
|
53
|
+
return QuotationError.ADAPTER_NOT_FOUND;
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
isManualRequestVerificationRequired: async () => {
|
|
58
|
+
try {
|
|
59
|
+
const isRequired = await adapter.isManualRequestVerificationRequired();
|
|
60
|
+
return isRequired;
|
|
61
|
+
} catch (error) {
|
|
62
|
+
logger.error(
|
|
63
|
+
'QuotationDirector -> Error while checking if is manual request verification required',
|
|
64
|
+
{
|
|
65
|
+
...error,
|
|
66
|
+
},
|
|
67
|
+
);
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
isManualProposalRequired: async () => {
|
|
73
|
+
try {
|
|
74
|
+
const isRequired = await adapter.isManualProposalRequired();
|
|
75
|
+
return isRequired;
|
|
76
|
+
} catch (error) {
|
|
77
|
+
logger.error('QuotationDirector -> Error while checking if is manual proposal required', {
|
|
78
|
+
...error,
|
|
79
|
+
});
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
quote: adapter.quote,
|
|
85
|
+
rejectRequest: adapter.rejectRequest,
|
|
86
|
+
submitRequest: adapter.submitRequest,
|
|
87
|
+
verifyRequest: adapter.verifyRequest,
|
|
88
|
+
|
|
89
|
+
transformItemConfiguration: async ({ quantity, configuration }) => {
|
|
90
|
+
try {
|
|
91
|
+
const itemConfiguration = await adapter.transformItemConfiguration({
|
|
92
|
+
quantity,
|
|
93
|
+
configuration,
|
|
94
|
+
});
|
|
95
|
+
return itemConfiguration;
|
|
96
|
+
} catch (error) {
|
|
97
|
+
logger.error('QuotationDirector -> Error while transforming item configuration', {
|
|
98
|
+
...error,
|
|
99
|
+
});
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
},
|
|
105
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { log, LogLevel } from '@unchainedshop/logger';
|
|
2
|
+
import { IBaseAdapter } from '@unchainedshop/utils';
|
|
3
|
+
import { DeliveryProvider } from '@unchainedshop/core-delivery';
|
|
4
|
+
import { Product } from '@unchainedshop/core-products';
|
|
5
|
+
import { Order, OrderPosition } from '@unchainedshop/core-orders';
|
|
6
|
+
import {
|
|
7
|
+
TokenSurrogate,
|
|
8
|
+
WarehousingConfiguration,
|
|
9
|
+
WarehousingProviderType,
|
|
10
|
+
} from '@unchainedshop/core-warehousing';
|
|
11
|
+
|
|
12
|
+
export enum WarehousingError {
|
|
13
|
+
ADAPTER_NOT_FOUND = 'ADAPTER_NOT_FOUND',
|
|
14
|
+
NOT_IMPLEMENTED = 'NOT_IMPLEMENTED',
|
|
15
|
+
INCOMPLETE_CONFIGURATION = 'INCOMPLETE_CONFIGURATION',
|
|
16
|
+
WRONG_CREDENTIALS = 'WRONG_CREDENTIALS',
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type WarehousingAdapterActions = {
|
|
20
|
+
configurationError: () => WarehousingError;
|
|
21
|
+
isActive: () => boolean;
|
|
22
|
+
stock: (referenceDate: Date) => Promise<number>;
|
|
23
|
+
productionTime: (quantityToProduce: number) => Promise<number>;
|
|
24
|
+
commissioningTime: (quantity: number) => Promise<number>;
|
|
25
|
+
tokenize: () => Promise<Array<Omit<TokenSurrogate, 'userId' | 'productId' | 'orderPositionId'>>>;
|
|
26
|
+
tokenMetadata: (chainTokenId: string, referenceDate: Date) => Promise<any>;
|
|
27
|
+
isInvalidateable: (chainTokenId: string, referenceDate: Date) => Promise<boolean>;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export interface WarehousingContext {
|
|
31
|
+
deliveryProvider?: DeliveryProvider;
|
|
32
|
+
product?: Product;
|
|
33
|
+
token?: TokenSurrogate;
|
|
34
|
+
quantity?: number;
|
|
35
|
+
referenceDate?: Date;
|
|
36
|
+
locale?: Intl.Locale;
|
|
37
|
+
order?: Order;
|
|
38
|
+
warehousingProviderId?: string;
|
|
39
|
+
orderPosition?: OrderPosition;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type IWarehousingAdapter = IBaseAdapter & {
|
|
43
|
+
orderIndex: number;
|
|
44
|
+
initialConfiguration: WarehousingConfiguration;
|
|
45
|
+
typeSupported: (type: WarehousingProviderType) => boolean;
|
|
46
|
+
|
|
47
|
+
actions: (config: WarehousingConfiguration, context: WarehousingContext) => WarehousingAdapterActions;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const WarehousingAdapter: Omit<IWarehousingAdapter, 'key' | 'label' | 'version'> = {
|
|
51
|
+
orderIndex: 0,
|
|
52
|
+
|
|
53
|
+
typeSupported: () => {
|
|
54
|
+
return false;
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
initialConfiguration: [],
|
|
58
|
+
|
|
59
|
+
actions: () => {
|
|
60
|
+
return {
|
|
61
|
+
configurationError: () => WarehousingError.NOT_IMPLEMENTED,
|
|
62
|
+
|
|
63
|
+
isActive: () => false,
|
|
64
|
+
|
|
65
|
+
stock: async () => 0,
|
|
66
|
+
|
|
67
|
+
productionTime: async () => 0,
|
|
68
|
+
|
|
69
|
+
commissioningTime: async () => 0,
|
|
70
|
+
|
|
71
|
+
tokenize: async () => [],
|
|
72
|
+
|
|
73
|
+
tokenMetadata: async () => ({}),
|
|
74
|
+
|
|
75
|
+
isInvalidateable: async () => true,
|
|
76
|
+
};
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
log(message, { level = LogLevel.Debug, ...options } = {}) {
|
|
80
|
+
// eslint-disable-line
|
|
81
|
+
return log(message, { level, ...options });
|
|
82
|
+
},
|
|
83
|
+
};
|