public async Task <AdditionalPreminum_result> Handle(AdditionalPremiumEndorsementCommand request, CancellationToken cancellationToken) { GenerateHttpClientCommand generateHttpClientCommand = new GenerateHttpClientCommand(); var client = await mediator.Send(generateHttpClientCommand); HttpContent httpContent = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request), Encoding.UTF8, "application/json"); HttpResponseMessage httpResponseMessage = await client.PostAsync("/apidemo/1.0.0/services/premfin/account/premium/addition", httpContent); if (httpResponseMessage.IsSuccessStatusCode) { var temp = await httpResponseMessage.Content.ReadAsStringAsync(); var result = Newtonsoft.Json.JsonConvert.DeserializeObject <AdditionalPreminum_result>(temp); return(result); } else { return(null); } }
public async Task <NewBilling_response> Handle(NewBillingAccountSetupCommand request, CancellationToken cancellationToken) { GenerateHttpClientCommand generateHttpClientCommand = new GenerateHttpClientCommand(); var client = await mediator.Send(generateHttpClientCommand); string route = "/apidemo/1.0.0/services/premfin/account/new/setup"; HttpContent httpContent = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request), Encoding.UTF8, "application/json"); var ret = await client.PostAsync(route, httpContent); if (ret.IsSuccessStatusCode) { var temp = await ret.Content.ReadAsStringAsync(); var result = Newtonsoft.Json.JsonConvert.DeserializeObject <NewBilling_response>(temp); return(result); } else { var result = await ret.Content.ReadAsStringAsync(); return(null); } }