WIP Persist zaps, create and send zap receipts
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
2024-05-09 14:31:37 +02:00
parent c0f4e7925e
commit c6c5d80fb4
17 changed files with 242 additions and 37 deletions
+8 -1
View File
@@ -52,7 +52,7 @@ class LnurlpayController < ApplicationController
return
end
if params[:nostr].present?
if params[:nostr].present?# TODO && Setting.nostr_enabled?
handle_zap_request amount, params[:nostr], params[:lnurl]
else
handle_pay_request address, amount, comment
@@ -131,6 +131,9 @@ class LnurlpayController < ApplicationController
return
end
# TODO might want to use the existing invoice and zap record if there are
# multiple calls with the same zap request
desc = "Zap for #{@user.address}"
desc = "#{desc}: \"#{event.content}\"" if event.content.present?
@@ -142,6 +145,10 @@ class LnurlpayController < ApplicationController
}
)
@user.zaps.create! request: event,
payment_request: invoice["payment_request"],
amount: amount
render json: { status: "OK", pr: invoice["payment_request"] }
end
end