Add task for easily creating test invoices
This commit is contained in:
parent
596ed7fccc
commit
adedaa5f7b
@ -1,3 +1,6 @@
|
|||||||
|
require "digest"
|
||||||
|
require "pp"
|
||||||
|
|
||||||
namespace :lndhub do
|
namespace :lndhub do
|
||||||
desc "Generate wallets for all users"
|
desc "Generate wallets for all users"
|
||||||
task :generate_wallets => :environment do |t, args|
|
task :generate_wallets => :environment do |t, args|
|
||||||
@ -22,6 +25,21 @@ namespace :lndhub do
|
|||||||
puts "--\nSum of user balances: #{sum} sats"
|
puts "--\nSum of user balances: #{sum} sats"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc "Create test invoice"
|
||||||
|
task :create_test_invoice, [:username, :amount, :description] => :environment do |t, args|
|
||||||
|
user = User.find_by cn: args[:username]
|
||||||
|
desc = args[:description]
|
||||||
|
hash = Digest::SHA256.hexdigest(desc)
|
||||||
|
|
||||||
|
invoice = LndhubManager::CreateUserInvoice.call(user: user, payload: {
|
||||||
|
"amount": args[:amount].to_i,
|
||||||
|
"description": desc,
|
||||||
|
"description_hash": hash
|
||||||
|
})
|
||||||
|
|
||||||
|
pp invoice
|
||||||
|
end
|
||||||
|
|
||||||
desc "Migrate existing accounts to lndhub.go"
|
desc "Migrate existing accounts to lndhub.go"
|
||||||
task :migrate => :environment do |t, args|
|
task :migrate => :environment do |t, args|
|
||||||
# user = User.find_by cn: "jimmy"
|
# user = User.find_by cn: "jimmy"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user