# Loki Checkout Postcode Nl

**This module supplies integration with the Postcode EU API to allow for address validation within The Netherlands.**

No Dutch shop is complete without proper address validation. This module integrates the Postcode EU API into the LokiCheckout. Once enabled, a customer is able to enter a postcode and house number. Next, the autocompletion logic fills in the streetname, city and region (which are disabled until that moment).

If the autocompletion is not working because the API is down, the "Use autocompletion" flag is automatically disabled. A customer is also able to turn off autocompletion. When autocompletion is disabled, the fields that were disabled are enabled.

## Autocompletion logic
When a valid postcode and house number are supplied, which leads into various house number additions to be selected, the **Addition** field is automatically switched from being a text field into a select field.

When a valid postcode and house number are supplied, however there is no addition, the addition is automatically wiped from the quote. The select field becomes again a text field.

When an exception occurs, usually when the postcode and house number do not lead into a valid combination, the addition, streetname, city and region are wiped from the quote.

## Configuration settings

To use the Postcode EU API, you will need to register for API credentials at [www.postcode.eu](https://www.postcode.eu/). The configuration settings in the Magento backend allow you to quickly validate these credentials as well.

## Debugging

If shit hits the fan, it is nice to enable the **Debug** flag. With this, a yellow box is shown with the raw API data response (a JSON object) and some other data that might be useful.
