mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-29 11:54:27 +01:00
* BPU Prep Work Part2 * Adjust tests to use the hot wallet when registering deriv scheme * Add amount to payment data view for onchain payments * Make zone limits higher when in dev mode (for tests in next PR) * Make IPaymentMethodDetails serialize/deserialize through payment type using the network * Allow named settings through settings repo * Refactor some extensions for next PR * pr changes * use json convert for now
54 lines
1.9 KiB
C#
54 lines
1.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using BTCPayServer.Payments.Lightning;
|
|
using BTCPayServer.Services.Invoices;
|
|
using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
namespace BTCPayServer.Payments
|
|
{
|
|
public class LightningPaymentType : PaymentType
|
|
{
|
|
public static LightningPaymentType Instance { get; } = new LightningPaymentType();
|
|
private LightningPaymentType()
|
|
{
|
|
|
|
}
|
|
|
|
public override string ToPrettyString() => "Off-Chain";
|
|
public override string GetId() => "LightningLike";
|
|
public override CryptoPaymentData DeserializePaymentData(BTCPayNetworkBase network, string str)
|
|
{
|
|
return ((BTCPayNetwork) network).ToObject<LightningLikePaymentData>(str);
|
|
}
|
|
|
|
public override string SerializePaymentData(BTCPayNetworkBase network, CryptoPaymentData paymentData)
|
|
{
|
|
return ((BTCPayNetwork) network).ToString(paymentData);
|
|
}
|
|
|
|
public override IPaymentMethodDetails DeserializePaymentMethodDetails(BTCPayNetworkBase network, string str)
|
|
{
|
|
return JsonConvert.DeserializeObject<Payments.Lightning.LightningLikePaymentMethodDetails>(str);
|
|
}
|
|
|
|
public override string SerializePaymentMethodDetails(BTCPayNetworkBase network, IPaymentMethodDetails details)
|
|
{
|
|
return JsonConvert.SerializeObject(details);
|
|
}
|
|
|
|
public override ISupportedPaymentMethod DeserializeSupportedPaymentMethod(BTCPayNetworkBase network, JToken value)
|
|
{
|
|
return JsonConvert.DeserializeObject<LightningSupportedPaymentMethod>(value.ToString());
|
|
}
|
|
|
|
public override string GetTransactionLink(BTCPayNetworkBase network, string txId)
|
|
{
|
|
return null;
|
|
}
|
|
public override string InvoiceViewPaymentPartialName { get; } = "ViewLightningLikePaymentData";
|
|
}
|
|
}
|