Version Notes
Features:
- Added automatic connection testing
- Improved connection debugging assistance
- Added Dutch translations for admin
Fixes:
- Fixed error when using showcase option
Download this release
Release Info
Developer | Postcode.nl Technical Support |
Extension | PostcodeNl_Api |
Version | 1.2.3.0 |
Comparing to | |
See all releases |
Code changes from version 1.2.2.0 to 1.2.3.0
- app/code/community/PostcodeNl/Api/Helper/Data.php +177 -36
- app/code/community/PostcodeNl/Api/Model/Observer.php +15 -0
- app/code/community/PostcodeNl/Api/etc/config.xml +12 -1
- app/code/community/PostcodeNl/Api/etc/system.xml +10 -44
- app/locale/en_US/PostcodeNl_Api.csv +52 -0
- app/locale/nl_NL/PostcodeNl_Api.csv +52 -0
- js/postcodenl/api/lookup.js +6 -8
- package.xml +8 -6
- skin/frontend/base/default/postcodenl/api/css/lookup.css +0 -17
app/code/community/PostcodeNl/Api/Helper/Data.php
CHANGED
@@ -12,6 +12,7 @@ class PostcodeNl_Api_Helper_Data extends Mage_Core_Helper_Abstract
|
|
12 |
protected $_httpResponseCode = null;
|
13 |
protected $_httpResponseCodeClass = null;
|
14 |
protected $_httpClientError = null;
|
|
|
15 |
|
16 |
/**
|
17 |
* Get the html for initializing validation script.
|
@@ -37,7 +38,7 @@ class PostcodeNl_Api_Helper_Data extends Mage_Core_Helper_Abstract
|
|
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') . ',
|
40 |
-
debug: ' . $this->
|
41 |
translations: {
|
42 |
defaultError: "' . htmlspecialchars($this->__('Unknown postcode + housenumber combination.')) . '",
|
43 |
postcodeInputLabel: "' . htmlspecialchars($this->__('Postcode')) . '",
|
@@ -79,7 +80,7 @@ class PostcodeNl_Api_Helper_Data extends Mage_Core_Helper_Abstract
|
|
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->
|
83 |
return true;
|
84 |
|
85 |
if (!$this->_getStoreConfig('postcodenl_api/config/enabled'))
|
@@ -95,13 +96,26 @@ class PostcodeNl_Api_Helper_Data extends Mage_Core_Helper_Abstract
|
|
95 |
}
|
96 |
|
97 |
/**
|
98 |
-
* Check if we're currently in debug mode.
|
99 |
*
|
100 |
* @return bool
|
101 |
*/
|
102 |
public function isDebugging()
|
103 |
{
|
104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
}
|
106 |
|
107 |
/**
|
@@ -137,31 +151,11 @@ class PostcodeNl_Api_Helper_Data extends Mage_Core_Helper_Abstract
|
|
137 |
|
138 |
$jsonData = $this->_callApiUrlGet($url);
|
139 |
|
140 |
-
|
141 |
-
$serviceDebug = $this->isDebugging();
|
142 |
-
|
143 |
-
if ($serviceShowcase)
|
144 |
$response['showcaseResponse'] = $jsonData;
|
145 |
|
146 |
-
if ($
|
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 |
{
|
@@ -234,7 +228,7 @@ class PostcodeNl_Api_Helper_Data extends Mage_Core_Helper_Abstract
|
|
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');
|
@@ -264,6 +258,10 @@ class PostcodeNl_Api_Helper_Data extends Mage_Core_Helper_Abstract
|
|
264 |
{
|
265 |
$response['message'] = $this->__('Signal API response not understood, service unavailable.') . 'HTTP status code: `'. $this->_httpResponseCode .'`';
|
266 |
}
|
|
|
|
|
|
|
|
|
267 |
return $response;
|
268 |
}
|
269 |
|
@@ -295,7 +293,7 @@ class PostcodeNl_Api_Helper_Data extends Mage_Core_Helper_Abstract
|
|
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]+';
|
@@ -434,6 +432,149 @@ class PostcodeNl_Api_Helper_Data extends Mage_Core_Helper_Abstract
|
|
434 |
return $access;
|
435 |
}
|
436 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
437 |
protected function _getStoreConfig($path)
|
438 |
{
|
439 |
return Mage::getStoreConfig($path);
|
@@ -511,16 +652,16 @@ class PostcodeNl_Api_Helper_Data extends Mage_Core_Helper_Abstract
|
|
511 |
|
512 |
protected function _checkApiReady($service = null)
|
513 |
{
|
514 |
-
if (!$this->_getStoreConfig('postcodenl_api/config/enabled'))
|
515 |
return array('message' => $this->__('Postcode.nl API not enabled.'));;
|
516 |
|
517 |
if ($this->_getServiceUrl() === '' || $this->_getKey() === '' || $this->_getSecret() === '')
|
518 |
-
return array('message' => $this->__('Postcode.nl API not configured.'));
|
519 |
|
520 |
-
if ($service === 'Address' && !$this->_getStoreConfig('postcodenl_api/config/enabled_address_api'))
|
521 |
return array('message' => $this->__('Postcode.nl Address API not enabled.'));;
|
522 |
|
523 |
-
if ($service === 'Signal' && !$this->_getStoreConfig('postcodenl_api/config/enabled_signal_api'))
|
524 |
return array('message' => $this->__('Postcode.nl Signal API not enabled.'));;
|
525 |
|
526 |
return $this->_checkCapabilities();
|
@@ -553,14 +694,14 @@ class PostcodeNl_Api_Helper_Data extends Mage_Core_Helper_Abstract
|
|
553 |
$this->_httpResponseRaw = curl_exec($ch);
|
554 |
$this->_httpResponseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
555 |
$this->_httpResponseCodeClass = (int)floor($this->_httpResponseCode / 100) * 100;
|
556 |
-
$this->_httpClientError = curl_error($ch);
|
557 |
|
558 |
curl_close($ch);
|
559 |
|
560 |
return json_decode($this->_httpResponseRaw, true);
|
561 |
}
|
562 |
|
563 |
-
protected function _callApiUrlPostJson($url, $data)
|
564 |
{
|
565 |
$ch = curl_init();
|
566 |
curl_setopt($ch, CURLOPT_URL, $url);
|
@@ -575,7 +716,7 @@ class PostcodeNl_Api_Helper_Data extends Mage_Core_Helper_Abstract
|
|
575 |
$this->_httpResponseRaw = curl_exec($ch);
|
576 |
$this->_httpResponseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
577 |
$this->_httpResponseCodeClass = (int)floor($this->_httpResponseCode / 100) * 100;
|
578 |
-
$this->_httpClientError = curl_error($ch);
|
579 |
curl_close($ch);
|
580 |
|
581 |
return json_decode($this->_httpResponseRaw, true);
|
12 |
protected $_httpResponseCode = null;
|
13 |
protected $_httpResponseCodeClass = null;
|
14 |
protected $_httpClientError = null;
|
15 |
+
protected $_debuggingOverride = false;
|
16 |
|
17 |
/**
|
18 |
* Get the html for initializing validation script.
|
38 |
blockPostOfficeBoxAddresses: '. $this->_getConfigBoolString('postcodenl_api/advanced_config/block_postofficeboxaddresses') . ',
|
39 |
neverHideCountry: ' . $this->_getConfigBoolString('postcodenl_api/advanced_config/never_hide_country') . ',
|
40 |
showcase: ' . $this->_getConfigBoolString('postcodenl_api/development_config/api_showcase') . ',
|
41 |
+
debug: ' . ($this->isDebugging() ? 'true' : 'false') . ',
|
42 |
translations: {
|
43 |
defaultError: "' . htmlspecialchars($this->__('Unknown postcode + housenumber combination.')) . '",
|
44 |
postcodeInputLabel: "' . htmlspecialchars($this->__('Postcode')) . '",
|
80 |
public function isApiEnabled($service)
|
81 |
{
|
82 |
// If we're debugging, assume all services are enabled, to get feedback on all levels.
|
83 |
+
if ($this->isDebugging())
|
84 |
return true;
|
85 |
|
86 |
if (!$this->_getStoreConfig('postcodenl_api/config/enabled'))
|
96 |
}
|
97 |
|
98 |
/**
|
99 |
+
* Check if we're currently in debug mode, and if the current user may see dev info.
|
100 |
*
|
101 |
* @return bool
|
102 |
*/
|
103 |
public function isDebugging()
|
104 |
{
|
105 |
+
if ($this->_debuggingOverride)
|
106 |
+
return true;
|
107 |
+
else
|
108 |
+
return (bool)$this->_getStoreConfig('postcodenl_api/development_config/api_debug') && Mage::helper('core')->isDevAllowed();
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Set the debugging override flag.
|
113 |
+
*
|
114 |
+
* @param bool $toggle
|
115 |
+
*/
|
116 |
+
public function setDebuggingOverride($toggle = true)
|
117 |
+
{
|
118 |
+
$this->_debuggingOverride = $toggle;
|
119 |
}
|
120 |
|
121 |
/**
|
151 |
|
152 |
$jsonData = $this->_callApiUrlGet($url);
|
153 |
|
154 |
+
if ($this->_getStoreConfig('postcodenl_api/development_config/api_showcase'))
|
|
|
|
|
|
|
155 |
$response['showcaseResponse'] = $jsonData;
|
156 |
|
157 |
+
if ($this->isDebugging())
|
158 |
+
$response['debugInfo'] = $this->_getDebugInfo($url, $jsonData);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
|
160 |
if ($this->_httpResponseCode == 200 && is_array($jsonData) && isset($jsonData['postcode']))
|
161 |
{
|
228 |
*
|
229 |
* @return array Signal result
|
230 |
*/
|
231 |
+
public function checkSignal(array $signalCheck)
|
232 |
{
|
233 |
// Check if we are we enabled, configured & capable of handling an API request
|
234 |
$message = $this->_checkApiReady('Signal');
|
258 |
{
|
259 |
$response['message'] = $this->__('Signal API response not understood, service unavailable.') . 'HTTP status code: `'. $this->_httpResponseCode .'`';
|
260 |
}
|
261 |
+
|
262 |
+
if ($this->isDebugging())
|
263 |
+
$response['debugInfo'] = $this->_getDebugInfo($url, $jsonData);
|
264 |
+
|
265 |
return $response;
|
266 |
}
|
267 |
|
293 |
*
|
294 |
* @return array Array containing 'street', 'houseNumber' and 'houseNumberAddition'
|
295 |
*/
|
296 |
+
public function splitStreetData(array $streetData)
|
297 |
{
|
298 |
$regexpStreet = '[^0-9].*?|.*?[^0-9]';
|
299 |
$regexpHouseNumber = '[0-9]+';
|
432 |
return $access;
|
433 |
}
|
434 |
|
435 |
+
protected function _getDebugInfo($url, $jsonData)
|
436 |
+
{
|
437 |
+
return array(
|
438 |
+
'requestUrl' => $url,
|
439 |
+
'rawResponse' => $this->_httpResponseRaw,
|
440 |
+
'responseCode' => $this->_httpResponseCode,
|
441 |
+
'responseCodeClass' => $this->_httpResponseCodeClass,
|
442 |
+
'parsedResponse' => $jsonData,
|
443 |
+
'httpClientError' => $this->_httpClientError,
|
444 |
+
'configuration' => array(
|
445 |
+
'url' => $this->_getServiceUrl(),
|
446 |
+
'key' => $this->_getKey(),
|
447 |
+
'secret' => substr($this->_getSecret(), 0, 6) .'[hidden]',
|
448 |
+
'showcase' => $this->_getStoreConfig('postcodenl_api/development_config/api_showcase'),
|
449 |
+
'debug' => $this->_getStoreConfig('postcodenl_api/development_config/api_debug'),
|
450 |
+
),
|
451 |
+
'magentoVersion' => $this->_getMagentoVersion(),
|
452 |
+
'extensionVersion' => $this->_getExtensionVersion(),
|
453 |
+
'modules' => $this->_getMagentoModules(),
|
454 |
+
);
|
455 |
+
}
|
456 |
+
|
457 |
+
public function testConnection()
|
458 |
+
{
|
459 |
+
// Default is not OK
|
460 |
+
$message = $this->__('The test connection could not be successfully completed.');
|
461 |
+
$status = 'error';
|
462 |
+
$info = array();
|
463 |
+
|
464 |
+
// Do a test address lookup
|
465 |
+
$this->setDebuggingOverride(true);
|
466 |
+
$addressData = $this->lookupAddress('2012ES', '30', '');
|
467 |
+
$this->setDebuggingOverride(false);
|
468 |
+
|
469 |
+
if (!isset($addressData['debugInfo']) && isset($addressData['message']))
|
470 |
+
{
|
471 |
+
// Client-side error
|
472 |
+
$message = $addressData['message'];
|
473 |
+
if (isset($addressData['info']))
|
474 |
+
$info = $addressData['info'];
|
475 |
+
}
|
476 |
+
else if ($addressData['debugInfo']['httpClientError'])
|
477 |
+
{
|
478 |
+
// We have a HTTP connection error
|
479 |
+
$message = $this->__('Your server could not connect to the Postcode.nl server.');
|
480 |
+
|
481 |
+
// Do some common SSL CA problem detection
|
482 |
+
if (strpos($addressData['debugInfo']['httpClientError'], 'SSL certificate problem, verify that the CA cert is OK') !== false)
|
483 |
+
{
|
484 |
+
$info[] = $this->__('Your servers\' \'cURL SSL CA bundle\' is missing or outdated. Further information:');
|
485 |
+
$info[] = '- <a href="http://stackoverflow.com/questions/6400300/https-and-ssl3-get-server-certificatecertificate-verify-failed-ca-is-ok" target="_blank">'. $this->__('How to update/fix your CA cert bundle') .'</a>';
|
486 |
+
$info[] = '- <a href="http://curl.haxx.se/docs/sslcerts.html" target="_blank">'. $this->__('About cURL SSL CA certificates') .'</a>';
|
487 |
+
$info[] = '';
|
488 |
+
}
|
489 |
+
else if (strpos($addressData['debugInfo']['httpClientError'], 'unable to get local issuer certificate') !== false)
|
490 |
+
{
|
491 |
+
$info[] = $this->__('cURL cannot read/access the CA cert file:');
|
492 |
+
$info[] = '- <a href="http://curl.haxx.se/docs/sslcerts.html" target="_blank">'. $this->__('About cURL SSL CA certificates') .'</a>';
|
493 |
+
$info[] = '';
|
494 |
+
}
|
495 |
+
else
|
496 |
+
{
|
497 |
+
$info[] = $this->__('Connection error.');
|
498 |
+
}
|
499 |
+
$info[] = $this->__('Error message:') . ' "'. $addressData['debugInfo']['httpClientError'] .'"';
|
500 |
+
$info[] = '- <a href="https://www.google.com/search?q='. urlencode($addressData['debugInfo']['httpClientError']) .'" target="_blank">'. $this->__('Google the error message') .'</a>';
|
501 |
+
$info[] = '- '. $this->__('Contact your hosting provider if problems persist.');
|
502 |
+
|
503 |
+
}
|
504 |
+
else if (!is_array($addressData['debugInfo']['parsedResponse']))
|
505 |
+
{
|
506 |
+
// We have not received a valid JSON response
|
507 |
+
|
508 |
+
$message = $this->__('The response from the Postcode.nl service could not be understood.');
|
509 |
+
$info[] = '- '. $this->__('The service might be temporarily unavailable, if problems persist, please contact <a href=\'mailto:info@postcode.nl\'>info@postcode.nl</a>.');
|
510 |
+
$info[] = '- '. $this->__('Technical reason: No valid JSON was returned by the request.');
|
511 |
+
}
|
512 |
+
else if (is_array($addressData['debugInfo']['parsedResponse']) && isset($addressData['debugInfo']['parsedResponse']['exceptionId']))
|
513 |
+
{
|
514 |
+
// We have an exception message from the service itself
|
515 |
+
|
516 |
+
if ($addressData['debugInfo']['responseCode'] == 401)
|
517 |
+
{
|
518 |
+
if ($addressData['debugInfo']['parsedResponse']['exceptionId'] == 'PostcodeNl_Controller_Plugin_HttpBasicAuthentication_NotAuthorizedException')
|
519 |
+
$message = $this->__('`API Key` specified is incorrect.');
|
520 |
+
else if ($addressData['debugInfo']['parsedResponse']['exceptionId'] == 'PostcodeNl_Controller_Plugin_HttpBasicAuthentication_PasswordNotCorrectException')
|
521 |
+
$message = $this->__('`API Secret` specified is incorrect.');
|
522 |
+
else
|
523 |
+
$message = $this->__('Authentication is incorrect.');
|
524 |
+
}
|
525 |
+
else if ($addressData['debugInfo']['responseCode'] == 403)
|
526 |
+
{
|
527 |
+
$message = $this->__('Access is denied.');
|
528 |
+
}
|
529 |
+
else
|
530 |
+
{
|
531 |
+
$message = $this->__('Service reported an error.');
|
532 |
+
}
|
533 |
+
$info[] = $this->__('Postcode.nl service message:') .' "'. $addressData['debugInfo']['parsedResponse']['exception'] .'"';
|
534 |
+
}
|
535 |
+
else if (is_array($addressData['debugInfo']['parsedResponse']) && !isset($addressData['debugInfo']['parsedResponse']['postcode']))
|
536 |
+
{
|
537 |
+
// This message is thrown when the JSON returned did not contain the data expected.
|
538 |
+
|
539 |
+
$message = $this->__('The response from the Postcode.nl service could not be understood.');
|
540 |
+
$info[] = '- '. $this->__('The service might be temporarily unavailable, if problems persist, please contact <a href=\'mailto:info@postcode.nl\'>info@postcode.nl</a>.');
|
541 |
+
$info[] = '- '. $this->__('Technical reason: Received JSON data did not contain expected data.');
|
542 |
+
}
|
543 |
+
else
|
544 |
+
{
|
545 |
+
$message = $this->__('A test connection to the API was successfully completed.');
|
546 |
+
$status = 'success';
|
547 |
+
}
|
548 |
+
|
549 |
+
if ($status == 'success' && $this->isApiEnabled('Signal'))
|
550 |
+
{
|
551 |
+
$this->setDebuggingOverride(true);
|
552 |
+
$signalData = $this->checkSignal(array('customer' => array('firstName' => 'Magento', 'lastName' => 'Tester')));
|
553 |
+
$this->setDebuggingOverride(false);
|
554 |
+
|
555 |
+
if (!is_array($signalData['debugInfo']['parsedResponse']))
|
556 |
+
{
|
557 |
+
// Signal service failed, but in an unexpected way
|
558 |
+
$status = 'error';
|
559 |
+
$message = $this->__('Address API service has no problems, but the Signal API service reported an error.');
|
560 |
+
$info[] = '- '. $this->__('The Signal service might be temporarily unavailable, if problems persist, please contact <a href=\'mailto:info@postcode.nl\'>info@postcode.nl</a>.');
|
561 |
+
}
|
562 |
+
else if (isset($signalData['debugInfo']['parsedResponse']['exceptionId']))
|
563 |
+
{
|
564 |
+
// We have an exception message from the service itself
|
565 |
+
$status = 'error';
|
566 |
+
$message = $this->__('Address API service has no problems, but the Signal API service reported an error.');
|
567 |
+
$info[] = $this->__('Postcode.nl service message:') .' "'. $signalData['debugInfo']['parsedResponse']['exception'] .'"';
|
568 |
+
}
|
569 |
+
}
|
570 |
+
|
571 |
+
return array(
|
572 |
+
'message' => $message,
|
573 |
+
'status' => $status,
|
574 |
+
'info' => $info,
|
575 |
+
);
|
576 |
+
}
|
577 |
+
|
578 |
protected function _getStoreConfig($path)
|
579 |
{
|
580 |
return Mage::getStoreConfig($path);
|
652 |
|
653 |
protected function _checkApiReady($service = null)
|
654 |
{
|
655 |
+
if (!$this->_getStoreConfig('postcodenl_api/config/enabled') && !$this->_debuggingOverride)
|
656 |
return array('message' => $this->__('Postcode.nl API not enabled.'));;
|
657 |
|
658 |
if ($this->_getServiceUrl() === '' || $this->_getKey() === '' || $this->_getSecret() === '')
|
659 |
+
return array('message' => $this->__('Postcode.nl API not configured.'), 'info' => array($this->__('Configure your `API key` and `API secret`.')));
|
660 |
|
661 |
+
if ($service === 'Address' && !$this->_getStoreConfig('postcodenl_api/config/enabled_address_api') && !$this->_debuggingOverride)
|
662 |
return array('message' => $this->__('Postcode.nl Address API not enabled.'));;
|
663 |
|
664 |
+
if ($service === 'Signal' && !$this->_getStoreConfig('postcodenl_api/config/enabled_signal_api') && !$this->_debuggingOverride)
|
665 |
return array('message' => $this->__('Postcode.nl Signal API not enabled.'));;
|
666 |
|
667 |
return $this->_checkCapabilities();
|
694 |
$this->_httpResponseRaw = curl_exec($ch);
|
695 |
$this->_httpResponseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
696 |
$this->_httpResponseCodeClass = (int)floor($this->_httpResponseCode / 100) * 100;
|
697 |
+
$this->_httpClientError = curl_errno($ch) ? sprintf('cURL error %s: %s', curl_errno($ch), curl_error($ch)) : null;
|
698 |
|
699 |
curl_close($ch);
|
700 |
|
701 |
return json_decode($this->_httpResponseRaw, true);
|
702 |
}
|
703 |
|
704 |
+
protected function _callApiUrlPostJson($url, array $data)
|
705 |
{
|
706 |
$ch = curl_init();
|
707 |
curl_setopt($ch, CURLOPT_URL, $url);
|
716 |
$this->_httpResponseRaw = curl_exec($ch);
|
717 |
$this->_httpResponseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
718 |
$this->_httpResponseCodeClass = (int)floor($this->_httpResponseCode / 100) * 100;
|
719 |
+
$this->_httpClientError = curl_errno($ch) ? sprintf('cURL error %s: %s', curl_errno($ch), curl_error($ch)) : null;
|
720 |
curl_close($ch);
|
721 |
|
722 |
return json_decode($this->_httpResponseRaw, true);
|
app/code/community/PostcodeNl/Api/Model/Observer.php
CHANGED
@@ -26,4 +26,19 @@ class PostcodeNl_Api_Model_Observer
|
|
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 |
}
|
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 |
+
|
30 |
+
public function adminConfigurationChanged(Varien_Event_Observer $observer)
|
31 |
+
{
|
32 |
+
$helper = Mage::helper('postcodenl_api');
|
33 |
+
|
34 |
+
$data = $helper->testConnection();
|
35 |
+
|
36 |
+
if ($data['status'] == 'error')
|
37 |
+
Mage::getSingleton('core/session')->addError($helper->__('Postcode.nl API Test: '). $data['message']);
|
38 |
+
if ($data['status'] == 'success')
|
39 |
+
Mage::getSingleton('core/session')->addSuccess($helper->__('Postcode.nl API Test: '). $data['message']);
|
40 |
+
|
41 |
+
if ($data['info'])
|
42 |
+
Mage::getSingleton('core/session')->addNotice($helper->__('Postcode.nl API Test Troubleshooting: ') .'<br /><br />'. implode('<br />', $data['info']));
|
43 |
+
}
|
44 |
}
|
app/code/community/PostcodeNl/Api/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<PostcodeNl_Api>
|
5 |
-
<version>1.2.
|
6 |
</PostcodeNl_Api>
|
7 |
</modules>
|
8 |
<frontend>
|
@@ -90,6 +90,17 @@
|
|
90 |
</postcodenl_api>
|
91 |
</modules>
|
92 |
</translate>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
</adminhtml>
|
94 |
<default>
|
95 |
<postcodenl_api>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<PostcodeNl_Api>
|
5 |
+
<version>1.2.3.0</version>
|
6 |
</PostcodeNl_Api>
|
7 |
</modules>
|
8 |
<frontend>
|
90 |
</postcodenl_api>
|
91 |
</modules>
|
92 |
</translate>
|
93 |
+
<events>
|
94 |
+
<admin_system_config_changed_section_postcodenl_api>
|
95 |
+
<observers>
|
96 |
+
<postcodenl_admin_change>
|
97 |
+
<type>singleton</type>
|
98 |
+
<class>PostcodeNl_Api_Model_Observer</class>
|
99 |
+
<method>adminConfigurationChanged</method>
|
100 |
+
</postcodenl_admin_change>
|
101 |
+
</observers>
|
102 |
+
</admin_system_config_changed_section_postcodenl_api>
|
103 |
+
</events>
|
104 |
</adminhtml>
|
105 |
<default>
|
106 |
<postcodenl_api>
|
app/code/community/PostcodeNl/Api/etc/system.xml
CHANGED
@@ -45,10 +45,7 @@
|
|
45 |
<show_in_website>1</show_in_website>
|
46 |
<show_in_store>1</show_in_store>
|
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>
|
@@ -58,10 +55,7 @@
|
|
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>
|
@@ -71,10 +65,7 @@
|
|
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>
|
@@ -95,10 +86,7 @@
|
|
95 |
<show_in_default>1</show_in_default>
|
96 |
<show_in_website>1</show_in_website>
|
97 |
<show_in_store>1</show_in_store>
|
98 |
-
<comment>
|
99 |
-
<![CDATA[
|
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>
|
@@ -108,10 +96,7 @@
|
|
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>
|
@@ -121,11 +106,7 @@
|
|
121 |
<show_in_default>1</show_in_default>
|
122 |
<show_in_website>1</show_in_website>
|
123 |
<show_in_store>1</show_in_store>
|
124 |
-
<comment>
|
125 |
-
<![CDATA[
|
126 |
-
This will consider 'post office box' (postbus) addresses invalid for all validated address fields.<br />
|
127 |
-
<em>(though still allowed if address is added with 'manual' checkbox)</em>
|
128 |
-
]]></comment>
|
129 |
</block_postofficeboxaddresses>
|
130 |
<never_hide_country translate="label">
|
131 |
<label>Always show country selector</label>
|
@@ -135,11 +116,7 @@
|
|
135 |
<show_in_default>1</show_in_default>
|
136 |
<show_in_website>1</show_in_website>
|
137 |
<show_in_store>1</show_in_store>
|
138 |
-
<comment>
|
139 |
-
<![CDATA[
|
140 |
-
For webshops with a more international audience, always show the country selection box.<br />
|
141 |
-
<b>Developer Note</b>: If there are other fields next to the country selector, they will be disabled.
|
142 |
-
]]></comment>
|
143 |
</never_hide_country>
|
144 |
<admin_validation_disabled translate="label">
|
145 |
<label>Disable validation in admin</label>
|
@@ -149,10 +126,7 @@
|
|
149 |
<show_in_default>1</show_in_default>
|
150 |
<show_in_website>1</show_in_website>
|
151 |
<show_in_store>1</show_in_store>
|
152 |
-
<comment>
|
153 |
-
<![CDATA[
|
154 |
-
You can use this option if you encounter problems in the admin address validation, or want to allow all addresses in the admin.
|
155 |
-
]]></comment>
|
156 |
</admin_validation_disabled>
|
157 |
</fields>
|
158 |
</advanced_config>
|
@@ -191,11 +165,7 @@
|
|
191 |
<show_in_default>1</show_in_default>
|
192 |
<show_in_website>1</show_in_website>
|
193 |
<show_in_store>1</show_in_store>
|
194 |
-
<comment>
|
195 |
-
<![CDATA[
|
196 |
-
By enabling this option, you will see what additional information the Postcode.nl API has to offer, every time your information is enriched.<br />
|
197 |
-
<em>(this is not recommended in production environments!)</em>
|
198 |
-
]]></comment>
|
199 |
</api_showcase>
|
200 |
<api_debug translate="label">
|
201 |
<label>Show API Debug info</label>
|
@@ -205,11 +175,7 @@
|
|
205 |
<show_in_default>1</show_in_default>
|
206 |
<show_in_website>1</show_in_website>
|
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>
|
214 |
</fields>
|
215 |
</development_config>
|
45 |
<show_in_website>1</show_in_website>
|
46 |
<show_in_store>1</show_in_store>
|
47 |
<validate>validate-length minimum-length-10</validate>
|
48 |
+
<comment><![CDATA[To get your Postcode.nl API key and secret, please register at <a href='https://api.postcode.nl' target='_blank'>Postcode.nl API</a>.]]></comment>
|
|
|
|
|
|
|
49 |
</api_secret>
|
50 |
<enabled_address_api translate="label">
|
51 |
<label>Address API Enabled?</label>
|
55 |
<show_in_default>1</show_in_default>
|
56 |
<show_in_website>1</show_in_website>
|
57 |
<show_in_store>1</show_in_store>
|
58 |
+
<comment><![CDATA[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.]]></comment>
|
|
|
|
|
|
|
59 |
</enabled_address_api>
|
60 |
<enabled_signal_api translate="label">
|
61 |
<label>Signal API Enabled?</label>
|
65 |
<show_in_default>1</show_in_default>
|
66 |
<show_in_website>1</show_in_website>
|
67 |
<show_in_store>1</show_in_store>
|
68 |
+
<comment><![CDATA[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.]]></comment>
|
|
|
|
|
|
|
69 |
</enabled_signal_api>
|
70 |
</fields>
|
71 |
</config>
|
86 |
<show_in_default>1</show_in_default>
|
87 |
<show_in_website>1</show_in_website>
|
88 |
<show_in_store>1</show_in_store>
|
89 |
+
<comment><![CDATA[If you use the second 'street' field as a separate house-number field, enable this option.]]></comment>
|
|
|
|
|
|
|
90 |
</use_street2_as_housenumber>
|
91 |
<use_street3_as_housenumber_addition translate="label">
|
92 |
<label>Separate housenumber addition</label>
|
96 |
<show_in_default>1</show_in_default>
|
97 |
<show_in_website>1</show_in_website>
|
98 |
<show_in_store>1</show_in_store>
|
99 |
+
<comment><![CDATA[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)]]></comment>
|
|
|
|
|
|
|
100 |
</use_street3_as_housenumber_addition>
|
101 |
<block_postofficeboxaddresses translate="label">
|
102 |
<label>Block post office box addresses</label>
|
106 |
<show_in_default>1</show_in_default>
|
107 |
<show_in_website>1</show_in_website>
|
108 |
<show_in_store>1</show_in_store>
|
109 |
+
<comment><![CDATA[This will consider 'post office box' (postbus) addresses invalid for all validated address fields.<br /><em>(though still allowed if address is added with 'manual' checkbox)</em>]]></comment>
|
|
|
|
|
|
|
|
|
110 |
</block_postofficeboxaddresses>
|
111 |
<never_hide_country translate="label">
|
112 |
<label>Always show country selector</label>
|
116 |
<show_in_default>1</show_in_default>
|
117 |
<show_in_website>1</show_in_website>
|
118 |
<show_in_store>1</show_in_store>
|
119 |
+
<comment><![CDATA[For webshops with a more international audience, always show the country selection box.<br /><b>Developer Note</b>: If there are other fields next to the country selector, they will be disabled.]]></comment>
|
|
|
|
|
|
|
|
|
120 |
</never_hide_country>
|
121 |
<admin_validation_disabled translate="label">
|
122 |
<label>Disable validation in admin</label>
|
126 |
<show_in_default>1</show_in_default>
|
127 |
<show_in_website>1</show_in_website>
|
128 |
<show_in_store>1</show_in_store>
|
129 |
+
<comment><![CDATA[You can use this option if you encounter problems in the admin address validation, or want to allow all addresses in the admin.]]></comment>
|
|
|
|
|
|
|
130 |
</admin_validation_disabled>
|
131 |
</fields>
|
132 |
</advanced_config>
|
165 |
<show_in_default>1</show_in_default>
|
166 |
<show_in_website>1</show_in_website>
|
167 |
<show_in_store>1</show_in_store>
|
168 |
+
<comment><![CDATA[By enabling this option, you will see what additional information the Postcode.nl API has to offer, every time your information is enriched.<br /><em>(this is not recommended in production environments!)</em>]]></comment>
|
|
|
|
|
|
|
|
|
169 |
</api_showcase>
|
170 |
<api_debug translate="label">
|
171 |
<label>Show API Debug info</label>
|
175 |
<show_in_default>1</show_in_default>
|
176 |
<show_in_website>1</show_in_website>
|
177 |
<show_in_store>1</show_in_store>
|
178 |
+
<comment><![CDATA[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 /><em>(this is not recommended in production environments!)</em>]]></comment>
|
|
|
|
|
|
|
|
|
179 |
</api_debug>
|
180 |
</fields>
|
181 |
</development_config>
|
app/locale/en_US/PostcodeNl_Api.csv
CHANGED
@@ -33,3 +33,55 @@
|
|
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."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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."
|
36 |
+
"A test connection could not be successfully completed.","The test connection could not be successfully completed."
|
37 |
+
"A test connection to the API was successfully completed.","A test connection to the API was successfully completed."
|
38 |
+
"Your server could not connect to the Postcode.nl server.","Your server could not connect to the Postcode.nl server."
|
39 |
+
"Your servers' \"cURL SSL CA bundle\" is missing or outdated. Further information:", "Your servers' \"cURL SSL CA bundle\" is missing or outdated. Further information:"
|
40 |
+
"How to update/fix your CA cert bundle","How to update/fix your CA cert bundle"
|
41 |
+
"About cURL SSL CA certificates","About cURL SSL CA certificates"
|
42 |
+
"cURL cannot read/access the CA cert file:","cURL cannot read/access the CA cert file:"
|
43 |
+
"Error message:","Error message:"
|
44 |
+
"Google the error message","Google the error message"
|
45 |
+
"Contact your hosting provider if problems persist.","Contact your hosting provider if problems persist."
|
46 |
+
"The response from the Postcode.nl service could not be understood.","The response from the Postcode.nl service could not be understood."
|
47 |
+
"The service might be temporarily unavailable, if problems persist, please contact <a href=\"mailto:info@postcode.nl\">info@postcode.nl</a>.","The service might be temporarily unavailable, if problems persist, please contact <a href=\"mailto:info@postcode.nl\">info@postcode.nl</a>."
|
48 |
+
"Technical reason: No valid JSON was returned by the request.","Technical reason: No valid JSON was returned by the request."
|
49 |
+
"`API Secret` specified is incorrect.","`API Secret` specified is incorrect."
|
50 |
+
"`API key` specified is incorrect.","`API key` specified is incorrect."
|
51 |
+
"Authentication is incorrect.","Authentication is incorrect."
|
52 |
+
"Access is denied.","Access is denied."
|
53 |
+
"Service reported an error.","Service reported an error."
|
54 |
+
"Postcode.nl service message:","Postcode.nl service message:"
|
55 |
+
"Address API service has no problems, but the Signal API service reported an error.","Address API service has no problems, but the Signal API service reported an error."\
|
56 |
+
"The Signal service might be temporarily unavailable, if problems persist, please contact <a href=\"mailto:info@postcode.nl\">info@postcode.nl</a>.","The Signal service might be temporarily unavailable, if problems persist, please contact <a href=\"mailto:info@postcode.nl\">info@postcode.nl</a>."
|
57 |
+
"Postcode.nl API Test: ","Postcode.nl API Test: "
|
58 |
+
"Postcode.nl API Test Troubleshooting: ","Postcode.nl API Test Troubleshooting: "
|
59 |
+
"Configure your `API key` and `API secret`.","Configure your `API key` and `API secret`."
|
60 |
+
"Technical reason: Received JSON data did not contain expected data.","Technical reason: Received JSON data did not contain expected data."
|
61 |
+
"Configuration","Configuration"
|
62 |
+
"Enabled?","Enabled?"
|
63 |
+
"API key","API key"
|
64 |
+
"API secret","API secret"
|
65 |
+
"To get your Postcode.nl API key and secret, please register at <a href='https://api.postcode.nl' target='_blank'>Postcode.nl API</a>.","To get your Postcode.nl API key and secret, please register at <a href='https://api.postcode.nl' target='_blank'>Postcode.nl API</a>."
|
66 |
+
"Address API Enabled?","Address API Enabled?"
|
67 |
+
"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.","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."
|
68 |
+
"Signal API Enabled?","Signal API Enabled?"
|
69 |
+
"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.","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."
|
70 |
+
"Advanced Address API configuration","Advanced Address API configuration"
|
71 |
+
"Separate housenumber","Separate housenumber"
|
72 |
+
"If you use the second 'street' field as a separate house-number field, enable this option.","If you use the second 'street' field as a separate house-number field, enable this option."
|
73 |
+
"Separate housenumber addition","Separate housenumber addition"
|
74 |
+
"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)","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)"
|
75 |
+
"Block post office box addresses","Block post office box addresses"
|
76 |
+
"This will consider 'post office box' (postbus) addresses invalid for all validated address fields.<br /><em>(though still allowed if address is added with 'manual' checkbox)</em>","This will consider 'post office box' (postbus) addresses invalid for all validated address fields.<br /><em>(though still allowed if address is added with 'manual' checkbox)</em>"
|
77 |
+
"Always show country selector","Always show country selector"
|
78 |
+
"For webshops with a more international audience, always show the country selection box.<br /><b>Developer Note</b>: If there are other fields next to the country selector, they will be disabled.","For webshops with a more international audience, always show the country selection box.<br /><b>Developer Note</b>: If there are other fields next to the country selector, they will be disabled."
|
79 |
+
"Disable validation in admin","Disable validation in admin"
|
80 |
+
"You can use this option if you encounter problems in the admin address validation, or want to allow all addresses in the admin.","You can use this option if you encounter problems in the admin address validation, or want to allow all addresses in the admin."
|
81 |
+
"Advanced Signal API configuration","Advanced Signal API configuration"
|
82 |
+
"Development configuration","Development configuration"
|
83 |
+
"API URL","API URL"
|
84 |
+
"Enable API Showcase","Enable API Showcase"
|
85 |
+
"By enabling this option, you will see what additional information the Postcode.nl API has to offer, every time your information is enriched.<br /><em>(this is not recommended in production environments!)</em>","By enabling this option, you will see what additional information the Postcode.nl API has to offer, every time your information is enriched.<br /><em>(this is not recommended in production environments!)</em>"
|
86 |
+
"Show API Debug info","Show API Debug info"
|
87 |
+
"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 /><em>(this is not recommended in production environments!)</em>","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 /><em>(this is not recommended in production environments!)</em>"
|
app/locale/nl_NL/PostcodeNl_Api.csv
CHANGED
@@ -33,3 +33,55 @@
|
|
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."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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."
|
36 |
+
"A test connection could not be successfully completed.","Een test connectie kon niet succesvol uitgevoerd worden."
|
37 |
+
"A test connection to the API was successfully completed.","Een test connectie naar de API is succesvol tot stand gekomen."
|
38 |
+
"Your server could not connect to the Postcode.nl server.","Er kon geen connectie tot stand worden gebracht met de Postcode.nl server."
|
39 |
+
"Your servers' 'cURL SSL CA bundle' is missing or outdated. Further information:", "Deze server zijn `cURL SSL CA bundle` is niet aanwezig of verouderd. Verdere informatie:"
|
40 |
+
"How to update/fix your CA cert bundle","Hoe de `SSL CA cert bundle` te vernieuwen/configureren"
|
41 |
+
"About cURL SSL CA certificates","Over cURL SSL CA certificaten"
|
42 |
+
"cURL cannot read/access the CA cert file:","cURL kan het `CA cert` bestand niet lezen:"
|
43 |
+
"Error message:","Foutmelding:"
|
44 |
+
"Google the error message","Google de foutmelding"
|
45 |
+
"Contact your hosting provider if problems persist.","Neem contact op met uw hosting provider als het probleem aanblijft."
|
46 |
+
"The response from the Postcode.nl service could not be understood.","Het antwoord van de Postcode.nl dienst kon niet begrepen worden."
|
47 |
+
"The service might be temporarily unavailable, if problems persist, please contact <a href='mailto:info@postcode.nl'>info@postcode.nl</a>.","De dienst kan tijdelijk onbereikbaar zijn, als het probleem zich blijft voordoen, neem dan contact op met <a href='mailto:info@postcode.nl'>info@postcode.nl</a>."
|
48 |
+
"Technical reason: No valid JSON was returned by the request.","Technische reden: Geen geldige JSON data ontvangen van de dienst."
|
49 |
+
"`API Secret` specified is incorrect.","De opgegeven `API Secret` is niet correct."
|
50 |
+
"`API key` specified is incorrect.","De opgegeven `API key` is niet correct."
|
51 |
+
"Authentication is incorrect.","Authenticatie niet succesvol."
|
52 |
+
"Access is denied.","Toegang geweigerd."
|
53 |
+
"Service reported an error.","De dienst geeft een foutmelding."
|
54 |
+
"Postcode.nl service message:","Postcode.nl foutmelding:"
|
55 |
+
"Address API service has no problems, but the Signal API service reported an error.","De Adres API dienst heeft geen problemen, maar de Signaal API dienst geeft een foutmelding."
|
56 |
+
"The Signal service might be temporarily unavailable, if problems persist, please contact <a href='mailto:info@postcode.nl'>info@postcode.nl</a>.","De Signaal dienst kan tijdelijk onbereikbaar zijn, als het probleem zich blijft voordoen, neem dan contact op met <a href='mailto:info@postcode.nl'>info@postcode.nl</a>."
|
57 |
+
"Postcode.nl API Test: ","Postcode.nl API Test: "
|
58 |
+
"Postcode.nl API Test Troubleshooting: ","Postcode.nl API Test probleem informatie: "
|
59 |
+
"Configure your `API key` and `API secret`.","Configureer de `API key` en `API secret`."
|
60 |
+
"Technical reason: Received JSON data did not contain expected data.","Technische reden: Ontvangen JSON data bevatte niet verwachtte data."
|
61 |
+
"Configuration","Configuratie"
|
62 |
+
"Enabled?","Ingeschakeld?"
|
63 |
+
"API key","API key"
|
64 |
+
"API secret","API secret"
|
65 |
+
"To get your Postcode.nl API key and secret, please register at <a href='https://api.postcode.nl' target='_blank'>Postcode.nl API</a>.","Om uw Postcode.nl API key en secret te verkrijgen, registreer een account bij <a href='https://api.postcode.nl' target='_blank'>de Postcode.nl API</a>."
|
66 |
+
"Address API Enabled?","Adres API Ingeschakeld?"
|
67 |
+
"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.","De Nederlandse adres validatie via de <a href='https://api.postcode.nl/documentation/address-api-description' target='_blank'>Postcode.nl Adres API</a> is automatisch beschikbaar bij een account."
|
68 |
+
"Signal API Enabled?","Signaal API Ingeschakeld?"
|
69 |
+
"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.","Om de <a href='https://api.postcode.nl/documentation/signal-api-description' target='_blank'>Postcode.nl Signaal API</a> te gebruiken, vink de dienst aan tijdens registratie, of in je <a href='https://api.postcode.nl'>Postcode.nl API dashboard</a>."
|
70 |
+
"Advanced Address API configuration","Geavanceerde Adres API configuratie"
|
71 |
+
"Separate housenumber","Los huisnummer"
|
72 |
+
"If you use the second 'street' field as a separate house-number field, enable this option.","Als je het tweede 'straat' veld wilt gebruiken voor opslag van het huisnummer, gebruik deze optie."
|
73 |
+
"Separate housenumber addition","Los huisnummer toevoeging"
|
74 |
+
"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)","Als je het derde 'straat' veld wilt gebruiken voor opslag van de huisnummer toevoeging, gebruik deze optie. (vereist ook de 'Los huisnummer' optie)"
|
75 |
+
"Block post office box addresses","Blokkeer postbus addressen"
|
76 |
+
"This will consider 'post office box' (postbus) addresses invalid for all validated address fields.<br /><em>(though still allowed if address is added with 'manual' checkbox)</em>","Dit zorgt ervoor dat postbus addressen niet als valide worden gezien voor adresvelden.<br /><em>(dit is nog steeds toegestaan met de 'handmatige invoer' vink)</em>"
|
77 |
+
"Always show country selector","Toon altijd het land-selectie veld"
|
78 |
+
"For webshops with a more international audience, always show the country selection box.<br /><b>Developer Note</b>: If there are other fields next to the country selector, they will be disabled.","Voor webshops met een internationaal publiek.<br /><b>Ontwikkelaars notitie</b>: Als er een ander veld naast het land veld staat, is deze uitgeschakeld."
|
79 |
+
"Disable validation in admin","Schakel adres validatie uit in de admin"
|
80 |
+
"You can use this option if you encounter problems in the admin address validation, or want to allow all addresses in the admin.","Je kan deze optie gebruiken om problemen in de admin te voorkomen, of om alle adressen toe te staan."
|
81 |
+
"Advanced Signal API configuration","Geavanceerde Signaal API configuratie"
|
82 |
+
"Development configuration","Ontwikkelaars configuratie"
|
83 |
+
"API URL","API URL"
|
84 |
+
"Enable API Showcase","Schakel API Showcase in"
|
85 |
+
"By enabling this option, you will see what additional information the Postcode.nl API has to offer, every time your information is enriched.<br /><em>(this is not recommended in production environments!)</em>","Deze optie laat tijdens checkout een uitgebreide lijst van adres informatie zien.<br /><em>(deze optie is niet aan te raden voor een live webshop!)</em>"
|
86 |
+
"Show API Debug info","Toon API debug info"
|
87 |
+
"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 /><em>(this is not recommended in production environments!)</em>","Extra debug informatie wordt getoond. De Signaal API schrijft logs weg in 'var/log/postcodenl-signal.log'.<br /><em>(deze optie is niet aan te raden voor een live webshop!)</em>"
|
js/postcodenl/api/lookup.js
CHANGED
@@ -196,6 +196,10 @@ document.observe("dom:loaded", PCNL_START_FUNCTION = function()
|
|
196 |
else {
|
197 |
html += '<dt>'+ name.escapeHTML() +'</dt><dd>'+ this.getFieldListHtml(data[prop]) +'</dd>';
|
198 |
}
|
|
|
|
|
|
|
|
|
199 |
}
|
200 |
html += '</dl>';
|
201 |
} else {
|
@@ -325,24 +329,18 @@ document.observe("dom:loaded", PCNL_START_FUNCTION = function()
|
|
325 |
*/
|
326 |
updatePostcodeLookup: function(data, housenumber_addition, housenumber_addition_select, prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4, event)
|
327 |
{
|
328 |
-
if (PCNLAPI_CONFIG.showcase)
|
329 |
{
|
330 |
if ($(prefix +'showcase'))
|
331 |
$(prefix +'showcase').remove();
|
332 |
|
333 |
var info = this.getFieldListHtml(data.showcaseResponse, 'pcnl-showcase');
|
334 |
|
335 |
-
var map = '';
|
336 |
-
if (data.showcaseResponse.longitude && data.showcaseResponse.latitude)
|
337 |
-
{
|
338 |
-
map = '<iframe frameborder="0" scrolling="no" marginheight="0" marginwidth="0" class="map" src="http://maps.google.com/maps?t=h&q='+ data.showcaseResponse.latitude +','+ data.showcaseResponse.longitude +'+(Location found)&z=19&output=embed&iwloc=near"></iframe>';
|
339 |
-
}
|
340 |
-
|
341 |
if ($(prefix + street1).up(this.parentElementType))
|
342 |
{
|
343 |
if (this.parentElementType == 'li')
|
344 |
{
|
345 |
-
$(prefix + street1).up(this.parentElementType).insert({before: '<li id="' + prefix +'showcase" class="wide"><div class="input-box"><h4 class="pcnl-showcase">'+ PCNLAPI_CONFIG.translations.apiShowcase.escapeHTML() +'</h4>'+
|
346 |
}
|
347 |
else if (this.parentElementType == 'tr')
|
348 |
{
|
196 |
else {
|
197 |
html += '<dt>'+ name.escapeHTML() +'</dt><dd>'+ this.getFieldListHtml(data[prop]) +'</dd>';
|
198 |
}
|
199 |
+
|
200 |
+
if (prop == 'longitude') {
|
201 |
+
html += '<dt>See in map</dt><dd><a href="https://www.google.nl/maps/?q=loc:'+ data.latitude +','+ data.longitude +'">Google maps</a></dd>';
|
202 |
+
}
|
203 |
}
|
204 |
html += '</dl>';
|
205 |
} else {
|
329 |
*/
|
330 |
updatePostcodeLookup: function(data, housenumber_addition, housenumber_addition_select, prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4, event)
|
331 |
{
|
332 |
+
if (PCNLAPI_CONFIG.showcase && data.showcaseResponse)
|
333 |
{
|
334 |
if ($(prefix +'showcase'))
|
335 |
$(prefix +'showcase').remove();
|
336 |
|
337 |
var info = this.getFieldListHtml(data.showcaseResponse, 'pcnl-showcase');
|
338 |
|
|
|
|
|
|
|
|
|
|
|
|
|
339 |
if ($(prefix + street1).up(this.parentElementType))
|
340 |
{
|
341 |
if (this.parentElementType == 'li')
|
342 |
{
|
343 |
+
$(prefix + street1).up(this.parentElementType).insert({before: '<li id="' + prefix +'showcase" class="wide"><div class="input-box"><h4 class="pcnl-showcase">'+ PCNLAPI_CONFIG.translations.apiShowcase.escapeHTML() +'</h4>'+ info + '</div></li>'});
|
344 |
}
|
345 |
else if (this.parentElementType == 'tr')
|
346 |
{
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>PostcodeNl_Api</name>
|
4 |
-
<version>1.2.
|
5 |
<stability>stable</stability>
|
6 |
<license>Simplified BSD License</license>
|
7 |
<channel>community</channel>
|
@@ -19,15 +19,17 @@ Also includes the free Postcode.nl Signal API service to validate and enrich ord
|
|
19 |

|
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:
|
22 |
-
-
|
|
|
|
|
23 |

|
24 |
Fixes:
|
25 |
-
- Fixed
|
26 |
</notes>
|
27 |
<authors><author><name>Postcode.nl Technical Support</name><user>TechPostcodeNl</user><email>tech@postcode.nl</email></author></authors>
|
28 |
-
<date>2015-06-
|
29 |
-
<time>
|
30 |
-
<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="
|
31 |
<compatible/>
|
32 |
<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>
|
33 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>PostcodeNl_Api</name>
|
4 |
+
<version>1.2.3.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>Simplified BSD License</license>
|
7 |
<channel>community</channel>
|
19 |

|
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:
|
22 |
+
- Added automatic connection testing
|
23 |
+
- Improved connection debugging assistance
|
24 |
+
- Added Dutch translations for admin
|
25 |

|
26 |
Fixes:
|
27 |
+
- Fixed error when using showcase option
|
28 |
</notes>
|
29 |
<authors><author><name>Postcode.nl Technical Support</name><user>TechPostcodeNl</user><email>tech@postcode.nl</email></author></authors>
|
30 |
+
<date>2015-06-29</date>
|
31 |
+
<time>08:47:02</time>
|
32 |
+
<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="820d2fed4cbc0d1dbd8f197a78e549f1"/></dir><dir name="Model"><file name="Observer.php" hash="d394877fb8340673dbb78751008cae5f"/></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="169658dbcaec550a4c11820e0d620ecf"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="5d518aeaeae028b6299c7cf3d6e54f60"/><file name="config.xml" hash="2dd73976d793375ed9544024c815892d"/><file name="system.xml" hash="429eb397ed1fc622b970de3378ba4d77"/></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="d2408958337c27b6fe9a33630e2d1714"/></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="f70ab07d4fbee85d3de8d15decff77d2"/></dir><dir name="nl_NL"><file name="PostcodeNl_Api.csv" hash="1f14faf448152ce546215f14cb4d66f8"/></dir></target><target name="mageweb"><dir name="js"><dir name="postcodenl"><dir name="api"><file name="lookup.js" hash="eff8624d36a501f8deb6416e06dc2c54"/></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="ea6b231d66e2ebfb2f9f1431abac0382"/></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>
|
33 |
<compatible/>
|
34 |
<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>
|
35 |
</package>
|
skin/frontend/base/default/postcodenl/api/css/lookup.css
CHANGED
@@ -70,15 +70,6 @@ dl.pcnl-showcase, dl.pcnl-debug {
|
|
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 |
}
|
@@ -103,14 +94,6 @@ div.checkoutcontainer div.pcnl-input-housenumber select.pcnl-input-text-half {
|
|
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 {
|
70 |
position: relative;
|
71 |
}
|
72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
dl.pcnl-showcase dt, dl.pcnl-debug dt {
|
74 |
font-weight: bold;
|
75 |
}
|
94 |
div.checkoutcontainer .pcnl-info-text {
|
95 |
width: 85%;
|
96 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
|
98 |
/* OneStepCheckout.com */
|
99 |
.onestepcheckout-index-index .group-select li .input-postcode .input-box {
|