diff --git a/CHANGELOG.md b/CHANGELOG.md index 1381f76..fe5b3c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/lib/minfraud/model/phone.rb b/lib/minfraud/model/phone.rb index 632494b..4896261 100644 --- a/lib/minfraud/model/phone.rb +++ b/lib/minfraud/model/phone.rb @@ -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 @@ -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 diff --git a/minfraud.gemspec b/minfraud.gemspec index 8fc24d2..b3a3aa8 100644 --- a/minfraud.gemspec +++ b/minfraud.gemspec @@ -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' diff --git a/spec/fixtures/files/insights-response1.json b/spec/fixtures/files/insights-response1.json index 836797c..b5762ae 100644 --- a/spec/fixtures/files/insights-response1.json +++ b/spec/fixtures/files/insights-response1.json @@ -153,6 +153,7 @@ "billing_phone": { "country": "US", "is_voip": false, + "matches_postal": true, "network_operator": "Verizon/1", "number_type": "fixed" }, @@ -198,6 +199,7 @@ "shipping_phone": { "country": "CA", "is_voip": true, + "matches_postal": true, "network_operator": "Telus Mobility-SVR/2", "number_type": "mobile" }, diff --git a/spec/model/insights_spec.rb b/spec/model/insights_spec.rb index 9e10240..d608003 100644 --- a/spec/model/insights_spec.rb +++ b/spec/model/insights_spec.rb @@ -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' @@ -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'