fix: use fresh balance in PayAppUserInvoice notification
Some checks failed
Docker Compose Actions Workflow / test (push) Has been cancelled
Some checks failed
Docker Compose Actions Workflow / test (push) Has been cancelled
notifyAppUserPayment was sending the stale cached balance from the entity loaded before PayInvoice decremented it. Update the entity's balance_sats from the PayInvoice response so LiveUserOperation events contain the correct post-payment balance. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
109550e693
commit
492fb8981a
1 changed files with 2 additions and 0 deletions
|
|
@ -241,6 +241,8 @@ export default class {
|
|||
const paid = await this.paymentManager.PayInvoice(appUser.user.user_id, req, app, {
|
||||
ack: pendingOp => { this.notifyAppUserPayment(appUser, pendingOp) }
|
||||
})
|
||||
// Refresh appUser balance from DB so notification has accurate latest_balance
|
||||
appUser.user.balance_sats = paid.latest_balance
|
||||
this.notifyAppUserPayment(appUser, paid.operation)
|
||||
getLogger({ appName: app.name })(appUser.identifier, "invoice paid", paid.amount_paid, "sats")
|
||||
return paid
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue