PostcodeNl_Api - Version 1.2.0.0

Version Notes

Features:
- Added the new Postcode.nl Signal API network for data checking and fraud warnings (https://api.postcode.nl/documentation/signal-api-description in Dutch)
- Added option to enable/disable Signal and Address API separately

Download this release

Release Info

Developer Postcode.nl Technical Support
Extension PostcodeNl_Api
Version 1.2.0.0
Comparing to
See all releases


Code changes from version 1.1.2.1 to 1.2.0.0

app/code/community/PostcodeNl/Api/Helper/Data.php CHANGED
@@ -4,62 +4,28 @@ class PostcodeNl_Api_Helper_Data extends Mage_Core_Helper_Abstract
4
  const API_TIMEOUT = 3;
5
  const API_URL = 'https://api.postcode.nl';
6
 
7
- protected $_modules;
8
 
9
  protected $_enrichType = 0;
10
 
11
- protected function _getMagentoVersion()
12
- {
13
- if ($this->_getModuleInfo('Enterprise_CatalogPermissions') !== null)
14
- {
15
- // Detect enterprise
16
- return 'MagentoEnterprise/'. Mage::getVersion();
17
- }
18
- elseif ($this->_getModuleInfo('Enterprise_Enterprise') !== null)
19
- {
20
- // Detect professional
21
- return 'MagentoProfessional/'. Mage::getVersion();
22
- }
23
- else
24
- {
25
- // Rest
26
- return 'Magento/'. Mage::getVersion();
27
- }
28
- }
29
-
30
- protected function _getModuleInfo($moduleName)
31
- {
32
- if (!isset($this->_modules))
33
- $this->_modules = (array)Mage::getConfig()->getNode('modules')->children();
34
-
35
- if (!isset($this->_modules[$moduleName]))
36
- return null;
37
-
38
- return $this->_modules[$moduleName];
39
- }
40
-
41
- protected function _getConfigBoolString($configKey)
42
- {
43
- if (Mage::getStoreConfig($configKey))
44
- return 'true';
45
-
46
- return 'false';
47
- }
48
 
49
  /**
50
  * Get the html for initializing validation script.
51
  *
 
 
52
  * @return string
53
  */
54
  public function getJsinit($getAdminConfig = false)
55
  {
56
- if ($getAdminConfig && Mage::getStoreConfig('postcodenl_api/advanced_config/admin_validation_disabled'))
57
  return '';
58
 
59
- if ($getAdminConfig)
60
- $baseUrl = Mage::helper('adminhtml')->getUrl('*/pcnl/lookup', array('_secure' => true));
61
- else
62
- $baseUrl = Mage::getUrl('postcodenl_api/json', array('_secure' => true));
63
 
64
  $html = '
65
  <script type="text/javascript">
@@ -67,6 +33,7 @@ class PostcodeNl_Api_Helper_Data extends Mage_Core_Helper_Abstract
67
  var PCNLAPI_CONFIG = {
68
  baseUrl: "' . htmlspecialchars($baseUrl) . '",
69
  useStreet2AsHouseNumber: ' . $this->_getConfigBoolString('postcodenl_api/advanced_config/use_street2_as_housenumber') . ',
 
70
  blockPostOfficeBoxAddresses: '. $this->_getConfigBoolString('postcodenl_api/advanced_config/block_postofficeboxaddresses') . ',
71
  neverHideCountry: ' . $this->_getConfigBoolString('postcodenl_api/advanced_config/never_hide_country') . ',
72
  showcase: ' . $this->_getConfigBoolString('postcodenl_api/development_config/api_showcase') . ',
@@ -102,48 +69,58 @@ class PostcodeNl_Api_Helper_Data extends Mage_Core_Helper_Abstract
102
  return $html;
103
  }
104
 
105
- public function setEnrichType($enrichType)
 
 
 
 
 
 
 
106
  {
107
- $this->_enrichType = preg_replace('~[^0-9a-z\-_,]~i', '', $enrichType);
108
- if (strlen($this->_enrichType) > 40)
109
- $this->_enrichType = substr($this->_enrichType, 0, 40);
110
- }
111
 
112
- public function lookupAddress($postcode, $houseNumber, $houseNumberAddition)
113
- {
114
- if (!Mage::getStoreConfig('postcodenl_api/config/enabled'))
115
- {
116
- return array('message' => $this->__('Postcode.nl API not enabled.'));
117
- }
118
 
119
- // Basic Configuration
120
- $serviceKey = trim(Mage::getStoreConfig('postcodenl_api/config/api_key'));
121
- $serviceSecret = trim(Mage::getStoreConfig('postcodenl_api/config/api_secret'));
122
- // Development options
123
- $serviceUrl = trim(Mage::getStoreConfig('postcodenl_api/development_config/api_url'));
124
- if (empty($serviceUrl))
125
- $serviceUrl = self::API_URL;
126
 
127
- $serviceShowcase = Mage::getStoreConfig('postcodenl_api/development_config/api_showcase');
128
- $serviceDebug = Mage::getStoreConfig('postcodenl_api/development_config/api_debug');
129
 
130
- $extensionInfo = $this->_getModuleInfo('PostcodeNl_Api');
131
- $extensionVersion = $extensionInfo ? (string)$extensionInfo->version : 'unknown';
132
 
133
- if (!$serviceUrl || !$serviceKey || !$serviceSecret)
134
- {
135
- return array('message' => $this->__('Postcode.nl API not configured.'));
136
- }
 
 
 
 
 
137
 
138
- // Check for SSL support in CURL, if connecting to `https`
139
- if (substr($serviceUrl, 0, 8) == 'https://')
140
- {
141
- $curlVersion = curl_version();
142
- if (!($curlVersion['features'] & CURL_VERSION_SSL))
143
- {
144
- return array('message' => $this->__('Cannot connect to Postcode.nl API: Server is missing SSL (https) support for CURL.'));
145
- }
146
- }
 
 
 
 
 
 
 
 
147
 
148
  // Some basic user data 'fixing', remove any not-letter, not-number characters
149
  $postcode = preg_replace('~[^a-z0-9]~i', '', $postcode);
@@ -151,104 +128,444 @@ class PostcodeNl_Api_Helper_Data extends Mage_Core_Helper_Abstract
151
  // Basic postcode format checking
152
  if (!preg_match('~^[0-9]{4}[a-z]{2}$~i', $postcode))
153
  {
154
- $sendResponse = array();
155
- $sendResponse['message'] = $this->__('Invalid postcode format, use `1234AB` format.');
156
- $sendResponse['messageTarget'] = 'postcode';
157
- return $sendResponse;
158
  }
159
 
160
- $url = $serviceUrl . '/rest/addresses/' . rawurlencode($postcode). '/'. rawurlencode($houseNumber) . '/'. rawurlencode($houseNumberAddition);
161
 
162
- $ch = curl_init();
163
- curl_setopt($ch, CURLOPT_URL, $url);
164
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
165
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, self::API_TIMEOUT);
166
- curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
167
- curl_setopt($ch, CURLOPT_USERPWD, $serviceKey .':'. $serviceSecret);
168
- curl_setopt($ch, CURLOPT_USERAGENT, 'PostcodeNl_Api_MagentoPlugin/' . $extensionVersion .' '. $this->_getMagentoVersion() .' PHP/'. phpversion() .' EnrichType/'. $this->_enrichType);
169
- $jsonResponse = curl_exec($ch);
170
- $curlError = curl_error($ch);
171
- curl_close($ch);
172
 
173
- $response = json_decode($jsonResponse, true);
 
174
 
175
- $sendResponse = array();
176
  if ($serviceShowcase)
177
- $sendResponse['showcaseResponse'] = $response;
178
 
179
  if ($serviceDebug)
180
  {
181
- $modules = array();
182
- foreach (Mage::getConfig()->getNode('modules')->children() as $name => $module)
183
- {
184
- $modules[$name] = array();
185
- foreach ($module as $key => $value)
186
- {
187
- if (in_array((string)$key, array('active')))
188
- $modules[$name][$key] = (string)$value == 'true' ? true : false;
189
- else if (in_array((string)$key, array('codePool', 'version')))
190
- $modules[$name][$key] = (string)$value;
191
- }
192
- }
193
-
194
- $sendResponse['debugInfo'] = array(
195
  'requestUrl' => $url,
196
- 'rawResponse' => $jsonResponse,
197
- 'parsedResponse' => $response,
198
- 'curlError' => $curlError,
199
  'configuration' => array(
200
- 'url' => $serviceUrl,
201
- 'key' => $serviceKey,
202
- 'secret' => substr($serviceSecret, 0, 6) .'[hidden]',
203
  'showcase' => $serviceShowcase,
204
  'debug' => $serviceDebug,
205
  ),
206
  'magentoVersion' => $this->_getMagentoVersion(),
207
- 'extensionVersion' => $extensionVersion,
208
- 'modules' => $modules,
209
  );
210
  }
211
 
212
- if (is_array($response) && isset($response['exceptionId']))
 
 
 
 
213
  {
214
- switch ($response['exceptionId'])
215
  {
216
- case 'PostcodeNl_Controller_Address_PostcodeTooShortException':
217
- case 'PostcodeNl_Controller_Address_PostcodeTooLongException':
218
- case 'PostcodeNl_Controller_Address_NoPostcodeSpecifiedException':
219
- case 'PostcodeNl_Controller_Address_InvalidPostcodeException':
220
- $sendResponse['message'] = $this->__('Invalid postcode format, use `1234AB` format.');
221
- $sendResponse['messageTarget'] = 'postcode';
222
- break;
223
- case 'PostcodeNl_Service_PostcodeAddress_AddressNotFoundException':
224
- $sendResponse['message'] = $this->__('Unknown postcode + housenumber combination.');
225
- $sendResponse['messageTarget'] = 'housenumber';
226
- break;
227
- case 'PostcodeNl_Controller_Address_InvalidHouseNumberException':
228
- case 'PostcodeNl_Controller_Address_NoHouseNumberSpecifiedException':
229
- case 'PostcodeNl_Controller_Address_NegativeHouseNumberException':
230
- case 'PostcodeNl_Controller_Address_HouseNumberTooLargeException':
231
- case 'PostcodeNl_Controller_Address_HouseNumberIsNotAnIntegerException':
232
- $sendResponse['message'] = $this->__('Housenumber format is not valid.');
233
- $sendResponse['messageTarget'] = 'housenumber';
234
- break;
235
- default:
236
- $sendResponse['message'] = $this->__('Validation error, please use manual input.');
237
- $sendResponse['messageTarget'] = 'housenumber';
238
- $sendResponse['useManual'] = true;
239
- break;
 
 
 
 
 
 
 
 
240
  }
241
  }
242
- else if (is_array($response) && isset($response['postcode']))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
243
  {
244
- $sendResponse = array_merge($sendResponse, $response);
 
 
 
 
 
245
  }
246
  else
247
  {
248
- $sendResponse['message'] = $this->__('Validation unavailable, please use manual input.');
249
- $sendResponse['messageTarget'] = 'housenumber';
250
- $sendResponse['useManual'] = true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
251
  }
252
- return $sendResponse;
253
  }
254
  }
4
  const API_TIMEOUT = 3;
5
  const API_URL = 'https://api.postcode.nl';
6
 
7
+ protected $_modules = null;
8
 
9
  protected $_enrichType = 0;
10
 
11
+ protected $_httpResponseRaw = null;
12
+ protected $_httpResponseCode = null;
13
+ protected $_httpResponseCodeClass = null;
14
+ protected $_httpClientError = null;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
  /**
17
  * Get the html for initializing validation script.
18
  *
19
+ * @param bool $getAdminConfig
20
+ *
21
  * @return string
22
  */
23
  public function getJsinit($getAdminConfig = false)
24
  {
25
+ if ($getAdminConfig && $this->_getStoreConfig('postcodenl_api/advanced_config/admin_validation_disabled'))
26
  return '';
27
 
28
+ $baseUrl = $this->_getMagentoLookupUrl($getAdminConfig);
 
 
 
29
 
30
  $html = '
31
  <script type="text/javascript">
33
  var PCNLAPI_CONFIG = {
34
  baseUrl: "' . htmlspecialchars($baseUrl) . '",
35
  useStreet2AsHouseNumber: ' . $this->_getConfigBoolString('postcodenl_api/advanced_config/use_street2_as_housenumber') . ',
36
+ useStreet3AsHouseNumberAddition: ' . $this->_getConfigBoolString('postcodenl_api/advanced_config/use_street3_as_housenumber_addition') . ',
37
  blockPostOfficeBoxAddresses: '. $this->_getConfigBoolString('postcodenl_api/advanced_config/block_postofficeboxaddresses') . ',
38
  neverHideCountry: ' . $this->_getConfigBoolString('postcodenl_api/advanced_config/never_hide_country') . ',
39
  showcase: ' . $this->_getConfigBoolString('postcodenl_api/development_config/api_showcase') . ',
69
  return $html;
70
  }
71
 
72
+ /**
73
+ * Check if a specific service is enabled or not.
74
+ *
75
+ * @param string $service
76
+ *
77
+ * @return bool
78
+ */
79
+ public function isApiEnabled($service)
80
  {
81
+ // If we're debugging, assume all services are enabled, to get feedback on all levels.
82
+ if ($this->_getStoreConfig('postcodenl_api/development_config/api_debug'))
83
+ return true;
 
84
 
85
+ if (!$this->_getStoreConfig('postcodenl_api/config/enabled'))
86
+ return false;
 
 
 
 
87
 
88
+ if ($service === 'Address' && !$this->_getStoreConfig('postcodenl_api/config/enabled_address_api'))
89
+ return false;
 
 
 
 
 
90
 
91
+ if ($service === 'Signal' && !$this->_getStoreConfig('postcodenl_api/config/enabled_signal_api'))
92
+ return false;
93
 
94
+ return true;
95
+ }
96
 
97
+ /**
98
+ * Check if we're currently in debug mode.
99
+ *
100
+ * @return bool
101
+ */
102
+ public function isDebugging()
103
+ {
104
+ return (bool)$this->_getStoreConfig('postcodenl_api/development_config/api_debug');
105
+ }
106
 
107
+ /**
108
+ * Look information about a Dutch address by postcode, house number, and house number addition
109
+ *
110
+ * @param string $postcode
111
+ * @param string $houseNumber
112
+ * @param string $houseNumberAddition
113
+ *
114
+ * @return string
115
+ */
116
+ public function lookupAddress($postcode, $houseNumber, $houseNumberAddition)
117
+ {
118
+ // Check if we are we enabled, configured & capable of handling an API request
119
+ $message = $this->_checkApiReady('Address');
120
+ if ($message)
121
+ return $message;
122
+
123
+ $response = array();
124
 
125
  // Some basic user data 'fixing', remove any not-letter, not-number characters
126
  $postcode = preg_replace('~[^a-z0-9]~i', '', $postcode);
128
  // Basic postcode format checking
129
  if (!preg_match('~^[0-9]{4}[a-z]{2}$~i', $postcode))
130
  {
131
+ $response['message'] = $this->__('Invalid postcode format, use `1234AB` format.');
132
+ $response['messageTarget'] = 'postcode';
133
+ return $response;
 
134
  }
135
 
136
+ $url = $this->_getServiceUrl() . '/rest/addresses/' . rawurlencode($postcode). '/'. rawurlencode($houseNumber) . '/'. rawurlencode($houseNumberAddition);
137
 
138
+ $jsonData = $this->_callApiUrlGet($url);
 
 
 
 
 
 
 
 
 
139
 
140
+ $serviceShowcase = $this->_getStoreConfig('postcodenl_api/development_config/api_showcase');
141
+ $serviceDebug = $this->isDebugging();
142
 
 
143
  if ($serviceShowcase)
144
+ $response['showcaseResponse'] = $jsonData;
145
 
146
  if ($serviceDebug)
147
  {
148
+ $response['debugInfo'] = array(
 
 
 
 
 
 
 
 
 
 
 
 
 
149
  'requestUrl' => $url,
150
+ 'rawResponse' => $this->_httpResponseRaw,
151
+ 'parsedResponse' => $jsonData,
152
+ 'httpClientError' => $this->_httpClientError,
153
  'configuration' => array(
154
+ 'url' => $this->_getServiceUrl(),
155
+ 'key' => $this->_getKey(),
156
+ 'secret' => substr($this->_getSecret(), 0, 6) .'[hidden]',
157
  'showcase' => $serviceShowcase,
158
  'debug' => $serviceDebug,
159
  ),
160
  'magentoVersion' => $this->_getMagentoVersion(),
161
+ 'extensionVersion' => $this->_getExtensionVersion(),
162
+ 'modules' => $this->_getMagentoModules(),
163
  );
164
  }
165
 
166
+ if ($this->_httpResponseCode == 200 && is_array($jsonData) && isset($jsonData['postcode']))
167
+ {
168
+ $response = array_merge($response, $jsonData);
169
+ }
170
+ else if (is_array($jsonData) && isset($jsonData['exceptionId']))
171
  {
172
+ if ($this->_httpResponseCode == 400 || $this->_httpResponseCode == 404)
173
  {
174
+ switch ($jsonData['exceptionId'])
175
+ {
176
+ case 'PostcodeNl_Controller_Address_PostcodeTooShortException':
177
+ case 'PostcodeNl_Controller_Address_PostcodeTooLongException':
178
+ case 'PostcodeNl_Controller_Address_NoPostcodeSpecifiedException':
179
+ case 'PostcodeNl_Controller_Address_InvalidPostcodeException':
180
+ $response['message'] = $this->__('Invalid postcode format, use `1234AB` format.');
181
+ $response['messageTarget'] = 'postcode';
182
+ break;
183
+ case 'PostcodeNl_Service_PostcodeAddress_AddressNotFoundException':
184
+ $response['message'] = $this->__('Unknown postcode + housenumber combination.');
185
+ $response['messageTarget'] = 'housenumber';
186
+ break;
187
+ case 'PostcodeNl_Controller_Address_InvalidHouseNumberException':
188
+ case 'PostcodeNl_Controller_Address_NoHouseNumberSpecifiedException':
189
+ case 'PostcodeNl_Controller_Address_NegativeHouseNumberException':
190
+ case 'PostcodeNl_Controller_Address_HouseNumberTooLargeException':
191
+ case 'PostcodeNl_Controller_Address_HouseNumberIsNotAnIntegerException':
192
+ $response['message'] = $this->__('Housenumber format is not valid.');
193
+ $response['messageTarget'] = 'housenumber';
194
+ break;
195
+ default:
196
+ $response['message'] = $this->__('Incorrect address.');
197
+ $response['messageTarget'] = 'housenumber';
198
+ break;
199
+ }
200
+ }
201
+ else if (is_array($jsonData) && isset($jsonData['exceptionId']))
202
+ {
203
+ $response['message'] = $this->__('Validation error, please use manual input.');
204
+ $response['messageTarget'] = 'housenumber';
205
+ $response['useManual'] = true;
206
  }
207
  }
208
+ else
209
+ {
210
+ $response['message'] = $this->__('Validation unavailable, please use manual input.');
211
+ $response['messageTarget'] = 'housenumber';
212
+ $response['useManual'] = true;
213
+ }
214
+
215
+ return $response;
216
+ }
217
+
218
+ /**
219
+ * Set the enrichType number, or text/class description if not in known enrichType list
220
+ *
221
+ * @param mixed $enrichType
222
+ */
223
+ public function setEnrichType($enrichType)
224
+ {
225
+ $this->_enrichType = preg_replace('~[^0-9a-z\-_,]~i', '', $enrichType);
226
+ if (strlen($this->_enrichType) > 40)
227
+ $this->_enrichType = substr($this->_enrichType, 0, 40);
228
+ }
229
+
230
+ /**
231
+ * Perform a Signal API check.
232
+ *
233
+ * @param array $signalCheck
234
+ *
235
+ * @return array Signal result
236
+ */
237
+ public function checkSignal($signalCheck)
238
+ {
239
+ // Check if we are we enabled, configured & capable of handling an API request
240
+ $message = $this->_checkApiReady('Signal');
241
+ if ($message)
242
+ return $message;
243
+
244
+ $response = array();
245
+
246
+ $url = $this->_getServiceUrl() . '/rest/signal/check';
247
+
248
+ $jsonData = $this->_callApiUrlPostJson($url, $signalCheck);
249
+
250
+ if ($this->_httpResponseCodeClass == 200 && is_array($jsonData))
251
+ {
252
+ $response = $jsonData;
253
+ }
254
+ else if (is_array($jsonData) && isset($jsonData['exceptionId']))
255
  {
256
+ if ($this->_httpResponseCode == 401 || $this->_httpResponseCode == 403)
257
+ $response['message'] = $this->__('Invalid Signal API authentication:') .' (`'. $this->_httpResponseCode .'`): ' . $jsonData['exception'];
258
+ else if ($this->_httpResponseCodeClass == 400)
259
+ $response['message'] = $this->__('Invalid Signal API input:') .' (`'. $this->_httpResponseCode .'`): ' . $jsonData['exception'];
260
+ else
261
+ $response['message'] = $this->__('Signal API error:') .' (`'. $this->_httpResponseCode .'`): '. $jsonData['exception'];
262
  }
263
  else
264
  {
265
+ $response['message'] = $this->__('Signal API response not understood, service unavailable.') . 'HTTP status code: `'. $this->_httpResponseCode .'`';
266
+ }
267
+ return $response;
268
+ }
269
+
270
+ /**
271
+ * Split a housenumber addition from a housenumber.
272
+ * Examples: "123 2", "123 rood", "123a", "123a4", "123-a", "123 II"
273
+ * (the official notation is to separate the housenumber and addition with a single space)
274
+ *
275
+ * @param string $houseNumber Housenumber input
276
+ *
277
+ * @return array Split 'houseNumber' and 'houseNumberAddition'
278
+ */
279
+ public function splitHouseNumber($houseNumber)
280
+ {
281
+ $houseNumberAddition = '';
282
+ if (preg_match('~^(?<number>[0-9]+)(?:[^0-9a-zA-Z]+(?<addition1>[0-9a-zA-Z ]+)|(?<addition2>[a-zA-Z](?:[0-9a-zA-Z ]*)))?$~', $houseNumber, $match))
283
+ {
284
+ $houseNumber = $match['number'];
285
+ $houseNumberAddition = isset($match['addition2']) ? $match['addition2'] : (isset($match['addition1']) ? $match['addition1'] : '');
286
+ }
287
+
288
+ return array($houseNumber, $houseNumberAddition);
289
+ }
290
+
291
+ /**
292
+ * Split a streename, housenumber and housenumber addition from a text lines containing a street and housenumber information.
293
+ *
294
+ * @param array $streetData Lines of steet data
295
+ *
296
+ * @return array Array containing 'street', 'houseNumber' and 'houseNumberAddition'
297
+ */
298
+ public function splitStreetData($streetData)
299
+ {
300
+ $regexpStreet = '[^0-9].*?|.*?[^0-9]';
301
+ $regexpHouseNumber = '[0-9]+';
302
+ $regexpHouseNumberAddition = '[^\\s]+|[^\\s]\\s+[^\\s]{1,4}';
303
+
304
+ if (preg_match('~^(?<street>'. $regexpStreet .')\s+(?<houseNumber>'. $regexpHouseNumber .')([^0-9a-zA-Z]*(?<houseNumberAddition>'. $regexpHouseNumberAddition .'))?\s*$~', $streetData[0], $match))
305
+ {
306
+ // Found housenumber contained in first street line
307
+ return array(
308
+ 'street' => $match['street'],
309
+ 'houseNumber' => $match['houseNumber'],
310
+ 'houseNumberAddition' => $match['houseNumberAddition'],
311
+ );
312
+ }
313
+ else if (isset($streetData[1]))
314
+ {
315
+ // Find housenumber contained in second street line
316
+
317
+ $houseNumberData = $this->splitHouseNumber($streetData[1]);
318
+
319
+ return array(
320
+ 'street' => $streetData[0],
321
+ 'houseNumber' => $houseNumberData[0],
322
+ 'houseNumberAddition' => $houseNumberData[1],
323
+ );
324
+ }
325
+ else
326
+ {
327
+ return array(
328
+ 'street' => $streetData[0],
329
+ 'houseNumber' => null,
330
+ 'houseNumberAddition' => null,
331
+ );
332
+ }
333
+ }
334
+
335
+ /**
336
+ * Do a Postcode.nl Signal API check on a (newly created) Magento order.
337
+ * (called by hook class PostcodeNl_Api_Model_Observer)
338
+ * Will pass any information that can be used by the MijnPolitie.nl MIO Fraud Warning system
339
+ * (email, phonenumber), or Postcode.nl address validation (billing and delivery address).
340
+ * Also includes the order number, to be able to reference the Signal Check later.
341
+ *
342
+ * @param Mage_Sales_Model_Order $order
343
+ *
344
+ * @return array Signal data, or error with 'message' entry.
345
+ */
346
+ public function checkOrderViaSignal($order)
347
+ {
348
+ // Check if we are we are enabled, configured & capable of handling an API request
349
+ $message = $this->_checkApiReady('Signal');
350
+ if ($message)
351
+ return $message;
352
+
353
+ // Housenumber data is often contained within the 'street' lines of the address.
354
+ $billingStreetData = $this->splitStreetData($order->getBillingAddress()->getStreet());
355
+ $shippingStreetData = $this->splitStreetData($order->getShippingAddress()->getStreet());
356
+
357
+ // No customer might be available if this is an order status change
358
+ $hasCustomer = ($order->getCustomer() !== null);
359
+
360
+ // Only send phonenumber if it is at least 5 characters long
361
+ $phoneNumber = Mage::helper('core/string')->strlen($order->getBillingAddress()->getTelephone()) >= 5 ? $order->getBillingAddress()->getTelephone() : null;
362
+
363
+ $signalCheck = array(
364
+ 'customer' => array(
365
+ 'email' => $hasCustomer ? $order->getCustomer()->getEmail() : null,
366
+ 'phoneNumber' => $phoneNumber,
367
+ 'address' => array(
368
+ 'postcode' => $order->getBillingAddress()->getPostcode(),
369
+ 'houseNumber' => $billingStreetData['houseNumber'],
370
+ 'houseNumberAddition' => $billingStreetData['houseNumberAddition'],
371
+ 'street' => $billingStreetData['street'],
372
+ 'city' => $order->getBillingAddress()->getCity(),
373
+ 'region' => $order->getBillingAddress()->getRegion(),
374
+ 'country' => $order->getBillingAddress()->getCountryId(),
375
+ ),
376
+ ),
377
+ 'transaction' => array(
378
+ 'internalId' => $order->getIncrementId(),
379
+ 'deliveryAddress' => array(
380
+ 'postcode' => $order->getShippingAddress()->getPostcode(),
381
+ 'houseNumber' => $shippingStreetData['houseNumber'],
382
+ 'houseNumberAddition' => $shippingStreetData['houseNumberAddition'],
383
+ 'street' => $shippingStreetData['street'],
384
+ 'city' => $order->getShippingAddress()->getCity(),
385
+ 'region' => $order->getShippingAddress()->getRegion(),
386
+ 'country' => $order->getShippingAddress()->getCountryId(),
387
+ ),
388
+ ),
389
+ );
390
+
391
+ return $this->checkSignal($signalCheck);
392
+ }
393
+
394
+ protected function _getStoreConfig($path)
395
+ {
396
+ return Mage::getStoreConfig($path);
397
+ }
398
+
399
+ protected function _getKey()
400
+ {
401
+ return trim($this->_getStoreConfig('postcodenl_api/config/api_key'));
402
+ }
403
+
404
+ protected function _getSecret()
405
+ {
406
+ return trim($this->_getStoreConfig('postcodenl_api/config/api_secret'));
407
+ }
408
+
409
+ protected function _getServiceUrl()
410
+ {
411
+ $serviceUrl = trim($this->_getStoreConfig('postcodenl_api/development_config/api_url'));
412
+ if (empty($serviceUrl))
413
+ $serviceUrl = self::API_URL;
414
+
415
+ return $serviceUrl;
416
+ }
417
+
418
+ protected function _getMagentoVersion()
419
+ {
420
+ if ($this->_getModuleInfo('Enterprise_CatalogPermissions') !== null)
421
+ {
422
+ // Detect enterprise
423
+ return 'MagentoEnterprise/'. Mage::getVersion();
424
+ }
425
+ elseif ($this->_getModuleInfo('Enterprise_Enterprise') !== null)
426
+ {
427
+ // Detect professional
428
+ return 'MagentoProfessional/'. Mage::getVersion();
429
+ }
430
+ else
431
+ {
432
+ // Rest
433
+ return 'Magento/'. Mage::getVersion();
434
+ }
435
+ }
436
+
437
+ protected function _getModuleInfo($moduleName)
438
+ {
439
+ $modules = $this->_getMagentoModules();
440
+
441
+ if (!isset($modules[$moduleName]))
442
+ return null;
443
+
444
+ return $modules[$moduleName];
445
+ }
446
+
447
+ protected function _getConfigBoolString($configKey)
448
+ {
449
+ if ($this->_getStoreConfig($configKey))
450
+ return 'true';
451
+
452
+ return 'false';
453
+ }
454
+
455
+ protected function _getMagentoLookupUrl($inAdmin = false)
456
+ {
457
+ if ($inAdmin)
458
+ return Mage::helper('adminhtml')->getUrl('*/pcnl/lookup', array('_secure' => true));
459
+ else
460
+ return Mage::getUrl('postcodenl_api/json', array('_secure' => true));
461
+ }
462
+
463
+ protected function _curlHasSsl()
464
+ {
465
+ $curlVersion = curl_version();
466
+ return $curlVersion['features'] & CURL_VERSION_SSL;
467
+ }
468
+
469
+ protected function _checkApiReady($service = null)
470
+ {
471
+ if (!$this->_getStoreConfig('postcodenl_api/config/enabled'))
472
+ return array('message' => $this->__('Postcode.nl API not enabled.'));;
473
+
474
+ if ($this->_getServiceUrl() === '' || $this->_getKey() === '' || $this->_getSecret() === '')
475
+ return array('message' => $this->__('Postcode.nl API not configured.'));
476
+
477
+ if ($service === 'Address' && !$this->_getStoreConfig('postcodenl_api/config/enabled_address_api'))
478
+ return array('message' => $this->__('Postcode.nl Address API not enabled.'));;
479
+
480
+ if ($service === 'Signal' && !$this->_getStoreConfig('postcodenl_api/config/enabled_signal_api'))
481
+ return array('message' => $this->__('Postcode.nl Signal API not enabled.'));;
482
+
483
+ return $this->_checkCapabilities();
484
+ }
485
+
486
+ protected function _checkCapabilities()
487
+ {
488
+ // Check for SSL support in CURL
489
+ if (!$this->_curlHasSsl())
490
+ return array('message' => $this->__('Cannot connect to Postcode.nl API: Server is missing SSL (https) support for CURL.'));
491
+
492
+ return false;
493
+ }
494
+
495
+ protected function _checkAddressApiReady()
496
+ {
497
+ if (!$this->_getStoreConfig('postcodenl_api/config/enabled_address_api'))
498
+ return array('message' => $this->__('Postcode.nl Address API not enabled.'));;
499
+ }
500
+
501
+ protected function _callApiUrlGet($url)
502
+ {
503
+ $ch = curl_init();
504
+ curl_setopt($ch, CURLOPT_URL, $url);
505
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
506
+ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, self::API_TIMEOUT);
507
+ curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
508
+ curl_setopt($ch, CURLOPT_USERPWD, $this->_getKey() .':'. $this->_getSecret());
509
+ curl_setopt($ch, CURLOPT_USERAGENT, $this->_getUserAgent());
510
+ $this->_httpResponseRaw = curl_exec($ch);
511
+ $this->_httpResponseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
512
+ $this->_httpResponseCodeClass = (int)floor($this->_httpResponseCode / 100) * 100;
513
+ $this->_httpClientError = curl_error($ch);
514
+
515
+ curl_close($ch);
516
+
517
+ return json_decode($this->_httpResponseRaw, true);
518
+ }
519
+
520
+ protected function _callApiUrlPostJson($url, $data)
521
+ {
522
+ $ch = curl_init();
523
+ curl_setopt($ch, CURLOPT_URL, $url);
524
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
525
+ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, self::API_TIMEOUT);
526
+ curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
527
+ curl_setopt($ch, CURLOPT_USERPWD, $this->_getKey() .':'. $this->_getSecret());
528
+ curl_setopt($ch, CURLOPT_USERAGENT, $this->_getUserAgent());
529
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
530
+ curl_setopt($ch, CURLOPT_POST, true);
531
+ curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
532
+ $this->_httpResponseRaw = curl_exec($ch);
533
+ $this->_httpResponseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
534
+ $this->_httpResponseCodeClass = (int)floor($this->_httpResponseCode / 100) * 100;
535
+ $this->_httpClientError = curl_error($ch);
536
+ curl_close($ch);
537
+
538
+ return json_decode($this->_httpResponseRaw, true);
539
+ }
540
+
541
+ protected function _getExtensionVersion()
542
+ {
543
+ $extensionInfo = $this->_getModuleInfo('PostcodeNl_Api');
544
+ return $extensionInfo ? (string)$extensionInfo['version'] : 'unknown';
545
+ }
546
+
547
+ protected function _getUserAgent()
548
+ {
549
+ return 'PostcodeNl_Api_MagentoPlugin/' . $this->_getExtensionVersion() .' '. $this->_getMagentoVersion() .' PHP/'. phpversion() .' EnrichType/'. $this->_enrichType;
550
+ }
551
+
552
+ protected function _getMagentoModules()
553
+ {
554
+ if ($this->_modules !== null)
555
+ return $this->_modules;
556
+
557
+ $this->_modules = array();
558
+ foreach (Mage::getConfig()->getNode('modules')->children() as $name => $module)
559
+ {
560
+ $this->_modules[$name] = array();
561
+ foreach ($module as $key => $value)
562
+ {
563
+ if (in_array((string)$key, array('active')))
564
+ $this->_modules[$name][$key] = (string)$value == 'true' ? true : false;
565
+ else if (in_array((string)$key, array('codePool', 'version')))
566
+ $this->_modules[$name][$key] = (string)$value;
567
+ }
568
  }
569
+ return $this->_modules;
570
  }
