BillingData: Upgrade GetSelection()
This commit is contained in:
@ -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