mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 22:14:26 +01:00
Renaming + fix invoice display when paid and expired
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
using BTCPayServer.Configuration;
|
||||
using BTCPayServer.Hosting;
|
||||
using BTCPayServer.Invoicing;
|
||||
using BTCPayServer.RateProvider;
|
||||
using BTCPayServer.Servcices.Invoices;
|
||||
using BTCPayServer.Services.Rates;
|
||||
using BTCPayServer.Tests.Logging;
|
||||
using BTCPayServer.Tests.Mocks;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using BTCPayServer.Controllers;
|
||||
using BTCPayServer.Invoicing;
|
||||
using BTCPayServer.Models.AccountViewModels;
|
||||
using BTCPayServer.Models.StoreViewModels;
|
||||
using BTCPayServer.Servcices.Invoices;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NBitcoin;
|
||||
using NBitpayClient;
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Threading;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
using Xunit.Sdk;
|
||||
using BTCPayServer.Invoicing;
|
||||
using BTCPayServer.Servcices.Invoices;
|
||||
|
||||
namespace BTCPayServer.Tests
|
||||
{
|
||||
@@ -123,7 +123,7 @@ namespace BTCPayServer.Tests
|
||||
FullNotifications = true
|
||||
}, Facade.Merchant);
|
||||
|
||||
var textSearchResult = tester.PayTester.Runtime.InvoiceRepository.GetInvoices(new Invoicing.InvoiceQuery()
|
||||
var textSearchResult = tester.PayTester.Runtime.InvoiceRepository.GetInvoices(new InvoiceQuery()
|
||||
{
|
||||
StoreId = user.StoreId,
|
||||
TextSearch = invoice.OrderId
|
||||
@@ -131,7 +131,7 @@ namespace BTCPayServer.Tests
|
||||
|
||||
Assert.Equal(1, textSearchResult.Length);
|
||||
|
||||
textSearchResult = tester.PayTester.Runtime.InvoiceRepository.GetInvoices(new Invoicing.InvoiceQuery()
|
||||
textSearchResult = tester.PayTester.Runtime.InvoiceRepository.GetInvoices(new InvoiceQuery()
|
||||
{
|
||||
StoreId = user.StoreId,
|
||||
TextSearch = invoice.Id
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using BTCPayServer.Authentication;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using BTCPayServer.Invoicing;
|
||||
using BTCPayServer.Logging;
|
||||
using BTCPayServer.Wallet;
|
||||
using DBreeze;
|
||||
using NBitcoin;
|
||||
using NBXplorer;
|
||||
@@ -15,6 +13,8 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using BTCPayServer.Data;
|
||||
using BTCPayServer.Servcices.Invoices;
|
||||
using BTCPayServer.Services.Wallets;
|
||||
|
||||
namespace BTCPayServer.Configuration
|
||||
{
|
||||
|
||||
@@ -13,7 +13,8 @@ using Microsoft.Extensions.Options;
|
||||
using BTCPayServer.Models;
|
||||
using BTCPayServer.Models.AccountViewModels;
|
||||
using BTCPayServer.Services;
|
||||
using BTCPayServer.Stores;
|
||||
using BTCPayServer.Services.Mails;
|
||||
using BTCPayServer.Services.Stores;
|
||||
|
||||
namespace BTCPayServer.Controllers
|
||||
{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using BTCPayServer.Authentication;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using BTCPayServer.Filters;
|
||||
using BTCPayServer.Invoicing;
|
||||
using BTCPayServer.Logging;
|
||||
using BTCPayServer.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -11,6 +10,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using BTCPayServer.Data;
|
||||
using BTCPayServer.Servcices.Invoices;
|
||||
|
||||
namespace BTCPayServer.Controllers
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using BTCPayServer.Data;
|
||||
using BTCPayServer.Filters;
|
||||
using BTCPayServer.Invoicing;
|
||||
using BTCPayServer.Models.InvoicingModels;
|
||||
using BTCPayServer.Servcices.Invoices;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
|
||||
@@ -12,12 +12,9 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using BTCPayServer.Models;
|
||||
using Newtonsoft.Json;
|
||||
using BTCPayServer.Invoicing;
|
||||
using BTCPayServer.Wallet;
|
||||
using System.Globalization;
|
||||
using NBitcoin;
|
||||
using NBitcoin.DataEncoders;
|
||||
using BTCPayServer.RateProvider;
|
||||
using BTCPayServer.Filters;
|
||||
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
||||
using System.Net;
|
||||
@@ -26,12 +23,15 @@ using Newtonsoft.Json.Linq;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||
using NBitcoin.Payment;
|
||||
using BTCPayServer.Data;
|
||||
using BTCPayServer.Stores;
|
||||
using BTCPayServer.Models.InvoicingModels;
|
||||
using System.Security.Claims;
|
||||
using BTCPayServer.Services;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.RegularExpressions;
|
||||
using BTCPayServer.Services.Stores;
|
||||
using BTCPayServer.Servcices.Invoices;
|
||||
using BTCPayServer.Services.Rates;
|
||||
using BTCPayServer.Services.Wallets;
|
||||
|
||||
namespace BTCPayServer.Controllers
|
||||
{
|
||||
|
||||
@@ -14,11 +14,12 @@ using BTCPayServer.Models;
|
||||
using BTCPayServer.Models.ManageViewModels;
|
||||
using BTCPayServer.Services;
|
||||
using BTCPayServer.Authentication;
|
||||
using BTCPayServer.Wallet;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using NBitpayClient;
|
||||
using NBitcoin;
|
||||
using BTCPayServer.Stores;
|
||||
using BTCPayServer.Services.Stores;
|
||||
using BTCPayServer.Services.Wallets;
|
||||
using BTCPayServer.Services.Mails;
|
||||
|
||||
namespace BTCPayServer.Controllers
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using BTCPayServer.Models;
|
||||
using BTCPayServer.RateProvider;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -7,6 +6,7 @@ using System.Text;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using BTCPayServer.Filters;
|
||||
using BTCPayServer.Services.Rates;
|
||||
|
||||
namespace BTCPayServer.Controllers
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using BTCPayServer.Authentication;
|
||||
using BTCPayServer.Models;
|
||||
using BTCPayServer.Models.StoreViewModels;
|
||||
using BTCPayServer.Stores;
|
||||
using BTCPayServer.Wallet;
|
||||
using BTCPayServer.Services.Stores;
|
||||
using BTCPayServer.Services.Wallets;
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using BTCPayServer.Invoicing;
|
||||
using BTCPayServer.Models;
|
||||
using BTCPayServer.Models;
|
||||
using BTCPayServer.Servcices.Invoices;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Text.Encodings.Web;
|
||||
using System.Threading.Tasks;
|
||||
using BTCPayServer.Services;
|
||||
using BTCPayServer.Services.Mails;
|
||||
|
||||
namespace BTCPayServer.Services
|
||||
{
|
||||
|
||||
@@ -6,20 +6,20 @@ using System.Text;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using BTCPayServer.Wallet;
|
||||
using BTCPayServer.RateProvider;
|
||||
using NBitpayClient;
|
||||
using NBitcoin;
|
||||
using BTCPayServer.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.IO;
|
||||
using Microsoft.Data.Sqlite;
|
||||
using BTCPayServer.Invoicing;
|
||||
using NBXplorer;
|
||||
using BTCPayServer.Stores;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using BTCPayServer.Services;
|
||||
using BTCPayServer.Servcices.Invoices;
|
||||
using BTCPayServer.Services.Rates;
|
||||
using BTCPayServer.Services.Stores;
|
||||
using BTCPayServer.Services.Fees;
|
||||
|
||||
namespace BTCPayServer.Hosting
|
||||
{
|
||||
|
||||
@@ -20,8 +20,9 @@ using Microsoft.Extensions.Logging;
|
||||
using BTCPayServer.Logging;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using System.Threading.Tasks;
|
||||
using BTCPayServer.Stores;
|
||||
using BTCPayServer.Controllers;
|
||||
using BTCPayServer.Services.Stores;
|
||||
using BTCPayServer.Services.Mails;
|
||||
|
||||
namespace BTCPayServer.Hosting
|
||||
{
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// <auto-generated />
|
||||
using BTCPayServer.Data;
|
||||
using BTCPayServer.Invoicing;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// <auto-generated />
|
||||
using BTCPayServer.Data;
|
||||
using BTCPayServer.Invoicing;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
|
||||
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using BTCPayServer.Invoicing;
|
||||
using BTCPayServer.Data;
|
||||
|
||||
namespace BTCPayServer.Models
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using BTCPayServer.Invoicing;
|
||||
using BTCPayServer.Validations;
|
||||
using BTCPayServer.Validations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using BTCPayServer.Invoicing;
|
||||
using BTCPayServer.Servcices.Invoices;
|
||||
using BTCPayServer.Validations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
26
BTCPayServer/Services/Fees/FixedFeeProvider.cs
Normal file
26
BTCPayServer/Services/Fees/FixedFeeProvider.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using NBitcoin;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BTCPayServer.Services.Fees
|
||||
{
|
||||
public class FixedFeeProvider : IFeeProvider
|
||||
{
|
||||
public FixedFeeProvider(FeeRate feeRate)
|
||||
{
|
||||
FeeRate = feeRate;
|
||||
}
|
||||
|
||||
public FeeRate FeeRate
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public Task<FeeRate> GetFeeRateAsync()
|
||||
{
|
||||
return Task.FromResult(FeeRate);
|
||||
}
|
||||
}
|
||||
}
|
||||
15
BTCPayServer/Services/Fees/IFeeProvider.cs
Normal file
15
BTCPayServer/Services/Fees/IFeeProvider.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using NBitcoin;
|
||||
using NBXplorer;
|
||||
using NBXplorer.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BTCPayServer.Services
|
||||
{
|
||||
public interface IFeeProvider
|
||||
{
|
||||
Task<FeeRate> GetFeeRateAsync();
|
||||
}
|
||||
}
|
||||
@@ -6,13 +6,8 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BTCPayServer.Services
|
||||
namespace BTCPayServer.Services.Fees
|
||||
{
|
||||
public interface IFeeProvider
|
||||
{
|
||||
Task<FeeRate> GetFeeRateAsync();
|
||||
}
|
||||
|
||||
public class NBXplorerFeeProvider : IFeeProvider
|
||||
{
|
||||
public ExplorerClient ExplorerClient
|
||||
@@ -33,28 +28,10 @@ namespace BTCPayServer.Services
|
||||
{
|
||||
return (await ExplorerClient.GetFeeRateAsync(BlockTarget).ConfigureAwait(false)).FeeRate;
|
||||
}
|
||||
catch(NBXplorerException ex) when( ex.Error.HttpCode == 400 && ex.Error.Code == "fee-estimation-unavailable")
|
||||
catch(NBXplorerException ex) when(ex.Error.HttpCode == 400 && ex.Error.Code == "fee-estimation-unavailable")
|
||||
{
|
||||
return Fallback;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class FixedFeeProvider : IFeeProvider
|
||||
{
|
||||
public FixedFeeProvider(FeeRate feeRate)
|
||||
{
|
||||
FeeRate = feeRate;
|
||||
}
|
||||
|
||||
public FeeRate FeeRate
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public Task<FeeRate> GetFeeRateAsync()
|
||||
{
|
||||
return Task.FromResult(FeeRate);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace BTCPayServer.Invoicing
|
||||
namespace BTCPayServer.Servcices.Invoices
|
||||
{
|
||||
public class BuyerInformation
|
||||
{
|
||||
@@ -17,7 +17,7 @@ using BTCPayServer.Data;
|
||||
using System.Globalization;
|
||||
using BTCPayServer.Models.InvoicingModels;
|
||||
|
||||
namespace BTCPayServer.Invoicing
|
||||
namespace BTCPayServer.Servcices.Invoices
|
||||
{
|
||||
public class InvoiceRepository
|
||||
{
|
||||
@@ -12,7 +12,7 @@ using System.Threading;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
namespace BTCPayServer.Invoicing
|
||||
namespace BTCPayServer.Servcices.Invoices
|
||||
{
|
||||
public class InvoiceWatcher : IHostedService
|
||||
{
|
||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BTCPayServer.Services
|
||||
namespace BTCPayServer.Services.Mails
|
||||
{
|
||||
// This class is used by the application to send email for account confirmation and password reset.
|
||||
// For more details see https://go.microsoft.com/fwlink/?LinkID=532713
|
||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BTCPayServer.Services
|
||||
namespace BTCPayServer.Services.Mails
|
||||
{
|
||||
public interface IEmailSender
|
||||
{
|
||||
@@ -5,7 +5,7 @@ using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BTCPayServer.RateProvider
|
||||
namespace BTCPayServer.Services.Rates
|
||||
{
|
||||
public class BitpayRateProvider : IRateProvider
|
||||
{
|
||||
@@ -5,7 +5,7 @@ using System.Reflection;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BTCPayServer.RateProvider
|
||||
namespace BTCPayServer.Services.Rates
|
||||
{
|
||||
public class CurrencyData
|
||||
{
|
||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BTCPayServer.RateProvider
|
||||
namespace BTCPayServer.Services.Rates
|
||||
{
|
||||
public class Rate
|
||||
{
|
||||
@@ -4,7 +4,7 @@ using System.Text;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BTCPayServer.RateProvider
|
||||
namespace BTCPayServer.Services.Rates
|
||||
{
|
||||
public class MockRateProvider : IRateProvider
|
||||
{
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace BTCPayServer.RateProvider
|
||||
namespace BTCPayServer.Services.Rates
|
||||
{
|
||||
public class RateUnavailableException : Exception
|
||||
{
|
||||
@@ -8,7 +8,7 @@ using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BTCPayServer.Stores
|
||||
namespace BTCPayServer.Services.Stores
|
||||
{
|
||||
public class StoreRepository
|
||||
{
|
||||
@@ -8,7 +8,7 @@ using System.Text;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BTCPayServer.Wallet
|
||||
namespace BTCPayServer.Services.Wallets
|
||||
{
|
||||
public class BTCPayWallet
|
||||
{
|
||||
@@ -33,19 +33,7 @@
|
||||
var display = $(".timer-row__time-left"); // Timer container
|
||||
|
||||
// check if the Document expired
|
||||
if (expirationTime <= 0 && !(isArchieved)) {
|
||||
|
||||
$(".timer-row__message span").html("Invoice Expired");
|
||||
$(".timer-row__spinner").html("");
|
||||
$("#emailAddressView").removeClass("active");
|
||||
$(".modal-dialog").addClass("expired");
|
||||
$("#expired").addClass("active");
|
||||
|
||||
} else if (isArchieved) {
|
||||
$(".modal-dialog").addClass("archived");
|
||||
$("#emailAddressView").removeClass("active");
|
||||
$("#archived").addClass("active");
|
||||
} else {
|
||||
if (expirationTime > 0) {
|
||||
|
||||
progressStart(maxTime); // Progress bar
|
||||
startTimer(expirationTime, display); // Timer
|
||||
@@ -191,6 +179,7 @@ function updateState(status) {
|
||||
$(".timer-row").removeClass("expiring-soon");
|
||||
$(".timer-row__message span").html("Invoice expired.");
|
||||
$(".timer-row__spinner").html("");
|
||||
$("#emailAddressView").removeClass("active");
|
||||
$(".modal-dialog").addClass("expired");
|
||||
$("#expired").addClass("active");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user