571
  }
app/code/community/PostcodeNl/Api/Model/Observer.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class PostcodeNl_Api_Model_Observer
3
+ {
4
+ /**
5
+ * Event Hook: checkout_submit_all_after
6
+ * @param Varien_Event_Observer $observer
7
+ */
8
+ public function signalObserveOrderCreation(Varien_Event_Observer $observer)
9
+ {
10
+ $helper = Mage::helper('postcodenl_api');
11
+
12
+ if (!$helper->isApiEnabled('Signal'))
13
+ return;
14
+
15
+ $order = $observer->getEvent()->getOrder();
16
+
17
+ $result = $helper->checkOrderViaSignal($order);
18
+
19
+ // Can't return errors/messages in hook, so log errors.
20
+ if (isset($result['message']))
21
+ {
22
+ Mage::log('Order #'. $order->getIncrementId() .' signalObserveOrderCreation failed: '. $result['message'], Zend_Log::ERR, 'postcodenl-signal.log', true);
23
+ }
24
+ else if ($helper->isDebugging())
25
+ {
26
+ Mage::log('Order #'. $order->getIncrementId() .' signalObserveOrderCreation called. '. $result['warningCount'] .' Signal warnings, report: '. $result['reportPdfUrl'], Zend_Log::DEBUG, 'postcodenl-signal.log', true);
27
+ }
28
+ }
29
+ }
app/code/community/PostcodeNl/Api/etc/config.xml CHANGED
@@ -61,6 +61,17 @@
61
  </setup>
