mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-28 08:54:13 +01:00
* Separate coinswitch as a system plugin * Decouple Coinswitch from Checkout UI * remove dummy csproj * Remove CoinSwitchTests.cs per @NicolasDorier feedback Co-authored-by: rockstardev <rockstardev@users.noreply.github.com>
32 lines
1,001 B
C#
32 lines
1,001 B
C#
using BTCPayServer.Data;
|
|
using NBitcoin;
|
|
using NBXplorer;
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
namespace BTCPayServer.Plugins.CoinSwitch
|
|
{
|
|
public static class CoinSwitchExtensions
|
|
{
|
|
public const string StoreBlobKey = "coinSwitchSettings";
|
|
public static CoinSwitchSettings GetCoinSwitchSettings(this StoreBlob storeBlob)
|
|
{
|
|
if (storeBlob.AdditionalData.TryGetValue(StoreBlobKey, out var rawS) && rawS is JObject rawObj)
|
|
{
|
|
return new Serializer(null).ToObject<CoinSwitchSettings>(rawObj);
|
|
}
|
|
|
|
return null;
|
|
}
|
|
public static void SetCoinSwitchSettings(this StoreBlob storeBlob, CoinSwitchSettings settings)
|
|
{
|
|
if (settings is null)
|
|
{
|
|
storeBlob.AdditionalData.Remove(StoreBlobKey);
|
|
}
|
|
else
|
|
{
|
|
storeBlob.AdditionalData.AddOrReplace(StoreBlobKey, JObject.FromObject(settings));
|
|
}
|
|
}
|
|
}
|
|
}
|