minfraud 1.6.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rubocop.yml +1 -1
- data/.github/workflows/test.yml +1 -0
- data/.rubocop.yml +1 -20
- data/CHANGELOG.md +80 -4
- data/Gemfile +0 -9
- data/LICENSE.txt +1 -1
- data/README.md +4 -4
- data/lib/minfraud/assessments.rb +21 -16
- data/lib/minfraud/components/account.rb +1 -1
- data/lib/minfraud/components/billing.rb +1 -1
- data/lib/minfraud/components/credit_card.rb +40 -8
- data/lib/minfraud/components/custom_inputs.rb +1 -1
- data/lib/minfraud/components/device.rb +1 -1
- data/lib/minfraud/components/email.rb +1 -1
- data/lib/minfraud/components/event.rb +11 -11
- data/lib/minfraud/components/order.rb +1 -1
- data/lib/minfraud/components/payment.rb +153 -142
- data/lib/minfraud/components/report/transaction.rb +2 -2
- data/lib/minfraud/components/shipping.rb +2 -2
- data/lib/minfraud/components/shopping_cart.rb +1 -1
- data/lib/minfraud/components/shopping_cart_item.rb +3 -3
- data/lib/minfraud/http_service/response.rb +28 -21
- data/lib/minfraud/model/device.rb +1 -1
- data/lib/minfraud/model/disposition.rb +3 -3
- data/lib/minfraud/model/factors.rb +1 -1
- data/lib/minfraud/model/ip_address.rb +4 -47
- data/lib/minfraud/model/score.rb +1 -1
- data/lib/minfraud/model/subscores.rb +1 -23
- data/lib/minfraud/report.rb +19 -11
- data/lib/minfraud/validates.rb +2 -2
- data/lib/minfraud/version.rb +1 -1
- data/lib/minfraud.rb +18 -24
- data/minfraud.gemspec +13 -10
- metadata +47 -67
- data/lib/maxmind/geoip2/model/city.rb +0 -99
- data/lib/maxmind/geoip2/model/country.rb +0 -94
- data/lib/maxmind/geoip2/model/insights.rb +0 -38
- data/lib/maxmind/geoip2/record/abstract.rb +0 -46
- data/lib/maxmind/geoip2/record/city.rb +0 -62
- data/lib/maxmind/geoip2/record/continent.rb +0 -61
- data/lib/maxmind/geoip2/record/country.rb +0 -78
- data/lib/maxmind/geoip2/record/location.rb +0 -97
- data/lib/maxmind/geoip2/record/maxmind.rb +0 -41
- data/lib/maxmind/geoip2/record/place.rb +0 -52
- data/lib/maxmind/geoip2/record/postal.rb +0 -54
- data/lib/maxmind/geoip2/record/represented_country.rb +0 -47
- data/lib/maxmind/geoip2/record/subdivision.rb +0 -72
- data/lib/maxmind/geoip2/record/traits.rb +0 -233
- data/lib/minfraud/http_service/request.rb +0 -38
- data/lib/minfraud/http_service.rb +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f6c78c29956e0fd0302d07fe250d84bf9d750fb0ef5d713f57afd8bd8ec355d
|
4
|
+
data.tar.gz: f438db4f7d05466e6074192031900ce47fffdd1f2f6256706b63fa2d49ca4c56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 837c85526868ce32e3485da88043dc5d2d5ec1aeda9b66ed7f30dd75f609eb8bdf9a0645aade8a3ae7b7993384559dbe6d6455be1f36cae0cda873d10b4f829d
|
7
|
+
data.tar.gz: ebb55de945c03a0ba68a78ec6c75f3c71b51533be2a5adaf321f35a64e64c6905fca90ba9c996351d9ed190730a97d7cbbc19fb14147e919b29da7457ab409c4
|
data/.github/workflows/test.yml
CHANGED
data/.rubocop.yml
CHANGED
@@ -40,7 +40,7 @@ Layout/IndentationStyle:
|
|
40
40
|
# Style.
|
41
41
|
|
42
42
|
Style/HashSyntax:
|
43
|
-
EnforcedStyle: ruby19_no_mixed_keys # Default is ruby19.
|
43
|
+
EnforcedStyle: ruby19_no_mixed_keys # Default is ruby19. This one is better.
|
44
44
|
|
45
45
|
Style/CollectionMethods:
|
46
46
|
Enabled: true # Default is false.
|
@@ -54,9 +54,6 @@ Style/NegatedIf: # I disagree with this.
|
|
54
54
|
Style/IfUnlessModifier: # This doesn't always make sense.
|
55
55
|
Enabled: false
|
56
56
|
|
57
|
-
Style/SymbolArray:
|
58
|
-
EnforcedStyle: brackets # Default is percent, but 1.9 doesn't support that.
|
59
|
-
|
60
57
|
# Trailing commas are often good.
|
61
58
|
Style/TrailingCommaInArguments:
|
62
59
|
Enabled: false
|
@@ -65,9 +62,6 @@ Style/TrailingCommaInArrayLiteral:
|
|
65
62
|
Style/TrailingCommaInHashLiteral:
|
66
63
|
Enabled: false
|
67
64
|
|
68
|
-
Style/SafeNavigation:
|
69
|
-
Enabled: false # Default is true, but this 1.9 doesn't support it.
|
70
|
-
|
71
65
|
# Default is both which is probably fine, but it changes code and I don't want
|
72
66
|
# to investigate any possible behavior change right now.
|
73
67
|
Style/EmptyElse:
|
@@ -76,25 +70,12 @@ Style/EmptyElse:
|
|
76
70
|
Style/ConditionalAssignment:
|
77
71
|
Enabled: false # This produces kind of strange results.
|
78
72
|
|
79
|
-
Style/Dir:
|
80
|
-
Enabled: false # This is good, but not supported on 1.9.
|
81
|
-
|
82
|
-
Style/ExpandPathArguments:
|
83
|
-
Enabled: false # This causes us to use __dir__ which 1.9 doesn't support.
|
84
|
-
|
85
73
|
Style/GuardClause:
|
86
74
|
Enabled: false # Doesn't always make sense.
|
87
75
|
|
88
|
-
Style/Documentation:
|
89
|
-
Enabled: false # We should enable this, but allow for pre-existing code.
|
90
|
-
|
91
76
|
Style/FormatStringToken:
|
92
77
|
Enabled: false # Seems unnecessary.
|
93
78
|
|
94
|
-
# Asks to use x.negative? instead of x < 0. But this isn't available until 2.3.
|
95
|
-
Style/NumericPredicate:
|
96
|
-
Enabled: false
|
97
|
-
|
98
79
|
# Seems unnecessary. Asks us to call super in a bunch of places when there's no
|
99
80
|
# need.
|
100
81
|
Lint/MissingSuper:
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,79 @@
|
|
1
|
-
#
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## v2.2.0 (2022-03-28)
|
4
|
+
|
5
|
+
* Added the input `/credit_card/country`. This is the country where the
|
6
|
+
issuer of the card is located. This may be passed instead of the
|
7
|
+
`/credit_card/issuer_id_number` if you do not wish to pass partial
|
8
|
+
account numbers or if your payment processor does not provide them. You
|
9
|
+
may provide this using the `country` attribute on
|
10
|
+
`Minfraud::Components::CreditCard`.
|
11
|
+
|
12
|
+
## v2.1.0 (2022-01-25)
|
13
|
+
|
14
|
+
* Adds the following new processor to `Minfraud::Components::Payment`:
|
15
|
+
* `:windcave`
|
16
|
+
* The `last_4_digits` input to `Minfraud::Components::CreditCard` has been
|
17
|
+
deprecated in favor of `last_digits` and will be removed in a future
|
18
|
+
release. `last_digits`/`last_4_digits` also now supports two digit values
|
19
|
+
in addition to the previous four digit values.
|
20
|
+
* Eight digit `issuer_id_number` inputs are now supported by
|
21
|
+
`Minfraud::Components::CreditCard` in addition to the previously accepted
|
22
|
+
six digit `issuer_id_number`. In most cases, you should send the last four
|
23
|
+
digits for `last_digits`. If you send an `issuer_id_number` that contains
|
24
|
+
an eight digit IIN, and if the credit card brand is not one of the
|
25
|
+
following, you should send the last two digits for `last_digits`:
|
26
|
+
* `Discover`
|
27
|
+
* `JCB`
|
28
|
+
* `Mastercard`
|
29
|
+
* `UnionPay`
|
30
|
+
* `Visa`
|
31
|
+
|
32
|
+
## v2.0.0 (2021-12-06)
|
33
|
+
|
34
|
+
* Breaking change from 1.x: Removed deprecated methods
|
35
|
+
`is_in_european_union`, `is_anonymous`, `is_anonymous_vpn`,
|
36
|
+
`is_hosting_provider`, `is_public_proxy`, and `is_tor_exit_node`. The
|
37
|
+
non-deprecated equivalents are `in_european_union?`, `anonymous?`,
|
38
|
+
`anonymous_vpn?`, `hosting_provider?`, `public_proxy?`, and
|
39
|
+
`tor_exit_node?`.
|
40
|
+
* Breaking change from 1.x: Removed deprecated methods for deprecated
|
41
|
+
subscores: `email_tenure` and `ip_tenure`. For `email_tenure`, please use
|
42
|
+
the `email_address` subscore instead. For `ip_tenure`, please use
|
43
|
+
`risk_score` instead.
|
44
|
+
* Breaking change from 1.x: Removed deprecated method for deprecated
|
45
|
+
attribute `ip_address.country.is_high_risk`.
|
46
|
+
* Breaking change from 1.x: Switches HTTP client from faraday to http.rb.
|
47
|
+
There should be no behavior change for most users, but this is
|
48
|
+
technically a breaking change from the perspective of semver. Most users
|
49
|
+
should not be affected as the changes are limited to attributes and
|
50
|
+
classes that would not normally be accessed outside the gem.
|
51
|
+
* Breaking change from 1.x: `user_id` is no longer supported as a way to
|
52
|
+
configure your MaxMind account ID. Use `account_id` instead.
|
53
|
+
* Breaking change from 1.x: Removed the `Minfraud.configuration` method.
|
54
|
+
* Breaking change from 1.x: Localized names are no longer exposed via
|
55
|
+
methods on `names` objects, only as hash keys. For example, use
|
56
|
+
`response.ip_address.country.names['en']` instead of
|
57
|
+
`response.ip_address.country.names.en`. The latter was deprecated.
|
58
|
+
* Adds mobile country code (MCC) and mobile network code (MNC) to minFraud
|
59
|
+
Insights and Factors responses. These are available at
|
60
|
+
`response.ip_address.traits.mobile_country_code` and
|
61
|
+
`response.ip_address.traits.mobile_network_code`. We expect this data to
|
62
|
+
be available by late January, 2022.
|
63
|
+
* Adds the following new processors to `Minfraud::Components::Payment`:
|
64
|
+
* `:boacompra`
|
65
|
+
* `:boku`
|
66
|
+
* `:coregateway`
|
67
|
+
* `:fiserv`
|
68
|
+
* `:neopay`
|
69
|
+
* `:neosurf`
|
70
|
+
* `:openbucks`
|
71
|
+
* `:paysera`
|
72
|
+
* `:payvision`
|
73
|
+
* `:trustly`
|
74
|
+
* Depend on the `maxmind-geoip2` gem. This allows us to delete classes from
|
75
|
+
that gem that we previously had included in this gem. There is no
|
76
|
+
functional difference.
|
2
77
|
|
3
78
|
## v1.6.0 (2021-08-19)
|
4
79
|
|
@@ -14,7 +89,7 @@
|
|
14
89
|
|
15
90
|
## v1.5.0 (2021-02-02)
|
16
91
|
|
17
|
-
*
|
92
|
+
* Adds the `hash_address` attribute to `Minfraud::Components::Email`. If
|
18
93
|
this is `true`, the MD5 hash of the `address` will be sent instead of the
|
19
94
|
plain text `address`. Use this if you prefer to send the hash of the
|
20
95
|
`address` rather than the plain text. Note that this normalizes the
|
@@ -24,7 +99,7 @@
|
|
24
99
|
input is set but the `domain` is not.
|
25
100
|
* Adds new payment processors `:apple_pay` and `:aps_payments` to
|
26
101
|
`Minfraud::Components::Payment`.
|
27
|
-
*
|
102
|
+
* Adds support for the IP address risk reasons in the minFraud Insights
|
28
103
|
and Factors responses. This is available at `.ip_address.risk_reasons`.
|
29
104
|
It is an array of `IPRiskReason` objects.
|
30
105
|
|
@@ -38,7 +113,7 @@
|
|
38
113
|
|
39
114
|
* IMPORTANT: Ruby 2.0 is no longer supported. If you're using Ruby 2.0,
|
40
115
|
please use version 1.3.0.
|
41
|
-
*
|
116
|
+
* Adds handling for the `REQUEST_INVALID` error code.
|
42
117
|
* The IP address is no longer a required input.
|
43
118
|
* Adds new payment processor `:tsys` to `Minfraud::Components::Payment`.
|
44
119
|
|
@@ -103,6 +178,7 @@
|
|
103
178
|
* Adds `amount` attribute to the `Minfraud::Components::Order` instances
|
104
179
|
|
105
180
|
## v1.0.3 (2016-11-24)
|
181
|
+
|
106
182
|
* Adds `token` attribute to the `Minfraud::Components::CreditCard` instances
|
107
183
|
according to the MinFraud Release Notes introduced on November 17, 2016
|
108
184
|
|
data/Gemfile
CHANGED
@@ -2,13 +2,4 @@
|
|
2
2
|
|
3
3
|
source 'https://rubygems.org'
|
4
4
|
|
5
|
-
# coveralls fails on Ruby 1.9. My understanding is we don't need to run this on
|
6
|
-
# more than one version anyway, so restrict to the current latest.
|
7
|
-
version_pieces = RUBY_VERSION.split('.')
|
8
|
-
major_version = version_pieces[0]
|
9
|
-
minor_version = version_pieces[1]
|
10
|
-
if major_version == '2' && minor_version == '7'
|
11
|
-
gem 'coveralls', require: false
|
12
|
-
end
|
13
|
-
|
14
5
|
gemspec
|
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-2022 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-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.
|
@@ -123,7 +123,7 @@ assessment = Minfraud::Assessments.new(
|
|
123
123
|
},
|
124
124
|
credit_card: {
|
125
125
|
issuer_id_number: '411111',
|
126
|
-
|
126
|
+
last_digits: '7643',
|
127
127
|
bank_name: 'Bank of No Hope',
|
128
128
|
bank_phone_country_code: '1',
|
129
129
|
bank_phone_number: '123-456-1234',
|
@@ -283,7 +283,7 @@ This API uses [Semantic Versioning](https://semver.org/).
|
|
283
283
|
|
284
284
|
Copyright (c) 2016-2020 kushnir.yb.
|
285
285
|
|
286
|
-
Copyright (c) 2020-
|
286
|
+
Copyright (c) 2020-2022 MaxMind, Inc.
|
287
287
|
|
288
288
|
The gem is available as open source under the terms of the [MIT
|
289
289
|
License](https://opensource.org/licenses/MIT).
|
data/lib/minfraud/assessments.rb
CHANGED
@@ -4,9 +4,8 @@ module Minfraud
|
|
4
4
|
# Assessments is used to perform minFraud Score, Insights, and Factors
|
5
5
|
# requests.
|
6
6
|
#
|
7
|
-
# @see https://dev.maxmind.com/minfraud
|
7
|
+
# @see https://dev.maxmind.com/minfraud?lang=en
|
8
8
|
class Assessments
|
9
|
-
include ::Minfraud::HTTPService
|
10
9
|
include ::Minfraud::Resolver
|
11
10
|
|
12
11
|
# The Account component.
|
@@ -82,6 +81,8 @@ module Minfraud
|
|
82
81
|
#
|
83
82
|
# @return [Minfraud::HTTPService::Response]
|
84
83
|
#
|
84
|
+
# @raise [JSON::ParserError] if there was invalid JSON in the response.
|
85
|
+
#
|
85
86
|
# @raise [Minfraud::AuthorizationError] If there was an authentication
|
86
87
|
# problem.
|
87
88
|
#
|
@@ -98,6 +99,8 @@ module Minfraud
|
|
98
99
|
#
|
99
100
|
# @return [Minfraud::HTTPService::Response]
|
100
101
|
#
|
102
|
+
# @raise [JSON::ParserError] if there was invalid JSON in the response.
|
103
|
+
#
|
101
104
|
# @raise [Minfraud::AuthorizationError] If there was an authentication
|
102
105
|
# problem.
|
103
106
|
#
|
@@ -114,6 +117,8 @@ module Minfraud
|
|
114
117
|
#
|
115
118
|
# @return [Minfraud::HTTPService::Response]
|
116
119
|
#
|
120
|
+
# @raise [JSON::ParserError] if there was invalid JSON in the response.
|
121
|
+
#
|
117
122
|
# @raise [Minfraud::AuthorizationError] If there was an authentication
|
118
123
|
# problem.
|
119
124
|
#
|
@@ -129,18 +134,22 @@ module Minfraud
|
|
129
134
|
private
|
130
135
|
|
131
136
|
def perform_request(endpoint)
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
+
response = nil
|
138
|
+
body = nil
|
139
|
+
Minfraud.connection_pool.with do |client|
|
140
|
+
response = client.post(
|
141
|
+
"/minfraud/v2.0/#{endpoint}",
|
142
|
+
json: request_body,
|
143
|
+
)
|
144
|
+
|
145
|
+
body = response.to_s
|
146
|
+
end
|
137
147
|
|
138
148
|
response = ::Minfraud::HTTPService::Response.new(
|
139
|
-
endpoint
|
140
|
-
|
141
|
-
|
142
|
-
body
|
143
|
-
headers: raw.headers
|
149
|
+
endpoint,
|
150
|
+
@locales,
|
151
|
+
response,
|
152
|
+
body,
|
144
153
|
)
|
145
154
|
|
146
155
|
::Minfraud::ErrorHandler.examine(response)
|
@@ -153,9 +162,5 @@ module Minfraud
|
|
153
162
|
mem.merge!(e.to_s => value.to_json)
|
154
163
|
end
|
155
164
|
end
|
156
|
-
|
157
|
-
def request
|
158
|
-
@request ||= Request.new(::Minfraud::HTTPService.configuration)
|
159
|
-
end
|
160
165
|
end
|
161
166
|
end
|
@@ -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
|
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
|
|
@@ -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
|
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,20 +4,22 @@ 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
|
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
|
|
11
|
-
# The issuer ID number for the credit card. This is the first 6
|
12
|
-
# the credit card number. It identifies the issuing bank.
|
11
|
+
# The issuer ID number for the credit card. This is the first 6 or 8
|
12
|
+
# digits of the credit card number. It identifies the issuing bank.
|
13
13
|
#
|
14
14
|
# @return [String, nil]
|
15
15
|
attr_accessor :issuer_id_number
|
16
16
|
|
17
|
-
# The last four digits of the credit card number.
|
17
|
+
# The last two or four digits of the credit card number.
|
18
|
+
#
|
19
|
+
# @see https://dev.maxmind.com/minfraud/api-documentation/requests?lang=en#schema--request--credit-card__last_digits
|
18
20
|
#
|
19
21
|
# @return [String, nil]
|
20
|
-
attr_accessor :
|
22
|
+
attr_accessor :last_digits
|
21
23
|
|
22
24
|
# The name of the issuing bank as provided by the end user.
|
23
25
|
#
|
@@ -39,6 +41,16 @@ module Minfraud
|
|
39
41
|
# @return [String, nil]
|
40
42
|
attr_accessor :bank_phone_number
|
41
43
|
|
44
|
+
# 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 {::issuer_id_number}
|
46
|
+
# if you do not wish to pass partial account numbers, or if your payment
|
47
|
+
# processor does not provide them.
|
48
|
+
#
|
49
|
+
# @see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
|
50
|
+
#
|
51
|
+
# @return [String, nil]
|
52
|
+
attr_accessor :country
|
53
|
+
|
42
54
|
# A token uniquely identifying the card. The token should consist of
|
43
55
|
# non-space printable ASCII characters. If the token is all digits, it
|
44
56
|
# must be more than 19 characters long. The token must not be a primary
|
@@ -72,12 +84,31 @@ module Minfraud
|
|
72
84
|
# @return [Boolean, nil]
|
73
85
|
attr_accessor :was_3d_secure_successful
|
74
86
|
|
87
|
+
# Get the last digits of the credit card number.
|
88
|
+
#
|
89
|
+
# @deprecated Use {::last_digits} instead.
|
90
|
+
#
|
91
|
+
# @return [String, nil]
|
92
|
+
def last_4_digits
|
93
|
+
@last_digits
|
94
|
+
end
|
95
|
+
|
96
|
+
# Set the last digits of the credit card number.
|
97
|
+
#
|
98
|
+
# @deprecated Use {::last_digits} instead.
|
99
|
+
#
|
100
|
+
# @return [String, nil]
|
101
|
+
def last_4_digits=(last4)
|
102
|
+
@last_digits = last4
|
103
|
+
end
|
104
|
+
|
75
105
|
# @param params [Hash] Hash of parameters. Each key/value should
|
76
106
|
# correspond to one of the available attributes.
|
77
107
|
def initialize(params = {})
|
78
108
|
@bank_phone_country_code = params[:bank_phone_country_code]
|
109
|
+
@country = params[:country]
|
79
110
|
@issuer_id_number = params[:issuer_id_number]
|
80
|
-
@
|
111
|
+
@last_digits = params[:last_digits] || params[:last_4_digits]
|
81
112
|
@bank_name = params[:bank_name]
|
82
113
|
@bank_phone_number = params[:bank_phone_number]
|
83
114
|
@avs_result = params[:avs_result]
|
@@ -94,8 +125,9 @@ module Minfraud
|
|
94
125
|
return if !Minfraud.enable_validation
|
95
126
|
|
96
127
|
validate_telephone_country_code('bank_phone_country_code', @bank_phone_country_code)
|
97
|
-
|
98
|
-
validate_regex('
|
128
|
+
validate_country_code('country', @country)
|
129
|
+
validate_regex('issuer_id_number', /\A(?:[0-9]{6}|[0-9]{8})\z/, @issuer_id_number)
|
130
|
+
validate_regex('last_digits', /\A(?:[0-9]{2}|[0-9]{4})\z/, @last_digits)
|
99
131
|
validate_string('bank_name', 255, @bank_name)
|
100
132
|
validate_string('bank_phone_number', 255, @bank_phone_number)
|
101
133
|
validate_string('avs_result', 1, @avs_result)
|
@@ -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
|
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
|
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
|
|
@@ -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
|
10
|
+
# @see https://dev.maxmind.com/minfraud/api-documentation/requests?lang=en#schema--request--email
|
11
11
|
class Email < Base
|
12
12
|
include Minfraud::Validates
|
13
13
|
|
@@ -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
|
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
|
@@ -43,16 +43,16 @@ module Minfraud
|
|
43
43
|
#
|
44
44
|
# @return [Symbol, nil]
|
45
45
|
enum_accessor :type,
|
46
|
-
[
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
46
|
+
%i[
|
47
|
+
account_creation
|
48
|
+
account_login
|
49
|
+
email_change
|
50
|
+
password_reset
|
51
|
+
payout_change
|
52
|
+
purchase
|
53
|
+
recurring_purchase
|
54
|
+
referral
|
55
|
+
survey
|
56
56
|
]
|
57
57
|
|
58
58
|
# @param params [Hash] Hash of parameters. Each key/value should
|
@@ -4,7 +4,7 @@ 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
|
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
|
|