2020-06-29 04:44:35 +02:00
|
|
|
using Newtonsoft.Json;
|
2018-02-20 04:45:04 +01:00
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
|
|
|
|
namespace BTCPayServer.Payments
|
|
|
|
{
|
|
|
|
public class PaymentMethodExtensions
|
|
|
|
{
|
|
|
|
public static JToken Serialize(ISupportedPaymentMethod factory)
|
|
|
|
{
|
|
|
|
// Legacy
|
|
|
|
if (factory.PaymentId.PaymentType == PaymentTypes.BTCLike)
|
|
|
|
{
|
2019-05-08 16:39:11 +02:00
|
|
|
var derivation = (DerivationSchemeSettings)factory;
|
|
|
|
var str = derivation.Network.NBXplorerNetwork.Serializer.ToString(derivation);
|
|
|
|
return JObject.Parse(str);
|
2018-02-20 04:45:04 +01:00
|
|
|
}
|
|
|
|
//////////////
|
|
|
|
else
|
|
|
|
{
|
|
|
|
var str = JsonConvert.SerializeObject(factory);
|
|
|
|
return JObject.Parse(str);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|