Skip to content

Commit be5dde9

Browse files
committed
fix(provider place-details): restrict google place details query fields
1 parent 43f1311 commit be5dde9

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

src/provider/google-maps/command/google-maps-place-details.command.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ export class GoogleMapsPlaceDetailsCommand extends GoogleMapsLocationCommandMixi
2424
placeid: query.placeId,
2525
language: query.language,
2626
sensor: false,
27+
/**
28+
* @see interface
29+
* used basic fields
30+
*/
31+
fields: 'address_component,formatted_address,geometry,place_id,type',
2732
};
2833

2934
if (query.countryCode) {

src/provider/google-maps/interface/google-maps-place-details-query.interface.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,13 @@ import { GoogleMapsQueryInterface } from './google-maps-query.interface';
22

33
export interface GoogleMapsPlaceDetailsQueryInterface extends GoogleMapsQueryInterface {
44
placeid: string;
5+
/**
6+
* Warning: If you do not specify at least one field with a request,
7+
* or if you omit the fields parameter from a request, ALL possible fields will be returned,
8+
* and you will be billed accordingly. This applies only to Place Details requests.
9+
*
10+
* @link https://developers.google.com/places/web-service/details
11+
* @link https://developers.google.com/maps/documentation/javascript/reference/places-service#PlaceResult
12+
*/
13+
fields?: string;
514
}

test/fixture/provider/google.fixture.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@ export const providerRawPlaceDetailsResponse: Readonly<any> = Object.freeze({
218218
types: ['postal_code_suffix'],
219219
},
220220
],
221-
adr_address:
222-
'<span class="street-address">1158 E 89th St</span>, <span class="locality">Chicago</span>, <span class="region">IL</span> <span class="postal-code">60619-7017</span>, <span class="country-name">USA</span>',
221+
// adr_address:
222+
// '<span class="street-address">1158 E 89th St</span>, <span class="locality">Chicago</span>, <span class="region">IL</span> <span class="postal-code">60619-7017</span>, <span class="country-name">USA</span>',
223223
formatted_address: '1158 E 89th St, Chicago, IL 60619, USA',
224224
geometry: {
225225
location: {
@@ -237,18 +237,18 @@ export const providerRawPlaceDetailsResponse: Readonly<any> = Object.freeze({
237237
},
238238
},
239239
},
240-
icon: 'https://maps.gstatic.com/mapfiles/place_api/icons/geocode-71.png',
240+
// icon: 'https://maps.gstatic.com/mapfiles/place_api/icons/geocode-71.png',
241241
// sometimes this field is not returned
242242
// id: 'bbbfd42eed9385648e42f6f331d54eac2d61cbca',
243-
name: '1158 E 89th St',
243+
// name: '1158 E 89th St',
244244
place_id: 'EiYxMTU4IEUgODl0aCBTdCwgQ2hpY2FnbywgSUwgNjA2MTksIFVTQSIxEi8KFAoSCZ9KkOIgJg6IEYkN8yihjBnAEIYJKhQKEgkJAlVQKiYOiBHg0_ra6hq5MA',
245-
reference: 'EiYxMTU4IEUgODl0aCBTdCwgQ2hpY2FnbywgSUwgNjA2MTksIFVTQSIxEi8KFAoSCZ9KkOIgJg6IEYkN8yihjBnAEIYJKhQKEgkJAlVQKiYOiBHg0_ra6hq5MA',
245+
// reference: 'EiYxMTU4IEUgODl0aCBTdCwgQ2hpY2FnbywgSUwgNjA2MTksIFVTQSIxEi8KFAoSCZ9KkOIgJg6IEYkN8yihjBnAEIYJKhQKEgkJAlVQKiYOiBHg0_ra6hq5MA',
246246
// sometimes this field is not returned
247247
// scope: 'GOOGLE',
248248
types: ['street_address'],
249-
url: 'https://maps.google.com/?q=1158+E+89th+St,+Chicago,+IL+60619,+USA&ftid=0x880e2620e2904a9f:0x8850f56fdf8a5429',
250-
utc_offset: -360,
251-
vicinity: 'Chicago',
249+
// url: 'https://maps.google.com/?q=1158+E+89th+St,+Chicago,+IL+60619,+USA&ftid=0x880e2620e2904a9f:0x8850f56fdf8a5429',
250+
// utc_offset: -360,
251+
// vicinity: 'Chicago',
252252
},
253253
status: 'OK',
254254
});

0 commit comments

Comments
 (0)