public async Task <VerifyModel> payfoneVerify(VerifyRequestModel input) //verify endpoint { input.requestId = Guid.NewGuid().ToString(); string body = JsonConvert.SerializeObject(input, Newtonsoft.Json.Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); String a = await ProcessToken(); var request = new HttpRequestMessage() { RequestUri = new Uri("https://api.staging.payfone.com/identity/verify/v2"), Method = HttpMethod.Post, Content = new System.Net.Http.StringContent(body, Encoding.UTF8, "application/json") }; request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accesstoken); request.Headers.Add("Accept", "application/json"); try { var response = await client.SendAsync(request); var responseBody = await response.Content.ReadAsStringAsync(); VerifyModel model = JsonConvert.DeserializeObject <VerifyModel>(responseBody); return(model); } catch (AggregateException ex) { Console.WriteLine(String.Format("Error in request. Http Status Code: {0}", ex.InnerExceptions[0])); return(null); } }
public async Task <PayResult <VerifyResponseModel> > VerifyAsync(VerifyRequestModel model) { var errors = new List <PayError>(); model.Api = _configuration.Api; model.ValidateVerifyRequestModel(errors); if (errors.Any()) { return(PayResult <VerifyResponseModel> .Failed(errors.ToArray())); } var t = await PostRequestBase <VerifyResponseModel, VerifyRequestModel>(model, _verifyUrl); return(PayResult <VerifyResponseModel> .Invoke(t.Result)); }