seller-backend (v1.0.0)
Backend service for integrating with third-party marketplaces (currently Shopee). Handles order reception, catalog synchronization, campaign management, and quotation.
Service Overview
The seller-backend service is responsible for integrating with third-party marketplaces, currently focusing on Shopee integration. It acts as a bridge between external marketplaces and the Daki internal system, ensuring orders are received, transformed, and processed correctly, and that product information is synchronized.
Key Features
- Order Management: Receives orders from marketplaces via webhooks and creates them in the ORDR system
- Catalog Synchronization: Syncs product data (prices, inventory, content) between Daki and marketplaces
- Campaign Management: Creates and manages promotional campaigns on marketplaces
- Quotation: Provides freight quotations for marketplace orders
- Product Mapping: Maps products between Daki (SKU) and Shopee (item_id)
Architecture
- Language: Go (Golang)
- Framework: Gin (HTTP router)
- Architectural Pattern: DDD (Domain-Driven Design), Hexagonal Architecture
- Database: PostgreSQL
- Cache: Redis
- Messaging:
- Google Cloud Pub/Sub (publishing
new_orderevents) - Kafka (consuming delivery status events)
- Google Cloud Pub/Sub (publishing
- External APIs:
- Shopee API (REST)
- Catalog Service (GraphQL)
- Hub Config Service (REST)
- ORDR (via Pub/Sub)
Integration Points
- Shopee API: REST API for order management, catalog operations, and campaign management
- ORDR: Publishes
new_orderevents via Pub/Sub topicordr-input - Catalog Updates: Consumes product update events (price and inventory) via Pub/Sub topics (configured via
PRICE_UPDATE_TOPICandINVENTORY_UPDATE_TOPICenvironment variables). These events are published when product prices or inventory change in the Daki catalog system, and are not yet documented in the Event Catalog. - Kafka: Consumes delivery status events (
delivery.ready,delivery.on_the_way,delivery.delivered,delivery.canceled) from topicdeliveries.out
Responsibilities
- Order Reception: Receives webhooks from Shopee when orders are ready to ship
- Order Transformation: Transforms Shopee order format to Daki ORDR format
- Order Status Updates: Updates order status in Shopee when status changes in ORDR
- Product Synchronization: Syncs product prices, inventory, and content to Shopee
- Campaign Management: Creates and manages promotional campaigns on Shopee
- Quotation: Provides freight quotations for Shopee orders
- Product Mapping: Maps products between Daki (SKU) and Shopee (item_id, outlet_item_id)
Catalog Events (Pub/Sub)
The service consumes product update events from the Daki catalog system via Google Cloud Pub/Sub. These events are not yet documented in the Event Catalog as they are internal Pub/Sub events:
Price Updates: Consumed from Pub/Sub topic configured via
PRICE_UPDATE_TOPICenvironment variable- Event type:
PriceUpdateEvent - Subscription:
seller-backend-price-update-subscription - Purpose: Syncs product price changes to Shopee marketplace
- Event type:
Inventory Updates: Consumed from Pub/Sub topic configured via
INVENTORY_UPDATE_TOPICenvironment variable- Event type:
InventoryUpdateEvent - Subscription:
seller-backend-inventory-update-subscription - Purpose: Syncs product inventory (stock) changes to Shopee marketplace
- Event type:
These events are processed internally and trigger domain events (signals) that update products in the Shopee marketplace.