Skip to content

Data Flow ​

This page describes how data moves between Logidav and all connected external systems -- inbound, outbound, and internal transformations.

Main Data Flow ​

View diagram source
flowchart TB
    subgraph Inbound Sources
        MAG[Magento 2]
        MED[Meduse]
        AMZ[Amazon]
        CDI[Cdiscount]
        MNM[ManoMano]
        SUP[Suppliers<br/><small>Bigbuy, Vidaxl, etc.</small>]
    end

    subgraph Logidav Pipeline
        IMPORT[Import<br/><small>Cronjobs pull data</small>]
        NORM[Normalize<br/><small>Map to internal format</small>]
        PERSIST[Persist<br/><small>Doctrine entities → DB</small>]
        EVT[Events<br/><small>Domain events dispatched</small>]
        QUEUE[Queue<br/><small>Async side effects</small>]
        EXPORT[Export<br/><small>Push to external systems</small>]
    end

    subgraph Outbound Destinations
        CAR[Carriers<br/><small>DPD, BRT, ChronoPost, GLS, Geodis</small>]
        MP_OUT[Marketplaces<br/><small>Amazon, Cdiscount, ManoMano</small>]
        PAY[Payment Providers<br/><small>Stripe, Hipay, Klarna, Payline</small>]
        MAG_OUT[Magento 2<br/><small>Status updates, stock</small>]
        MED_OUT[Meduse<br/><small>Inventory sync</small>]
    end

    MAG -->|orders, statuses| IMPORT
    MED -->|internal data| IMPORT
    AMZ -->|marketplace orders| IMPORT
    CDI -->|marketplace orders| IMPORT
    MNM -->|marketplace orders| IMPORT
    SUP -->|catalog, stock| IMPORT

    IMPORT --> NORM
    NORM --> PERSIST
    PERSIST --> EVT
    EVT --> QUEUE
    QUEUE --> EXPORT

    EXPORT -->|labels, tracking| CAR
    EXPORT -->|stock, prices, products| MP_OUT
    EXPORT -->|charges, refunds| PAY
    EXPORT -->|order updates| MAG_OUT
    EXPORT -->|inventory sync| MED_OUT

Diagram

Inbound Flows ​

Orders from Magento ​

The primary order pipeline pulls new and updated orders from Magento 2:

CommandScheduleWhat It Does
menzzo:v2:salesEvery 10 minImports new orders from Magento
menzzo:v2:sales:updateEvery 30 minSyncs status changes on existing orders
menzzo:v2:sales:paymentPeriodicProcesses payment confirmations

Data imported: orders, line items, customer information, shipping addresses, payment status.

Products from Magento ​

CommandScheduleWhat It Does
menzzo:v2:productsEvery 2 hoursSyncs the product catalog

Data imported: product attributes, prices, descriptions, images, availability status.

Marketplace Orders ​

Orders from third-party marketplaces (Amazon, Cdiscount, ManoMano) are imported through ErpBundle:

  • Each marketplace has its own import command
  • Orders are normalized into the same internal Sale + SaleProduct format
  • Marketplace-specific fields (marketplace order ID, channel) are preserved for routing

Supplier Data ​

Supplier bundles (BigbuyBundle, VidaxlBundle, etc.) import:

  • Product catalogs and pricing
  • Stock levels at supplier warehouses
  • Delivery lead times

INFO

All inbound data goes through the same pipeline: Import → Normalize → Persist → Events → Queue. This ensures consistent processing regardless of the data source.

Outbound Flows ​

Shipments to Carriers ​

When orders are ready to ship, Logidav generates shipping labels and tracking numbers:

CarrierAPI ClientWhat Is Sent
ChronoPostChronoPostApiLabel generation, pickup scheduling
BRTBrtApiLabel generation, tracking updates
GLSGlsApiLabel generation, tracking
GeodisGeodisApiHeavy-item shipping, pallet labels
DPDvia carrier serviceParcel shipping labels

Data exported: recipient address, parcel dimensions/weight, service level, tracking numbers returned.

Stock and Products to Marketplaces ​

Logidav pushes product and inventory data back to marketplaces:

Data TypeDirectionFrequency
Stock levelsLogidav → MarketplacesNear real-time via queues
Product pricesLogidav → MarketplacesOn change (event-driven)
New productsLogidav → MarketplacesOn creation
Tracking numbersLogidav → MarketplacesAfter shipment

Order Status to Magento ​

Status updates flow back to Magento as orders progress:

  • Order confirmed → Magento status update
  • Order shipped → tracking number pushed to Magento
  • Order refunded → credit memo created in Magento

Payment Operations ​

Payment-related outbound flows:

  • Capture charges after shipment confirmation
  • Process refunds on cancellations
  • Handle installment payment status updates

Internal Data Flows ​

Stock Mutation Flow ​

Stock mutations are one of the most critical internal flows. Every inventory change is journaled for auditability:

View diagram source
sequenceDiagram
    participant MAG as Magento 2
    participant CMD as menzzo:v2:sales
    participant SVC as SaleService
    participant DB as Database
    participant QTY as ProductQtyLogService
    participant EVT as EventDispatcher

    MAG->>CMD: New order (status: processing)
    CMD->>SVC: addOrder(sale, isV2Data=true)
    SVC->>DB: Create Sale + SaleProducts
    SVC->>QTY: productChangeLog(..., 'sale')
    QTY->>DB: Insert stock journal entry
    SVC->>EVT: dispatch AfterSaleCreatedEvent
    EVT->>DB: Subscriber updates availability
    EVT->>DB: Subscriber logs audit entry

Diagram

WARNING

Stock mutations are immediate and synchronous -- they happen in the same transaction as the order import. The ProductQtyLogService creates a journal entry for every single stock change, with the source (sale, manual adjustment, supplier sync, etc.) recorded for traceability.

Order Lifecycle Flow ​

An order moves through several states, each triggering different data flows:

View diagram source
flowchart LR
    NEW[New Order<br/><small>Imported from source</small>]
    PROC[Processing<br/><small>Stock reserved</small>]
    PREP[Preparing<br/><small>Label generated</small>]
    SHIP[Shipped<br/><small>Tracking sent</small>]
    COMP[Complete<br/><small>Delivered</small>]
    CANC[Canceled<br/><small>Stock released</small>]

    NEW --> PROC
    PROC --> PREP
    PREP --> SHIP
    SHIP --> COMP
    PROC --> CANC

    PROC -.-|AfterSaleCreatedEvent| EVT1[Stock decrement]
    SHIP -.-|SaleProductsShippedEvent| EVT2[Tracking to Magento]
    CANC -.-|AfterSaleCanceledEvent| EVT3[Stock release + refund]

Diagram

Event-Driven Side Effects ​

Domain events trigger cascading data updates across the system. See Bundle Responsibilities -- EventBundle for the complete event catalog and Queue Model for how async tasks are processed.

Internal developer documentation for Menzzo systems.