Giter Club home page Giter Club logo

maxmind's Introduction

maxmind

An unofficial wrapper around MaxMind's minFraud anti-fraud service.

For MaxMind's Proxy Detection Service, see this gem: https://github.com/eric-smartlove/maxmind_proxy_detection

Installation

In your Gemfile;

gem 'maxmind'

Tests

bundle install
bundle exec guard

Dependencies

bundle install

Running Tests

Run bundle install to make sure you have all the dependencies. Once that's done, run:

rake spec

Usage

Minimum Required

These are the only required fields to acquire a response from MaxMind.

require 'maxmind'
Maxmind.license_key = 'LICENSE_KEY'
request = Maxmind::Request.new(
  :client_ip => '24.24.24.24'
)

  response = request.process!

Recommended

For increased accuracy, these are the recommended fields to submit to MaxMind. The additional fields here are optional and can be all or none.

require 'maxmind'
Maxmind.license_key = 'LICENSE_KEY'
request = Maxmind::Request.new(
	  :client_ip => '24.24.24.24',
	  :city => 'New York',
	  :region	=> 'NY',
	  :postal	=> '11434',
	  :country => 'US',
	  :domain => 'yahoo.com',
  :bin => '549099',
  :forwarded_ip => '24.24.24.25',
  :email => '[email protected]',
  :username => 'test_carder_username',
  :password => 'test_carder_password'
)

  response = request.process!

Thorough

This is every field available.

require 'maxmind'
Maxmind.license_key = 'LICENSE_KEY'
request = Maxmind::Request.new(
  :client_ip => '24.24.24.24',
  :city => 'New York',
  :region	=> 'NY',
  :postal	=> '11434',
  :country => 'US',
  :domain => 'yahoo.com',
  :bin => '549099',
  :forwarded_ip => '24.24.24.25',
  :email => '[email protected]',
  :username => 'test_carder_username',
  :password => 'test_carder_password'
  :bin_name => 'MBNA America Bank',
  :bin_phone => '800-421-2110',
  :cust_phone => '212-242',
  :request_type => 'premium',
  :shipping_address => '145-50 157th Street',
  :shipping_city => 'Jamaica',
  :shipping_region => 'NY',
  :shipping_postal => '11434',
  :shipping_country => 'US',
  :transaction_id => '1234',
  :session_id => 'abcd9876',
  :user_agent => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_5; en-us) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.20.1',
  :accept_language => 'en-us'
)

  response = request.process!

TODO

  • Improve specs (eg, test server failover)

Reference

minFraud API Reference

Also see examples/example.rb

Chargeback Service

You can help improve the Minfraud service by reporting instances of fraud. Only the IP address of a suspected fraudulent order is required, but you can pass additional information. Note that your Maxmind User ID is required in addition to your license key.

Chargeback Service Usage

Minimum Required

These are the only required fields to acquire a response from MaxMind.

require 'maxmind'
Maxmind.license_key = 'LICENSE_KEY'
Maxmind.user_id     = 'MAXMIND_USER_ID'
request = Maxmind::ChargebackRequest.new(
  :client_ip => '24.24.24.24'
)

  response = request.process!

Recommended

For increased accuracy, these are the recommended fields to submit to MaxMind. The additional fields here are optional and can be all or none.

require 'maxmind'
Maxmind.license_key = 'LICENSE_KEY'
Maxmind.user_id     = 'MAXMIND_USER_ID'
request = Maxmind::ChargebackRequest.new(
  :client_ip       => '24.24.24.24',
  :chargeback_code => 'Fraud',
  :fraud_score     => 'suspected_fraud',
  :maxmind_id      => 'KW36L83C',
  :transaction_id  => '12345'
)

response = request.process!

minFraud Chargeback reference

Contributors

Thanks to all :)

Copyright

Copyright (c) 2009 Adam Daniels [email protected].

See LICENSE for details.

maxmind's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

maxmind's Issues

Response object turns any field with 'no' into false

If you have a response that has the name/value pair of:

explanation=This order is very high risk, and we suggest you not accept it.

response.attributes[:explanation] gets set to false. In Response#set_attribute there's this code:

  case v
  when /[Yy]es/
    attributes[k] = true
  when /[Nn]o/
    attributes[k] = false
  else
    attributes[k] = v
  end

Since 'no' is a substring of the value, it triggers the second case. The regex should be more like /\A[Nn]o\Z/

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.