From b8608ca07e21420254e8bfe474e6395db38421ab Mon Sep 17 00:00:00 2001 From: Oleg Zhuk Date: Mon, 30 Sep 2024 16:44:08 +0200 Subject: [PATCH 1/2] VCST-1867: Mark IsSpa and QuotesEnabled as Deprecated fix: Mark IsSpa, SubscriptionEnabled and QuotesEnabled as deprecated properties. Use Quotes.EnableQuotes public property instead. Client application should use own business logic for SPA detection. Both properties will be removed after 11 stable release. --- src/VirtoCommerce.Xapi.Core/Models/StoreSettings.cs | 3 +++ src/VirtoCommerce.Xapi.Core/Schemas/StoreSettingsType.cs | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/VirtoCommerce.Xapi.Core/Models/StoreSettings.cs b/src/VirtoCommerce.Xapi.Core/Models/StoreSettings.cs index bf80d07..0ee9a73 100644 --- a/src/VirtoCommerce.Xapi.Core/Models/StoreSettings.cs +++ b/src/VirtoCommerce.Xapi.Core/Models/StoreSettings.cs @@ -5,14 +5,17 @@ namespace VirtoCommerce.Xapi.Core.Models { public class StoreSettings { + [Obsolete("Use Quotes.EnableQuotes public property instead", DiagnosticId = "VC0009", UrlFormat = "https://docs.virtocommerce.org/products/products-virto3-versions/")] public bool QuotesEnabled { get; set; } + [Obsolete("Use Subscription.EnableSubscriptions public property instead", DiagnosticId = "VC0009", UrlFormat = "https://docs.virtocommerce.org/products/products-virto3-versions/")] public bool SubscriptionEnabled { get; set; } public bool TaxCalculationEnabled { get; set; } public bool AnonymousUsersAllowed { get; set; } + [Obsolete("Client application should use own business logic for SPA detection", DiagnosticId = "VC0009", UrlFormat = "https://docs.virtocommerce.org/products/products-virto3-versions/")] public bool IsSpa { get; set; } public bool EmailVerificationEnabled { get; set; } diff --git a/src/VirtoCommerce.Xapi.Core/Schemas/StoreSettingsType.cs b/src/VirtoCommerce.Xapi.Core/Schemas/StoreSettingsType.cs index f6a6301..a47da56 100644 --- a/src/VirtoCommerce.Xapi.Core/Schemas/StoreSettingsType.cs +++ b/src/VirtoCommerce.Xapi.Core/Schemas/StoreSettingsType.cs @@ -7,11 +7,11 @@ public class StoreSettingsType : ExtendableGraphType { public StoreSettingsType() { - Field(x => x.QuotesEnabled).Description("Quotes enabled"); - Field(x => x.SubscriptionEnabled).Description("Store ID"); + Field(x => x.QuotesEnabled).Description("Quotes enabled").DeprecationReason("Use Quotes.EnableQuotes public property instead."); + Field(x => x.SubscriptionEnabled).Description("Subscription enabled").DeprecationReason("Use Subscription.EnableSubscriptions public property instead."); Field(x => x.TaxCalculationEnabled).Description("Tax calculation enabled"); Field(x => x.AnonymousUsersAllowed).Description("Allow anonymous users to visit the store "); - Field(x => x.IsSpa).Description("SPA"); + Field(x => x.IsSpa).Description("SPA").DeprecationReason("Client application should use own business logic for SPA detection."); Field(x => x.EmailVerificationEnabled).Description("Email address verification enabled"); Field(x => x.EmailVerificationRequired).Description("Email address verification required"); Field(x => x.CreateAnonymousOrderEnabled).Description("Allow anonymous users to create orders (XAPI)"); From 02507fb3f97dd661ab15d10117f986507cc72aa7 Mon Sep 17 00:00:00 2001 From: Oleg Zhuk Date: Mon, 30 Sep 2024 16:48:46 +0200 Subject: [PATCH 2/2] add pragma warning --- src/VirtoCommerce.Xapi.Core/Models/StoreSettings.cs | 1 + src/VirtoCommerce.Xapi.Core/Schemas/StoreSettingsType.cs | 4 +++- src/VirtoCommerce.Xapi.Data/Queries/GetStoreQueryHandler.cs | 6 ++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/VirtoCommerce.Xapi.Core/Models/StoreSettings.cs b/src/VirtoCommerce.Xapi.Core/Models/StoreSettings.cs index 0ee9a73..9a313e1 100644 --- a/src/VirtoCommerce.Xapi.Core/Models/StoreSettings.cs +++ b/src/VirtoCommerce.Xapi.Core/Models/StoreSettings.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using Microsoft.AspNetCore.Identity; diff --git a/src/VirtoCommerce.Xapi.Core/Schemas/StoreSettingsType.cs b/src/VirtoCommerce.Xapi.Core/Schemas/StoreSettingsType.cs index a47da56..020e8b0 100644 --- a/src/VirtoCommerce.Xapi.Core/Schemas/StoreSettingsType.cs +++ b/src/VirtoCommerce.Xapi.Core/Schemas/StoreSettingsType.cs @@ -7,11 +7,13 @@ public class StoreSettingsType : ExtendableGraphType { public StoreSettingsType() { +#pragma warning disable VC0009 Field(x => x.QuotesEnabled).Description("Quotes enabled").DeprecationReason("Use Quotes.EnableQuotes public property instead."); Field(x => x.SubscriptionEnabled).Description("Subscription enabled").DeprecationReason("Use Subscription.EnableSubscriptions public property instead."); + Field(x => x.IsSpa).Description("SPA").DeprecationReason("Client application should use own business logic for SPA detection."); +#pragma warning restore VC0009 Field(x => x.TaxCalculationEnabled).Description("Tax calculation enabled"); Field(x => x.AnonymousUsersAllowed).Description("Allow anonymous users to visit the store "); - Field(x => x.IsSpa).Description("SPA").DeprecationReason("Client application should use own business logic for SPA detection."); Field(x => x.EmailVerificationEnabled).Description("Email address verification enabled"); Field(x => x.EmailVerificationRequired).Description("Email address verification required"); Field(x => x.CreateAnonymousOrderEnabled).Description("Allow anonymous users to create orders (XAPI)"); diff --git a/src/VirtoCommerce.Xapi.Data/Queries/GetStoreQueryHandler.cs b/src/VirtoCommerce.Xapi.Data/Queries/GetStoreQueryHandler.cs index 2191ae2..d740217 100644 --- a/src/VirtoCommerce.Xapi.Data/Queries/GetStoreQueryHandler.cs +++ b/src/VirtoCommerce.Xapi.Data/Queries/GetStoreQueryHandler.cs @@ -105,7 +105,11 @@ public async Task Handle(GetStoreQuery request, CancellationToken { response.Settings = new StoreSettings { +#pragma warning disable VC0009 IsSpa = store.Settings.GetValue(StoreSettingGeneral.IsSpa), + QuotesEnabled = store.Settings.GetValue(new SettingDescriptor { Name = "Quotes.EnableQuotes" }), + SubscriptionEnabled = store.Settings.GetValue(new SettingDescriptor { Name = "Subscription.EnableSubscriptions" }), +#pragma warning restore VC0009 TaxCalculationEnabled = store.Settings.GetValue(StoreSettingGeneral.TaxCalculationEnabled), AnonymousUsersAllowed = store.Settings.GetValue(StoreSettingGeneral.AllowAnonymousUsers), EmailVerificationEnabled = store.Settings.GetValue(StoreSettingGeneral.EmailVerificationEnabled), @@ -114,8 +118,6 @@ public async Task Handle(GetStoreQuery request, CancellationToken CreateAnonymousOrderEnabled = store.Settings.GetValue(ModuleConstants.Settings.General.CreateAnonymousOrder), DefaultSelectedForCheckout = store.Settings.GetValue(ModuleConstants.Settings.General.IsSelectedForCheckout), - QuotesEnabled = store.Settings.GetValue(new SettingDescriptor { Name = "Quotes.EnableQuotes" }), - SubscriptionEnabled = store.Settings.GetValue(new SettingDescriptor { Name = "Subscription.EnableSubscriptions" }), EnvironmentName = _settingsManager.GetValue(ModuleConstants.Settings.General.EnvironmentName), PasswordRequirements = _identityOptions.Password,