Integration Components
The int_dqe
cartridge is the core implementation for integrating DQE functionality into SFCC. Below is a detailed overview of its components:
DQE Services
These services are implemented to interact with DQE APIs, providing functionality for email, phone, and address validation and suggestions.
Implemented Services:
dqe.http.email.validate
dqe.http.phone.validate
dqe.http.address.suggestions.search
dqe.http.address.suggestions.complete
dqe.http.address.validate
Utilized DQE APIs:
DQE Scripts and Helpers
All DQE scripts and helpers files and logic are located under cartridges/int_dqe/cartridge/scripts/dqe folder and contains base SFCC DQE functionality for address suggestion and validation, email and phone validation, manipulating with DQE configs, calling DQE services, etc.
- cartridges/int_dqe/cartridge/scripts/dqe/dqeAddress.js - contains all related to DQE address methods. Can be used for getting address suggestions and validation of address.
- cartridges/int_dqe/cartridge/scripts/dqe/dqeAPI.js - provides methods for working with DQE API. It is used to call appropriate DQE API. It is sort of a middleware between DQE scripts and DQE Services.
- cartridges/int_dqe/cartridge/scripts/dqe/dqeCache.js - provides a method for working with DQE custom cache. Custom cache is used to store validation results for DQE response code. Custom cache is used to avoid too many queries for appropriate custom objects in the database.
- cartridges/int_dqe/cartridge/scripts/dqe/dqeConstants.js - simply contains DQE constants used in other integration and extensions files.
- cartridges/int_dqe/cartridge/scripts/dqe/dqeEmailValidator.js - provides method for validation email value
- cartridges/int_dqe/cartridge/scripts/dqe/dqeHelpers.js - contains DQE generic helper methods and methods for getting DQE preferences
- cartridges/int_dqe/cartridge/scripts/dqe/dqePhoneValidator.js - provides method for validation phone value
DQE Models
These models map DQE API responses to JS objects for use in SFCC.
-
addressSuggestions.js
: Maps DQE address suggestion responses. -
completeAddressDetails.js
: Maps DQE address completion responses.
DQE Templates
Templates for rendering address suggestions and validation results:
-
Address Suggestions:
addressSuggestions.isml
-
Address Validation Results:
addressValidationSuggestions.isml
Email Validation
Entry point of email validation is a validate method of scripts/dqe/dqeEmailValidator.js file. It receives email string value and validates it with DQE API considering current DQE preferences setup and DQE response codes mapping. More info about DQE Codes Mapping is provided in the corresponding section below.
Email Validation result is represented as an object with the next properties:
- status (string) - validation status, possible values - 'valid', 'invalid', 'warn'
- message (string) - validation message
- suggestions (array of string) - suggested values if any
- error (boolean) - indicates if there is error during validation
Phone Validation
Entry point of phone validation is a validate method of scripts/dqe/dqePhoneValidator.js file. It receives phone and country code string values and validates it with DQE API considering current DQE preferences setup and DQE response codes mapping. More info about DQE Codes Mapping is provided in the corresponding section below.
Phone Validation result is represented as an object with the next properties:
- status (string) - validation status, possible values - 'valid', 'invalid', 'warn'
- message (string) - validation message
- error (boolean) - indicates if there is error during validation
Address Validation
All methods related to addresses can be found in scripts/dqe/dqeAddress.js file. It provides methods for getting and completing address suggestions and validating the address details.
To validate an address using a validateAddress method the following fields are mandatory – address1, postalCode, city and countryCode. Other fields address2 and placeName are optional. Those fields are mapped to Adresse (“additional address|address|dependent locality|zip code|city”) string of DQE RNVP API as the next:
SFCC field | DQE RNVP API request string |
address1 | address |
postalCode | zip code |
city | city |
address2 | additional address |
placeName | dependent |
Also, it is possible to validate address providing the Adresse (“additional address|address|dependent locality|zip code|city”) string using validateAddressString method of scripts/dqe/dqeAddress.js.
Address is validated using DQE API considering current DQE preferences setup and DQE response codes mapping. More info about DQE Codes Mapping is provided in the corresponding section below.
Address Validation result is represented as an object with the next properties:
- status (string) - validation status, possible values - 'valid', 'invalid', 'warn'
- message (string) - validation message
- suggestions (array of string) - suggested values if any
- error (boolean) - indicates if there is error during validation
DQE Codes Mapping
All DQE validation logic relies on current DQE preferences setup and DQE response codes mapping.
Technically DQE codes mappings are stored in SFCC as custom objects. The next custom object type definitions are part of the cartridge:
- dqeEmailValidationConfigs
- dqePhoneValidationConfigs
- dqeAddressValidationConfigs
Each custom object entity has the next attributes:
- dqeCode – key attribute, mapped to dqe response code
- status – validation status. Possible values are valid, warning and blocking which are mapped to corresponding validation statuses
- displayMessage – localizable message to be show to user as result of validation
To improve performance and avoid constant queries to custom object databases there is a DQE custom cache mechanism implemented. It caches dqe code to validation status and message values.
To have the ability for specific merchants to configure DQE codes mapping there is a corresponding DQE business manager module implemented.
Business Manager Extensions
All DQE business manager customization are part of the bm_dqe cartridge.
It includes:
DQE Links
DQE links BM section simply contains some DQE related useful links that can be accessible from BM.
DQE Codes Mappings
To have the ability for specific merchants to configure DQE codes mapping there is a corresponding DQE business manager module implemented. Under the hood all mappings are stored in system as custom objects.
DQE Site Preferences
DQE Site Preferences module can be used as an alternative for configuring DQE related site preferences.
DQE Site Preferences module can be used in case of BM user role does not have access to all Site Preferences modules on site but needs to have access to manage DQE related stuff.
Related to