Koovira Dev Docs
20-modules/services/overview.md

Module: HomeAssist / Services (homeassist / services)

Status: 🟒 Production (best-documented escrow flow; 0 live bookings currently) · Last validated: 2026-09-06 · Priority: P0

On-demand local services with an escrow-protected booking lifecycle. Validated against classs/ServiceModule.php (7,542 lines, re-measured 2026-09-06 β€” an earlier pass of this page said "~3,700 lines"; the file has grown since, code wins) + schema.

A. Purpose

Customers hire service providers (individual or company); money is held in escrow and released on completion. Revenue = 5% commission (platform_commission_settings.setting_key='service_booking', platform_commission_percent=5.00, is_active=1, checked 2026-09-06). Not hardcoded: at release time releaseEscrowForBooking (:2432) resolves the rate through CommissionEngineModule in order β€” plan-based rule (resolveCommission, :2596-2604) β†’ sr_service_categories.commission_percent (:2606-2616) β†’ this 5% platform default (:2618-2625) β€” so a specific category/plan can override the headline 5%. One historical commission txn exists for services (commission_transactions order_type='service', order_table='sr_service_escrow_orders, 1 row, 2026-09-06) even though sr_service_escrow_orders` itself is empty now (data since cleared/reset).

B. Actors

Customer; individual provider; company provider + staff; admin (escalation). Enrollment services.

C. Entry points

Consumer: /services.php, /topservices.php. Provider: management onboarding. All actions route through ServiceModule::handleRequest($action, $payload, $userId) (:83) β€” an in-class dispatcher.

D. Onboarding

createOrUpdateIndividualProvider (:1020) or createOrUpdateCompanyProvider (:1224). KYC via sr_service_provider_kyc_docs. Categories from sr_service_categories (120).

E. Feature registry (prefix SVC-)

IDFeatureActorMethodTablesStatus
SVC-001Provider onboardingprovidercreateOrUpdateIndividual/CompanyProvider :1020/:1224sr_service_providers🟒
SVC-002Create bookingcustomercreateBooking :1402sr_service_bookings🟒 (money)
SVC-003Init escrowsysteminitEscrowForBooking :2021sr_service_escrow_orders🟒
SVC-004Update booking statusprovider/customerupdateBookingStatus :3078sr_service_bookings🟒
SVC-005Customer confirm completioncustomercustomerConfirmCompletion :3698booking🟒
SVC-006Release escrowsystem/actorreleaseEscrowForBooking :2432escrow, wallet, commission🟒
SVC-007Refund escrow (cancel)actorrefundEscrowForCancelledBooking :2302escrow, wallet🟒
SVC-008Escalation / disputeactoropenEscalation :2785escalation🟒
SVC-009InvoiceproviderupsertInvoiceForBooking :3460, markInvoiceSent :3613invoice🟒

F. Escrow booking lifecycle (the archetype for escrow flows)

services.php β†’ createBooking(userId, payload)  :1402  β†’ sr_service_bookings (status=requested)
  β†’ initEscrowForBooking(bookingId, userId)  :2021  β†’ wallet debit β†’ escrow HOLD (sr_service_escrow_orders)
  β†’ provider accepts β†’ updateBookingStatus(...)  :3078
  β†’ work done β†’ customerConfirmCompletion(userId, bookingId)  :3698
  β†’ releaseEscrowForBooking(bookingId, actor)  :2432  β†’ escrow β†’ provider wallet, commission recorded,
     central finance ledger (module_key='homeassist'/'services', order_table='sr_service_bookings')
  cancel path β†’ refundEscrowForCancelledBooking  :2302  β†’ escrow β†’ customer wallet
  dispute β†’ openEscalation  :2785  β†’ admin resolves β†’ release or refund

G. Data model (2026-09-06)

TableRowsRole
sr_service_categories120service taxonomy
sr_service_providers0providers (unexercised currently)
sr_service_bookings0bookings (unexercised currently)
sr_service_escrow_orders0escrow holds

H. Financial impact

Escrow-first: money held on booking, released on completion (β†’ provider) or refunded on cancel (β†’ customer), 5% commission on release. This is the reference escrow pattern β€” mirror it for Freelancer and Classifieds. See ../../40-financial/central-finance-ledger.md.

K. State machine (sr_service_bookings)

requested β†’ accepted β†’ in_progress β†’ completed (customer-confirmed) β†’ released with cancelled (refund) / escalated (dispute β†’ resolved). Escrow: held β†’ released | held β†’ refunded.

L. Errors (prefix SVC-E)

  • SVC-E001 escrow not released β€” completion not customer-confirmed; check booking status.
  • SVC-E002 dispute open β€” openEscalation created; funds stay held until admin resolves.

M / N. Dependencies & change-impact

Wallet (escrow hold/release), commission, invoicing, logistics (materials), notifications. Changing the escrow path affects held funds — re-test hold→release and hold→refund with correct commission.