Document Properties
Kbid
3092Y9
Last Modified
22-Apr-2024
Added to KB
21-Jun-2023
Public Access
Everyone
Status
Online
Doc Type
Guidelines
Product
Intershop Progressive Web App
Guide - Intershop Progressive Web App - Address Check with Address Doctor

We integrated Address Doctor to verify address data for correctness.

The current integration is based on the Address Doctor API 6.0.0.

Setup

First, activate the feature toggle addressDoctor.
You will also have to provide the endpoint and additional verification data.
This can be done by defining it in Angular CLI environment files:

features: [
  'addressDoctor'
],
addressDoctor: {
  url: '<addressDoctor-url>',
  login: '<addressDoctor-login>',
  password: '<addressDoctor-password>',
  maxResultCount: 5,
},

The Address Doctor configuration can also be supplied via environment variable ADDRESS_DOCTOR as stringified JSON:

ADDRESS_DOCTOR='{ "url": "<addressDoctor-url>", "login": "<addressDoctor-login>", "password": "<addressDoctor-password>", "maxResultCount": "5" }';

The Address Doctor configuration for docker-compose looks like this:

pwa:
  environment:
    ADDRESS_DOCTOR: '{ "url": "<addressDoctor-url>", "login": "<addressDoctor-login>", "password": "<addressDoctor-password>", "maxResultCount": "5" }'

For the current PWA Helm Chart that is also used in the PWA Flux deployments, the Address Doctor configuration looks like this.:

environment:
  - name: ADDRESS_DOCTOR
    value: |
      {
        "url": "<addressDoctor-url>", "login": "<addressDoctor-login>", "password": "<addressDoctor-password>", "maxResultCount": "5"
      }

Workflow

To check an address with the address doctor the PWA needs to render the <ish-lazy-address-doctor> component.
When the user submits the address data, the PWA needs to send a feature notification event with the request to check the data.

const id = this.featureEventService.sendNotification('addressDoctor', 'check-address', {
  address,
});

This method will submit the address data to the Address Doctor REST API and open a modal with all suggestions.
The user needs to decide and confirm the address, which is the correct one.
With the subscribe on the eventResultListener$ observable, the initial component can react on the confirmation data.

this.featureEventService
  .eventResultListener$('addressDoctor', 'check-address', id)
  .pipe(whenTruthy(), take(1), takeUntilDestroyed(this.destroyRef))
  .subscribe(({ address }) => {
    if (address) {
      this.accountFacade.updateCustomerAddress(address);
    }
  });

Further References

Disclaimer
The information provided in the Knowledge Base may not be applicable to all systems and situations. Intershop Communications will not be liable to any party for any direct or indirect damages resulting from the use of the Customer Support section of the Intershop Corporate Web site, including, without limitation, any lost profits, business interruption, loss of programs or other data on your information handling system.
The Intershop Knowledge Portal uses only technically necessary cookies. We do not track visitors or have visitors tracked by 3rd parties. Please find further information on privacy in the Intershop Privacy Policy and Legal Notice.
Home
Knowledge Base
Product Releases
Log on to continue
This Knowledge Base document is reserved for registered customers.
Log on with your Intershop Entra ID to continue.
Write an email to supportadmin@intershop.de if you experience login issues,
or if you want to register as customer.