Exports and events ​
Client exports ​
exports.np_dealership:OpenCatalog('pdm', {})
local active, info = exports.np_dealership:IsTestDriving()
Server exports ​
These APIs are for trusted server resources. Do not expose reward, stock, title or settlement operations through unvalidated client events.
| Export | Signature / purpose |
|---|---|
| GetDealer | (dealerId) → dealer definition |
| AcquireDealer | (src, dealerId, method?) → acquisition result |
| GetStock | (dealerId, model?) → counts or model map |
| AddStock | (dealerId, model, count, opts?) → VIN list |
| Quote | (src, params) → quote; params include dealerId/model/config/method |
| Sell | (src, quoteId, opts?) → sale result |
| GiveVehicle | (src, model, opts?) → reward handover |
| TransferTitle | (vin, recipientIdentifier, opts?) → success/error; active lien blocks transfer |
| GetSale | (saleId) → persisted row |
| GetVehicleHistory | (vin) → sale history rows |
| GetSupply | (model) → cap, usage, period and reset estimate |
| GetCustomerQueue | (src, dealerId) → permitted queue rows |
| QueueAssign | (src, queueId) → assignment result |
| QueueDiscount | (src, queueId, percent) → server-clamped staff grant |
| AssignCustomer | (src, queueId) → assignment result |
| ReturnLease | (src, financeId) → eligible matured lease return |
| StartRepo | (vin, reason) → repo id |
| ClaimRepo | (src, jobId) → permission/proximity checked claim |
| CreateAuction | (vin, sourceKind, startPrice, duration) → auction id |
| PlaceBid | (src, auctionId, amount) → high bid / error |
| ClaimAuction | (src, auctionId) → winner collection result |
| RefundAuctionBid | (auctionId, bidderIdentifier, createdAt) → trusted settlement refund path |
| Appraise | (plate) → cached appraisal offer/result; first create an appraisal through its RPC |
| CreateOrder | (dealerId, importerId, lines, opts?) → order id |
| ClaimDelivery | (src, jobId) → delivery claim |
| CompleteDelivery | (src, jobId, report) → payout/error; verifies assigned driver and destination |
The server also exposes OpenCatalog(src, dealerId, opts?) to open a player's UI.
Events ​
Listen server-side with AddEventHandler:
| Event | Arguments |
|---|---|
| np_dealership:sold | saleId, sale |
| np_dealership:stockChanged | dealerId, model, counts |
| np_dealership:orderStatus | orderId, status |
| np_dealership:testDrive | src, vin, result |
| np_dealership:repoOpened / repoClosed | repoId, vin, result |
| np_dealership:auctionEnded | auctionId, winner, amount |
| np_dealership:leaseReturned | financeId, vin, penalty |
Event payloads are notifications. They do not authorize purchases or settle transactions.
Phone and checkout extensions ​
Autos also registers leaseReturn, leaseBuyout, auctionClaim, queueAssign and queueDiscount. Phone RPC names are unprefixed within app autos. catalog.reserve takes { dealerId, model, confirmedDeposit } and returns a reservation id/deposit/expiry. The built-in UI shows the server-returned vehicle.reservationDeposit and requires a second click to confirm; custom clients must pass that exact amount as confirmedDeposit. Pass the reservation id to re-quotes. dealer.acquire buys an eligible nearby NPC-until-bought business. A phone-signature checkout can return { pending = true, contractId }; handover arrives only after signature and completed sale.
Addons and NUI ​
Owner-tracked server registrations include registerHook, removeHook, registerImporter, unregisterImporter, registerPackage, registerFinanceProvider and registerDeliveryKind. Registrations are removed when their owning resource stops. Use the np_addon host convention for addon lifecycle.
The NUI uses POST https://np_dealership/rpc with { method, params }, answering { ok, data } or { ok = false, error }. Families are ui, catalog, checkout, testdrive, handover, tablet, orders, appraisal and admin. Client-only methods handle preview, camera and point picking; server operations validate their own authority.
Admin reconciliation RPCs ​
Both methods require np_dealership.admin and use the normal NUI RPC transport.
admin.payoutReview {}returns review rows withid,owner,amount,kind,payout_ref,claim_atandcreated_at.admin.payoutResolve { payoutId, status: 'paid' | 'pending' }resolves a review row after wallet evidence has been checked and returns{ status }.paidacknowledges a completed credit;pendingauthorizes the normal worker to retry. Resolution is audited.
The built-in admin Tools UI provides the review list and confirmation steps. See Admin payout reconciliation for the operator workflow.