Skip to content

Commit

Permalink
VCST-1867: Mark IsSpa, SubscriptionEnabled and QuotesEnabled as Depre…
Browse files Browse the repository at this point in the history
…cated (#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.
  • Loading branch information
OlegoO authored Oct 4, 2024
1 parent e293e87 commit 0c7b7e7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/VirtoCommerce.Xapi.Core/Models/StoreSettings.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Identity;

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; }
Expand Down
8 changes: 5 additions & 3 deletions src/VirtoCommerce.Xapi.Core/Schemas/StoreSettingsType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ public class StoreSettingsType : ExtendableGraphType<StoreSettings>
{
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)");
Expand Down
6 changes: 4 additions & 2 deletions src/VirtoCommerce.Xapi.Data/Queries/GetStoreQueryHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ public async Task<StoreResponse> Handle(GetStoreQuery request, CancellationToken
{
response.Settings = new StoreSettings
{
#pragma warning disable VC0009
IsSpa = store.Settings.GetValue<bool>(StoreSettingGeneral.IsSpa),
QuotesEnabled = store.Settings.GetValue<bool>(new SettingDescriptor { Name = "Quotes.EnableQuotes" }),
SubscriptionEnabled = store.Settings.GetValue<bool>(new SettingDescriptor { Name = "Subscription.EnableSubscriptions" }),
#pragma warning restore VC0009
TaxCalculationEnabled = store.Settings.GetValue<bool>(StoreSettingGeneral.TaxCalculationEnabled),
AnonymousUsersAllowed = store.Settings.GetValue<bool>(StoreSettingGeneral.AllowAnonymousUsers),
EmailVerificationEnabled = store.Settings.GetValue<bool>(StoreSettingGeneral.EmailVerificationEnabled),
Expand All @@ -114,8 +118,6 @@ public async Task<StoreResponse> Handle(GetStoreQuery request, CancellationToken
CreateAnonymousOrderEnabled = store.Settings.GetValue<bool>(ModuleConstants.Settings.General.CreateAnonymousOrder),
DefaultSelectedForCheckout = store.Settings.GetValue<bool>(ModuleConstants.Settings.General.IsSelectedForCheckout),

QuotesEnabled = store.Settings.GetValue<bool>(new SettingDescriptor { Name = "Quotes.EnableQuotes" }),
SubscriptionEnabled = store.Settings.GetValue<bool>(new SettingDescriptor { Name = "Subscription.EnableSubscriptions" }),

EnvironmentName = _settingsManager.GetValue<string>(ModuleConstants.Settings.General.EnvironmentName),
PasswordRequirements = _identityOptions.Password,
Expand Down

0 comments on commit 0c7b7e7

Please sign in to comment.