jumio 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/gem-push.yml +33 -0
  3. data/.github/workflows/specs.yml +35 -0
  4. data/.gitignore +14 -0
  5. data/CODE_OF_CONDUCT.md +74 -0
  6. data/Gemfile +8 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +77 -0
  9. data/Rakefile +8 -0
  10. data/bin/console +14 -0
  11. data/bin/setup +8 -0
  12. data/jumio.gemspec +42 -0
  13. data/lib/jumio/client.rb +43 -0
  14. data/lib/jumio/config.rb +19 -0
  15. data/lib/jumio/container.rb +23 -0
  16. data/lib/jumio/entities/address.rb +32 -0
  17. data/lib/jumio/entities/api_entity.rb +14 -0
  18. data/lib/jumio/entities/document.rb +28 -0
  19. data/lib/jumio/entities/identity_verification.rb +15 -0
  20. data/lib/jumio/entities/reject_reason.rb +22 -0
  21. data/lib/jumio/entities/reject_reason_details.rb +13 -0
  22. data/lib/jumio/entities/requestable_record.rb +16 -0
  23. data/lib/jumio/entities/scan.rb +27 -0
  24. data/lib/jumio/entities/scan_status.rb +21 -0
  25. data/lib/jumio/entities/transaction.rb +21 -0
  26. data/lib/jumio/entities/types.rb +12 -0
  27. data/lib/jumio/entities/verification.rb +18 -0
  28. data/lib/jumio/entities/verification_response.rb +16 -0
  29. data/lib/jumio/entities.rb +15 -0
  30. data/lib/jumio/factories.rb +233 -0
  31. data/lib/jumio/http_client.rb +72 -0
  32. data/lib/jumio/operations/get_scan_details.rb +21 -0
  33. data/lib/jumio/operations/get_scan_status.rb +20 -0
  34. data/lib/jumio/operations/initiate_verification.rb +24 -0
  35. data/lib/jumio/operations.rb +5 -0
  36. data/lib/jumio/repositories/scan.rb +30 -0
  37. data/lib/jumio/repositories/verification.rb +22 -0
  38. data/lib/jumio/repositories.rb +4 -0
  39. data/lib/jumio/schemas/verification_request.rb +39 -0
  40. data/lib/jumio/schemas.rb +3 -0
  41. data/lib/jumio/version.rb +5 -0
  42. data/lib/jumio.rb +32 -0
  43. metadata +280 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 3e941bbd99f1d6738f065a67195a26a25faf3867077eae3aab3275ba6467d848
