Skip to content

Developer notes

Technical reference for developers who customize The Courier Guy (ShipLogic) Shipping.

Item Value
Add-on id kv_za_couriers
Function prefix fn_kv_za_couriers_
Language variables kv_za_couriers.*
CSS scope .kv-za-couriers
PHP namespace Tygh\Addons\KvZaCouriers
Preset shipping (generated by kv new --kind integration)
Class Role
Client\BaseClient HTTP (cURL, TLS verification, timeouts), JSON, OAuth2 client-credentials with an encrypted token cache, error mapping, masked logging
Client\Api The ShipLogic API: rates, create / list shipments, label PDF through the signed URL (fetched without the key), cancel, tracking; bearer key
Waybill, Parcel Pure mappers: address / contact / parcel bodies, rate and shipment parsers, status words, tracking state
RateCalculator Checkout rates: 5 second timeout, 10 minute cache, ZAR conversion, fallback
Shipments Waybill creation under the lock label:<order> with a request reference stored before the call, adoption by list lookup, cancel, tracking, label
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, filters, CSV, retention
Webhook Signature check and event ids; the controller kv_za_couriers.webhook?c=<account> stores the event as a job
Table Purpose
?:kv_za_couriers_accounts Credentials per company (secrets sealed), last connection check, token cache
?:kv_za_couriers_log Log
?:kv_za_couriers_jobs Queue
?:kv_za_couriers_shipments Labels and tracking

PHP: change_order_status_post (waybill at a chosen order status). Template hooks: orders:tabs_extra (waybill tab), orders:list_tools (bulk action in the order list). The shipping service class is Tygh\Shippings\Services\KvZaCouriers. Every ShipLogic call and field is listed with its documentation page in notes/API-NOTES.md.

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

$config['kv_za_couriers_base_url'] = 'http://127.0.0.1:11830';

node tests/mock-server/server.js 11830 starts a local stand-in of the provider API; node tests/e2e/e2e.mjs runs the HTTP end-to-end test against it; php tests/unit.php runs the unit tests.

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