The order-manager
microservice is designed to handle the core aspects of order processing. This service offers a RESTful API to streamline various operations, including the creation, retrieval, and cancellation of orders, as well as the integration of status update webhooks from payment gateways and shipping providers. Additionally, it maintains up-to-date order statuses by processing incoming events. It also updates orders status through events. For instructions on how to get this microservice up and running, please refer to the Getting Started
section.
Endpoint | Method | Description |
---|---|---|
/api/v1/orders |
GET | Retrieve a list of all orders |
/api/v1/orders/:orderId |
GET | Retrieve details of a specific order by ID |
/api/v1/orders/customer/:customerId |
GET | Retrieve a list of all customer's orders |
/api/v1/orders/status/:status |
GET | Retrieve a list of all orders with a given status |
/api/v1/orders |
POST | Create or update an order |
/api/v1/orders/:orderId/cancel |
POST | Cancel an order |
/api/v1/webhook/payment |
POST | Emulates PSPs callbacks of payment transactions |
/api/v1/webhook/shipment |
POST | Emulates the status updates sent by the carrier |
For detailed information on request and response formats, please refer to the complete API documentation at: /api/docs
.
To ensure the service is running and healthy, you can use the root endpoint:
Endpoint | Method | Description |
---|---|---|
/ |
GET | A successful response indicates that the service is operational |
If this service is down:
- Orders will not be processed
-
Architecture: Inspired in a clean architecture combined with the hexagonal architecture and based on domain-driven design. Isolating domain citizens and application use-cases of any kind of external dependency.
The folder structure follows the different layers:
- domain for domain entities and interfaces (core)
- application for application services (use-cases)
- handlers for the web API and event listeners (controllers and event handlers)
- infrastructure for infra implementations (e.g.: database)
-
Language:
- TypeScript (see tsconfig.json) with Node.js
-
App Framework:
- Server: Express
- Request validation: express-validator
-
Persistence:
- Database Module with Mongo Client using mongoose
-
Exceptions:
-
Observability:
-
Documentation:
- API: Swagger with OpenAPI Specification
- CHANGELOG: All news, improvements and fixes
All additional documentation can be found under
docs
. -
Testing
- Framework: jest (see jest.config.json)
- Component testing: SuperTest
-
Code style:
- Prettier (see .prettierrc)
- ESLint (see .eslintrc)
To run the service it is quick and easy, please check the steps here.
See CONTRIBUTING.md and TECHDEBT.md
This project is licensed under the MIT License. For more details, see the LICENSE file.