4
+ data.tar.gz: 6414ccc1c70dc65bc3517986f81542741734970d17e512255ca78abf0c9d9cf7
5
+ SHA512:
6
+ metadata.gz: 39e670a843f8e9ff27ba4c1f214636d51879197ab4ab53680da88baadcc75386be112fda91fcbfad9142613f61bb0021c5ba3c936454023ebd9ab21f6a5086b1
7
+ data.tar.gz: 8a43184251933f11bf751086cbe4b928ef37d529707d737313085c6f1eaf9d319aeb3d81644ffea7da139d9248d8f08f34ed02b41022bd3d6a4258599f4f499d
@@ -0,0 +1,33 @@
1
+ name: Ruby Gem
2
+
3
+ on:
4
+ push:
5
+ branches: [ "main" ]
6
+ pull_request:
7
+ branches: [ "main" ]
8
+
9
+ jobs:
10
+ build:
11
+ name: Build + Publish
12
+ runs-on: ubuntu-latest
13
+ permissions:
14
+ contents: read
15
+ packages: write
16
+
17
+ steps:
18
+ - uses: actions/checkout@v3
19
+ - name: Set up Ruby 2.6
20
+ uses: actions/setup-ruby@v1
21
+ with:
22
+ ruby-version: 2.6.x
23
+
24
+ - name: Publish to RubyGems
25
+ run: |
26
+ mkdir -p $HOME/.gem
27
+ touch $HOME/.gem/credentials
28
+ chmod 0600 $HOME/.gem/credentials
29
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
30
+ gem build *.gemspec
31
+ gem push *.gem
32
+ env:
33
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
@@ -0,0 +1,35 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Specs
9
+
10
+ on:
11
+ push:
12
+ branches: [ main ]
13
+ pull_request:
14
+ branches: [ main ]
15
+
16
+ jobs:
17
+ test:
18
+
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ matrix:
22
+ ruby-version: ['2.7', '3.0']
23
+
24
+ steps:
25
+ - uses: actions/checkout@v2
26
+ - name: Set up Ruby
27
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
28
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
29
+ # uses: ruby/setup-ruby@v1
30
+ uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
31
+ with:
32
+ ruby-version: ${{ matrix.ruby-version }}
33
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
34
+ - name: Run tests
35
+ run: bundle exec rake spec
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ vendor
11
+ .env
12
+
13
+ # rspec failure tracking
14
+ .rspec_status
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at alessandro@juul.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ # Specify your gem's dependencies in jumio.gemspec
8
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 JUUL Labs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,77 @@
1
+ # Jumio
2
+
3
+ [![Specs](https://github.com/JuulLabs-OSS/jumio/actions/workflows/specs.yml/badge.svg)](https://github.com/JuulLabs-OSS/jumio/actions/workflows/specs.yml)
4
+
5
+ This is a client to communicate with the [Jumio Netverify Web API](https://github.com/Jumio/implementation-guides/tree/master/netverify) to perform age verification.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'jumio'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install jumio
22
+
23
+ ## Usage
24
+
25
+ First, you need to configure them gem:
26
+
27
+ ```ruby
28
+ Jumio.configure do |config|
29
+ config.api.secret = 'your_api_secret'
30
+ config.api.token = 'your_api_token'
31
+
32
+ config.merchant.app_name = 'your app name'
33
+ config.merchant.company_name = 'your company name'
34
+ config.merchant.version = Jumio::VERSION
35
+ end
36
+ ```
37
+
38
+ ### Initiate a Verification
39
+
40
+ ```ruby
41
+ Jumio.initiate_verification.call(
42
+ customerInternalReference: 'your_customer_internal_reference',
43
+ userReference: 'your_user_reference'
44
+ )
45
+ ```
46
+
47
+ ### Get Scan Status
48
+
49
+ ```ruby
50
+ Jumio.get_scan_status.call('your_scan_reference')
51
+ ```
52
+
53
+ ### Get Scan Details
54
+
55
+ ```ruby
56
+ Jumio.get_scan_details.call('your_scan_reference')
57
+ ```
58
+
59
+ ## Development
60
+
61
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
62
+
63
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
64
+
65
+ To execute tests, run `bundle exec rake spec`.
66
+
67
+ ## Contributing
68
+
69
+ Bug reports and pull requests are welcome on GitHub at https://github.com/JuulLabs-OSS/jumio. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
70
+
71
+ ## License
72
+
73
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
74
+
75
+ ## Code of Conduct
76
+
77
+ Everyone interacting in the Test project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/JuulLabs-OSS/jumio/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "jumio"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/jumio.gemspec ADDED
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path("../lib", __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require "jumio/version"
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.required_ruby_version = '>= 2.6.0'
9
+ spec.name = "jumio"
10
+ spec.version = Jumio::VERSION
11
+ spec.authors = ['Juul Labs, Inc.']
12
+ spec.email = ['opensource@juul.com']
13
+
14
+ spec.summary = "Wrapper for Jumio Netverify Web API"
15
+ spec.homepage = "https://github.com/JuulLabs-OSS/jumio"
16
+ spec.license = 'MIT'
17
+
18
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
19
+ f.match(%r{^(test|spec|features)/})
20
+ end
21
+ spec.bindir = "exe"
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ["lib"]
24
+
25
+ spec.add_dependency 'dry-auto_inject'
26
+ spec.add_dependency 'dry-configurable'
27
+ spec.add_dependency 'dry-container'
28
+ spec.add_dependency 'dry-monads'
29
+ spec.add_dependency "dry-schema", "~> 1.6.0"
30
+ spec.add_dependency 'dry-struct', '~> 1.4.0'
31
+
32
+ spec.add_development_dependency "activesupport"
33
+ spec.add_development_dependency "rake", "~> 10.0"
34
+ spec.add_development_dependency "rspec", "~> 3.0"
35
+ spec.add_development_dependency "pry"
36
+ # Until cc-test-reporter works with 0.18.0
37
+ # https://github.com/codeclimate/test-reporter/issues/418
38
+ spec.add_development_dependency "simplecov", "~> 0.17.0"
39
+ spec.add_development_dependency "vcr"
40
+ spec.add_development_dependency "webmock"
41
+ spec.add_development_dependency "dotenv"
42
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jumio
4
+ # configures an http client based on passed in credentials, or
5
+ # uses the Jumio.api configuration. The instance will expose the
6
+ # methods below that return lambdas. This is to maintain pairity
7
+ # with the existing module interface
8
+ class Client
9
+ attr_reader :client
10
+
11
+ # @param token [String, nil]
12
+ # @param secret [String, nil]
13
+ # @param base_url [String, nil]
14
+ def initialize(token: nil, secret: nil, base_url: nil)
15
+ @client = Container.resolve('http_client').new(
16
+ token: token,
17
+ secret: secret,
18
+ base_url: base_url
19
+ )
20
+ end
21
+
22
+ def get_scan_details
23
+ ->(scan_reference) {
24
+ Container.resolve('get_scan_details').
25
+ call(scan_reference, client)
26
+ }
27
+ end
28
+
29
+ def get_scan_status
30
+ ->(scan_reference) {
31
+ Container.resolve('get_scan_status').
32
+ call(scan_reference, client)
33
+ }
34
+ end
35
+
36
+ def initiate_verification
37
+ ->(verification_params) {
38
+ Container.resolve('initiate_verification').
39
+ call(verification_params, client)
40
+ }
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'dry-configurable'
4
+
5
+ module Jumio
6
+ extend Dry::Configurable
7
+
8
+ setting :api, reader: true do
9
+ setting :base_url, 'https://netverify.com/api/'
10
+ setting :secret
11
+ setting :token
12
+ end
13
+
14
+ setting :merchant, reader: true do
15
+ setting :app_name, 'YourApp'
16
+ setting :company_name, 'YourCompany'
17
+ setting :version, '1.0'
18
+ end
19
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'dry-auto_inject'
4
+
5
+ module Jumio
6
+ # Publicly accessible parts of Jumio gem
7
+ class Container
8
+ extend Dry::Container::Mixin
9
+
10
+ register(:http_client) { Object.const_get('Jumio::HttpClient') }
11
+
12
+ register(:get_scan_details) { Object.const_get('Jumio::Operations::GetScanDetails').new }
13
+ register(:get_scan_status) { Object.const_get('Jumio::Operations::GetScanStatus').new }
14
+ register(:initiate_verification) { Object.const_get('Jumio::Operations::InitiateVerification').new }
15
+
16
+ namespace(:repositories) do
17
+ register(:scan) { Object.const_get('Jumio::Repositories::Scan').new }
18
+ register(:verification) { Object.const_get('Jumio::Repositories::Verification').new }
19
+ end
20
+ end
21
+
22
+ JDC_CONTAINER = Dry::AutoInject(Container)
23
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'api_entity'
4
+
5
+ module Jumio
6
+ module Entities
7
+ # A generic address payload.
8
+ # Jumio is very vague about what could come back, so this entity is currently
9
+ # very permissive to accomodate all possible formats.
10
+ #
11
+ # https://github.com/Jumio/implementation-guides/blob/master/netverify/netverify-retrieval-api.md#us-address-format
12
+ class Address < ApiEntity
13
+ attribute :city, Types::Strict::String.meta(omittable: true)
14
+ attribute :country, Types::Strict::String.meta(omittable: true)
15
+ attribute :line1, Types::Strict::String.meta(omittable: true)
16
+ attribute :line2, Types::Strict::String.meta(omittable: true)
17
+ attribute :line3, Types::Strict::String.meta(omittable: true)
18
+ attribute :line4, Types::Strict::String.meta(omittable: true)
19
+ attribute :line5, Types::Strict::String.meta(omittable: true)
20
+ attribute :stateCode, Types::Strict::String.meta(omittable: true)
21
+ attribute :streetDirection, Types::Strict::String.meta(omittable: true)
22
+ attribute :streetName, Types::Strict::String.meta(omittable: true)
23
+ attribute :streetNumber, Types::Strict::String.meta(omittable: true)
24
+ attribute :streetSuffix, Types::Strict::String.meta(omittable: true)
25
+ attribute :unitDesignator, Types::Strict::String.meta(omittable: true)
26
+ attribute :unitDetails, Types::Strict::String.meta(omittable: true)
27
+ attribute :unitNumber, Types::Strict::String.meta(omittable: true)
28
+ attribute :zip, Types::Strict::String.meta(omittable: true)
29
+ attribute :zipExtension, Types::Strict::String.meta(omittable: true)
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'dry-struct'
4
+ require_relative 'types'
5
+
6
+ module Jumio
7
+ module Entities
8
+ # Base netverify api entity
9
+ class ApiEntity < Dry::Struct
10
+ # Allows us to easily consume api payloads
11
+ transform_keys(&:to_sym)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'jumio/entities/requestable_record'
4
+
5
+ module Jumio
6
+ module Entities
7
+ # Photo ID like Driver's license or Passport
8
+ #
9
+ # https://github.com/Jumio/implementation-guides/blob/master/netverify/netverify-retrieval-api.md#response-9
10
+ class Document < RequestableRecord
11
+ attribute :address, Address.meta(omittable: true)
12
+ attribute :dob, Types::JSON::Date.meta(omittable: true)
13
+ attribute :expiry, Types::Strict::String.meta(omittable: true)
14
+ attribute :idSubtype, Types::Strict::String.meta(omittable: true)
15
+ attribute :issuingCountry, Types::Strict::String.meta(omittable: true)
16
+ attribute :issuingDate, Types::Strict::String.meta(omittable: true)
17
+ attribute :firstName, Types::Strict::String.meta(omittable: true)
18
+ attribute :lastName, Types::Strict::String.meta(omittable: true)
19
+ attribute :number, Types::Strict::String.meta(omittable: true)
20
+ attribute :optionalData1, Types::Strict::String.meta(omittable: true)
21
+ attribute :optionalData2, Types::Strict::String.meta(omittable: true)
22
+ attribute :personalNumber, Types::Strict::String.meta(omittable: true)
23
+ attribute :status, Types::Strict::String
24
+ attribute :type, Types::Strict::String.meta(omittable: true)
25
+ attribute :usState, Types::Strict::String.meta(omittable: true)
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'api_entity'
4
+
5
+ module Jumio
6
+ module Entities
7
+ # Comparison between customer photo and identification
8
+ class IdentityVerification < ApiEntity
9
+ attribute :handwrittenNoteMatches, Types::Strict::String.meta(omittable: true)
10
+ attribute :reason, Types::Strict::String.meta(omittable: true)
11
+ attribute :similarity, Types::Strict::String.meta(omittable: true)
12
+ attribute :validity, Types::Strict::String.meta(omittable: true)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/core_ext/array/wrap'
4
+
5
+ require_relative 'api_entity'
6
+ require_relative 'reject_reason_details'
7
+
8
+ module Jumio
9
+ module Entities
10
+ # Explanation for identity validation failure
11
+ class RejectReason < ApiEntity
12
+ attribute :rejectReasonCode, Types::Strict::String.meta(omittable: true)
13
+ attribute :rejectReasonDescription, Types::Strict::String.meta(omittable: true)
14
+
15
+ # Since the API used to fetch scan details may return a hash or an array
16
+ # we choose to wrap this attribute so that it is _always_ an array.
17
+ attribute :rejectReasonDetails, Types::Array(RejectReasonDetails).
18
+ constructor { |val| Array.new(::Array.wrap(val)) }.
19
+ meta(omittable: true)
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'api_entity'
4
+
5
+ module Jumio
6
+ module Entities
7
+ # Explanation for identity validation failure
8
+ class RejectReasonDetails < ApiEntity
9
+ attribute :detailsCode, Types::Strict::String.meta(omittable: true)
10
+ attribute :detailsDescription, Types::Strict::String.meta(omittable: true)
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'api_entity'
4
+ require_relative 'types'
5
+
6
+ module Jumio
7
+ module Entities
8
+ # Base entity for any item that can be directly requested from a netverify api.
9
+ # Root payloads always contain a timestamp and scan reference.
10
+ # These attributes are not present when part of a nested response.
11
+ class RequestableRecord < ApiEntity
12
+ attribute :timestamp, Types::Strict::String.meta(omittable: true)
13
+ attribute :scanReference, Types::Strict::String.meta(omittable: true)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'document'
4
+ require_relative 'requestable_record'
5
+ require_relative 'transaction'
6
+ require_relative 'verification'
7
+
8
+ module Jumio
9
+ module Entities
10
+ # A scan details api response
11
+ #
12
+ # https://github.com/Jumio/implementation-guides/blob/master/netverify/netverify-retrieval-api.md#retrieving-scan-details
13
+ #
14
+ # This entity will contain only a transaction (with some status information)
15
+ # until Jumio has completed their verification process.
16
+ class Scan < RequestableRecord
17
+ attribute :document, Document.meta(omittable: true)
18
+ attribute :transaction, Transaction
19
+ attribute :verification, Verification.meta(omittable: true)
20
+
21
+ # Added for parity with the ScanStatus response entity
22
+ def status
23
+ transaction.status
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'requestable_record'
4
+
5
+ module Jumio
6
+ module Entities
7
+ class ScanStatus < RequestableRecord
8
+ # A separate entity to hold the "scan status request"
9
+ #
10
+ # https://github.com/Jumio/implementation-guides/blob/master/netverify/netverify-retrieval-api.md#retrieving-scan-status
11
+ #
12
+ # Since this endpoint returns _only_ a status value and the "scan details"
13
+ # does not return this same status at all, we have a separate entity for
14
+ # each, so as to not have one shared entity with all attributes optional.
15
+ #
16
+ # Although the Jumio docs describe this as "required", we have seen scans
17
+ # come back without one.
18
+ attribute :status, Types::Strict::String.meta(omittable: true) # Possible states: PENDING, DONE, FAILED
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'requestable_record'
4
+
5
+ module Jumio
6
+ module Entities
7
+ # Inforation relating the upload up documents to be processed.
8
+ #
9
+ # https://github.com/Jumio/implementation-guides/blob/master/netverify/netverify-retrieval-api.md#retrieving-transaction-data-only
10
+ class Transaction < RequestableRecord
11
+ attribute :clientIp, Types::Strict::String.meta(omittable: true)
12
+ attribute :customerId, Types::Strict::String.meta(omittable: true)
13
+ attribute :date, Types::Strict::String
14
+ attribute :merchantReportingCriteria, Types::Strict::String.meta(omittable: true)
15
+ attribute :merchantScanReference, Types::Strict::String.meta(omittable: true)
16
+ attribute :source, Types::Strict::String
17
+ attribute :status, Types::Strict::String
18
+ attribute :updatedAt, Types::JSON::DateTime.meta(omittable: true)
19
+ end
20
+ end
21
+ end