Can apply tax rates to PoS items (#6724)

This commit is contained in:
Nicolas Dorier
2025-05-19 10:35:46 +09:00
committed by GitHub
parent 80d6ba3e5b
commit 932d313dee
36 changed files with 1224 additions and 807 deletions

View File

@@ -30,9 +30,18 @@ namespace BTCPayServer.JsonConverters
case JTokenType.Integer:
case JTokenType.String:
if (objectType == typeof(decimal) || objectType == typeof(decimal?))
{
if (objectType == typeof(decimal?) && string.IsNullOrWhiteSpace(token.ToString()))
return null;
return decimal.Parse(token.ToString(), NumberStyles.Any, CultureInfo.InvariantCulture);
}
if (objectType == typeof(double) || objectType == typeof(double?))
{
if (objectType == typeof(double?) && string.IsNullOrWhiteSpace(token.ToString()))
return null;
return double.Parse(token.ToString(), NumberStyles.Any, CultureInfo.InvariantCulture);
}
throw new JsonSerializationException("Unexpected object type: " + objectType);
case JTokenType.Null when objectType == typeof(decimal?) || objectType == typeof(double?):
return null;