Esempio n. 1
0
        private static IdfyException BuildIdfyException(IdfyResponse response, HttpStatusCode statusCode, string requestUri, string responseContent)
        {
            var idfyError = Mapper <IdfyError> .MapFromJson(responseContent, response);

            return(new IdfyException(statusCode, idfyError, idfyError.Message)
            {
                IdfyResponse = response
            });
        }
Esempio n. 2
0
        public static T MapFromJson(string json, IdfyResponse idfyResponse = null)
        {
            var result = JsonConvert.DeserializeObject <T>(json);

            if (idfyResponse == null)
            {
                return(result);
            }

            foreach (var prop in result.GetType().GetRuntimeProperties())
            {
                if (prop.Name == nameof(IdfyResponse))
                {
                    prop.SetValue(result, idfyResponse);
                }
            }

            return(result);
        }
Esempio n. 3
0
 public static T MapFromJson(IdfyResponse idfyResponse)
 {
     return(MapFromJson(idfyResponse.ResponseJson, idfyResponse));
 }