mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 06:24:24 +01:00
Pluginify BTCPayNetworkProvider (#5331)
This commit is contained in:
@@ -11,6 +11,8 @@ using BTCPayServer.Models.StoreReportsViewModels;
|
||||
using BTCPayServer.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Internal;
|
||||
using System.Threading;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
@@ -21,12 +23,13 @@ namespace BTCPayServer.Controllers;
|
||||
public partial class UIReportsController : Controller
|
||||
{
|
||||
public UIReportsController(
|
||||
BTCPayNetworkProvider networkProvider,
|
||||
ApplicationDbContextFactory dbContextFactory,
|
||||
GreenfieldReportsController api,
|
||||
ReportService reportService,
|
||||
DisplayFormatter displayFormatter,
|
||||
BTCPayServerEnvironment env)
|
||||
BTCPayServerEnvironment env,
|
||||
BTCPayNetworkProvider networkProvider,
|
||||
TransactionLinkProviders transactionLinkProviders)
|
||||
{
|
||||
Api = api;
|
||||
ReportService = reportService;
|
||||
@@ -34,6 +37,7 @@ public partial class UIReportsController : Controller
|
||||
DBContextFactory = dbContextFactory;
|
||||
NetworkProvider = networkProvider;
|
||||
DisplayFormatter = displayFormatter;
|
||||
TransactionLinkProviders = transactionLinkProviders;
|
||||
}
|
||||
private BTCPayNetworkProvider NetworkProvider { get; }
|
||||
private DisplayFormatter DisplayFormatter { get; }
|
||||
@@ -41,6 +45,7 @@ public partial class UIReportsController : Controller
|
||||
public ReportService ReportService { get; }
|
||||
public BTCPayServerEnvironment Env { get; }
|
||||
public ApplicationDbContextFactory DBContextFactory { get; }
|
||||
public TransactionLinkProviders TransactionLinkProviders { get; }
|
||||
|
||||
[HttpPost("stores/{storeId}/reports")]
|
||||
[AcceptMediaTypeConstraint("application/json")]
|
||||
@@ -67,7 +72,7 @@ public partial class UIReportsController : Controller
|
||||
var vm = new StoreReportsViewModel
|
||||
{
|
||||
InvoiceTemplateUrl = Url.Action(nameof(UIInvoiceController.Invoice), "UIInvoice", new { invoiceId = "INVOICE_ID" }),
|
||||
ExplorerTemplateUrls = NetworkProvider.GetAll().ToDictionary(network => network.CryptoCode, network => network.BlockExplorerLink?.Replace("{0}", "TX_ID")),
|
||||
ExplorerTemplateUrls = TransactionLinkProviders.ToDictionary(p => p.Key.CryptoCode, p => p.Value.BlockExplorerLink?.Replace("{0}", "TX_ID")),
|
||||
Request = new StoreReportRequest { ViewName = viewName ?? "Payments" },
|
||||
AvailableViews = ReportService.ReportProviders
|
||||
.Values
|
||||
|
||||
Reference in New Issue
Block a user