62
  </postcodenl_api_setup>
63
  </resources>
 
 
 
 
 
 
 
 
 
 
 
64
  </global>
65
  <adminhtml>
66
  <layout>
@@ -86,9 +97,12 @@
86
  <enabled>1</enabled>
87
  <api_key></api_key>
88
  <api_secret></api_secret>
 
 
89
  </config>
90
  <advanced_config>
91
  <use_street2_as_housenumber>0</use_street2_as_housenumber>
 
92
  <block_postofficeboxaddresses>0</block_postofficeboxaddresses>
93
  <never_hide_country>0</never_hide_country>
94
  <admin_validation_disabled>0</admin_validation_disabled>
61
  </setup>
62
  </postcodenl_api_setup>
63
  </resources>
64
+ <events>
65
+ <checkout_submit_all_after>
66
+ <observers>
67
+ <postcodenl_signal_order_creation>
68
+ <type>singleton</type>
69
+ <class>PostcodeNl_Api_Model_Observer</class>
70
+ <method>signalObserveOrderCreation</method>
71
+ </postcodenl_signal_order_creation>
72
+ </observers>
73
+ </checkout_submit_all_after>
74
+ </events>
75
  </global>
76
  <adminhtml>
77
  <layout>
97
  <enabled>1</enabled>
98
  <api_key></api_key>
99
  <api_secret></api_secret>
100
+ <enabled_address_api>1</enabled_address_api>
101
+ <enabled_signal_api>0</enabled_signal_api>
102
  </config>
103
  <advanced_config>
104
  <use_street2_as_housenumber>0</use_street2_as_housenumber>
105
+ <use_street3_as_housenumber_addition>0</use_street3_as_housenumber_addition>
106
  <block_postofficeboxaddresses>0</block_postofficeboxaddresses>
107
  <never_hide_country>0</never_hide_country>
108
  <admin_validation_disabled>0</admin_validation_disabled>
app/code/community/PostcodeNl/Api/etc/system.xml CHANGED
@@ -47,13 +47,39 @@
47
  <validate>validate-length minimum-length-10</validate>
48
  <comment>
49
  <![CDATA[
50
- To get your Postcode.nl API key and secret, please register at <a href="https://api.postcode.nl">Postcode.nl API</a>.
51
  ]]></comment>
52
  </api_secret>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  </fields>
54
  </config>
55
  <advanced_config translate="label">
56
- <label>Advanced configuration</label>
57
  <frontend_type>text</frontend_type>
58
  <sort_order>20</sort_order>
59
  <show_in_default>1</show_in_default>
@@ -74,11 +100,24 @@
74
  If you use the second 'street' field as a separate house-number field, enable this option.
75
  ]]></comment>
