PostcodeNl_Api - Version 1.2.1.0

Version Notes

Features:
- Add support for IP address checking and Dutch address checking with the Postcode.nl Signal API
- Added 'validation-passed' and 'validation-failed' css classes to checkout input fields, support for 'validate-immediate'
- Added provisional support for the Lotusbreath One Step Checkout extension

Fixes:
- Fix for language files installation via modman/composer

Download this release

Release Info

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


Code changes from version 1.2.0.1 to 1.2.1.0

app/code/community/PostcodeNl/Api/Helper/Data.php CHANGED
@@ -105,7 +105,7 @@ class PostcodeNl_Api_Helper_Data extends Mage_Core_Helper_Abstract
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
@@ -268,11 +268,11 @@ class PostcodeNl_Api_Helper_Data extends Mage_Core_Helper_Abstract
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
  */
@@ -289,9 +289,9 @@ class PostcodeNl_Api_Helper_Data extends Mage_Core_Helper_Abstract
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
  */
@@ -357,6 +357,9 @@ class PostcodeNl_Api_Helper_Data extends Mage_Core_Helper_Abstract
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
 
@@ -374,6 +377,10 @@ class PostcodeNl_Api_Helper_Data extends Mage_Core_Helper_Abstract
374
  'country' => $order->getBillingAddress()->getCountryId(),
375
  ),
376
  ),
 
 
 
 
377
  'transaction' => array(
378
  'internalId' => $order->getIncrementId(),
379
  'deliveryAddress' => array(
@@ -388,9 +395,45 @@ class PostcodeNl_Api_Helper_Data extends Mage_Core_Helper_Abstract
388
  ),
389
  );
390
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
391
  return $this->checkSignal($signalCheck);
392
  }
393
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
394
  protected function _getStoreConfig($path)
395
  {
396
  return Mage::getStoreConfig($path);
105
  }
106
 
107
  /**
108
+ * Lookup information about a Dutch address by postcode, house number, and house number addition
109
  *
110
  * @param string $postcode
111
  * @param string $houseNumber
268
  }
269
 
270
  /**
271
+ * Split a house number addition from a house number.
272
  * Examples: "123 2", "123 rood", "123a", "123a4", "123-a", "123 II"
273
+ * (the official notation is to separate the house number and addition with a single space)
274
  *
275
+ * @param string $houseNumber House number input
276
  *
277
  * @return array Split 'houseNumber' and 'houseNumberAddition'
278
  */
289
  }
290
 
291
  /**
292
+ * Split a street name, house number and house number addition from a text lines containing a street and house number information.
293
  *
294
+ * @param array $streetData Lines of street data
295
  *
296
  * @return array Array containing 'street', 'houseNumber' and 'houseNumberAddition'
297
  */
357
  // No customer might be available if this is an order status change
358
  $hasCustomer = ($order->getCustomer() !== null);
359
 
360
+ // Note if this is executed as an admin, then do not send access details, as that might muddy the customer info
361
+ $isAdmin = Mage::app()->getStore()->isAdmin();
362
+
363
  // Only send phonenumber if it is at least 5 characters long
364
  $phoneNumber = Mage::helper('core/string')->strlen($order->getBillingAddress()->getTelephone()) >= 5 ? $order->getBillingAddress()->getTelephone() : null;
365
 
377
  'country' => $order->getBillingAddress()->getCountryId(),
378
  ),
379
  ),
380
+ 'access' => array(
381
+ 'ipAddress' => $isAdmin ? null : Mage::helper('core/http')->getRemoteAddr(),
382
+ 'additionalIpAddresses' => array(),
383
+ ),
384
  'transaction' => array(
385
  'internalId' => $order->getIncrementId(),
386
  'deliveryAddress' => array(
395
  ),
396
  );
397
 
