Skip to content

Add phone matches_postal output #119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## v2.8.0

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

## v2.7.1 (2025-02-10)
Expand Down
10 changes: 10 additions & 0 deletions lib/minfraud/model/phone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ class Phone < Abstract
# @return [Boolean, nil]
attr_reader :is_voip

# This property is true if the phone number's prefix is commonly
# associated with the postal code. It is false if the prefix is not
# associated with the postal code. It is non-nil only when the phone
# number is in the US, the number prefix is in our database, and the
# postal code and country are provided in the request.
#
# @return [Boolean, nil]
attr_reader :matches_postal

# The name of the original network operator associated with the phone
# number. This attribute does not reflect phone numbers that have been
# ported from the original operator to another, nor does it identify
Expand All @@ -41,6 +50,7 @@ def initialize(record)

@country = get('country')
@is_voip = get('is_voip')
@matches_postal = get('matches_postal')
@network_operator = get('network_operator')
@number_type = get('number_type')
end
Expand Down
2 changes: 1 addition & 1 deletion minfraud.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Gem::Specification.new do |spec|

spec.add_dependency 'connection_pool', '~> 2.2'
spec.add_dependency 'http', '>= 4.3', '< 6.0'
spec.add_dependency 'maxmind-geoip2', '~> 1.2'
spec.add_dependency 'maxmind-geoip2', '~> 1.3'
spec.add_dependency 'simpleidn', '~> 0.1', '>= 0.1.1'

spec.add_development_dependency 'bundler', '~> 2.2'
Expand Down
2 changes: 2 additions & 0 deletions spec/fixtures/files/insights-response1.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
"billing_phone": {
"country": "US",
"is_voip": false,
"matches_postal": true,
"network_operator": "Verizon/1",
"number_type": "fixed"
},
Expand Down Expand Up @@ -198,6 +199,7 @@
"shipping_phone": {
"country": "CA",
"is_voip": true,
"matches_postal": true,
"network_operator": "Telus Mobility-SVR/2",
"number_type": "mobile"
},
Expand Down
2 changes: 2 additions & 0 deletions spec/model/insights_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@

expect(m.billing_phone.country).to eq 'US'
expect(m.billing_phone.is_voip).to eq false
expect(m.billing_phone.matches_postal).to eq true
expect(m.billing_phone.network_operator).to eq 'Verizon/1'
expect(m.billing_phone.number_type).to eq 'fixed'

Expand Down Expand Up @@ -133,6 +134,7 @@

expect(m.shipping_phone.country).to eq 'CA'
expect(m.shipping_phone.is_voip).to eq true
expect(m.shipping_phone.matches_postal).to eq true
expect(m.shipping_phone.network_operator).to eq 'Telus Mobility-SVR/2'
expect(m.shipping_phone.number_type).to eq 'mobile'

Expand Down