From d79dcba4cb71626327bec909c85c0396d10475c8 Mon Sep 17 00:00:00 2001 From: Padreug Date: Wed, 13 May 2026 11:40:43 +0200 Subject: [PATCH 01/11] feat(restaurant/checkout): tag outgoing payment with restaurant + order id Adds extra={tag:'restaurant', restaurant_id, order_id} to the POST /api/v1/payments body when paying a placed-order's bolt11. Mirrors the same extras the extension stamps on its incoming invoice, so a customer's wallet history can later filter or surface restaurant orders rather than showing them as generic Lightning sends. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/modules/restaurant/composables/useCheckout.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/modules/restaurant/composables/useCheckout.ts b/src/modules/restaurant/composables/useCheckout.ts index f42e6c8..fdf75ab 100644 --- a/src/modules/restaurant/composables/useCheckout.ts +++ b/src/modules/restaurant/composables/useCheckout.ts @@ -236,7 +236,8 @@ export function useCheckout(): UseCheckoutReturn { async function payBolt11Raw( bolt11: string, - adminkey: string + adminkey: string, + extra?: Record ): Promise { const response = await fetch(`${apiBaseUrl}/api/v1/payments`, { method: 'POST', @@ -244,7 +245,7 @@ export function useCheckout(): UseCheckoutReturn { 'Content-Type': 'application/json', 'X-Api-Key': adminkey, }, - body: JSON.stringify({ out: true, bolt11 }), + body: JSON.stringify({ out: true, bolt11, ...(extra ? { extra } : {}) }), }) if (!response.ok) { let detail = response.statusText @@ -272,7 +273,15 @@ export function useCheckout(): UseCheckoutReturn { state.value.step = 'paying' state.value.currentRestaurantSlug = placed.restaurantSlug try { - await payBolt11Raw(placed.invoice.bolt11, adminkey) + // Tag the outgoing payment so the customer's wallet history + // can later surface it as a restaurant order. Mirrors the + // `extra={"tag": "restaurant", ...}` the extension stamps on + // its incoming invoice. + await payBolt11Raw(placed.invoice.bolt11, adminkey, { + tag: 'restaurant', + restaurant_id: placed.restaurantId, + order_id: placed.order.id, + }) // Set semantics keeps `paidOrderIds` from re-renders; rebuild // it on update so Vue picks up the change. state.value.paidOrderIds = new Set([ From d33359a9019af55f4d5508c0543d45be296d777c Mon Sep 17 00:00:00 2001 From: Padreug Date: Wed, 13 May 2026 11:40:43 +0200 Subject: [PATCH 02/11] feat(restaurant/checkout): tag outgoing payment with restaurant + order id Adds extra={tag:'restaurant', restaurant_id, order_id} to the POST /api/v1/payments body when paying a placed-order's bolt11. Mirrors the same extras the extension stamps on its incoming invoice, so a customer's wallet history can later filter or surface restaurant orders rather than showing them as generic Lightning sends. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/modules/restaurant/composables/useCheckout.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/modules/restaurant/composables/useCheckout.ts b/src/modules/restaurant/composables/useCheckout.ts index f42e6c8..fdf75ab 100644 --- a/src/modules/restaurant/composables/useCheckout.ts +++ b/src/modules/restaurant/composables/useCheckout.ts @@ -236,7 +236,8 @@ export function useCheckout(): UseCheckoutReturn { async function payBolt11Raw( bolt11: string, - adminkey: string + adminkey: string, + extra?: Record ): Promise { const response = await fetch(`${apiBaseUrl}/api/v1/payments`, { method: 'POST', @@ -244,7 +245,7 @@ export function useCheckout(): UseCheckoutReturn { 'Content-Type': 'application/json', 'X-Api-Key': adminkey, }, - body: JSON.stringify({ out: true, bolt11 }), + body: JSON.stringify({ out: true, bolt11, ...(extra ? { extra } : {}) }), }) if (!response.ok) { let detail = response.statusText @@ -272,7 +273,15 @@ export function useCheckout(): UseCheckoutReturn { state.value.step = 'paying' state.value.currentRestaurantSlug = placed.restaurantSlug try { - await payBolt11Raw(placed.invoice.bolt11, adminkey) + // Tag the outgoing payment so the customer's wallet history + // can later surface it as a restaurant order. Mirrors the + // `extra={"tag": "restaurant", ...}` the extension stamps on + // its incoming invoice. + await payBolt11Raw(placed.invoice.bolt11, adminkey, { + tag: 'restaurant', + restaurant_id: placed.restaurantId, + order_id: placed.order.id, + }) // Set semantics keeps `paidOrderIds` from re-renders; rebuild // it on update so Vue picks up the change. state.value.paidOrderIds = new Set([ From 31cefac18386dcfcc9b0c2548a98f19116618fec Mon Sep 17 00:00:00 2001 From: Padreug Date: Sat, 16 May 2026 23:16:42 +0200 Subject: [PATCH 03/11] feat(libra): wire up income submission flow Adds the frontend pair to libra's new POST /entries/income endpoint: SUBMIT_INCOME in PermissionType, IncomeEntry/IncomeEntryRequest types, ExpensesAPI.submitIncome wrapping the new endpoint, and the AddIncome view collecting description / amount / revenue account / payment-method account / currency / reference. Mirrors the existing expense flow so non-admin users can log income on behalf of the organization for super-user review. --- src/accounting-app/views/AddIncome.vue | 394 +++++++++++++++++-- src/modules/expenses/services/ExpensesAPI.ts | 29 ++ src/modules/expenses/types/index.ts | 31 ++ 3 files changed, 423 insertions(+), 31 deletions(-) diff --git a/src/accounting-app/views/AddIncome.vue b/src/accounting-app/views/AddIncome.vue index e3a009f..f9f80a7 100644 --- a/src/accounting-app/views/AddIncome.vue +++ b/src/accounting-app/views/AddIncome.vue @@ -1,7 +1,243 @@ +