398
+ // Retrieve quote for registered remote IP / proxy IP (they are registered at session start)
399
+ $quoteId = $order->getQuoteId();
400
+ $quote = Mage::getModel('sales/quote')->load($quoteId);
401
+ if ($quote)
402
+ {
403
+ $signalCheck['access'] = $this->_addAccessIpAddress($signalCheck['access'], $quote->getRemoteIp());
404
+ $signalCheck['access'] = $this->_addAccessIpAddress($signalCheck['access'], $quote->getXForwardedFor());
405
+ }
406
+ // Register current forwarded-for IP address (if not admin)
407
+ if (!$isAdmin)
408
+ {
409
+ $forwardedFor = Mage::app()->getRequest()->getServer('HTTP_X_FORWARDED_FOR');
410
+ $signalCheck['access'] = $this->_addAccessIpAddress($signalCheck['access'], $forwardedFor);
411
+ }
412
+
413
  return $this->checkSignal($signalCheck);
414
  }
415
 
416
+ protected function _addAccessIpAddress($access, $inputIp)
417
+ {
418
+ if ($inputIp === '' || $inputIp === null || $inputIp === false)
419
+ return $access;
420
+
421
+ // input might be multiple IPs (from X-Forwarded-For, for example)
422
+ if (strpos($inputIp, ',') !== false)
423
+ {
424
+ $inputIp = array_map('trim', explode(',', $inputIp));
425
+
426
+ foreach ($inputIp as $ip)
427
+ $access = $this->_addAccessIpAddress($access, $ip);
428
+ }
429
+ else if (filter_var($inputIp, FILTER_VALIDATE_IP) && $inputIp !== $access['ipAddress'] && !in_array($inputIp, $access['additionalIpAddresses']))
430
+ {
431
+ $access['additionalIpAddresses'][] = $inputIp;
432
+ }
433
+
434
+ return $access;
435
+ }
436
+
437
  protected function _getStoreConfig($path)
