/
NUTRINTG LDS Agreements validator

NUTRINTG LDS Agreements validator

  1. Agreements validator is a Middleware service which is used to check if provided agreements are valid for given campaign by checking:
    1.  if the request includes all necessary agreements (LDS businessID) for particular profile source
    2. if relevant consents are marked 
    3. whether the pair "businessID : revisionID" exists
  2. 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)

  1. Process flow:

#stepdescription
1Send validation request

CDP and CDS flows should be able to generate the following json from each profile request:

example payload
{
"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
        }]
}
2Endpoint

URL: To be created

Headers: To be created

Log: To be created

3Internal 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)
4Internal DB

The collection should store:

example payload
{
"AccountSourceCode":"GBRPHAEXTPROF0001",
"Agreements":[
  		{
        "BusinessId":"xxx",
        "MandatoryInd":false
        },
        {
        "BusinessId":"xxx",
        "MandatoryInd":true,
        },
        {
        "BusinessId":"xxx",
        "MandatoryInd":true
        }]
}
5Validation

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"
6External validation
  1. Send a request to LDS API - Validate revision (/wiki/spaces/GUA/pages/3578891)
  2. No authentication is needed for that request

LDS URL:http://digital-lds-application-web-production.frankfurt.rbdigitalcloud.com

Example request:

Example request
POST {lds_url}/r/validate/revisions/
 
Payload:
{
    "revisionIdList" : [
        "59c3b74e91f5bb000163ffe7"
        "51b3b79931ef43852ca321bb"
    ]
}


Example response:

LDS 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:

  1. Sent request
  2. Build BusinessIds for the revisionId as follows
    1. BusinessId = "useType"+"-"+"contentType"+"-"+"country"+"-"+"language"+"-"+"brand": "Vanish"+"-"+"customName"
    2. BusinessId example: ST-TC-CH-en-Vanish-a
  3. 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:

7Validation 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"
8Response
  • Send response about positive validation
  • Log:
    • "Code":
    • "timestamp"
    • Agreements validation_status": "correct"