mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 14:34:23 +01:00
Introduce Additional Data to Store Blob and move obsolete props to migration (#2065)
* Introduce Additional Data to Store Blob and move obsolete props to migration * Fixes and tests * Small adjustements to prevent tracking too many objects Co-authored-by: nicolas.dorier <nicolas.dorier@gmail.com>
This commit is contained in:
@@ -52,46 +52,6 @@ namespace BTCPayServer.Data
|
||||
return result;
|
||||
}
|
||||
|
||||
public static List<PaymentMethodCriteria> GetPaymentMethodCriteria(this StoreData storeData, BTCPayNetworkProvider networkProvider,StoreBlob storeBlob = null)
|
||||
{
|
||||
#pragma warning disable 612
|
||||
storeBlob ??= storeData.GetStoreBlob();
|
||||
|
||||
return storeData.GetEnabledPaymentIds(networkProvider).Select(paymentMethodId=>
|
||||
{
|
||||
var matchedFromBlob =
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
storeBlob.PaymentMethodCriteria?.SingleOrDefault(criteria => criteria.PaymentMethod == paymentMethodId && criteria.Value != null);
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
if (matchedFromBlob is null && paymentMethodId.PaymentType == LightningPaymentType.Instance && storeBlob.LightningMaxValue != null)
|
||||
{
|
||||
return new PaymentMethodCriteria()
|
||||
{
|
||||
Above = false,
|
||||
PaymentMethod = paymentMethodId,
|
||||
Value = storeBlob.LightningMaxValue
|
||||
};
|
||||
}
|
||||
if (matchedFromBlob is null && paymentMethodId.PaymentType == BitcoinPaymentType.Instance && storeBlob.OnChainMinValue != null)
|
||||
{
|
||||
return new PaymentMethodCriteria()
|
||||
{
|
||||
Above = true,
|
||||
PaymentMethod = paymentMethodId,
|
||||
Value = storeBlob.OnChainMinValue
|
||||
};
|
||||
}
|
||||
|
||||
return new PaymentMethodCriteria()
|
||||
{
|
||||
PaymentMethod = paymentMethodId,
|
||||
Above = matchedFromBlob?.Above??true,
|
||||
Value = matchedFromBlob?.Value
|
||||
};
|
||||
}).ToList();
|
||||
#pragma warning restore 612
|
||||
}
|
||||
|
||||
public static bool SetStoreBlob(this StoreData storeData, StoreBlob storeBlob)
|
||||
{
|
||||
var original = new Serializer(null).ToString(storeData.GetStoreBlob());
|
||||
|
||||
Reference in New Issue
Block a user