We integrated Address Doctor to verify address data for correctness.
The current integration is based on the Address Doctor API 6.0.0.
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"
}
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);
}
});
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 Website, including, without limitation, any lost profits, business interruption, loss of programs or other data on your information handling system.