-
Notifications
You must be signed in to change notification settings - Fork 2
/
addressFieldMapping.js
42 lines (38 loc) · 1.79 KB
/
addressFieldMapping.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
const PostcodeNlAddressFieldMapping = {
/**
* These constants define address parts which can be used to populate form fields.
* The values in PostcodeNlAddressFieldMapping.mapping can be any of the constants below.
*/
street: 'street',
houseNumber: 'houseNumber',
houseNumberAddition: 'houseNumberAddition',
city: 'city',
streetAndHouseNumber: 'streetAndHouseNumber',
// A combination of street and house number (including house number addition)
postcode: 'postcode',
// A combination of house number and house number addition
houseNumberAndAddition: 'houseNumberAndAddition',
/**
* Contains the province or similar administrative level for specific countries:
* Spain - Province
* Switzerland - Canton
*/
province: 'province',
};
/**
* Mapping from field names (ending) to their address parts used in the address forms.
* Change this mapping to accommodate your (checkout) forms address fields.
* - Keys: form field name endings (omit 'billing' in 'billing_address_1' to match both shipping and billing addresses),
* - Values: address parts placed in them on selecting an address.
* - Use a value of null to toggle the field without changing its value.
*/
PostcodeNlAddressFieldMapping.mapping = {
_address_1: PostcodeNlAddressFieldMapping.streetAndHouseNumber,
_address_2: null, // Address line 2
_postcode: PostcodeNlAddressFieldMapping.postcode,
_city: PostcodeNlAddressFieldMapping.city,
_state: PostcodeNlAddressFieldMapping.province,
_street_name: PostcodeNlAddressFieldMapping.street,
_house_number: PostcodeNlAddressFieldMapping.houseNumber,
_house_number_suffix: PostcodeNlAddressFieldMapping.houseNumberAddition
};