Allow comments for LNURL-PAY invoices #65

Merged
raucao merged 3 commits from feature/lnurlp_memos into master 2022-03-02 14:13:40 +00:00
2 changed files with 5 additions and 4 deletions
Showing only changes of commit 9903683536 - Show all commits

View File

@@ -20,7 +20,7 @@ class LnurlpayController < ApplicationController
def invoice
amount = params[:amount].to_i / 1000 # msats
address = params[:address]
comment = params[:comment]
comment = params[:comment] || ""
if !valid_amount?(amount)
render json: { status: "ERROR", reason: "Invalid amount" }
@@ -32,10 +32,12 @@ class LnurlpayController < ApplicationController
return
end
memo = "Sats for #{address}"
memo = "#{memo}: \"#{comment}\"" if comment.present?
payment_request = @user.ln_create_invoice({
amount: amount, # we create invoices in sats
description_hash: Digest::SHA2.hexdigest(metadata(address)),
memo: comment
memo: memo
})
render json: {

View File

@@ -49,7 +49,6 @@ class Lndhub
def addinvoice(payload)
invoice = post "addinvoice", {
amt: payload[:amount],
description_hash: payload[:description_hash],
memo: payload[:memo]
}