mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 05:54:26 +01:00
Run dotnet format (#3244)
This commit is contained in:
@@ -37,11 +37,13 @@ namespace BTCPayServer.Client
|
||||
if (status != null)
|
||||
queryPayload.Add(nameof(status), status.Select(s => s.ToString().ToLower()).ToArray());
|
||||
|
||||
if(skip != null) {
|
||||
if (skip != null)
|
||||
{
|
||||
queryPayload.Add(nameof(skip), skip);
|
||||
}
|
||||
|
||||
if(take != null) {
|
||||
if (take != null)
|
||||
{
|
||||
queryPayload.Add(nameof(take), take);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using NBitcoin;
|
||||
using NBitcoin.JsonConverters;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using BTCPayServer.Client.JsonConverters;
|
||||
using BTCPayServer.Client.JsonConverters;
|
||||
using NBitcoin;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace BTCPayServer.Client.Models
|
||||
namespace BTCPayServer.Client.Models
|
||||
{
|
||||
public class GenericPaymentMethodData
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace BTCPayServer.Client.Models
|
||||
namespace BTCPayServer.Client.Models
|
||||
{
|
||||
public class LNURLPayPaymentMethodBaseData
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace BTCPayServer.Client.Models
|
||||
namespace BTCPayServer.Client.Models
|
||||
{
|
||||
public class LNURLPayPaymentMethodData : LNURLPayPaymentMethodBaseData
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace BTCPayServer.Client.Models
|
||||
namespace BTCPayServer.Client.Models
|
||||
{
|
||||
public class LightningNetworkPaymentMethodBaseData
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using NBitcoin;
|
||||
using NBitcoin;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace BTCPayServer.Client.Models
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using BTCPayServer.Client.JsonConverters;
|
||||
using BTCPayServer.Client.JsonConverters;
|
||||
using NBitcoin;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using NBXplorer;
|
||||
using NBXplorer;
|
||||
|
||||
namespace BTCPayServer.Common
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using BTCPayServer.Data;
|
||||
using BTCPayServer.Data;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using BTCPayServer.Data;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using BTCPayServer.Data;
|
||||
using BTCPayServer.Data;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using BTCPayServer.Data;
|
||||
using BTCPayServer.Data;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using BTCPayServer.Data;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
namespace BTCPayServer.Migrations
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using BTCPayServer.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using BTCPayServer.Abstractions.Contracts;
|
||||
using BTCPayServer.Abstractions.Models;
|
||||
using BTCPayServer.Abstractions.Services;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -28,7 +28,8 @@ namespace BTCPayServer.Tests
|
||||
|
||||
public static void AssertNoError(this IWebDriver driver)
|
||||
{
|
||||
if (!driver.PageSource.Contains("alert-danger")) return;
|
||||
if (!driver.PageSource.Contains("alert-danger"))
|
||||
return;
|
||||
foreach (var dangerAlert in driver.FindElements(By.ClassName("alert-danger")))
|
||||
Assert.False(dangerAlert.Displayed, $"No alert should be displayed, but found this on {driver.Url}: {dangerAlert.Text}");
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using BTCPayServer.Abstractions.Models;
|
||||
using BTCPayServer.BIP78.Sender;
|
||||
using BTCPayServer.Client.Models;
|
||||
using BTCPayServer.Controllers;
|
||||
using BTCPayServer.Data;
|
||||
@@ -16,11 +17,10 @@ using BTCPayServer.Services;
|
||||
using BTCPayServer.Services.Invoices;
|
||||
using BTCPayServer.Services.Wallets;
|
||||
using BTCPayServer.Tests.Logging;
|
||||
using BTCPayServer.Views.Stores;
|
||||
using BTCPayServer.Views.Wallets;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using NBitcoin;
|
||||
using BTCPayServer.BIP78.Sender;
|
||||
using BTCPayServer.Views.Stores;
|
||||
using NBitcoin.Payment;
|
||||
using NBitpayClient;
|
||||
using NBXplorer.DerivationStrategy;
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using BTCPayServer.Abstractions.Models;
|
||||
using BTCPayServer.BIP78.Sender;
|
||||
using BTCPayServer.Lightning;
|
||||
using BTCPayServer.Lightning.CLightning;
|
||||
using BTCPayServer.Views.Manage;
|
||||
@@ -12,11 +13,10 @@ using BTCPayServer.Views.Stores;
|
||||
using BTCPayServer.Views.Wallets;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using NBitcoin;
|
||||
using BTCPayServer.BIP78.Sender;
|
||||
using OpenQA.Selenium;
|
||||
using OpenQA.Selenium.Chrome;
|
||||
using Xunit;
|
||||
using OpenQA.Selenium.Support.UI;
|
||||
using Xunit;
|
||||
|
||||
namespace BTCPayServer.Tests
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BTCPayServer.BIP78.Sender;
|
||||
using BTCPayServer.Client;
|
||||
using BTCPayServer.Client.Models;
|
||||
using BTCPayServer.Controllers;
|
||||
@@ -14,6 +15,7 @@ using BTCPayServer.Lightning;
|
||||
using BTCPayServer.Lightning.CLightning;
|
||||
using BTCPayServer.Models.AccountViewModels;
|
||||
using BTCPayServer.Models.StoreViewModels;
|
||||
using BTCPayServer.Payments.Lightning;
|
||||
using BTCPayServer.Payments.PayJoin.Sender;
|
||||
using BTCPayServer.Services;
|
||||
using BTCPayServer.Services.Stores;
|
||||
@@ -23,8 +25,6 @@ using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.CodeAnalysis.Operations;
|
||||
using NBitcoin;
|
||||
using BTCPayServer.BIP78.Sender;
|
||||
using BTCPayServer.Payments.Lightning;
|
||||
using NBitcoin.Payment;
|
||||
using NBitpayClient;
|
||||
using NBXplorer.DerivationStrategy;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using BTCPayServer.Configuration;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using BTCPayServer.Configuration;
|
||||
using BTCPayServer.Logging;
|
||||
using BTCPayServer.SSH;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
@@ -464,8 +464,13 @@ namespace BTCPayServer.Controllers
|
||||
return RedirectToAction(nameof(HomeController.Index), "Home");
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
var user = new ApplicationUser { UserName = model.Email, Email = model.Email, RequiresEmailConfirmation = policies.RequiresConfirmedEmail,
|
||||
Created = DateTimeOffset.UtcNow };
|
||||
var user = new ApplicationUser
|
||||
{
|
||||
UserName = model.Email,
|
||||
Email = model.Email,
|
||||
RequiresEmailConfirmation = policies.RequiresConfirmedEmail,
|
||||
Created = DateTimeOffset.UtcNow
|
||||
};
|
||||
var result = await _userManager.CreateAsync(user, model.Password);
|
||||
if (result.Succeeded)
|
||||
{
|
||||
@@ -583,7 +588,8 @@ namespace BTCPayServer.Controllers
|
||||
}
|
||||
_eventAggregator.Publish(new UserPasswordResetRequestedEvent()
|
||||
{
|
||||
User = user, RequestUri = Request.GetAbsoluteRootUri()
|
||||
User = user,
|
||||
RequestUri = Request.GetAbsoluteRootUri()
|
||||
});
|
||||
return RedirectToAction(nameof(ForgotPasswordConfirmation));
|
||||
}
|
||||
@@ -639,7 +645,8 @@ namespace BTCPayServer.Controllers
|
||||
{
|
||||
TempData.SetStatusMessageModel(new StatusMessageModel()
|
||||
{
|
||||
Severity = StatusMessageModel.StatusSeverity.Success, Message = "Password successfully set."
|
||||
Severity = StatusMessageModel.StatusSeverity.Success,
|
||||
Message = "Password successfully set."
|
||||
});
|
||||
return RedirectToAction(nameof(Login));
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using BTCPayServer.Data;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using BTCPayServer.Abstractions.Constants;
|
||||
using BTCPayServer.Client;
|
||||
using BTCPayServer.Data;
|
||||
using BTCPayServer.Models;
|
||||
using BTCPayServer.Models.AppViewModels;
|
||||
using BTCPayServer.Services.Apps;
|
||||
|
||||
@@ -37,7 +37,10 @@ namespace BTCPayServer.Controllers.GreenField
|
||||
{
|
||||
var items = await _notificationManager.GetNotifications(new NotificationsQuery()
|
||||
{
|
||||
Seen = seen, UserId = _userManager.GetUserId(User), Skip = skip, Take = take
|
||||
Seen = seen,
|
||||
UserId = _userManager.GetUserId(User),
|
||||
Skip = skip,
|
||||
Take = take
|
||||
});
|
||||
|
||||
return Ok(items.Items.Select(ToModel));
|
||||
@@ -50,7 +53,8 @@ namespace BTCPayServer.Controllers.GreenField
|
||||
{
|
||||
var items = await _notificationManager.GetNotifications(new NotificationsQuery()
|
||||
{
|
||||
Ids = new[] {id}, UserId = _userManager.GetUserId(User)
|
||||
Ids = new[] { id },
|
||||
UserId = _userManager.GetUserId(User)
|
||||
});
|
||||
|
||||
if (items.Count == 0)
|
||||
@@ -84,7 +88,8 @@ namespace BTCPayServer.Controllers.GreenField
|
||||
{
|
||||
await _notificationManager.Remove(new NotificationsQuery()
|
||||
{
|
||||
Ids = new[] {id}, UserId = _userManager.GetUserId(User)
|
||||
Ids = new[] { id },
|
||||
UserId = _userManager.GetUserId(User)
|
||||
});
|
||||
|
||||
return Ok();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using BTCPayServer.Abstractions.Constants;
|
||||
using BTCPayServer.Client;
|
||||
|
||||
@@ -85,7 +85,8 @@ namespace BTCPayServer.Controllers.GreenField
|
||||
public async Task<IActionResult> ShowOnChainWalletOverview(string storeId, string cryptoCode)
|
||||
{
|
||||
if (IsInvalidWalletRequest(cryptoCode, out var network,
|
||||
out var derivationScheme, out var actionResult)) return actionResult;
|
||||
out var derivationScheme, out var actionResult))
|
||||
return actionResult;
|
||||
|
||||
var wallet = _btcPayWalletProvider.GetWallet(network);
|
||||
var balance = await wallet.GetBalance(derivationScheme.AccountDerivation);
|
||||
@@ -104,7 +105,8 @@ namespace BTCPayServer.Controllers.GreenField
|
||||
public async Task<IActionResult> GetOnChainFeeRate(string storeId, string cryptoCode, int? blockTarget = null)
|
||||
{
|
||||
if (IsInvalidWalletRequest(cryptoCode, out var network,
|
||||
out var derivationScheme, out var actionResult)) return actionResult;
|
||||
out var derivationScheme, out var actionResult))
|
||||
return actionResult;
|
||||
|
||||
var feeRateTarget = blockTarget ?? Store.GetStoreBlob().RecommendedFeeBlockTarget;
|
||||
return Ok(new OnChainWalletFeeRateData()
|
||||
@@ -119,7 +121,8 @@ namespace BTCPayServer.Controllers.GreenField
|
||||
public async Task<IActionResult> GetOnChainWalletReceiveAddress(string storeId, string cryptoCode, bool forceGenerate = false)
|
||||
{
|
||||
if (IsInvalidWalletRequest(cryptoCode, out var network,
|
||||
out var derivationScheme, out var actionResult)) return actionResult;
|
||||
out var derivationScheme, out var actionResult))
|
||||
return actionResult;
|
||||
|
||||
var kpi = await _walletReceiveService.GetOrGenerate(new WalletId(storeId, cryptoCode), forceGenerate);
|
||||
if (kpi is null)
|
||||
@@ -146,7 +149,8 @@ namespace BTCPayServer.Controllers.GreenField
|
||||
public async Task<IActionResult> UnReserveOnChainWalletReceiveAddress(string storeId, string cryptoCode)
|
||||
{
|
||||
if (IsInvalidWalletRequest(cryptoCode, out var network,
|
||||
out var derivationScheme, out var actionResult)) return actionResult;
|
||||
out var derivationScheme, out var actionResult))
|
||||
return actionResult;
|
||||
|
||||
var addr = await _walletReceiveService.UnReserveAddress(new WalletId(storeId, cryptoCode));
|
||||
if (addr is null)
|
||||
@@ -168,7 +172,8 @@ namespace BTCPayServer.Controllers.GreenField
|
||||
)
|
||||
{
|
||||
if (IsInvalidWalletRequest(cryptoCode, out var network,
|
||||
out var derivationScheme, out var actionResult)) return actionResult;
|
||||
out var derivationScheme, out var actionResult))
|
||||
return actionResult;
|
||||
|
||||
var wallet = _btcPayWalletProvider.GetWallet(network);
|
||||
var walletId = new WalletId(storeId, cryptoCode);
|
||||
@@ -205,7 +210,8 @@ namespace BTCPayServer.Controllers.GreenField
|
||||
string transactionId)
|
||||
{
|
||||
if (IsInvalidWalletRequest(cryptoCode, out var network,
|
||||
out var derivationScheme, out var actionResult)) return actionResult;
|
||||
out var derivationScheme, out var actionResult))
|
||||
return actionResult;
|
||||
|
||||
var wallet = _btcPayWalletProvider.GetWallet(network);
|
||||
var tx = await wallet.FetchTransaction(derivationScheme.AccountDerivation, uint256.Parse(transactionId));
|
||||
@@ -227,7 +233,8 @@ namespace BTCPayServer.Controllers.GreenField
|
||||
public async Task<IActionResult> GetOnChainWalletUTXOs(string storeId, string cryptoCode)
|
||||
{
|
||||
if (IsInvalidWalletRequest(cryptoCode, out var network,
|
||||
out var derivationScheme, out var actionResult)) return actionResult;
|
||||
out var derivationScheme, out var actionResult))
|
||||
return actionResult;
|
||||
|
||||
var wallet = _btcPayWalletProvider.GetWallet(network);
|
||||
|
||||
@@ -260,7 +267,8 @@ namespace BTCPayServer.Controllers.GreenField
|
||||
[FromBody] CreateOnChainTransactionRequest request)
|
||||
{
|
||||
if (IsInvalidWalletRequest(cryptoCode, out var network,
|
||||
out var derivationScheme, out var actionResult)) return actionResult;
|
||||
out var derivationScheme, out var actionResult))
|
||||
return actionResult;
|
||||
if (network.ReadonlyWallet)
|
||||
{
|
||||
return this.CreateAPIError("not-available",
|
||||
|
||||
@@ -36,7 +36,8 @@ namespace BTCPayServer.Controllers.GreenField
|
||||
var storeBlob = Store.GetStoreBlob();
|
||||
var excludedPaymentMethods = storeBlob.GetExcludedPaymentMethods();
|
||||
var canModifyStore = (await _authorizationService.AuthorizeAsync(User, null,
|
||||
new PolicyRequirement(Policies.CanModifyStoreSettings))).Succeeded;;
|
||||
new PolicyRequirement(Policies.CanModifyStoreSettings))).Succeeded;
|
||||
;
|
||||
return Ok(Store.GetSupportedPaymentMethods(_btcPayNetworkProvider)
|
||||
.Where(method =>
|
||||
enabled is null || (enabled is false && excludedPaymentMethods.Match(method.PaymentId)))
|
||||
|
||||
@@ -10,17 +10,17 @@ using BTCPayServer.Configuration;
|
||||
using BTCPayServer.Data;
|
||||
using BTCPayServer.Events;
|
||||
using BTCPayServer.HostedServices;
|
||||
using BTCPayServer.Logging;
|
||||
using BTCPayServer.Security;
|
||||
using BTCPayServer.Security.GreenField;
|
||||
using BTCPayServer.Services;
|
||||
using BTCPayServer.Storage.Services;
|
||||
using BTCPayServer.Services.Stores;
|
||||
using BTCPayServer.Storage.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Cors;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NicolasDorier.RateLimits;
|
||||
using BTCPayServer.Logging;
|
||||
|
||||
namespace BTCPayServer.Controllers.GreenField
|
||||
{
|
||||
@@ -169,7 +169,8 @@ namespace BTCPayServer.Controllers.GreenField
|
||||
if (!anyAdmin)
|
||||
{
|
||||
var settings = await _settingsRepository.GetSettingAsync<ThemeSettings>();
|
||||
if (settings != null) {
|
||||
if (settings != null)
|
||||
{
|
||||
settings.FirstRun = false;
|
||||
await _settingsRepository.UpdateSetting(settings);
|
||||
}
|
||||
@@ -234,7 +235,8 @@ namespace BTCPayServer.Controllers.GreenField
|
||||
private async Task<bool> IsUserTheOnlyOneAdmin(ApplicationUser user)
|
||||
{
|
||||
var isUserAdmin = await _userService.IsAdminUser(user);
|
||||
if (!isUserAdmin) {
|
||||
if (!isUserAdmin)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ using System.Threading.Tasks;
|
||||
using BTCPayServer.Data;
|
||||
using BTCPayServer.Filters;
|
||||
using BTCPayServer.Payments;
|
||||
using BTCPayServer.Services;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NBitcoin;
|
||||
using BTCPayServer.Services;
|
||||
|
||||
namespace BTCPayServer.Controllers
|
||||
{
|
||||
|
||||
@@ -283,7 +283,8 @@ namespace BTCPayServer.Controllers
|
||||
case RefundSteps.SelectRate:
|
||||
createPullPayment = new CreatePullPayment
|
||||
{
|
||||
Name = $"Refund {invoice.Id}", PaymentMethodIds = new[] { paymentMethodId },
|
||||
Name = $"Refund {invoice.Id}",
|
||||
PaymentMethodIds = new[] { paymentMethodId },
|
||||
StoreId = invoice.StoreId
|
||||
};
|
||||
switch (model.SelectedRefundOption)
|
||||
@@ -343,7 +344,8 @@ namespace BTCPayServer.Controllers
|
||||
|
||||
createPullPayment = new CreatePullPayment
|
||||
{
|
||||
Name = $"Refund {invoice.Id}", PaymentMethodIds = new[] { paymentMethodId },
|
||||
Name = $"Refund {invoice.Id}",
|
||||
PaymentMethodIds = new[] { paymentMethodId },
|
||||
StoreId = invoice.StoreId,
|
||||
Currency = model.CustomCurrency,
|
||||
Amount = model.CustomAmount
|
||||
|
||||
@@ -201,14 +201,19 @@ namespace BTCPayServer.Controllers
|
||||
* Go over each permission and associated store IDs and
|
||||
* join them so that permission for a specific store is parsed correctly
|
||||
*/
|
||||
for (var i = 0; i < permissions.Length; i++) {
|
||||
for (var i = 0; i < permissions.Length; i++)
|
||||
{
|
||||
var currPerm = permissions[i];
|
||||
var storeIds = vm.PermissionValues[i].SpecificStores.ToArray();
|
||||
if (storeIds.Length > 0) {
|
||||
for (var x = 0; x < storeIds.Length; x++) {
|
||||
if (storeIds.Length > 0)
|
||||
{
|
||||
for (var x = 0; x < storeIds.Length; x++)
|
||||
{
|
||||
permissionsWithStoreIDs.Add($"{currPerm}:{storeIds[x]}");
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
permissionsWithStoreIDs.Add(currPerm);
|
||||
}
|
||||
}
|
||||
@@ -232,7 +237,8 @@ namespace BTCPayServer.Controllers
|
||||
var command = commandParts.Length > 1 ? commandParts[1] : null;
|
||||
var isPerformingAnAction = command == "change-store-mode" || command == "add-store";
|
||||
// Don't want to accidentally change mode for the user if they are explicitly performing some action
|
||||
if (isPerformingAnAction) {
|
||||
if (isPerformingAnAction)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
|
||||
@@ -56,7 +56,8 @@ namespace BTCPayServer.Controllers
|
||||
await _userManager.UpdateAsync(user);
|
||||
TempData.SetStatusMessageModel(new StatusMessageModel()
|
||||
{
|
||||
Message = "Updated successfully.", Severity = StatusMessageModel.StatusSeverity.Success
|
||||
Message = "Updated successfully.",
|
||||
Severity = StatusMessageModel.StatusSeverity.Success
|
||||
});
|
||||
return RedirectToAction("NotificationSettings");
|
||||
}
|
||||
|
||||
@@ -110,7 +110,9 @@ namespace BTCPayServer.Controllers
|
||||
|
||||
var res = await _notificationManager.GetNotifications(new NotificationsQuery()
|
||||
{
|
||||
Skip = skip, Take = count, UserId = userId
|
||||
Skip = skip,
|
||||
Take = count,
|
||||
UserId = userId
|
||||
});
|
||||
|
||||
var model = new IndexViewModel() { Skip = skip, Count = count, Items = res.Items, Total = res.Count };
|
||||
@@ -148,7 +150,8 @@ namespace BTCPayServer.Controllers
|
||||
var items = await
|
||||
_notificationManager.ToggleSeen(new NotificationsQuery()
|
||||
{
|
||||
Ids = new[] {id}, UserId = userId
|
||||
Ids = new[] { id },
|
||||
UserId = userId
|
||||
}, true);
|
||||
|
||||
var link = items.FirstOrDefault()?.ActionLink ?? "";
|
||||
@@ -185,21 +188,26 @@ namespace BTCPayServer.Controllers
|
||||
case "delete":
|
||||
await _notificationManager.Remove(new NotificationsQuery()
|
||||
{
|
||||
UserId = userId, Ids = selectedItems
|
||||
UserId = userId,
|
||||
Ids = selectedItems
|
||||
});
|
||||
|
||||
break;
|
||||
case "mark-seen":
|
||||
await _notificationManager.ToggleSeen(new NotificationsQuery()
|
||||
{
|
||||
UserId = userId, Ids = selectedItems, Seen = false
|
||||
UserId = userId,
|
||||
Ids = selectedItems,
|
||||
Seen = false
|
||||
}, true);
|
||||
|
||||
break;
|
||||
case "mark-unseen":
|
||||
await _notificationManager.ToggleSeen(new NotificationsQuery()
|
||||
{
|
||||
UserId = userId, Ids = selectedItems, Seen = true
|
||||
UserId = userId,
|
||||
Ids = selectedItems,
|
||||
Seen = true
|
||||
}, false);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -279,7 +279,8 @@ namespace BTCPayServer.Controllers
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
if (!result.AllowCustomPaymentAmounts) {
|
||||
if (!result.AllowCustomPaymentAmounts)
|
||||
{
|
||||
return BadRequest("Not allowed to cancel this invoice");
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +107,8 @@ namespace BTCPayServer.Controllers
|
||||
{
|
||||
TempData.SetStatusMessageModel(new StatusMessageModel()
|
||||
{
|
||||
Message = "The plugin could not be downloaded. Try again later.", Severity = StatusMessageModel.StatusSeverity.Error
|
||||
Message = "The plugin could not be downloaded. Try again later.",
|
||||
Severity = StatusMessageModel.StatusSeverity.Error
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -138,8 +138,14 @@ namespace BTCPayServer.Controllers
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
IdentityResult result;
|
||||
var user = new ApplicationUser { UserName = model.Email, Email = model.Email, EmailConfirmed = model.EmailConfirmed, RequiresEmailConfirmation = requiresConfirmedEmail,
|
||||
Created = DateTimeOffset.UtcNow };
|
||||
var user = new ApplicationUser
|
||||
{
|
||||
UserName = model.Email,
|
||||
Email = model.Email,
|
||||
EmailConfirmed = model.EmailConfirmed,
|
||||
RequiresEmailConfirmation = requiresConfirmedEmail,
|
||||
Created = DateTimeOffset.UtcNow
|
||||
};
|
||||
|
||||
if (!string.IsNullOrEmpty(model.Password))
|
||||
{
|
||||
@@ -159,7 +165,10 @@ namespace BTCPayServer.Controllers
|
||||
|
||||
_eventAggregator.Publish(new UserRegisteredEvent()
|
||||
{
|
||||
RequestUri = Request.GetAbsoluteRootUri(), User = user, Admin = model.IsAdmin is true, CallbackUrlGenerated = tcs
|
||||
RequestUri = Request.GetAbsoluteRootUri(),
|
||||
User = user,
|
||||
Admin = model.IsAdmin is true,
|
||||
CallbackUrlGenerated = tcs
|
||||
});
|
||||
var callbackUrl = await tcs.Task;
|
||||
|
||||
@@ -173,7 +182,8 @@ namespace BTCPayServer.Controllers
|
||||
Html =
|
||||
$"Account created without a set password. An email will be sent (if configured) to set the password.<br/> You may alternatively share this link with them: <a class='alert-link' href='{callbackUrl}'>{callbackUrl}</a>"
|
||||
});
|
||||
}else if (!await _UserManager.HasPasswordAsync(user))
|
||||
}
|
||||
else if (!await _UserManager.HasPasswordAsync(user))
|
||||
{
|
||||
TempData.SetStatusMessageModel(new StatusMessageModel()
|
||||
{
|
||||
|
||||
@@ -172,7 +172,9 @@ namespace BTCPayServer.Controllers
|
||||
|
||||
var vm = this.ParseListQuery(new PullPaymentsModel()
|
||||
{
|
||||
Skip = skip, Count = count, Total = await ppsQuery.CountAsync()
|
||||
Skip = skip,
|
||||
Count = count,
|
||||
Total = await ppsQuery.CountAsync()
|
||||
});
|
||||
var pps = (await ppsQuery
|
||||
.Skip(vm.Skip)
|
||||
@@ -186,7 +188,8 @@ namespace BTCPayServer.Controllers
|
||||
.Select(o => o.GetBlob(_jsonSerializerSettings).Amount).Sum();
|
||||
var totalAwaiting = pp.Payouts.Where(p => (p.State == PayoutState.AwaitingPayment ||
|
||||
p.State == PayoutState.AwaitingApproval) &&
|
||||
p.IsInPeriod(pp, now)).Select(o => o.GetBlob(_jsonSerializerSettings).Amount).Sum();;
|
||||
p.IsInPeriod(pp, now)).Select(o => o.GetBlob(_jsonSerializerSettings).Amount).Sum();
|
||||
;
|
||||
var ppBlob = pp.GetBlob();
|
||||
var ni = _currencyNameTable.GetCurrencyData(ppBlob.Currency, true);
|
||||
var nfi = _currencyNameTable.GetNumberFormatInfo(ppBlob.Currency, true);
|
||||
@@ -331,17 +334,20 @@ namespace BTCPayServer.Controllers
|
||||
}
|
||||
TempData.SetStatusMessageModel(new StatusMessageModel()
|
||||
{
|
||||
Message = "Payouts approved", Severity = StatusMessageModel.StatusSeverity.Success
|
||||
Message = "Payouts approved",
|
||||
Severity = StatusMessageModel.StatusSeverity.Success
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
case "pay":
|
||||
{
|
||||
if (handler is { }) return await handler?.InitiatePayment(paymentMethodId, payoutIds);
|
||||
if (handler is { })
|
||||
return await handler?.InitiatePayment(paymentMethodId, payoutIds);
|
||||
TempData.SetStatusMessageModel(new StatusMessageModel()
|
||||
{
|
||||
Message = "Paying via this payment method is not supported", Severity = StatusMessageModel.StatusSeverity.Error
|
||||
Message = "Paying via this payment method is not supported",
|
||||
Severity = StatusMessageModel.StatusSeverity.Error
|
||||
});
|
||||
break;
|
||||
}
|
||||
@@ -379,7 +385,8 @@ namespace BTCPayServer.Controllers
|
||||
|
||||
TempData.SetStatusMessageModel(new StatusMessageModel()
|
||||
{
|
||||
Message = "Payouts marked as paid", Severity = StatusMessageModel.StatusSeverity.Success
|
||||
Message = "Payouts marked as paid",
|
||||
Severity = StatusMessageModel.StatusSeverity.Success
|
||||
});
|
||||
break;
|
||||
}
|
||||
@@ -389,7 +396,8 @@ namespace BTCPayServer.Controllers
|
||||
new PullPaymentHostedService.CancelRequest(payoutIds));
|
||||
TempData.SetStatusMessageModel(new StatusMessageModel()
|
||||
{
|
||||
Message = "Payouts archived", Severity = StatusMessageModel.StatusSeverity.Success
|
||||
Message = "Payouts archived",
|
||||
Severity = StatusMessageModel.StatusSeverity.Success
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#nullable enable
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using BTCPayServer.Client.Models;
|
||||
using BTCPayServer.Data;
|
||||
using BTCPayServer.Models;
|
||||
using BTCPayServer.Models.StoreViewModels;
|
||||
using BTCPayServer.Client.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NBitcoin;
|
||||
using NBitcoin.DataEncoders;
|
||||
@@ -30,7 +30,8 @@ namespace BTCPayServer.Controllers
|
||||
var webhooks = await _Repo.GetWebhooks(CurrentStore.Id);
|
||||
return View(nameof(Webhooks), new WebhooksViewModel()
|
||||
{
|
||||
Webhooks = webhooks.Select(async w => {
|
||||
Webhooks = webhooks.Select(async w =>
|
||||
{
|
||||
var lastDelivery = await LastDeliveryForWebhook(w.Id);
|
||||
var lastDeliveryBlob = lastDelivery?.GetBlob();
|
||||
|
||||
@@ -135,9 +136,12 @@ namespace BTCPayServer.Controllers
|
||||
{
|
||||
var result = await WebhookNotificationManager.TestWebhook(CurrentStore.Id, webhookId, viewModel.Type);
|
||||
|
||||
if (result.Success) {
|
||||
if (result.Success)
|
||||
{
|
||||
TempData[WellKnownTempData.SuccessMessage] = $"{viewModel.Type.ToString()} event delivered successfully! Delivery ID is {result.DeliveryId}";
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
TempData[WellKnownTempData.ErrorMessage] = $"{viewModel.Type.ToString()} event could not be delivered. Error message received: {(result.ErrorMessage ?? "unknown")}";
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BTCPayServer.Abstractions.Extensions;
|
||||
using BTCPayServer.Abstractions.Models;
|
||||
using BTCPayServer.BIP78.Sender;
|
||||
using BTCPayServer.HostedServices;
|
||||
using BTCPayServer.ModelBinders;
|
||||
using BTCPayServer.Models;
|
||||
@@ -13,7 +14,6 @@ using BTCPayServer.Payments.PayJoin.Sender;
|
||||
using BTCPayServer.Services;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NBitcoin;
|
||||
using BTCPayServer.BIP78.Sender;
|
||||
using NBitcoin.Payment;
|
||||
using NBXplorer;
|
||||
using NBXplorer.Models;
|
||||
|
||||
@@ -7,13 +7,16 @@ using System.Threading.Tasks;
|
||||
using BTCPayServer.Abstractions.Constants;
|
||||
using BTCPayServer.Abstractions.Extensions;
|
||||
using BTCPayServer.Abstractions.Models;
|
||||
using BTCPayServer.BIP78.Sender;
|
||||
using BTCPayServer.Client;
|
||||
using BTCPayServer.Data;
|
||||
using BTCPayServer.HostedServices;
|
||||
using BTCPayServer.ModelBinders;
|
||||
using BTCPayServer.Models;
|
||||
using BTCPayServer.Models.StoreViewModels;
|
||||
using BTCPayServer.Models.WalletViewModels;
|
||||
using BTCPayServer.Payments;
|
||||
using BTCPayServer.Payments.PayJoin;
|
||||
using BTCPayServer.Services;
|
||||
using BTCPayServer.Services.Labels;
|
||||
using BTCPayServer.Services.Rates;
|
||||
@@ -23,9 +26,6 @@ using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NBitcoin;
|
||||
using BTCPayServer.BIP78.Sender;
|
||||
using BTCPayServer.Models.StoreViewModels;
|
||||
using BTCPayServer.Payments.PayJoin;
|
||||
using NBXplorer;
|
||||
using NBXplorer.DerivationStrategy;
|
||||
using NBXplorer.Models;
|
||||
@@ -177,7 +177,8 @@ namespace BTCPayServer.Controllers
|
||||
allColors
|
||||
.GroupBy(k => k)
|
||||
.OrderBy(k => k.Count())
|
||||
.ThenBy(k => {
|
||||
.ThenBy(k =>
|
||||
{
|
||||
var indexInColorScheme = Array.IndexOf(LabelColorScheme, k.Key);
|
||||
|
||||
// Ensures that any label color which may not be in our label color scheme is given the least priority
|
||||
|
||||
@@ -106,7 +106,8 @@ public class BitcoinLikePayoutHandler : IPayoutHandler
|
||||
var res = raw.ToObject<PayoutTransactionOnChainBlob>(
|
||||
JsonSerializer.Create(_jsonSerializerSettings.GetSerializer(paymentMethodId.CryptoCode)));
|
||||
var network = _btcPayNetworkProvider.GetNetwork<BTCPayNetwork>(paymentMethodId.CryptoCode);
|
||||
if (res == null) return null;
|
||||
if (res == null)
|
||||
return null;
|
||||
res.LinkTemplate = network.BlockExplorerLink;
|
||||
return res;
|
||||
}
|
||||
@@ -392,7 +393,8 @@ public class BitcoinLikePayoutHandler : IPayoutHandler
|
||||
var proof = ParseProof(payout) as PayoutTransactionOnChainBlob ??
|
||||
new PayoutTransactionOnChainBlob() { Accounted = isInternal };
|
||||
var txId = newTransaction.NewTransactionEvent.TransactionData.TransactionHash;
|
||||
if (!proof.Candidates.Add(txId)) return;
|
||||
if (!proof.Candidates.Add(txId))
|
||||
return;
|
||||
if (isInternal)
|
||||
{
|
||||
payout.State = PayoutState.InProgress;
|
||||
|
||||
@@ -5,8 +5,8 @@ using BTCPayServer.Abstractions.Models;
|
||||
using BTCPayServer.Client.Models;
|
||||
using BTCPayServer.Data;
|
||||
using BTCPayServer.Payments;
|
||||
using PayoutData = BTCPayServer.Data.PayoutData;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using PayoutData = BTCPayServer.Data.PayoutData;
|
||||
using StoreData = BTCPayServer.Data.StoreData;
|
||||
|
||||
public interface IPayoutHandler
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace BTCPayServer.Data.Payouts.LightningLike
|
||||
namespace BTCPayServer.Data.Payouts.LightningLike
|
||||
{
|
||||
public class LNURLPayClaimDestinaton : ILightningLikeLikeClaimDestination
|
||||
{
|
||||
|
||||
@@ -76,7 +76,8 @@ namespace BTCPayServer.Data.Payouts.LightningLike
|
||||
.ToListAsync())
|
||||
.Where(payout =>
|
||||
{
|
||||
if (approvedStores.TryGetValue(payout.PullPaymentData.StoreId, out var value)) return value;
|
||||
if (approvedStores.TryGetValue(payout.PullPaymentData.StoreId, out var value))
|
||||
return value;
|
||||
value = payout.PullPaymentData.StoreData.UserStores
|
||||
.Any(store => store.Role == StoreRoles.Owner && store.ApplicationUserId == userId);
|
||||
approvedStores.Add(payout.PullPaymentData.StoreId, value);
|
||||
@@ -98,7 +99,9 @@ namespace BTCPayServer.Data.Payouts.LightningLike
|
||||
|
||||
return new ConfirmVM()
|
||||
{
|
||||
Amount = blob.CryptoAmount.Value, Destination = blob.Destination, PayoutId = payoutData.Id
|
||||
Amount = blob.CryptoAmount.Value,
|
||||
Destination = blob.Destination,
|
||||
PayoutId = payoutData.Id
|
||||
};
|
||||
}).ToList();
|
||||
return View(vm);
|
||||
@@ -136,7 +139,9 @@ namespace BTCPayServer.Data.Payouts.LightningLike
|
||||
{
|
||||
results.Add(new ResultVM()
|
||||
{
|
||||
PayoutId = payoutData.Id, Result = result.Result, Destination = payoutBlob.Destination
|
||||
PayoutId = payoutData.Id,
|
||||
Result = result.Result,
|
||||
Destination = payoutBlob.Destination
|
||||
});
|
||||
payoutData.State = PayoutState.Completed;
|
||||
}
|
||||
@@ -144,7 +149,9 @@ namespace BTCPayServer.Data.Payouts.LightningLike
|
||||
{
|
||||
results.Add(new ResultVM()
|
||||
{
|
||||
PayoutId = payoutData.Id, Result = result.Result, Destination = payoutBlob.Destination
|
||||
PayoutId = payoutData.Id,
|
||||
Result = result.Result,
|
||||
Destination = payoutBlob.Destination
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -249,7 +256,9 @@ namespace BTCPayServer.Data.Payouts.LightningLike
|
||||
{
|
||||
results.Add(new ResultVM()
|
||||
{
|
||||
PayoutId = payoutData.Id, Result = PayResult.Error, Destination = blob.Destination
|
||||
PayoutId = payoutData.Id,
|
||||
Result = PayResult.Error,
|
||||
Destination = blob.Destination
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,8 @@ namespace BTCPayServer.Data.Payouts.LightningLike
|
||||
? new BoltInvoiceClaimDestination(destination, invoice)
|
||||
: null;
|
||||
|
||||
if (result == null) return (null, "A valid BOLT11 invoice (with 30+ day expiry) or LNURL Pay or Lightning address was not provided.");
|
||||
if (result == null)
|
||||
return (null, "A valid BOLT11 invoice (with 30+ day expiry) or LNURL Pay or Lightning address was not provided.");
|
||||
if (validate && (invoice.ExpiryDate.UtcDateTime - DateTime.UtcNow).Days < 30)
|
||||
{
|
||||
return (null,
|
||||
@@ -150,7 +151,8 @@ namespace BTCPayServer.Data.Payouts.LightningLike
|
||||
|
||||
foreach (UserStore storeDataUserStore in storeData.UserStores)
|
||||
{
|
||||
if (!await _userService.IsAdminUser(storeDataUserStore.ApplicationUserId)) continue;
|
||||
if (!await _userService.IsAdminUser(storeDataUserStore.ApplicationUserId))
|
||||
continue;
|
||||
result.Add(supportedPaymentMethod.PaymentId);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -4,11 +4,11 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using BTCPayServer.Payments;
|
||||
using BTCPayServer.Payments.Lightning;
|
||||
using BTCPayServer.Services.Rates;
|
||||
using NBitcoin;
|
||||
using NBXplorer;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using BTCPayServer.Payments.Lightning;
|
||||
|
||||
namespace BTCPayServer.Data
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using BTCPayServer.Services.Invoices;
|
||||
using BTCPayServer.Services.Invoices;
|
||||
|
||||
namespace BTCPayServer.Events
|
||||
{
|
||||
|
||||
@@ -12,6 +12,7 @@ using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BTCPayServer.Abstractions.Models;
|
||||
using BTCPayServer.BIP78.Sender;
|
||||
using BTCPayServer.Configuration;
|
||||
using BTCPayServer.Data;
|
||||
using BTCPayServer.Lightning;
|
||||
@@ -29,7 +30,6 @@ using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NBitcoin;
|
||||
using BTCPayServer.BIP78.Sender;
|
||||
using NBitcoin.Payment;
|
||||
using NBitpayClient;
|
||||
using NBXplorer.DerivationStrategy;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using BTCPayServer.Abstractions.Contracts;
|
||||
using BTCPayServer.Services;
|
||||
|
||||
|
||||
@@ -12,7 +12,8 @@ namespace BTCPayServer
|
||||
{
|
||||
return input.Substring(0, input.Length - suffixToRemove.Length);
|
||||
}
|
||||
else return input;
|
||||
else
|
||||
return input;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using BTCPayServer.Data;
|
||||
using BTCPayServer.Services.Invoices;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
@@ -50,7 +50,8 @@ namespace BTCPayServer.Fido2
|
||||
// 3. Create options
|
||||
var authenticatorSelection = new AuthenticatorSelection
|
||||
{
|
||||
RequireResidentKey = false, UserVerification = UserVerificationRequirement.Preferred
|
||||
RequireResidentKey = false,
|
||||
UserVerification = UserVerificationRequirement.Preferred
|
||||
};
|
||||
|
||||
var exts = new AuthenticationExtensionsClientInputs()
|
||||
@@ -61,7 +62,8 @@ namespace BTCPayServer.Fido2
|
||||
UserVerificationMethod = true,
|
||||
BiometricAuthenticatorPerformanceBounds = new AuthenticatorBiometricPerfBounds
|
||||
{
|
||||
FAR = float.MaxValue, FRR = float.MaxValue
|
||||
FAR = float.MaxValue,
|
||||
FRR = float.MaxValue
|
||||
},
|
||||
};
|
||||
|
||||
@@ -183,7 +185,8 @@ namespace BTCPayServer.Fido2
|
||||
return options;
|
||||
}
|
||||
|
||||
public async Task<bool> CompleteLogin(string userId, AuthenticatorAssertionRawResponse response){
|
||||
public async Task<bool> CompleteLogin(string userId, AuthenticatorAssertionRawResponse response)
|
||||
{
|
||||
await using var dbContext = _contextFactory.CreateContext();
|
||||
var user = await dbContext.Users.Include(applicationUser => applicationUser.Fido2Credentials)
|
||||
.FirstOrDefaultAsync(applicationUser => applicationUser.Id == userId);
|
||||
|
||||
@@ -40,7 +40,8 @@ namespace BTCPayServer.Fido2
|
||||
}
|
||||
public string Verify(string code)
|
||||
{
|
||||
if (!_memoryCache.TryGetValue(code, out var userId)) return null;
|
||||
if (!_memoryCache.TryGetValue(code, out var userId))
|
||||
return null;
|
||||
_memoryCache.Remove(GetCacheKey((string)userId));
|
||||
_memoryCache.Remove(code);
|
||||
return (string)userId;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using System;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc.ActionConstraints;
|
||||
using BTCPayServer.Services;
|
||||
using Microsoft.AspNetCore.Mvc.ActionConstraints;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace BTCPayServer.Filters
|
||||
{
|
||||
|
||||
@@ -44,7 +44,8 @@ namespace BTCPayServer.Filters
|
||||
return true;
|
||||
}
|
||||
|
||||
if (AppType == policies.RootAppType) {
|
||||
if (AppType == policies.RootAppType)
|
||||
{
|
||||
context.RouteContext.RouteData.Values.Add("appId", policies.RootAppId);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -8,8 +8,8 @@ using BTCPayServer.Data;
|
||||
using BTCPayServer.Logging;
|
||||
using BTCPayServer.Services;
|
||||
using BTCPayServer.Services.Invoices;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace BTCPayServer.HostedServices
|
||||
{
|
||||
|
||||
@@ -6,8 +6,8 @@ using BTCPayServer.Abstractions.Contracts;
|
||||
using BTCPayServer.Abstractions.Extensions;
|
||||
using BTCPayServer.Abstractions.Models;
|
||||
using BTCPayServer.Abstractions.Services;
|
||||
using BTCPayServer.Common;
|
||||
using BTCPayServer.Client;
|
||||
using BTCPayServer.Common;
|
||||
using BTCPayServer.Configuration;
|
||||
using BTCPayServer.Controllers;
|
||||
using BTCPayServer.Controllers.GreenField;
|
||||
@@ -51,12 +51,12 @@ using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using NBitcoin;
|
||||
using NBitcoin.RPC;
|
||||
using NBitpayClient;
|
||||
using NBXplorer.DerivationStrategy;
|
||||
using Newtonsoft.Json;
|
||||
using NicolasDorier.RateLimits;
|
||||
using Serilog;
|
||||
using NBitcoin.RPC;
|
||||
#if ALTCOINS
|
||||
using BTCPayServer.Services.Altcoins.Monero;
|
||||
#endif
|
||||
|
||||
@@ -545,12 +545,16 @@ retry:
|
||||
null when paymentMethodId.PaymentType == LightningPaymentType.Instance &&
|
||||
lightningMaxValue != null => new PaymentMethodCriteria()
|
||||
{
|
||||
Above = false, PaymentMethod = paymentMethodId, Value = lightningMaxValue
|
||||
Above = false,
|
||||
PaymentMethod = paymentMethodId,
|
||||
Value = lightningMaxValue
|
||||
},
|
||||
null when paymentMethodId.PaymentType == BitcoinPaymentType.Instance &&
|
||||
onChainMinValue != null => new PaymentMethodCriteria()
|
||||
{
|
||||
Above = true, PaymentMethod = paymentMethodId, Value = onChainMinValue
|
||||
Above = true,
|
||||
PaymentMethod = paymentMethodId,
|
||||
Value = onChainMinValue
|
||||
},
|
||||
_ => new PaymentMethodCriteria()
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using BTCPayServer.Configuration;
|
||||
using BTCPayServer.Controllers.GreenField;
|
||||
using BTCPayServer.Data;
|
||||
using BTCPayServer.Fido2;
|
||||
using BTCPayServer.Filters;
|
||||
@@ -13,15 +14,16 @@ using BTCPayServer.Plugins;
|
||||
using BTCPayServer.Security;
|
||||
using BTCPayServer.Services.Apps;
|
||||
using BTCPayServer.Storage;
|
||||
using Fido2NetLib;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Fido2NetLib;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.DataProtection;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
@@ -30,8 +32,6 @@ using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Microsoft.Net.Http.Headers;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using BTCPayServer.Controllers.GreenField;
|
||||
|
||||
namespace BTCPayServer.Hosting
|
||||
{
|
||||
|
||||
@@ -26,8 +26,8 @@ using BTCPayServer.Services.Stores;
|
||||
using LNURL;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
using NBitcoin;
|
||||
using NBitcoin.Crypto;
|
||||
using Newtonsoft.Json;
|
||||
@@ -340,7 +340,8 @@ namespace BTCPayServer
|
||||
{
|
||||
return BadRequest(new LNUrlStatusResponse
|
||||
{
|
||||
Status = "ERROR", Reason = "Amount is out of bounds."
|
||||
Status = "ERROR",
|
||||
Reason = "Amount is out of bounds."
|
||||
});
|
||||
}
|
||||
|
||||
@@ -404,7 +405,9 @@ namespace BTCPayServer
|
||||
paymentMethodDetails, pmi));
|
||||
return Ok(new LNURLPayRequest.LNURLPayRequestCallbackResponse
|
||||
{
|
||||
Disposable = true, Routes = Array.Empty<string>(), Pr = paymentMethodDetails.BOLT11
|
||||
Disposable = true,
|
||||
Routes = Array.Empty<string>(),
|
||||
Pr = paymentMethodDetails.BOLT11
|
||||
});
|
||||
}
|
||||
|
||||
@@ -419,7 +422,9 @@ namespace BTCPayServer
|
||||
|
||||
return Ok(new LNURLPayRequest.LNURLPayRequestCallbackResponse
|
||||
{
|
||||
Disposable = true, Routes = Array.Empty<string>(), Pr = paymentMethodDetails.BOLT11
|
||||
Disposable = true,
|
||||
Routes = Array.Empty<string>(),
|
||||
Pr = paymentMethodDetails.BOLT11
|
||||
});
|
||||
}
|
||||
|
||||
@@ -439,7 +444,8 @@ namespace BTCPayServer
|
||||
|
||||
return BadRequest(new LNUrlStatusResponse
|
||||
{
|
||||
Status = "ERROR", Reason = "Invoice not in a valid payable state"
|
||||
Status = "ERROR",
|
||||
Reason = "Invoice not in a valid payable state"
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using BTCPayServer.Services.Apps;
|
||||
using BTCPayServer.Validation;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using BTCPayServer.Services.Apps;
|
||||
|
||||
namespace BTCPayServer.Models.InvoicingModels
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using BTCPayServer.Abstractions.Extensions;
|
||||
using System.Linq;
|
||||
using BTCPayServer.Abstractions.Extensions;
|
||||
using BTCPayServer.Client.Models;
|
||||
using BTCPayServer.Data;
|
||||
using BTCPayServer.Payments;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using NBitcoin;
|
||||
using BTCPayServer;
|
||||
using NBitcoin;
|
||||
|
||||
namespace BTCPayServer.Models.WalletViewModels
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BTCPayServer.Client.Models;
|
||||
using BTCPayServer.Configuration;
|
||||
using BTCPayServer.Data;
|
||||
using BTCPayServer.HostedServices;
|
||||
@@ -12,7 +13,6 @@ using BTCPayServer.Lightning;
|
||||
using BTCPayServer.Logging;
|
||||
using BTCPayServer.Models;
|
||||
using BTCPayServer.Models.InvoicingModels;
|
||||
using BTCPayServer.Client.Models;
|
||||
using BTCPayServer.Services;
|
||||
using BTCPayServer.Services.Invoices;
|
||||
using BTCPayServer.Services.Rates;
|
||||
@@ -67,7 +67,8 @@ namespace BTCPayServer.Payments.Lightning
|
||||
|
||||
return new LNURLPayPaymentMethodDetails()
|
||||
{
|
||||
Activated = false, LightningSupportedPaymentMethod = lnSupported
|
||||
Activated = false,
|
||||
LightningSupportedPaymentMethod = lnSupported
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using BTCPayServer.Client.JsonConverters;
|
||||
using BTCPayServer.Client.JsonConverters;
|
||||
using BTCPayServer.Lightning;
|
||||
using BTCPayServer.Payments.Lightning;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BTCPayServer.Client.Models;
|
||||
using BTCPayServer.Configuration;
|
||||
using BTCPayServer.Data;
|
||||
using BTCPayServer.HostedServices;
|
||||
@@ -12,7 +13,6 @@ using BTCPayServer.Lightning;
|
||||
using BTCPayServer.Logging;
|
||||
using BTCPayServer.Models;
|
||||
using BTCPayServer.Models.InvoicingModels;
|
||||
using BTCPayServer.Client.Models;
|
||||
using BTCPayServer.Services;
|
||||
using BTCPayServer.Services.Invoices;
|
||||
using BTCPayServer.Services.Rates;
|
||||
@@ -59,7 +59,8 @@ namespace BTCPayServer.Payments.Lightning
|
||||
{
|
||||
throw new PaymentMethodUnavailableException("BOLT11 payment method is disabled");
|
||||
}
|
||||
if (paymentMethod.ParentEntity.Type == InvoiceType.TopUp) {
|
||||
if (paymentMethod.ParentEntity.Type == InvoiceType.TopUp)
|
||||
{
|
||||
throw new PaymentMethodUnavailableException("Lightning Network payment method is not available for top-up invoices");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using BTCPayServer.BIP78.Sender;
|
||||
using BTCPayServer.HostedServices;
|
||||
using BTCPayServer.Payments.PayJoin.Sender;
|
||||
using BTCPayServer.Services;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using BTCPayServer.BIP78.Sender;
|
||||
|
||||
namespace BTCPayServer.Payments.PayJoin
|
||||
{
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using BTCPayServer.BIP78.Sender;
|
||||
using BTCPayServer.Client.Models;
|
||||
using BTCPayServer.Payments.Bitcoin;
|
||||
using BTCPayServer.Services.Invoices;
|
||||
using NBitcoin;
|
||||
using BTCPayServer.BIP78.Sender;
|
||||
using BTCPayServer.Client.Models;
|
||||
using NBitpayClient;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using InvoiceCryptoInfo = BTCPayServer.Services.Invoices.InvoiceCryptoInfo;
|
||||
|
||||
@@ -9,7 +9,8 @@ namespace BTCPayServer.Plugins.Shopify.ApiModels
|
||||
public ScriptTag ScriptTag { get; set; }
|
||||
}
|
||||
|
||||
public class ScriptTag {
|
||||
public class ScriptTag
|
||||
{
|
||||
[JsonProperty("id")]
|
||||
public int Id { get; set; }
|
||||
|
||||
|
||||
@@ -111,7 +111,8 @@ namespace BTCPayServer.Plugins.Shopify
|
||||
var invoiceOrderId = $"{ShopifyOrderMarkerHostedService.SHOPIFY_ORDER_ID_PREFIX}{orderId}";
|
||||
var matchedExistingInvoices = await _invoiceRepository.GetInvoices(new InvoiceQuery()
|
||||
{
|
||||
OrderId = new[] {invoiceOrderId}, StoreId = new[] {storeId}
|
||||
OrderId = new[] { invoiceOrderId },
|
||||
StoreId = new[] { storeId }
|
||||
});
|
||||
matchedExistingInvoices = matchedExistingInvoices.Where(entity =>
|
||||
entity.GetInternalTags(ShopifyOrderMarkerHostedService.SHOPIFY_ORDER_ID_PREFIX)
|
||||
|
||||
@@ -164,9 +164,12 @@ namespace BTCPayServer.Security
|
||||
_httpContext.SetStoreData(store);
|
||||
|
||||
// cache associated entities if present
|
||||
if (app != null) _httpContext.SetAppData(app);
|
||||
if (invoice != null) _httpContext.SetInvoiceData(invoice);
|
||||
if (paymentRequest != null) _httpContext.SetPaymentRequestData(paymentRequest);
|
||||
if (app != null)
|
||||
_httpContext.SetAppData(app);
|
||||
if (invoice != null)
|
||||
_httpContext.SetInvoiceData(invoice);
|
||||
if (paymentRequest != null)
|
||||
_httpContext.SetPaymentRequestData(paymentRequest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
|
||||
@@ -59,67 +59,80 @@ namespace BTCPayServer.Services.Invoices
|
||||
set => SetMetadata("paymentRequestId", value);
|
||||
}
|
||||
[JsonIgnore]
|
||||
public string BuyerName{
|
||||
public string BuyerName
|
||||
{
|
||||
get => GetMetadata<string>("buyerName");
|
||||
set => SetMetadata("buyerName", value);
|
||||
}
|
||||
[JsonIgnore]
|
||||
public string BuyerEmail {
|
||||
public string BuyerEmail
|
||||
{
|
||||
get => GetMetadata<string>("buyerEmail");
|
||||
set => SetMetadata("buyerEmail", value);
|
||||
}
|
||||
[JsonIgnore]
|
||||
public string BuyerCountry {
|
||||
public string BuyerCountry
|
||||
{
|
||||
get => GetMetadata<string>("buyerCountry");
|
||||
set => SetMetadata("buyerCountry", value);
|
||||
}
|
||||
[JsonIgnore]
|
||||
public string BuyerZip {
|
||||
public string BuyerZip
|
||||
{
|
||||
get => GetMetadata<string>("buyerZip");
|
||||
set => SetMetadata("buyerZip", value);
|
||||
}
|
||||
[JsonIgnore]
|
||||
public string BuyerState{
|
||||
public string BuyerState
|
||||
{
|
||||
get => GetMetadata<string>("buyerState");
|
||||
set => SetMetadata("buyerState", value);
|
||||
}
|
||||
[JsonIgnore]
|
||||
public string BuyerCity {
|
||||
public string BuyerCity
|
||||
{
|
||||
get => GetMetadata<string>("buyerCity");
|
||||
set => SetMetadata("buyerCity", value);
|
||||
}
|
||||
[JsonIgnore]
|
||||
public string BuyerAddress2{
|
||||
public string BuyerAddress2
|
||||
{
|
||||
get => GetMetadata<string>("buyerAddress2");
|
||||
set => SetMetadata("buyerAddress2", value);
|
||||
}
|
||||
[JsonIgnore]
|
||||
public string BuyerAddress1 {
|
||||
public string BuyerAddress1
|
||||
{
|
||||
get => GetMetadata<string>("buyerAddress1");
|
||||
set => SetMetadata("buyerAddress1", value);
|
||||
}
|
||||
[JsonIgnore]
|
||||
public string BuyerPhone {
|
||||
public string BuyerPhone
|
||||
{
|
||||
get => GetMetadata<string>("buyerPhone");
|
||||
set => SetMetadata("buyerPhone", value);
|
||||
}
|
||||
[JsonIgnore]
|
||||
public string ItemDesc {
|
||||
public string ItemDesc
|
||||
{
|
||||
get => GetMetadata<string>("itemDesc");
|
||||
set => SetMetadata("itemDesc", value);
|
||||
}
|
||||
[JsonIgnore]
|
||||
public string ItemCode{
|
||||
public string ItemCode
|
||||
{
|
||||
get => GetMetadata<string>("itemCode");
|
||||
set => SetMetadata("itemCode", value);
|
||||
}
|
||||
[JsonIgnore]
|
||||
public bool? Physical {
|
||||
public bool? Physical
|
||||
{
|
||||
get => GetMetadata<bool?>("physical");
|
||||
set => SetMetadata("physical", value);
|
||||
}
|
||||
[JsonIgnore]
|
||||
public decimal? TaxIncluded {
|
||||
public decimal? TaxIncluded
|
||||
{
|
||||
get => GetMetadata<decimal?>("taxIncluded");
|
||||
set => SetMetadata("taxIncluded", value);
|
||||
}
|
||||
@@ -134,7 +147,8 @@ namespace BTCPayServer.Services.Invoices
|
||||
|
||||
public T GetMetadata<T>(string propName)
|
||||
{
|
||||
if (AdditionalData == null || !(AdditionalData.TryGetValue(propName, out var jt) is true)) return default;
|
||||
if (AdditionalData == null || !(AdditionalData.TryGetValue(propName, out var jt) is true))
|
||||
return default;
|
||||
if (jt.Type == JTokenType.Null)
|
||||
return default;
|
||||
if (typeof(T) == typeof(string))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Net;
|
||||
using Newtonsoft.Json;
|
||||
using MailKit.Net.Smtp;
|
||||
using MimeKit;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
using System.Net.Security;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MailKit.Net.Smtp;
|
||||
using MimeKit;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace BTCPayServer.Services.Mails
|
||||
{
|
||||
|
||||
@@ -32,7 +32,8 @@ namespace BTCPayServer.Services.Mails
|
||||
return emailSettings;
|
||||
}
|
||||
|
||||
if (FallbackSender != null) return await FallbackSender?.GetEmailSettings();
|
||||
if (FallbackSender != null)
|
||||
return await FallbackSender?.GetEmailSettings();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,10 @@ namespace BTCPayServer.Services.Notifications
|
||||
{
|
||||
var resp = await GetNotifications(new NotificationsQuery()
|
||||
{
|
||||
Seen = false, Skip = 0, Take = 5, UserId = userId
|
||||
Seen = false,
|
||||
Skip = 0,
|
||||
Take = 5,
|
||||
UserId = userId
|
||||
});
|
||||
entry.SetAbsoluteExpiration(TimeSpan.FromMilliseconds(_cacheExpiryMs));
|
||||
var res = new NotificationSummaryViewModel() { Last5 = resp.Items, UnseenCount = resp.Count };
|
||||
|
||||
@@ -3,11 +3,11 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using BTCPayServer.Data;
|
||||
using BTCPayServer.Services.Stores;
|
||||
using BTCPayServer.Storage.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using BTCPayServer.Data;
|
||||
using BTCPayServer.Storage.Services;
|
||||
using BTCPayServer.Services.Stores;
|
||||
|
||||
namespace BTCPayServer.Services
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user