switch to jobj

This commit is contained in:
Kukks
2022-02-15 11:36:04 +01:00
committed by Andrew Camilleri
parent 1c5cf29540
commit 03bc91fd1e
4 changed files with 10 additions and 6 deletions

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using BTCPayServer.JsonConverters; using BTCPayServer.JsonConverters;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Converters; using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
namespace BTCPayServer.Client.Models namespace BTCPayServer.Client.Models
{ {
@@ -34,7 +35,7 @@ namespace BTCPayServer.Client.Models
public string PaymentMethod { get; set; } public string PaymentMethod { get; set; }
public string CryptoCode { get; set; } public string CryptoCode { get; set; }
public Dictionary<string, object> AdditionalData { get; set; } public Dictionary<string, JObject> AdditionalData { get; set; }
public class Payment public class Payment
{ {

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json.Linq;
namespace BTCPayServer.Payments namespace BTCPayServer.Payments
{ {
@@ -21,6 +22,6 @@ namespace BTCPayServer.Payments
bool Activated { get; set; } bool Activated { get; set; }
virtual string GetAdditionalDataPartialName() => null; virtual string GetAdditionalDataPartialName() => null;
virtual Dictionary<string,object> GetAdditionalData() => new(); virtual Dictionary<string,JObject> GetAdditionalData() => new();
} }
} }

View File

@@ -3,6 +3,7 @@ using BTCPayServer.Client.JsonConverters;
using BTCPayServer.Lightning; using BTCPayServer.Lightning;
using BTCPayServer.Payments.Lightning; using BTCPayServer.Payments.Lightning;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace BTCPayServer.Payments namespace BTCPayServer.Payments
{ {
@@ -34,17 +35,17 @@ namespace BTCPayServer.Payments
return "LNURL/AdditionalPaymentMethodDetails"; return "LNURL/AdditionalPaymentMethodDetails";
} }
public override Dictionary<string, object> GetAdditionalData() public override Dictionary<string, JObject> GetAdditionalData()
{ {
var result = base.GetAdditionalData(); var result = base.GetAdditionalData();
if (!string.IsNullOrEmpty(ProvidedComment)) if (!string.IsNullOrEmpty(ProvidedComment))
{ {
result.TryAdd(nameof(ProvidedComment), ProvidedComment); result.TryAdd(nameof(ProvidedComment), new JObject(ProvidedComment));
} }
if (!string.IsNullOrEmpty(ConsumedLightningAddress)) if (!string.IsNullOrEmpty(ConsumedLightningAddress))
{ {
result.TryAdd(nameof(ConsumedLightningAddress), ConsumedLightningAddress); result.TryAdd(nameof(ConsumedLightningAddress), new JObject(ConsumedLightningAddress));
} }
return result; return result;

View File

@@ -1,6 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using BTCPayServer.Lightning; using BTCPayServer.Lightning;
using NBitcoin; using NBitcoin;
using Newtonsoft.Json.Linq;
namespace BTCPayServer.Payments.Lightning namespace BTCPayServer.Payments.Lightning
{ {
@@ -42,7 +43,7 @@ namespace BTCPayServer.Payments.Lightning
return null; return null;
} }
public virtual Dictionary<string, object> GetAdditionalData() public virtual Dictionary<string, JObject> GetAdditionalData()
{ {
return new(); return new();
} }