Skip to content

Commit

Permalink
Merge branch 'task-pay-keysend' of github.com:getAlby/nostr-wallet-co…
Browse files Browse the repository at this point in the history
…nnect into task-pay-keysend
  • Loading branch information
rolznz committed Dec 13, 2023
2 parents 823c1ed + 27c4589 commit d18b5d4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
7 changes: 2 additions & 5 deletions handle_pay_keysend_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,8 @@ func (svc *Service) HandlePayKeysendEvent(ctx context.Context, request *Nip47Req
return nil, err
}

hasPermission, code, message := svc.hasPermission(&app, event, NIP_47_PAY_INVOICE_METHOD, 0)
if hasPermission {
// We use pay_invoice permissions for budget and max amount
hasPermission, code, message = svc.hasPermission(&app, event, NIP_47_PAY_INVOICE_METHOD, payParams.Amount)
}
// We use pay_invoice permissions for budget and max amount
hasPermission, code, message := svc.hasPermission(&app, event, NIP_47_PAY_INVOICE_METHOD, payParams.Amount)

if !hasPermission {
svc.Logger.WithFields(logrus.Fields{
Expand Down
7 changes: 0 additions & 7 deletions service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,13 +314,6 @@ func TestHandleEvent(t *testing.T) {
newMaxAmount = 1000
err = svc.db.Model(&AppPermission{}).Where("app_id = ?", app.ID).Update("request_method", NIP_47_PAY_INVOICE_METHOD).Update("max_amount", newMaxAmount).Error
assert.NoError(t, err)
// create a second permission for getting the budget
appPermission = &AppPermission{
AppId: app.ID,
App: app,
RequestMethod: NIP_47_PAY_KEYSEND_METHOD,
ExpiresAt: expiresAt,
}
err = svc.db.Create(appPermission).Error
res, err = svc.HandleEvent(ctx, &nostr.Event{
ID: "test_pay_keysend_event_2",
Expand Down

0 comments on commit d18b5d4

Please sign in to comment.