Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/blueberryapps/netverify-engine
Jumio Netverify integration into Rails app as an engine
https://github.com/blueberryapps/netverify-engine
Last synced: about 7 hours ago
JSON representation
Jumio Netverify integration into Rails app as an engine
- Host: GitHub
- URL: https://github.com/blueberryapps/netverify-engine
- Owner: blueberryapps
- License: mit
- Created: 2014-11-18T11:49:25.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2023-01-19T04:14:02.000Z (almost 2 years ago)
- Last Synced: 2024-04-09T21:49:12.602Z (7 months ago)
- Language: Ruby
- Size: 45.9 KB
- Stars: 2
- Watchers: 6
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: MIT-LICENSE
Awesome Lists containing this project
README
# Netverify API validation implementation for Rails
## Installation
TODO: Installation as gem
1. Mount engine to your `config/routes.rb`
```ruby
mount Netverify::Engine, at: 'netverify'
```2. Install migrations of netverify
```console
rake netverify:install:migrations
rake db:migrate
```3. In the model you want to validate (you can have more of them), add
```ruby
has_one :validation, as: :validatable, class: 'Netverify::Validation'
```## Usage
### Basic usage - API
In your controller/wherever, call the instantiate the class and run
`perform!````ruby
# user is an instance the User model
user = User.first# opts are all options, you can pass in as of Netverify integration
# guide version (v 1.7.3)
# all keys are handled as underscore (original
# merchantIdScanReference is merchant_id_scan_reference in gem)
opts = { merchant_id_scan_reference: '',
frontside_image: '' }validator = Netverify::ApiValidator.new(user, opts)
validator.perform!
```### Basic usage - IFRAME
In your controller/wherever, call instantiate the class and run
`perform_initiation!`After the user finishes uploading his documents, a simple GET request is
sent back to the site and renders in the iframe (mounted to
`/netverify/validations/{success,error}`).There is a basic implementation of the success/error page, which you can
override by creating new view files in your application at
`app/views/netverify/validations/{success,error}.html.````ruby
# user in an instance of the User model
user = User.first# opts are all options, you can pass in as of Netverify integration
# guide (version 1.7.3)
opts = {
merchant_id_scan_reference: ''
}validator = Netverify::IframeValidator.new(user, opts)
validator.perform_initiation!
```### Running callbacks
Netverify calls a callback (mounted to `/netverify/validations/callback`).
After the state has changed, a new callback is called and you can implement it
on the class (here `User`).If you want to run a callback after the state has changed by Netverify,
you can do it the following way.```ruby
class User < ActiveRecord::Base
include Netverify::Callbacksafter_netverify_state_changed :do_something
private
def do_something
...
end
end
```