internal static CreditNoteList getCredits(HttpResponseMessage responce) { var creditList = new CreditNoteList(); var jsonObj = JsonConvert.DeserializeObject<Dictionary<string, object>>(responce.Content.ReadAsStringAsync().Result); if (jsonObj.ContainsKey("credits")) { var paymentsArray = JsonConvert.DeserializeObject<List<object>>(jsonObj["credits"].ToString()); foreach (var paymentObj in paymentsArray) { var credit = new CreditNote(); credit = JsonConvert.DeserializeObject<CreditNote>(paymentObj.ToString()); creditList.Add(credit); } } return creditList; }
internal static CreditNoteList getCreditnoteList(HttpResponseMessage responce) { var creditNoteList = new CreditNoteList(); var jsonObj = JsonConvert.DeserializeObject<Dictionary<string, object>>(responce.Content.ReadAsStringAsync().Result); if (jsonObj.ContainsKey("creditnotes")) { var creditnotesArray = JsonConvert.DeserializeObject<List<object>>(jsonObj["creditnotes"].ToString()); foreach(var creditnoteObj in creditnotesArray) { var creditnote = new CreditNote(); creditnote = JsonConvert.DeserializeObject<CreditNote>(creditnoteObj.ToString()); creditNoteList.Add(creditnote); } } if (jsonObj.ContainsKey("page_context")) { var pageContext = new PageContext(); pageContext = JsonConvert.DeserializeObject<PageContext>(jsonObj["page_context"].ToString()); creditNoteList.page_context = pageContext; } return creditNoteList; }