Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VCST-1867: Mark IsSpa, SubscriptionEnabled and QuotesEnabled as Deprecated #13

Merged
merged 3 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading