From 0c7b7e7af0737a7e74d934e9c44bb54ced236d0e Mon Sep 17 00:00:00 2001 From: Oleg Zhuk Date: Fri, 4 Oct 2024 15:03:43 +0200 Subject: [PATCH] VCST-1867: Mark IsSpa, SubscriptionEnabled and QuotesEnabled as Deprecated (#13) feat: Mark IsSpa, SubscriptionEnabled and QuotesEnabled as deprecated properties. Use Quotes.EnableQuotes public property instead. The client application should use its own business logic for SPA detection. Both properties will be removed after 11 stable releases. --- src/VirtoCommerce.Xapi.Core/Models/StoreSettings.cs | 4 ++++ src/VirtoCommerce.Xapi.Core/Schemas/StoreSettingsType.cs | 8 +++++--- .../Queries/GetStoreQueryHandler.cs | 6 ++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/VirtoCommerce.Xapi.Core/Models/StoreSettings.cs b/src/VirtoCommerce.Xapi.Core/Models/StoreSettings.cs index bf80d07..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; @@ -5,14 +6,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..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() { - Field(x => x.QuotesEnabled).Description("Quotes enabled"); - Field(x => x.SubscriptionEnabled).Description("Store ID"); +#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"); 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,