Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
The MIT License (MIT)

Copyright (c) 2016-2020 kushnir.yb
Copyright (c) 2020-2025 MaxMind, Inc.
Copyright (c) 2020-2026 MaxMind, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Minfraud.configure do |c|
c.license_key = 'your_license_key'
c.enable_validation = true
end
````
```

To use the Sandbox web service instead of the production web service, you can provide the host:

Expand All @@ -69,8 +69,8 @@ creating the object.

After populating the object, call the method for the minFraud endpoint you
want to use: `#score`, `#insights`, or `#factors`. The returned value is a
`MinFraud::Response` object. You can access the response model through its
`#body` attribute.
`Minfraud::HTTPService::Response` object. You can access the response model
through its `#body` attribute.

An exception will be thrown for critical errors. You should check for
`warnings` related to your inputs after a request.
Expand Down Expand Up @@ -245,6 +245,8 @@ this functionality.

The gem supplies several distinct exception-types:

* `InvalidInputError` - Raised if an input value is invalid when client-side
validation is enabled
* `RequestFormatError` - Raised if an unknown key is provided to the
`Minfraud::Assessments` constructor
* `ClientError` - Raised if the IP address is absent, reserved, or the JSON
Expand Down Expand Up @@ -295,7 +297,7 @@ This API uses [Semantic Versioning](https://semver.org/).

Copyright (c) 2016-2020 kushnir.yb.

Copyright (c) 2020-2025 MaxMind, Inc.
Copyright (c) 2020-2026 MaxMind, Inc.

The gem is available as open source under the terms of the [MIT
License](https://opensource.org/licenses/MIT).
Expand Down
11 changes: 6 additions & 5 deletions lib/minfraud/components/credit_card.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ class CreditCard < Base
# @return [String, nil]
attr_accessor :issuer_id_number

# The last two or four digits of the credit card number.
# The last two or four digits of the credit card number. In most cases,
# you should send the last four digits for +last_digits+.
#
# @see https://dev.maxmind.com/minfraud/api-documentation/requests?lang=en#schema--request--credit-card__last_digits
#
Expand Down Expand Up @@ -42,7 +43,7 @@ class CreditCard < Base
attr_accessor :bank_phone_number

# The two character ISO 3166-1 alpha-2 country code where the issuer of
# the card is located. This may be passed instead of {::issuer_id_number}
# the card is located. This may be passed instead of {#issuer_id_number}
# if you do not wish to pass partial account numbers, or if your payment
# processor does not provide them.
#
Expand Down Expand Up @@ -74,7 +75,7 @@ class CreditCard < Base
# @return [String, nil]
attr_accessor :cvv_result

# Whether the outcome of 3-D Secure verification (e.g. Safekey,
# Whether the outcome of 3-D Secure verification (e.g. SafeKey,
# SecureCode, Verified by Visa) was successful. +true+ if customer
# verification was successful, or +false+ if the customer failed
# verification. If 3-D Secure verification was not used, was unavailable,
Expand All @@ -86,7 +87,7 @@ class CreditCard < Base

# Get the last digits of the credit card number.
#
# @deprecated Use {::last_digits} instead.
# @deprecated Use {#last_digits} instead.
#
# @return [String, nil]
def last_4_digits
Expand All @@ -95,7 +96,7 @@ def last_4_digits

# Set the last digits of the credit card number.
#
# @deprecated Use {::last_digits} instead.
# @deprecated Use {#last_digits} instead.
#
# @return [String, nil]
def last_4_digits=(last4)
Expand Down
2 changes: 1 addition & 1 deletion lib/minfraud/components/email.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Minfraud
module Components
# Email corresponds to the email object of a minFraud request.
#
# @see https://dev.maxmind.com/minfraud/api-documentation/requests?lang=en#schema--request--email
# @see https://dev.maxmind.com/minfraud/api-documentation/requests/?lang=en#email
class Email < Base
include Minfraud::Validates

Expand Down
2 changes: 1 addition & 1 deletion lib/minfraud/components/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Event < Base

# The date and time the event occurred. The string must be in the RFC
# 3339 date-time format, e.g., "2012-04-12T23:20:50.52Z". The time must
# be within the past 10 years. If this field is not in the request, the
# be within the past year. If this field is not in the request, the
# current time will be used.
#
# @see https://tools.ietf.org/html/rfc3339
Expand Down
2 changes: 1 addition & 1 deletion lib/minfraud/components/order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Order < Base
include Minfraud::Validates

# The total order amount for the transaction before taxes and discounts.
# The value must be at least 0 and at most 1e14 - 1.
# The value must be at least 0 and at most 1e13 - 1.
#
# @return [Float, nil]
attr_accessor :amount
Expand Down
8 changes: 4 additions & 4 deletions lib/minfraud/components/shopping_cart_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ module Components
# ShoppingCartItem corresponds to objects in the shopping_cart object
# of a minFraud request.
#
# @see https://dev.maxmind.com/minfraud/api-documentation/requests?lang=en#schema--request--shopping-cart--item
# @see https://dev.maxmind.com/minfraud/api-documentation/requests?lang=en#schema--request--shopping-cart
class ShoppingCartItem < Base
include Minfraud::Validates

# The category of the item. This can also be a hashed value; see link.
#
# @see https://dev.maxmind.com/minfraud/api-documentation/requests?lang=en#schema--request--shopping-cart--item__category
# @see https://dev.maxmind.com/minfraud/api-documentation/requests/?lang=en#schema--request--shopping-cart__category
#
# @return [String, nil]
attr_accessor :category

# The internal ID of the item. This can also be a hashed value; see link.
#
# @see https://dev.maxmind.com/minfraud/api-documentation/requests?lang=en#schema--request--shopping-cart--item__item_id
# @see https://dev.maxmind.com/minfraud/api-documentation/requests/?lang=en#schema--request--shopping-cart__item_id
#
# @return [String, nil]
attr_accessor :item_id
Expand All @@ -31,7 +31,7 @@ class ShoppingCartItem < Base

# The per-unit price of this item in the shopping cart. This should use
# the same currency as the order currency. The value must be at least 0
# and at most 1e14 - 1.
# and at most 1e13 - 1.
#
# @return [Float, nil]
attr_accessor :price
Expand Down
4 changes: 2 additions & 2 deletions lib/minfraud/http_service/response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ module HTTPService
class Response
# Response HTTP status code.
#
# @return [Fixnum, nil]
# @return [Integer, nil]
attr_reader :status

# Response model.
#
# @return [Minfraud::Model::Score, Minfraud::Model::Insights,
# Minfraud::Model::Factors, nil]
# Minfraud::Model::Factors, Minfraud::Model::Error, nil]
attr_reader :body

# @param endpoint [Symbol, nil] endpoint name, like :score.
Expand Down
3 changes: 2 additions & 1 deletion lib/minfraud/model/email.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ class Email < Abstract

# A date string (e.g. 2017-04-24) to identify the date an email address
# was first seen by MaxMind. This is expressed using the ISO 8601 date
# format.
# format YYYY-MM-DD. The earliest date that may be returned is January
# 1, 2008.
#
# @return [String, nil]
attr_reader :first_seen
Expand Down
5 changes: 3 additions & 2 deletions lib/minfraud/model/email_domain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ class EmailDomain < Abstract
# @return [String, nil]
attr_reader :classification

# A date string (e.g. 2017-04-24) to identify the date an email domain
# A date string (e.g. 2019-01-01) to identify the date an email domain
# was first seen by MaxMind. This is expressed using the ISO 8601 date
# format.
# format YYYY-MM-DD. The earliest date that may be returned is January
# 1, 2019.
#
# @return [String, nil]
attr_reader :first_seen
Expand Down
17 changes: 10 additions & 7 deletions lib/minfraud/model/email_domain_visit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ module Model
# Model containing information about an automated visit to the email
# domain.
class EmailDomainVisit < Abstract
# Whether the domain redirects to another URL.
# This is true if the domain in the request has redirects (configured
# to automatically send visitors to another URL). Otherwise, this will
# be nil.
#
# @return [Boolean, nil]
attr_reader :has_redirect
Expand All @@ -19,12 +21,13 @@ class EmailDomainVisit < Abstract
attr_reader :last_visited_on

# The status of the domain. Possible values are:
# * live - The domain is operational and serving content.
# * dns_error - The domain has missing, expired, or misconfigured DNS.
# * network_error - The domain is offline or unreachable.
# * http_error - The domain is reachable, but has an application error.
# * parked - The domain is reachable and in a parked state.
# * pre_development - The domain is reachable and in a pre-development
# * live - The domain is reachable and serving content normally.
# * dns_error - The domain is missing, expired, or DNS is misconfigured.
# * network_error - The domain is offline, blocked, or unreachable.
# * http_error - The domain is reachable but the web application had a
# problem or denied the request.
# * parked - The domain is live and is in a parked state.
# * pre_development - The domain is live and is in a pre-development
# state.
#
# @return [String, nil]
Expand Down
2 changes: 1 addition & 1 deletion lib/minfraud/model/factors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Factors < Insights
# that are used to calculate the overall risk score.
#
# @return [Minfraud::Model::Subscores]
# @deprecated Use {::risk_score_reasons} instead.
# @deprecated Use {#risk_score_reasons} instead.
attr_reader :subscores

# @!visibility private
Expand Down
4 changes: 3 additions & 1 deletion lib/minfraud/model/shipping_address.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Minfraud
module Model
# Model containing information about the shipping address.
class ShippingAddress < Address
# The distance in kilometers from the shipping address to billing
# The distance in kilometers from the shipping address to the billing
# address.
#
# @return [Integer, nil]
Expand All @@ -16,6 +16,8 @@ class ShippingAddress < Address
# with fraudulent transactions. The field is false when the address is
# not associated with increased risk. The key will only be present when a
# shipping address is provided.
#
# @return [Boolean, nil]
attr_reader :is_high_risk

# @!visibility private
Expand Down
15 changes: 13 additions & 2 deletions lib/minfraud/model/warning.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,30 @@ module Model
# our database.
# * BILLING_POSTAL_NOT_FOUND - the billing postal could not be found in our
# database.
# * BILLING_REGION_NOT_FOUND - the billing region could not be found in our
# database.
# * EMAIL_ADDRESS_UNUSABLE - the email address entered is likely incorrect
# due to an integration issue. To avoid false positives, it has not been
# used in scoring.
# * INPUT_INVALID - the value associated with the key does not meet the
# required constraints, e.g., "United States" in a field that requires a
# two-letter country code.
# * INPUT_UNKNOWN - an unknown key was encountered in the request body.
# * IP_ADDRESS_INVALID - the IP address supplied is not a valid IPv4 or
# IPv6 address.
# * IP_ADDRESS_NOT_FOUND - the IP address could not be geolocated.
# * SHIPPING_COUNTRY_MISSING - shipping address information was provided
# without providing a shipping country.
# * IP_ADDRESS_RESERVED - the IP address supplied is in a reserved
# network.
# * SHIPPING_CITY_NOT_FOUND - the shipping city could not be found in our
# database.
# * SHIPPING_COUNTRY_MISSING - shipping address information was provided
# without providing a shipping country.
# * SHIPPING_COUNTRY_NOT_FOUND - the shipping country could not be found in
# our database.
# * SHIPPING_POSTAL_NOT_FOUND - the shipping postal could not be found in
# our database.
# * SHIPPING_REGION_NOT_FOUND - the shipping region could not be found in
# our database.
class Warning < Abstract
# This value is a machine-readable code identifying the warning.
#
Expand Down