Compare commits
11 commits
c2e8fca613
...
89145b39cd
| Author | SHA1 | Date | |
|---|---|---|---|
| 89145b39cd | |||
| bfa5118fbe | |||
| 30ad4cf512 | |||
| 26a89c58dd | |||
| 84456a849e | |||
| 0e03a424cb | |||
| 5902aed431 | |||
| 4fee9c015d | |||
| 0390ecd4a0 | |||
| 31cefac183 | |||
| d33359a901 |
1 changed files with 12 additions and 3 deletions
|
|
@ -236,7 +236,8 @@ export function useCheckout(): UseCheckoutReturn {
|
|||
|
||||
async function payBolt11Raw(
|
||||
bolt11: string,
|
||||
adminkey: string
|
||||
adminkey: string,
|
||||
extra?: Record<string, unknown>
|
||||
): Promise<void> {
|
||||
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([
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue