Skip to content

Commit

Permalink
chore: publish payment failed event
Browse files Browse the repository at this point in the history
  • Loading branch information
im-adithya committed Jul 19, 2024
1 parent f3d66e3 commit 467a0f8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lnclient/lnd/lnd.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,14 @@ func NewLNDService(ctx context.Context, eventPublisher events.EventPublisher, ln
time.Sleep(2 * time.Second)
continue
}
if payment.Status != lnrpc.Payment_SUCCEEDED {

var eventName string
switch payment.Status {
case lnrpc.Payment_FAILED:
eventName = "nwc_payment_failed_async"
case lnrpc.Payment_SUCCEEDED:
eventName = "nwc_payment_sent"
default:
continue
}

Expand All @@ -454,7 +461,7 @@ func NewLNDService(ctx context.Context, eventPublisher events.EventPublisher, ln
}

eventPublisher.Publish(&events.Event{
Event: "nwc_payment_sent",
Event: eventName,
Properties: transaction,
})
}
Expand Down

0 comments on commit 467a0f8

Please sign in to comment.