Skip to content

Development ​

Layout ​

fxmanifest.lua
shared/lib/                 00_core (NpPay namespace, bridge selection, safe calls), 01_locale, 02_format
shared/config.lua           Config.*
shared/locales/             en / de (Lua strings + ui.* web strings)
bridge/framework/client/    0_common 1_qbx 2_qb 3_esx 9_standalone
bridge/framework/server/    0_common 1_qbx 2_qb 3_esx 9_standalone
bridge/banking/server/      0_common (provider contract, RegisterProvider) 1_np_banking 2_renewed 3_qb_banking
                            4_okok 5_esx_society 9_framework
bridge/inventory/server/    0_common 1_ox (also np_inventory) 2_qb 3_esx 9_none
server/                     00_server 01_db 02_rpc 03_methods 04_rules 05_requests 06_charge (+ split)
                            07_approvals 08_invoices 09_terminal 10_quick (+ give cash) 11_phone 12_integrations
                            20_exports 30_commands
client/                     00_state 01_nui 02_rpc 03_checkout 04_quick 05_terminal 06_menu 10_api
sql/np_payments.sql         schema (also run at start with Config.AutoCreateTables)
web/                        NUI: React 18 + Vite 5 + TypeScript strict + zustand
                            index.html = checkout / terminal / pill / PIN, phone.html = np_phone Pay app
design/                     Nimbus UI tokens and CSS (same copy as np_banking, never edited)
tests/                      plain-Lua harness + run.sh

Files are numbered so the glob order in fxmanifest.lua is deterministic. Code resolves NpPay.X when it's called, never at file load, so later files can replace modules. All SQL lives in server/01_db.lua, so the tests swap it for an in-memory store. 30_commands.lua loads last and boots the server once every module exists.

Build ​

sh
cd web
npm ci
npm run build        # FiveM guard check + tsc --noEmit + vite build → web/dist/index.html, web/dist/phone.html
npm test             # vitest: formatting, split maths, checkout store flow, phone logic, silver-line CSS lint
npm run dev          # browser mock with a dev bar
npm run screenshots  # mock build into dist-mock, then headless Chrome → web/screenshots/*.png

npm run build first runs scripts/check-fivem-guard.mjs. index.html and phone.html set html.nb-fivem before the first paint, and the CSS turns backdrop-filter off under it and uses a denser glass tint instead. In FiveM a blurred surface renders as a black box over the game. The guard fails the build when CSS uses backdrop-filter but the html.nb-fivem rule or the code that sets the class is missing.

Browser mock ​

npm run dev runs the UI without FiveM, with mock data and a dev bar. URL parameters pick a screen:

Parameter Values
screen checkout, states, split, tip, later, terminal, request, pin, quick, phone
state processing, accepted, declined, approval, waiting
variant toll, parking, fuel (quick pill)
material liquid
locale de
hide 1 (hidden balances)
shot 1 (no dev bar, for screenshots)

The mock PIN is 1234. The screenshots on these pages come from npm run screenshots.

Tests ​

sh
bash tests/run.sh             # luac -p on every Lua file, then the server and client suites (plain Lua 5.4+)
VERBOSE=1 bash tests/run.sh   # with resource log lines

The harness (tests/harness.lua, tests/harness_fakes.lua) stubs the FiveM natives, oxmysql (in-memory repository), qb-core and ESX players, the banking resources, np_hud and np_phone. The suites cover method building and disabled reasons, charge and rollback, split rollback, limits and the day rollover, approvals (approve, deny, timeout), invoices and late fees, terminal distance and job checks, quick pay and auto-pay, request expiry, player drops, the RPC rate limit, the qb, esx and standalone bridges, and the banking fallbacks.

The np_banking bridge is also tested from the other side: np_banking's suite test_payments_contract loads bridge/banking/server/1_np_banking.lua from a sibling ../np_payments and runs it against np_banking's exports (see np_banking → Development).

Try it in game ​

/paytest with the permission node np_payments.admin (or Config.Debug = true) opens sample payments: checkout, quick, split, later, terminal. See Events & commands.