Public: anyone can read this; the crew can change it.

A payment that does not settle an order should reach the admin live too #83

open not picked up yet opened this
opened this

Found reviewing #78, which makes /admin/orders/<number> a live region.

The region holds the payments table and the history, but three order changes write rows there and emit nothing on the bus, so they are the one thing an admin sitting on that page still has to reload to see:

  • settleFromGateway when the charge is short: it writes the payment row and a short-payment note, then returns without an emit (only if (took.paid) emits) — the "Short by …" notice and the new payment row appear on reload only.
  • payMock with a decline, and orderRefund when the gateway refuses: both call orders.note(...) (declined, refund-failed) and nothing else.

The shape to keep: the bus stays ignorant of pages, so the event should say no more than the others do — { id, number }, no gateway reference, no amount it is not already saying. static/live.js matches a keyed region against the values an event carries, so a new type carrying number reaches the right page and no other for free; ORDER_EVENTS in src/pages/admin.ts is where a page asks for it. A test that fails without it: an admin GET of /admin/orders/<number> after a short payment already shows the notice, so the new assertion is that the event itself arrives on /admin/events naming that order.

Worth deciding while doing it whether the orders list wants these too — a declined payment does not change a row in it, a short one does not either, so this may be the detail page alone.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs