public Task <FunctionResponse> SetOverdraft(HttpClient httpClient, string accountnumber, OverdraftSetData payload)
 {
     return(Task <FunctionResponse> .FromResult(new FunctionResponse()
     {
         Message = "This is a mock overdraft",
         InError = false
     }));
 }
        public async Task <FunctionResponse> SetOverdraft(HttpClient httpClient, string accountnumber, OverdraftSetData payload)
        {
            if (null != httpClient)
            {
                string key = "";

                key = _commands.FirstOrDefault(f => f.CommandName == "Set Overdraft")?.ApiKey;

                Uri postTarget = new Uri(RetailBankApi.GetBase(), RetailBankApi.SetOverdraft(accountnumber, key));

                string jsonContent = JsonConvert.SerializeObject(payload);
                // Turn the payload into a JSON
                var content = new ByteArrayContent(System.Text.Encoding.UTF8.GetBytes(jsonContent));
                content.Headers.ContentType = new MediaTypeHeaderValue(RetailBankApi.PAYLOAD_TYPE);

                var response = await httpClient.PostAsync(postTarget, content);

                if (response.IsSuccessStatusCode)
                {
                    var jsonString = await response.Content.ReadAsStringAsync();

                    return(JsonConvert.DeserializeObject <FunctionResponse>(jsonString));
                }
                else
                {
                    return(new FunctionResponse()
                    {
                        Message = $"Unable to set overdraft - {response.StatusCode}", InError = true
                    });
                }
            }

            return(new FunctionResponse()
            {
                Message = $"Not connected to retail bank API", InError = true
            });
        }