@evershop/evershop 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/build/client/index.js +1 -1
- package/bin/build/complie.js +1 -1
- package/bin/build/index.js +25 -1
- package/bin/build/server/index.js +1 -1
- package/bin/build/server/useDDL.js +1 -1
- package/bin/dev/index.js +2 -1
- package/bin/evershop +8 -7
- package/bin/extension/index.js +3 -3
- package/bin/install/index.js +1 -1
- package/bin/lib/addDefaultMiddlewareFuncs.js +9 -4
- package/bin/lib/app.js +1 -1
- package/bin/lib/bootstrap/migrate.js +1 -1
- package/bin/lib/buildEntry.js +16 -1
- package/bin/lib/onError.js +1 -1
- package/bin/lib/onListening.js +7 -4
- package/bin/lib/startUp.js +16 -9
- package/bin/lib/watch/watchComponents.js +16 -26
- package/bin/lib/watch/watchMF.js +1 -1
- package/bin/lib/watch/watchMR.js +1 -1
- package/bin/lib/watch/watchSchema.js +1 -1
- package/bin/user/changePassword.js +1 -1
- package/bin/user/create.js +1 -1
- package/package.json +10 -2
- package/src/components/admin/catalog/productEdit/category/CategoryItem.jsx +3 -8
- package/src/components/admin/catalog/productEdit/category/CategoryTree.jsx +15 -8
- package/src/components/admin/catalog/productEdit/category/CategoryTree.scss +10 -0
- package/src/components/admin/catalog/productEdit/variants/CreateVariant.jsx +2 -2
- package/src/components/admin/catalog/productEdit/variants/CreateVariantGroup.jsx +4 -9
- package/src/components/admin/catalog/productEdit/variants/EditVariant.jsx +1 -1
- package/src/components/admin/catalog/productEdit/variants/New.jsx +2 -2
- package/src/components/admin/catalog/productEdit/variants/Search.jsx +1 -1
- package/src/components/admin/catalog/productEdit/variants/SearchModal.jsx +1 -1
- package/src/components/admin/catalog/productEdit/variants/Variant.jsx +1 -1
- package/src/components/admin/catalog/productEdit/variants/VariantModal.jsx +68 -12
- package/src/components/admin/catalog/productEdit/variants/Variants.jsx +1 -1
- package/src/components/admin/catalog/productGrid/rows/ThumbnailRow.jsx +1 -1
- package/src/components/admin/checkout/shippingSetting/Method.jsx +130 -0
- package/src/components/admin/{oms → checkout}/shippingSetting/MethodForm.jsx +127 -16
- package/src/components/admin/{oms → checkout}/shippingSetting/Methods.jsx +5 -5
- package/src/components/admin/checkout/shippingSetting/PriceBasedPrice.jsx +101 -0
- package/src/components/admin/checkout/shippingSetting/WeightBasedPrice.jsx +101 -0
- package/src/components/admin/{oms → checkout}/shippingSetting/Zone.jsx +40 -10
- package/src/components/admin/{oms → checkout}/shippingSetting/ZoneForm.jsx +1 -1
- package/src/components/admin/{oms → checkout}/shippingSetting/Zones.jsx +6 -3
- package/src/components/admin/cms/Card.jsx +3 -3
- package/src/components/admin/cms/PageHeading.jsx +3 -3
- package/src/components/admin/cms/widget/WidgetTypes.jsx +28 -0
- package/src/components/admin/cms/widget/grid/WidgetTypeRow.jsx +29 -0
- package/src/components/admin/oms/orderEdit/items/ItemVariantOptions.jsx +1 -1
- package/src/components/admin/oms/orderEdit/items/Name.jsx +1 -1
- package/src/components/admin/oms/orderGrid/headers/OrderDateColumnHeader.jsx +1 -1
- package/src/components/admin/promotion/couponEdit/AttributeGroupSelector.jsx +8 -8
- package/src/components/admin/promotion/couponEdit/BuyXGetY.jsx +2 -2
- package/src/components/admin/promotion/couponEdit/CategorySelector.jsx +10 -10
- package/src/components/admin/promotion/couponEdit/CollectionSelector.jsx +8 -8
- package/src/components/admin/promotion/couponEdit/ProductSkuSelector.jsx +30 -9
- package/src/components/admin/promotion/couponEdit/RequireProducts.jsx +2 -2
- package/src/components/admin/promotion/couponEdit/Setting.jsx +1 -1
- package/src/components/admin/promotion/couponEdit/TargetProducts.jsx +4 -4
- package/src/components/admin/tax/taxSetting/Rate.jsx +6 -6
- package/src/components/admin/tax/taxSetting/RateForm.jsx +5 -5
- package/src/components/admin/tax/taxSetting/Rates.jsx +6 -6
- package/src/components/admin/tax/taxSetting/TaxClass.jsx +3 -3
- package/src/components/admin/tax/taxSetting/TaxClassForm.jsx +1 -1
- package/src/components/admin/widgets/BasicMenuSetting.jsx +614 -0
- package/src/components/admin/widgets/BasicMenuSetting.scss +19 -0
- package/src/components/admin/widgets/CollectionProductsSetting.jsx +203 -0
- package/src/components/admin/widgets/TextBlockSetting.jsx +70 -0
- package/src/components/common/Area.jsx +31 -8
- package/src/components/common/Badge.jsx +1 -1
- package/src/components/common/Editor.jsx +191 -0
- package/src/components/common/Notification.scss +1 -0
- package/src/components/common/SimplePagination.jsx +2 -2
- package/src/components/common/context/checkout.jsx +8 -14
- package/src/components/common/form/Field.jsx +1 -1
- package/src/components/common/form/Form.jsx +1 -1
- package/src/components/common/form/fields/Checkbox.jsx +1 -1
- package/src/components/common/form/fields/Ckeditor.jsx +11 -11
- package/src/components/common/form/fields/Editor.jsx +326 -0
- package/src/components/common/form/fields/Editor.scss +29 -0
- package/src/components/common/form/fields/Input.jsx +2 -1
- package/src/components/common/form/fields/Radio.jsx +1 -1
- package/src/components/common/form/fields/editor/FileBrowser.jsx +419 -0
- package/src/components/common/form/fields/editor/FileBrowser.scss +37 -0
- package/src/components/common/form/fields/editor/GetColumnClasses.jsx +14 -0
- package/src/components/common/form/fields/editor/GetRowClasses.jsx +18 -0
- package/src/components/common/form/fields/editor/RowTemplates.jsx +154 -0
- package/src/components/common/form/validator.js +6 -2
- package/src/components/common/grid/Pagination.jsx +4 -4
- package/src/components/common/grid/headers/Dummy.jsx +1 -1
- package/src/components/common/grid/headers/FromTo.jsx +1 -1
- package/src/components/common/grid/headers/Sortable.jsx +148 -0
- package/src/components/common/grid/rows/StatusRow.jsx +1 -1
- package/src/components/common/grid/rows/ThumbnailRow.jsx +1 -1
- package/src/components/common/list/Filter.jsx +83 -0
- package/src/components/common/list/Filter.scss +39 -0
- package/src/components/common/modal/Alert.jsx +1 -1
- package/src/components/common/modal/Modal.jsx +1 -1
- package/src/components/frontStore/catalog/categoryView/filter/AttributeFilter.jsx +21 -7
- package/src/components/frontStore/catalog/categoryView/filter/CategoryFilter.jsx +61 -53
- package/src/components/frontStore/catalog/categoryView/filter/CategoryFilter.scss +5 -0
- package/src/components/frontStore/catalog/categoryView/filter/PriceFilter.jsx +20 -11
- package/src/components/frontStore/catalog/product/list/List.jsx +4 -4
- package/src/components/frontStore/catalog/product/list/Pagination.jsx +1 -1
- package/src/components/frontStore/catalog/product/list/SortOptions.jsx +4 -2
- package/src/components/frontStore/catalog/product/list/Sorting.jsx +7 -7
- package/src/components/frontStore/catalog/product/list/item/Name.jsx +1 -1
- package/src/components/frontStore/checkout/cart/Empty.jsx +3 -3
- package/src/components/frontStore/checkout/cart/items/ItemOptions.jsx +1 -1
- package/src/components/frontStore/checkout/cart/items/ItemVariantOptions.jsx +1 -1
- package/src/components/frontStore/checkout/cart/items/Items.jsx +20 -21
- package/src/components/frontStore/checkout/cart/items/Items.scss +47 -0
- package/src/components/frontStore/checkout/cart/items/Quantity.jsx +154 -0
- package/src/components/frontStore/checkout/checkout/StepTitle.jsx +1 -1
- package/src/components/frontStore/checkout/checkout/payment/paymentStep/StepContent.jsx +13 -10
- package/src/components/frontStore/checkout/checkout/shipment/StepContent.jsx +1 -1
- package/src/components/frontStore/checkout/checkout/summary/Cart.jsx +10 -12
- package/src/components/frontStore/checkout/checkout/summary/Items.jsx +9 -9
- package/src/components/frontStore/checkout/checkout/summary/cart/Total.jsx +6 -6
- package/src/components/frontStore/checkout/success/summary/items/ItemOptions.jsx +1 -1
- package/src/components/frontStore/checkout/success/summary/items/Items.jsx +9 -6
- package/src/components/frontStore/checkout/success/summary/order/OrderSummary.jsx +9 -13
- package/src/components/frontStore/checkout/success/summary/order/Total.jsx +5 -5
- package/src/components/frontStore/customer/address/addressForm/AddressFormLoadingSkeleton.jsx +2 -2
- package/src/components/frontStore/customer/address/addressForm/NameAndTelephone.jsx +1 -1
- package/src/components/frontStore/customer/address/addressForm/ProvinceAndPostcode.jsx +1 -1
- package/src/components/frontStore/customer/checkout/Edit.jsx +2 -2
- package/src/components/frontStore/customer/detail/Order.jsx +4 -4
- package/src/components/frontStore/stripe/checkout/CheckoutForm.jsx +9 -5
- package/src/components/frontStore/stripe/checkout/TestCards.jsx +1 -1
- package/src/components/frontStore/widgets/BasicMenu.jsx +129 -0
- package/src/{modules/catalog/pages/frontStore/homepage/FeaturedProducts.jsx → components/frontStore/widgets/CollectionProducts.jsx} +40 -32
- package/src/components/frontStore/widgets/TextBlock.jsx +46 -0
- package/src/lib/componee/getComponentsByRoute.js +15 -2
- package/src/lib/event/callSubscibers.js +14 -11
- package/src/lib/event/event-manager.js +2 -2
- package/src/lib/event/loadSubscribers.js +2 -2
- package/src/lib/helpers.js +3 -1
- package/src/lib/log/CustomColorize.js +22 -0
- package/src/lib/log/logger.js +153 -19
- package/src/lib/middleware/Handler.js +2 -3
- package/src/lib/middleware/async.js +5 -9
- package/src/lib/middleware/sync.js +5 -10
- package/src/lib/middleware/tests/app/app.js +1 -1
- package/src/lib/middleware/tests/app/modules/404page/pages/frontStore/product/route.json +2 -1
- package/src/lib/middlewares/static.js +3 -1
- package/src/lib/response/render.js +5 -6
- package/src/lib/router/Router.js +1 -1
- package/src/lib/router/buildAbsoluteUrl.js +1 -1
- package/src/lib/router/loadModuleRoutes.js +3 -0
- package/src/lib/router/registerAdminRoute.js +9 -1
- package/src/lib/router/registerFrontStoreRoute.js +2 -0
- package/src/lib/router/scanForRoutes.js +1 -0
- package/src/lib/router/tests/unit/unit.validateRoute.test.js +7 -1
- package/src/lib/util/buildFilterFromUrl.js +31 -64
- package/src/lib/util/defaultPaginationFilters.js +104 -0
- package/src/lib/util/filterOperationMapp.js +16 -0
- package/src/lib/util/getEnabledWidgets.js +28 -0
- package/src/lib/util/merge.js +67 -14
- package/src/lib/util/registry.js +44 -6
- package/src/lib/util/tests/unit/util.merge.test.js +21 -4
- package/src/lib/util/validateConfiguration.js +83 -0
- package/src/lib/webpack/createBaseConfig.js +4 -1
- package/src/lib/webpack/dev/createConfigClient.js +12 -2
- package/src/lib/webpack/loaders/AreaLoader.js +15 -4
- package/src/lib/webpack/loaders/loadTranslationFromCsv.js +1 -1
- package/src/lib/webpack/plugins/Tailwindcss.js +1 -1
- package/src/lib/webpack/util/parseGraphql.js +29 -16
- package/src/lib/webpack/util/parseGraphqlByFile.js +16 -2
- package/src/modules/auth/graphql/types/AdminUser/AdminUser.admin.resolvers.js +6 -6
- package/src/modules/auth/pages/admin/adminLogin/LoginForm.jsx +55 -36
- package/src/modules/auth/pages/admin/all/AdminUser.jsx +3 -3
- package/src/modules/base/api/global/[apiResponse]apiErrorHandler.js +2 -2
- package/src/modules/base/bootstrap.js +79 -0
- package/src/modules/base/graphql/types/Route/Route.admin.graphql +15 -0
- package/src/modules/base/graphql/types/Route/Route.admin.resolvers.js +10 -0
- package/src/modules/base/pages/global/[response]errorHandler.js +2 -2
- package/src/modules/base/pages/global/response[errorHandler].js +23 -0
- package/src/modules/catalog/api/addProductToCategory/addProducts.js +1 -1
- package/src/modules/catalog/api/addProductToCollection/addProducts.js +35 -22
- package/src/modules/catalog/api/removeProductFromCollection/removeProducts.js +20 -5
- package/src/modules/catalog/bootstrap.js +188 -5
- package/src/modules/catalog/graphql/types/Attribute/Attribute.admin.graphql +2 -2
- package/src/modules/catalog/graphql/types/Attribute/Attribute.admin.resolvers.js +48 -276
- package/src/modules/catalog/graphql/types/Category/Category.graphql +19 -5
- package/src/modules/catalog/graphql/types/Category/Category.resolvers.js +36 -2
- package/src/modules/catalog/graphql/types/Collection/Collection.graphql +2 -2
- package/src/modules/catalog/graphql/types/Collection/Collection.resolvers.js +36 -2
- package/src/modules/catalog/graphql/types/Product/Attribute/ProductAttribute.resolvers.js +1 -0
- package/src/modules/catalog/graphql/types/Product/Product.graphql +1 -1
- package/src/modules/catalog/graphql/types/Product/Product.resolvers.js +35 -1
- package/src/modules/catalog/graphql/types/Product/Variant/Variant.graphql +2 -2
- package/src/modules/catalog/graphql/types/Product/Variant/Variant.resolvers.js +68 -92
- package/src/modules/catalog/graphql/types/Widget/CollectionProductsWidget/CollectionProductsWidget.graphql +11 -0
- package/src/modules/catalog/graphql/types/Widget/CollectionProductsWidget/CollectionProductsWidget.resolvers.js +8 -0
- package/src/modules/catalog/migration/Version-1.0.0.js +1 -0
- package/src/modules/catalog/migration/Version-1.0.7.js +10 -0
- package/src/modules/catalog/pages/admin/attributeEdit+attributeNew/FormContent.jsx +4 -4
- package/src/modules/catalog/pages/admin/attributeEdit+attributeNew/General.jsx +18 -14
- package/src/modules/catalog/pages/admin/attributeGrid/Grid.jsx +84 -41
- package/src/modules/catalog/pages/admin/attributeGrid/index.js +1 -1
- package/src/modules/catalog/pages/admin/categoryEdit/Products.jsx +9 -9
- package/src/modules/catalog/pages/admin/categoryEdit+categoryNew/FormContent.jsx +4 -4
- package/src/modules/catalog/pages/admin/categoryEdit+categoryNew/General.jsx +16 -18
- package/src/modules/catalog/pages/admin/categoryEdit+categoryNew/Image.jsx +1 -2
- package/src/modules/catalog/pages/admin/categoryEdit+categoryNew/Status.jsx +16 -1
- package/src/modules/catalog/pages/admin/categoryGrid/Grid.jsx +50 -18
- package/src/modules/catalog/pages/admin/categoryGrid/index.js +1 -1
- package/src/modules/catalog/pages/admin/collectionEdit/Products.jsx +9 -9
- package/src/modules/catalog/pages/admin/collectionEdit+collectionNew/FormContent.jsx +2 -2
- package/src/modules/catalog/pages/admin/collectionEdit+collectionNew/General.jsx +2 -2
- package/src/modules/catalog/pages/admin/collectionGrid/Grid.jsx +48 -7
- package/src/modules/catalog/pages/admin/collectionGrid/index.js +1 -1
- package/src/modules/catalog/pages/admin/productEdit/Collection.jsx +7 -7
- package/src/modules/catalog/pages/admin/productEdit+productNew/Attributes.jsx +29 -25
- package/src/modules/catalog/pages/admin/productEdit+productNew/CustomOptions.jsss +4 -4
- package/src/modules/catalog/pages/admin/productEdit+productNew/FormContent.jsx +4 -4
- package/src/modules/catalog/pages/admin/productEdit+productNew/General.jsx +15 -17
- package/src/modules/catalog/pages/admin/productGrid/Grid.jsx +160 -28
- package/src/modules/catalog/pages/admin/productGrid/index.js +1 -2
- package/src/modules/catalog/pages/frontStore/all/SearchBox.jsx +2 -1
- package/src/modules/catalog/pages/frontStore/catalogSearch/General.jsx +2 -2
- package/src/modules/catalog/pages/frontStore/catalogSearch/Products.jsx +1 -1
- package/src/modules/catalog/pages/frontStore/catalogSearch/[index]filters.js +4 -59
- package/src/modules/catalog/pages/frontStore/catalogSearch/index.js +11 -0
- package/src/modules/catalog/pages/frontStore/catalogSearch/route.json +2 -1
- package/src/modules/catalog/pages/frontStore/categoryView/CategoryView.jsx +19 -2
- package/src/modules/catalog/pages/frontStore/categoryView/Filter.jsx +22 -6
- package/src/modules/catalog/pages/frontStore/categoryView/Filter.scss +3 -0
- package/src/modules/catalog/pages/frontStore/categoryView/General.jsx +6 -8
- package/src/modules/catalog/pages/frontStore/categoryView/General.scss +0 -2
- package/src/modules/catalog/pages/frontStore/categoryView/Pagination.jsx +6 -0
- package/src/modules/catalog/pages/frontStore/categoryView/Products.jsx +8 -1
- package/src/modules/catalog/pages/frontStore/categoryView/[index]filters.js +5 -105
- package/src/modules/catalog/pages/frontStore/categoryView/route.json +2 -1
- package/src/modules/catalog/pages/frontStore/productView/Description.jsx +3 -3
- package/src/modules/catalog/pages/frontStore/productView/Form.jsx +12 -7
- package/src/modules/catalog/pages/frontStore/productView/Form.scss +1 -0
- package/src/modules/catalog/pages/frontStore/productView/GeneralInfo.jsx +1 -1
- package/src/modules/catalog/pages/frontStore/productView/Images.jsx +1 -1
- package/src/modules/catalog/pages/frontStore/productView/Layout.jsx +1 -1
- package/src/modules/catalog/pages/frontStore/productView/Options.jsx +2 -2
- package/src/modules/catalog/pages/frontStore/productView/Variants.jsx +106 -44
- package/src/modules/catalog/pages/frontStore/productView/route.json +2 -1
- package/src/modules/catalog/services/AttributeCollection.js +59 -0
- package/src/modules/catalog/services/AttributeGroupCollection.js +100 -0
- package/src/modules/catalog/services/CategoryCollection.js +26 -83
- package/src/modules/catalog/services/CollectionCollection.js +23 -71
- package/src/modules/catalog/services/ProductCollection.js +50 -216
- package/src/modules/catalog/services/attribute/deleteProductAttribute.js +15 -0
- package/src/modules/catalog/services/getAttributeGroupsBaseQuery.js +3 -0
- package/src/modules/catalog/services/getAttributesBaseQuery.js +3 -0
- package/src/modules/catalog/services/getCollectionsBaseQuery.js +0 -1
- package/src/modules/catalog/services/product/updateProduct.js +8 -2
- package/src/modules/catalog/services/registerCartItemProductUrlField.js +35 -0
- package/src/modules/catalog/services/registerCartItemVariantOptionsField.js +51 -0
- package/src/modules/catalog/services/registerDefaultAttributeCollectionFilters.js +149 -0
- package/src/modules/catalog/services/registerDefaultCategoryCollectionFilters.js +101 -0
- package/src/modules/catalog/services/registerDefaultCollectionCollectionFilters.js +65 -0
- package/src/modules/catalog/services/registerDefaultProductCollectionFilters.js +219 -0
- package/src/modules/catalog/subscribers/category_created/buildUrlRewrite.js +1 -1
- package/src/modules/catalog/subscribers/category_deleted/deleteUrlRewrite.js +1 -1
- package/src/modules/catalog/subscribers/category_updated/builUrlRewrite.js +1 -1
- package/src/modules/catalog/subscribers/product_created/builUrlRewrite.js +1 -1
- package/src/modules/catalog/subscribers/product_deleted/deleteUrlRewrite.js +1 -1
- package/src/modules/catalog/subscribers/product_image_added/localGenerateProductImageVariant.js +3 -3
- package/src/modules/checkout/api/addCartShippingMethod/saveShippingMethod.js +6 -1
- package/src/modules/checkout/api/addShippingNote/[context]bodyParser[auth].js +5 -0
- package/src/modules/checkout/api/addShippingNote/payloadSchema.json +15 -0
- package/src/modules/checkout/api/addShippingNote/route.json +5 -0
- package/src/modules/checkout/api/addShippingNote/saveShippingNote.js +50 -0
- package/src/modules/checkout/api/createCart/[context]bodyParser[auth].js +5 -0
- package/src/modules/checkout/api/createCart/createNewCart.js +119 -0
- package/src/modules/checkout/api/createCart/payloadSchema.json +44 -0
- package/src/modules/checkout/api/createCart/route.json +5 -0
- package/src/modules/checkout/api/deleteShippingZone/deleteShippingZone.js +58 -0
- package/src/modules/checkout/api/deleteShippingZone/route.json +5 -0
- package/src/modules/checkout/api/deleteShippingZoneMethod/deleteShippingZoneMethod.js +85 -0
- package/src/modules/checkout/api/deleteShippingZoneMethod/route.json +5 -0
- package/src/modules/checkout/api/getShippingMethods/sendMethods.js +37 -0
- package/src/modules/checkout/api/updateCartItemQty/[bodyParser]updateQty.js +49 -0
- package/src/modules/checkout/api/updateCartItemQty/[context]bodyParser[auth].js +5 -0
- package/src/modules/checkout/api/updateCartItemQty/payloadSchema.json +21 -0
- package/src/modules/checkout/api/updateCartItemQty/route.json +5 -0
- package/src/modules/checkout/api/updateMineCartItemQty/[context]bodyParser[auth].js +5 -0
- package/src/modules/checkout/api/updateMineCartItemQty/[detectCurrentCart]updateQty.js +51 -0
- package/src/modules/checkout/api/updateMineCartItemQty/[getCurrentCustomer]detectCurrentCart.js +32 -0
- package/src/modules/checkout/api/updateMineCartItemQty/payloadSchema.json +21 -0
- package/src/modules/checkout/api/updateMineCartItemQty/route.json +5 -0
- package/src/modules/checkout/api/updateShippingMethod/[context]borderParser[auth].js +5 -0
- package/src/modules/checkout/api/updateShippingMethod/payloadSchema.json +12 -0
- package/src/modules/checkout/api/updateShippingMethod/route.json +5 -0
- package/src/modules/checkout/api/updateShippingMethod/updateShippingMethod.js +64 -0
- package/src/modules/checkout/api/updateShippingZoneMethod/payloadSchema.json +43 -1
- package/src/modules/checkout/api/updateShippingZoneMethod/updateShippingZoneMethod.js +17 -3
- package/src/modules/checkout/bootstrap.js +28 -1
- package/src/modules/checkout/graphql/types/Cart/Cart.graphql +22 -3
- package/src/modules/checkout/graphql/types/Cart/Cart.resolvers.js +18 -2
- package/src/modules/checkout/graphql/types/CheckoutSetting/CheckoutSetting.graphql +3 -0
- package/src/modules/checkout/graphql/types/CheckoutSetting/CheckoutSetting.resolvers.js +7 -0
- package/src/modules/checkout/graphql/types/ShippingMethod/ShippingMethod.graphql +1 -0
- package/src/modules/checkout/graphql/types/ShippingMethod/ShippingMethod.resolvers.js +4 -0
- package/src/modules/checkout/graphql/types/ShippingZone/ShippingZone.graphql +21 -1
- package/src/modules/checkout/graphql/types/ShippingZone/ShippingZone.resolvers.js +34 -4
- package/src/modules/checkout/graphql/types/Weight/Weight.resolvers.js +8 -11
- package/src/modules/checkout/migration/Version-1.0.0.js +14 -0
- package/src/modules/checkout/migration/Version-1.0.5.js +28 -0
- package/src/modules/checkout/migration/Version-1.0.6.js +201 -0
- package/src/modules/{oms → checkout}/pages/admin/shippingSetting/ShippingSetting.jsx +67 -44
- package/src/modules/checkout/pages/frontStore/all/[auth]addCustomerToCart.js +3 -3
- package/src/modules/checkout/pages/frontStore/all/[context]detectCurrentCart[auth].js +5 -0
- package/src/modules/checkout/pages/frontStore/cart/ShoppingCart.jsx +17 -8
- package/src/modules/checkout/pages/frontStore/cart/Summary.jsx +18 -19
- package/src/modules/checkout/pages/frontStore/cart/route.json +2 -1
- package/src/modules/checkout/pages/frontStore/checkout/Checkout.jsx +5 -5
- package/src/modules/checkout/pages/frontStore/checkout/Checkout.scss +4 -0
- package/src/modules/checkout/pages/frontStore/checkout/PaymentStep.jsx +3 -2
- package/src/modules/checkout/pages/frontStore/checkout/ShippingMethods.jsx +25 -12
- package/src/modules/checkout/pages/frontStore/checkout/ShippingNote.jsx +105 -0
- package/src/modules/checkout/pages/frontStore/checkout/Summary.jsx +14 -14
- package/src/modules/checkout/pages/frontStore/checkout/SummaryMobile.jsx +129 -0
- package/src/modules/checkout/pages/frontStore/checkout/SummaryMobile.scss +7 -0
- package/src/modules/checkout/pages/frontStore/checkout/route.json +2 -1
- package/src/modules/checkout/pages/frontStore/checkoutSuccess/CheckoutSuccess.jsx +1 -1
- package/src/modules/checkout/pages/frontStore/checkoutSuccess/CheckoutSuccess.scss +4 -0
- package/src/modules/checkout/pages/frontStore/checkoutSuccess/CustomerInfo.jsx +30 -32
- package/src/modules/checkout/pages/frontStore/checkoutSuccess/ShippingNote.jsx +47 -0
- package/src/modules/checkout/pages/frontStore/checkoutSuccess/Summary.jsx +12 -15
- package/src/modules/checkout/pages/frontStore/checkoutSuccess/route.json +2 -1
- package/src/modules/checkout/services/cart/Cart.js +41 -21
- package/src/modules/checkout/services/cart/DataObject.js +3 -3
- package/src/modules/checkout/services/cart/registerCartBaseFields.js +165 -41
- package/src/modules/checkout/services/cart/registerCartItemBaseFields.js +300 -373
- package/src/modules/checkout/services/toPrice.js +1 -1
- package/src/modules/checkout/tests/basicSetup.js +85 -0
- package/src/modules/checkout/tests/coupons.js +82 -0
- package/src/modules/checkout/tests/products.js +67 -0
- package/src/modules/checkout/tests/taxRates.js +3 -0
- package/src/modules/checkout/tests/unit/discountAmount.test.js +60 -0
- package/src/modules/checkout/tests/unit/grandTotal.test.js +83 -0
- package/src/modules/checkout/tests/unit/lineTotal.test.js +90 -0
- package/src/modules/checkout/tests/unit/lineTotalWithDiscount.test.js +103 -0
- package/src/modules/checkout/tests/unit/productPrice.test.js +67 -0
- package/src/modules/checkout/tests/unit/subTotal.test.js +85 -0
- package/src/modules/checkout/tests/unit/subTotalWithDiscount.test.js +117 -0
- package/src/modules/checkout/tests/unit/taxAmount.test.js +67 -0
- package/src/modules/checkout/tests/unit/taxAmountRounding.test.js +277 -0
- package/src/modules/cms/api/createWidget/[context]bodyParser[auth].js +5 -0
- package/src/modules/cms/api/createWidget/createWidget[finish].js +17 -0
- package/src/modules/cms/api/createWidget/finish[apiResponse].js +27 -0
- package/src/modules/cms/api/createWidget/payloadSchema.json +18 -0
- package/src/modules/cms/api/createWidget/route.json +5 -0
- package/src/modules/cms/api/deleteWidget/deleteWidget.js +27 -0
- package/src/modules/cms/api/deleteWidget/route.json +5 -0
- package/src/modules/cms/api/updateWidget/[context]bodyParser[auth].js +5 -0
- package/src/modules/cms/api/updateWidget/finish[apiResponse].js +27 -0
- package/src/modules/cms/api/updateWidget/payloadSchema.json +18 -0
- package/src/modules/cms/api/updateWidget/route.json +5 -0
- package/src/modules/cms/api/updateWidget/updateWidget[finish].js +17 -0
- package/src/modules/cms/bootstrap.js +239 -2
- package/src/modules/cms/graphql/types/CmsPage/CmsPage.graphql +1 -2
- package/src/modules/cms/graphql/types/CmsPage/CmsPage.resolvers.js +37 -12
- package/src/modules/cms/graphql/types/Widget/Widget.graphql +91 -0
- package/src/modules/cms/graphql/types/Widget/Widget.resolvers.js +142 -0
- package/src/modules/cms/migration/Version-1.1.0.js +22 -0
- package/src/modules/cms/migration/Version-1.1.1.js +103 -0
- package/src/modules/cms/pages/admin/adminNotFound/NotFound.jsx +4 -4
- package/src/modules/cms/pages/admin/all/CmsMenuGroup.jsx +12 -4
- package/src/modules/cms/pages/admin/all/Layout.scss +3 -2
- package/src/modules/cms/pages/admin/all/Notification.scss +1 -1
- package/src/modules/cms/pages/admin/all/SearchBox.jsx +1 -1
- package/src/modules/cms/pages/admin/all/search/NoResult.jsx +2 -2
- package/src/modules/cms/pages/admin/all/search/Results.jsx +3 -3
- package/src/modules/cms/pages/admin/cmsPageEdit+cmsPageNew/FormContent.jsx +7 -9
- package/src/modules/cms/pages/admin/cmsPageEdit+cmsPageNew/General.jsx +3 -3
- package/src/modules/cms/pages/admin/cmsPageEdit+cmsPageNew/Seo.jsx +1 -1
- package/src/modules/cms/pages/admin/cmsPageEdit+cmsPageNew/Status.jsx +40 -0
- package/src/modules/cms/pages/admin/cmsPageGrid/Grid.jsx +64 -12
- package/src/modules/cms/pages/admin/cmsPageGrid/index.js +1 -2
- package/src/modules/cms/pages/admin/dashboard/Layout.jsx +3 -3
- package/src/modules/cms/pages/admin/widgetEdit/WidgetForm.jsx +52 -0
- package/src/modules/cms/pages/admin/widgetEdit/index.js +36 -0
- package/src/modules/cms/pages/admin/widgetEdit/route.json +4 -0
- package/src/modules/cms/pages/admin/widgetEdit+widgetNew/FormContent.jsx +69 -0
- package/src/modules/cms/pages/admin/widgetEdit+widgetNew/FormContent.scss +7 -0
- package/src/modules/cms/pages/admin/widgetEdit+widgetNew/General.jsx +185 -0
- package/src/modules/cms/pages/admin/widgetEdit+widgetNew/PageHeading.jsx +37 -0
- package/src/modules/cms/pages/admin/widgetEdit+widgetNew/Setting.jsx +55 -0
- package/src/modules/cms/pages/admin/widgetGrid/Grid.jsx +415 -0
- package/src/modules/cms/pages/admin/widgetGrid/Heading.jsx +11 -0
- package/src/modules/cms/pages/admin/widgetGrid/NewWidgetButton.jsx +52 -0
- package/src/modules/cms/pages/admin/widgetGrid/index.js +15 -0
- package/src/modules/cms/pages/admin/widgetGrid/route.json +4 -0
- package/src/modules/cms/pages/admin/widgetNew/WidgetNewForm.jsx +60 -0
- package/src/modules/cms/pages/admin/widgetNew/index.js +11 -0
- package/src/modules/cms/pages/admin/widgetNew/route.json +4 -0
- package/src/modules/cms/pages/admin/widgetNew/typeValidate.js +21 -0
- package/src/modules/cms/pages/frontStore/all/Breadcrumb.jsx +1 -1
- package/src/modules/cms/pages/frontStore/all/Footer.jsx +2 -2
- package/src/modules/cms/pages/frontStore/all/Layout.jsx +3 -3
- package/src/modules/cms/pages/frontStore/all/Layout.scss +13 -0
- package/src/modules/cms/pages/frontStore/all/Logo.jsx +2 -2
- package/src/modules/cms/pages/frontStore/all/Logo.scss +2 -4
- package/src/modules/cms/pages/frontStore/all/Notification.scss +1 -1
- package/src/modules/cms/pages/frontStore/cmsPageView/Layout.jsx +2 -2
- package/src/modules/cms/pages/frontStore/cmsPageView/View.jsx +5 -3
- package/src/modules/cms/pages/frontStore/cmsPageView/index.js +6 -12
- package/src/modules/cms/pages/frontStore/cmsPageView/route.json +2 -1
- package/src/modules/cms/pages/frontStore/homepage/route.json +2 -1
- package/src/modules/cms/pages/frontStore/notFound/NotFound.jsx +4 -4
- package/src/modules/cms/pages/frontStore/notFound/route.json +2 -1
- package/src/modules/cms/pages/frontStore/staticAsset/[context]staticAssets[auth].js +1 -1
- package/src/modules/cms/services/CMSPageCollection.js +23 -70
- package/src/modules/cms/services/WidgetCollection.js +62 -0
- package/src/modules/cms/services/getWidgetsBaseQuery.js +7 -0
- package/src/modules/cms/services/page/createPage.js +1 -2
- package/src/modules/cms/services/page/pageDataSchema.json +0 -4
- package/src/modules/cms/services/registerDefaultPageCollectionFilters.js +62 -0
- package/src/modules/cms/services/registerDefaultWidgetCollectionFilters.js +62 -0
- package/src/modules/cms/services/tailwind.admin.config.js +22 -102
- package/src/modules/cms/services/tailwind.frontStore.config.js +23 -108
- package/src/modules/cms/services/widget/createWidget.js +73 -0
- package/src/modules/cms/services/widget/deleteWidget.js +49 -0
- package/src/modules/cms/services/widget/loadWidgetInstances.js +54 -0
- package/src/modules/cms/services/widget/updateWidget.js +86 -0
- package/src/modules/cms/services/widget/widgetDataSchema.json +29 -0
- package/src/modules/cod/pages/admin/paymentSetting/CODSetting.jsx +2 -2
- package/src/modules/cod/pages/frontStore/checkout/CashOnDelivery.jsx +1 -1
- package/src/modules/customer/api/createCustomer/[bodyParser]createCustomer.js +2 -2
- package/src/modules/customer/api/resetPassword/[bodyParser]resetPassword.js +2 -2
- package/src/modules/customer/api/updatePassword/[bodyParser]updatePassword.js +2 -2
- package/src/modules/customer/bootstrap.js +50 -4
- package/src/modules/customer/graphql/types/Customer/Customer.admin.resolvers.js +2 -4
- package/src/modules/customer/pages/admin/customerEdit/CustomerEditForm.jsx +3 -3
- package/src/modules/customer/pages/admin/customerEdit+customerNew/OrderHistory.jsx +1 -1
- package/src/modules/customer/pages/admin/customerGrid/Grid.jsx +110 -16
- package/src/modules/customer/pages/admin/customerGrid/index.js +1 -2
- package/src/modules/customer/pages/frontStore/account/AccountDetails.jsx +3 -3
- package/src/modules/customer/pages/frontStore/account/Layout.jsx +3 -3
- package/src/modules/customer/pages/frontStore/account/OrderHistory.jsx +1 -1
- package/src/modules/customer/pages/frontStore/account/route.json +2 -1
- package/src/modules/customer/pages/frontStore/login/LoginForm.jsx +2 -3
- package/src/modules/customer/pages/frontStore/login/route.json +2 -1
- package/src/modules/customer/pages/frontStore/register/RegisterForm.jsx +2 -2
- package/src/modules/customer/pages/frontStore/register/route.json +2 -1
- package/src/modules/customer/pages/frontStore/resetPasswordPage/ResetPasswordForm.jsx +2 -2
- package/src/modules/customer/pages/frontStore/resetPasswordPage/route.json +2 -1
- package/src/modules/customer/pages/frontStore/updatePasswordPage/UpdatePasswordForm.jsx +3 -3
- package/src/modules/customer/pages/frontStore/updatePasswordPage/route.json +2 -1
- package/src/modules/customer/services/CustomerCollection.js +22 -103
- package/src/modules/customer/services/CustomerGroupCollection.js +20 -69
- package/src/modules/customer/services/registerDefaultCustomerCollectionFilters.js +90 -0
- package/src/modules/customer/services/registerDefaultCustomerGroupCollectionFilters.js +50 -0
- package/src/modules/graphql/pages/global/[bodyParser]buildQuery[graphql].js +239 -7
- package/src/modules/graphql/pages/global/[buildQuery]graphql[notification].js +13 -9
- package/src/modules/graphql/services/graphqlMiddleware.js +1 -1
- package/src/modules/oms/bootstrap.js +104 -3
- package/src/modules/oms/graphql/types/Order/Order.admin.resolvers.js +1 -1
- package/src/modules/oms/graphql/types/Order/Order.graphql +11 -2
- package/src/modules/oms/graphql/types/Order/Order.resolvers.js +9 -2
- package/src/modules/oms/pages/admin/dashboard/Bestsellers.jsx +2 -2
- package/src/modules/oms/pages/admin/dashboard/Lifetimesales.jsx +5 -5
- package/src/modules/oms/pages/admin/orderEdit/AddTrackingButton.jsx +1 -1
- package/src/modules/oms/pages/admin/orderEdit/Items.jsx +7 -7
- package/src/modules/oms/pages/admin/orderEdit/Layout.jsx +3 -3
- package/src/modules/oms/pages/admin/orderEdit/Payment.jsx +6 -6
- package/src/modules/oms/pages/admin/orderEdit/ShipButton.jsx +1 -1
- package/src/modules/oms/pages/admin/orderGrid/Grid.jsx +154 -53
- package/src/modules/oms/pages/admin/orderGrid/index.js +1 -2
- package/src/modules/oms/services/OrderCollection.js +18 -138
- package/src/modules/oms/services/registerDefaultOrderCollectionFilters.js +121 -0
- package/src/modules/paypal/api/paypalCreateOrder/[bodyParser]createOrder.js +55 -24
- package/src/modules/paypal/pages/admin/paymentSetting/PaypalSetting.jsx +6 -6
- package/src/modules/paypal/pages/frontStore/checkout/Paypal.jsx +3 -4
- package/src/modules/promotion/bootstrap.js +35 -101
- package/src/modules/promotion/graphql/types/Coupon/Coupon.admin.resolvers.js +2 -7
- package/src/modules/promotion/pages/admin/couponEdit+couponNew/DiscountType.jsx +1 -1
- package/src/modules/promotion/pages/admin/couponEdit+couponNew/FormContent.jsx +5 -5
- package/src/modules/promotion/pages/admin/couponGrid/Grid.jsx +159 -35
- package/src/modules/promotion/pages/admin/couponGrid/index.js +1 -2
- package/src/modules/promotion/pages/frontStore/cart/Coupon.jsx +2 -2
- package/src/modules/promotion/services/CouponCollection.js +21 -130
- package/src/modules/promotion/services/couponValidator.js +4 -7
- package/src/modules/promotion/services/discountCalculator.js +2 -7
- package/src/modules/promotion/services/registerCartItemPromotionFields.js +80 -0
- package/src/modules/promotion/services/registerCartPromotionFields.js +128 -0
- package/src/modules/promotion/services/registerDefaultCalculators.js +48 -20
- package/src/modules/promotion/services/registerDefaultCouponCollectionFilters.js +72 -0
- package/src/modules/promotion/services/registerDefaultValidators.js +16 -4
- package/src/modules/setting/pages/admin/paymentSetting/PaymentSetting.jsx +2 -2
- package/src/modules/setting/pages/admin/storeSetting/StoreSetting.jsx +98 -35
- package/src/modules/stripe/api/stripeWebHook/[bodyJson]webhook.js +4 -2
- package/src/modules/stripe/pages/admin/paymentSetting/StripePayment.jsx +5 -5
- package/src/modules/stripe/pages/frontStore/checkout/Stripe.jsx +1 -1
- package/src/modules/tax/bootstrap.js +57 -5
- package/src/modules/tax/graphql/types/Product/Price/ProductPrice.resolvers.js +6 -39
- package/src/modules/tax/graphql/types/TaxSetting/TaxSetting.graphql +1 -2
- package/src/modules/tax/graphql/types/TaxSetting/TaxSetting.resolvers.js +1 -8
- package/src/modules/tax/pages/admin/taxSetting/TaxSetting.jsx +4 -4
- package/src/modules/tax/services/TaxClassCollection.js +22 -56
- package/src/modules/tax/services/calculateTaxAmount.js +12 -9
- package/src/modules/tax/services/registerCartItemTaxPercentField.js +76 -0
- package/src/modules/tax/services/registerDefaultTaxClassCollectionFilters.js +49 -0
- package/src/components/admin/oms/shippingSetting/Method.jsx +0 -73
- package/src/components/common/grid/headers/Basic.jsx +0 -55
- package/src/lib/log/debuger.js +0 -89
- package/src/modules/auth/services/adminSessionMiddleware.js +0 -0
- package/src/modules/catalog/pages/frontStore/homepage/FeaturedCategories.jsx +0 -58
- package/src/modules/cms/pages/admin/cmsPageEdit+cmsPageNew/StatusAndLayout.jsx +0 -61
- package/src/modules/cms/pages/frontStore/all/Menu.jsx +0 -46
- package/src/modules/cms/pages/frontStore/all/Menu.scss +0 -7
- package/src/modules/cms/pages/frontStore/all/MobileMenu.jsx +0 -73
- package/src/modules/cms/pages/frontStore/all/MobileMenu.scss +0 -35
- package/src/modules/cms/pages/frontStore/homepage/MainBanner.jsx +0 -31
- package/src/modules/cms/pages/frontStore/homepage/MainBanner.scss +0 -48
- package/src/modules/customer/pages/frontStore/login/LoginButton.jsx +0 -27
- /package/src/modules/{oms → checkout}/pages/admin/all/ShippingSettingMenu.jsx +0 -0
- /package/src/modules/{oms → checkout}/pages/admin/shippingSetting/index.js +0 -0
- /package/src/modules/{oms → checkout}/pages/admin/shippingSetting/route.json +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const { error } = require('../../lib/log/
|
|
1
|
+
const { error } = require('../../lib/log/logger');
|
|
2
2
|
const { addProcessor, addFinalProcessor } = require('../../lib/util/registry');
|
|
3
3
|
const { sortFields } = require('./services/cart/sortFields');
|
|
4
4
|
const {
|
|
@@ -8,6 +8,11 @@ const {
|
|
|
8
8
|
const {
|
|
9
9
|
registerCartItemBaseFields
|
|
10
10
|
} = require('./services/cart/registerCartItemBaseFields');
|
|
11
|
+
const {
|
|
12
|
+
getProductsBaseQuery
|
|
13
|
+
} = require('../catalog/services/getProductsBaseQuery');
|
|
14
|
+
const { pool } = require('../../lib/postgres/connection');
|
|
15
|
+
const { merge } = require('../../lib/util/merge');
|
|
11
16
|
|
|
12
17
|
module.exports = () => {
|
|
13
18
|
addProcessor('cartFields', registerCartBaseFields, 0);
|
|
@@ -33,4 +38,26 @@ module.exports = () => {
|
|
|
33
38
|
throw e;
|
|
34
39
|
}
|
|
35
40
|
});
|
|
41
|
+
|
|
42
|
+
addProcessor('cartItemProductLoaderFunction', () => async (id) => {
|
|
43
|
+
const productQuery = getProductsBaseQuery();
|
|
44
|
+
const product = await productQuery.where('product_id', '=', id).load(pool);
|
|
45
|
+
return product;
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
addProcessor('configuratonSchema', (schema) => {
|
|
49
|
+
merge(schema, {
|
|
50
|
+
properties: {
|
|
51
|
+
checkout: {
|
|
52
|
+
type: 'object',
|
|
53
|
+
properties: {
|
|
54
|
+
showShippingNote: {
|
|
55
|
+
type: 'boolean'
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
return schema;
|
|
62
|
+
});
|
|
36
63
|
};
|
|
@@ -15,9 +15,12 @@ interface ShoppingCart {
|
|
|
15
15
|
shippingFeeInclTax: Price!
|
|
16
16
|
discountAmount: Price!
|
|
17
17
|
subTotal: Price!
|
|
18
|
+
subTotalWithDiscount: Price!
|
|
19
|
+
subTotalWithDiscountInclTax: Price!
|
|
18
20
|
totalQty: Int!
|
|
19
21
|
totalWeight: Weight!
|
|
20
22
|
taxAmount: Price!
|
|
23
|
+
taxAmountBeforeDiscount: Price!
|
|
21
24
|
grandTotal: Price!
|
|
22
25
|
shippingMethod: String
|
|
23
26
|
shippingMethodName: String
|
|
@@ -44,8 +47,12 @@ interface ShoppingCartItem {
|
|
|
44
47
|
finalPriceInclTax: Price!
|
|
45
48
|
taxPercent: Float!
|
|
46
49
|
taxAmount: Price!
|
|
50
|
+
taxAmountBeforeDiscount: Price!
|
|
47
51
|
discountAmount: Price!
|
|
48
|
-
|
|
52
|
+
lineTotal: Price!
|
|
53
|
+
lineTotalWithDiscount: Price!
|
|
54
|
+
lineTotalWithDiscountInclTax: Price!
|
|
55
|
+
lineTotalInclTax: Price!
|
|
49
56
|
variantGroupId: Int
|
|
50
57
|
variantOptions: String
|
|
51
58
|
productCustomOptions: String
|
|
@@ -90,6 +97,7 @@ type CartItem implements ShoppingCartItem {
|
|
|
90
97
|
uuid: String!
|
|
91
98
|
cartId: ID!
|
|
92
99
|
removeApi: String!
|
|
100
|
+
updateQtyApi: String!
|
|
93
101
|
productId: ID!
|
|
94
102
|
productSku: String!
|
|
95
103
|
productName: String
|
|
@@ -102,9 +110,14 @@ type CartItem implements ShoppingCartItem {
|
|
|
102
110
|
finalPriceInclTax: Price!
|
|
103
111
|
taxPercent: Float!
|
|
104
112
|
taxAmount: Price!
|
|
113
|
+
taxAmountBeforeDiscount: Price!
|
|
105
114
|
discountAmount: Price!
|
|
106
|
-
|
|
107
|
-
|
|
115
|
+
lineTotal: Price!
|
|
116
|
+
subTotal: Price! # Deprecated, this field is equivalent to lineTotal
|
|
117
|
+
lineTotalWithDiscount: Price!
|
|
118
|
+
lineTotalWithDiscountInclTax: Price!
|
|
119
|
+
lineTotalInclTax: Price!
|
|
120
|
+
total: Price! # Deprecated, this field is equivalent to lineTotalInclTax
|
|
108
121
|
variantGroupId: Int
|
|
109
122
|
variantOptions: String
|
|
110
123
|
productCustomOptions: String
|
|
@@ -132,12 +145,17 @@ type Cart implements ShoppingCart {
|
|
|
132
145
|
coupon: String
|
|
133
146
|
shippingFeeExclTax: Price!
|
|
134
147
|
shippingFeeInclTax: Price!
|
|
148
|
+
shippingTaxAmount: Price!
|
|
135
149
|
discountAmount: Price!
|
|
136
150
|
subTotal: Price!
|
|
137
151
|
subTotalInclTax: Price!
|
|
152
|
+
subTotalWithDiscount: Price!
|
|
153
|
+
subTotalWithDiscountInclTax: Price!
|
|
138
154
|
totalQty: Int!
|
|
139
155
|
totalWeight: Weight!
|
|
140
156
|
taxAmount: Price!
|
|
157
|
+
taxAmountBeforeDiscount: Price!
|
|
158
|
+
totalTaxAmount: Price!
|
|
141
159
|
grandTotal: Price!
|
|
142
160
|
shippingMethod: String
|
|
143
161
|
shippingMethodName: String
|
|
@@ -149,6 +167,7 @@ type Cart implements ShoppingCart {
|
|
|
149
167
|
addShippingMethodApi: String!
|
|
150
168
|
addContactInfoApi: String!
|
|
151
169
|
addAddressApi: String!
|
|
170
|
+
addNoteApi: String!
|
|
152
171
|
}
|
|
153
172
|
|
|
154
173
|
extend type Query {
|
|
@@ -19,7 +19,14 @@ module.exports = {
|
|
|
19
19
|
const items = cart.items || [];
|
|
20
20
|
return items.map((item) => ({
|
|
21
21
|
...camelCase(item),
|
|
22
|
-
removeApi: buildUrl('
|
|
22
|
+
removeApi: buildUrl('removeCartItem', {
|
|
23
|
+
item_id: item.uuid,
|
|
24
|
+
cart_id: cart.uuid
|
|
25
|
+
}),
|
|
26
|
+
updateQtyApi: buildUrl('updateCartItemQty', {
|
|
27
|
+
cart_id: cart.uuid,
|
|
28
|
+
item_id: item.uuid
|
|
29
|
+
})
|
|
23
30
|
}));
|
|
24
31
|
},
|
|
25
32
|
shippingAddress: async ({ shippingAddressId }, _, { pool }) => {
|
|
@@ -43,6 +50,15 @@ module.exports = {
|
|
|
43
50
|
buildUrl('addCartShippingMethod', { cart_id: cart.uuid }),
|
|
44
51
|
addContactInfoApi: (cart) =>
|
|
45
52
|
buildUrl('addCartContactInfo', { cart_id: cart.uuid }),
|
|
46
|
-
addAddressApi: (cart) => buildUrl('addCartAddress', { cart_id: cart.uuid })
|
|
53
|
+
addAddressApi: (cart) => buildUrl('addCartAddress', { cart_id: cart.uuid }),
|
|
54
|
+
addNoteApi: (cart) => buildUrl('addShippingNote', { cart_id: cart.uuid })
|
|
55
|
+
},
|
|
56
|
+
CartItem: {
|
|
57
|
+
total: ({ lineTotalInclTax }) =>
|
|
58
|
+
// This field is deprecated, use lineTotalInclTax instead
|
|
59
|
+
lineTotalInclTax,
|
|
60
|
+
subTotal: ({ lineTotal }) =>
|
|
61
|
+
// This field is deprecated, use lineTotal instead
|
|
62
|
+
lineTotal
|
|
47
63
|
}
|
|
48
64
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const { select } = require('@evershop/postgres-query-builder');
|
|
2
2
|
const { pool } = require('@evershop/evershop/src/lib/postgres/connection');
|
|
3
3
|
const { camelCase } = require('@evershop/evershop/src/lib/util/camelCase');
|
|
4
|
+
const { buildUrl } = require('@evershop/evershop/src/lib/router/buildUrl');
|
|
4
5
|
|
|
5
6
|
module.exports = {
|
|
6
7
|
Query: {
|
|
@@ -11,5 +12,8 @@ module.exports = {
|
|
|
11
12
|
.execute(pool);
|
|
12
13
|
return shippingMethods.map((row) => camelCase(row));
|
|
13
14
|
}
|
|
15
|
+
},
|
|
16
|
+
ShippingMethod: {
|
|
17
|
+
updateApi: ({ uuid }) => buildUrl('updateShippingMethod', { id: uuid })
|
|
14
18
|
}
|
|
15
19
|
};
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Represents a price based cost
|
|
3
|
+
"""
|
|
4
|
+
type PriceBasedCostItem {
|
|
5
|
+
minPrice: Price!
|
|
6
|
+
cost: Price!
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
"""
|
|
10
|
+
Represents a weight based cost
|
|
11
|
+
"""
|
|
12
|
+
type WeightBasedCostItem {
|
|
13
|
+
minWeight: Price!
|
|
14
|
+
cost: Price!
|
|
15
|
+
}
|
|
16
|
+
|
|
1
17
|
"""
|
|
2
18
|
Represents a shipping method.
|
|
3
19
|
"""
|
|
@@ -7,12 +23,15 @@ type ShippingMethodByZone {
|
|
|
7
23
|
uuid: String!
|
|
8
24
|
name: String!
|
|
9
25
|
cost: Price
|
|
26
|
+
priceBasedCost: [PriceBasedCostItem]
|
|
27
|
+
weightBasedCost: [WeightBasedCostItem]
|
|
10
28
|
isEnabled: Boolean!
|
|
11
29
|
calculateApi: String
|
|
12
30
|
conditionType: String
|
|
13
31
|
max: Float
|
|
14
32
|
min: Float
|
|
15
33
|
updateApi: String!
|
|
34
|
+
deleteApi: String!
|
|
16
35
|
}
|
|
17
36
|
|
|
18
37
|
"""
|
|
@@ -22,10 +41,11 @@ type ShippingZone {
|
|
|
22
41
|
shipping_zone_id: Int!
|
|
23
42
|
uuid: String!
|
|
24
43
|
name: String!
|
|
25
|
-
country: Country
|
|
44
|
+
country: Country
|
|
26
45
|
provinces: [Province]
|
|
27
46
|
methods: [ShippingMethodByZone]
|
|
28
47
|
updateApi: String!
|
|
48
|
+
deleteApi: String!
|
|
29
49
|
addMethodApi: String!
|
|
30
50
|
removeMethodApi: String!
|
|
31
51
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const { select } = require('@evershop/postgres-query-builder');
|
|
2
|
+
const { contries } = require('@evershop/evershop/src/lib/locale/countries');
|
|
2
3
|
const { pool } = require('@evershop/evershop/src/lib/postgres/connection');
|
|
3
4
|
const { camelCase } = require('@evershop/evershop/src/lib/util/camelCase');
|
|
4
5
|
const { buildUrl } = require('@evershop/evershop/src/lib/router/buildUrl');
|
|
@@ -36,6 +37,18 @@ module.exports = {
|
|
|
36
37
|
const methods = await query.execute(pool);
|
|
37
38
|
return methods.map((row) => camelCase(row));
|
|
38
39
|
},
|
|
40
|
+
country: ({ country }) => {
|
|
41
|
+
if (!country) {
|
|
42
|
+
return null;
|
|
43
|
+
} else {
|
|
44
|
+
const c = contries.find((p) => p.code === country);
|
|
45
|
+
if (c) {
|
|
46
|
+
return c;
|
|
47
|
+
} else {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
39
52
|
provinces: async ({ shippingZoneId }) => {
|
|
40
53
|
const provinces = await select('province')
|
|
41
54
|
.from('shipping_zone_province')
|
|
@@ -43,10 +56,10 @@ module.exports = {
|
|
|
43
56
|
.execute(pool);
|
|
44
57
|
return provinces.map((row) => row.province);
|
|
45
58
|
},
|
|
46
|
-
updateApi:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
removeMethodApi:
|
|
59
|
+
updateApi: ({ uuid }) => buildUrl('updateShippingZone', { id: uuid }),
|
|
60
|
+
deleteApi: ({ uuid }) => buildUrl('deleteShippingZone', { id: uuid }),
|
|
61
|
+
addMethodApi: ({ uuid }) => buildUrl('addShippingZoneMethod', { id: uuid }),
|
|
62
|
+
removeMethodApi: ({ uuid }) =>
|
|
50
63
|
buildUrl('removeShippingZoneMethod', { id: uuid })
|
|
51
64
|
},
|
|
52
65
|
ShippingMethodByZone: {
|
|
@@ -60,6 +73,23 @@ module.exports = {
|
|
|
60
73
|
zone_id: zone.uuid,
|
|
61
74
|
method_id: uuid
|
|
62
75
|
});
|
|
76
|
+
},
|
|
77
|
+
deleteApi: async ({ uuid, zoneId }) => {
|
|
78
|
+
const zone = await select()
|
|
79
|
+
.from('shipping_zone')
|
|
80
|
+
.where('shipping_zone_id', '=', zoneId)
|
|
81
|
+
.load(pool);
|
|
82
|
+
|
|
83
|
+
return buildUrl('deleteShippingZoneMethod', {
|
|
84
|
+
zone_id: zone.uuid,
|
|
85
|
+
method_id: uuid
|
|
86
|
+
});
|
|
63
87
|
}
|
|
88
|
+
},
|
|
89
|
+
WeightBasedCostItem: {
|
|
90
|
+
minWeight: ({ min_weight }) => min_weight
|
|
91
|
+
},
|
|
92
|
+
PriceBasedCostItem: {
|
|
93
|
+
minPrice: ({ min_price }) => min_price
|
|
64
94
|
}
|
|
65
95
|
};
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const { getConfig } = require('@evershop/evershop/src/lib/util/getConfig');
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
4
|
Weight: {
|
|
5
|
-
value: (raw) => parseFloat(raw),
|
|
6
|
-
unit:
|
|
7
|
-
const unit =
|
|
5
|
+
value: (raw) => parseFloat(raw),
|
|
6
|
+
unit: () => {
|
|
7
|
+
const unit = getConfig('shop.weightUnit', 'kg');
|
|
8
8
|
return unit;
|
|
9
9
|
},
|
|
10
|
-
text:
|
|
11
|
-
const weight = parseFloat(raw);
|
|
12
|
-
const unit =
|
|
13
|
-
const language = await getSetting('storeLanguage', 'en');
|
|
10
|
+
text: (raw) => {
|
|
11
|
+
const weight = parseFloat(raw);
|
|
12
|
+
const unit = getConfig('shop.weightUnit', 'kg');
|
|
14
13
|
// Localize the weight
|
|
15
|
-
return
|
|
16
|
-
weight
|
|
17
|
-
);
|
|
14
|
+
return `${weight} ${unit}`;
|
|
18
15
|
}
|
|
19
16
|
}
|
|
20
17
|
};
|
|
@@ -21,9 +21,13 @@ module.exports = exports = async (connection) => {
|
|
|
21
21
|
"discount_amount" decimal(12,4) DEFAULT NULL,
|
|
22
22
|
"sub_total" decimal(12,4) NOT NULL,
|
|
23
23
|
"sub_total_incl_tax" decimal(12,4) NOT NULL,
|
|
24
|
+
"sub_total_with_discount" decimal(12,4) NOT NULL,
|
|
25
|
+
"sub_total_with_discount_incl_tax" decimal(12,4) NOT NULL,
|
|
24
26
|
"total_qty" INT NOT NULL,
|
|
25
27
|
"total_weight" decimal(12,4) DEFAULT NULL,
|
|
26
28
|
"tax_amount" decimal(12,4) NOT NULL,
|
|
29
|
+
"tax_amount_before_discount" decimal(12,4) NOT NULL,
|
|
30
|
+
"shipping_tax_amount" decimal(12,4) NOT NULL,
|
|
27
31
|
"grand_total" decimal(12,4) NOT NULL,
|
|
28
32
|
"shipping_method" varchar DEFAULT NULL,
|
|
29
33
|
"shipping_method_name" varchar DEFAULT NULL,
|
|
@@ -75,9 +79,12 @@ module.exports = exports = async (connection) => {
|
|
|
75
79
|
"final_price_incl_tax" decimal(12,4) NOT NULL,
|
|
76
80
|
"tax_percent" decimal(12,4) NOT NULL,
|
|
77
81
|
"tax_amount" decimal(12,4) NOT NULL,
|
|
82
|
+
"tax_amount_before_discount" decimal(12,4) NOT NULL,
|
|
78
83
|
"discount_amount" decimal(12,4) NOT NULL,
|
|
79
84
|
"sub_total" decimal(12,4) NOT NULL,
|
|
85
|
+
"line_total_with_discount" decimal(12,4) NOT NULL,
|
|
80
86
|
"total" decimal(12,4) NOT NULL,
|
|
87
|
+
"line_total_with_discount_incl_tax" decimal(12,4) NOT NULL,
|
|
81
88
|
"variant_group_id" INT DEFAULT NULL,
|
|
82
89
|
"variant_options" text DEFAULT NULL,
|
|
83
90
|
"product_custom_options" text DEFAULT NULL,
|
|
@@ -118,9 +125,13 @@ module.exports = exports = async (connection) => {
|
|
|
118
125
|
"discount_amount" decimal(12,4) DEFAULT NULL,
|
|
119
126
|
"sub_total" decimal(12,4) NOT NULL,
|
|
120
127
|
"sub_total_incl_tax" decimal(12,4) NOT NULL,
|
|
128
|
+
"sub_total_with_discount" decimal(12,4) NOT NULL,
|
|
129
|
+
"sub_total_with_discount_incl_tax" decimal(12,4) NOT NULL,
|
|
121
130
|
"total_qty" INT NOT NULL,
|
|
122
131
|
"total_weight" decimal(12,4) DEFAULT NULL,
|
|
123
132
|
"tax_amount" decimal(12,4) NOT NULL,
|
|
133
|
+
"tax_amount_before_discount" decimal(12,4) NOT NULL,
|
|
134
|
+
"shipping_tax_amount" decimal(12,4) NOT NULL,
|
|
124
135
|
"shipping_note" text DEFAULT NULL,
|
|
125
136
|
"grand_total" decimal(12,4) NOT NULL,
|
|
126
137
|
"shipping_method" varchar DEFAULT NULL,
|
|
@@ -194,9 +205,12 @@ module.exports = exports = async (connection) => {
|
|
|
194
205
|
"final_price_incl_tax" decimal(12,4) NOT NULL,
|
|
195
206
|
"tax_percent" decimal(12,4) NOT NULL,
|
|
196
207
|
"tax_amount" decimal(12,4) NOT NULL,
|
|
208
|
+
"tax_amount_before_discount" decimal(12,4) NOT NULL,
|
|
197
209
|
"discount_amount" decimal(12,4) NOT NULL,
|
|
198
210
|
"sub_total" decimal(12,4) NOT NULL,
|
|
211
|
+
"line_total_with_discount" decimal(12,4) NOT NULL,
|
|
199
212
|
"total" decimal(12,4) NOT NULL,
|
|
213
|
+
"line_total_with_discount_incl_tax" decimal(12,4) NOT NULL,
|
|
200
214
|
"variant_group_id" INT DEFAULT NULL,
|
|
201
215
|
"variant_options" text DEFAULT NULL,
|
|
202
216
|
"product_custom_options" text DEFAULT NULL,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const { execute } = require('@evershop/postgres-query-builder');
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line no-multi-assign
|
|
4
|
+
module.exports = exports = async (connection) => {
|
|
5
|
+
// Add a column 'price_based_cost' to the method table if it does not exist
|
|
6
|
+
await execute(
|
|
7
|
+
connection,
|
|
8
|
+
`ALTER TABLE "shipping_zone_method" ADD COLUMN "price_based_cost" jsonb`
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
// Add a column 'price_based_cost' to the method table if it does not exist
|
|
12
|
+
await execute(
|
|
13
|
+
connection,
|
|
14
|
+
`ALTER TABLE "shipping_zone_method" ADD COLUMN "weight_based_cost" jsonb`
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
// Delete the constraint 'CONDITION_TYPE_MUST_BE_PRICE_OR_WEIGHT' from the method table
|
|
18
|
+
await execute(
|
|
19
|
+
connection,
|
|
20
|
+
`ALTER TABLE "shipping_zone_method" DROP CONSTRAINT "CONDITION_TYPE_MUST_BE_PRICE_OR_WEIGHT"`
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
// Delete the constraint 'CONDITION_TYPE_MUST_BE_PRICE_OR_WEIGHT' from the method table
|
|
24
|
+
await execute(
|
|
25
|
+
connection,
|
|
26
|
+
`ALTER TABLE "shipping_zone_method" DROP CONSTRAINT "CALCULATE API MUST BE PROVIDE IF COST IS NULL"`
|
|
27
|
+
);
|
|
28
|
+
};
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
const { execute } = require('@evershop/postgres-query-builder');
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line no-multi-assign
|
|
4
|
+
module.exports = exports = async (connection) => {
|
|
5
|
+
// Rename sub_total column to line_total
|
|
6
|
+
await execute(
|
|
7
|
+
connection,
|
|
8
|
+
`ALTER TABLE "cart_item" RENAME COLUMN sub_total TO line_total`
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
await execute(
|
|
12
|
+
connection,
|
|
13
|
+
`ALTER TABLE "order_item" RENAME COLUMN sub_total TO line_total`
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
// Rename total column to line_total_incl_tax
|
|
17
|
+
await execute(
|
|
18
|
+
connection,
|
|
19
|
+
`ALTER TABLE "cart_item" RENAME COLUMN total TO line_total_incl_tax`
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
await execute(
|
|
23
|
+
connection,
|
|
24
|
+
`ALTER TABLE "order_item" RENAME COLUMN total TO line_total_incl_tax`
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
// Add a column 'tax_amount_before_discount' to the cart item table if it does not exist
|
|
28
|
+
await execute(
|
|
29
|
+
connection,
|
|
30
|
+
'ALTER TABLE "cart_item" ADD COLUMN IF NOT EXISTS "tax_amount_before_discount" decimal(12,4)'
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
// Add a column 'tax_amount_before_discount' to the order item table if it does not exist
|
|
34
|
+
await execute(
|
|
35
|
+
connection,
|
|
36
|
+
'ALTER TABLE "order_item" ADD COLUMN IF NOT EXISTS "tax_amount_before_discount" decimal(12,4)'
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
// Add a column 'tax_amount_before_discount' to the cart table if it does not exist
|
|
40
|
+
await execute(
|
|
41
|
+
connection,
|
|
42
|
+
'ALTER TABLE "cart" ADD COLUMN IF NOT EXISTS "tax_amount_before_discount" decimal(12,4)'
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
// Add a column 'tax_amount_before_discount' to the order table if it does not exist
|
|
46
|
+
await execute(
|
|
47
|
+
connection,
|
|
48
|
+
'ALTER TABLE "order" ADD COLUMN IF NOT EXISTS "tax_amount_before_discount" decimal(12,4)'
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
// Add a column 'line_total_with_discount' to the cart item table if it does not exist
|
|
52
|
+
await execute(
|
|
53
|
+
connection,
|
|
54
|
+
'ALTER TABLE "cart_item" ADD COLUMN IF NOT EXISTS "line_total_with_discount" decimal(12,4)'
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
// Add a column 'line_total_with_discount_incl_tax' to the cart item table if it does not exist
|
|
58
|
+
await execute(
|
|
59
|
+
connection,
|
|
60
|
+
'ALTER TABLE "cart_item" ADD COLUMN IF NOT EXISTS "line_total_with_discount_incl_tax" decimal(12,4)'
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
// Add a column 'line_total_with_discount' to the order item table if it does not exist
|
|
64
|
+
await execute(
|
|
65
|
+
connection,
|
|
66
|
+
'ALTER TABLE "order_item" ADD COLUMN IF NOT EXISTS "line_total_with_discount" decimal(12,4)'
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
// Add a column 'line_total_with_discount_incl_tax' to the order item table if it does not exist
|
|
70
|
+
await execute(
|
|
71
|
+
connection,
|
|
72
|
+
'ALTER TABLE "order_item" ADD COLUMN IF NOT EXISTS "line_total_with_discount_incl_tax" decimal(12,4)'
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
// Add a column 'sub_total_with_discount' to the cart table if it does not exist
|
|
76
|
+
await execute(
|
|
77
|
+
connection,
|
|
78
|
+
'ALTER TABLE "cart" ADD COLUMN IF NOT EXISTS "sub_total_with_discount" decimal(12,4)'
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
// Add a column 'sub_total_with_discount' to the order table if it does not exist
|
|
82
|
+
await execute(
|
|
83
|
+
connection,
|
|
84
|
+
'ALTER TABLE "order" ADD COLUMN IF NOT EXISTS "sub_total_with_discount" decimal(12,4)'
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
// Add a column 'sub_total_with_discount_incl_tax' to the cart table if it does not exist
|
|
88
|
+
await execute(
|
|
89
|
+
connection,
|
|
90
|
+
'ALTER TABLE "cart" ADD COLUMN IF NOT EXISTS "sub_total_with_discount_incl_tax" decimal(12,4)'
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
// Add a column 'sub_total_with_discount_incl_tax' to the order table if it does not exist
|
|
94
|
+
await execute(
|
|
95
|
+
connection,
|
|
96
|
+
'ALTER TABLE "order" ADD COLUMN IF NOT EXISTS "sub_total_with_discount_incl_tax" decimal(12,4)'
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
// Add a column 'shipping_tax_amount' to the cart table if it does not exist
|
|
100
|
+
await execute(
|
|
101
|
+
connection,
|
|
102
|
+
'ALTER TABLE "cart" ADD COLUMN IF NOT EXISTS "shipping_tax_amount" decimal(12,4)'
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
// Add a column 'shipping_tax_amount' to the order table if it does not exist
|
|
106
|
+
await execute(
|
|
107
|
+
connection,
|
|
108
|
+
'ALTER TABLE "order" ADD COLUMN IF NOT EXISTS "shipping_tax_amount" decimal(12,4)'
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
// Calculate the value for the new columns 'tax_amount_before_discount', 'line_total_with_discount', 'line_total_with_discount_incl_tax', 'sub_total'
|
|
112
|
+
|
|
113
|
+
await execute(
|
|
114
|
+
connection,
|
|
115
|
+
`UPDATE "cart_item" SET tax_amount_before_discount = ROUND(COALESCE(final_price, 0) * (COALESCE(tax_percent, 0) / 100), 2) * qty`
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
await execute(
|
|
119
|
+
connection,
|
|
120
|
+
`UPDATE "order_item" SET tax_amount_before_discount = ROUND(COALESCE(final_price, 0) * (COALESCE(tax_percent, 0) / 100), 2) * qty`
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
// Calculate the tax_amount_before_discount on cart and order by summing up the tax_amount_before_discount of all items
|
|
124
|
+
await execute(
|
|
125
|
+
connection,
|
|
126
|
+
`UPDATE "cart" SET tax_amount_before_discount = (SELECT SUM(tax_amount_before_discount) FROM cart_item WHERE cart_item.cart_id = cart.cart_id)`
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
await execute(
|
|
130
|
+
connection,
|
|
131
|
+
`UPDATE "order" SET tax_amount_before_discount = (SELECT SUM(tax_amount_before_discount) FROM "order_item" WHERE "order_item".order_item_order_id = "order".order_id)`
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
await execute(
|
|
135
|
+
connection,
|
|
136
|
+
`UPDATE "cart_item" SET line_total_with_discount = line_total`
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
await execute(
|
|
140
|
+
connection,
|
|
141
|
+
`UPDATE "cart_item" SET line_total = COALESCE(final_price, 0) * qty`
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
await execute(
|
|
145
|
+
connection,
|
|
146
|
+
`UPDATE "order_item" SET line_total_with_discount = line_total`
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
await execute(
|
|
150
|
+
connection,
|
|
151
|
+
`UPDATE "order_item" SET line_total = COALESCE(final_price, 0) * qty`
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
await execute(
|
|
155
|
+
connection,
|
|
156
|
+
`UPDATE "cart_item" SET line_total_with_discount_incl_tax = line_total_with_discount + tax_amount`
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
await execute(
|
|
160
|
+
connection,
|
|
161
|
+
`UPDATE "order_item" SET line_total_with_discount_incl_tax = line_total_with_discount + tax_amount`
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
await execute(
|
|
165
|
+
connection,
|
|
166
|
+
`UPDATE "cart" SET sub_total_with_discount = (SELECT SUM(line_total_with_discount) FROM cart_item WHERE cart_item.cart_id = cart.cart_id)`
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
await execute(
|
|
170
|
+
connection,
|
|
171
|
+
`UPDATE "order" SET sub_total_with_discount = (SELECT SUM(line_total_with_discount) FROM "order_item" WHERE "order_item".order_item_order_id = "order".order_id)`
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
await execute(
|
|
175
|
+
connection,
|
|
176
|
+
`UPDATE "cart" SET sub_total_with_discount_incl_tax = sub_total_with_discount + tax_amount`
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
await execute(
|
|
180
|
+
connection,
|
|
181
|
+
`UPDATE "order" SET sub_total_with_discount_incl_tax = sub_total_with_discount + tax_amount`
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
// Add a column 'total_tax_amount' to the cart table if it does not exist
|
|
185
|
+
await execute(
|
|
186
|
+
connection,
|
|
187
|
+
'ALTER TABLE "cart" ADD COLUMN IF NOT EXISTS "total_tax_amount" decimal(12,4)'
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
// Update the value for the new column 'total_tax_amount' on the cart table get value from the `tax_amount` column
|
|
191
|
+
await execute(connection, `UPDATE "cart" SET total_tax_amount = tax_amount`);
|
|
192
|
+
|
|
193
|
+
// Add a column 'total_tax_amount' to the order table if it does not exist
|
|
194
|
+
await execute(
|
|
195
|
+
connection,
|
|
196
|
+
'ALTER TABLE "order" ADD COLUMN IF NOT EXISTS "total_tax_amount" decimal(12,4)'
|
|
197
|
+
);
|
|
198
|
+
|
|
199
|
+
// Update the value for the new column 'total_tax_amount' on the cart table get value from the `tax_amount` column
|
|
200
|
+
await execute(connection, `UPDATE "order" SET total_tax_amount = tax_amount`);
|
|
201
|
+
};
|