DRY up btcpay and lndhub services

Removing initialize methods from the main/manager class also allows for
different iniitalizers in specific task services
This commit is contained in:
2024-02-14 10:44:47 +01:00
parent fee951c05c
commit 69b3afb8f7
5 changed files with 43 additions and 25 deletions

View File

@@ -1,7 +1,7 @@
module BtcpayManager
class FetchLightningWalletBalance < BtcpayManagerService
def call
res = get "stores/#{store_id}/lightning/BTC/balance"
res = get "/lightning/BTC/balance"
{
confirmed_balance: res["offchain"]["local"].to_i / 1000 # msats to sats

View File

@@ -1,7 +1,7 @@
module BtcpayManager
class FetchOnchainWalletBalance < BtcpayManagerService
def call
res = get "stores/#{store_id}/payment-methods/onchain/BTC/wallet"
res = get "/payment-methods/onchain/BTC/wallet"
{
balance: (res["balance"].to_f * 100000000).to_i, # BTC to sats