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_order events)
    • Kafka (consuming delivery status events)
  • 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_order events via Pub/Sub topic ordr-input
  • Catalog Updates: Consumes product update events (price and inventory) via Pub/Sub topics (configured via PRICE_UPDATE_TOPIC and INVENTORY_UPDATE_TOPIC environment 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 topic deliveries.out

Responsibilities

  1. Order Reception: Receives webhooks from Shopee when orders are ready to ship
  2. Order Transformation: Transforms Shopee order format to Daki ORDR format
  3. Order Status Updates: Updates order status in Shopee when status changes in ORDR
  4. Product Synchronization: Syncs product prices, inventory, and content to Shopee
  5. Campaign Management: Creates and manages promotional campaigns on Shopee
  6. Quotation: Provides freight quotations for Shopee orders
  7. 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_TOPIC environment variable

    • Event type: PriceUpdateEvent
    • Subscription: seller-backend-price-update-subscription
    • Purpose: Syncs product price changes to Shopee marketplace
  • Inventory Updates: Consumed from Pub/Sub topic configured via INVENTORY_UPDATE_TOPIC environment variable

    • Event type: InventoryUpdateEvent
    • Subscription: seller-backend-inventory-update-subscription
    • Purpose: Syncs product inventory (stock) changes to Shopee marketplace

These events are processed internally and trigger domain events (signals) that update products in the Shopee marketplace.