kycaidplus 1.0.1

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e3c417cced6d9a989cdc628508ff08b0753fdd47fb292c036a6b8c3101fc8a3d
4
+ data.tar.gz: 7dc877c08d8441e2c4fd3786956f676b8415d98cc2622eed7eb5348a17173b13
5
+ SHA512:
6
+ metadata.gz: 58b67200e4a359d138b72d4be5416636482643ee40dae8927e4f66e728bcf6aa04253a68dfe2a4f388c984d1c51911b624abad8d7a95367c3d047edbd95356ec
7
+ data.tar.gz: b1d07d40b3527205cf4bc02515f276908f2bcde1060912a6ea0a7f0de091a9adb34ecf5635e0bedbcdcdffe956517ff30cec454d5f3b61cef0ac3b6e44121b5c
data/.drone.yml ADDED
@@ -0,0 +1,30 @@
1
+ ---
2
+ kind: pipeline
3
+ name: default
4
+
5
+ steps:
6
+ - name: Run rspec
7
+ image: ruby:2.6
8
+ commands:
9
+ - gem install bundler:2.1.4
10
+ - bundle install
11
+ - bundle exec rspec
12
+
13
+ - name: Release gems
14
+ image: ruby:2.6
15
+ environment:
16
+ GEM_CREDENTIALS:
17
+ from_secret: gem_credentials
18
+ commands:
19
+ - mkdir -p ~/.gem
20
+ - echo $GEM_CREDENTIALS | base64 -d > ~/.gem/credentials
21
+ - chmod 0600 ~/.gem/credentials
22
+ - gem build kycaidplus.gemspec
23
+ - gem push kycaidplus*.gem
24
+ when:
25
+ branch:
26
+ - master
27
+
28
+ trigger:
29
+ event:
30
+ - push
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis-yml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.6.5
6
+ before_install: gem install bundler -v 2.1.4
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in kycaidplus.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,94 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ kycaidplus (1.0.0)
5
+ faraday
6
+ faraday_middleware
7
+ json
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ addressable (2.8.1)
13
+ public_suffix (>= 2.0.2, < 6.0)
14
+ coderay (1.1.3)
15
+ crack (0.4.5)
16
+ rexml
17
+ diff-lcs (1.5.0)
18
+ docile (1.4.0)
19
+ faraday (1.10.2)
20
+ faraday-em_http (~> 1.0)
21
+ faraday-em_synchrony (~> 1.0)
22
+ faraday-excon (~> 1.1)
23
+ faraday-httpclient (~> 1.0)
24
+ faraday-multipart (~> 1.0)
25
+ faraday-net_http (~> 1.0)
26
+ faraday-net_http_persistent (~> 1.0)
27
+ faraday-patron (~> 1.0)
28
+ faraday-rack (~> 1.0)
29
+ faraday-retry (~> 1.0)
30
+ ruby2_keywords (>= 0.0.4)
31
+ faraday-em_http (1.0.0)
32
+ faraday-em_synchrony (1.0.0)
33
+ faraday-excon (1.1.0)
34
+ faraday-httpclient (1.0.1)
35
+ faraday-multipart (1.0.4)
36
+ multipart-post (~> 2)
37
+ faraday-net_http (1.0.1)
38
+ faraday-net_http_persistent (1.2.0)
39
+ faraday-patron (1.0.0)
40
+ faraday-rack (1.0.0)
41
+ faraday-retry (1.0.3)
42
+ faraday_middleware (1.2.0)
43
+ faraday (~> 1.0)
44
+ hashdiff (1.0.1)
45
+ json (2.6.2)
46
+ method_source (1.0.0)
47
+ multipart-post (2.2.3)
48
+ pry (0.14.1)
49
+ coderay (~> 1.1)
50
+ method_source (~> 1.0)
51
+ public_suffix (5.0.0)
52
+ rake (13.0.6)
53
+ rexml (3.2.5)
54
+ rspec (3.11.0)
55
+ rspec-core (~> 3.11.0)
56
+ rspec-expectations (~> 3.11.0)
57
+ rspec-mocks (~> 3.11.0)
58
+ rspec-core (3.11.0)
59
+ rspec-support (~> 3.11.0)
60
+ rspec-expectations (3.11.1)
61
+ diff-lcs (>= 1.2.0, < 2.0)
62
+ rspec-support (~> 3.11.0)
63
+ rspec-mocks (3.11.1)
64
+ diff-lcs (>= 1.2.0, < 2.0)
65
+ rspec-support (~> 3.11.0)
66
+ rspec-support (3.11.1)
67
+ ruby2_keywords (0.0.5)
68
+ simplecov (0.21.2)
69
+ docile (~> 1.1)
70
+ simplecov-html (~> 0.11)
71
+ simplecov_json_formatter (~> 0.1)
72
+ simplecov-html (0.12.3)
73
+ simplecov_json_formatter (0.1.4)
74
+ vcr (6.1.0)
75
+ webmock (3.18.1)
76
+ addressable (>= 2.8.0)
77
+ crack (>= 0.3.2)
78
+ hashdiff (>= 0.4.0, < 2.0.0)
79
+
80
+ PLATFORMS
81
+ ruby
82
+
83
+ DEPENDENCIES
84
+ bundler
85
+ kycaidplus!
86
+ pry
87
+ rake (~> 13.0)
88
+ rspec (~> 3.0)
89
+ simplecov
90
+ vcr
91
+ webmock
92
+
93
+ BUNDLED WITH
94
+ 2.1.4
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # KYCAIDPLUS
2
+
3
+ Ruby gem to interact with KYC provider https://www.kycaid.com/
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'kycaidplus'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle install
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install kycaidplus
20
+
21
+ ## Usage
22
+
23
+ Configure the gem using your issued KYCAIDPLUS credentials in an initializer file. For example, in config/initializers/kycaidplus.rb:
24
+
25
+ ```
26
+ KYCAIDPLUS.configure do |config|
27
+ config.authorization_token = ENV['KYCAIDPLUS_AUTHORIZATION_TOKEN']
28
+ config.sandbox_mode = ENV['KYCAIDPLUS_SANDBOX_MODE']
29
+ end
30
+ ```
31
+
32
+ ## Development
33
+
34
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
35
+
36
+ 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).
37
+
38
+ ## Contributing
39
+
40
+ Bug reports and pull requests are welcome on GitHub at https://github.com/ianeinser/kycaidplus.
41
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "kycaidplus"
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
@@ -0,0 +1,35 @@
1
+ require_relative 'lib/kycaidplus/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "kycaidplus"
5
+ spec.version = KYCAIDPLUS::VERSION
6
+ spec.authors = ["PlutoNeXT"]
7
+ spec.email = ["support@plutonext.com"]
8
+
9
+ spec.summary = %q{kycaid.com ruby library.}
10
+ spec.description = %q{Support of core functionalities of the KYC provider kycaid.com}
11
+ spec.homepage = "https://kycaid.com/"
12
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
13
+
14
+ spec.metadata["homepage_uri"] = spec.homepage
15
+ spec.metadata["source_code_uri"] = "https://github.com/ianeinser/kycaidplus"
16
+
17
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
18
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_development_dependency "bundler"
25
+ spec.add_development_dependency "rake", "~> 13.0"
26
+ spec.add_development_dependency "rspec", "~> 3.0"
27
+ spec.add_development_dependency "vcr"
28
+ spec.add_development_dependency "webmock"
29
+ spec.add_development_dependency "pry"
30
+ spec.add_development_dependency "simplecov"
31
+
32
+ spec.add_dependency "faraday"
33
+ spec.add_dependency "faraday_middleware"
34
+ spec.add_dependency "json"
35
+ end
@@ -0,0 +1,30 @@
1
+ module KYCAIDPLUS
2
+ # Address is wrapper for KYCAID Address endpoints.
3
+ class Address < Response
4
+ extend Client
5
+
6
+ # Creates new address, params is a Hash.
7
+ # * +:applicant_id+ - _required_ The applicant’s unique identificator that received in response of create an applicant.
8
+ # * +:type+ - _required_ The address type. Valid values are: +'REGISTERED', 'BUSINESS', 'ADDITIONAL'+.
9
+ # * +:country+ - The country of the applicants’s address. Example: GB (ISO 3166-2).
10
+ # * +:city+ - The city or town of the applicant’s address.
11
+ # * +:postal_code+ - The post or zip code of the applicant’s address.
12
+ # * +:full_address+ - The applicant’s full address.
13
+ #
14
+ # Returns Response object, conatining +address_id+.
15
+ def self.create(params)
16
+ response = KYCAIDPLUS::Document.create(
17
+ {
18
+ front_file: params[:front_file],
19
+ applicant_id: params[:applicant_id],
20
+ type: 'ADDRESS_DOCUMENT'
21
+ }
22
+ )
23
+ return response unless response.errors.nil?
24
+
25
+ protected_params = params.slice(:country, :city, :postal_code, :full_address, :applicant_id, :type)
26
+
27
+ respond(post("/addresses", protected_params))
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,34 @@
1
+ module KYCAIDPLUS
2
+ # Applicant is wrapper for KYCAID Applicants endpoints.
3
+ class Applicant < Response
4
+ extend Client
5
+
6
+ # Creates new applicant, params is a Hash.
7
+ # * +:type+ - _required_ The applicant type. Valid values are PERSON or COMPANY.
8
+ # * +:first_name+ - _required_ The applicant’s first name.
9
+ # * +:last_name+ - _required_ The applicant’s last name.
10
+ # * +:dob+ - _required_ The applicant’s day of birth date. (ISO 8601, YYYY-MM-DD).
11
+ # * +:residence_country+ - _required_ The applicant’s current nationality. Example: GB (ISO 3166-2).
12
+ # * +:email+ - _required_ The applicant’s email address.
13
+ # * +:phone+ - _required_ The phone number of applicant.
14
+ #
15
+ # Returns Response object, conatining +applicant_id+.
16
+ def self.create(params)
17
+ protected_params = params.slice(:type, :first_name, :last_name, :dob, :residence_country, :email, :phone)
18
+ respond(post("/applicants", protected_params))
19
+ end
20
+
21
+ # Send get request to retrieve applicant by his ID.
22
+ #
23
+ # Returns Response object, conatining:
24
+ # * +:applicant_id+
25
+ # * +:first_name+
26
+ # * +:last_name+
27
+ # * +:dob+
28
+ # * +:residence_country+
29
+ # * +:email+
30
+ def self.fetch(applicant_id)
31
+ respond(get("/applicants/#{applicant_id}"))
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,62 @@
1
+ module KYCAIDPLUS
2
+ # Client contins REST API and handles content type and injecting Authorization token.
3
+ module Client
4
+ # Returns Faraday connection with authorization header containing token.
5
+ def conn
6
+ @conn ||= Faraday.new(url: KYCAIDPLUS.configuration.api_endpoint).tap do |faraday|
7
+ faraday.authorization("Token", KYCAIDPLUS.configuration.authorization_token)
8
+ end
9
+ end
10
+
11
+ # Returns Faraday connection for multipart data uploading with authorization header containing token.
12
+ def multipart_conn
13
+ @multipart_conn ||= Faraday.new(url: KYCAIDPLUS.configuration.api_endpoint) do |faraday|
14
+ faraday.request :multipart
15
+ faraday.request :url_encoded
16
+ faraday.adapter Faraday.default_adapter
17
+ faraday.authorization("Token", KYCAIDPLUS.configuration.authorization_token)
18
+ end
19
+ end
20
+
21
+ # Returns true if sandbox mode is set.
22
+ def sandbox?
23
+ KYCAIDPLUS.configuration.sandbox_mode
24
+ end
25
+
26
+ # Performs a get request, adds sandbox flag to request.
27
+ def get(url, options={})
28
+ conn.get(url, options.merge(sandbox: sandbox?))
29
+ end
30
+
31
+ # Performs a post request, adds sandbox flag to request.
32
+ def post(url, params={})
33
+ conn.post(url, params.merge(sandbox: sandbox?))
34
+ end
35
+
36
+ # Performs a patch request, adds sandbox flag to request.
37
+ def patch(url, params={})
38
+ conn.patch(url, params.merge(sandbox: sandbox?))
39
+ end
40
+
41
+ # Performs a post request with multipart data, adds sandbox flag to request.
42
+ def file_post(url, params={})
43
+ multipart_conn.post(url, file_payload(params))
44
+ end
45
+
46
+ # Performs a put request with multipart data, adds sandbox flag to request.
47
+ def file_put(url, params={})
48
+ multipart_conn.put(url, file_payload(params))
49
+ end
50
+
51
+ # Returns multipart data body params.
52
+ def file_payload(params={})
53
+ file = Faraday::UploadIO.new(
54
+ params[:tempfile].path,
55
+ params[:content_type],
56
+ params[:original_filename]
57
+ )
58
+ payload = { :file => file }.merge(sandbox: sandbox?)
59
+ payload
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,21 @@
1
+ module KYCAIDPLUS
2
+ # Configuration contains KYCAIDPLUS gem preferences.
3
+ # * +:authorization_token+ - KYCAID acces token.
4
+ # * +:sandbox_mode+ - run requests in sandbox mode.
5
+ # * +:api_endpoint+ - KYCAID service endpoint.
6
+ # * +:raise_errors+ - if set to true, KYCAID errors (like unauthorized) will be raised, otherwise access errors by Response#errors.
7
+ class Configuration
8
+ attr_accessor :authorization_token
9
+ attr_accessor :sandbox_mode
10
+ attr_accessor :api_endpoint
11
+ attr_accessor :raise_errors
12
+
13
+ # Initizes configuration with default values.
14
+ def initialize
15
+ @authorization_token = "d9883415047de3439328df17b0310569669a"
16
+ @sandbox_mode = true
17
+ @api_endpoint = "https://api.kycaid.com/"
18
+ @raise_errors = false
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,72 @@
1
+ module KYCAIDPLUS
2
+ # Document is wrapper for KYCAID Documents endpoints.
3
+ class Document < Response
4
+ extend Client
5
+
6
+ # Creates +:front_file+ and +:back_file+ files (see File) and a document,referring to those files.
7
+ # * +:applicant_id+ - _required_ The applicant’s unique identificator that received in response of Applicant#create.
8
+ # * +:type+ - _required_ The document type. Valid values are: GOVERNMENT_ID, PASSPORT, DRIVERS_LICENSE, SELFIE_IMAGE,
9
+ # ADDRESS_DOCUMENT, FINANCIAL_DOCUMENT, TAX_ID_NUMBER, REGISTRATION_COMPANY, COMPANY_LEGAL_ADDRESS, AUTHORISED_PERSON,
10
+ # COMPANY_OWNERSHIP.
11
+ # * +:document_number+ - The unique number associated with document (e.g. passport number).
12
+ # * +:issue_date+ - The issue date of the document. (ISO 8601, YYYY-MM-DD).
13
+ # * +:expiry_date+ - The expiry date of the document. (ISO 8601, YYYY-MM-DD)
14
+ # * +:front_file+ - nested param to create a file.
15
+ # * +:back_file+ - nested param to create a file.
16
+ #
17
+ # Front file and Back file are a Hash:
18
+ # * +:tempfile+ - file to upload.
19
+ # * +:file_extension+ - file's extensions (f.e., .jpeg)
20
+ # * +:file_name+ - filename.
21
+ #
22
+ # Returns Response object, conatining +document_id+.
23
+ def self.create(params)
24
+ front_file_id = create_file(params[:front_file])
25
+ back_file_id = create_file(params[:back_file])
26
+
27
+ protected_params = params.slice(:applicant_id, :type, :document_number, :issue_date, :expiry_date)
28
+ .merge(front_side_id: front_file_id, back_side_id: back_file_id)
29
+
30
+ respond(post("/documents", protected_params.compact))
31
+ end
32
+
33
+ # Update document, params is a Hash.
34
+ # * +:type+ - see #create
35
+ # * +:document_number+ - see #create
36
+ # * +:issue_date+ - see #create
37
+ # * +:expiry_date+ - see #create
38
+ # Front file and Back file are a Hash:
39
+ # * +:tempfile+ - file to upload.
40
+ # * +:file_extension+ - file's extensions (f.e., .jpeg)
41
+ # * +:file_name+ - filename.
42
+ #
43
+ # Returns Response object, conatining +document_id+.
44
+ def self.update(params)
45
+ front_file_id = create_file(params[:front_file])
46
+ back_file_id = create_file(params[:back_file])
47
+
48
+ protected_params = params.slice(:type, :document_number, :issue_date, :expiry_date)
49
+ .merge(front_side_id: front_file_id, back_side_id: back_file_id)
50
+ respond(patch("/documents/#{params[:id]}", protected_params))
51
+ end
52
+
53
+ # A helper to create associated file before creating document.
54
+ # Return a File Response object.
55
+ def self.file_params(params)
56
+ KYCAIDPLUS::File.create(
57
+ tempfile: params[:tempfile],
58
+ content_type: "image/#{params[:file_extension]}",
59
+ original_filename: params[:file_name]
60
+ )
61
+ end
62
+
63
+ def self.create_file(file)
64
+ unless file.nil?
65
+ front_file = file_params(file)
66
+ return front_file unless front_file.errors.nil?
67
+
68
+ front_file.file_id
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,28 @@
1
+ module KYCAIDPLUS
2
+ # File is wrapper for KYCAID Files endpoints.
3
+ class File < Response
4
+ extend Client
5
+
6
+ # Creates new file.
7
+ # * +:tempfile+ - file to upload.
8
+ # * +:content_type+ - multipart data content type.
9
+ # * +:original_filename+ - filename.
10
+ #
11
+ # Returns Response object, conatining +file_id+.
12
+ def self.create(params)
13
+ respond(file_post("/files", params.slice(:tempfile, :content_type, :original_filename)))
14
+ end
15
+
16
+ # Updates a file.
17
+ # * +:file_id+ - file ID to update.
18
+ # * +:tempfile+ - file to upload.
19
+ # * +:content_type+ - multipart data content type.
20
+ # * +:original_filename+ - filename.
21
+ #
22
+ # Returns Response object, conatining +file_id+.
23
+ def self.update(params)
24
+ respond(file_put("/files/#{params[:file_id]}",
25
+ params.slice(:tempfile, :content_type, :original_filename)))
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,24 @@
1
+ module KYCAIDPLUS
2
+ # Liveness is wrapper for KYCAID endpoints to perform liveness check.
3
+ class Liveness < Response
4
+ extend Client
5
+
6
+ # Gets form url based on the template prepared in dashboard
7
+ # * +:applicant_id+ - _mandatory_ The applicant’s unique identificator that received in response of create an applicant. It's supposed to use when need to create verification for exists applicant.
8
+ # * +:external_applicant_id+ -_optional_ Custom identifier of the applicant, which is intended for binding the applicant in the customer and KYCAID systems.
9
+ # * +:redirect_url+ -_mandatory_ The customer site URL, where applicant will be redirected after completing filling the form.
10
+ #
11
+ # Returns Response object, containing
12
+ # * +form_id+ - _mandatory_ The form’s unique identificator.
13
+ # * +form_url+ - _mandatory_ One-time URL to the verification form. This URL will be available until applicant will not complete the form.
14
+ # * +verificiation_id+ - _mandatory_ The verification’s unique identificator.
15
+ def self.create(params)
16
+
17
+ protected_params = params.slice(:applicant_id, :external_applicant_id, :redirect_url)
18
+ form_id = params[:form_id]
19
+
20
+ respond(post("/forms/#{form_id}/urls", protected_params))
21
+
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,32 @@
1
+ module KYCAIDPLUS
2
+ # Response is an object to wrap parsed json response.
3
+ class Response < OpenStruct
4
+ def initialize(response)
5
+ super(response)
6
+ end
7
+
8
+ # * If response is not successful, set errors to array of detected errors.
9
+ # * If response is successful, errors in nil.
10
+ # * If raise_errors is set in configuration, will raise error if any.
11
+ def handle_error(err)
12
+ self.errors ||= []
13
+ self.errors << err
14
+
15
+ raise err if KYCAIDPLUS.configuration.raise_errors
16
+
17
+ self
18
+ end
19
+
20
+ # Wraps JSON response into OpenStruct.
21
+ # Original response in stored in +raw_response+
22
+ def self.respond(response)
23
+ resp = new(JSON.parse(response.body))
24
+ resp.raw_response = response
25
+
26
+ resp.handle_error(Unauthorized.new(response.body)) if response.status == 403
27
+ resp.handle_error(Error.new(response.body)) unless response.success?
28
+
29
+ resp
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,33 @@
1
+ module KYCAIDPLUS
2
+ # Verification is wrapper for KYCAID Verifications endpoints.
3
+ class Verification < Response
4
+ extend Client
5
+
6
+ # Create a verification.
7
+ # * +:applicant_id+ - _required_ The applicant unique identificator that received in response of Applicant#create.
8
+ # * +:types+ - _required_ The verification types. Valid values are: DOCUMENT, FACIAL, ADDRESS, AML, FINANCIAL, VIDEO, COMPANY.
9
+ # * +:callback_url+ - _required_ URL on which the result will come.
10
+ # * +:form_id+ - _optional_ The form unique identificator. Used for inheritance of form configuration like ACR and email templates.
11
+ #
12
+ # See https://docs.kycaid.com/#create-a-verification for more info.
13
+ #
14
+ # Returns Response object, containing +verification_id+.
15
+ def self.create(params)
16
+ protected_params = params.slice(:applicant_id, :types, :callback_url, :form_id)
17
+ respond(post("/verifications", protected_params))
18
+ end
19
+
20
+ # Retrieve a verification by it's id.
21
+ #
22
+ # Returns Response object, conatining:
23
+ # * +:verification_id+ - The verification’s unique identificator.
24
+ # * +:status+ - Status of verification. Possible values: +unused+, +pending+, +completed+.
25
+ # * +:verified+ - Result of verification. Possible values: +true+ or +false+.
26
+ # * +:verifications+ - VerificationsList object.
27
+ #
28
+ # See https://docs.kycaid.com/#retrieve-a-verification for more info.
29
+ def self.fetch(verification_id)
30
+ respond(get("/verifications/#{verification_id}"))
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,3 @@
1
+ module KYCAIDPLUS
2
+ VERSION = "1.0.1"
3
+ end
data/lib/kycaidplus.rb ADDED
@@ -0,0 +1,46 @@
1
+ require "faraday"
2
+ require "json"
3
+ require "ostruct"
4
+
5
+ require "kycaidplus/version"
6
+ require "kycaidplus/configuration"
7
+ require "kycaidplus/client"
8
+ require "kycaidplus/response"
9
+ require "kycaidplus/applicant"
10
+ require "kycaidplus/file"
11
+ require "kycaidplus/document"
12
+ require "kycaidplus/address"
13
+ require "kycaidplus/verification"
14
+ require "kycaidplus/liveness"
15
+
16
+ # KYCAIDPLUS module contains wrappers around KYCAIDPLUS API.
17
+ # See https://kycaid.com/
18
+ module KYCAIDPLUS
19
+
20
+ # Error is generic error used in this gem.
21
+ # All defined errors are inherited from Error.
22
+ class Error < StandardError; end
23
+
24
+ # Unauthorized is raised when 403 status returned,
25
+ # when request is correct but refuses to authorize it.
26
+ # Check your token or contact KYCAIDPLUS support.
27
+ class Unauthorized < Error; end
28
+
29
+ class << self
30
+ attr_accessor :configuration
31
+ end
32
+
33
+ # Coinfigure allows to change gem preferences. Check Configuration for the list of options.
34
+ # ==== Example
35
+ #
36
+ # KYCAIDPLUS.configure do |c|
37
+ # c.authorization_token = '1MAR3SP3CTABL3t0k3N'
38
+ # c.sandbox_mode = false
39
+ # c.api_endpoint = 'https://api.kycaid.com/'
40
+ # c.raise_errors = true
41
+ # end
42
+ def self.configure
43
+ self.configuration ||= Configuration.new
44
+ yield(configuration) if block_given?
45
+ end
46
+ end
metadata ADDED
@@ -0,0 +1,206 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kycaidplus
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - PlutoNeXT
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-09-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '13.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '13.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: vcr
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: webmock
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: simplecov
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: faraday
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: faraday_middleware
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: json
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ description: Support of core functionalities of the KYC provider kycaid.com
154
+ email:
155
+ - support@plutonext.com
156
+ executables: []
157
+ extensions: []
158
+ extra_rdoc_files: []
159
+ files:
160
+ - ".drone.yml"
161
+ - ".gitignore"
162
+ - ".rspec"
163
+ - ".travis-yml"
164
+ - Gemfile
165
+ - Gemfile.lock
166
+ - README.md
167
+ - Rakefile
168
+ - bin/console
169
+ - bin/setup
170
+ - kycaidplus.gemspec
171
+ - lib/kycaidplus.rb
172
+ - lib/kycaidplus/address.rb
173
+ - lib/kycaidplus/applicant.rb
174
+ - lib/kycaidplus/client.rb
175
+ - lib/kycaidplus/configuration.rb
176
+ - lib/kycaidplus/document.rb
177
+ - lib/kycaidplus/file.rb
178
+ - lib/kycaidplus/liveness.rb
179
+ - lib/kycaidplus/response.rb
180
+ - lib/kycaidplus/verification.rb
181
+ - lib/kycaidplus/version.rb
182
+ homepage: https://kycaid.com/
183
+ licenses: []
184
+ metadata:
185
+ homepage_uri: https://kycaid.com/
186
+ source_code_uri: https://github.com/ianeinser/kycaidplus
187
+ post_install_message:
188
+ rdoc_options: []
189
+ require_paths:
190
+ - lib
191
+ required_ruby_version: !ruby/object:Gem::Requirement
192
+ requirements:
193
+ - - ">="
194
+ - !ruby/object:Gem::Version
195
+ version: 2.3.0
196
+ required_rubygems_version: !ruby/object:Gem::Requirement
197
+ requirements:
198
+ - - ">="
199
+ - !ruby/object:Gem::Version
200
+ version: '0'
201
+ requirements: []
202
+ rubygems_version: 3.0.3.1
203
+ signing_key:
204
+ specification_version: 4
205
+ summary: kycaid.com ruby library.
206
+ test_files: []