Exemplo n.º 1
0
        public async Task <Result> Handle(Message request, CancellationToken cancellationToken, RequestHandlerDelegate <Result> next)
        {
            var image = $"{request.Document}/{request.Images.FirstOrDefault(img => img.Equals("selfie.jpeg"))}";

            var result = await _service.AnalisyAsync(image);

            var self = new Selfie(result);

            var isValid = self.IsValidSelfie(request.Confidence);

            if (isValid)
            {
                return(await next());
            }

            return(new Result(false, "Sua selfie não passou no teste!"));
        }
Exemplo n.º 2
0
        public async Task <Result> Handle(Message request, CancellationToken cancellationToken, RequestHandlerDelegate <Result> next)
        {
            var image = $"{request.Document}/{request.Images.FirstOrDefault(img => img.Equals("document-front.jpeg"))}";

            var result = await _service.AnalisyAsync(image);

            var document = new Document(Side.Front, result);

            var isValid = document.IsValidDocument(request.Confidence);

            if (isValid)
            {
                return(await next());
            }

            return(new Result(false, "Seu documento parece não ser válido"));
        }