2021-04-13 10:36:49 +02:00
|
|
|
using System.Linq;
|
|
|
|
using System.Text;
|
2024-05-01 10:22:07 +09:00
|
|
|
using BTCPayServer.Payouts;
|
2021-04-13 10:36:49 +02:00
|
|
|
using NBitcoin.JsonConverters;
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
|
|
|
namespace BTCPayServer.Data
|
|
|
|
{
|
|
|
|
public static class PullPaymentsExtensions
|
|
|
|
{
|
2021-12-31 16:59:02 +09:00
|
|
|
|
2021-04-13 10:36:49 +02:00
|
|
|
public static PullPaymentBlob GetBlob(this PullPaymentData data)
|
|
|
|
{
|
2024-08-28 18:52:08 +09:00
|
|
|
return JsonConvert.DeserializeObject<PullPaymentBlob>(data.Blob);
|
2021-04-13 10:36:49 +02:00
|
|
|
}
|
|
|
|
public static void SetBlob(this PullPaymentData data, PullPaymentBlob blob)
|
|
|
|
{
|
2024-03-14 19:13:26 +09:00
|
|
|
data.Blob = JsonConvert.SerializeObject(blob).ToString();
|
2021-04-13 10:36:49 +02:00
|
|
|
}
|
|
|
|
|
2024-08-28 18:52:08 +09:00
|
|
|
public static bool IsSupported(this PullPaymentData data, PayoutMethodId payoutMethodId)
|
2021-04-13 10:36:49 +02:00
|
|
|
{
|
2024-08-28 18:52:08 +09:00
|
|
|
return data.GetBlob().SupportedPayoutMethods.Contains(payoutMethodId);
|
2021-04-13 10:36:49 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|