minfraud 2.8.0 → 2.10.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 +55 -0
- data/LICENSE.txt +1 -1
- data/README.md +15 -10
- data/lib/minfraud/assessments.rb +1 -1
- data/lib/minfraud/components/account.rb +1 -1
- data/lib/minfraud/components/base.rb +3 -0
- 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 +8 -1
- data/lib/minfraud/components/email.rb +3 -3
- data/lib/minfraud/components/event.rb +23 -6
- data/lib/minfraud/components/order.rb +2 -2
- data/lib/minfraud/components/payment.rb +29 -1
- data/lib/minfraud/components/report/transaction.rb +8 -7
- data/lib/minfraud/components/shipping.rb +1 -1
- data/lib/minfraud/components/shopping_cart.rb +2 -2
- data/lib/minfraud/components/shopping_cart_item.rb +4 -4
- data/lib/minfraud/enum.rb +9 -0
- 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 +36 -3
- data/lib/minfraud/model/email_domain_visit.rb +46 -0
- 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 +142 -5
- data/lib/minfraud/version.rb +1 -1
- data/lib/minfraud.rb +11 -0
- metadata +78 -19
- data/.rspec +0 -2
- data/.rubocop.yml +0 -90
- 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 -38
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2e9a3d34fdcba8b336c22ccfb3088f42cf08e9debccc2a9f97e80cefe5f2c79d
|
|
4
|
+
data.tar.gz: 851ce59eec3a798f76821ddcd06e73840d5911735aa0f8be802c95caa340005f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4d5832ed02bbfe75d68e1232629815a1fe18be611f62d01b04c361d99efdc6125970abde150bd8ff52be2725c177bd72ac4600fee9030cabb53913eb552c7131
|
|
7
|
+
data.tar.gz: 9a8e36fb6925f617296fc4d5c472f3fed5d73a95715aaf3f5c098987ffb74e6218e7509a24fb0b38c73458e149969fdbcf05052a8b9b86ef9d631d921b13b211
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,60 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v2.10.0 (2026-07-21)
|
|
4
|
+
|
|
5
|
+
* Added the `residential` attribute to the `anonymizer` object on
|
|
6
|
+
`Minfraud::Model::IPAddress`. This object contains residential proxy
|
|
7
|
+
data for the network, including a confidence score, the network last
|
|
8
|
+
seen date, and the provider name. It may be populated even when no
|
|
9
|
+
other anonymizer attributes are set. This is only available from the
|
|
10
|
+
minFraud Insights and Factors web services.
|
|
11
|
+
* Added the `tracking_token` attribute to `Minfraud::Components::Device`.
|
|
12
|
+
This is the token generated by the
|
|
13
|
+
[Device Tracking Add-on](https://dev.maxmind.com/minfraud/track-devices)
|
|
14
|
+
for explicit device linking.
|
|
15
|
+
* Added the processors `:banquest`, `:fat_zebra`, `:summit_payments`, and
|
|
16
|
+
`:yaadpay` to `Minfraud::Components::Payment`.
|
|
17
|
+
* Added `:clear` to the valid values for the `tag` attribute on
|
|
18
|
+
`Minfraud::Components::Report::Transaction`.
|
|
19
|
+
* Unnecessary files were removed from the published .gem.
|
|
20
|
+
|
|
21
|
+
## v2.9.0 (2025-11-20)
|
|
22
|
+
|
|
23
|
+
* Added the processor `:securepay` to `Minfraud::Components::Payment`.
|
|
24
|
+
* Ruby 3.2+ is now required. If you're using Ruby 3.0 or 3.1, please use
|
|
25
|
+
version 2.8.0 of this gem.
|
|
26
|
+
* Added `/event/type` values `:credit_application` and `:fund_transfer` to
|
|
27
|
+
`Minfraud::Components::Event`.
|
|
28
|
+
* Added the `/event/type` value `:sim_swap` to
|
|
29
|
+
`Minfraud::Components::Event`.
|
|
30
|
+
* Added the input `/event/party`. This is the party submitting the
|
|
31
|
+
transaction. You may provide this using the `party` attribute on
|
|
32
|
+
`Minfraud::Components::Event`.
|
|
33
|
+
* Added the input `/payment/method`. This is the payment method associated
|
|
34
|
+
with the transaction. You may provide this using the `method` attribute
|
|
35
|
+
on `Minfraud::Components::Payment`.
|
|
36
|
+
* Added support for new email domain outputs on `Minfraud::Model::EmailDomain`:
|
|
37
|
+
* `/email/domain/classification` - The domain type (e.g., business,
|
|
38
|
+
education, government, isp_email). Available as the `classification`
|
|
39
|
+
attribute.
|
|
40
|
+
* `/email/domain/risk` - A risk score from 0.01 to 99 for the domain.
|
|
41
|
+
Available as the `risk` attribute.
|
|
42
|
+
* `/email/domain/volume` - Activity across the minFraud network expressed
|
|
43
|
+
as sightings per million. Available as the `volume` attribute.
|
|
44
|
+
* `/email/domain/visit` - Information from an automated visit to the
|
|
45
|
+
domain. Available as the `visit` attribute, which returns a
|
|
46
|
+
`Minfraud::Model::EmailDomainVisit` object.
|
|
47
|
+
* Added support for email domain visit outputs on
|
|
48
|
+
`Minfraud::Model::EmailDomainVisit`:
|
|
49
|
+
* `/email/domain/visit/has_redirect` - Whether the domain redirects to
|
|
50
|
+
another URL. Available as the `has_redirect` attribute.
|
|
51
|
+
* `/email/domain/visit/last_visited_on` - The date the automated visit
|
|
52
|
+
was completed. Available as the `last_visited_on` attribute.
|
|
53
|
+
* `/email/domain/visit/status` - The status of the domain (e.g., live,
|
|
54
|
+
dns_error, parked). Available as the `status` attribute.
|
|
55
|
+
* Updated `maxmind-geoip2` to 1.4, which includes new anonymizer and IP
|
|
56
|
+
risk outputs.
|
|
57
|
+
|
|
3
58
|
## v2.8.0 (2025-05-23)
|
|
4
59
|
|
|
5
60
|
* Added support for the `/billing_phone/matches_postal` and
|
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,9 +83,11 @@ 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: {
|
|
90
|
+
party: :customer,
|
|
89
91
|
transaction_id: 'txn3134133',
|
|
90
92
|
shop_id: 's2123',
|
|
91
93
|
time: '2012-04-12T23:20:50+00:00',
|
|
@@ -127,6 +129,7 @@ assessment = Minfraud::Assessments.new(
|
|
|
127
129
|
delivery_speed: :same_day,
|
|
128
130
|
},
|
|
129
131
|
payment: {
|
|
132
|
+
method: :card,
|
|
130
133
|
processor: :stripe,
|
|
131
134
|
was_authorized: false,
|
|
132
135
|
decline_code: 'invalid number',
|
|
@@ -243,6 +246,8 @@ this functionality.
|
|
|
243
246
|
|
|
244
247
|
The gem supplies several distinct exception-types:
|
|
245
248
|
|
|
249
|
+
* `InvalidInputError` - Raised if an input value is invalid when client-side
|
|
250
|
+
validation is enabled
|
|
246
251
|
* `RequestFormatError` - Raised if an unknown key is provided to the
|
|
247
252
|
`Minfraud::Assessments` constructor
|
|
248
253
|
* `ClientError` - Raised if the IP address is absent, reserved, or the JSON
|
|
@@ -271,11 +276,11 @@ Please report all issues with this code using the
|
|
|
271
276
|
|
|
272
277
|
If you are having an issue with the minFraud service that is not specific
|
|
273
278
|
to the client API, please see
|
|
274
|
-
[our support page](https://
|
|
279
|
+
[our support page](https://support.maxmind.com/knowledge-base).
|
|
275
280
|
|
|
276
281
|
## Requirements
|
|
277
282
|
|
|
278
|
-
This gem works with Ruby 3.
|
|
283
|
+
This gem works with Ruby 3.2 and above.
|
|
279
284
|
|
|
280
285
|
## Contributing
|
|
281
286
|
|
|
@@ -283,7 +288,7 @@ Bug reports and pull requests are welcome on
|
|
|
283
288
|
[GitHub](https://github.com/maxmind/minfraud-api-ruby). This project is
|
|
284
289
|
intended to be a safe, welcoming space for collaboration, and contributors
|
|
285
290
|
are expected to adhere to the [Contributor
|
|
286
|
-
Covenant](https://contributor-covenant.org) code of conduct.
|
|
291
|
+
Covenant](https://www.contributor-covenant.org/) code of conduct.
|
|
287
292
|
|
|
288
293
|
## Versioning
|
|
289
294
|
|
|
@@ -293,10 +298,10 @@ This API uses [Semantic Versioning](https://semver.org/).
|
|
|
293
298
|
|
|
294
299
|
Copyright (c) 2016-2020 kushnir.yb.
|
|
295
300
|
|
|
296
|
-
Copyright (c) 2020-
|
|
301
|
+
Copyright (c) 2020-2026 MaxMind, Inc.
|
|
297
302
|
|
|
298
303
|
The gem is available as open source under the terms of the [MIT
|
|
299
|
-
License](https://opensource.org/
|
|
304
|
+
License](https://opensource.org/license/MIT).
|
|
300
305
|
|
|
301
306
|
## Thank You
|
|
302
307
|
|
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
|
|
|
@@ -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.
|
|
@@ -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
|
|
@@ -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
|
|
|
@@ -99,7 +99,7 @@ module Minfraud
|
|
|
99
99
|
end
|
|
100
100
|
|
|
101
101
|
if domain == 'gmail.com'
|
|
102
|
-
local_part.
|
|
102
|
+
local_part.delete!('.')
|
|
103
103
|
end
|
|
104
104
|
|
|
105
105
|
domain_parts = domain.split('.')
|
|
@@ -384,7 +384,7 @@ module Minfraud
|
|
|
384
384
|
|
|
385
385
|
idx = domain.rindex('.')
|
|
386
386
|
if !idx.nil?
|
|
387
|
-
tld = domain[idx + 1..]
|
|
387
|
+
tld = domain[(idx + 1)..]
|
|
388
388
|
if TYPO_TLDS.key?(tld)
|
|
389
389
|
domain = "#{domain[0, idx]}.#{TYPO_TLDS[tld]}"
|
|
390
390
|
end
|
|
@@ -4,11 +4,23 @@ 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
|
|
11
11
|
|
|
12
|
+
# The party submitting the transaction. This must be one of +:agent+ or
|
|
13
|
+
# +:customer+.
|
|
14
|
+
#
|
|
15
|
+
# @!attribute party
|
|
16
|
+
#
|
|
17
|
+
# @return [Symbol, nil]
|
|
18
|
+
enum_accessor :party,
|
|
19
|
+
%i[
|
|
20
|
+
agent
|
|
21
|
+
customer
|
|
22
|
+
]
|
|
23
|
+
|
|
12
24
|
# Your internal ID for the transaction. MaxMind can use this to locate a
|
|
13
25
|
# specific transaction in logs, and it will also show up in email alerts
|
|
14
26
|
# and notifications from MaxMind to you. No specific format is required.
|
|
@@ -26,18 +38,19 @@ module Minfraud
|
|
|
26
38
|
|
|
27
39
|
# The date and time the event occurred. The string must be in the RFC
|
|
28
40
|
# 3339 date-time format, e.g., "2012-04-12T23:20:50.52Z". The time must
|
|
29
|
-
# be within the past
|
|
41
|
+
# be within the past year. If this field is not in the request, the
|
|
30
42
|
# current time will be used.
|
|
31
43
|
#
|
|
32
|
-
# @see https://
|
|
44
|
+
# @see https://datatracker.ietf.org/doc/html/rfc3339
|
|
33
45
|
#
|
|
34
46
|
# @return [String, nil]
|
|
35
47
|
attr_accessor :time
|
|
36
48
|
|
|
37
49
|
# The type of event being scored. This must be one of
|
|
38
|
-
# +:account_creation+, +:account_login+, +:
|
|
39
|
-
# +:
|
|
40
|
-
# +:
|
|
50
|
+
# +:account_creation+, +:account_login+, +:credit_application+,
|
|
51
|
+
# +:email_change+, +:fund_transfer+, +:password_reset+,
|
|
52
|
+
# +:payout_change+, +:purchase+, +:recurring_purchase+, +:referral+,
|
|
53
|
+
# +:sim_swap+, or +:survey+.
|
|
41
54
|
#
|
|
42
55
|
# @!attribute type
|
|
43
56
|
#
|
|
@@ -46,18 +59,22 @@ module Minfraud
|
|
|
46
59
|
%i[
|
|
47
60
|
account_creation
|
|
48
61
|
account_login
|
|
62
|
+
credit_application
|
|
49
63
|
email_change
|
|
64
|
+
fund_transfer
|
|
50
65
|
password_reset
|
|
51
66
|
payout_change
|
|
52
67
|
purchase
|
|
53
68
|
recurring_purchase
|
|
54
69
|
referral
|
|
70
|
+
sim_swap
|
|
55
71
|
survey
|
|
56
72
|
]
|
|
57
73
|
|
|
58
74
|
# @param params [Hash] Hash of parameters. Each key/value should
|
|
59
75
|
# correspond to one of the available attributes.
|
|
60
76
|
def initialize(params = {})
|
|
77
|
+
self.party = params[:party]
|
|
61
78
|
@transaction_id = params[:transaction_id]
|
|
62
79
|
@shop_id = params[:shop_id]
|
|
63
80
|
@time = params[: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
|
|
@@ -4,11 +4,33 @@ module Minfraud
|
|
|
4
4
|
module Components
|
|
5
5
|
# Payment corresponds to the payment 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--payment
|
|
8
8
|
class Payment < Base
|
|
9
9
|
include ::Minfraud::Enum
|
|
10
10
|
include Minfraud::Validates
|
|
11
11
|
|
|
12
|
+
# The payment method associated with the transaction. This must be one of
|
|
13
|
+
# +:bank_debit+, +:bank_redirect+, +:bank_transfer+, +:buy_now_pay_later+,
|
|
14
|
+
# +:card+, +:crypto+, +:digital_wallet+, +:gift_card+,
|
|
15
|
+
# +:real_time_payment+, or +:rewards+.
|
|
16
|
+
#
|
|
17
|
+
# @!attribute method
|
|
18
|
+
#
|
|
19
|
+
# @return [Symbol, nil]
|
|
20
|
+
enum_accessor :method,
|
|
21
|
+
%i[
|
|
22
|
+
bank_debit
|
|
23
|
+
bank_redirect
|
|
24
|
+
bank_transfer
|
|
25
|
+
buy_now_pay_later
|
|
26
|
+
card
|
|
27
|
+
crypto
|
|
28
|
+
digital_wallet
|
|
29
|
+
gift_card
|
|
30
|
+
real_time_payment
|
|
31
|
+
rewards
|
|
32
|
+
]
|
|
33
|
+
|
|
12
34
|
# The payment processor used for the transaction. The value is one
|
|
13
35
|
# listed as a valid value, as a symbol.
|
|
14
36
|
#
|
|
@@ -26,6 +48,7 @@ module Minfraud
|
|
|
26
48
|
aps_payments
|
|
27
49
|
authorizenet
|
|
28
50
|
balanced
|
|
51
|
+
banquest
|
|
29
52
|
beanstream
|
|
30
53
|
bluepay
|
|
31
54
|
bluesnap
|
|
@@ -74,6 +97,7 @@ module Minfraud
|
|
|
74
97
|
epx
|
|
75
98
|
eway
|
|
76
99
|
exact
|
|
100
|
+
fat_zebra
|
|
77
101
|
first_atlantic_commerce
|
|
78
102
|
first_data
|
|
79
103
|
fiserv
|
|
@@ -147,6 +171,7 @@ module Minfraud
|
|
|
147
171
|
rewardspay
|
|
148
172
|
safecharge
|
|
149
173
|
sagepay
|
|
174
|
+
securepay
|
|
150
175
|
securetrading
|
|
151
176
|
shopify_payments
|
|
152
177
|
simplify_commerce
|
|
@@ -156,6 +181,7 @@ module Minfraud
|
|
|
156
181
|
solidtrust_pay
|
|
157
182
|
sps_decidir
|
|
158
183
|
stripe
|
|
184
|
+
summit_payments
|
|
159
185
|
synapsefi
|
|
160
186
|
systempay
|
|
161
187
|
telerecargas
|
|
@@ -175,6 +201,7 @@ module Minfraud
|
|
|
175
201
|
windcave
|
|
176
202
|
wirecard
|
|
177
203
|
worldpay
|
|
204
|
+
yaadpay
|
|
178
205
|
]
|
|
179
206
|
|
|
180
207
|
# The authorization outcome from the payment processor. If the
|
|
@@ -195,6 +222,7 @@ module Minfraud
|
|
|
195
222
|
def initialize(params = {})
|
|
196
223
|
@was_authorized = params[:was_authorized]
|
|
197
224
|
@decline_code = params[:decline_code]
|
|
225
|
+
self.method = params[:method]
|
|
198
226
|
self.processor = params[:processor]
|
|
199
227
|
|
|
200
228
|
validate
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
module Minfraud
|
|
4
4
|
module Components
|
|
5
|
+
# Components for the Report Transaction API.
|
|
5
6
|
module Report
|
|
6
7
|
# Contains the fields used in the Report Transaction API.
|
|
7
8
|
#
|
|
8
|
-
# @see https://dev.maxmind.com/minfraud/report-a-transaction
|
|
9
|
+
# @see https://dev.maxmind.com/minfraud/report-a-transaction/?lang=en
|
|
9
10
|
class Transaction < Base
|
|
10
11
|
include ::Minfraud::Enum
|
|
11
12
|
include ::Minfraud::Validates
|
|
@@ -22,13 +23,13 @@ module Minfraud
|
|
|
22
23
|
# A symbol indicating the likelihood that a transaction may be
|
|
23
24
|
# fraudulent.
|
|
24
25
|
#
|
|
25
|
-
# This may be one of +:chargeback+, +:
|
|
26
|
-
# +:suspected_fraud+.
|
|
26
|
+
# This may be one of +:chargeback+, +:clear+ (to retract a previous
|
|
27
|
+
# report), +:not_fraud+, +:spam_or_abuse+, or +:suspected_fraud+.
|
|
27
28
|
#
|
|
28
29
|
# @!attribute tag
|
|
29
30
|
#
|
|
30
31
|
# @return [Symbol, nil]
|
|
31
|
-
enum_accessor :tag, %i[chargeback not_fraud spam_or_abuse suspected_fraud]
|
|
32
|
+
enum_accessor :tag, %i[chargeback clear not_fraud spam_or_abuse suspected_fraud]
|
|
32
33
|
|
|
33
34
|
# A string which is provided by your payment processor indicating the
|
|
34
35
|
# reason for the chargeback.
|
|
@@ -95,15 +96,15 @@ module Minfraud
|
|
|
95
96
|
validate_uuid('minfraud_id', @minfraud_id)
|
|
96
97
|
|
|
97
98
|
if ip_address.nil? &&
|
|
98
|
-
(minfraud_id.nil? || empty_uuid(minfraud_id)) &&
|
|
99
|
+
(minfraud_id.nil? || empty_uuid?(minfraud_id)) &&
|
|
99
100
|
(maxmind_id.nil? || maxmind_id.empty?) &&
|
|
100
101
|
(transaction_id.nil? || transaction_id.empty?)
|
|
101
102
|
raise ArgumentError, 'At least one of the following is required: ip_address, minfraud_id, maxmind_id, transaction_id.'
|
|
102
103
|
end
|
|
103
104
|
end
|
|
104
105
|
|
|
105
|
-
def empty_uuid(value)
|
|
106
|
-
stripped_value = value.to_s.
|
|
106
|
+
def empty_uuid?(value)
|
|
107
|
+
stripped_value = value.to_s.delete('-')
|
|
107
108
|
stripped_value == '0' * 32
|
|
108
109
|
end
|
|
109
110
|
end
|
|
@@ -4,7 +4,7 @@ module Minfraud
|
|
|
4
4
|
module Components
|
|
5
5
|
# Shipping corresponds to the shipping 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--shipping
|
|
8
8
|
class Shipping < Addressable
|
|
9
9
|
include ::Minfraud::Enum
|
|
10
10
|
|
|
@@ -5,7 +5,7 @@ module Minfraud
|
|
|
5
5
|
# ShoppingCart corresponds to the shopping_cart 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--shopping-cart
|
|
9
9
|
class ShoppingCart < Base
|
|
10
10
|
# An array of Minfraud::Components::ShoppingCartItem instances.
|
|
11
11
|
#
|
|
@@ -17,7 +17,7 @@ module Minfraud
|
|
|
17
17
|
# to an item's field, or as a Minfraud:::Components::ShoppingCartItem
|
|
18
18
|
# object.
|
|
19
19
|
def initialize(params = [])
|
|
20
|
-
@items = params.map(
|
|
20
|
+
@items = params.map { |param| resolve(param) }
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
# A JSON representation of Minfraud::Components::ShoppingCart items.
|
|
@@ -5,20 +5,20 @@ module Minfraud
|
|
|
5
5
|
# ShoppingCartItem corresponds to objects in the shopping_cart object
|
|
6
6
|
# of a minFraud 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--shopping-cart
|
|
9
9
|
class ShoppingCartItem < Base
|
|
10
10
|
include Minfraud::Validates
|
|
11
11
|
|
|
12
12
|
# The category of the item. This can also be a hashed value; see link.
|
|
13
13
|
#
|
|
14
|
-
# @see https://dev.maxmind.com/minfraud/api-documentation/requests
|
|
14
|
+
# @see https://dev.maxmind.com/minfraud/api-documentation/requests/?lang=en#schema--request--shopping-cart__category
|
|
15
15
|
#
|
|
16
16
|
# @return [String, nil]
|
|
17
17
|
attr_accessor :category
|
|
18
18
|
|
|
19
19
|
# The internal ID of the item. This can also be a hashed value; see link.
|
|
20
20
|
#
|
|
21
|
-
# @see https://dev.maxmind.com/minfraud/api-documentation/requests
|
|
21
|
+
# @see https://dev.maxmind.com/minfraud/api-documentation/requests/?lang=en#schema--request--shopping-cart__item_id
|
|
22
22
|
#
|
|
23
23
|
# @return [String, nil]
|
|
24
24
|
attr_accessor :item_id
|
|
@@ -31,7 +31,7 @@ module Minfraud
|
|
|
31
31
|
|
|
32
32
|
# The per-unit price of this item in the shopping cart. This should use
|
|
33
33
|
# the same currency as the order currency. The value must be at least 0
|
|
34
|
-
# and at most
|
|
34
|
+
# and at most 1e13 - 1.
|
|
35
35
|
#
|
|
36
36
|
# @return [Float, nil]
|
|
37
37
|
attr_accessor :price
|
data/lib/minfraud/enum.rb
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
module Minfraud
|
|
4
4
|
# Enum provides helpers for working with attributes with enumerated types.
|
|
5
5
|
module Enum
|
|
6
|
+
# Hook method called when the module is included into a class.
|
|
7
|
+
# Extends the class with ClassMethods.
|
|
8
|
+
#
|
|
9
|
+
# @param base [Class] The class including this module.
|
|
10
|
+
#
|
|
11
|
+
# @return [Class] The base class.
|
|
6
12
|
def self.included(base)
|
|
7
13
|
base.extend(ClassMethods)
|
|
8
14
|
end
|
|
@@ -15,7 +21,10 @@ module Minfraud
|
|
|
15
21
|
#
|
|
16
22
|
# @return [Hash]
|
|
17
23
|
def mapping
|
|
24
|
+
# rubocop:disable ThreadSafety/ClassInstanceVariable
|
|
25
|
+
# This is a false positive - this is set during class definition and then only read
|
|
18
26
|
@mapping ||= {}
|
|
27
|
+
# rubocop:enable ThreadSafety/ClassInstanceVariable
|
|
19
28
|
end
|
|
20
29
|
|
|
21
30
|
# Create a set of methods for enum-like behavior of the attribute.
|