Related Github Documents
Document Properties
Kbid
3092Y9
Last Modified
21-Jun-2023
Added to KB
21-Jun-2023
Public Access
Everyone
Status
Online
Doc Type
Guidelines, Concepts & Cookbooks
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.

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:

export const environment: Environment = {
  ...ENVIRONMENT_DEFAULTS,

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

This configuration can also be supplied via environment variable ADDRESS_DOCTOR as stringified JSON:

ADDRESS_DOCTOR='{ "addressDoctor": { "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), takeUntil(this.destroy$))
  .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 Customer Support website uses only technically necessary cookies. We do not track visitors or have visitors tracked by 3rd parties.

Further information on privacy can be found in the Intershop Privacy Policy and Legal Notice.
Customer Support
Knowledge Base
Product Resources
Tickets