76
  </use_street2_as_housenumber>
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  <block_postofficeboxaddresses translate="label">
78
  <label>Block post office box addresses</label>
79
  <frontend_type>select</frontend_type>
80
  <source_model>adminhtml/system_config_source_yesno</source_model>
81
- <sort_order>20</sort_order>
82
  <show_in_default>1</show_in_default>
83
  <show_in_website>1</show_in_website>
84
  <show_in_store>1</show_in_store>
@@ -92,7 +131,7 @@
92
  <label>Always show country selector</label>
93
  <frontend_type>select</frontend_type>
94
  <source_model>adminhtml/system_config_source_yesno</source_model>
95
- <sort_order>30</sort_order>
96
  <show_in_default>1</show_in_default>
97
  <show_in_website>1</show_in_website>
98
  <show_in_store>1</show_in_store>
@@ -106,7 +145,7 @@
106
  <label>Disable validation in admin</label>
107
  <frontend_type>select</frontend_type>
108
  <source_model>adminhtml/system_config_source_yesno</source_model>
109
- <sort_order>40</sort_order>
110
  <show_in_default>1</show_in_default>
111
  <show_in_website>1</show_in_website>
112
  <show_in_store>1</show_in_store>
@@ -117,10 +156,20 @@
117
  </admin_validation_disabled>
118
  </fields>
119
  </advanced_config>
 
 
 
 
 
 
 
 
 
 
120
  <development_config translate="label">
121
  <label>Development configuration</label>
122
  <frontend_type>text</frontend_type>
123
- <sort_order>30</sort_order>
124
  <show_in_default>1</show_in_default>
125
  <show_in_website>1</show_in_website>
126
  <show_in_store>1</show_in_store>
@@ -158,7 +207,7 @@
158
  <show_in_store>1</show_in_store>
159
  <comment>
160
  <![CDATA[
161
- Additional debug information used for trouble-shooting will be sent by the Postcode.nl API extension.<br />
162
  <em>(this is not recommended in production environments!)</em>
163
  ]]></comment>
164
  </api_debug>
47
  <validate>validate-length minimum-length-10</validate>
48
  <comment>
49
  <![CDATA[
50
+ To get your Postcode.nl API key and secret, please register at <a href="https://api.postcode.nl" target="_blank">Postcode.nl API</a>.
51
  ]]></comment>
52
  </api_secret>
53
+ <enabled_address_api translate="label">
54
+ <label>Address API Enabled?</label>
55
+ <frontend_type>select</frontend_type>
56
+ <source_model>adminhtml/system_config_source_yesno</source_model>
57
+ <sort_order>50</sort_order>
58
+ <show_in_default>1</show_in_default>
59
+ <show_in_website>1</show_in_website>
60
+ <show_in_store>1</show_in_store>
61
+ <comment>
62
+ <![CDATA[
63
+ Dutch address validation via <a href="https://api.postcode.nl/documentation/address-api-description" target="_blank">Postcode.nl Address API</a> is available by default when you create an account.
64
+ ]]></comment>
65
+ </enabled_address_api>
66
+ <enabled_signal_api translate="label">
67
+ <label>Signal API Enabled?</label>
68
+ <frontend_type>select</frontend_type>
69
+ <source_model>adminhtml/system_config_source_yesno</source_model>
70
+ <sort_order>60</sort_order>
71
+ <show_in_default>1</show_in_default>
72
+ <show_in_website>1</show_in_website>
73
+ <show_in_store>1</show_in_store>
74
+ <comment>
75
+ <![CDATA[
76
+ To use the <a href="https://api.postcode.nl/documentation/signal-api-description" target="_blank">Postcode.nl Signal API</a>, sign up for the service during registration, or at your <a href="https://api.postcode.nl">Postcode.nl API dashboard</a>. Then, enable this option.
77
+ ]]></comment>
78
+ </enabled_signal_api>
79
  </fields>
80
  </config>
81
  <advanced_config translate="label">
82
+ <label>Advanced Address API configuration</label>
83
  <frontend_type>text</frontend_type>
84
  <sort_order>20</sort_order>
85
  <show_in_default>1</show_in_default>
100
  If you use the second 'street' field as a separate house-number field, enable this option.
101
  ]]></comment>
102
  </use_street2_as_housenumber>
103
+ <use_street3_as_housenumber_addition translate="label">
104
+ <label>Separate housenumber addition</label>
105
+ <frontend_type>select</frontend_type>
106
+ <source_model>adminhtml/system_config_source_yesno</source_model>
107
+ <sort_order>20</sort_order>
108
+ <show_in_default>1</show_in_default>
109
+ <show_in_website>1</show_in_website>
110
+ <show_in_store>1</show_in_store>
111
+ <comment>
112
+ <![CDATA[
113
+ If you use the third 'street' field as a separate house-number addition field, enable this option. (requires 'Separate housenumber' option to be enabled too)
114
+ ]]></comment>
115
+ </use_street3_as_housenumber_addition>
116
  <block_postofficeboxaddresses translate="label">
117
  <label>Block post office box addresses</label>
118
  <frontend_type>select</frontend_type>
119
  <source_model>adminhtml/system_config_source_yesno</source_model>
120
+ <sort_order>30</sort_order>
121
  <show_in_default>1</show_in_default>
122
  <show_in_website>1</show_in_website>
123
  <show_in_store>1</show_in_store>
131
  <label>Always show country selector</label>
132
  <frontend_type>select</frontend_type>
133
  <source_model>adminhtml/system_config_source_yesno</source_model>
134
+ <sort_order>40</sort_order>
135
  <show_in_default>1</show_in_default>
136
  <show_in_website>1</show_in_website>
137
  <show_in_store>1</show_in_store>
145
  <label>Disable validation in admin</label>
146
  <frontend_type>select</frontend_type>
147
  <source_model>adminhtml/system_config_source_yesno</source_model>
148
+ <sort_order>50</sort_order>
149
  <show_in_default>1</show_in_default>
150
  <show_in_website>1</show_in_website>
151
  <show_in_store>1</show_in_store>
156
  </admin_validation_disabled>
157
  </fields>
158
  </advanced_config>
159
+ <advanced_config_signal translate="label">
160
+ <label>Advanced Signal API configuration</label>
161
+ <frontend_type>text</frontend_type>
162
+ <sort_order>30</sort_order>
163
+ <show_in_default>1</show_in_default>
164
+ <show_in_website>1</show_in_website>
165
+ <show_in_store>1</show_in_store>
166
+ <fields>
167
+ </fields>
168
+ </advanced_config_signal>
169
  <development_config translate="label">
170
  <label>Development configuration</label>
171
  <frontend_type>text</frontend_type>
172
+ <sort_order>40</sort_order>
173
  <show_in_default>1</show_in_default>
174
  <show_in_website>1</show_in_website>
175
  <show_in_store>1</show_in_store>
207
  <show_in_store>1</show_in_store>
208
  <comment>
209
  <![CDATA[
210
+ Additional debug information used for trouble-shooting will be sent by the Postcode.nl API extension. Signal API will log to 'var/log/postcodenl-signal.log'.<br />
211
  <em>(this is not recommended in production environments!)</em>
212
  ]]></comment>
213
  </api_debug>