438
  {
439
  return Mage::getStoreConfig($path);
app/code/community/PostcodeNl/Api/data/postcodenl_api_setup/data-upgrade-1.0.8.0-1.1.0.0.php CHANGED
@@ -12,7 +12,7 @@ $serviceNeverHideCountry = Mage::getStoreConfig('postcodenl/config/never_hide_co
12
  $serviceUseStreet2AsHousenumber = Mage::getStoreConfig('postcodenl/config/use_street2_as_housenumber');
13
 
14
  // Only do update, if we actually have old configuration (secret being most important to check)
15
- if ($serviceSecret !== null)
16
  {
17
  // Set new basic configuration
18
  $config->saveConfig('postcodenl_api/config/enabled', $serviceEnabled, 'default', 0);
12
  $serviceUseStreet2AsHousenumber = Mage::getStoreConfig('postcodenl/config/use_street2_as_housenumber');
13
 
14
  // Only do update, if we actually have old configuration (secret being most important to check)
15
+ if ($serviceSecret !== '')
16
  {
17
  // Set new basic configuration
18
  $config->saveConfig('postcodenl_api/config/enabled', $serviceEnabled, 'default', 0);
app/code/community/PostcodeNl/Api/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <PostcodeNl_Api>
5
- <version>1.2.0.1</version>
6
  </PostcodeNl_Api>
7
  </modules>
8
  <frontend>
2
  <config>
3
  <modules>
4
  <PostcodeNl_Api>
5
+ <version>1.2.1.0</version>
6
  </PostcodeNl_Api>
7
  </modules>
8
  <frontend>
app/design/frontend/base/default/layout/postcodenl/api/lookup.xml CHANGED
@@ -166,4 +166,14 @@
166
  <block type="postcodenl_api/jsinit" name="postcodenl.jsinit" template="postcodenl/api/jsinit.phtml" />
167
  </reference>
168
  </mastercheckout_index_index>
 
 
 
 
 
 
 
 
 
 
169
  </layout>
166
  <block type="postcodenl_api/jsinit" name="postcodenl.jsinit" template="postcodenl/api/jsinit.phtml" />
167
  </reference>
168
  </mastercheckout_index_index>
169
+ <!-- For `Lotusbreath One Step Checkout` -->
170
+ <lotusbreath_onestepcheckout_index_index>
171
+ <reference name="head">
172
+ <action method="addCss" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/css/lookup.css</script></action>
173
+ <action method="addJs" ifconfig="postcodenl_api/config/enabled"><script>postcodenl/api/lookup.js</script></action>
174
+ </reference>
175
+ <reference name="content">
176
+ <block type="postcodenl_api/jsinit" name="postcodenl.jsinit" template="postcodenl/api/jsinit.phtml" />
177
+ </reference>
178
+ </lotusbreath_onestepcheckout_index_index>
179
  </layout>
js/postcodenl/api/lookup.js CHANGED
@@ -78,6 +78,7 @@ document.observe("dom:loaded", PCNL_START_FUNCTION = function()
78
  'Quick One Page Checkout (by KAM)': 18,
79
  'MAGExtended MasterCheckout': 19,
80
  'Customer Address Form': 20,
 
81
  },
82
  enrichHint: null,
83
 
@@ -120,16 +121,19 @@ document.observe("dom:loaded", PCNL_START_FUNCTION = function()
120
  if (advice)
121
  {
122
  Validation.hideAdvice($(prefix +'postcode_housenumber'), advice, 'invalid-postcode');
 
123
  }
124
  var advice = Validation.getAdvice('invalid-postcode', $(prefix +'postcode_input'));
125
  if (advice)
126
  {
127
  Validation.hideAdvice($(prefix +'postcode_input'), advice, 'invalid-postcode');
 
128
  }
129
  var advice = Validation.getAdvice('address-is-postofficebox', $(prefix +'postcode_input'));
130
  if (advice)
131
  {
132
  Validation.hideAdvice($(prefix +'postcode_input'), advice, 'address-is-postofficebox');
 
133
  }
134
  if ($(prefix +'postcode_housenumber_addition'))
135
  {
@@ -137,6 +141,7 @@ document.observe("dom:loaded", PCNL_START_FUNCTION = function()
137
  if (additionAdvice)
138
  {
139
  Validation.hideAdvice($(prefix +'postcode_housenumber_addition'), additionAdvice, 'invalid-addition');
 
140
  }
141
  }
142
  },
@@ -429,6 +434,8 @@ document.observe("dom:loaded", PCNL_START_FUNCTION = function()
429
  $(prefix + 'postcode_output').update((data.street +' '+ data.houseNumber +' '+ (data.houseNumberAddition ? data.houseNumberAddition : housenumber_addition)).trim() + "<br>" + data.postcode + " " + data.city);
430
  }
431
 
 
 
432
  // Handle all housenumber addition possiblities
433
  if (data.houseNumberAddition == null && (housenumber_addition_select == housenumber_addition || (housenumber_addition_select == '__none__' && housenumber_addition == '')))
434
  {
@@ -444,6 +451,13 @@ document.observe("dom:loaded", PCNL_START_FUNCTION = function()
444
  {
445
  newAdvice = Validation.createAdvice('invalid-addition', $(prefix +'postcode_housenumber_addition'), false, (housenumber_addition != '' ? PCNLAPI_CONFIG.translations.houseNumberAdditionUnknown.replace('{addition}', housenumber_addition) : PCNLAPI_CONFIG.translations.houseNumberAdditionRequired));
446
  Validation.showAdvice($(prefix +'postcode_housenumber_addition'), newAdvice, 'invalid-addition');
 
 
 
 
 
 
 
447
  }
448
  }
449
  else if (data.houseNumberAddition == null)
@@ -454,12 +468,17 @@ document.observe("dom:loaded", PCNL_START_FUNCTION = function()
454
 
455
  newAdvice = Validation.createAdvice('invalid-addition', $(prefix +'postcode_housenumber_addition'), false, (housenumber_addition != '' ? PCNLAPI_CONFIG.translations.houseNumberAdditionUnknown.replace('{addition}', housenumber_addition) : PCNLAPI_CONFIG.translations.houseNumberAdditionRequired));
456
  Validation.showAdvice($(prefix +'postcode_housenumber_addition'), newAdvice, 'invalid-addition');
 
 
 
457
  }
458
  else if (data.houseNumberAdditions.length > 1 || (data.houseNumberAdditions.length == 1 && data.houseNumberAdditions[0] != ''))
459
  {
460
  // Address has multiple housenumber additions
461
  var additionSelect = this.createPostcodeHouseNumberAddition(prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4, data.houseNumberAdditions);
462
  additionSelect.setValue(data.houseNumberAddition);
 
 
463
  }
464
  else
465
  {
@@ -471,6 +490,15 @@ document.observe("dom:loaded", PCNL_START_FUNCTION = function()
471
  {
472
  newAdvice = Validation.createAdvice('address-is-postofficebox', $(prefix + 'postcode_input'), false, PCNLAPI_CONFIG.translations.postOfficeBoxNotAllowed);
473
  Validation.showAdvice($(prefix + postcodeFieldId), newAdvice, 'address-is-postofficebox');
 
 
 
 
 
 
 
 
 
474
  }
475
  }
476
  else if (data.message !== undefined)
@@ -479,9 +507,12 @@ document.observe("dom:loaded", PCNL_START_FUNCTION = function()
479
  if (typeof data.useManual !== 'undefined' && data.useManual === true) {
480
  $(prefix + 'postcode_input_checkbox').click();
481
  }
 
482
 
483
- newAdvice = Validation.createAdvice('invalid-postcode', $(prefix + (data.messageTarget == 'postcode' ? 'postcode_input' : 'postcode_housenumber')), false, data.message);
484
- Validation.showAdvice($(prefix +'postcode_housenumber'), newAdvice, 'invalid-postcode');
 
 
485
 
486
  this.removeHousenumberAddition(prefix);
487
  }
@@ -489,8 +520,12 @@ document.observe("dom:loaded", PCNL_START_FUNCTION = function()
489
  {
490
  // Address check did not return an error or a postcode result (something else wrong)
491
 
492
- newAdvice = Validation.createAdvice('invalid-postcode', $(prefix + (data.messageTarget == 'postcode' ? 'postcode_input' : 'postcode_housenumber')), false, '');
493
- Validation.showAdvice($(prefix +'postcode_housenumber'), newAdvice, 'invalid-postcode');
 
 
 
 
494
 
495
  this.removeHousenumberAddition(prefix);
496
  }
@@ -918,6 +953,7 @@ document.observe("dom:loaded", PCNL_START_FUNCTION = function()
918
  // + Fire Checkout
919
  // + Quick One Page Checkout (by KAM)
920
  // + MAGExtended MasterCheckout
 
921
 
922
  if ($(document.body).hasClassName('firecheckout-index-index'))
923
  this.enrichType = 'Fire Checkout';
@@ -925,6 +961,8 @@ document.observe("dom:loaded", PCNL_START_FUNCTION = function()
925
  this.enrichType = 'Quick One Page Checkout (by KAM)';
926
  else if ($(document.body).hasClassName('mastercheckout-index-index'))
927
  this.enrichType = 'MAGExtended MasterCheckout';
 
 
928
  else if ($(document.body).hasClassName('checkout-onepage-index'))
929
  this.enrichType = 'Basic';
930
  else if ($(document.body).hasClassName('customer-address-form'))
@@ -957,6 +995,10 @@ document.observe("dom:loaded", PCNL_START_FUNCTION = function()
957
  this.showFields([prefix +'postcode_input', prefix +'postcode_housenumber', prefix +'postcode_housenumber_addition', prefix + 'postcode_input:info-text', prefix + 'postcode_input_checkbox']);
958
  }
959
 
 
 
 
 
960
  this.toggleAddressFields(prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4);
961
 
962
  // Previous value was not NL, switch manual off
@@ -1045,6 +1087,36 @@ document.observe("dom:loaded", PCNL_START_FUNCTION = function()
1045
  }
1046
  },
1047
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1048
  /**
1049
  * Toggle address field visibility, to be in line with the value of the 'manual input' checkbox.
1050
  */
@@ -1166,6 +1238,8 @@ document.observe("dom:loaded", PCNL_START_FUNCTION = function()
1166
 
1167
  $(prefix +'postcode_housenumber_addition').observe('change', function(e) { pcnlapi.lookupPostcode(prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4, e); });
1168
 
 
 
1169
  return $(prefix +'postcode_housenumber_addition');
1170
  },
1171
 
78
  'Quick One Page Checkout (by KAM)': 18,
79
  'MAGExtended MasterCheckout': 19,
80
  'Customer Address Form': 20,
81
+ 'Lotusbreath One Step Checkout': 21
82
  },
83
  enrichHint: null,
84
 
121
  if (advice)
122
  {
123
  Validation.hideAdvice($(prefix +'postcode_housenumber'), advice, 'invalid-postcode');
124
+ $(prefix +'postcode_housenumber').removeClassName('validation-failed');
125
  }
126
  var advice = Validation.getAdvice('invalid-postcode', $(prefix +'postcode_input'));
127
  if (advice)
128
  {
129
  Validation.hideAdvice($(prefix +'postcode_input'), advice, 'invalid-postcode');
130
+ $(prefix +'postcode_input').removeClassName('validation-failed');
131
  }
132
  var advice = Validation.getAdvice('address-is-postofficebox', $(prefix +'postcode_input'));
133
  if (advice)
134
  {
135
  Validation.hideAdvice($(prefix +'postcode_input'), advice, 'address-is-postofficebox');
136
+ $(prefix +'postcode_input').removeClassName('validation-failed');
137
  }
138
  if ($(prefix +'postcode_housenumber_addition'))
139
  {
141
  if (additionAdvice)
142
  {
143
  Validation.hideAdvice($(prefix +'postcode_housenumber_addition'), additionAdvice, 'invalid-addition');
144
+ $(prefix +'postcode_housenumber_addition').removeClassName('validation-failed');
145
  }
146
  }
147
  },
434
  $(prefix + 'postcode_output').update((data.street +' '+ data.houseNumber +' '+ (data.houseNumberAddition ? data.houseNumberAddition : housenumber_addition)).trim() + "<br>" + data.postcode + " " + data.city);
435
  }
436
 
437
+ var hasAdvice = false;
438
+
439
  // Handle all housenumber addition possiblities
440
  if (data.houseNumberAddition == null && (housenumber_addition_select == housenumber_addition || (housenumber_addition_select == '__none__' && housenumber_addition == '')))
441
  {
451
  {
452
  newAdvice = Validation.createAdvice('invalid-addition', $(prefix +'postcode_housenumber_addition'), false, (housenumber_addition != '' ? PCNLAPI_CONFIG.translations.houseNumberAdditionUnknown.replace('{addition}', housenumber_addition) : PCNLAPI_CONFIG.translations.houseNumberAdditionRequired));
453
  Validation.showAdvice($(prefix +'postcode_housenumber_addition'), newAdvice, 'invalid-addition');
454
+ $(prefix +'postcode_housenumber_addition').removeClassName('validation-passed');
455
+ $(prefix +'postcode_housenumber_addition').addClassName('validation-failed');
456
+ hasAdvice = true;
457
+ }
458
+ else
459
+ {
460
+ $(prefix + 'postcode_housenumber_addition').addClassName('validation-passed');
461
  }
462
  }
463
  else if (data.houseNumberAddition == null)
468
 
469
  newAdvice = Validation.createAdvice('invalid-addition', $(prefix +'postcode_housenumber_addition'), false, (housenumber_addition != '' ? PCNLAPI_CONFIG.translations.houseNumberAdditionUnknown.replace('{addition}', housenumber_addition) : PCNLAPI_CONFIG.translations.houseNumberAdditionRequired));
470
  Validation.showAdvice($(prefix +'postcode_housenumber_addition'), newAdvice, 'invalid-addition');
471
+ $(prefix +'postcode_housenumber_addition').removeClassName('validation-passed');
472
+ $(prefix +'postcode_housenumber_addition').addClassName('validation-failed');
473
+ hasAdvice = true;
474
  }
475
  else if (data.houseNumberAdditions.length > 1 || (data.houseNumberAdditions.length == 1 && data.houseNumberAdditions[0] != ''))
476
  {
477
  // Address has multiple housenumber additions
478
  var additionSelect = this.createPostcodeHouseNumberAddition(prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4, data.houseNumberAdditions);
479
  additionSelect.setValue(data.houseNumberAddition);
480
+
481
+ $(prefix + 'postcode_housenumber_addition').addClassName('validation-passed');
482
  }
483
  else
484
  {
490
  {
491
  newAdvice = Validation.createAdvice('address-is-postofficebox', $(prefix + 'postcode_input'), false, PCNLAPI_CONFIG.translations.postOfficeBoxNotAllowed);
492
  Validation.showAdvice($(prefix + postcodeFieldId), newAdvice, 'address-is-postofficebox');
493
+ $(prefix + postcodeFieldId).removeClassName('validation-passed');
494
+ $(prefix + postcodeFieldId).addClassName('validation-failed');
495
+ hasAdvice = true;
496
+ }
497
+
498
+ if (!hasAdvice)
499
+ {
500
+ $(prefix + postcodeFieldId).addClassName('validation-passed');
501
+ $(prefix + 'postcode_housenumber').addClassName('validation-passed');
502
  }
503
  }
504
  else if (data.message !== undefined)
507
  if (typeof data.useManual !== 'undefined' && data.useManual === true) {
508
  $(prefix + 'postcode_input_checkbox').click();
509
  }
510
+ var target = (data.messageTarget == 'postcode' ? 'postcode_input' : 'postcode_housenumber');
511
 
512
+ newAdvice = Validation.createAdvice('invalid-postcode', $(prefix + target), false, data.message);
513
+ Validation.showAdvice($(prefix + target), newAdvice, 'invalid-postcode');
514
+ $(prefix + target).removeClassName('validation-passed');
515
+ $(prefix + target).addClassName('validation-failed');
516
 
517
  this.removeHousenumberAddition(prefix);
518
  }
520
  {
521
  // Address check did not return an error or a postcode result (something else wrong)
522
 
523
+ var target = (data.messageTarget == 'postcode' ? 'postcode_input' : 'postcode_housenumber');
524
+
525
+ newAdvice = Validation.createAdvice('invalid-postcode', $(prefix + target), false, '');
526
+ Validation.showAdvice($(prefix + target), newAdvice, 'invalid-postcode');
527
+ $(prefix + target).removeClassName('validation-passed');
528
+ $(prefix + target).addClassName('validation-failed');
529
 
530
  this.removeHousenumberAddition(prefix);
531
  }
953
  // + Fire Checkout
954
  // + Quick One Page Checkout (by KAM)
955
  // + MAGExtended MasterCheckout
956
+ // + Lotusbreath One Step Checkout
957
 
958
  if ($(document.body).hasClassName('firecheckout-index-index'))
959
  this.enrichType = 'Fire Checkout';
961
  this.enrichType = 'Quick One Page Checkout (by KAM)';
962
  else if ($(document.body).hasClassName('mastercheckout-index-index'))
963
  this.enrichType = 'MAGExtended MasterCheckout';
964
+ else if ($(document.body).hasClassName('lotusbreath-onestepcheckout-index-index'))
965
+ this.enrichType = 'Lotusbreath One Step Checkout';
966
  else if ($(document.body).hasClassName('checkout-onepage-index'))
967
  this.enrichType = 'Basic';
968
  else if ($(document.body).hasClassName('customer-address-form'))
995
  this.showFields([prefix +'postcode_input', prefix +'postcode_housenumber', prefix +'postcode_housenumber_addition', prefix + 'postcode_input:info-text', prefix + 'postcode_input_checkbox']);
996
  }
997
 
998
+ this.observeImmediate(prefix, 'postcode_input');
999
+ this.observeImmediate(prefix, 'postcode_housenumber');
1000
+ this.observeImmediate(prefix, 'postcode_input_checkbox');
1001
+
1002
  this.toggleAddressFields(prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4);
1003
 
1004
  // Previous value was not NL, switch manual off
1087
  }
1088
  },
1089
 
1090
+ /**
1091
+ * Try to see if our created fields need to be observed by the billing/shipping form
1092
+ */
1093
+ observeImmediate: function(prefix, formElement)
1094
+ {
1095
+ var form;
1096
+ if (prefix.substring(0, 7) == 'billing' && (typeof billingForm != 'undefined'))
1097
+ form = billingForm;
1098
+ if (prefix.substring(0, 8) == 'shipping' && (typeof shippingForm != 'undefined'))
1099
+ form = shippingForm;
1100
+
1101
+ if (!form || !form.validator.options.immediate)
1102
+ return;
1103
+
1104
+ var input = $(prefix + formElement);
1105
+
1106
+ if (input.tagName.toLowerCase() == 'select')
1107
+ {
1108
+ Event.observe(input, 'blur', form.validator.onChange.bindAsEventListener(form.validator));
1109
+ }
1110
+ if (input.type.toLowerCase() == 'radio' || input.type.toLowerCase() == 'checkbox')
1111
+ {
1112
+ Event.observe(input, 'click', form.validator.onChange.bindAsEventListener(form.validator));
1113
+ }
1114
+ else
1115
+ {
1116
+ Event.observe(input, 'change', form.validator.onChange.bindAsEventListener(form.validator));
1117
+ }
1118
+ },
1119
+
1120
  /**
1121
  * Toggle address field visibility, to be in line with the value of the 'manual input' checkbox.
1122
  */
1238
 
1239
  $(prefix +'postcode_housenumber_addition').observe('change', function(e) { pcnlapi.lookupPostcode(prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4, e); });
1240
 
1241
+ this.observeImmediate(prefix, 'postcode_housenumber_addition');
1242
+
1243
  return $(prefix +'postcode_housenumber_addition');
1244
  },
