BillingData: Upgrade GetSelection()
This commit is contained in:
1 parent
ee161b149b
commit
75e9d756d2
2 files changed
+9
-16
No files matched your search
@@ -146,7 +146,12 @@ namespace Elwig.Helpers.Billing {
|
||||
return dict;
|
||||
}
|
||||
|
||||
protected static Dictionary<string, JsonValue> GetSelection(JsonObject data, IEnumerable<string> attributeVariants) {
|
||||
protected static Dictionary<string, JsonValue> GetSelection(JsonNode value, IEnumerable<string> attributeVariants) {
|
||||
if (value is JsonValue flatRate) {
|
||||
return attributeVariants.ToDictionary(e => e, _ => flatRate);
|
||||
} if (value is not JsonObject data) {
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
Dictionary<string, JsonValue> dict;
|
||||
if (data["default"] is JsonValue def) {
|
||||
dict = attributeVariants.ToDictionary(e => e, _ => def);
|
||||
|
||||
Reference in new issue
Block a user