Module: Hyperlocal Delivery (hyperlocal / โ)
Status: ๐ก Partially implemented (delivery tasks flow on hardcoded fee constants; rider fleet empty; no admin pricing-override row configured) ยท Last validated: 2026-09-06 ยท Priority: P1
The last-mile rider layer that CommerceX/Food/etc. route local deliveries through. Validated against classs/HyperlocalModule.php + schema.
A. Purpose
Assign nearby riders to delivery tasks, price by distance, track. No commission model defined. Correction (2026-09-06): an earlier pass of this page framed the fee model as incomplete because "the pricing settings key is absent from config." The admin_global_settings row for that key (hyperlocal_delivery_pricing) is indeed absent (verified live, 2026-09-06), but computeDeliveryFee does not need it to function: deliveryPricingConfig() (:243) treats hardcoded class constants DELIVERY_BASE_FEE=40.0, DELIVERY_PER_KM=8.0, DELIVERY_MIN_FEE=40.0 (:20-22) as "the source of truth" (its own docblock, :238) and only optionally overrides them from that admin key at runtime. So the fee model is live and computing real fees today (โน40 base + โน8/km, โน40 floor) โ what is actually missing is an admin UI/config row to change those numbers without a code deploy, not a working fee calculation.
B. Actors
Rider (partner); the module that created the task (commerce/food); admin.
E. Feature registry (prefix HYP-)
| ID | Feature | Actor | Method | Tables | Status |
|---|---|---|---|---|---|
| HYP-001 | Register rider | rider | registerRider :113 | hyperlocal_riders | ๐ก |
| HYP-002 | Update location / online | rider | updateRiderLocation :133, toggleOnline :170 | hyperlocal_riders | ๐ข |
| HYP-003 | Create delivery task | module | createDeliveryTask(orderId, pickup, drop) :181 | hyperlocal_tasks | ๐ข |
| HYP-004 | Compute fee | system | computeDeliveryFee :289 (haversine :270) | โ | ๐ข (constants live; no admin override configured โ see correction below) |
| HYP-005 | Find nearby riders | system | findNearbyRiders(lat,lng,radius) :336 | hyperlocal_riders | ๐ข |
| HYP-006 | Assign rider | system | assignRider(taskId, riderId) :427 | hyperlocal_tasks | ๐ข |
Correction (2026-09-06): an earlier pass of this page nameddelivery_ordersas the delivery task table throughout HYP-003/HYP-006, the data model, and the state machine.grepacrossclasss/HyperlocalModule.phpfordelivery_ordersreturns zero hits โ the moduleCREATE TABLE IF NOT EXISTSs and reads/writes exclusivelyhyperlocal_tasks(:56schema,:221INSERT increateDeliveryTask,:452/:465/:479inassignRider/related).delivery_ordersis a real, populated table (61 rows) but it belongs to a different module's code path, not this one โ do not cite it for Hyperlocal claims. Code wins; corrected below.
G. Data model (2026-09-06)
hyperlocal_riders 0 (no riders onboarded) ยท hyperlocal_tasks 1 (the real live delivery-task table โ createDeliveryTask INSERTs here). delivery_orders (61 rows) exists in the schema but is never referenced by HyperlocalModule.php; it is out of this module's scope (likely owned by another delivery/courier code path not audited here) โ see correction above.
H. Financial impact
Delivery fee computed by computeDeliveryFee (:289) off hardcoded constants (โน40 base + โน8/km, โน40 floor โ see correction under Purpose) and added to the parent order; there is no hyperlocal commission. The fee model itself works; what's missing is (a) an admin-configurable override row and (b) any commission on the delivery fee.
K. State machine (hyperlocal_tasks.status, ENUM confirmed at :64)
pending โ assigned โ picked_up โ delivered / cancelled. assignRider (:427) is the only observed pending โ assigned transition in this file; no code path in HyperlocalModule.php was found that moves a task to picked_up/delivered (OTP columns otp_pickup/otp_drop exist on the table but no method here reads/verifies them) โ Requires Verification: confirm whether those transitions live in a rider-facing app/API file outside this class before assuming they're missing.
L / M / N
Errors: HYP-E001 no rider found (hyperlocal_riders=0 โ nothing to assign). Depends on the calling module (commerce/food routing), geo. Change-impact: it is the shared last-mile layer โ onboarding riders + an admin pricing override activates configurable pricing for every module that creates delivery tasks (the fee itself already works via constants without either).