We integrated Address Doctor to verify address data for correctness.
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" } }';
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);
}
});
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.