public async Task CreateMessage(string message) { var clientMessage = new ClientMessage() { Date = DateTime.UtcNow, Text = message }; await CreateAsync(clientMessage); var isComplete = await _httpClient.SendMessage(message); clientMessage.State = isComplete ? MessageState.Complete : MessageState.Error; await UpdateAsync(clientMessage); }
public async Task<HmrcTokenResponse> GetAuthenticationToken(string redirectUrl, string accessCode) { return await _executionPolicy.ExecuteAsync(async () => { var requestParams = new { client_secret = _configuration.Hmrc.ClientSecret, client_id = _configuration.Hmrc.ClientId, grant_type = "authorization_code", redirect_uri = redirectUrl, code = accessCode }; var response = await _httpClientWrapper.SendMessage(requestParams, "oauth/token"); return JsonConvert.DeserializeObject<HmrcTokenResponse>(response); }); }