Automatic EFTPOS Address Resolution is an optional configuration in your POS’s EFTPOS Settings screen.
When turned on, the client library will automatically try to resolve the address of the EFTPOS based on the supplied Serial-Number.
Automatic Address resolution solves 2 problems:
- Helps with recovery when the local IP address of an Eftpos changes due to underlying network circumstances
Before pairing (i.e. in the UNPAIRED state), the address will automatically be resolved when the user clicks the Save button.
After pairing, if the address of the EFTPOS changes due to a networking condition, the client library will detect this and update the address accordingly.
The SPI Client library will inform the POS code via a callback whenever the address is set/changed, so that the POS can persist it across restarts, together with the rest of the settings on this screen.
The Auto Address Resolution feature requires internet access. However it is only used in the UNPAIRED state or if the client library thinks that the address might have changed. It is NOT used in the normal happy path operation. The POS is still required to persist the last known EFTPOS address and inject it into the client library at startup.
If internet access is not available before pairing, the address will not be automatically filled in. The user will have to untick the auto box and enter it manually.
If internet access is not available after pairing when the client library is trying to recover from an IP address change, the recovery will not be possible until the internet connection is available again, or until the user goes into the settings screen and changes the address manually.
For advanced network setups, we still recommend to configure the local network router to reserve a static IP address for the EFTPOS terminal, and for the automatic setting to be left OFF. The EFTPOS should still be left in DHCP mode. It is the local network router that will always assign the same address to the EFTPOS. This configuration remains the most robust solution and does not require an internet connection.
This is required so the client library can use Secure WebSockets (WSS) to talk to the EFTPOS, thus preventing the browser from complaining about and blocking “mixed content”.
In this mode, the POS will need an internet connection because the operating system of the POS will use the public DNS system to resolve the fully qualified domain. (This could technically be worked around if the POS administrator could hardcode the mapping in the host operating system, for example in the traditional hosts file)
For existing POS installations upgrading to a new version that uses the auto-resolution, the auto-mode should be defaulted to being OFF. This is because older installations would not have had the concept of Serial-Number. To take advantage of this feature after the upgrade, the user would have to go to the settings screen and change the configuration accordingly. We recommend that the POS team tests upgrades scenarios properly to make sure the user experience is seamless.
There are two kinds of EFTPOS devices:
A. Test devices that only do test transactions with test cards and are typically only used while developing the integration
B. Production devices that work with real cards and make real transactions used by real merchants.
These two environments are totally segregated.
Since the auto-address resolution feature uses a service in the cloud, the client-library needs to know whether it should connect to the sandboxed test-environment or to the real prod environment to resolve the address.
For this purpose, a “Test-Mode” tick box is needed. It should always be turned off by default. It should only be turned on by POS testers who are testing against test EFTPOS devices. Real users of the POS system should never be able to change it. We recommend to hide this option for production users of your POS system.
Required Changes - Code
As part of the update there is a requirement to provide an additional argument when instantiating the library and some extra values as part of the DeviceAddressService class. These have been defined below:
To receive an apiKey please contact your Assembly contact
Triggering the Auto Device Resolution
A number of scenarios will trigger the SPI Client to obtain an IP address based on a provided serial number. These are good to understand when completing the development for the Auto Device Resolution:
SetSerialNumber - When unpaired, if the serial number changes, the library will resolve the device address.
SetAutoAddressResolution - When paired and disconnected, if auto address resolution is enabled, the library will resolve the device address.
SetTestMode - When unpaired, toggling the test mode will resolve the device address.
Disconnection - When disconnected the library will try and re-connect - When disconnected, the mode will switch to PairedConnecting and if auto address resolution is enabled and the number of retries (normal reconnect) is more than 5, the library will resolve the device address and try to re-connect.