mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-19 06:54:19 +01:00
Refactor and decouple Payout logic (#2046)
* Refactor and decouple Payout logic So that we can support lightning and more complex flows like allowing external payments to payouts. * fix dropdown align * switch to simpler buttons * rebase fixes add some comments * rebase fixes add some comments * simplify enum caveman logic * reduce code duplication and db round trips * Fix pull payment date format * fix issue with payouts to send page not working correctly * try fix some style issue * fix bip21parse
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BTCPayServer.Client.Models;
|
||||
using BTCPayServer.Data;
|
||||
using BTCPayServer.Payments;
|
||||
|
||||
namespace BTCPayServer.Models.WalletViewModels
|
||||
{
|
||||
@@ -7,6 +11,9 @@ namespace BTCPayServer.Models.WalletViewModels
|
||||
{
|
||||
public string PullPaymentId { get; set; }
|
||||
public string Command { get; set; }
|
||||
public List<PayoutStateSet> PayoutStateSets{ get; set; }
|
||||
public PaymentMethodId PaymentMethodId { get; set; }
|
||||
|
||||
public class PayoutModel
|
||||
{
|
||||
public string PayoutId { get; set; }
|
||||
@@ -18,7 +25,18 @@ namespace BTCPayServer.Models.WalletViewModels
|
||||
public string Amount { get; set; }
|
||||
public string TransactionLink { get; set; }
|
||||
}
|
||||
public List<PayoutModel> WaitingForApproval { get; set; } = new List<PayoutModel>();
|
||||
public List<PayoutModel> Other { get; set; } = new List<PayoutModel>();
|
||||
|
||||
public class PayoutStateSet
|
||||
{
|
||||
public PayoutState State { get; set; }
|
||||
public List<PayoutModel> Payouts { get; set; }
|
||||
}
|
||||
|
||||
public string[] GetSelectedPayouts(PayoutState state)
|
||||
{
|
||||
return PayoutStateSets.Where(set => set.State == state)
|
||||
.SelectMany(set => set.Payouts.Where(model => model.Selected).Select(model => model.PayoutId))
|
||||
.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user