mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 22:44:29 +01:00
Pluginize Webhooks and support Payouts (#5421)
Co-authored-by: d11n <mail@dennisreimann.de>
This commit is contained in:
@@ -16,8 +16,8 @@ namespace BTCPayServer.PaymentRequest
|
||||
{
|
||||
public class PaymentRequestService
|
||||
{
|
||||
private readonly PaymentRequestRepository _PaymentRequestRepository;
|
||||
private readonly BTCPayNetworkProvider _BtcPayNetworkProvider;
|
||||
private readonly PaymentRequestRepository _paymentRequestRepository;
|
||||
private readonly BTCPayNetworkProvider _btcPayNetworkProvider;
|
||||
private readonly InvoiceRepository _invoiceRepository;
|
||||
private readonly CurrencyNameTable _currencies;
|
||||
private readonly TransactionLinkProviders _transactionLinkProviders;
|
||||
@@ -31,8 +31,8 @@ namespace BTCPayServer.PaymentRequest
|
||||
CurrencyNameTable currencies,
|
||||
TransactionLinkProviders transactionLinkProviders)
|
||||
{
|
||||
_PaymentRequestRepository = paymentRequestRepository;
|
||||
_BtcPayNetworkProvider = btcPayNetworkProvider;
|
||||
_paymentRequestRepository = paymentRequestRepository;
|
||||
_btcPayNetworkProvider = btcPayNetworkProvider;
|
||||
_invoiceRepository = invoiceRepository;
|
||||
_currencies = currencies;
|
||||
_transactionLinkProviders = transactionLinkProviders;
|
||||
@@ -41,7 +41,7 @@ namespace BTCPayServer.PaymentRequest
|
||||
|
||||
public async Task UpdatePaymentRequestStateIfNeeded(string id)
|
||||
{
|
||||
var pr = await _PaymentRequestRepository.FindPaymentRequest(id, null);
|
||||
var pr = await _paymentRequestRepository.FindPaymentRequest(id, null);
|
||||
await UpdatePaymentRequestStateIfNeeded(pr);
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace BTCPayServer.PaymentRequest
|
||||
|
||||
if (currentStatus != Client.Models.PaymentRequestData.PaymentRequestStatus.Expired)
|
||||
{
|
||||
var invoices = await _PaymentRequestRepository.GetInvoicesForPaymentRequest(pr.Id);
|
||||
var invoices = await _paymentRequestRepository.GetInvoicesForPaymentRequest(pr.Id);
|
||||
var contributions = _invoiceRepository.GetContributionsByPaymentMethodId(blob.Currency, invoices, true);
|
||||
var allSettled = contributions.All(i => i.Value.States.All(s => s.IsSettled()));
|
||||
var isPaid = contributions.TotalCurrency >= blob.Amount;
|
||||
@@ -81,13 +81,13 @@ namespace BTCPayServer.PaymentRequest
|
||||
if (currentStatus != pr.Status)
|
||||
{
|
||||
pr.Status = currentStatus;
|
||||
await _PaymentRequestRepository.UpdatePaymentRequestStatus(pr.Id, currentStatus);
|
||||
await _paymentRequestRepository.UpdatePaymentRequestStatus(pr.Id, currentStatus);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ViewPaymentRequestViewModel> GetPaymentRequest(string id, string userId = null)
|
||||
{
|
||||
var pr = await _PaymentRequestRepository.FindPaymentRequest(id, userId);
|
||||
var pr = await _paymentRequestRepository.FindPaymentRequest(id, userId);
|
||||
if (pr == null)
|
||||
{
|
||||
return null;
|
||||
@@ -95,7 +95,7 @@ namespace BTCPayServer.PaymentRequest
|
||||
|
||||
var blob = pr.GetBlob();
|
||||
|
||||
var invoices = await _PaymentRequestRepository.GetInvoicesForPaymentRequest(id);
|
||||
var invoices = await _paymentRequestRepository.GetInvoicesForPaymentRequest(id);
|
||||
var paymentStats = _invoiceRepository.GetContributionsByPaymentMethodId(blob.Currency, invoices, true);
|
||||
var amountDue = blob.Amount - paymentStats.TotalCurrency;
|
||||
var pendingInvoice = invoices.OrderByDescending(entity => entity.InvoiceTime)
|
||||
|
||||
Reference in New Issue
Block a user