Skip to content

Commit 4312a32

Browse files
authored
Merge pull request #119 from maxmind/greg/eng-1669
Add phone matches_postal output
2 parents 8c17089 + 64169d1 commit 4312a32

File tree

5 files changed

+18
-1
lines changed

5 files changed

+18
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## v2.8.0
44

5+
* Added support for the `/billing_phone/matches_postal` and
6+
`/shipping_phone/matches_postal` outputs. These are available as the
7+
`matches_postal` attribute on `Minfraud::Model::Phone`.
58
* Added the processor `:cryptomus` to `Minfraud::Components::Payment`.
69

710
## v2.7.1 (2025-02-10)

lib/minfraud/model/phone.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ class Phone < Abstract
2121
# @return [Boolean, nil]
2222
attr_reader :is_voip
2323

24+
# This property is true if the phone number's prefix is commonly
25+
# associated with the postal code. It is false if the prefix is not
26+
# associated with the postal code. It is non-nil only when the phone
27+
# number is in the US, the number prefix is in our database, and the
28+
# postal code and country are provided in the request.
29+
#
30+
# @return [Boolean, nil]
31+
attr_reader :matches_postal
32+
2433
# The name of the original network operator associated with the phone
2534
# number. This attribute does not reflect phone numbers that have been
2635
# ported from the original operator to another, nor does it identify
@@ -41,6 +50,7 @@ def initialize(record)
4150

4251
@country = get('country')
4352
@is_voip = get('is_voip')
53+
@matches_postal = get('matches_postal')
4454
@network_operator = get('network_operator')
4555
@number_type = get('number_type')
4656
end

minfraud.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
2424

2525
spec.add_dependency 'connection_pool', '~> 2.2'
2626
spec.add_dependency 'http', '>= 4.3', '< 6.0'
27-
spec.add_dependency 'maxmind-geoip2', '~> 1.2'
27+
spec.add_dependency 'maxmind-geoip2', '~> 1.3'
2828
spec.add_dependency 'simpleidn', '~> 0.1', '>= 0.1.1'
2929

3030
spec.add_development_dependency 'bundler', '~> 2.2'

spec/fixtures/files/insights-response1.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@
153153
"billing_phone": {
154154
"country": "US",
155155
"is_voip": false,
156+
"matches_postal": true,
156157
"network_operator": "Verizon/1",
157158
"number_type": "fixed"
158159
},
@@ -198,6 +199,7 @@
198199
"shipping_phone": {
199200
"country": "CA",
200201
"is_voip": true,
202+
"matches_postal": true,
201203
"network_operator": "Telus Mobility-SVR/2",
202204
"number_type": "mobile"
203205
},

spec/model/insights_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696

9797
expect(m.billing_phone.country).to eq 'US'
9898
expect(m.billing_phone.is_voip).to eq false
99+
expect(m.billing_phone.matches_postal).to eq true
99100
expect(m.billing_phone.network_operator).to eq 'Verizon/1'
100101
expect(m.billing_phone.number_type).to eq 'fixed'
101102

@@ -133,6 +134,7 @@
133134

134135
expect(m.shipping_phone.country).to eq 'CA'
135136
expect(m.shipping_phone.is_voip).to eq true
137+
expect(m.shipping_phone.matches_postal).to eq true
136138
expect(m.shipping_phone.network_operator).to eq 'Telus Mobility-SVR/2'
137139
expect(m.shipping_phone.number_type).to eq 'mobile'
138140

0 commit comments

Comments
 (0)