Skip to content

tanyamadaan/log-verification-utility

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ONDC-LOG-VALIDATION

APIs Log Validation tool for Pre-Prod participants

The tool is a NODE.js based utility to check the conformance and compliance of the API logs for logistics and B2B based on the examples in the API Contract.

Tech

Steps to run the utility

Log Validation Tool requires Node.js to run.

  1. Clone the repository, navigate to log-validation-utility and install the dependencies.
cd log-validation-utility

npm i
  1. Move all the API payloads inside "/public/logs" folder or mention the path to the logs folder as demonstrated in the next step.

  2. Run the utility in the following format

    node index.js "domain" "/path/to/logs/folder/"

node index.js logistics ./public/logs/
node index.js b2b ./public/logs/
  1. A text report (log_report.json) will be generated upon successful execution of the utility.

Notes:

There must be a separate payload for every API.

The utility validates all the payloads as documented in the examples for respective domains:

Test cases to be referred here -> logsitics and B2B

Sample payload for search.json is demonstrated below:

{
  "context":
  {
    "domain":"ONDC:RET10",
    "location": {
      "city": {
        "code": "std:080"
      },
      "country": {
        "code": "IND"
      }
    },
    "action":"search",
    "version":"2.0.1",
    "bap_id":"buyerapp.com",
    "bap_uri":"https://buyerapp.com/grocery",
    "transaction_id":"T1",
    "message_id":"M1",
    "timestamp":"2023-01-08T22:00:00.000Z",
    "ttl":"PT30S"
  },
  "message":
  {
    "intent":
    {
      "item":
      {
        "descriptor":
        {
          "name":"oil"
        }
      },
      "fulfillment":
      {
        "type":"Delivery",
        "stops":
        [
          {
            "type":"end",
            "location":
            {
              "gps":"1.3806217468119772, 103.74636438437074",
              "area_code":"680230"
            }
          }
        ]
      },
      "payment":
      {
        "type":"ON-FULFILLMENT"
      },
      "tags":
      [
        {
          "descriptor": {
            "code":"bap_terms"
          },
          "list":
          [
            {
              "descriptor": {
                "code":"finder_fee_type"
              },
              "value":"percent"
            },
            {
              "descriptor": {
                "code":"finder_fee_amount"
              },
              "value":"0"
            }
          ]
        }
      ]
    }
  }
}

N.B.

  • Community contributions are welcomed to enhance this utility for future releases.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •