public async static Task <Transaction> VerifyPassport(AbbyyCloudOCRResponse abbyyCloudOCRResponse, MemoryStream streamOut) { // Using Trulioo to verify extracted passport details TruliooClient truliooClient = new TruliooClient(); VerifyRequest requestValidate = new VerifyRequest() { AcceptTruliooTermsAndConditions = true, CleansedAddress = false, CallBackUrl = Environment.GetEnvironmentVariable("CallBackURL"), ConfigurationName = ConfigurationName, CountryCode = CountryCodes.Mapping[abbyyCloudOCRResponse.IssuingCountry], VerboseMode = true, DataFields = new DataFields() { PersonInfo = new PersonInfo() { FirstGivenName = abbyyCloudOCRResponse.GivenName, FirstSurName = abbyyCloudOCRResponse.LastName, }, Document = new Document() { AcceptIncompleteDocument = true, DocumentType = DocumentType, DocumentBackImage = streamOut.ToArray(), LivePhoto = null, ValidateDocumentImageQuality = true, DocumentFrontImage = streamOut.ToArray() }, } }; return(await truliooClient.Verify(requestValidate)); }
public async static void Run([BlobTrigger("kyccontainer/{name}", Connection = "AzureWebJobsStorage")] Stream blob, string name, TraceWriter log) { try { log.Info($"Azure blob function triggered for the passport image: {name}"); // Resolve assembly FunctionsAssemblyResolver.StaticInstance(); // Using AbbyyCloudOCR to extract Passport details RestServiceClient restClient = new RestServiceClient(); // Convert stream into image stream MemoryStream streamOut = ImageStream.GetImageStream(blob); OcrSdkTask task = restClient.ProcessMrz(streamOut); // Get Passport details AbbyyCloudOCRResponse abbyyCloudOCRResponse = restClient.WaitAndGetAbbyyCloudOCRResponse(task); // Using Trulioo API for Passport verification Transaction transaction = await Verify.VerifyPassport(abbyyCloudOCRResponse, streamOut); // Save the AbbyyCloudOCR response and transaction response into the database DataLayer.KYCDbContext.Save(abbyyCloudOCRResponse, transaction); } catch (Exception ex) { log.Error(ex.Message, ex, "KYC blob function"); } }