Code Monkey home page Code Monkey logo

alloy-kyc's Introduction

Installation

Add this line to your application's Gemfile:

gem 'alloy-kyc'

And then execute:

$ bundle

Or install it yourself as:

$ gem install alloy-kyc

Usage

Configure the gem using your issued Alloy credentials in an initializer file. For example, in config/initializers/alloy-kyc.rb:

Alloy::KYC.configure do |config|
  config.application_token = ENV['ALLOY_APPLICATION_TOKEN']
  config.application_secret = ENV['ALLOY_APPLICATION_SECRET']
  config.api_endpoint = "https://alloy.co/v1/"
  config.open_timeout = 1 # default is 2 seconds
  config.read_timeout = 3 # default is 5 seconds
end

Create a new evaluation:

Alloy::KYC::Evaluation.create({
    phone_number: "18042562188",
    name_first: "Thomas",
    name_last: "Nicholas",
    email_address: "[email protected]",
    birth_date: "1985-01-23",
    address_line_1: "1717 E Test St",
    address_city: "Richmond",
    address_state: "VA",
    document_ssn: "123456789",
    address_postal_code: "23220",
    address_country_code: "US",
    social_twitter: "tommyrva"
  })

If evaluation requires further information around out-of-wallet questions:

evaluation = Alloy::KYC::Evaluation.create({phone_number: "18042562188", name_first: "Thomas",...})
if evaluation.requires_oow?
  # collect answers and either match locally or resubmit
  updated_evaluation = evaluation.submit_oow_responses(responses)
end

Testing

To prevent this gem from making API calls when your tests are running, use mock mode:

Alloy::KYC.mock_mode!

When in mock mode methods will return "successful" results; i.e., a call to Alloy::KYC::Evaluation.create will return an Evaluation that doesn't require an out of wallet followup. To simulate a failure, call Alloy::KYC::Evaluation.create with a document_ssn of 111223333:

Alloy::KYC::Evaluation.create(document_ssn: "111223333", ...) # any other parameters are ignored

Similarly, you can simulate an out-of-wallet response that requires more responses by passing that same document_ssn to submit_oow_responses:

# given an existing Evaluation e:
e.submit_oow_responses({document_ssn: "111223333", ...}) # any other parameters are ignored

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/qedinvestors/alloy-kyc.

License

The gem is available as open source under the terms of the MIT License.

alloy-kyc's People

Contributors

tommotorefi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.