internal static PaymentMethodApiModel DeserializePaymentMethodApiModel(XElement element) { bool? active = default; long? id = default; string name = default; string number = default; PaymentMethodApiModelType type = default; if (element.Element("active") is XElement activeElement) { active = (bool?)activeElement; } if (element.Element("id") is XElement idElement) { id = (long?)idElement; } if (element.Element("name") is XElement nameElement) { name = (string)nameElement; } if (element.Element("number") is XElement numberElement) { number = (string)numberElement; } if (element.Element("type") is XElement typeElement) { type = new PaymentMethodApiModelType(typeElement.Value); } return(new PaymentMethodApiModel(active, id, name, number, type)); }
internal PaymentMethodApiModel(bool?active, long?id, string name, string number, PaymentMethodApiModelType type) { Active = active; Id = id; Name = name; Number = number; Type = type; }
public PaymentMethodApiModel(string name, PaymentMethodApiModelType type) { if (name == null) { throw new ArgumentNullException(nameof(name)); } Name = name; Type = type; }
internal static PaymentMethodApiModel DeserializePaymentMethodApiModel(JsonElement element) { Optional <bool> active = default; Optional <long> id = default; string name = default; Optional <string> number = default; PaymentMethodApiModelType type = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("active")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } active = property.Value.GetBoolean(); continue; } if (property.NameEquals("id")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } id = property.Value.GetInt64(); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("number")) { number = property.Value.GetString(); continue; } if (property.NameEquals("type")) { type = new PaymentMethodApiModelType(property.Value.GetString()); continue; } } return(new PaymentMethodApiModel(Optional.ToNullable(active), Optional.ToNullable(id), name, number.Value, type)); }