minfraud 1.0.4 → 2.4.0
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 +5 -5
- data/.github/dependabot.yml +11 -0
- data/.github/workflows/release.yml +28 -0
- data/.github/workflows/rubocop.yml +18 -0
- data/.github/workflows/test.yml +36 -0
- data/.gitignore +2 -0
- data/.rubocop.yml +90 -0
- data/CHANGELOG.md +197 -4
- data/CODE_OF_CONDUCT.md +4 -4
- data/Gemfile +2 -2
- data/LICENSE.txt +2 -1
- data/README.dev.md +4 -0
- data/README.md +255 -58
- data/Rakefile +9 -3
- data/bin/console +4 -3
- data/dev-bin/release.sh +59 -0
- data/lib/minfraud/assessments.rb +127 -53
- data/lib/minfraud/components/account.rb +31 -9
- data/lib/minfraud/components/addressable.rb +73 -26
- data/lib/minfraud/components/base.rb +26 -14
- data/lib/minfraud/components/billing.rb +5 -0
- data/lib/minfraud/components/credit_card.rb +117 -29
- data/lib/minfraud/components/custom_inputs.rb +25 -0
- data/lib/minfraud/components/device.rb +51 -10
- data/lib/minfraud/components/email.rb +120 -9
- data/lib/minfraud/components/event.rb +60 -13
- data/lib/minfraud/components/order.rb +59 -22
- data/lib/minfraud/components/payment.rb +192 -22
- data/lib/minfraud/components/report/transaction.rb +80 -0
- data/lib/minfraud/components/shipping.rb +15 -6
- data/lib/minfraud/components/shopping_cart.rb +19 -12
- data/lib/minfraud/components/shopping_cart_item.rb +42 -13
- data/lib/minfraud/enum.rb +22 -8
- data/lib/minfraud/error_handler.rb +45 -18
- data/lib/minfraud/errors.rb +22 -2
- data/lib/minfraud/http_service/response.rb +61 -17
- data/lib/minfraud/model/abstract.rb +20 -0
- data/lib/minfraud/model/address.rb +52 -0
- data/lib/minfraud/model/billing_address.rb +11 -0
- data/lib/minfraud/model/credit_card.rb +75 -0
- data/lib/minfraud/model/device.rb +51 -0
- data/lib/minfraud/model/disposition.rb +42 -0
- data/lib/minfraud/model/email.rb +54 -0
- data/lib/minfraud/model/email_domain.rb +24 -0
- data/lib/minfraud/model/error.rb +28 -0
- data/lib/minfraud/model/factors.rb +24 -0
- data/lib/minfraud/model/geoip2_location.rb +25 -0
- data/lib/minfraud/model/insights.rb +68 -0
- data/lib/minfraud/model/ip_address.rb +58 -0
- data/lib/minfraud/model/ip_risk_reason.rb +48 -0
- data/lib/minfraud/model/issuer.rb +49 -0
- data/lib/minfraud/model/score.rb +76 -0
- data/lib/minfraud/model/score_ip_address.rb +23 -0
- data/lib/minfraud/model/shipping_address.rb +30 -0
- data/lib/minfraud/model/subscores.rb +156 -0
- data/lib/minfraud/model/warning.rb +63 -0
- data/lib/minfraud/report.rb +66 -0
- data/lib/minfraud/resolver.rb +25 -16
- data/lib/minfraud/validates.rb +187 -0
- data/lib/minfraud/version.rb +4 -1
- data/lib/minfraud.rb +55 -16
- data/minfraud.gemspec +27 -18
- metadata +107 -36
- data/.travis.yml +0 -5
- data/lib/minfraud/http_service/request.rb +0 -37
- data/lib/minfraud/http_service.rb +0 -31
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'minfraud/model/abstract'
|
4
|
+
require 'minfraud/model/email_domain'
|
5
|
+
|
6
|
+
module Minfraud
|
7
|
+
module Model
|
8
|
+
# Model containing information about the email address.
|
9
|
+
class Email < Abstract
|
10
|
+
# An object containing information about the email domain.
|
11
|
+
#
|
12
|
+
# @return [Minfraud::Model::EmailDomain]
|
13
|
+
attr_reader :domain
|
14
|
+
|
15
|
+
# A date string (e.g. 2017-04-24) to identify the date an email address
|
16
|
+
# was first seen by MaxMind. This is expressed using the ISO 8601 date
|
17
|
+
# format.
|
18
|
+
#
|
19
|
+
# @return [String, nil]
|
20
|
+
attr_reader :first_seen
|
21
|
+
|
22
|
+
# Whether this email address is from a disposable email provider. The
|
23
|
+
# value will be nil when no email address or email domain has been passed
|
24
|
+
# as an input.
|
25
|
+
#
|
26
|
+
# @return [Boolean, nil]
|
27
|
+
attr_reader :is_disposable
|
28
|
+
|
29
|
+
# This property is true if MaxMind believes that this email is hosted by
|
30
|
+
# a free email provider such as Gmail or Yahoo! Mail.
|
31
|
+
#
|
32
|
+
# @return [Boolean, nil]
|
33
|
+
attr_reader :is_free
|
34
|
+
|
35
|
+
# This field is true if MaxMind believes that this email is likely to be
|
36
|
+
# used for fraud. Note that this is also factored into the overall
|
37
|
+
# risk_score in the response as well.
|
38
|
+
#
|
39
|
+
# @return [Boolean, nil]
|
40
|
+
attr_reader :is_high_risk
|
41
|
+
|
42
|
+
# @!visibility private
|
43
|
+
def initialize(record)
|
44
|
+
super(record)
|
45
|
+
|
46
|
+
@domain = Minfraud::Model::EmailDomain.new(get('domain'))
|
47
|
+
@first_seen = get('first_seen')
|
48
|
+
@is_disposable = get('is_disposable')
|
49
|
+
@is_free = get('is_free')
|
50
|
+
@is_high_risk = get('is_high_risk')
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'minfraud/model/abstract'
|
4
|
+
|
5
|
+
module Minfraud
|
6
|
+
module Model
|
7
|
+
# Model containing information about the email domain.
|
8
|
+
class EmailDomain < Abstract
|
9
|
+
# A date string (e.g. 2017-04-24) to identify the date an email domain
|
10
|
+
# was first seen by MaxMind. This is expressed using the ISO 8601 date
|
11
|
+
# format.
|
12
|
+
#
|
13
|
+
# @return [String, nil]
|
14
|
+
attr_reader :first_seen
|
15
|
+
|
16
|
+
# @!visibility private
|
17
|
+
def initialize(record)
|
18
|
+
super(record)
|
19
|
+
|
20
|
+
@first_seen = get('first_seen')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'minfraud/model/abstract'
|
4
|
+
|
5
|
+
module Minfraud
|
6
|
+
module Model
|
7
|
+
# Model with information about an error.
|
8
|
+
class Error < Abstract
|
9
|
+
# An error code for machine use.
|
10
|
+
#
|
11
|
+
# @return [String]
|
12
|
+
attr_reader :code
|
13
|
+
|
14
|
+
# A human readable error message.
|
15
|
+
#
|
16
|
+
# @return [String]
|
17
|
+
attr_reader :error
|
18
|
+
|
19
|
+
# @!visibility private
|
20
|
+
def initialize(record)
|
21
|
+
super(record)
|
22
|
+
|
23
|
+
@code = get('code')
|
24
|
+
@error = get('error')
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'minfraud/model/insights'
|
4
|
+
require 'minfraud/model/subscores'
|
5
|
+
|
6
|
+
module Minfraud
|
7
|
+
module Model
|
8
|
+
# Model representing the Factors response.
|
9
|
+
class Factors < Insights
|
10
|
+
# An object containing scores for many of the individual risk factors
|
11
|
+
# that are used to calculate the overall risk score.
|
12
|
+
#
|
13
|
+
# @return [Minfraud::Model::Subscores]
|
14
|
+
attr_reader :subscores
|
15
|
+
|
16
|
+
# @!visibility private
|
17
|
+
def initialize(record, locales)
|
18
|
+
super(record, locales)
|
19
|
+
|
20
|
+
@subscores = Minfraud::Model::Subscores.new(get('subscores'))
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'maxmind/geoip2/record/location'
|
4
|
+
|
5
|
+
module Minfraud
|
6
|
+
module Model
|
7
|
+
# Model of the GeoIP2 location information, including the local time.
|
8
|
+
class GeoIP2Location < MaxMind::GeoIP2::Record::Location
|
9
|
+
# The date and time of the transaction in the time zone associated with
|
10
|
+
# the IP address. The value is formatted according to RFC 3339. For
|
11
|
+
# instance, the local time in Boston might be returned as
|
12
|
+
# 2015-04-27T19:17:24-04:00.
|
13
|
+
#
|
14
|
+
# @return [String]
|
15
|
+
attr_reader :local_time
|
16
|
+
|
17
|
+
# @!visibility private
|
18
|
+
def initialize(record)
|
19
|
+
super(record)
|
20
|
+
|
21
|
+
@local_time = get('local_time')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'minfraud/model/billing_address'
|
4
|
+
require 'minfraud/model/credit_card'
|
5
|
+
require 'minfraud/model/device'
|
6
|
+
require 'minfraud/model/email'
|
7
|
+
require 'minfraud/model/ip_address'
|
8
|
+
require 'minfraud/model/score'
|
9
|
+
require 'minfraud/model/shipping_address'
|
10
|
+
|
11
|
+
module Minfraud
|
12
|
+
module Model
|
13
|
+
# Model of the Insights response.
|
14
|
+
class Insights < Score
|
15
|
+
# An object containing minFraud data related to the billing address used
|
16
|
+
# in the transaction.
|
17
|
+
#
|
18
|
+
# @return [Minfraud::Model::BillingAddress]
|
19
|
+
attr_reader :billing_address
|
20
|
+
|
21
|
+
# An object containing minFraud data about the credit card used in the
|
22
|
+
# transaction.
|
23
|
+
#
|
24
|
+
# @return [Minfraud::Model::CreditCard]
|
25
|
+
attr_reader :credit_card
|
26
|
+
|
27
|
+
# This object contains information about the device that MaxMind believes
|
28
|
+
# is associated with the IP address passed in the request.
|
29
|
+
#
|
30
|
+
# @return [Minfraud::Model::Device]
|
31
|
+
attr_reader :device
|
32
|
+
|
33
|
+
# This object contains information about the email address passed in the
|
34
|
+
# request.
|
35
|
+
#
|
36
|
+
# @return [Minfraud::Model::Email]
|
37
|
+
attr_reader :email
|
38
|
+
|
39
|
+
# An object containing GeoIP2 and minFraud Insights information about the
|
40
|
+
# geolocated IP address.
|
41
|
+
#
|
42
|
+
# @return [Minfraud::Model::IPAddress]
|
43
|
+
attr_reader :ip_address
|
44
|
+
|
45
|
+
# An object containing minFraud data related to the shipping address used
|
46
|
+
# in the transaction.
|
47
|
+
#
|
48
|
+
# @return [Minfraud::Model::ShippingAddress]
|
49
|
+
attr_reader :shipping_address
|
50
|
+
|
51
|
+
# @!visibility private
|
52
|
+
def initialize(record, locales)
|
53
|
+
super(record, locales)
|
54
|
+
|
55
|
+
@billing_address = Minfraud::Model::BillingAddress.new(
|
56
|
+
get('billing_address')
|
57
|
+
)
|
58
|
+
@credit_card = Minfraud::Model::CreditCard.new(get('credit_card'))
|
59
|
+
@device = Minfraud::Model::Device.new(get('device'))
|
60
|
+
@email = Minfraud::Model::Email.new(get('email'))
|
61
|
+
@ip_address = Minfraud::Model::IPAddress.new(get('ip_address'), locales)
|
62
|
+
@shipping_address = Minfraud::Model::ShippingAddress.new(
|
63
|
+
get('shipping_address')
|
64
|
+
)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'maxmind/geoip2/model/insights'
|
4
|
+
require 'minfraud/model/geoip2_location'
|
5
|
+
require 'minfraud/model/ip_risk_reason'
|
6
|
+
|
7
|
+
module Minfraud
|
8
|
+
module Model
|
9
|
+
# Model containing GeoIP2 data and the risk for the IP address.
|
10
|
+
class IPAddress < MaxMind::GeoIP2::Model::Insights
|
11
|
+
# This field contains the risk associated with the IP address. The value
|
12
|
+
# ranges from 0.01 to 99. A higher score indicates a higher risk.
|
13
|
+
#
|
14
|
+
# @return [Float]
|
15
|
+
attr_reader :risk
|
16
|
+
|
17
|
+
# This field contains IPRiskReason objects identifying the reasons why
|
18
|
+
# the IP address received the associated risk. This will be an empty
|
19
|
+
# array if there are no reasons.
|
20
|
+
#
|
21
|
+
# @return [Array<Minfraud::Model::IPRiskReason>]
|
22
|
+
attr_reader :risk_reasons
|
23
|
+
|
24
|
+
# @!visibility private
|
25
|
+
def initialize(record, locales)
|
26
|
+
if record
|
27
|
+
super(record, locales)
|
28
|
+
else
|
29
|
+
super({}, locales)
|
30
|
+
end
|
31
|
+
|
32
|
+
if record
|
33
|
+
@location = Minfraud::Model::GeoIP2Location.new(record.fetch('location', nil))
|
34
|
+
else
|
35
|
+
@location = Minfraud::Model::GeoIP2Location.new(nil)
|
36
|
+
end
|
37
|
+
if record
|
38
|
+
@risk = record.fetch('risk', nil)
|
39
|
+
else
|
40
|
+
@risk = nil
|
41
|
+
end
|
42
|
+
|
43
|
+
@risk_reasons = []
|
44
|
+
if record&.key?('risk_reasons')
|
45
|
+
record['risk_reasons'].each do |r|
|
46
|
+
@risk_reasons << Minfraud::Model::IPRiskReason.new(r)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# These attributes are deprecated and aren't in maxmind-geoip2. The
|
51
|
+
# webservice still sends them as of writing, so we'd like to keep them
|
52
|
+
# for now as they could still be providing value.
|
53
|
+
@traits.define_singleton_method(:is_anonymous_proxy) { get('is_anonymous_proxy') }
|
54
|
+
@traits.define_singleton_method(:is_satellite_provider) { get('is_satellite_provider') }
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'minfraud/model/abstract'
|
4
|
+
|
5
|
+
module Minfraud
|
6
|
+
module Model
|
7
|
+
# Reason for the IP risk.
|
8
|
+
#
|
9
|
+
# This class provides both a machine-readable code and a human-readable
|
10
|
+
# explanation of the reason for the IP risk score.
|
11
|
+
#
|
12
|
+
# Although more codes may be added in the future, the current codes are:
|
13
|
+
#
|
14
|
+
# * ANONYMOUS_IP - The IP address belongs to an anonymous network. See the
|
15
|
+
# object at ip_address.traits for more details.
|
16
|
+
# * BILLING_POSTAL_VELOCITY - Many different billing postal codes have been
|
17
|
+
# seen on this IP address.
|
18
|
+
# * EMAIL_VELOCITY - Many different email addresses have been seen on this
|
19
|
+
# IP address.
|
20
|
+
# * HIGH_RISK_DEVICE - A high risk device was seen on this IP address.
|
21
|
+
# * HIGH_RISK_EMAIL - A high risk email address was seen on this IP address
|
22
|
+
# in your past transactions.
|
23
|
+
# * ISSUER_ID_NUMBER_VELOCITY - Many different issuer ID numbers have been
|
24
|
+
# seen on this IP address.
|
25
|
+
# * MINFRAUD_NETWORK_ACTIVITY - Suspicious activity has been seen on this
|
26
|
+
# IP address across minFraud customers.
|
27
|
+
class IPRiskReason < Abstract
|
28
|
+
# This value is a machine-readable code identifying the reason.
|
29
|
+
#
|
30
|
+
# @return [String, nil]
|
31
|
+
attr_reader :code
|
32
|
+
|
33
|
+
# This field provides a human-readable explanation of the reason. The
|
34
|
+
# text may change at any time and should not be matched against.
|
35
|
+
#
|
36
|
+
# @return [String, nil]
|
37
|
+
attr_reader :reason
|
38
|
+
|
39
|
+
# @!visibility private
|
40
|
+
def initialize(record)
|
41
|
+
super(record)
|
42
|
+
|
43
|
+
@code = get('code')
|
44
|
+
@reason = get('reason')
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'minfraud/model/abstract'
|
4
|
+
|
5
|
+
module Minfraud
|
6
|
+
module Model
|
7
|
+
# Model containing information about the card issuer.
|
8
|
+
class Issuer < Abstract
|
9
|
+
# The name of the bank which issued the credit card.
|
10
|
+
#
|
11
|
+
# @return [String, nil]
|
12
|
+
attr_reader :name
|
13
|
+
|
14
|
+
# This property is true if the name matches the name provided in the
|
15
|
+
# request for the card issuer. It is false if the name does not match.
|
16
|
+
# The property is nil if either no name or issuer ID number (IIN) was
|
17
|
+
# provided in the request or if MaxMind does not have a name associated
|
18
|
+
# with the IIN.
|
19
|
+
#
|
20
|
+
# @return [Boolean, nil]
|
21
|
+
attr_reader :matches_provided_name
|
22
|
+
|
23
|
+
# This property is true if the phone number matches the number provided
|
24
|
+
# in the request for the card issuer. It is false if the number does not
|
25
|
+
# match. It is nil if either no phone number was provided or issuer ID
|
26
|
+
# number (IIN) was provided in the request or if MaxMind does not have a
|
27
|
+
# phone number associated with the IIN.
|
28
|
+
#
|
29
|
+
# @return [Boolean, nil]
|
30
|
+
attr_reader :matches_provided_phone_number
|
31
|
+
|
32
|
+
# The phone number of the bank which issued the credit card. In some
|
33
|
+
# cases the phone number we return may be out of date.
|
34
|
+
#
|
35
|
+
# @return [String, nil]
|
36
|
+
attr_reader :phone_number
|
37
|
+
|
38
|
+
# @!visibility private
|
39
|
+
def initialize(record)
|
40
|
+
super(record)
|
41
|
+
|
42
|
+
@name = get('name')
|
43
|
+
@phone_number = get('phone_number')
|
44
|
+
@matches_provided_name = get('matches_provided_name')
|
45
|
+
@matches_provided_phone_number = get('matches_provided_phone_number')
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'minfraud/model/abstract'
|
4
|
+
require 'minfraud/model/disposition'
|
5
|
+
require 'minfraud/model/score_ip_address'
|
6
|
+
require 'minfraud/model/warning'
|
7
|
+
|
8
|
+
module Minfraud
|
9
|
+
module Model
|
10
|
+
# Model of the Score response.
|
11
|
+
class Score < Abstract
|
12
|
+
# An object containing the disposition set by custom rules.
|
13
|
+
#
|
14
|
+
# @return [Minfraud::Model::Disposition]
|
15
|
+
attr_reader :disposition
|
16
|
+
|
17
|
+
# The approximate US dollar value of the funds remaining on your MaxMind
|
18
|
+
# account.
|
19
|
+
#
|
20
|
+
# @return [Float]
|
21
|
+
attr_reader :funds_remaining
|
22
|
+
|
23
|
+
# This is a UUID that identifies the minFraud request. Please use this ID
|
24
|
+
# in bug reports or support requests to MaxMind so that we can easily
|
25
|
+
# identify a particular request.
|
26
|
+
#
|
27
|
+
# @return [String]
|
28
|
+
attr_reader :id
|
29
|
+
|
30
|
+
# An object containing the IP risk for the transaction.
|
31
|
+
#
|
32
|
+
# @return [Minfraud::Model::ScoreIPAddress]
|
33
|
+
attr_reader :ip_address
|
34
|
+
|
35
|
+
# The approximate number of queries remaining for this service before
|
36
|
+
# your account runs out of funds.
|
37
|
+
#
|
38
|
+
# @return [Integer]
|
39
|
+
attr_reader :queries_remaining
|
40
|
+
|
41
|
+
# This property contains the risk score, from 0.01 to 99. A higher score
|
42
|
+
# indicates a higher risk of fraud. For example, a score of 20 indicates
|
43
|
+
# a 20% chance that a transaction is fraudulent. We never return a risk
|
44
|
+
# score of 0, since all transactions have the possibility of being
|
45
|
+
# fraudulent. Likewise we never return a risk score of 100.
|
46
|
+
#
|
47
|
+
# @return [Float]
|
48
|
+
attr_reader :risk_score
|
49
|
+
|
50
|
+
# This array contains objects detailing issues with the request that was
|
51
|
+
# sent, such as invalid or unknown inputs. It is highly recommended that
|
52
|
+
# you check this array for issues when integrating the web service.
|
53
|
+
#
|
54
|
+
# @return [Array<Minfraud::Model::Warning>]
|
55
|
+
attr_reader :warnings
|
56
|
+
|
57
|
+
# @!visibility private
|
58
|
+
def initialize(record, _locales)
|
59
|
+
super(record)
|
60
|
+
|
61
|
+
@disposition = Minfraud::Model::Disposition.new(get('disposition'))
|
62
|
+
@funds_remaining = get('funds_remaining')
|
63
|
+
@id = get('id')
|
64
|
+
@ip_address = Minfraud::Model::ScoreIPAddress.new(get('ip_address'))
|
65
|
+
@queries_remaining = get('queries_remaining')
|
66
|
+
@risk_score = get('risk_score')
|
67
|
+
@warnings = []
|
68
|
+
if record&.key?('warnings')
|
69
|
+
record['warnings'].each do |w|
|
70
|
+
@warnings << Minfraud::Model::Warning.new(w)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'minfraud/model/abstract'
|
4
|
+
|
5
|
+
module Minfraud
|
6
|
+
module Model
|
7
|
+
# Model containing the IP address's risk for the Score response.
|
8
|
+
class ScoreIPAddress < Abstract
|
9
|
+
# This field contains the risk associated with the IP address. The value
|
10
|
+
# ranges from 0.01 to 99. A higher score indicates a higher risk.
|
11
|
+
#
|
12
|
+
# @return [Float]
|
13
|
+
attr_reader :risk
|
14
|
+
|
15
|
+
# @!visibility private
|
16
|
+
def initialize(record)
|
17
|
+
super(record)
|
18
|
+
|
19
|
+
@risk = get('risk')
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'minfraud/model/address'
|
4
|
+
|
5
|
+
module Minfraud
|
6
|
+
module Model
|
7
|
+
# Model containing information about the shipping address.
|
8
|
+
class ShippingAddress < Address
|
9
|
+
# The distance in kilometers from the shipping address to billing
|
10
|
+
# address.
|
11
|
+
#
|
12
|
+
# @return [Integer, nil]
|
13
|
+
attr_reader :distance_to_billing_address
|
14
|
+
|
15
|
+
# This field is true if the shipping address is an address associated
|
16
|
+
# with fraudulent transactions. The field is false when the address is
|
17
|
+
# not associated with increased risk. The key will only be present when a
|
18
|
+
# shipping address is provided.
|
19
|
+
attr_reader :is_high_risk
|
20
|
+
|
21
|
+
# @!visibility private
|
22
|
+
def initialize(record)
|
23
|
+
super(record)
|
24
|
+
|
25
|
+
@distance_to_billing_address = get('distance_to_billing_address')
|
26
|
+
@is_high_risk = get('is_high_risk')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,156 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'minfraud/model/abstract'
|
4
|
+
|
5
|
+
module Minfraud
|
6
|
+
module Model
|
7
|
+
# Score for risk factors that are used in calculating the riskScore.
|
8
|
+
class Subscores < Abstract
|
9
|
+
# The risk associated with the AVS result. If present, this is a value in
|
10
|
+
# the range 0.01 to 99.
|
11
|
+
#
|
12
|
+
# @return [Float, nil]
|
13
|
+
attr_reader :avs_result
|
14
|
+
|
15
|
+
# The risk associated with the billing address. If present, this is a
|
16
|
+
# value in the range 0.01 to 99.
|
17
|
+
#
|
18
|
+
# @return [Float, nil]
|
19
|
+
attr_reader :billing_address
|
20
|
+
|
21
|
+
# The risk associated with the distance between the billing address and
|
22
|
+
# the location for the given IP address. If present, this is a value in
|
23
|
+
# the range 0.01 to 99.
|
24
|
+
#
|
25
|
+
# @return [Float, nil]
|
26
|
+
attr_reader :billing_address_distance_to_ip_location
|
27
|
+
|
28
|
+
# The risk associated with the browser attributes such as the User-Agent
|
29
|
+
# and Accept-Language. If present, this is a value in the range 0.01 to
|
30
|
+
# 99.
|
31
|
+
#
|
32
|
+
# @return [Float, nil]
|
33
|
+
attr_reader :browser
|
34
|
+
|
35
|
+
# Individualized risk of chargeback for the given IP address given for
|
36
|
+
# your account and any shop ID passed. This is only available to users
|
37
|
+
# sending chargeback data to MaxMind. If present, this is a value in the
|
38
|
+
# range 0.01 to 99.
|
39
|
+
#
|
40
|
+
# @return [Float, nil]
|
41
|
+
attr_reader :chargeback
|
42
|
+
|
43
|
+
# The risk associated with the country the transaction originated from.
|
44
|
+
# If present, this is a value in the range 0.01 to 99.
|
45
|
+
#
|
46
|
+
# @return [Float, nil]
|
47
|
+
attr_reader :country
|
48
|
+
|
49
|
+
# The risk associated with the combination of IP country, card issuer
|
50
|
+
# country, billing country, and shipping country. If present, this is a
|
51
|
+
# value in the range 0.01 to 99.
|
52
|
+
#
|
53
|
+
# @return [Float, nil]
|
54
|
+
attr_reader :country_mismatch
|
55
|
+
|
56
|
+
# The risk associated with the CVV result. If present, this is a value in
|
57
|
+
# the range 0.01 to 99.
|
58
|
+
#
|
59
|
+
# @return [Float, nil]
|
60
|
+
attr_reader :cvv_result
|
61
|
+
|
62
|
+
# The risk associated with the device. If present, this is a value in the
|
63
|
+
# range of 0.01 to 99.
|
64
|
+
#
|
65
|
+
# @return [Float, nil]
|
66
|
+
attr_reader :device
|
67
|
+
|
68
|
+
# The risk associated with the particular email address. If present, this
|
69
|
+
# is a value in the range 0.01 to 99.
|
70
|
+
#
|
71
|
+
# @return [Float, nil]
|
72
|
+
attr_reader :email_address
|
73
|
+
|
74
|
+
# The general risk associated with the email domain. If present, this is
|
75
|
+
# a value in the range 0.01 to 99.
|
76
|
+
#
|
77
|
+
# @return [Float, nil]
|
78
|
+
attr_reader :email_domain
|
79
|
+
|
80
|
+
# The risk associated with the email address local part (the part of
|
81
|
+
# the email address before the @ symbol). If present, this is a value
|
82
|
+
# in the range 0.01 to 99.
|
83
|
+
#
|
84
|
+
# @return [Float, nil]
|
85
|
+
attr_reader :email_local_part
|
86
|
+
|
87
|
+
# The risk associated with the particular issuer ID number (IIN) given
|
88
|
+
# the billing location and the history of usage of the IIN on your
|
89
|
+
# account and shop ID. If present, this is a value in the range 0.01 to
|
90
|
+
# 99.
|
91
|
+
#
|
92
|
+
# @return [Float, nil]
|
93
|
+
attr_reader :issuer_id_number
|
94
|
+
|
95
|
+
# The risk associated with the particular order amount for your account
|
96
|
+
# and shop ID. If present, this is a value in the range 0.01 to 99.
|
97
|
+
#
|
98
|
+
# @return [Float, nil]
|
99
|
+
attr_reader :order_amount
|
100
|
+
|
101
|
+
# The risk associated with the particular phone number. If present, this
|
102
|
+
# is a value in the range 0.01 to 99.
|
103
|
+
#
|
104
|
+
# @return [Float, nil]
|
105
|
+
attr_reader :phone_number
|
106
|
+
|
107
|
+
# The risk associated with the shipping address. If present, this is a
|
108
|
+
# value in the range 0.01 to 99.
|
109
|
+
#
|
110
|
+
# @return [Float, nil]
|
111
|
+
attr_reader :shipping_address
|
112
|
+
|
113
|
+
# The risk associated with the distance between the shipping address and
|
114
|
+
# the IP location for the given IP address. If present, this is a value
|
115
|
+
# in the range 0.01 to 99.
|
116
|
+
#
|
117
|
+
# @return [Float, nil]
|
118
|
+
attr_reader :shipping_address_distance_to_ip_location
|
119
|
+
|
120
|
+
# The risk associated with the local time of day of the transaction in
|
121
|
+
# the IP address location. If present, this is a value in the range 0.01
|
122
|
+
# to 99.
|
123
|
+
#
|
124
|
+
# @return [Float, nil]
|
125
|
+
attr_reader :time_of_day
|
126
|
+
|
127
|
+
# @!visibility private
|
128
|
+
def initialize(record)
|
129
|
+
super(record)
|
130
|
+
|
131
|
+
@avs_result = get('avs_result')
|
132
|
+
@billing_address = get('billing_address')
|
133
|
+
@billing_address_distance_to_ip_location = get(
|
134
|
+
'billing_address_distance_to_ip_location'
|
135
|
+
)
|
136
|
+
@browser = get('browser')
|
137
|
+
@chargeback = get('chargeback')
|
138
|
+
@country = get('country')
|
139
|
+
@country_mismatch = get('country_mismatch')
|
140
|
+
@cvv_result = get('cvv_result')
|
141
|
+
@device = get('device')
|
142
|
+
@email_address = get('email_address')
|
143
|
+
@email_domain = get('email_domain')
|
144
|
+
@email_local_part = get('email_local_part')
|
145
|
+
@issuer_id_number = get('issuer_id_number')
|
146
|
+
@order_amount = get('order_amount')
|
147
|
+
@phone_number = get('phone_number')
|
148
|
+
@shipping_address = get('shipping_address')
|
149
|
+
@shipping_address_distance_to_ip_location = get(
|
150
|
+
'shipping_address_distance_to_ip_location'
|
151
|
+
)
|
152
|
+
@time_of_day = get('time_of_day')
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|