Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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);
        }