public void GetUserContactDetails() { GetUserContactDetailsCall api = new GetUserContactDetailsCall( this.apiContext); // Make API call. ApiException gotException = null; // Negative test. try { String contact = api.GetUserContactDetails("test item id", "contact user id", "requester"); } catch (ApiException ex) { gotException = ex; } Assert.IsNotNull(gotException); }
private List <ZohoLead> GetLeadInformation(List <ZohoLead> leads) { try { foreach (var lead in leads) { try { var doc = new HtmlDocument(); doc.LoadHtml(lead.ItemDescription); foreach (HtmlNode li in doc.DocumentNode.SelectNodes("//li")) { var splitLi = li.InnerText.Split(':'); if (splitLi.Count() == 2) { switch (splitLi[0].Trim()) { case "Year": lead.VehicleYear = splitLi[1].Trim(); break; case "Make": lead.VehicleMake = splitLi[1].Trim(); break; case "Model": lead.VehicleModel = splitLi[1].Trim(); break; case "Stock Number": lead.StockNumber = splitLi[1].Trim(); break; } } } if (String.IsNullOrEmpty(lead.StockNumber)) { foreach (HtmlNode span in doc.DocumentNode.SelectNodes("//span")) { if (span.InnerText == "Stock:") { lead.StockNumber = span.NextSibling.InnerText; } } } } catch { } try { apiContext = GetApiContext(); GetUserContactDetailsCall user = new GetUserContactDetailsCall(apiContext); var details = user.GetUserContactDetails(lead.EbayItemId, lead.UserId, "XXXXXXX"); lead.City = user.ContactAddress.CityName; lead.State = user.ContactAddress.StateOrProvince; lead.Zip = user.ContactAddress.PostalCode; lead.PhoneNumber = user.ContactAddress.Phone; lead.FullName = user.ContactAddress.Name; var splitName = lead.FullName.Split(' '); lead.FirstName = splitName[0]; lead.LastName = lead.FullName.Replace(splitName[0], ""); } catch (Exception ex) { Console.WriteLine(ex.Message); if (ex.Message.StartsWith("Item is not active for item id")) { Trace.TraceError(ex.Message); throw ex; } lead.FullName = "eBayUser " + lead.UserId; lead.FirstName = "eBayUser"; lead.LastName = lead.UserId; } } return(leads); } catch (Exception ex) { Trace.TraceError(ex.Message); throw ex; } }