public KYCVerifcationServiceResult VerifyPersonInfo(KYCVerificationRequest request) { KYCVerifcationServiceResult kycResult = null; HttpClient _httpClient = new HttpClient(new HttpClientHandler { UseCookies = false }); var requestMessage = new HttpRequestMessage(HttpMethod.Post, TruilooUrl); _httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(MimeTypes.JSON)); _httpClient.DefaultRequestHeaders.Add("x-trulioo-api-key", Key); var content = new StringContent(JsonConvert.SerializeObject(request), Encoding.UTF8, MimeTypes.JSON); requestMessage.Content = content; var response = _httpClient.SendAsync(requestMessage).Result; if (response.IsSuccessStatusCode) { var result = response.Content.ReadAsStringAsync().Result; kycResult = JsonConvert.DeserializeObject <KYCVerifcationServiceResult>(result); } return(kycResult); }
private KYCVerificationRequest GetRequest(dynamic data) { KYCVerificationRequest request = new KYCVerificationRequest() { AcceptTruliooTermsAndConditions = true, CleansedAddress = false, ConfigurationName = "Identity Verification", ConsentForDataSources = new List <string>() { "Visa Verification" }, CountryCode = "AU", DataFields = new DataFields() { PersonInfo = new PersonInfo() { DayOfBirth = 5, FirstGivenName = data.GivenName, FirstSurName = data.LastName, // MiddleName = "Henry", MinimumAge = 0, MonthOfBirth = 3, YearOfBirth = 1983 }, Location = new Location() { BuildingNumber = "10", PostalCode = "3108", StateProvinceCode = "VIC", StreetName = "Lawford", StreetType = "St", Suburb = "Doncaster", UnitNumber = "3" }, Communication = new Communication() { EmailAddress = "testpersonAU % 40gdctest.com", Telephone = "03 9896 8785" }, Passport = new Passport { Number = data.PassportNumber } } }; return(request); }
public KYCVerificationResponse VerifyPerson(KYCVerificationRequest kycRequest) { KYCVerificationResponse response = new KYCVerificationResponse(); try { _logger.LogInformation("Getting KYC information"); KYCVerifcationServiceResult kycResult = _service.VerifyPersonInfo(kycRequest); response.Result = kycResult; } catch (Exception ex) { response.FailureReason = "Systrem error!"; } return(response); }
public void Handle(string message) { MRZVerifiedEvent @event = JsonConvert.DeserializeObject <MRZVerifiedEvent>(message); dynamic data = JsonConvert.DeserializeObject(@event.PersonInformationAsJSON); KYCVerificationRequest request = GetRequest(data); KYCVerifcationServiceResult resultDto = iKYCVerifcation.VerifyPersonInfo(request); KYCVerificationResult result = new KYCVerificationResult(); result.VerificationResult = JsonConvert.SerializeObject(resultDto); result.TransactionId = @event.TransactionId; result.PersonData = @event.PersonInformationAsJSON; result.CreatedDate = DateTime.Now; _iKYCRepository.AddResult(result); }