Developer notes
Technical reference for developers who customize Packeta Shipping & Labels.
Add-on identity
Section titled “Add-on identity”| Item | Value |
|---|---|
| Add-on id | kv_packeta |
| Function prefix | fn_kv_packeta_ |
| Language variables | kv_packeta.* |
| CSS scope | .kv-packeta, .kv-pkt |
| PHP namespace | Tygh\Addons\KvPacketa |
| Preset | shipping |
Structure
Section titled “Structure”| Class | Role |
|---|---|
Client\BaseClient |
HTTP (cURL, TLS verification, timeouts), error mapping, masked logging |
Client\Api |
Packeta REST/XML: serialiser and parser, createPacket, cancelPacket, packetInfo, label methods (Packeta and carrier, PDF and ZPL, bulk), packetStatus, packetTracking, widget validation, carrier list |
Shipments |
Order to PacketAttributes (recipient, point or address, currency conversion, COD, weight), label choice (Packeta, carrier, fallback), status mapping, cancel, push event application |
Points, Parcel |
Point of an order (own table, or the point stored by EU Pickup Points), widget options, server-side validation; destination rules (phone formats, currency, COD rounding, street split) |
RateCalculator |
Customer price from the shipping method’s own parameters |
Client |
Client per company, the connection test |
Accounts, Secret |
Credentials (test and live) sealed with AES-256-GCM; 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(), recurring work in Jobs::schedule() |
Log |
Event log with masking (API password in XML, API key in feed URLs), filters, CSV, retention |
Webhook |
HMAC-SHA256 verification of Packeta push events (timestamp.rawBody), event ids; the controller kv_packeta.webhook?c=<account> stores verified POST events as jobs |
Database tables
Section titled “Database tables”| Table | Purpose |
|---|---|
?:kv_packeta_accounts |
Credentials per company (secrets sealed), sender, last connection check |
?:kv_packeta_log |
Log |
?:kv_packeta_jobs |
Queue |
?:kv_packeta_shipments |
Packets, labels (base64), courier number, label kind and tracking |
?:kv_packeta_points |
Pick-up point chosen at the checkout, per order (internal point id or carrier id + carrier point) |
Hooks used
Section titled “Hooks used”PHP: change_order_status_post (label at a status), get_order_info, place_order, place_suborders, delete_order (point with the order), template_document_order_context_init (point text on documents). Template hooks: checkout/shipping_method.post (point 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 pick-up point order without a point.
The storefront output is the checkout page (never cached: it depends on the session cart) plus one static stylesheet; nothing per-visitor is printed on cacheable pages, so the add-on is safe with the full page cache of 4.21.
Test the HTTP layer without the provider
Section titled “Test the HTTP layer without the provider”The endpoint can be overridden for tests in config.local.php (development only):
$config['kv_packeta_base_url'] = 'http://127.0.0.1:11840';node tests/mock-server/server.js 11840 starts a local stand-in of the Packeta API (REST/XML, widget validation, carrier list) that follows the official documentation; node tests/e2e/e2e.mjs runs the HTTP end-to-end test against it; php tests/unit.php runs the unit tests with the official examples.
Template overrides
Section titled “Template overrides”Admin templates live in design/backend/templates/addons/kv_packeta/. Do not edit them in a store; they are replaced on update.