app/design/frontend/default/default/layout/postcodenl/api/lookup.xml DELETED
@@ -1,169 +0,0 @@
1
- <?xml version="1.0"?>
2
- <layout version="0.1.0">
3
- <!-- Regular Magento Checkout, and other checkout modules which use the same page -->
4
- <!-- Also for: `J2T OneCheckout`, `Magento Templates - OnePage Magento Checkout`, `EcommerceTeam Easy Checkout 2`, `Quick One Page Checkout` -->
5
- <checkout_onepage_index>
6
- <reference name="head">
7
- <action method="addCss" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/css/lookup.css</script></action>
8
- <action method="addJs" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/lookup.js</script></action>
9
- </reference>
10
- <reference name="content">
11
- <block type="postcodenl_api/jsinit" name="postcodenl.jsinit" template="postcodenl/api/jsinit.phtml" />
12
- </reference>
13
- </checkout_onepage_index>
14
- <customer_address_form>
15
- <reference name="head">
16
- <action method="addCss" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/css/lookup.css</script></action>
17
- <action method="addJs" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/lookup.js</script></action>
18
- </reference>
19
- <reference name="content">
20
- <block type="postcodenl_api/jsinit" name="postcodenl.jsinit" template="postcodenl/api/jsinit.phtml" />
21
- </reference>
22
- </customer_address_form>
23
- <checkout_multishipping_register>
24
- <reference name="head">
25
- <action method="addCss" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/css/lookup.css</script></action>
26
- <action method="addJs" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/lookup.js</script></action>
27
- </reference>
28
- <reference name="content">
29
- <block type="postcodenl_api/jsinit" name="postcodenl.jsinit" template="postcodenl/api/jsinit.phtml" />
30
- </reference>
31
- </checkout_multishipping_register>
32
- <checkout_multishipping_address_newshipping>
33
- <reference name="head">
34
- <action method="addCss" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/css/lookup.css</script></action>
35
- <action method="addJs" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/lookup.js</script></action>
36
- </reference>
37
- <reference name="content">
38
- <block type="postcodenl_api/jsinit" name="postcodenl.jsinit" template="postcodenl/api/jsinit.phtml" />
39
- </reference>
40
- </checkout_multishipping_address_newshipping>
41
- <checkout_multishipping_address_editshipping>
42
- <reference name="head">
43
- <action method="addCss" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/css/lookup.css</script></action>
44
- <action method="addJs" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/lookup.js</script></action>
45
- </reference>
46
- <reference name="content">
47
- <block type="postcodenl_api/jsinit" name="postcodenl.jsinit" template="postcodenl/api/jsinit.phtml" />
48
- </reference>
49
- </checkout_multishipping_address_editshipping>
50
- <checkout_multishipping_address_editbilling>
51
- <reference name="head">
52
- <action method="addCss" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/css/lookup.css</script></action>
53
- <action method="addJs" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/lookup.js</script></action>
54
- </reference>
55
- <reference name="content">
56
- <block type="postcodenl_api/jsinit" name="postcodenl.jsinit" template="postcodenl/api/jsinit.phtml" />
57
- </reference>
58
- </checkout_multishipping_address_editbilling>
59
- <!-- Used for `OneStepCheckout(.com)`, but also for `MageStore One Step Checkout` and `Apptha One Step Checkout` -->
60
- <onestepcheckout_index_index>
61
- <reference name="head">
62
- <action method="addCss" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/css/lookup.css</script></action>
63
- <action method="addJs" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/lookup.js</script></action>
64
- </reference>
65
- <reference name="content">
66
- <block type="postcodenl_api/jsinit" name="postcodenl.jsinit" template="postcodenl/api/jsinit.phtml" />
67
- </reference>
68
- </onestepcheckout_index_index>
69
- <!-- Used for older versions of `MageStore One Step Checkout` -->
70
- <onestepquickcheckout_index_index>
71
- <reference name="head">
72
- <action method="addCss" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/css/lookup.css</script></action>
73
- <action method="addJs" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/lookup.js</script></action>
74
- </reference>
75
- <reference name="content">
76
- <block type="postcodenl_api/jsinit" name="postcodenl.jsinit" template="postcodenl/api/jsinit.phtml" />
77
- </reference>
78
- </onestepquickcheckout_index_index>
79
- <!-- For `GoMage LightCheckout` -->
80
- <gomage_checkout_onepage_index>
81
- <reference name="head">
82
- <action method="addCss" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/css/lookup.css</script></action>
83
- <action method="addJs" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/lookup.js</script></action>
84
- </reference>
85
- <reference name="content">
86
- <block type="postcodenl_api/jsinit" name="postcodenl.jsinit" template="postcodenl/api/jsinit.phtml" />
87
- </reference>
88
- </gomage_checkout_onepage_index>
89
- <!-- For `Fire Checkout` 1.5 -->
90
- <firecheckout_index_index>
91
- <reference name="head">
92
- <action method="addCss" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/css/lookup.css</script></action>
93
- <action method="addJs" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/lookup.js</script></action>
94
- </reference>
95
- <reference name="content">
96
- <block type="postcodenl_api/jsinit" name="postcodenl.jsinit" template="postcodenl/api/jsinit.phtml" />
97
- </reference>
98
- </firecheckout_index_index>
99
- <!-- For `Fire Checkout` 2.0 -->
100
- <firecheckout_onepage_index>
101
- <reference name="head">
102
- <action method="addCss" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/css/lookup.css</script></action>
103
- <action method="addJs" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/lookup.js</script></action>
104
- </reference>
105
- <reference name="content">
106
- <block type="postcodenl_api/jsinit" name="postcodenl.jsinit" template="postcodenl/api/jsinit.phtml" />
107
- </reference>
108
- </firecheckout_onepage_index>
109
- <!-- For `FME One Step Checkout`, `MageWorld One Step Checkout Pro`, `GrafischDirect One Step Checkout` -->
110
- <checkout_onestep_index>
111
- <reference name="head">
112
- <action method="addCss" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/css/lookup.css</script></action>
113
- <action method="addJs" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/lookup.js</script></action>
114
- </reference>
115
- <reference name="content">
116
- <block type="postcodenl_api/jsinit" name="postcodenl.jsinit" template="postcodenl/api/jsinit.phtml" />
117
- </reference>
118
- </checkout_onestep_index>
119
- <!-- For `IWD Free One Page / Step Checkout` -->
120
- <onepagecheckout_index_index>
121
- <reference name="head">
122
- <action method="addCss" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/css/lookup.css</script></action>
123
- <action method="addJs" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/lookup.js</script></action>
124
- </reference>
125
- <reference name="content">
126
- <block type="postcodenl_api/jsinit" name="postcodenl.jsinit" template="postcodenl/api/jsinit.phtml" />
127
- </reference>
128
- </onepagecheckout_index_index>
129
- <!-- For `IWD Free One Page / Step Checkout v3+` -->
130
- <opc_index_index>
131
- <reference name="head">
132
- <action method="addCss" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/css/lookup.css</script></action>
133
- <action method="addJs" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/lookup.js</script></action>
134
- </reference>
135
- <reference name="content">
136
- <block type="postcodenl_api/jsinit" name="postcodenl.jsinit" template="postcodenl/api/jsinit.phtml" />
137
- </reference>
138
- </opc_index_index>
139
- <!-- For `AheadWorks One Step Checkout` -->
140
- <aw_onestepcheckout_index_index>
141
- <reference name="head">
142
- <action method="addCss" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/css/lookup.css</script></action>
143
- <action method="addJs" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/lookup.js</script></action>
144
- </reference>
145
- <reference name="content">
146
- <block type="postcodenl_api/jsinit" name="postcodenl.jsinit" template="postcodenl/api/jsinit.phtml" />
147
- </reference>
148
- </aw_onestepcheckout_index_index>
149
- <!-- For `Aitoc One Step Checkout Manager` -->
150
- <aitcheckout_checkout_index>
151
- <reference name="head">
152
- <action method="addCss" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/css/lookup.css</script></action>
153
- <action method="addJs" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/lookup.js</script></action>
154
- </reference>
155
- <reference name="content">
156
- <block type="postcodenl_api/jsinit" name="postcodenl.jsinit" template="postcodenl/api/jsinit.phtml" />
157
- </reference>
158
- </aitcheckout_checkout_index>
159
- <!-- For `MAGExtended Master Checkout` -->
160
- <mastercheckout_index_index>
161
- <reference name="head">
162
- <action method="addCss" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/css/lookup.css</script></action>
163
- <action method="addJs" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/lookup.js</script></action>
164
- </reference>
165
- <reference name="content">
166
- <block type="postcodenl_api/jsinit" name="postcodenl.jsinit" template="postcodenl/api/jsinit.phtml" />
167
- </reference>
168
- </mastercheckout_index_index>
169
- </layout>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/default/default/template/postcodenl/api/jsinit.phtml DELETED
@@ -1 +0,0 @@
1
- <?php echo Mage::helper('postcodenl_api/data')->getJsinit();
 
app/etc/modules/PostcodeNl_Api.xml DELETED
@@ -1,9 +0,0 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <PostcodeNl_Api>
5
- <active>true</active>
6
- <codePool>community</codePool>
7
- </PostcodeNl_Api>
8
- </modules>
9
- </config>
 
 
 
 
 
 
 
 
 
app/locale/en_US/PostcodeNl_Api.csv CHANGED
@@ -1,5 +1,6 @@
1
  "Unknown postcode + housenumber combination.","Unknown postcode + housenumber combination."
2
  "Housenumber format is not valid.","Housenumber format is not valid."
 
3
  "Housenumber addition `{addition}` is unknown.","Housenumber addition `{addition}` is unknown."
4
  "Housenumber addition required.","Housenumber addition required."
5
  "Invalid postcode format, use `1234AB` format.","Invalid postcode format, use `1234AB` format."
@@ -26,3 +27,9 @@
26
  "API Showcase","API Showcase"
27
  "API Debug Info","API Debug Info"
28
  "Post office box not allowed.","Post office box not allowed."
 
 
 
 
 
 
1
  "Unknown postcode + housenumber combination.","Unknown postcode + housenumber combination."
2
  "Housenumber format is not valid.","Housenumber format is not valid."
3
+ "Incorrect address.","Incorrect address."
4
  "Housenumber addition `{addition}` is unknown.","Housenumber addition `{addition}` is unknown."
5
  "Housenumber addition required.","Housenumber addition required."
6
  "Invalid postcode format, use `1234AB` format.","Invalid postcode format, use `1234AB` format."
27
  "API Showcase","API Showcase"
28
  "API Debug Info","API Debug Info"
29
  "Post office box not allowed.","Post office box not allowed."
30
+ "Postcode.nl Address API not enabled.","Postcode.nl Address API not enabled."
31
+ "Postcode.nl Signal API not enabled.","Postcode.nl Signal API not enabled."
32
+ "Invalid Signal API authentication:","Invalid Signal API authentication:"
33
+ "Invalid Signal API input:","Invalid Signal API input:"
34
+ "Signal API error:","Signal API error:"
35
+ "Signal API response not understood, service unavailable.","Signal API response not understood, service unavailable."
app/locale/nl_NL/PostcodeNl_Api.csv CHANGED
@@ -1,5 +1,6 @@
1
  "Unknown postcode + housenumber combination.","Onbekende postcode + huisnummer combinatie."
2
  "Housenumber format is not valid.","Onbekend huisnummer formaat."
 
3
  "Housenumber addition `{addition}` is unknown.","Huisnummer toevoeging `{addition}` is onbekend."
4
  "Housenumber addition required.","Huisnummer toevoeging vereist."
5
  "Invalid postcode format, use `1234AB` format.","Onbekend postcode formaat, gebruik het `1234AB` formaat."
@@ -26,3 +27,9 @@
26
  "API Showcase","API Showcase"
27
  "API Debug Info","API Debug Info"
28
  "Post office box not allowed.","Postbus niet toegestaan."
 
 
 
 
 
 
1
  "Unknown postcode + housenumber combination.","Onbekende postcode + huisnummer combinatie."
2
  "Housenumber format is not valid.","Onbekend huisnummer formaat."
3
+ "Incorrect address.","Onbekend adres."
4
  "Housenumber addition `{addition}` is unknown.","Huisnummer toevoeging `{addition}` is onbekend."
