public bool Parse(ref string requestString, JsonPropertyAttribute attribute, PropertyInfo property, object propertyValue, object propertyParent) { if (!attribute.PropertyName.Contains("metadata") && !attribute.PropertyName.Contains("fraud_details")) return false; var dictionary = (Dictionary<string, string>) propertyValue; if (dictionary == null) return true; foreach (var key in dictionary.Keys) RequestStringBuilder.ApplyParameterToRequestString(ref requestString, $"{attribute.PropertyName}[{key}]", dictionary[key]); return true; }
private static string GetJsonNameByProperty(PropertyInfo property) { Newtonsoft.Json.JsonPropertyAttribute attr = (JsonPropertyAttribute)Attribute.GetCustomAttribute(property, typeof(JsonPropertyAttribute)); if (attr != null) { return(attr.PropertyName); } else { return(property.Name.ToCamelCase()); } }
internal static void ProcessPlugins(ref string requestString, JsonPropertyAttribute attribute, PropertyInfo property, object propertyValue, object propertyParent) { var parsedParameter = false; foreach (var plugin in ParserPlugins) { if(!parsedParameter) parsedParameter = plugin.Parse(ref requestString, attribute, property, propertyValue, propertyParent); } if (!parsedParameter) ApplyParameterToRequestString(ref requestString, attribute.PropertyName, propertyValue.ToString()); }
public bool Parse(ref string requestString, JsonPropertyAttribute attribute, PropertyInfo property, object propertyValue, object propertyParent) { if (property.PropertyType != typeof(StripeDateFilter)) return false; var filter = (StripeDateFilter) propertyValue; if (filter.EqualTo.HasValue) RequestStringBuilder.ApplyParameterToRequestString(ref requestString, attribute.PropertyName, filter.EqualTo.Value.ConvertDateTimeToEpoch().ToString()); if (filter.LessThan.HasValue) RequestStringBuilder.ApplyParameterToRequestString(ref requestString, attribute.PropertyName + "[lt]", filter.LessThan.Value.ConvertDateTimeToEpoch().ToString()); if (filter.LessThanOrEqual.HasValue) RequestStringBuilder.ApplyParameterToRequestString(ref requestString, attribute.PropertyName + "[lte]", filter.LessThanOrEqual.Value.ConvertDateTimeToEpoch().ToString()); if (filter.GreaterThan.HasValue) RequestStringBuilder.ApplyParameterToRequestString(ref requestString, attribute.PropertyName + "[gt]", filter.GreaterThan.Value.ConvertDateTimeToEpoch().ToString()); if (filter.GreaterThanOrEqual.HasValue) RequestStringBuilder.ApplyParameterToRequestString(ref requestString, attribute.PropertyName + "[gte]", filter.GreaterThanOrEqual.Value.ConvertDateTimeToEpoch().ToString()); return true; }
public DataTablesPropertyInfo(PropertyDescriptor propertyInfo, JsonPropertyAttribute jsonProperty) { this.PropertyInfo = propertyInfo; }
public CustomAttributes( JsonIgnoreAttribute jsonIgnoreAttribute, JsonPropertyAttribute jsonPropertyAttribute, Attribute dataContractAttribute, Attribute dataMemberAttribute) { JsonIgnoreAttribute = jsonIgnoreAttribute; JsonPropertyAttribute = jsonPropertyAttribute; DataContractAttribute = dataContractAttribute; DataMemberAttribute = dataMemberAttribute; }