- Agreements validator is a Middleware service which is used to check if provided agreements are valid for given campaign by checking:
- if the request includes all necessary agreements (LDS businessID) for particular profile source
- if relevant consents are marked
- whether the pair "businessID : revisionID" exists
- Swagger API Documentation:
Currently, Confluence does not support Swagger, therefore we keep the YAML file here: AgreementsValidatorSwagger (Recommended to open on local SwaggerEditor or online Swagger Editor:https://editor.swagger.io)
- Process flow:
# | step | description |
---|
1 | Send validation request | CDP and CDS flows should be able to generate the following json from each profile request:
{
"AccountSourceCode":"GBRPHAEXTPROF0001"
"Agreements":[
{
"BusinessId":"xxx",
"RevisionId":"yyyy",
"ConsentAcceptedInd":true,
"ConsentDesc":"email marketing consent",
"MandatoryInd":false
},
{
"BusinessId":"xxx",
"RevisionId":"yyyy",
"ConsentAcceptedInd":true,
"ConsentDesc":"post marketing consent",
"MandatoryInd":true,
},
{
"BusinessId":"xxx",
"RevisionId":"yyyy",
"ConsentAcceptedInd":true,
"ConsentDesc":"sms marketing consent",
"MandatoryInd":true
}]
}
|
2 | Endpoint | URL: To be created Headers: To be created Log: To be created |
3 | Internal validation | Internal validation should: - get relevant for particular Code data source from the DB (next point)
- check:
- whether all businessIDs from DM are in the request
- whether all agreements in the request have the same "MandatoryInd" as it is in the DB
- Validate if all fields with "MandatoryInd" = true have also "ConsentAcceptedInd":true
- Log:
- timestamp
- account-source
- sender (CDP flow / CDS flow)
|
4 | Internal DB | The collection should store:
{
"AccountSourceCode":"GBRPHAEXTPROF0001",
"Agreements":[
{
"BusinessId":"xxx",
"MandatoryInd":false
},
{
"BusinessId":"xxx",
"MandatoryInd":true,
},
{
"BusinessId":"xxx",
"MandatoryInd":true
}]
}
|
5 | Validation | Check whether all the above conditions are correct: if yes: - proceed to the external validation
if no: - drop profile
- send response about failed validation according to the Swagger
- Log:
- "account-source:
- "timestamp"
- Agreements validation_status": "failed"
|
6 | External validation | - Send a request to LDS API - Validate revision (/wiki/spaces/GUA/pages/3578891)
- No authentication is needed for that request
LDS URL:http://digital-lds-application-web-production.frankfurt.rbdigitalcloud.com Example request:
POST {lds_url}/r/validate/revisions/
Payload:
{
"revisionIdList" : [
"59c3b74e91f5bb000163ffe7"
"51b3b79931ef43852ca321bb"
]
}
Example response:
HTTP 200 OK
Payload:
{
"result": {
"59c3b74e91f5bb000163ffe7": {
"useType": "ST",
"contentType": "TC",
"country": "CH",
"language": "en",
"brand": "Vanish",
"customName": "a"
},
"51b3b79931ef43852ca321bb": null
},
"errors": []
}
Validation logic: - Sent request
- Build BusinessIds for the revisionId as follows
- BusinessId = "useType"+"-"+"contentType"+"-"+"country"+"-"+"language"+"-"+"brand": "Vanish"+"-"+"customName"
- BusinessId example: ST-TC-CH-en-Vanish-a
- Check if built businessId is the same as it is in the request
Log: - timestamp
- BusinessID:revisionID (built)
- validation status (true (correct) / false (incorrect)
Example request: |
7 | Validation check | - if all pairs have status correct: proceed
- otherwise:
- drop profile
- send response about failed validation according to the swagger
- Log:
- "Code":
- "timestamp"
- Agreements validation_status": "failed"
|
8 | Response | - Send response about positive validation
- Log:
- "Code":
- "timestamp"
- Agreements validation_status": "correct"
|