1245
 
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>PostcodeNl_Api</name>
4
- <version>1.2.0.1</version>
5
  <stability>stable</stability>
6
  <license>Simplified BSD License</license>
7
  <channel>community</channel>
@@ -19,14 +19,17 @@ Also includes the free Postcode.nl Signal API service to validate and enrich ord
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
- - Installation bug fixed from v1.2.0.0&#xD;
 
 
 
25
  </notes>
26
  <authors><author><name>Postcode.nl Technical Support</name><user>TechPostcodeNl</user><email>tech@postcode.nl</email></author></authors>
27
- <date>2014-12-05</date>
28
- <time>10:36:50</time>
29
- <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="442f8143b6df85c6444de891021cdc53"/><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><target name="mageetc"><dir name="modules"><file name="PostcodeNl_Api.xml" hash="feeaf95128ffe4ad109ed8b0b8bc85ab"/></dir></target></contents>
30
  <compatible/>
31
  <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>
32
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>PostcodeNl_Api</name>
4
+ <version>1.2.1.0</version>
5
  <stability>stable</stability>
6
  <license>Simplified BSD License</license>
7
  <channel>community</channel>
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
+ - Add support for IP address checking and Dutch address checking with the Postcode.nl Signal API&#xD;
23
+ - Added 'validation-passed' and 'validation-failed' css classes to checkout input fields, support for 'validate-immediate'&#xD;
24
+ - Added provisional support for the Lotusbreath One Step Checkout extension&#xD;
25
+ &#xD;
26
+ Fixes:&#xD;
27
+ - Fix for language files installation via modman/composer&#xD;
28
  </notes>
29
  <authors><author><name>Postcode.nl Technical Support</name><user>TechPostcodeNl</user><email>tech@postcode.nl</email></author></authors>
30
+ <date>2015-01-13</date>
31
+ <time>17:02:04</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="c11562e3bbed91822894e2511560314c"/></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="169658dbcaec550a4c11820e0d620ecf"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="5d518aeaeae028b6299c7cf3d6e54f60"/><file name="config.xml" hash="6b18b78fecda7f26eac85e18893d4eab"/><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="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="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="7f3c68201b37dde8552f0a4821f727a8"/></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><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>