btcpayserver/BTCPayServer/Plugins/Shopify/Models/ShopifySettings.cs
JesterHodl ec76acd3a6
Code analysis (#4293)
* Enable NETAnalyzers for whole project

- remove obsolete analyzers so that the .NET Core SDK NETAnalyzers can be used
- enable NETAnalyzers for all projects so that developers can use them by defining the AnalysisMode on individual projects

This is because if we set AnalysisMode to minimal, recommended or all it would spam with warning.
The idea is to be able to turn them on during development to fix recommended stuff without polluting the build output.

Following commits will implement some of the Code Analysis findings

* Performance hints for using char overloads for single characters (CA1834 and CA1847)

CA1834: Use StringBuilder.Append(char) for single character strings
CA1847: Use string.Contains(char) instead of string.Contains(string) with single characters
2022-11-20 17:42:36 +09:00

37 lines
1003 B
C#

using System;
using System.ComponentModel.DataAnnotations;
using Newtonsoft.Json;
namespace BTCPayServer.Plugins.Shopify.Models
{
public class ShopifySettings
{
[Display(Name = "Shop Name")]
public string ShopName { get; set; }
[Display(Name = "Api Key")]
public string ApiKey { get; set; }
[Display(Name = "Admin API access token")]
public string Password { get; set; }
public bool CredentialsPopulated()
{
return
!string.IsNullOrWhiteSpace(ShopName) &&
!string.IsNullOrWhiteSpace(ApiKey) &&
!string.IsNullOrWhiteSpace(Password);
}
public DateTimeOffset? IntegratedAt { get; set; }
[JsonIgnore]
public string ShopifyUrl
{
get
{
return ShopName?.Contains('.', StringComparison.OrdinalIgnoreCase) is true ? ShopName : $"https://{ShopName}.myshopify.com";
}
}
}
}