btcpayserver/BTCPayServer/Models/WalletViewModels/PayoutsModel.cs
Andrew Camilleri 2e12befb8b
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
2021-04-13 17:36:49 +09:00

42 lines
1.4 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using BTCPayServer.Client.Models;
using BTCPayServer.Data;
using BTCPayServer.Payments;
namespace BTCPayServer.Models.WalletViewModels
{
public class PayoutsModel
{
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; }
public bool Selected { get; set; }
public DateTimeOffset Date { get; set; }
public string PullPaymentId { get; set; }
public string PullPaymentName { get; set; }
public string Destination { get; set; }
public string Amount { get; set; }
public string TransactionLink { get; set; }
}
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();
}
}
}