minfraud 2.9.0 → 2.11.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 +4 -4
- data/CHANGELOG.md +69 -0
- data/LICENSE.txt +1 -1
- data/README.md +46 -35
- data/lib/minfraud/assessments.rb +1 -1
- data/lib/minfraud/components/account.rb +1 -1
- data/lib/minfraud/components/addressable.rb +46 -11
- data/lib/minfraud/components/base.rb +11 -13
- data/lib/minfraud/components/billing.rb +1 -1
- data/lib/minfraud/components/credit_card.rb +8 -7
- data/lib/minfraud/components/custom_inputs.rb +1 -1
- data/lib/minfraud/components/device.rb +9 -1
- data/lib/minfraud/components/email.rb +28 -4
- data/lib/minfraud/components/event.rb +3 -3
- data/lib/minfraud/components/order.rb +2 -2
- data/lib/minfraud/components/payment.rb +6 -1
- data/lib/minfraud/components/report/transaction.rb +8 -4
- data/lib/minfraud/components/shipping.rb +1 -3
- data/lib/minfraud/components/shopping_cart.rb +1 -1
- data/lib/minfraud/components/shopping_cart_item.rb +4 -4
- data/lib/minfraud/enum.rb +33 -9
- data/lib/minfraud/http_service/response.rb +4 -2
- data/lib/minfraud/model/abstract.rb +3 -0
- data/lib/minfraud/model/device.rb +1 -1
- data/lib/minfraud/model/email.rb +2 -1
- data/lib/minfraud/model/email_domain.rb +3 -2
- data/lib/minfraud/model/email_domain_visit.rb +10 -7
- data/lib/minfraud/model/factors.rb +1 -1
- data/lib/minfraud/model/geoip2_location.rb +1 -1
- data/lib/minfraud/model/insights.rb +1 -1
- data/lib/minfraud/model/ip_address.rb +1 -1
- data/lib/minfraud/model/reason.rb +1 -1
- data/lib/minfraud/model/risk_score_reason.rb +2 -2
- data/lib/minfraud/model/shipping_address.rb +3 -1
- data/lib/minfraud/model/warning.rb +13 -2
- data/lib/minfraud/report.rb +1 -1
- data/lib/minfraud/validates.rb +223 -32
- data/lib/minfraud/version.rb +1 -1
- metadata +20 -19
- data/.rspec +0 -2
- data/.rubocop.yml +0 -113
- data/CLAUDE.md +0 -443
- data/CODE_OF_CONDUCT.md +0 -49
- data/Gemfile +0 -5
- data/README.dev.md +0 -28
- data/Rakefile +0 -12
- data/bin/console +0 -15
- data/bin/setup +0 -8
- data/minfraud.gemspec +0 -42
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6a88f0e4c000a338fa1048e0849bb717b4c28b2318d6cfc89cdef230ceb9539d
|
|
4
|
+
data.tar.gz: 40510ef4654ae52b4fdcf6fbf4a472e9b22797636e1940c16751b40f0a87bcd1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 03b6ed822052decb4c17c5c50f30368567f0178d69f9566bedea35e01fd1778a9851353094380e41cba44ed347bd49e5d69025312508e187f774c61855e39ca8
|
|
7
|
+
data.tar.gz: 3d32d446b59488f0d558582b384b8c4b18fcd4730eae606a28af69056eb2afe112bd7f8516edca3e1c73d5569860cded86461883ebc087970bbcb16363a6d658
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,74 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v2.11.0 (2026-11-18)
|
|
4
|
+
|
|
5
|
+
* Added the `phone_verification_method`,
|
|
6
|
+
`phone_was_verification_successful`, and `phone_verification_time`
|
|
7
|
+
attributes to `Minfraud::Components::Billing` and
|
|
8
|
+
`Minfraud::Components::Shipping`. They describe the most recent
|
|
9
|
+
verification of the billing or shipping phone number.
|
|
10
|
+
* Added the `verification_time` and `was_verification_successful`
|
|
11
|
+
attributes to `Minfraud::Components::Email`. They describe the most
|
|
12
|
+
recent verification of the email address.
|
|
13
|
+
* Boolean inputs are now always sent as JSON booleans, and `false` is no
|
|
14
|
+
longer dropped. Previously, every input set to `false` was omitted.
|
|
15
|
+
Now only `nil` inputs are omitted. In particular:
|
|
16
|
+
* `true` for `/credit_card/was_3d_secure_successful` was sent as the
|
|
17
|
+
string `"true"`, which the web service rejected and dropped. It is
|
|
18
|
+
now sent as a JSON boolean, so it reaches the web service.
|
|
19
|
+
* Custom input values of `true` and `false` are now sent as JSON
|
|
20
|
+
booleans, and `false` is no longer dropped.
|
|
21
|
+
* **Warning:** If a custom input is a string type on your account, a
|
|
22
|
+
Ruby `true` or `false` for it is now sent as a JSON boolean. The web
|
|
23
|
+
service rejects a boolean for a string custom input with an
|
|
24
|
+
`INPUT_INVALID` warning. Pass a string, such as `'true'`, instead.
|
|
25
|
+
* With validation on, `true` or `false` for a non-boolean input now
|
|
26
|
+
raises `InvalidInputError`. This includes `token` on
|
|
27
|
+
`Minfraud::Components::CreditCard`, `tracking_token` on
|
|
28
|
+
`Minfraud::Components::Device`, and `chargeback_code`, `notes`, and
|
|
29
|
+
`transaction_id` on `Minfraud::Components::Report::Transaction`.
|
|
30
|
+
Previously, these accepted a boolean, and `transaction_id: false`
|
|
31
|
+
raised `NoMethodError`.
|
|
32
|
+
* `/order/has_gift_message`, `/order/is_gift`, and
|
|
33
|
+
`/payment/was_authorized` already sent `true` as a JSON boolean.
|
|
34
|
+
* The `*_values` class methods of enum attributes, such as
|
|
35
|
+
`Minfraud::Components::Event.type_values`, now exist only on the class
|
|
36
|
+
that declares the enum and its subclasses. Previously, every class
|
|
37
|
+
responded to them. `mapping` on a subclass now includes the enums of
|
|
38
|
+
its parent class.
|
|
39
|
+
* Enum setters, such as `Minfraud::Components::Event#type=`, now raise
|
|
40
|
+
`NotEnumValueError` for a value that is not a String, a Symbol, or
|
|
41
|
+
`nil`. Previously, `false` cleared the attribute, and `true` raised
|
|
42
|
+
`NoMethodError`. The `*_values` class methods now return a frozen
|
|
43
|
+
array.
|
|
44
|
+
* With validation on, `Minfraud::Components::Event` now rejects a `time`
|
|
45
|
+
that the web service rejects. Previously, the client accepted hour 24,
|
|
46
|
+
second 60, a UTC offset of 24 hours or more, and a lowercase `t` or
|
|
47
|
+
`z`.
|
|
48
|
+
* Added the processor `:ryft` to `Minfraud::Components::Payment`.
|
|
49
|
+
* The minimum version of the `maxmind-geoip2` gem is now 1.7.0. It
|
|
50
|
+
requires `maxmind-db` 1.5.0, which limits the work and memory of each
|
|
51
|
+
decode of a crafted database and makes lookups faster. See the
|
|
52
|
+
[maxmind-geoip2 1.7.0 changelog](https://github.com/maxmind/GeoIP2-ruby/blob/v1.7.0/CHANGELOG.md).
|
|
53
|
+
|
|
54
|
+
## v2.10.0 (2026-07-21)
|
|
55
|
+
|
|
56
|
+
* Added the `residential` attribute to the `anonymizer` object on
|
|
57
|
+
`Minfraud::Model::IPAddress`. This object contains residential proxy
|
|
58
|
+
data for the network, including a confidence score, the network last
|
|
59
|
+
seen date, and the provider name. It may be populated even when no
|
|
60
|
+
other anonymizer attributes are set. This is only available from the
|
|
61
|
+
minFraud Insights and Factors web services.
|
|
62
|
+
* Added the `tracking_token` attribute to `Minfraud::Components::Device`.
|
|
63
|
+
This is the token generated by the
|
|
64
|
+
[Device Tracking Add-on](https://dev.maxmind.com/minfraud/track-devices)
|
|
65
|
+
for explicit device linking.
|
|
66
|
+
* Added the processors `:banquest`, `:fat_zebra`, `:summit_payments`, and
|
|
67
|
+
`:yaadpay` to `Minfraud::Components::Payment`.
|
|
68
|
+
* Added `:clear` to the valid values for the `tag` attribute on
|
|
69
|
+
`Minfraud::Components::Report::Transaction`.
|
|
70
|
+
* Unnecessary files were removed from the published .gem.
|
|
71
|
+
|
|
3
72
|
## v2.9.0 (2025-11-20)
|
|
4
73
|
|
|
5
74
|
* Added the processor `:securepay` to `Minfraud::Components::Payment`.
|
data/LICENSE.txt
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
3
|
Copyright (c) 2016-2020 kushnir.yb
|
|
4
|
-
Copyright (c) 2020-
|
|
4
|
+
Copyright (c) 2020-2026 MaxMind, Inc.
|
|
5
5
|
|
|
6
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
## Description
|
|
4
4
|
|
|
5
5
|
This package provides an API for the [MaxMind minFraud web
|
|
6
|
-
services](https://dev.maxmind.com/minfraud
|
|
6
|
+
services](https://dev.maxmind.com/minfraud/?lang=en). This includes minFraud Score,
|
|
7
7
|
Insights, and Factors. It also includes our [minFraud Report Transaction
|
|
8
|
-
API](https://dev.maxmind.com/minfraud/report-a-transaction
|
|
8
|
+
API](https://dev.maxmind.com/minfraud/report-a-transaction/?lang=en).
|
|
9
9
|
|
|
10
10
|
The legacy minFraud Standard and Premium services are not supported by this
|
|
11
11
|
API.
|
|
@@ -48,7 +48,7 @@ Minfraud.configure do |c|
|
|
|
48
48
|
c.license_key = 'your_license_key'
|
|
49
49
|
c.enable_validation = true
|
|
50
50
|
end
|
|
51
|
-
|
|
51
|
+
```
|
|
52
52
|
|
|
53
53
|
To use the Sandbox web service instead of the production web service, you can provide the host:
|
|
54
54
|
|
|
@@ -69,8 +69,8 @@ creating the object.
|
|
|
69
69
|
|
|
70
70
|
After populating the object, call the method for the minFraud endpoint you
|
|
71
71
|
want to use: `#score`, `#insights`, or `#factors`. The returned value is a
|
|
72
|
-
`
|
|
73
|
-
`#body` attribute.
|
|
72
|
+
`Minfraud::HTTPService::Response` object. You can access the response model
|
|
73
|
+
through its `#body` attribute.
|
|
74
74
|
|
|
75
75
|
An exception will be thrown for critical errors. You should check for
|
|
76
76
|
`warnings` related to your inputs after a request.
|
|
@@ -83,13 +83,14 @@ assessment = Minfraud::Assessments.new(
|
|
|
83
83
|
accept_language: 'en-US,en;q=0.8',
|
|
84
84
|
session_age: 3600.5,
|
|
85
85
|
session_id: 'foo',
|
|
86
|
+
tracking_token: 'abc123',
|
|
86
87
|
user_agent: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.89 Safari/537.36',
|
|
87
88
|
},
|
|
88
89
|
event: {
|
|
89
90
|
party: :customer,
|
|
90
91
|
transaction_id: 'txn3134133',
|
|
91
92
|
shop_id: 's2123',
|
|
92
|
-
time: '
|
|
93
|
+
time: '2026-10-05T23:20:50+00:00',
|
|
93
94
|
type: :purchase,
|
|
94
95
|
},
|
|
95
96
|
account: {
|
|
@@ -97,35 +98,43 @@ assessment = Minfraud::Assessments.new(
|
|
|
97
98
|
username_md5: '4f9726678c438914fa04bdb8c1a24088',
|
|
98
99
|
},
|
|
99
100
|
email: {
|
|
100
|
-
address:
|
|
101
|
-
domain:
|
|
101
|
+
address: 'test@maxmind.com',
|
|
102
|
+
domain: 'maxmind.com',
|
|
103
|
+
verification_time: '2026-10-01T14:30:00Z',
|
|
104
|
+
was_verification_successful: true,
|
|
102
105
|
},
|
|
103
106
|
billing: {
|
|
104
|
-
first_name:
|
|
105
|
-
last_name:
|
|
106
|
-
company:
|
|
107
|
-
address:
|
|
108
|
-
address_2:
|
|
109
|
-
city:
|
|
110
|
-
region:
|
|
111
|
-
country:
|
|
112
|
-
postal:
|
|
113
|
-
phone_number:
|
|
114
|
-
phone_country_code:
|
|
107
|
+
first_name: 'First',
|
|
108
|
+
last_name: 'Last',
|
|
109
|
+
company: 'Company',
|
|
110
|
+
address: '101 Address Rd.',
|
|
111
|
+
address_2: 'Unit 5',
|
|
112
|
+
city: 'New Haven',
|
|
113
|
+
region: 'CT',
|
|
114
|
+
country: 'US',
|
|
115
|
+
postal: '06510',
|
|
116
|
+
phone_number: '123-456-7890',
|
|
117
|
+
phone_country_code: '1',
|
|
118
|
+
phone_verification_method: :delivered_code,
|
|
119
|
+
phone_verification_time: '2026-10-01T14:30:00Z',
|
|
120
|
+
phone_was_verification_successful: true,
|
|
115
121
|
},
|
|
116
122
|
shipping: {
|
|
117
|
-
first_name:
|
|
118
|
-
last_name:
|
|
119
|
-
company:
|
|
120
|
-
address:
|
|
121
|
-
address_2:
|
|
122
|
-
city:
|
|
123
|
-
region:
|
|
124
|
-
country:
|
|
125
|
-
postal:
|
|
126
|
-
phone_number:
|
|
127
|
-
phone_country_code:
|
|
128
|
-
delivery_speed:
|
|
123
|
+
first_name: 'ShipFirst',
|
|
124
|
+
last_name: 'ShipLast',
|
|
125
|
+
company: 'ShipCo',
|
|
126
|
+
address: '322 Ship Addr. Ln.',
|
|
127
|
+
address_2: 'St. 43',
|
|
128
|
+
city: 'Nowhere',
|
|
129
|
+
region: 'OK',
|
|
130
|
+
country: 'US',
|
|
131
|
+
postal: '73003',
|
|
132
|
+
phone_number: '123-456-0000',
|
|
133
|
+
phone_country_code: '1',
|
|
134
|
+
delivery_speed: :same_day,
|
|
135
|
+
phone_verification_method: :delivered_code,
|
|
136
|
+
phone_verification_time: '2026-10-01T14:30:00Z',
|
|
137
|
+
phone_was_verification_successful: true,
|
|
129
138
|
},
|
|
130
139
|
payment: {
|
|
131
140
|
method: :card,
|
|
@@ -245,6 +254,8 @@ this functionality.
|
|
|
245
254
|
|
|
246
255
|
The gem supplies several distinct exception-types:
|
|
247
256
|
|
|
257
|
+
* `InvalidInputError` - Raised if an input value is invalid when client-side
|
|
258
|
+
validation is enabled
|
|
248
259
|
* `RequestFormatError` - Raised if an unknown key is provided to the
|
|
249
260
|
`Minfraud::Assessments` constructor
|
|
250
261
|
* `ClientError` - Raised if the IP address is absent, reserved, or the JSON
|
|
@@ -273,7 +284,7 @@ Please report all issues with this code using the
|
|
|
273
284
|
|
|
274
285
|
If you are having an issue with the minFraud service that is not specific
|
|
275
286
|
to the client API, please see
|
|
276
|
-
[our support page](https://
|
|
287
|
+
[our support page](https://support.maxmind.com/knowledge-base).
|
|
277
288
|
|
|
278
289
|
## Requirements
|
|
279
290
|
|
|
@@ -285,7 +296,7 @@ Bug reports and pull requests are welcome on
|
|
|
285
296
|
[GitHub](https://github.com/maxmind/minfraud-api-ruby). This project is
|
|
286
297
|
intended to be a safe, welcoming space for collaboration, and contributors
|
|
287
298
|
are expected to adhere to the [Contributor
|
|
288
|
-
Covenant](https://contributor-covenant.org) code of conduct.
|
|
299
|
+
Covenant](https://www.contributor-covenant.org/) code of conduct.
|
|
289
300
|
|
|
290
301
|
## Versioning
|
|
291
302
|
|
|
@@ -295,10 +306,10 @@ This API uses [Semantic Versioning](https://semver.org/).
|
|
|
295
306
|
|
|
296
307
|
Copyright (c) 2016-2020 kushnir.yb.
|
|
297
308
|
|
|
298
|
-
Copyright (c) 2020-
|
|
309
|
+
Copyright (c) 2020-2026 MaxMind, Inc.
|
|
299
310
|
|
|
300
311
|
The gem is available as open source under the terms of the [MIT
|
|
301
|
-
License](https://opensource.org/
|
|
312
|
+
License](https://opensource.org/license/MIT).
|
|
302
313
|
|
|
303
314
|
## Thank You
|
|
304
315
|
|
data/lib/minfraud/assessments.rb
CHANGED
|
@@ -4,7 +4,7 @@ module Minfraud
|
|
|
4
4
|
module Components
|
|
5
5
|
# Account corresponds to the account object of a minFraud request.
|
|
6
6
|
#
|
|
7
|
-
# @see https://dev.maxmind.com/minfraud/api-documentation/requests
|
|
7
|
+
# @see https://dev.maxmind.com/minfraud/api-documentation/requests/?lang=en#schema--request--account
|
|
8
8
|
class Account < Base
|
|
9
9
|
include Minfraud::Validates
|
|
10
10
|
|
|
@@ -5,6 +5,7 @@ module Minfraud
|
|
|
5
5
|
# This is a parent class for the Billing and Shipping components.
|
|
6
6
|
class Addressable < Base
|
|
7
7
|
include Minfraud::Validates
|
|
8
|
+
include ::Minfraud::Enum
|
|
8
9
|
|
|
9
10
|
# The first name of the end user as provided in their billing / shipping
|
|
10
11
|
# information.
|
|
@@ -74,20 +75,52 @@ module Minfraud
|
|
|
74
75
|
# @return [String, nil]
|
|
75
76
|
attr_accessor :phone_country_code
|
|
76
77
|
|
|
78
|
+
# The most recent method used to verify the phone number. This must be
|
|
79
|
+
# one of +:delivered_code+, +:network+, or +:other+.
|
|
80
|
+
# +:delivered_code+ is a code delivered to the phone, such as by SMS,
|
|
81
|
+
# voice call, or messaging app. +:network+ is verification through the
|
|
82
|
+
# mobile network operator, such as silent network authentication.
|
|
83
|
+
#
|
|
84
|
+
# @!attribute phone_verification_method
|
|
85
|
+
#
|
|
86
|
+
# @return [Symbol, nil]
|
|
87
|
+
enum_accessor :phone_verification_method, %i[delivered_code network other]
|
|
88
|
+
|
|
89
|
+
# Whether the most recent verification of the phone number
|
|
90
|
+
# succeeded. Do not include this field if no verification was
|
|
91
|
+
# attempted.
|
|
92
|
+
#
|
|
93
|
+
# @return [Boolean, nil]
|
|
94
|
+
attr_accessor :phone_was_verification_successful
|
|
95
|
+
|
|
96
|
+
# The date and time of the most recent verification of the phone
|
|
97
|
+
# number. The string must be in the RFC 3339 date-time format, e.g.,
|
|
98
|
+
# "2012-04-12T23:20:50.52Z". The time must not be before
|
|
99
|
+
# 1970-01-01T00:00:00Z or more than two days in the future. The web
|
|
100
|
+
# service ignores a time outside this range and returns a warning.
|
|
101
|
+
#
|
|
102
|
+
# @see https://datatracker.ietf.org/doc/html/rfc3339
|
|
103
|
+
#
|
|
104
|
+
# @return [String, nil]
|
|
105
|
+
attr_accessor :phone_verification_time
|
|
106
|
+
|
|
77
107
|
# @param params [Hash] Hash of parameters. Each key/value should
|
|
78
108
|
# correspond to one of the available attributes.
|
|
79
109
|
def initialize(params = {})
|
|
80
|
-
@first_name
|
|
81
|
-
@last_name
|
|
82
|
-
@company
|
|
83
|
-
@address
|
|
84
|
-
@address_2
|
|
85
|
-
@city
|
|
86
|
-
@region
|
|
87
|
-
@country
|
|
88
|
-
@postal
|
|
89
|
-
@phone_number
|
|
90
|
-
@phone_country_code
|
|
110
|
+
@first_name = params[:first_name]
|
|
111
|
+
@last_name = params[:last_name]
|
|
112
|
+
@company = params[:company]
|
|
113
|
+
@address = params[:address]
|
|
114
|
+
@address_2 = params[:address_2]
|
|
115
|
+
@city = params[:city]
|
|
116
|
+
@region = params[:region]
|
|
117
|
+
@country = params[:country]
|
|
118
|
+
@postal = params[:postal]
|
|
119
|
+
@phone_number = params[:phone_number]
|
|
120
|
+
@phone_country_code = params[:phone_country_code]
|
|
121
|
+
self.phone_verification_method = params[:phone_verification_method]
|
|
122
|
+
@phone_was_verification_successful = params[:phone_was_verification_successful]
|
|
123
|
+
@phone_verification_time = params[:phone_verification_time]
|
|
91
124
|
|
|
92
125
|
validate
|
|
93
126
|
end
|
|
@@ -108,6 +141,8 @@ module Minfraud
|
|
|
108
141
|
validate_string('postal', 255, @postal)
|
|
109
142
|
validate_string('phone_number', 255, @phone_number)
|
|
110
143
|
validate_telephone_country_code('phone_country_code', @phone_country_code)
|
|
144
|
+
validate_boolean('phone_was_verification_successful', @phone_was_verification_successful)
|
|
145
|
+
validate_rfc3339('phone_verification_time', @phone_verification_time)
|
|
111
146
|
end
|
|
112
147
|
end
|
|
113
148
|
end
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Minfraud
|
|
4
|
+
# Components are used to build the request to the minFraud services.
|
|
5
|
+
# Each component represents a part of the transaction being analyzed,
|
|
6
|
+
# such as the device, account, email, or billing address.
|
|
4
7
|
module Components
|
|
5
8
|
# This is a parent class for all components. It defines a method which is
|
|
6
9
|
# used for basic JSON representation of the component objects.
|
|
@@ -23,27 +26,22 @@ module Minfraud
|
|
|
23
26
|
#
|
|
24
27
|
# @return [Hash]
|
|
25
28
|
def populate!(hash, v_sym)
|
|
26
|
-
|
|
29
|
+
value = instance_variable_get(v_sym)
|
|
30
|
+
return hash if value.nil?
|
|
27
31
|
|
|
28
|
-
key = v_sym.to_s.
|
|
29
|
-
hash.merge!(key => represent(
|
|
32
|
+
key = v_sym.to_s.delete_prefix('@')
|
|
33
|
+
hash.merge!(key => represent(value))
|
|
30
34
|
end
|
|
31
35
|
|
|
32
|
-
# Return the value according to the request format.
|
|
33
|
-
#
|
|
34
|
-
# @param key [Symbol] An instance variable symbol.
|
|
36
|
+
# Return the value according to the request format. Booleans stay
|
|
37
|
+
# booleans. Other values become strings.
|
|
35
38
|
#
|
|
36
39
|
# @param value [Object] An instance variable value.
|
|
37
40
|
#
|
|
38
41
|
# @return [Object]
|
|
39
|
-
def represent(
|
|
40
|
-
|
|
42
|
+
def represent(value)
|
|
43
|
+
Minfraud::Validates.boolean?(value) ? value : value.to_s
|
|
41
44
|
end
|
|
42
|
-
|
|
43
|
-
# Keys that have to remain boolean
|
|
44
|
-
BOOLS = %w[was_authorized is_gift has_gift_message].freeze
|
|
45
|
-
|
|
46
|
-
private_constant :BOOLS
|
|
47
45
|
end
|
|
48
46
|
end
|
|
49
47
|
end
|
|
@@ -4,7 +4,7 @@ module Minfraud
|
|
|
4
4
|
module Components
|
|
5
5
|
# Billing corresponds to the billing object of a minFraud request.
|
|
6
6
|
#
|
|
7
|
-
# @see https://dev.maxmind.com/minfraud/api-documentation/requests
|
|
7
|
+
# @see https://dev.maxmind.com/minfraud/api-documentation/requests/?lang=en#schema--request--billing
|
|
8
8
|
class Billing < Addressable; end
|
|
9
9
|
end
|
|
10
10
|
end
|
|
@@ -4,7 +4,7 @@ module Minfraud
|
|
|
4
4
|
module Components
|
|
5
5
|
# CreditCard corresponds to the credit_card object of a minFraud request.
|
|
6
6
|
#
|
|
7
|
-
# @see https://dev.maxmind.com/minfraud/api-documentation/requests
|
|
7
|
+
# @see https://dev.maxmind.com/minfraud/api-documentation/requests/?lang=en#schema--request--credit-card
|
|
8
8
|
class CreditCard < Base
|
|
9
9
|
include Minfraud::Validates
|
|
10
10
|
|
|
@@ -14,9 +14,10 @@ module Minfraud
|
|
|
14
14
|
# @return [String, nil]
|
|
15
15
|
attr_accessor :issuer_id_number
|
|
16
16
|
|
|
17
|
-
# The last two or four digits of the credit card number.
|
|
17
|
+
# The last two or four digits of the credit card number. In most cases,
|
|
18
|
+
# you should send the last four digits for +last_digits+.
|
|
18
19
|
#
|
|
19
|
-
# @see https://dev.maxmind.com/minfraud/api-documentation/requests
|
|
20
|
+
# @see https://dev.maxmind.com/minfraud/api-documentation/requests/?lang=en#schema--request--credit-card__last_digits
|
|
20
21
|
#
|
|
21
22
|
# @return [String, nil]
|
|
22
23
|
attr_accessor :last_digits
|
|
@@ -42,7 +43,7 @@ module Minfraud
|
|
|
42
43
|
attr_accessor :bank_phone_number
|
|
43
44
|
|
|
44
45
|
# The two character ISO 3166-1 alpha-2 country code where the issuer of
|
|
45
|
-
# the card is located. This may be passed instead of {
|
|
46
|
+
# the card is located. This may be passed instead of {#issuer_id_number}
|
|
46
47
|
# if you do not wish to pass partial account numbers, or if your payment
|
|
47
48
|
# processor does not provide them.
|
|
48
49
|
#
|
|
@@ -74,7 +75,7 @@ module Minfraud
|
|
|
74
75
|
# @return [String, nil]
|
|
75
76
|
attr_accessor :cvv_result
|
|
76
77
|
|
|
77
|
-
# Whether the outcome of 3-D Secure verification (e.g.
|
|
78
|
+
# Whether the outcome of 3-D Secure verification (e.g. SafeKey,
|
|
78
79
|
# SecureCode, Verified by Visa) was successful. +true+ if customer
|
|
79
80
|
# verification was successful, or +false+ if the customer failed
|
|
80
81
|
# verification. If 3-D Secure verification was not used, was unavailable,
|
|
@@ -86,7 +87,7 @@ module Minfraud
|
|
|
86
87
|
|
|
87
88
|
# Get the last digits of the credit card number.
|
|
88
89
|
#
|
|
89
|
-
# @deprecated Use {
|
|
90
|
+
# @deprecated Use {#last_digits} instead.
|
|
90
91
|
#
|
|
91
92
|
# @return [String, nil]
|
|
92
93
|
def last_4_digits
|
|
@@ -95,7 +96,7 @@ module Minfraud
|
|
|
95
96
|
|
|
96
97
|
# Set the last digits of the credit card number.
|
|
97
98
|
#
|
|
98
|
-
# @deprecated Use {
|
|
99
|
+
# @deprecated Use {#last_digits} instead.
|
|
99
100
|
#
|
|
100
101
|
# @return [String, nil]
|
|
101
102
|
def last_4_digits=(last4)
|
|
@@ -5,7 +5,7 @@ module Minfraud
|
|
|
5
5
|
# CustomInputs corresponds to the custom_inputs object of a minFraud
|
|
6
6
|
# request.
|
|
7
7
|
#
|
|
8
|
-
# @see https://dev.maxmind.com/minfraud/api-documentation/requests
|
|
8
|
+
# @see https://dev.maxmind.com/minfraud/api-documentation/requests/?lang=en#schema--request--custom-inputs
|
|
9
9
|
class CustomInputs < Base
|
|
10
10
|
include Minfraud::Validates
|
|
11
11
|
|
|
@@ -4,7 +4,7 @@ module Minfraud
|
|
|
4
4
|
module Components
|
|
5
5
|
# Device corresponds to the device object of a minFraud request.
|
|
6
6
|
#
|
|
7
|
-
# @see https://dev.maxmind.com/minfraud/api-documentation/requests
|
|
7
|
+
# @see https://dev.maxmind.com/minfraud/api-documentation/requests/?lang=en#schema--request--device
|
|
8
8
|
class Device < Base
|
|
9
9
|
include Minfraud::Validates
|
|
10
10
|
|
|
@@ -40,6 +40,12 @@ module Minfraud
|
|
|
40
40
|
# @return [String, nil]
|
|
41
41
|
attr_accessor :session_id
|
|
42
42
|
|
|
43
|
+
# The token generated by the Device Tracking Add-on for explicit
|
|
44
|
+
# device linking.
|
|
45
|
+
#
|
|
46
|
+
# @return [String, nil]
|
|
47
|
+
attr_accessor :tracking_token
|
|
48
|
+
|
|
43
49
|
# @param params [Hash] Hash of parameters. Each key/value should
|
|
44
50
|
# correspond to one of the available attributes.
|
|
45
51
|
def initialize(params = {})
|
|
@@ -48,6 +54,7 @@ module Minfraud
|
|
|
48
54
|
@accept_language = params[:accept_language]
|
|
49
55
|
@session_age = params[:session_age]
|
|
50
56
|
@session_id = params[:session_id]
|
|
57
|
+
@tracking_token = params[:tracking_token]
|
|
51
58
|
|
|
52
59
|
validate
|
|
53
60
|
end
|
|
@@ -62,6 +69,7 @@ module Minfraud
|
|
|
62
69
|
validate_string('accept_language', 255, @accept_language)
|
|
63
70
|
validate_nonnegative_number('session_age', @session_age)
|
|
64
71
|
validate_string('session_id', 255, @session_id)
|
|
72
|
+
validate_not_boolean('tracking_token', @tracking_token)
|
|
65
73
|
end
|
|
66
74
|
end
|
|
67
75
|
end
|
|
@@ -7,7 +7,7 @@ module Minfraud
|
|
|
7
7
|
module Components
|
|
8
8
|
# Email corresponds to the email object of a minFraud request.
|
|
9
9
|
#
|
|
10
|
-
# @see https://dev.maxmind.com/minfraud/api-documentation/requests
|
|
10
|
+
# @see https://dev.maxmind.com/minfraud/api-documentation/requests/?lang=en#email
|
|
11
11
|
class Email < Base
|
|
12
12
|
include Minfraud::Validates
|
|
13
13
|
|
|
@@ -31,12 +31,32 @@ module Minfraud
|
|
|
31
31
|
# @return [Boolean, nil]
|
|
32
32
|
attr_accessor :hash_address
|
|
33
33
|
|
|
34
|
+
# The date and time of the most recent attempt to verify the email
|
|
35
|
+
# address, if known. The string must be in the RFC 3339 date-time
|
|
36
|
+
# format, e.g., "2012-04-12T23:20:50.52Z". The time must not be before
|
|
37
|
+
# 1970-01-01T00:00:00Z or more than two days in the future. The web
|
|
38
|
+
# service ignores a time outside this range and returns a warning.
|
|
39
|
+
#
|
|
40
|
+
# @see https://datatracker.ietf.org/doc/html/rfc3339
|
|
41
|
+
#
|
|
42
|
+
# @return [String, nil]
|
|
43
|
+
attr_accessor :verification_time
|
|
44
|
+
|
|
45
|
+
# Whether the most recent verification that the end user controls the
|
|
46
|
+
# email address succeeded, for example by confirming a link sent to the
|
|
47
|
+
# address. Do not include this field if no verification was attempted.
|
|
48
|
+
#
|
|
49
|
+
# @return [Boolean, nil]
|
|
50
|
+
attr_accessor :was_verification_successful
|
|
51
|
+
|
|
34
52
|
# @param params [Hash] Hash of parameters. Each key/value should
|
|
35
53
|
# correspond to one of the available attributes.
|
|
36
54
|
def initialize(params = {})
|
|
37
|
-
@address
|
|
38
|
-
@domain
|
|
39
|
-
@hash_address
|
|
55
|
+
@address = params[:address]
|
|
56
|
+
@domain = params[:domain]
|
|
57
|
+
@hash_address = params[:hash_address]
|
|
58
|
+
@verification_time = params[:verification_time]
|
|
59
|
+
@was_verification_successful = params[:was_verification_successful]
|
|
40
60
|
|
|
41
61
|
validate
|
|
42
62
|
end
|
|
@@ -72,6 +92,8 @@ module Minfraud
|
|
|
72
92
|
|
|
73
93
|
validate_email('email', @address)
|
|
74
94
|
validate_string('domain', 255, @domain)
|
|
95
|
+
validate_rfc3339('verification_time', @verification_time)
|
|
96
|
+
validate_boolean('was_verification_successful', @was_verification_successful)
|
|
75
97
|
end
|
|
76
98
|
|
|
77
99
|
def hash_email_address(address)
|
|
@@ -222,6 +244,7 @@ module Minfraud
|
|
|
222
244
|
'fastemailer.com' => true,
|
|
223
245
|
'fastest.cc' => true,
|
|
224
246
|
'fastimap.com' => true,
|
|
247
|
+
'fastmail.ca' => true,
|
|
225
248
|
'fastmail.cn' => true,
|
|
226
249
|
'fastmail.co.uk' => true,
|
|
227
250
|
'fastmail.com' => true,
|
|
@@ -316,6 +339,7 @@ module Minfraud
|
|
|
316
339
|
private_constant :FASTMAIL_DOMAINS
|
|
317
340
|
|
|
318
341
|
YAHOO_DOMAINS = {
|
|
342
|
+
'myyahoo.com' => true,
|
|
319
343
|
'y7mail.com' => true,
|
|
320
344
|
'yahoo.at' => true,
|
|
321
345
|
'yahoo.be' => true,
|
|
@@ -4,7 +4,7 @@ module Minfraud
|
|
|
4
4
|
module Components
|
|
5
5
|
# Event corresponds to the event object of a minFraud request.
|
|
6
6
|
#
|
|
7
|
-
# @see https://dev.maxmind.com/minfraud/api-documentation/requests
|
|
7
|
+
# @see https://dev.maxmind.com/minfraud/api-documentation/requests/?lang=en#schema--request--event
|
|
8
8
|
class Event < Base
|
|
9
9
|
include ::Minfraud::Enum
|
|
10
10
|
include Minfraud::Validates
|
|
@@ -38,10 +38,10 @@ module Minfraud
|
|
|
38
38
|
|
|
39
39
|
# The date and time the event occurred. The string must be in the RFC
|
|
40
40
|
# 3339 date-time format, e.g., "2012-04-12T23:20:50.52Z". The time must
|
|
41
|
-
# be within the past
|
|
41
|
+
# be within the past year. If this field is not in the request, the
|
|
42
42
|
# current time will be used.
|
|
43
43
|
#
|
|
44
|
-
# @see https://
|
|
44
|
+
# @see https://datatracker.ietf.org/doc/html/rfc3339
|
|
45
45
|
#
|
|
46
46
|
# @return [String, nil]
|
|
47
47
|
attr_accessor :time
|
|
@@ -4,12 +4,12 @@ module Minfraud
|
|
|
4
4
|
module Components
|
|
5
5
|
# Order corresponds to the order object of a minFraud request.
|
|
6
6
|
#
|
|
7
|
-
# @see https://dev.maxmind.com/minfraud/api-documentation/requests
|
|
7
|
+
# @see https://dev.maxmind.com/minfraud/api-documentation/requests/?lang=en#schema--request--order
|
|
8
8
|
class Order < Base
|
|
9
9
|
include Minfraud::Validates
|
|
10
10
|
|
|
11
11
|
# The total order amount for the transaction before taxes and discounts.
|
|
12
|
-
# The value must be at least 0 and at most
|
|
12
|
+
# The value must be at least 0 and at most 1e13 - 1.
|
|
13
13
|
#
|
|
14
14
|
# @return [Float, nil]
|
|
15
15
|
attr_accessor :amount
|