Skip to content

DPD Integration ​

The DPD integration enables shipment creation, PDF label generation, and parcel tracking via the DPD/BRT REST API.

Components ​

ComponentFileRole
DpdApisrc/CoreBundle/Api/DpdApi.phpREST API client for DPD
DpdServicesrc/CoreBundle/Services/DpdService.phpShipment business logic
DpdControllersrc/AppBundle/Controller/DpdController.phpDashboard and web routes
Configurationapp/config/parameters.yml.distConnection parameters

Configuration ​

Required parameters in parameters.yml:

yaml
dpd:
  api_url: "https://api.dpd.fr"
  user_id: "..."
  password: "..."
  customer_code: "..."
  departure_depot: "..."
  operating_mode: "..."

Parameter injection pattern

Symfony does not allow accessing nested parameters (%dpd.api_url%). The service receives the full %dpd% array and extracts keys in PHP. This pattern is consistent with other carrier integrations (Geodis, etc.).

Data Flow ​

View diagram source
sequenceDiagram
    participant UI as DPD Dashboard
    participant CTRL as DpdController
    participant SVC as DpdService
    participant API as DpdApi
    participant DPD as DPD REST API
    participant SP as SaleProduct

    UI->>CTRL: Create shipment
    CTRL->>SVC: createShipment(saleProducts)
    SVC->>API: createShipment(data)
    API->>DPD: POST /shipments
    DPD-->>API: JSON response + PDF
    API-->>SVC: Label PDF + data
    SVC->>SVC: Save PDF to /web/pdf_dpd/
    SVC->>SP: Update carrier/tracking/shipment
    SVC->>SVC: ShipmentTrackingSynchronizer

Diagram

Dashboard Features ​

  • Shipment list with DataTables (server-side pagination)
  • Advanced filters (store, dates, tracking number, order number)
  • Batch shipment creation
  • PDF label download
  • Retry for failed shipments
  • Tracking synchronization

API Error Codes ​

CodeMeaning
-1General error
-3Invalid parameters
-5Authentication failed
-10Unknown depot
-11Unknown customer code
-21Shipment not found
-22Shipment already confirmed
-30Service unavailable

Integration Phases ​

Phase 1 -- API and Backend Services ​

  • REST API client (DpdApi)
  • Business logic service (DpdService)
  • PDF label storage
  • SaleProduct updates

Phase 2 -- User Interface ​

  • DPD dashboard with DataTables
  • AJAX routes for creation and tracking
  • Integration into the "Processing Not Printed" flow
  • Filters and carrier-based search

Phase 3 (optional) ​

  • Automated batch printing
  • Automatic tracking synchronization command
  • Email notifications
  • Webhooks
  • Statistics dashboard

Troubleshooting ​

ParameterNotFoundException for %dpd.api_url% ​

The service must receive %dpd% (the full array), not individual keys. Verify that services.yml passes %dpd% and that the DpdApi constructor accepts array $config.

Dashboard inaccessible ​

  1. Clear cache: php bin/console cache:clear
  2. Check the service: php bin/console debug:container mz.dpd.api
  3. Test the API connection manually

Internal developer documentation for Menzzo systems.