mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-03-03 17:36:59 +01:00
Rename IPaymentMethodFactory to ISupportedPaymentMethod
This commit is contained in:
parent
2e45c8b190
commit
3f07010de8
5 changed files with 9 additions and 9 deletions
|
@ -88,7 +88,7 @@ namespace BTCPayServer.Controllers
|
||||||
{
|
{
|
||||||
InvoiceTime = DateTimeOffset.UtcNow
|
InvoiceTime = DateTimeOffset.UtcNow
|
||||||
};
|
};
|
||||||
entity.SetPaymentMethodFactories(derivationStrategies);
|
entity.SetSupportedPaymentMethods(derivationStrategies);
|
||||||
|
|
||||||
var storeBlob = store.GetStoreBlob();
|
var storeBlob = store.GetStoreBlob();
|
||||||
Uri notificationUri = Uri.IsWellFormedUriString(invoice.NotificationURL, UriKind.Absolute) ? new Uri(invoice.NotificationURL, UriKind.Absolute) : null;
|
Uri notificationUri = Uri.IsWellFormedUriString(invoice.NotificationURL, UriKind.Absolute) ? new Uri(invoice.NotificationURL, UriKind.Absolute) : null;
|
||||||
|
|
|
@ -9,7 +9,7 @@ using NBXplorer.DerivationStrategy;
|
||||||
|
|
||||||
namespace BTCPayServer
|
namespace BTCPayServer
|
||||||
{
|
{
|
||||||
public class DerivationStrategy : IPaymentMethodFactory
|
public class DerivationStrategy : ISupportedPaymentMethod
|
||||||
{
|
{
|
||||||
private DerivationStrategyBase _DerivationStrategy;
|
private DerivationStrategyBase _DerivationStrategy;
|
||||||
private BTCPayNetwork _Network;
|
private BTCPayNetwork _Network;
|
||||||
|
|
|
@ -351,7 +351,7 @@ namespace BTCPayServer.Payments.Bitcoin
|
||||||
|
|
||||||
private DerivationStrategyBase GetDerivationStrategy(InvoiceEntity invoice, BTCPayNetwork network)
|
private DerivationStrategyBase GetDerivationStrategy(InvoiceEntity invoice, BTCPayNetwork network)
|
||||||
{
|
{
|
||||||
return invoice.GetPaymentMethodFactories(_ExplorerClients.NetworkProviders)
|
return invoice.GetSupportedPaymentMethod(_ExplorerClients.NetworkProviders)
|
||||||
.OfType<DerivationStrategy>()
|
.OfType<DerivationStrategy>()
|
||||||
.Where(d => d.Network.CryptoCode == network.CryptoCode)
|
.Where(d => d.Network.CryptoCode == network.CryptoCode)
|
||||||
.Select(d => d.DerivationStrategyBase)
|
.Select(d => d.DerivationStrategyBase)
|
||||||
|
@ -396,7 +396,7 @@ namespace BTCPayServer.Payments.Bitcoin
|
||||||
|
|
||||||
private DerivationStrategyBase GetStrategy(string cryptoCode, InvoiceEntity invoice)
|
private DerivationStrategyBase GetStrategy(string cryptoCode, InvoiceEntity invoice)
|
||||||
{
|
{
|
||||||
foreach (var derivationStrategy in invoice.GetPaymentMethodFactories(_ExplorerClients.NetworkProviders)
|
foreach (var derivationStrategy in invoice.GetSupportedPaymentMethod(_ExplorerClients.NetworkProviders)
|
||||||
.OfType<DerivationStrategy>())
|
.OfType<DerivationStrategy>())
|
||||||
{
|
{
|
||||||
if (derivationStrategy.Network.CryptoCode == cryptoCode)
|
if (derivationStrategy.Network.CryptoCode == cryptoCode)
|
||||||
|
|
|
@ -6,7 +6,7 @@ using BTCPayServer.Services.Invoices;
|
||||||
|
|
||||||
namespace BTCPayServer.Payments
|
namespace BTCPayServer.Payments
|
||||||
{
|
{
|
||||||
public interface IPaymentMethodFactory
|
public interface ISupportedPaymentMethod
|
||||||
{
|
{
|
||||||
PaymentMethodId PaymentId { get; }
|
PaymentMethodId PaymentId { get; }
|
||||||
}
|
}
|
|
@ -169,7 +169,7 @@ namespace BTCPayServer.Services.Invoices
|
||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<IPaymentMethodFactory> GetPaymentMethodFactories(BTCPayNetworkProvider networks)
|
public IEnumerable<ISupportedPaymentMethod> GetSupportedPaymentMethod(BTCPayNetworkProvider networks)
|
||||||
{
|
{
|
||||||
#pragma warning disable CS0618
|
#pragma warning disable CS0618
|
||||||
bool btcReturned = false;
|
bool btcReturned = false;
|
||||||
|
@ -199,7 +199,7 @@ namespace BTCPayServer.Services.Invoices
|
||||||
#pragma warning restore CS0618
|
#pragma warning restore CS0618
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void SetPaymentMethodFactories(IEnumerable<IPaymentMethodFactory> derivationStrategies)
|
internal void SetSupportedPaymentMethods(IEnumerable<ISupportedPaymentMethod> derivationStrategies)
|
||||||
{
|
{
|
||||||
JObject obj = new JObject();
|
JObject obj = new JObject();
|
||||||
foreach (var strat in derivationStrategies)
|
foreach (var strat in derivationStrategies)
|
||||||
|
@ -214,7 +214,7 @@ namespace BTCPayServer.Services.Invoices
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private IPaymentMethodFactory Deserialize(PaymentMethodId paymentMethodId, JToken value, BTCPayNetwork network)
|
private ISupportedPaymentMethod Deserialize(PaymentMethodId paymentMethodId, JToken value, BTCPayNetwork network)
|
||||||
{
|
{
|
||||||
// Legacy
|
// Legacy
|
||||||
if (paymentMethodId.PaymentType == PaymentTypes.BTCLike)
|
if (paymentMethodId.PaymentType == PaymentTypes.BTCLike)
|
||||||
|
@ -229,7 +229,7 @@ namespace BTCPayServer.Services.Invoices
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
JToken Serialize(IPaymentMethodFactory factory)
|
JToken Serialize(ISupportedPaymentMethod factory)
|
||||||
{
|
{
|
||||||
// Legacy
|
// Legacy
|
||||||
if(factory.PaymentId.PaymentType == PaymentTypes.BTCLike)
|
if(factory.PaymentId.PaymentType == PaymentTypes.BTCLike)
|
||||||
|
|
Loading…
Add table
Reference in a new issue