You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(api,rider): COD debt cap — pause dispatch when a rider owes too much
Prevents a rider accumulating unbounded platform cash (COD they collected but
haven't deposited) and absconding. New platform-config field riderCodCapPhp
(default ₱1,500, env RIDER_COD_CAP_PHP): once a rider's outstanding COD
(collected − deposited) reaches the cap, they stop receiving new jobs until
they deposit.
- platform-config: riderCodCapPhp added to CONFIG_FIELDS, defaults, and the
grouped values; migration adds the column (default 1500).
- orders.repository: riderOutstandingCod(rider) for the manual gate;
pickAutoDispatchRider now filters over-cap riders (batched two-groupBy, no
per-rider round-trip) so auto-dispatch skips them too.
- orders.service.assignRider: rejects an over-cap rider (parity with the
auto-dispatch filter) — BadRequest naming the limit.
- rider-cash: /me/cash now returns capPhp; the Cash tab shows "new jobs pause
once you owe ₱X" and flips to "over the limit — deposit to resume" when hit.
Note: ₱100 (as floated) would block a rider after one order — a single wash's
COD exceeds it. ₱1,500 (~4-7 orders) bounds abscond loss while allowing a normal
batch. The ~₱100 "carry allowance" (auto-net small debt vs weekly earnings) is a
separate remittance-netting feature, deferred.
New tests: over-cap assign rejected, just-under-cap allowed, balance carries the
cap, config default. 136 api unit tests green.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments