2022-02-07 09:39:48 +01:00
|
|
|
using System.Collections.Generic;
|
2021-12-31 16:59:02 +09:00
|
|
|
using BTCPayServer.Client.JsonConverters;
|
2021-10-25 08:18:02 +02:00
|
|
|
using BTCPayServer.Lightning;
|
|
|
|
using BTCPayServer.Payments.Lightning;
|
|
|
|
using Newtonsoft.Json;
|
2022-02-15 11:36:04 +01:00
|
|
|
using Newtonsoft.Json.Linq;
|
2021-10-25 08:18:02 +02:00
|
|
|
|
|
|
|
namespace BTCPayServer.Payments
|
|
|
|
{
|
|
|
|
public class LNURLPayPaymentMethodDetails : LightningLikePaymentMethodDetails
|
|
|
|
{
|
|
|
|
public LightningSupportedPaymentMethod LightningSupportedPaymentMethod { get; set; }
|
2021-12-31 16:59:02 +09:00
|
|
|
|
2021-10-25 08:18:02 +02:00
|
|
|
[JsonConverter(typeof(LightMoneyJsonConverter))]
|
|
|
|
public LightMoney GeneratedBoltAmount { get; set; }
|
2022-02-07 09:39:48 +01:00
|
|
|
|
2021-10-25 08:18:02 +02:00
|
|
|
public string BTCPayInvoiceId { get; set; }
|
|
|
|
public bool Bech32Mode { get; set; }
|
|
|
|
|
|
|
|
public string ProvidedComment { get; set; }
|
2021-10-29 11:01:16 +02:00
|
|
|
public string ConsumedLightningAddress { get; set; }
|
2021-10-25 08:18:02 +02:00
|
|
|
|
|
|
|
public override PaymentType GetPaymentType()
|
|
|
|
{
|
|
|
|
return LNURLPayPaymentType.Instance;
|
|
|
|
}
|
|
|
|
|
|
|
|
public override string GetAdditionalDataPartialName()
|
|
|
|
{
|
2021-10-29 11:01:16 +02:00
|
|
|
if (string.IsNullOrEmpty(ProvidedComment) && string.IsNullOrEmpty(ConsumedLightningAddress))
|
2021-10-25 08:18:02 +02:00
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return "LNURL/AdditionalPaymentMethodDetails";
|
|
|
|
}
|
2022-02-07 09:39:48 +01:00
|
|
|
|
2022-02-21 13:21:33 +09:00
|
|
|
public override JObject GetAdditionalData()
|
2022-02-07 09:39:48 +01:00
|
|
|
{
|
|
|
|
var result = base.GetAdditionalData();
|
|
|
|
if (!string.IsNullOrEmpty(ProvidedComment))
|
2022-02-21 13:21:33 +09:00
|
|
|
result.Add("providedComment", new JValue(ProvidedComment));
|
2022-02-07 09:39:48 +01:00
|
|
|
if (!string.IsNullOrEmpty(ConsumedLightningAddress))
|
2022-02-21 13:21:33 +09:00
|
|
|
result.Add("consumedLightningAddress", new JValue(ConsumedLightningAddress));
|
2022-02-07 09:39:48 +01:00
|
|
|
return result;
|
|
|
|
}
|
2021-10-25 08:18:02 +02:00
|
|
|
}
|
|
|
|
}
|