diff --git a/.gitignore b/.gitignore index c1b13a25..b5b2517e 100644 --- a/.gitignore +++ b/.gitignore @@ -270,4 +270,4 @@ Temp/ **/Assets/setup.* **/Assets/*.js deps/*.dll -commerce/ \ No newline at end of file +zero.Commerce/ \ No newline at end of file diff --git a/zero.Debug/Controllers/TestController.cs b/zero.Debug/Controllers/TestController.cs deleted file mode 100644 index d56ea36b..00000000 --- a/zero.Debug/Controllers/TestController.cs +++ /dev/null @@ -1,256 +0,0 @@ -using FluentValidation; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Infrastructure; -using Microsoft.Extensions.DependencyInjection; -using Newtonsoft.Json; -using Raven.Client.Documents.Session; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using zero.Commerce.Api; -using zero.Commerce.Depots.Providers.Bits; -using zero.Commerce.Entities; -using zero.Core.Api; -using zero.Core.Entities; -using zero.Core.Extensions; -using zero.Core.Utils; -using zero.Web.Filters; - -namespace zero.Debug.Controllers -{ - [ServiceFilter(typeof(ModelStateValidationFilterAttribute))] - public class TestController : Controller - { - private readonly IActionDescriptorCollectionProvider _actionDescriptorCollectionProvider; - - - public TestController(IActionDescriptorCollectionProvider actionDescriptorCollectionProvider) - { - _actionDescriptorCollectionProvider = actionDescriptorCollectionProvider; - } - - - [HttpGet] - public IActionResult Services() - { - List items = new List(); - - foreach (var service in Startup.Services) - { - if (!service.ServiceType.FullName.StartsWith("zero.") && (service.ImplementationType == null || !service.ImplementationType.FullName.StartsWith("zero."))) - { - continue; - } - - items.Add(new - { - name = service.ServiceType.FullName, - lifetime = service.Lifetime, - instance = service.ImplementationType?.FullName - }); - } - - return Json(new - { - count = items.Count, - items - }, new JsonSerializerSettings() - { - TypeNameHandling = TypeNameHandling.None - }); - } - - - [HttpGet] - public async Task GetTranslations([FromServices] ITranslationsApi api) - { - return Json(await api.GetAll()); - } - - - - [HttpGet] - public IActionResult Things([FromServices] IValidator appValidator) - { - return Ok(); - } - - - - [HttpGet] - public IActionResult Clone([FromServices] IRecycledEntity blueprint) - { - IRecycledEntity entity = blueprint.Clone(); - return Json(entity); - } - - - [HttpPost] - public IActionResult SaveTest([FromBody] IPage model) => Json(model); - - - [HttpPost] - public async Task TestBitsIntegration([FromBody] BitsSettings settings, [FromServices] BitsDepotProvider provider) - { - provider.Set(settings); - return Json(await provider.Run(new Commerce.Depots.DepotOperation() - { - AppId = "applications.1-A" - })); - } - - - - - [HttpGet] - public IActionResult Routes() - { - - var routes = _actionDescriptorCollectionProvider.ActionDescriptors.Items.ToList(); - if (routes != null && routes.Any()) - { - return Json(routes); - } - return Json(new string [0]); - } - - - [HttpGet] - public async Task AddOrder([FromServices] IOrdersApi ordersApi) - { - OrderAddress address = new OrderAddress() - { - Email = "cee@live.at", - FirstName = "Tobias", - LastName = "Klika", - Company = "brothers Klika OG", - Gender = Gender.Male, - VatNo = "ATU68334803", - PhoneNumber = "+43 660 2594892", - Address = "Laabstraße 9", - AddressLine1 = "Top 2", - Zip = "5280", - City = "Braunau am Inn", - Country = "Österreich", - CountryId = "countries.256-A" - }; - - OrderAddress shippingAddress = new OrderAddress() - { - Email = "cee@live.at", - FirstName = "Tobias", - LastName = "Klika", - Company = "brothers Klika OG", - Gender = Gender.Male, - VatNo = "ATU68334803", - PhoneNumber = "+43 660 2594892", - Address = "Salzburger Strasse 44", - Zip = "5280", - City = "Braunau am Inn", - Country = "Österreich", - CountryId = "countries.256-A" - }; - - Order order = new Order() - { - ChannelId = "channels.1-A", - Name = "23-0002", - Number = "23-0002", - LanguageId = "languages.2-A", - CurrencyId = "currencies.33-A", - State = OrderState.Completed, - DetailStateId = "orderDetailStates.3-A", - IsRequest = false, - CustomerId = "customers.1-A", - CustomerNote = "Danke für die Hilfe. Das war wirklich dringend nötig <3", - AssignedToUserId = "users.1-A", - Address = address, - Items = new List() - { - new OrderItem() - { - Id = IdGenerator.Create(), - ProductId = "products.1-A", - VariantId = "4a5ddabc-8158-43f5-90eb-1d115cc062cc", - Name = "Nike Jersey 2.0", - Description = "Polyester / XS", - Sort = 0, - Quantity = 3, - Discount = 0, - Price = 17, - TaxRate = 20 - }, - new OrderItem() - { - Id = IdGenerator.Create(), - ProductId = "products.1-A", - VariantId = "4a5ddabc-8158-43f5-90eb-1d115cc062cc", - Name = "Nike Jersey 2.0", - Description = "Polyester / s", - Sort = 1, - Quantity = 1, - Discount = 5, - Price = 12, - TaxRate = 20 - }, - new OrderItem() - { - Id = IdGenerator.Create(), - Name = "Flex-Druck", - Sort = 2, - Price = 1.99m, - Quantity = 2, - TaxRate = 12 - } - }, - Price = 72.98m - }; - - order.Shipping = new OrderShipping() - { - Name = "Österreichische Post", - ShippingOptionId = "shippingOptions.1-A", - Price = 7.99m, - Lines = new List() - { - new OrderShippingLine() { Key = "Postfach", Value = "7-A" } - }, - Address = shippingAddress, - Deliveries = new List() - { - new OrderDelivery() - { - CreatedDate = DateTimeOffset.Now, - TrackingNumber = "1035304005500970252807", - TrackingUrl = "https://www.post.at/sv/sendungsdetails?snr=1035304005500970252807", - Description = "Waren sind im Lager 2 (Regal 23)", - ShipmentDate = DateTimeOffset.Now.AddDays(2), - Items = new List() - { - new OrderDeliveryProduct() { Id = order.Items[0].Id, Quantity = 2 }, - new OrderDeliveryProduct() { Id = order.Items[1].Id, Quantity = 1 } - } - }, - new OrderDelivery() - { - CreatedDate = DateTimeOffset.Now, - ShipmentDate = DateTimeOffset.Now.AddDays(4), - Items = new List() - { - new OrderDeliveryProduct() { Id = order.Items[0].Id, Quantity = 1 } - } - } - } - }; - - return Json(await ordersApi.Save(order)); - } - } - - internal class RouteModel - { - public string Name { get; set; } - public string Template { get; set; } - } -} \ No newline at end of file diff --git a/zero.Debug/TestData/TestPlugin.cs b/zero.Debug/TestData/TestPlugin.cs index 556ee9b7..2bc2b332 100644 --- a/zero.Debug/TestData/TestPlugin.cs +++ b/zero.Debug/TestData/TestPlugin.cs @@ -8,7 +8,6 @@ using zero.Core.Extensions; using zero.Debug.Sync; using zero.Debug.TestData; using zero.Core.Messages; -using zero.Commerce.Depots.Providers.Bits; namespace zero.TestData { @@ -60,7 +59,6 @@ namespace zero.TestData //services.AddTransient(); // TODO auto-register handlers //services.AddTransient(); services.AddTransient(); - services.AddTransient(); } } } diff --git a/zero.Debug/zero.Debug.csproj b/zero.Debug/zero.Debug.csproj index d574abdc..4f66016f 100644 --- a/zero.Debug/zero.Debug.csproj +++ b/zero.Debug/zero.Debug.csproj @@ -5,8 +5,7 @@ - - + diff --git a/zero.Web.UI/App/resources/utils.js b/zero.Web.UI/App/resources/utils.js index 472e8f4e..5fa723e7 100644 --- a/zero.Web.UI/App/resources/utils.js +++ b/zero.Web.UI/App/resources/utils.js @@ -1,11 +1,34 @@ import Axios from 'axios'; -const base = 'utils/'; - export default { - generateAlias(name) + // get translation by id + getById(id) { - return Axios.get(base + 'generateAlias', { params: { name } }).then(res => Promise.resolve(res.data)); + return Axios.get('translations/getById', { params: { id } }).then(res => Promise.resolve(res.data)); + }, + + // get new translation model + getEmpty(id) + { + return Axios.get('translations/getEmpty').then(res => Promise.resolve(res.data)); + }, + + // get all translations + getAll(query) + { + return Axios.get('translations/getAll', { params: query }).then(res => Promise.resolve(res.data)); + }, + + // save a translation + save(model) + { + return Axios.post('translations/save', model).then(res => Promise.resolve(res.data)); + }, + + // deletes a translation + delete(id) + { + return Axios.delete('translations/delete', { params: { id } }).then(res => Promise.resolve(res.data)); } }; \ No newline at end of file diff --git a/zero.Web.UI/App/router.config.js b/zero.Web.UI/App/router.config.js index 3f76d05c..afe89f0a 100644 --- a/zero.Web.UI/App/router.config.js +++ b/zero.Web.UI/App/router.config.js @@ -110,7 +110,7 @@ addRoutesPerContext(require.context('zero/pages', true, /routes\.js$/)); // add plugin route extensions try { - addRoutesPerContext(require.context('@/../commerce/zero.Commerce/Plugins/zero.Commerce', true, /routes\.js$/), true); // TODO dynPATH + addRoutesPerContext(require.context('@/../zero.Commerce/Plugins/zero.Commerce', true, /routes\.js$/), true); // TODO dynPATH } catch (exc) { diff --git a/zero.Web.UI/App/zero.plugins.js b/zero.Web.UI/App/zero.plugins.js index 7dcf5309..5da14fbf 100644 --- a/zero.Web.UI/App/zero.plugins.js +++ b/zero.Web.UI/App/zero.plugins.js @@ -2,7 +2,7 @@ zero.plugins = zero.plugins || []; // TODO correct path -let plugins = require.context('@/../commerce/zero.Commerce/Plugins/zero.Commerce', true, /plugin\.js$/); // TODO dynPATH +let plugins = require.context('@/../zero.Commerce/Plugins/zero.Commerce', true, /plugin\.js$/); // TODO dynPATH plugins.keys().forEach(path => { diff --git a/zero.Web.UI/webpack.config.js b/zero.Web.UI/webpack.config.js index e0f6de2b..a69ca13b 100644 --- a/zero.Web.UI/webpack.config.js +++ b/zero.Web.UI/webpack.config.js @@ -30,7 +30,7 @@ module.exports = { 'zero': path.join(__dirname, 'App'), 'zerosetup': path.join(__dirname, 'Setup'), '@': __dirname, - 'shop': path.join(__dirname, '..', 'commerce/zero.Commerce/Plugins/zero.Commerce') // TODO dynPATH + 'shop': path.join(__dirname, '..', 'zero.Commerce/Plugins/zero.Commerce') // TODO dynPATH } }, diff --git a/zero.Web/ZeroVue.cs b/zero.Web/ZeroVue.cs index 8e782dc5..befd99ec 100644 --- a/zero.Web/ZeroVue.cs +++ b/zero.Web/ZeroVue.cs @@ -241,7 +241,7 @@ namespace zero.Web Dictionary CreateTranslations() { var zeroTranslations = CreateTranslationsForFile("O:/zero/zero.Web/Resources/Localization/zero.en-us.json"); // TODO - var commerceTranslations = CreateTranslationsForFile("O:/zero/commerce/zero.Commerce/Resources/Localization/zero.commerce.en-us.json"); + var commerceTranslations = CreateTranslationsForFile("O:/zero/zero.Commerce/Resources/Localization/zero.commerce.en-us.json"); foreach (var translation in commerceTranslations) { diff --git a/zero.sln b/zero.sln index 09e461fc..be0b8e19 100644 --- a/zero.sln +++ b/zero.sln @@ -5,7 +5,7 @@ VisualStudioVersion = 16.0.29709.97 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "zero.Core", "zero.Core\zero.Core.csproj", "{7BFF3DDE-F910-4CE1-9B94-846059CE80DA}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "zero.Commerce", "commerce\zero.Commerce\zero.Commerce.csproj", "{63A8AD15-15F0-4555-BD62-C38B4465FFC1}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "zero.Commerce", "zero.Commerce\zero.Commerce.csproj", "{63A8AD15-15F0-4555-BD62-C38B4465FFC1}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "zero.Debug", "zero.Debug\zero.Debug.csproj", "{83473041-7A1B-40ED-9FD0-968B22EB36B3}" EndProject @@ -39,14 +39,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{1CE271AD build\build.ps1 = build\build.ps1 EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "commerce", "commerce", "{1CC446F8-A670-4EB1-87D3-C41F0D14603F}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "zero.Commerce.Depots.Providers.Bits", "commerce\zero.Commerce.Depots.Providers.Bits\zero.Commerce.Depots.Providers.Bits.csproj", "{A7FC3CAC-658E-424A-A23E-70159C65B696}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "zero.Commerce.Payment.Providers.Adyen", "commerce\zero.Commerce.Payment.Providers.Adyen\zero.Commerce.Payment.Providers.Adyen.csproj", "{B9281DC6-1691-4FBD-93DA-DC6059DEAC2F}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "providers", "providers", "{1B17842B-035F-46F8-9740-C6675F72C780}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -73,24 +65,10 @@ Global {8CE1A69A-35DB-4748-AE1C-86F5BC2E11D4}.Debug|Any CPU.Build.0 = Debug|Any CPU {8CE1A69A-35DB-4748-AE1C-86F5BC2E11D4}.Release|Any CPU.ActiveCfg = Debug|Any CPU {8CE1A69A-35DB-4748-AE1C-86F5BC2E11D4}.Release|Any CPU.Build.0 = Debug|Any CPU - {A7FC3CAC-658E-424A-A23E-70159C65B696}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A7FC3CAC-658E-424A-A23E-70159C65B696}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A7FC3CAC-658E-424A-A23E-70159C65B696}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A7FC3CAC-658E-424A-A23E-70159C65B696}.Release|Any CPU.Build.0 = Release|Any CPU - {B9281DC6-1691-4FBD-93DA-DC6059DEAC2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B9281DC6-1691-4FBD-93DA-DC6059DEAC2F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B9281DC6-1691-4FBD-93DA-DC6059DEAC2F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B9281DC6-1691-4FBD-93DA-DC6059DEAC2F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {63A8AD15-15F0-4555-BD62-C38B4465FFC1} = {1CC446F8-A670-4EB1-87D3-C41F0D14603F} - {A7FC3CAC-658E-424A-A23E-70159C65B696} = {1B17842B-035F-46F8-9740-C6675F72C780} - {B9281DC6-1691-4FBD-93DA-DC6059DEAC2F} = {1B17842B-035F-46F8-9740-C6675F72C780} - {1B17842B-035F-46F8-9740-C6675F72C780} = {1CC446F8-A670-4EB1-87D3-C41F0D14603F} - EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {AD3F31B9-8BBB-4334-9571-F556B9E632C9} EndGlobalSection