Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Pricing Engine API Documentation

Documentation Overview

This is a standalone microservice for managing restaurant dynamic pricing rules with JWT authentication and multi-restaurant support.

Documentation Structure

Core Documentation

  1. 001-QUICK-START.md - Get started in 5 minutes
  2. 002-ARCHITECTURE.md - System architecture and design
  3. 003-AUTHENTICATION.md - JWT authentication flow
  4. 004-API-ENDPOINTS.md - Complete API reference

Feature Documentation

  1. 005-PRICING-RULES.md - Pricing rules management
  2. 006-DATE-TIME-CONDITIONS.md - Date/time condition types
  3. 007-GLOBAL-PRICING-SETTINGS.md - Restaurant pricing limits
  4. 008-ENUM-REFERENCE.md - All enum values reference

Advanced Features

  1. 009-REDIS-CACHING.md - Caching implementation
  2. 010-APM-MONITORING.md - Application monitoring
  3. 012-DEVELOPMENT-STANDARDS.md - Code standards
  4. 013-DEMAND-CAPACITY-CONDITIONS.md - Capacity-based rules
  5. 014-PRICE-MODIFIER.md - Price modifier lifecycle & management
  6. 015-PRICING-RECOMMENDATION-API.md - Pricing recommendation API
  7. 016-CUSTOMER-BOOKING-API.md - Customer booking API
  8. 017-CAPACITY-DEMAND-IMPLEMENTATION-PLAN.md - Capacity and demand implementation plan
  9. 018-DEMAND-CAPACITY-IMPLEMENTATION.md - Real implementation notes for Demand & Capacity rules
  10. 019-INTERNAL-ACTIVE-PRICE-MODIFIERS-API.md - Internal active modifier data API
  11. Demand_Capacity_Tiered_Seat_Discount_20260827150000.md - Tiered seat discount design and integration contract
  12. DEMAND-CAPACITY-FRONTEND-API-GUIDE.md - Frontend integration guide for demand-capacity pricing APIs

Technical Documentation

  1. 011-ENVIRONMENT-SETUP.md - Development setup
  2. SCHEMA_ERD.md - Database schema diagrams

API Testing

  1. postman/ - Postman collection and environments
  • API Base URL (Staging): https://price-engine.hh-engineering.my.id
  • Health Check: GET /up
  • API Documentation: GET /api-docs

Current Implementation Status

✅ Implemented Features

  • JWT Bearer token authentication
  • Multi-restaurant support with context handling
  • Pricing rules CRUD operations
  • Date/time conditions (6 types)
  • Global pricing settings (per restaurant)
  • Price change history tracking
  • Rule activation/deactivation
  • Rule cloning
  • Redis caching for performance
  • APM monitoring with Elastic APM
  • Kafka refresh events for downstream active-modifier snapshots

📋 API Endpoints

Partner API (/api/partner/v1/*)

  • Pricing Rules: Full CRUD + activate/deactivate/clone
  • Global Settings: GET (auto-create), PATCH
  • Price History: List, show, undo

Public API (/api/v1/*)

  • Pricing Rules: Read-only (list, show)

Internal API (/api/internal/v1/*)

  • Token Sync: login, logout, refresh, invalidate
  • Active Price Modifiers: read-only active/current-or-future modifier definitions for trusted pricing evaluators

Getting Started

  1. Read 001-QUICK-START.md for setup
  2. Import Postman collection from postman/ directory
  3. Configure authentication (see 003-AUTHENTICATION.md)
  4. Start testing with the collection

Technology Stack

  • Framework: Ruby on Rails 7+ (API mode)
  • Database: PostgreSQL
  • Cache: Redis
  • Monitoring: Elastic APM
  • Authentication: JWT (from HH-Server)
  • API Documentation: Swagger/OpenAPI (via Rswag)