mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 09:54:30 +01:00
24 lines
702 B
C#
24 lines
702 B
C#
#nullable enable
|
|
using System.Collections.Generic;
|
|
using BTCPayServer.Payments;
|
|
|
|
namespace BTCPayServer.Services
|
|
{
|
|
public class PrettyNameProvider
|
|
{
|
|
private readonly Dictionary<PaymentMethodId, IPaymentModelExtension> _extensions;
|
|
|
|
public PrettyNameProvider(Dictionary<PaymentMethodId, IPaymentModelExtension> extensions)
|
|
{
|
|
_extensions = extensions;
|
|
}
|
|
public string PrettyName(PaymentMethodId paymentMethodId)
|
|
{
|
|
if (paymentMethodId is null)
|
|
return "<NULL>";
|
|
_extensions.TryGetValue(paymentMethodId, out var n);
|
|
return n?.DisplayName ?? paymentMethodId.ToString();
|
|
}
|
|
}
|
|
}
|