Skip to content

Developer notes

Technical reference for developers who customize DHL Parcel Germany Shipping & Labels.

Item Value
Add-on id kv_dhl_parcel_de
Function prefix fn_kv_dhl_parcel_de_
Language variables kv_dhl_parcel_de.*
CSS scope .kv-dhl_parcel_de, .kv-dhlp
PHP namespace Tygh\Addons\KvDhlParcelDe
Preset shipping
Class Role
Client\BaseClient HTTP (cURL, TLS verification, timeouts), error mapping, masked logging
Client\Api The DHL APIs: OAuth password grant (token, /hello), POST/GET/DELETE /orders, POST/GET /manifests, label download, Shipment Tracking - Unified, Location Finder - Unified; error body parsing (RequestStatus, LabelDataResponse.items[].validationMessages, OAuth errors)
Shipments Order to the Shipment object of the API (consignee, Locker, PostOffice, shipper, services, customs), documents (label, return label, COD label, customs document), cancel, close-out, tracking and status mapping
Points, Parcel Packstation / Postfiliale of an order (own table, search, server-side validation); destination rules (ISO 3166 alpha-3, EU customs union, street split, grams)
RateCalculator Customer price from the shipping method’s own parameters (flat price or weight table, zone, free threshold)
Installer The five shipping services and the product of each
Client Client per company, the connection test
Accounts, Secret Credentials (test and live) sealed with AES-256-GCM; billing numbers, shipper and COD account in the non-secret extra; one account per store owner or per vendor
Config, Access Settings, owner mode, who may see and manage what
Queue, Jobs, JobException Job queue: back-off 5 min / 15 min / 1 h / 3 h / 12 h, per-job isolation, overlap lock; handlers in Jobs::handle() (create_label, track), recurring work in Jobs::schedule()
Log Event log with masking (bearer tokens, DHL-API-Key, password grant form, label URL tokens), filters, CSV, retention
Table Purpose
?:kv_dhl_parcel_de_accounts Credentials per company (secrets sealed), billing numbers, shipper, last connection check
?:kv_dhl_parcel_de_log Log
?:kv_dhl_parcel_de_jobs Queue
?:kv_dhl_parcel_de_shipments Shipments, labels (base64), further documents, product, close-out time, tracking
?:kv_dhl_parcel_de_points Packstation / Postfiliale chosen at the checkout, per order (number, location id, Postnummer)

PHP: change_order_status_post (label at a status), get_order_info, place_order, place_suborders, delete_order (location with the order), template_document_order_context_init (location text on documents). Template hooks: checkout/shipping_method.post (location card), index/scripts.post and index/styles.post (checkout only scripts), orders/totals_shipping.post (customer order page), orders/tabs_extra.post (admin tab). Pre-controller checkout.pre refuses a location order without a location.

The storefront output is the checkout page (never cached: it depends on the session cart) plus one static stylesheet; the location search is an AJAX POST. Nothing per-visitor is printed on cacheable pages, so the add-on is safe with the full page cache of 4.21.

The host can be overridden for tests in config.local.php (development only):

$config['kv_dhl_parcel_de_base_url'] = 'http://127.0.0.1:11850';

node tests/mock-server/server.js 11850 starts a local stand-in of the DHL APIs. It is built from the official OpenAPI files in tests/fixtures/openapi (converted from the YAML files of developer.dhl.com): every request body and query is validated against them, so a misspelt field, a wrong enum value or a missing required field is answered with HTTP 400 like the real service. node tests/e2e/e2e.mjs runs the HTTP end-to-end test against it; php tests/unit.php runs the unit tests, records every request the add-on builds and validates them with tests/check-requests.js.

Admin templates live in design/backend/templates/addons/kv_dhl_parcel_de/. Do not edit them in a store; they are replaced on update.