5
  "Housenumber addition required.","Huisnummer toevoeging vereist."
6
  "Invalid postcode format, use `1234AB` format.","Onbekend postcode formaat, gebruik het `1234AB` formaat."
27
  "API Showcase","API Showcase"
28
  "API Debug Info","API Debug Info"
29
  "Post office box not allowed.","Postbus niet toegestaan."
30
+ "Postcode.nl Address API not enabled.","Postcode.nl Address API niet ingeschakeld."
31
+ "Postcode.nl Signal API not enabled.","Postcode.nl Signal API niet ingeschakeld."
32
+ "Invalid Signal API authentication:","Signal API authenticatie foutmelding:"
33
+ "Invalid Signal API input:","Incorrecte Signal API invoer:"
34
+ "Signal API error:","Signal API foutmelding:"
35
+ "Signal API response not understood, service unavailable.","Signal API antwoord niet begrepen, dienst onbereikbaar."
js/postcodenl/api/lookup.js CHANGED
@@ -401,7 +401,15 @@ document.observe("dom:loaded", PCNL_START_FUNCTION = function()
401
  if (PCNLAPI_CONFIG.useStreet2AsHouseNumber && $(prefix + street2))
402
  {
403
  $(prefix + street1).setValue((data.street).trim());
404
- $(prefix + street2).setValue((data.houseNumber +' '+ (data.houseNumberAddition ? data.houseNumberAddition : housenumber_addition)).trim());
 
 
 
 
 
 
 
 
405
  }
406
  else
407
  {
@@ -970,11 +978,19 @@ document.observe("dom:loaded", PCNL_START_FUNCTION = function()
970
  var housenumber_addition = '';
971
  if (PCNLAPI_CONFIG.useStreet2AsHouseNumber && $(prefix + street2))
972
  {
973
- housenumber_match = $(prefix + street2).getValue().match('^('+ this.REGEXP_HOUSENUMBER +')([^0-9a-zA-Z]*('+ this.REGEXP_HOUSENUMBER_ADDITION +'))?\\s*$');
974
- if (housenumber_match)
975
  {
976
- housenumber = housenumber_match[1].trim();
977
- housenumber_addition = housenumber_match[3] === undefined ? '' : housenumber_match[3].trim();
 
 
 
 
 
 
 
 
 
978
  }
979
  }
980
  else
401
  if (PCNLAPI_CONFIG.useStreet2AsHouseNumber && $(prefix + street2))
402
  {
403
  $(prefix + street1).setValue((data.street).trim());
404
+ if (PCNLAPI_CONFIG.useStreet3AsHouseNumberAddition && $(prefix + street3))
405
+ {
406
+ $(prefix + street2).setValue(data.houseNumber);
407
+ $(prefix + street3).setValue((data.houseNumberAddition ? data.houseNumberAddition : housenumber_addition).trim());
408
+ }
409
+ else
410
+ {
411
+ $(prefix + street2).setValue((data.houseNumber +' '+ (data.houseNumberAddition ? data.houseNumberAddition : housenumber_addition)).trim());
412
+ }
413
  }
414
  else
415
  {
978
  var housenumber_addition = '';
979
  if (PCNLAPI_CONFIG.useStreet2AsHouseNumber && $(prefix + street2))
980
  {
981
+ if (PCNLAPI_CONFIG.useStreet3AsHouseNumberAddition && $(prefix + street3))
 
982
  {
983
+ housenumber = $(prefix + street2).getValue();
984
+ housenumber_addition = $(prefix + street3).getValue();
985
+ }
986
+ else
987
+ {
988
+ housenumber_match = $(prefix + street2).getValue().match('^('+ this.REGEXP_HOUSENUMBER +')([^0-9a-zA-Z]*('+ this.REGEXP_HOUSENUMBER_ADDITION +'))?\\s*$');
989
+ if (housenumber_match)
990
+ {
991
+ housenumber = housenumber_match[1].trim();
992
+ housenumber_addition = housenumber_match[3] === undefined ? '' : housenumber_match[3].trim();
993
+ }
994
  }
995
  }
996
  else
package.xml CHANGED
@@ -1,30 +1,31 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>PostcodeNl_Api</name>
4
- <version>1.1.2.1</version>
5
  <stability>stable</stability>
6
  <license>Simplified BSD License</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>Complement and validate Dutch addresses at Checkout with the free postcode Magento plugin from Postcode.nl.</summary>
10
  <description>Complement and validate Dutch addresses at Checkout with the free postcode Magento plugin from Postcode.nl.&#xD;
 
11
  &#xD;
12
  &#x2022; Reduce address errors&#xD;
13
  &#x2022; Reduce costs from undelivered mail and packages&#xD;
14
  &#x2022; Offer extra service for your customers with easy address entry&#xD;
15
  &#x2022; Improve sale conversion&#xD;
 
 
16
  &#xD;
17
  The postcode Magento plugin from Postcode.nl is free of charge, based on a Fair-Use policy. The use of the Postcode.nl Magento plugin is subject to our Terms and Conditions.</description>
18
- <notes>Fixes:&#xD;
19
- - Better support IWD One Step Checkout&#xD;
20
- - Better support for updates in admin&#xD;
21
- Features:&#xD;
22
- - Detection of checkout type, for better future checkout extension support&#xD;
23
  </notes>
24
  <authors><author><name>Postcode.nl Technical Support</name><user>TechPostcodeNl</user><email>tech@postcode.nl</email></author></authors>
25
- <date>2014-10-10</date>
26
- <time>08:46:21</time>
27
- <contents><target name="magecommunity"><dir name="PostcodeNl"><dir name="Api"><dir name="Block"><file name="Jsinit.php" hash="79bb826a50ce0cf4f87cc2f958bfafa1"/></dir><dir name="Helper"><file name="Data.php" hash="08fc025ba86655de3de7c69ad1d1c68d"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="PcnlController.php" hash="1a8eaf87ed60481f51f3f74eab3ab63f"/></dir><file name="JsonController.php" hash="6a3bff054e3229faaae2aa55f9a3cf3c"/></dir><dir name="data"><dir name="postcodenl_api_setup"><file name="data-upgrade-1.0.8.0-1.1.0.0.php" hash="e0acdb124cf735198c021f0c827c82bc"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="5d518aeaeae028b6299c7cf3d6e54f60"/><file name="config.xml" hash="2175234c6ee521c07a723566d5ff6538"/><file name="system.xml" hash="b92863ff806bd444125e4a829ecdc24c"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="postcodenl"><dir name="api"><file name="lookup.xml" hash="e8f6295a91c9c5bfd116ae1048a5445d"/></dir></dir></dir><dir name="template"><dir name="postcodenl"><dir name="api"><file name="jsinit.phtml" hash="8623676f4c6f4068d0b51e31dcfa08e9"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><dir name="postcodenl"><dir name="api"><file name="lookup.xml" hash="88c6556ea3cc3b3c6746021e8636a24c"/></dir></dir></dir><dir name="template"><dir name="postcodenl"><dir name="api"><file name="jsinit.phtml" hash="ff32e12bbc26e4414dd8ca76edc4ed0f"/></dir></dir></dir></dir></dir><dir name="base"><dir name="default"><dir name="layout"><dir name="postcodenl"><dir name="api"><file name="lookup.xml" hash="88c6556ea3cc3b3c6746021e8636a24c"/></dir></dir></dir><dir name="template"><dir name="postcodenl"><dir name="api"><file name="jsinit.phtml" hash="ff32e12bbc26e4414dd8ca76edc4ed0f"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="PostcodeNl_Api.csv" hash="0f85a94e876ec148734c556d9cf363a3"/></dir><dir name="nl_NL"><file name="PostcodeNl_Api.csv" hash="51fa45866ef7461769058d9c83d21766"/></dir></target><target name="mageweb"><dir name="js"><dir name="postcodenl"><dir name="api"><file name="lookup.js" hash="892ba29a3403c12f499ba109331bd52d"/></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="postcodenl"><dir name="api"><dir name="css"><file name="lookup.css" hash="c58103b505f8bcdf55cea1159ca21e27"/></dir><dir name="images"><file name="postcode-logo.png" hash="da02bc29be1057a0201e63f81ee4bd02"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="postcodenl"><dir name="api"><dir name="css"><file name="lookup.css" hash="c6ffbeceb6907b2e8463d1ff30810304"/></dir><dir name="images"><file name="postcode-logo.png" hash="da02bc29be1057a0201e63f81ee4bd02"/></dir></dir></dir></dir></dir><dir name="base"><dir name="default"><dir name="postcodenl"><dir name="api"><dir name="css"><file name="lookup.css" hash="c6ffbeceb6907b2e8463d1ff30810304"/></dir><dir name="images"><file name="postcode-logo.png" hash="da02bc29be1057a0201e63f81ee4bd02"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="PostcodeNl_Api.xml" hash="feeaf95128ffe4ad109ed8b0b8bc85ab"/></dir></target></contents>
28
  <compatible/>
29
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><extension><name>curl</name><min>7.10.5</min><max>7.99.0</max></extension></required></dependencies>
30
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>PostcodeNl_Api</name>
4
+ <version>1.2.0.0</version>
5
  <stability>stable</stability>
6
  <license>Simplified BSD License</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>Complement and validate Dutch addresses at Checkout, and check for order errors and fraud risks.</summary>
10
  <description>Complement and validate Dutch addresses at Checkout with the free postcode Magento plugin from Postcode.nl.&#xD;
11
+ Also includes the free Postcode.nl Signal API service to validate and enrich order information, as well as check for potential fraud risk via the Dutch authorities.&#xD;
12
  &#xD;
13
  &#x2022; Reduce address errors&#xD;
14
  &#x2022; Reduce costs from undelivered mail and packages&#xD;
15
  &#x2022; Offer extra service for your customers with easy address entry&#xD;
16
  &#x2022; Improve sale conversion&#xD;
17
+ &#x2022; Get warnings for potential incorrect order data&#xD;
18
+ &#x2022; Check against the Dutch authorities' fraud warning database&#xD;
19
  &#xD;
20
  The postcode Magento plugin from Postcode.nl is free of charge, based on a Fair-Use policy. The use of the Postcode.nl Magento plugin is subject to our Terms and Conditions.</description>
21
+ <notes>Features:&#xD;
22
+ - Added the new Postcode.nl Signal API network for data checking and fraud warnings (https://api.postcode.nl/documentation/signal-api-description in Dutch)&#xD;
23
+ - Added option to enable/disable Signal and Address API separately&#xD;
 
 
24
  </notes>
25
  <authors><author><name>Postcode.nl Technical Support</name><user>TechPostcodeNl</user><email>tech@postcode.nl</email></author></authors>
26
+ <date>2014-12-02</date>
27
+ <time>16:25:57</time>
28
+ <contents><target name="magecommunity"><dir name="PostcodeNl"><dir name="Api"><dir name="Block"><file name="Jsinit.php" hash="79bb826a50ce0cf4f87cc2f958bfafa1"/></dir><dir name="Helper"><file name="Data.php" hash="b339a9af05e5974aeba934603c110390"/></dir><dir name="Model"><file name="Observer.php" hash="f60c131c6000568df5313d9f07d153ee"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="PcnlController.php" hash="1a8eaf87ed60481f51f3f74eab3ab63f"/></dir><file name="JsonController.php" hash="6a3bff054e3229faaae2aa55f9a3cf3c"/></dir><dir name="data"><dir name="postcodenl_api_setup"><file name="data-upgrade-1.0.8.0-1.1.0.0.php" hash="e0acdb124cf735198c021f0c827c82bc"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="5d518aeaeae028b6299c7cf3d6e54f60"/><file name="config.xml" hash="a572215c4525a8d64636335b17128357"/><file name="system.xml" hash="1dc10a6e0247c32270a66373ae58517d"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="postcodenl"><dir name="api"><file name="lookup.xml" hash="e8f6295a91c9c5bfd116ae1048a5445d"/></dir></dir></dir><dir name="template"><dir name="postcodenl"><dir name="api"><file name="jsinit.phtml" hash="8623676f4c6f4068d0b51e31dcfa08e9"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="postcodenl"><dir name="api"><file name="lookup.xml" hash="88c6556ea3cc3b3c6746021e8636a24c"/></dir></dir></dir><dir name="template"><dir name="postcodenl"><dir name="api"><file name="jsinit.phtml" hash="ff32e12bbc26e4414dd8ca76edc4ed0f"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="PostcodeNl_Api.csv" hash="f48fa23f30f5dfaab37a905fb1ba9c51"/></dir><dir name="nl_NL"><file name="PostcodeNl_Api.csv" hash="fc2be2700e2025a3f56d4d8e72d30781"/></dir></target><target name="mageweb"><dir name="js"><dir name="postcodenl"><dir name="api"><file name="lookup.js" hash="ad6bea939cd0d6ababd953980a3e86e9"/></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="postcodenl"><dir name="api"><dir name="css"><file name="lookup.css" hash="c58103b505f8bcdf55cea1159ca21e27"/></dir><dir name="images"><file name="postcode-logo.png" hash="da02bc29be1057a0201e63f81ee4bd02"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="postcodenl"><dir name="api"><dir name="css"><file name="lookup.css" hash="c6ffbeceb6907b2e8463d1ff30810304"/></dir><dir name="images"><file name="postcode-logo.png" hash="da02bc29be1057a0201e63f81ee4bd02"/></dir></dir></dir></dir></dir></dir></target></contents>
29
  <compatible/>
30
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><extension><name>curl</name><min>7.10.5</min><max>7.99.0</max></extension></required></dependencies>
31
  </package>
skin/frontend/default/default/postcodenl/api/css/lookup.css DELETED
@@ -1,171 +0,0 @@
1
- /* Frontend styles */
2
-
3
- input.pcnl-readonly {
4
- background-color: #EEE;
5
- }
6
-
7
- .form-list input.pcnl-input-text-half {
8
- width: 45%;
9
- margin-right:5px;
10
- }
11
- .form-list select.pcnl-input-text-half {
12
- width: 45%;
13
- }
14
-
15
- input.pcnl-readonly,
16
- select.pcnl-readonly {
17
- color: grey;
18
- font-style: italic;
19
- }
20
-
21
- .pcnl-info-text {
22
- font-size: 90%;
23
- }
24
-
25
- .pcnl-info-label {
26
- float: none !important;
27
- }
28
-
29
- .pcnl-address-text {
30
- font-style: italic;
31
- clear: both;
32
- padding-left: 4px;
33
- padding-right: 4px;
34
- width: 90%;
35
- }
36
-
37
- /* excessive hidey-stuff? yes. blame IE (6, 7 & 9) */
38
- .pcnl-hidden-field {
39
- visibility: hidden;
40
- display: block;
41
- height: 0px !important;
42
- width: 0px !important;
43
- margin: 0 !important;
44
- padding: 0 !important;
45
- position: absolute;
46
- }
47
-
48
- /* Magento 1.9 styling 'float fix' for manual checkbox */
49
- .form-list .control.pcnl-manual-checkbox div.input-box {
50
- display: block;
51
- float: none;
52
- }
53
-
54
- /* Showcase styles */
55
-
56
- h4.pcnl-showcase, h4.pcnl-debug {
57
- background: url(../images/postcode-logo.png) left center no-repeat;
58
- padding-left: 146px;
59
- height: 22px;
60
- line-height: 25px;
61
- margin-bottom: 0px;
62
- }
63
-
64
- dl.pcnl-showcase, dl.pcnl-debug {
65
- padding: 4px;
66
- border: 1px solid grey;
67
- border-radius: 4px;
68
- -moz-border-radius: 4px;
69
- background: white;
70
- position: relative;
71
- }
72
-
73
- dl.pcnl-showcase iframe {
74
- position: absolute;
75
- top: 5px;
76
- right: 5px;
77
- width: 300px;
78
- height: 300px;
79
- border: 1px solid grey;
80
- }
81
-
82
- dl.pcnl-showcase dt, dl.pcnl-debug dt {
83
- font-weight: bold;
84
- }
85
- dl.pcnl-showcase dd, dl.pcnl-debug dd {
86
- margin-left: 20px;
87
- }
88
-
89
- /* OneStepCheckout(.com) styling */
90
- div.checkoutcontainer div.pcnl-input-housenumber {
91
- width: 60%;
92
- }
93
- div.checkoutcontainer div.pcnl-input-housenumber .input-text {
94
- width: 74%;
95
- }
96
- div.checkoutcontainer .pcnl-with-addition div.pcnl-input-housenumber .input-text {
97
- width: 22%;
98
- }
99
- div.checkoutcontainer div.pcnl-input-housenumber select.pcnl-input-text-half {
100
- margin-left: 4px;
101
- width: 50%;
102
- }
103
- div.checkoutcontainer .pcnl-info-text {
104
- width: 85%;
105
- }
106
- div.checkoutcontainer dl.pcnl-showcase iframe {
107
- position: relative;
108
- float: right;
109
- width: 260px;
110
- height: 260px;
111
- margin-bottom: 15px;
112
- border: 1px solid grey;
113
- }
114
-
115
- /* OneStepCheckout.com */
116
- .onestepcheckout-index-index .group-select li .input-postcode .input-box {
117
- width: auto;
118
- }
119
-
120
- /* GoMage LightCheckout */
121
- body.gomage-checkout-onepage-index dl.pcnl-debug {
122
- width: 260px;
123
- overflow: hidden;
124
- }
125
-
126
- body.gomage-checkout-onepage-index dl.pcnl-debug:hover {
127
- width: auto;
128
- overflow: normal;
129
- }
130
-
131
- body.gomage-checkout-onepage-index .pcnl-manual-checkbox label,
132
- body.gomage-checkout-onepage-index .pcnl-info label {
133
- float: none;
134
- }
135
- body.gomage-checkout-onepage-index .pcnl-info-text {
136
- width: 90%;
137
- }
138
-
139
- /* MageStore One Step Checkout */
140
- body.onestepcheckout-index-index #one-step-checkout-form .pcnl-info-text {
141
- width: 78%;
142
- }
143
-
144
- /* Apptha One Step Checkout */
145
- body.onestepcheckout-index-index .onepage .form-list .pcnl-apptha-fields .field {
146
- margin-right: 8px;
147
- float: left;
148
- width: 120px !important;
149
- }
150
- body.onestepcheckout-index-index .onepage .form-list .pcnl-apptha-fields .pcnl-input-housenumber {
151
- padding-left: 6px;
152
- }
153
- body.onestepcheckout-index-index .onepage .form-list .pcnl-apptha-fields .field .input-text {
154
- width: 120px !important;
155
- }
156
- body.onestepcheckout-index-index .onepage .form-list .pcnl-apptha-checkbox .field {
157
- width: 250px !important
158
- }
159
- body.onestepcheckout-index-index .onepage .form-list .pcnl-apptha-checkbox input {
160
- float: left;
161
- margin-top: 2px;
162
- margin-right: 0;
163
- }
164
- body.onestepcheckout-index-index .onepage .form-list .pcnl-apptha-checkbox label {
165
- padding-left: 6px;
166
- }
167
-
168
- /* IWD One Step Checkout */
169
- body.onepagecheckout-index-index .pcnl-manual-checkbox {
170
- clear: both; /* IE 7/9 fix */
171
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
skin/frontend/default/default/postcodenl/api/images/postcode-logo.png DELETED
Binary file