Skip to content

Draft Design

Shreyansh Shah edited this page Oct 25, 2024 · 3 revisions

Automation Framework


Architecture View

image

Key Components

Protocol Service

Layer to handle the network related calls that include receiving request or sending response (sync/callback) to the counterparty NP

  • Stack: Express, NodeJs
  • Modules: joi, ondc-crypto-sdk

Mock Service

Generate mock request/response to be consumed by the counterparty NP

  • Stack: NodeJS
  • Module: jest

Reporting Service

Perform business logic validations and generate final report with success/failure messages

  • Stack: NodeJS
  • Module: jest, jest-html-reporters

Cache Service

Transaction Cache Stores the transaction level details; eg: txn id and message id Lookup Cache Stores public keys and info fetched from registry User Session Cache To maintain the user session

  • Stack: Redis

Persistent Service

To retain data for final reporting and back office storage

  • Stack: YugaByte/MongoDB/PostgreSQL

3P Services

Ancillary services for 3rd party integrations like map services for geocoding and reverse geocoding, payment gateway integration etc.

  • Services: MMI, AA

Back Office (Support Service + Frontend)

For logging and metrics to get the tech insights

  • Stack: ReactJS + NodeJS + Grafanna

Front End

Interface for the participants to interact with the automation tool and carry out the testing and validation.

  • Stack: ReactJS

Validation Classification

Protocol Layer (Level-0 & Level 1 Validation)

At the API layer, the validation focuses on the foundational aspects of the request-response cycle, ensuring compliance with structural standards. The key validations are: Beckn Schema Validation: This involves verifying the structure of the request and response payloads. Only the Beckn protocol structure and associated enums are validated, ensuring the JSON conforms to the expected schema. Header Verification: It ensures that all necessary headers, such as authorization headers, are present and valid.

Level-1 Validation (Context & Attribute Validation): Required Attributes Validation: Ensures that mandatory fields (e.g., items/id, order/id) are present and not null. Contextual Validations: This ensures that the context of the API calls is correct. For instance, verifying that a transaction_id is the same across the transaction flow. **Allowed action/on_action: ** This ensures that based on current state of the transaction only certain followup action or on_action is allowed for this transaction Exceptional Business Validation: Only for existing or exceptional use case ideally to be none Note: At Level-1, an ACK/NACK will be provided based on the outcome of these checks. Hence handling all sync errors

Mock Layer (Level-2 Validation)

The Mock Layer provides deeper validation, focusing on context-aware and response associated business logic checks: Level-2 Validation (Business Logic Validation): Business Logic Checks: Ensures that basic workflow rules are followed.

For example:

  • Item and Fulfilment selected are not supported eg: Item does not support Self Pick up
  • Item and Payments selected are not supported eg: all Items in the cast dont support COD
  • Ensuring the item ID exists in the catalog before proceeding with further actions.

If the validation fails at this level, appropriate error objects will be returned in the response.

Reporting Layer (Level-3 Validation)

The final validation layer focuses on holistic flow and advanced business logic validations, ensuring that the entire process aligns with expected outcomes. Key aspects include: Comprehensive Business Checks: Verifies complex business rules, such as state transitions and cross-service validations. Example: Validating the correct sequence of events of order fulfillment (e.g., packed-> agent-assigned-> picked-> delivered). Holistic Flow Validation: Ensures that the entire API workflow follows the correct order, catching errors like sending a delivery update before the item is shipped, variants, customizations, etc. Final Reporting: A detailed report will be generated post-validation, including success/failure logs, error messages, and identified discrepancies for each validation level.

Validation Summary

Layer Validation Type Level Validation Focus
API Layer Beckn Schema, Enums & Header Verification Level-0 Validates schema structure, enums and headers.
Required Attributes & Contextual Validations Level-1 Ensures presence of mandatory fields and correct context.
Exceptional Validations due to ACK & NACK based on business logic Level - 1A To support existing use cases and any exceptional business requirements
Mock Layer Basic Business Logic Validation Level-2 Validates basic rules like order flow and item existence.
Reporting Layer Comprehensive Business Logic & Holistic Flow Validation Level-3 Conducts detailed business flow checks and generates a final report.

Tech Stack Summary

Frontend UI (Tool + Back Office Frontend) React JS
API Layer Node JS
Mock Layer NodeJS
Protocol layer NodeJS
Mock Layer
Validation Layer
Reporting Layer NodeJS
DB
* Lookup Cache Redis
* Transaction Cache Redis
* Persistent Storage MongoDB, Cassandra, YugaByte PostgreSQL
Logger Service Winston (Module) Graffana
3P Integration
* Map Services MMI