mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-19 06:54:19 +01:00
Fix: DateTime passed to bitpay API weren't assumed UTC, remove DateTime.Now references (#3206)
This commit is contained in:
@@ -308,8 +308,8 @@ namespace BTCPayServer.Controllers
|
||||
|
||||
var info = await GetAppInfo(appId);
|
||||
if (!isAdmin &&
|
||||
((settings.StartDate.HasValue && DateTime.Now < settings.StartDate) ||
|
||||
(settings.EndDate.HasValue && DateTime.Now > settings.EndDate) ||
|
||||
((settings.StartDate.HasValue && DateTime.UtcNow < settings.StartDate) ||
|
||||
(settings.EndDate.HasValue && DateTime.UtcNow > settings.EndDate) ||
|
||||
(settings.EnforceTargetAmount &&
|
||||
(info.Info.PendingProgressPercentage.GetValueOrDefault(0) +
|
||||
info.Info.ProgressPercentage.GetValueOrDefault(0)) >= 100)))
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Threading.Tasks;
|
||||
using BTCPayServer.Abstractions.Constants;
|
||||
using BTCPayServer.Client;
|
||||
using BTCPayServer.Filters;
|
||||
using BTCPayServer.ModelBinders;
|
||||
using BTCPayServer.Models;
|
||||
using BTCPayServer.Security;
|
||||
using BTCPayServer.Services.Invoices;
|
||||
@@ -54,7 +55,9 @@ namespace BTCPayServer.Controllers
|
||||
[Route("invoices")]
|
||||
public async Task<IActionResult> GetInvoices(
|
||||
string token,
|
||||
[ModelBinder(typeof(BitpayDateTimeOffsetModelBinder))]
|
||||
DateTimeOffset? dateStart = null,
|
||||
[ModelBinder(typeof(BitpayDateTimeOffsetModelBinder))]
|
||||
DateTimeOffset? dateEnd = null,
|
||||
string orderId = null,
|
||||
string itemCode = null,
|
||||
|
||||
@@ -201,7 +201,7 @@ namespace BTCPayServer.Controllers
|
||||
return BadRequest("Payment Request has already been settled.");
|
||||
}
|
||||
|
||||
if (result.ExpiryDate.HasValue && DateTime.Now >= result.ExpiryDate)
|
||||
if (result.ExpiryDate.HasValue && DateTime.UtcNow >= result.ExpiryDate)
|
||||
{
|
||||
if (redirectToInvoice)
|
||||
{
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace BTCPayServer.Controllers
|
||||
AmountDueFormatted = _currencyNameTable.FormatCurrency(amountDue, blob.Currency),
|
||||
CurrencyData = cd,
|
||||
StartDate = pp.StartDate,
|
||||
LastRefreshed = DateTime.Now,
|
||||
LastRefreshed = DateTime.UtcNow,
|
||||
Payouts = payouts
|
||||
.Select(entity => new ViewPullPaymentModel.PayoutLine
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user