code wiki / _hdl_build / nx_cms_ecommerce.nx
nx_cms_ecommerce.nx
buildroot/runtime/_hdl_build/nx_cms_ecommerce.nx
about
nx_cms_ecommerce.nx -- CMS ECOMMERCE core (sovereign cart, exact money, inventory, order FSM). The
WooCommerce class, made Nishi-native: ALL money is INTEGER CENTS (basis-point tax/discount) so there is
ZERO floating-point rounding drift (the exceed angle -- float money is a real WooCommerce/Stripe pain),
inventory is OVERSELL-PROOF (stock can never go negative, an over-quantity is refused not clamped), and
the order lifecycle is an EXACT state machine. Pure deterministic integer logic -- the payment gateway is
the only last-mile boundary; the commerce core is sovereign. Rates are the data-driven seam (rule 11).
license_tier: ORIGINAL
dependencies 1 imports · 2 importers
imports: nx_syscalls.nx
imported by: nx_aw_devserver.nxnx_cms_ecommerce_gate.nx
structs
| none |
consts
| 11 | const NX_ORD_CART: i64 = 0 |
| 12 | const NX_ORD_PENDING: i64 = 1 // placed, awaiting payment |
| 13 | const NX_ORD_PAID: i64 = 2 |
| 14 | const NX_ORD_SHIPPED: i64 = 3 |
| 15 | const NX_ORD_CANCELLED: i64 = 4 |
| 17 | const NX_EC_BPS: i64 = 10000 // basis-point denominator (100.00% = 10000 bps) |
functions
| 20 | func ec_line_total(unit_cents: i64, qty: i64) -> i64 { return unit_cents * qty } |
| 23 | func ec_cart_subtotal(unit_cents: *i64, qty: *i64, n: i64) -> i64 |
| 31 | func ec_apply_tax(subtotal_cents: i64, tax_bps: i64) -> i64 called by 1: main |
| 36 | func ec_apply_discount(subtotal_cents: i64, discount_bps: i64) -> i64 called by 1: main |
| 41 | func ec_stock_ok(available: i64, requested: i64) -> i64 |
| 48 | func ec_decrement_stock(available: i64, requested: i64) -> i64 |
| 54 | func ec_order_can_transition(from: i64, to: i64) -> i64 called by 1: main |