Exemplo n.º 1
0
        }        //CreateBrokerAccount

        public async Task <GetAccountByIDResponse> GetAccountByID(GetAccountByIDRequest requestModel)
        {
            if (this.loginResult == null)
            {
                this.loginResult = await Login();
            }

            var httpClient = new HttpClient {
                BaseAddress = new Uri(this.loginResult.instance_url)
            };

            var requestJson = JsonConvert.SerializeObject(requestModel);

            Log.InfoFormat("GetAccountByID request json: {0}", requestJson);
            var request = new HttpRequestMessage(HttpMethod.Post, "/services/apexrest/GetAccountByEmail");

            request.Content = new StringContent(requestJson);
            request.Headers.Add("Authorization", string.Format("{0} {1}", this.loginResult.token_type, this.loginResult.access_token));
            request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            var result = await httpClient.SendAsync(request).Result.Content.ReadAsStringAsync();

            var response = JsonConvert.DeserializeObject <RestApiResponse>(result);

            Log.InfoFormat("GetAccountByID res {0}", result);
            if (response != null && !string.IsNullOrEmpty(response.message) && response.success)
            {
                return(JsonConvert.DeserializeObject <GetAccountByIDResponse>(response.message));
            }
            return(null);
        }        //GetAccountByID
Exemplo n.º 2
0
        public void TestGetByID()
        {
            //Get accountID
            var getAccountByIDRequest = new GetAccountByIDRequest {
                Email_in = "*****@*****.**",
                Brand    = "ezbob"
            };

            var service = GetSb1Service();
            var result  = service.GetAccountByID(getAccountByIDRequest).Result;

            Assert.IsNotNull(result);
            Assert.IsNotNull(result.attributes);
            Assert.IsFalse(String.IsNullOrEmpty(result.Id));
            Assert.IsFalse(String.IsNullOrEmpty(result.attributes.type));
            Assert.IsFalse(String.IsNullOrEmpty(result.attributes.url));
        }
Exemplo n.º 3
0
 public Task <GetAccountByIDResponse> GetAccountByID(GetAccountByIDRequest requestModel)
 {
     return(null);
 }