Skip to content

Commit 0eaa9ad

Browse files
authored
Merge pull request #1646 from maxmind/greg/eng-1672
Add new matchesPostal phone attribute
2 parents 820a89a + eadb4b4 commit 0eaa9ad

File tree

5 files changed

+21
-2
lines changed

5 files changed

+21
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ CHANGELOG
44
8.1.0
55
------------------
66

7+
* Added support for the `/billing_phone/matches_postal` and
8+
`/shipping_phone/matches_postal` outputs. These are available as the
9+
`matchesPostal` attributes on `response.billingPhone` and
10+
`response.shippingPhone`.
711
* Added `Cryptomus` to the `Processor` enum.
812

913
8.0.0 (2025-02-10)

fixtures/insights.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@
198198
"shipping_phone": {
199199
"country": "CA",
200200
"is_voip": true,
201+
"matches_postal": true,
201202
"network_operator": "Telus Mobility-SVR/2",
202203
"number_type": "mobile"
203204
},
@@ -213,6 +214,7 @@
213214
"billing_phone": {
214215
"country": "US",
215216
"is_voip": false,
217+
"matches_postal": true,
216218
"network_operator": "Verizon/1",
217219
"number_type": "fixed"
218220
},

src/response/records.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,14 @@ export interface Phone {
251251
* number has not been provided or we do not have data for it.
252252
*/
253253
readonly isVoip?: boolean;
254+
/**
255+
* This property is `true` if the phone number's prefix is commonly
256+
* associated with the postal code. It is `false` if the prefix is not
257+
* associated with the postal code. It is non-`null` only when the phone
258+
* number is in the US, the number prefix is in our database, and the
259+
* postal code and country are provided in the request.
260+
*/
261+
readonly matchesPostal?: boolean;
254262
/**
255263
* The name of the original network operator associated with the phone
256264
* number. This property does not reflect phone numbers that have been ported

src/response/web-records.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ export interface DispositionWebRecord {
117117
export interface PhoneWebRecord {
118118
readonly country?: string;
119119
readonly is_voip?: boolean;
120+
readonly matches_postal?: boolean;
120121
readonly network_operator?: string;
121122
readonly number_type?: string;
122123
}

src/webServiceClient.spec.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ describe('WebServiceClient', () => {
3737
});
3838

3939
it('handles "full" responses', async () => {
40-
expect.assertions(172);
40+
expect.assertions(174);
4141

4242
nockInstance
4343
.post(fullPath('factors'), factors.request.basic)
@@ -226,6 +226,7 @@ describe('WebServiceClient', () => {
226226

227227
expect(got.shippingPhone?.country).toEqual('CA');
228228
expect(got.shippingPhone?.isVoip).toEqual(true);
229+
expect(got.shippingPhone?.matchesPostal).toEqual(true);
229230
expect(got.shippingPhone?.networkOperator).toEqual(
230231
'Telus Mobility-SVR/2'
231232
);
@@ -239,6 +240,7 @@ describe('WebServiceClient', () => {
239240

240241
expect(got.billingPhone?.country).toEqual('US');
241242
expect(got.billingPhone?.isVoip).toEqual(false);
243+
expect(got.billingPhone?.matchesPostal).toEqual(true);
242244
expect(got.billingPhone?.networkOperator).toEqual('Verizon/1');
243245
expect(got.billingPhone?.numberType).toEqual('fixed');
244246

@@ -291,7 +293,7 @@ describe('WebServiceClient', () => {
291293
});
292294

293295
it('handles "full" responses', async () => {
294-
expect.assertions(147);
296+
expect.assertions(149);
295297

296298
nockInstance
297299
.post(fullPath('insights'), insights.request.basic)
@@ -480,6 +482,7 @@ describe('WebServiceClient', () => {
480482

481483
expect(got.shippingPhone?.country).toEqual('CA');
482484
expect(got.shippingPhone?.isVoip).toEqual(true);
485+
expect(got.shippingPhone?.matchesPostal).toEqual(true);
483486
expect(got.shippingPhone?.networkOperator).toEqual(
484487
'Telus Mobility-SVR/2'
485488
);
@@ -493,6 +496,7 @@ describe('WebServiceClient', () => {
493496

494497
expect(got.billingPhone?.country).toEqual('US');
495498
expect(got.billingPhone?.isVoip).toEqual(false);
499+
expect(got.billingPhone?.matchesPostal).toEqual(true);
496500
expect(got.billingPhone?.networkOperator).toEqual('Verizon/1');
497501
expect(got.billingPhone?.numberType).toEqual('fixed');
498502

0 commit comments

Comments
 (0)