diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..e31c60ea --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,18 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.0.0 + hooks: + - id: trailing-whitespace + - id: check-yaml + - repo: local + hooks: + - id: lint + name: 'lint' + entry: bundle exec rake rubocop + language: system + description: "Lint" + - id: test + name: 'test' + entry: bundle exec rake spec + language: system + description: "Test" diff --git a/examples/doc_scan/README.md b/examples/doc_scan/README.md index 860f94e5..4b7b2f6a 100644 --- a/examples/doc_scan/README.md +++ b/examples/doc_scan/README.md @@ -3,7 +3,7 @@ 1. Create your application in the [Yoti Hub](https://hub.yoti.com) 1. Set the application domain of your app to `localhost:3002` 1. Rename the [.env.example](.env.example) file to `.env` -1. Fill in the environment variables in this file with the ones specific to your application (mentioned in the [Configuration](#configuration) section) +1. Fill in the environment variables in this file with the ones specific to your application, generated in the Yoti Hub when you create (and then publish) your application 1. Install the dependencies by running the following commands from this folder ```shell $ bundle install diff --git a/examples/doc_scan/app/controllers/yoti_controller.rb b/examples/doc_scan/app/controllers/yoti_controller.rb index cf13b4bd..95299020 100644 --- a/examples/doc_scan/app/controllers/yoti_controller.rb +++ b/examples/doc_scan/app/controllers/yoti_controller.rb @@ -1,5 +1,3 @@ -require 'base64' - class YotiController < ApplicationController # # Create Session @@ -27,6 +25,11 @@ def index .with_manual_check_never .build ) + .with_requested_check( + Yoti::DocScan::Session::Create::RequestedIdDocumentComparisonCheck + .builder + .build + ) .with_requested_task( Yoti::DocScan::Session::Create::RequestedTextExtractionTask .builder @@ -47,6 +50,28 @@ def index .with_error_url("#{request.base_url}/error") .build ) + .with_required_document( + Yoti::DocScan::Session::Create::RequiredIdDocument + .builder + .with_filter( + Yoti::DocScan::Session::Create::OrthogonalRestrictionsFilter + .builder + .with_included_document_types(['PASSPORT']) + .build + ) + .build + ) + .with_required_document( + Yoti::DocScan::Session::Create::RequiredIdDocument + .builder + .with_filter( + Yoti::DocScan::Session::Create::OrthogonalRestrictionsFilter + .builder + .with_included_document_types(['DRIVING_LICENCE']) + .build + ) + .build + ) .build create_session = Yoti::DocScan::Client.create_session(session_spec) @@ -73,15 +98,7 @@ def media media = Yoti::DocScan::Client.get_media_content(session[:DOC_SCAN_SESSION_ID], media_id) - body = media.content - content_type = media.mime_type - - if request.query_parameters[:base64Zip] == '1' && content_type == 'application/octet-stream' - body = Base64.strict_decode64(body) - content_type = 'application/zip' - end - - render body: body, content_type: content_type + render body: media.content, content_type: media.mime_type end # diff --git a/examples/doc_scan/app/views/yoti/success.html.erb b/examples/doc_scan/app/views/yoti/success.html.erb index 0c0f9dea..81b3de5c 100644 --- a/examples/doc_scan/app/views/yoti/success.html.erb +++ b/examples/doc_scan/app/views/yoti/success.html.erb @@ -34,6 +34,14 @@
ID | -- - <%= liveness_resource.facemap.media.id %> - - | -