Here is a detailed README for the ONDC-Official/automation-api-service repository:
The ONDC Automation API Service is a firewall for the ONDC protocol, providing various validations to ensure the integrity and compliance of transactions within the ONDC network. This service is written in TypeScript and includes both L0 and L1 validation modules.
- L0 Validations: Initial checks for basic compliance.
- L1 Validations: Advanced validations for deeper integrity checks.
- Transaction Logging: Detailed logging of transaction actions and responses.
- Cache Management: Efficient handling of session and transaction data using Redis.
To install the dependencies and set up the project, follow these steps:
-
Clone the repository:
git clone https://github.com/ONDC-Official/automation-api-service.git cd automation-api-service
-
Install the dependencies:
npm install
-
Build the project:
npm run build
To start the service, use the following command:
npm run start
A Dockerfile is provided to build and run the service in a containerized environment:
docker build -t automation-api-service .
docker run -p 3000:3000 automation-api-service
The service can be configured using environment variables. Key configurations include:
SIGN_PRIVATE_KEY
: Private key for signing transactions.SUBSCRIBER_ID
: Subscriber ID for the ONDC network.UKID
: Unique Key ID for the ONDC network.REDIS_URL
: URL for the Redis instance.
For development purposes, you can use the following commands:
-
Run the service in development mode:
npm run dev
-
Run tests:
npm test
-
Lint the code:
npm run lint
The service includes various test cases for validating API responses. Tests are located under the src/validations/L1-validations/api-tests
directory. You can run the tests using:
npm test
We welcome contributions to the project. To contribute, please follow these steps:
- Fork the repository.
- Create a new branch with a descriptive name.
- Make your changes and commit them with clear messages.
- Push your changes to your fork.
- Create a pull request to the main repository.
Please ensure your code follows the project's coding standards and passes all tests.
This project is licensed under the MIT License. For more details, see the LICENSE file.
For detailed information on specific validations and their conditions, refer to the individual markdown and TypeScript files within the repository.
-
Condition validate_tag_1_ROUTE_INFO:
every element of $.message.catalog.providers[*].fulfillments[*].tags[?(@.descriptor.code=='ROUTE_INFO')].list[*].descriptor.code must be in ["ROUTE_ID", "ROUTE_DIRECTION"]
-
Condition validate_tag_1_TICKET_INFO:
every element of $.message.catalog.providers[*].fulfillments[*].tags[?(@.descriptor.code=='TICKET_INFO')].list[*].descriptor.code must be in ["NUMBER"]
-
Condition validate_tag_1_TRIP_DETAILS:
every element of $.message.catalog.providers[*].fulfillments[*].tags[?(@.descriptor.code=='TRIP_DETAILS')].list[*].descriptor.code must be in ["AVAILABLE_TRIPS", "UTILIZED_TRIPS"]
For further details, refer to the instruct.md file.
This README is based on the gathered information from the repository's code and documentation. Adjustments may be necessary based on specific implementation details and updates to the codebase.