From e2ca38a1088a0ec0595432726b2e708b14a811ea Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 21 Sep 2026 08:16:00 -0700 Subject: Point of sale: a bill, an optional tip prompt, one invoice, and a ledger that keeps tips apart. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A new deferred feature (src/features/pos.js): type the amount in the display unit, optionally a note, Charge. With the tip prompt on, the customer sees the bill and picks a percentage (configurable, default 10/15/20), their own figure, or no tip; one Lightning invoice is made for the total through the Ark feature's receive (new hooks arkLnInvoice/arkLnWatch/arkLnUnwatch/ arkLnCancel wrap createLnInvoice and pollArkLn). Paid, expired and cancelled sales are recorded with the bill and the tip as separate figures, and the fiat rate at the time; the amount screen shows today's bills, tips and total. Doors: Settings → Payments card, and a button under the payment address on Receive (a receiveExtras hook the names pane renders). Co-Authored-By: Claude Fable 5.1 --- src/features/ark.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/features/ark.js') diff --git a/src/features/ark.js b/src/features/ark.js index 5327a23..ef5d8fc 100644 --- a/src/features/ark.js +++ b/src/features/ark.js @@ -3238,6 +3238,16 @@ export function arkFeature(ctx) { }, arkSpendableSat() { const b = arkBalance(); return b ? b.spendableSat : 0; }, arkReady() { return arkAvailable(); }, + // A Lightning invoice for another feature to watch (point of sale): + // the action id is the handle, the poller tells it when it settles. + async arkLnInvoice(amountSat, description) { + const mgr = await connectArk(); + const a = await mgr.createLnInvoice(amountSat, description); + return { id: a.id, invoice: a.invoice, paymentHash: a.paymentHash, amountSat, expiresAt: a.expiresAt }; + }, + arkLnWatch(id, onSettle) { pollArkLn(id, onSettle); return true; }, + arkLnUnwatch(id) { stopArkLnPoll(id); return true; }, + async arkLnCancel(id) { const mgr = await connectArk(); await mgr.cancelLnInvoice(id); return true; }, async arkMakeInvoice(amountSat, description) { const mgr = await connectArk(); const a = await mgr.createLnInvoice(amountSat, description); -- cgit v1.2.3