mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 05:54:26 +01:00
Dotnet reformat
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using System.Net.Http.Headers;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace BTCPayServer.Client.Models;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using BTCPayServer.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
|
||||
@@ -302,7 +302,8 @@ namespace BTCPayServer.Tests
|
||||
{
|
||||
await client.GetApp("some random ID lol");
|
||||
});
|
||||
await AssertHttpError(404, async () => {
|
||||
await AssertHttpError(404, async () =>
|
||||
{
|
||||
await client.GetPosApp("some random ID lol");
|
||||
});
|
||||
|
||||
@@ -462,10 +463,12 @@ namespace BTCPayServer.Tests
|
||||
Assert.Equal("Crowdfund", app.AppType);
|
||||
|
||||
// Make sure we return a 404 if we try to get an app that doesn't exist
|
||||
await AssertHttpError(404, async () => {
|
||||
await AssertHttpError(404, async () =>
|
||||
{
|
||||
await client.GetApp("some random ID lol");
|
||||
});
|
||||
await AssertHttpError(404, async () => {
|
||||
await AssertHttpError(404, async () =>
|
||||
{
|
||||
await client.GetCrowdfundApp("some random ID lol");
|
||||
});
|
||||
|
||||
@@ -488,7 +491,8 @@ namespace BTCPayServer.Tests
|
||||
|
||||
// Test deleting the newly created app
|
||||
await client.DeleteApp(retrievedApp.Id);
|
||||
await AssertHttpError(404, async () => {
|
||||
await AssertHttpError(404, async () =>
|
||||
{
|
||||
await client.GetApp(retrievedApp.Id);
|
||||
});
|
||||
}
|
||||
@@ -1256,7 +1260,10 @@ namespace BTCPayServer.Tests
|
||||
//update store
|
||||
Assert.Empty(newStore.PaymentMethodCriteria);
|
||||
await client.GenerateOnChainWallet(newStore.Id, "BTC", new GenerateOnChainWalletRequest());
|
||||
var updatedStore = await client.UpdateStore(newStore.Id, new UpdateStoreRequest() { Name = "B", PaymentMethodCriteria = new List<PaymentMethodCriteriaData>()
|
||||
var updatedStore = await client.UpdateStore(newStore.Id, new UpdateStoreRequest()
|
||||
{
|
||||
Name = "B",
|
||||
PaymentMethodCriteria = new List<PaymentMethodCriteriaData>()
|
||||
{
|
||||
new()
|
||||
{
|
||||
@@ -1265,7 +1272,8 @@ namespace BTCPayServer.Tests
|
||||
PaymentMethod = "BTC",
|
||||
CurrencyCode = "USD"
|
||||
}
|
||||
}});
|
||||
}
|
||||
});
|
||||
Assert.Equal("B", updatedStore.Name);
|
||||
var s = (await client.GetStore(newStore.Id));
|
||||
Assert.Equal("B", s.Name);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace BTCPayServer
|
||||
{
|
||||
|
||||
@@ -11,8 +11,8 @@ using BTCPayServer.Security;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Cors;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using StoreData = BTCPayServer.Data.StoreData;
|
||||
using PayoutProcessorData = BTCPayServer.Client.Models.PayoutProcessorData;
|
||||
using StoreData = BTCPayServer.Data.StoreData;
|
||||
|
||||
namespace BTCPayServer.Controllers.Greenfield
|
||||
{
|
||||
|
||||
@@ -264,7 +264,8 @@ namespace BTCPayServer.Controllers.Greenfield
|
||||
pullPaymentId = pullPaymentId
|
||||
}, Request.Scheme, Request.Host.ToString())!);
|
||||
|
||||
return base.Ok(new PullPaymentLNURL() {
|
||||
return base.Ok(new PullPaymentLNURL()
|
||||
{
|
||||
LNURLBech32 = LNURL.LNURL.EncodeUri(lnurlEndpoint, "withdrawRequest", true).ToString(),
|
||||
LNURLUri = LNURL.LNURL.EncodeUri(lnurlEndpoint, "withdrawRequest", false).ToString()
|
||||
});
|
||||
|
||||
@@ -33,7 +33,10 @@ namespace BTCPayServer.Controllers.Greenfield
|
||||
return new LightningAddressData();
|
||||
return new LightningAddressData()
|
||||
{
|
||||
Username = data.Username, Max = blob.Max, Min = blob.Min, CurrencyCode = blob.CurrencyCode
|
||||
Username = data.Username,
|
||||
Max = blob.Max,
|
||||
Min = blob.Min,
|
||||
CurrencyCode = blob.CurrencyCode
|
||||
};
|
||||
}
|
||||
|
||||
@@ -64,7 +67,8 @@ namespace BTCPayServer.Controllers.Greenfield
|
||||
{
|
||||
var res = await _lightningAddressService.Get(new LightningAddressQuery()
|
||||
{
|
||||
Usernames = new[] {username}, StoreIds = new[] {storeId},
|
||||
Usernames = new[] { username },
|
||||
StoreIds = new[] { storeId },
|
||||
});
|
||||
return res?.Any() is true ? Ok(ToModel(res.First())) : this.CreateAPIError(404, "lightning-address-not-found", "The lightning address was not present.");
|
||||
}
|
||||
|
||||
@@ -249,7 +249,8 @@ namespace BTCPayServer.Controllers.Greenfield
|
||||
if (string.IsNullOrEmpty(pmc.CurrencyCode))
|
||||
{
|
||||
request.AddModelError(data => data.PaymentMethodCriteria[index].CurrencyCode, "CurrencyCode is required", this);
|
||||
}else if (CurrencyNameTable.Instance.GetCurrencyData(pmc.CurrencyCode, false) is null)
|
||||
}
|
||||
else if (CurrencyNameTable.Instance.GetCurrencyData(pmc.CurrencyCode, false) is null)
|
||||
{
|
||||
request.AddModelError(data => data.PaymentMethodCriteria[index].CurrencyCode, "CurrencyCode is invalid", this);
|
||||
}
|
||||
|
||||
@@ -30,11 +30,11 @@ using LightningAddressData = BTCPayServer.Client.Models.LightningAddressData;
|
||||
using NotificationData = BTCPayServer.Client.Models.NotificationData;
|
||||
using PaymentRequestData = BTCPayServer.Client.Models.PaymentRequestData;
|
||||
using PayoutData = BTCPayServer.Client.Models.PayoutData;
|
||||
using PayoutProcessorData = BTCPayServer.Client.Models.PayoutProcessorData;
|
||||
using PullPaymentData = BTCPayServer.Client.Models.PullPaymentData;
|
||||
using StoreData = BTCPayServer.Client.Models.StoreData;
|
||||
using StoreWebhookData = BTCPayServer.Client.Models.StoreWebhookData;
|
||||
using WebhookDeliveryData = BTCPayServer.Client.Models.WebhookDeliveryData;
|
||||
using PayoutProcessorData = BTCPayServer.Client.Models.PayoutProcessorData;
|
||||
|
||||
namespace BTCPayServer.Controllers.Greenfield
|
||||
{
|
||||
|
||||
@@ -466,7 +466,7 @@ namespace BTCPayServer
|
||||
lnurlRequest ??= new LNURLPayRequest();
|
||||
lnUrlMetadata ??= new Dictionary<string, string>();
|
||||
|
||||
if (lnUrlMetadata?.TryGetValue("text/identifier", out var lnAddress) is true && lnAddress is string)
|
||||
if (lnUrlMetadata?.TryGetValue("text/identifier", out var lnAddress) is true && lnAddress is not null)
|
||||
{
|
||||
var pm = i.GetPaymentMethod(pmi);
|
||||
var paymentMethodDetails = (LNURLPayPaymentMethodDetails)pm.GetPaymentMethodDetails();
|
||||
|
||||
@@ -448,7 +448,8 @@ namespace BTCPayServer.Controllers
|
||||
WalletTransactionInfo ix = null;
|
||||
foreach (var key in keys)
|
||||
{
|
||||
if (!labelInfo.TryGetValue(key, out var i)) continue;
|
||||
if (!labelInfo.TryGetValue(key, out var i))
|
||||
continue;
|
||||
if (ix is null)
|
||||
{
|
||||
ix = i;
|
||||
@@ -458,7 +459,8 @@ namespace BTCPayServer.Controllers
|
||||
ix.Merge(i);
|
||||
}
|
||||
}
|
||||
if (ix is null) continue;
|
||||
if (ix is null)
|
||||
continue;
|
||||
|
||||
var labels = _labelService.CreateTransactionTagModels(ix, Request);
|
||||
var input = vm.Inputs.First(model => model.Index == inputToObject.Key);
|
||||
@@ -466,7 +468,8 @@ namespace BTCPayServer.Controllers
|
||||
}
|
||||
foreach (var outputToObject in outputToObjects)
|
||||
{
|
||||
if (!labelInfo.TryGetValue(outputToObject.Value.Id, out var ix)) continue;
|
||||
if (!labelInfo.TryGetValue(outputToObject.Value.Id, out var ix))
|
||||
continue;
|
||||
var labels = _labelService.CreateTransactionTagModels(ix, Request);
|
||||
var destination = vm.Destinations.First(model => model.Destination == outputToObject.Key);
|
||||
destination.Labels = labels;
|
||||
|
||||
@@ -211,7 +211,9 @@ public class BitcoinLikePayoutHandler : IPayoutHandler
|
||||
{
|
||||
var payouts = (await PullPaymentHostedService.GetPayouts(new PullPaymentHostedService.PayoutQuery()
|
||||
{
|
||||
States = new[] {PayoutState.AwaitingPayment}, Stores = new[] {storeId}, PayoutIds = payoutIds
|
||||
States = new[] { PayoutState.AwaitingPayment },
|
||||
Stores = new[] { storeId },
|
||||
PayoutIds = payoutIds
|
||||
}, context)).Where(data =>
|
||||
PaymentMethodId.TryParse(data.PaymentMethodId, out var paymentMethodId) &&
|
||||
CanHandle(paymentMethodId))
|
||||
@@ -234,7 +236,9 @@ public class BitcoinLikePayoutHandler : IPayoutHandler
|
||||
{
|
||||
var payouts = (await PullPaymentHostedService.GetPayouts(new PullPaymentHostedService.PayoutQuery()
|
||||
{
|
||||
States = new[] {PayoutState.AwaitingPayment}, Stores = new[] {storeId}, PayoutIds = payoutIds
|
||||
States = new[] { PayoutState.AwaitingPayment },
|
||||
Stores = new[] { storeId },
|
||||
PayoutIds = payoutIds
|
||||
}, context)).Where(data =>
|
||||
PaymentMethodId.TryParse(data.PaymentMethodId, out var paymentMethodId) &&
|
||||
CanHandle(paymentMethodId))
|
||||
|
||||
@@ -87,9 +87,12 @@ namespace BTCPayServer
|
||||
var match = derivationRegex.Match(xpub.Trim());
|
||||
if (match.Success)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(match.Groups[1].Value)) rootFingerprint = HDFingerprint.Parse(match.Groups[1].Value);
|
||||
if (!string.IsNullOrEmpty(match.Groups[2].Value)) accountKeyPath = KeyPath.Parse(match.Groups[2].Value);
|
||||
if (!string.IsNullOrEmpty(match.Groups[3].Value)) xpub = match.Groups[3].Value;
|
||||
if (!string.IsNullOrEmpty(match.Groups[1].Value))
|
||||
rootFingerprint = HDFingerprint.Parse(match.Groups[1].Value);
|
||||
if (!string.IsNullOrEmpty(match.Groups[2].Value))
|
||||
accountKeyPath = KeyPath.Parse(match.Groups[2].Value);
|
||||
if (!string.IsNullOrEmpty(match.Groups[3].Value))
|
||||
xpub = match.Groups[3].Value;
|
||||
}
|
||||
derivationSchemeSettings.AccountOriginal = xpub.Trim();
|
||||
derivationSchemeSettings.AccountDerivation = electrum ? derivationSchemeParser.ParseElectrum(derivationSchemeSettings.AccountOriginal) : derivationSchemeParser.Parse(derivationSchemeSettings.AccountOriginal);
|
||||
|
||||
@@ -39,7 +39,8 @@ namespace BTCPayServer.Filters
|
||||
if (matchedDomainMapping != null && req.Method != "POST" && !req.HasFormContentType)
|
||||
{
|
||||
var uri = new UriBuilder(req.Scheme, matchedDomainMapping.Domain);
|
||||
if (req.Host.Port.HasValue) uri.Port = req.Host.Port.Value;
|
||||
if (req.Host.Port.HasValue)
|
||||
uri.Port = req.Host.Port.Value;
|
||||
context.RouteContext.HttpContext.Response.Redirect(uri.ToString());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,8 @@ public class UIFormsController : Controller
|
||||
public async Task<IActionResult> Modify(string storeId, string id)
|
||||
{
|
||||
var form = await _formDataService.GetForm(storeId, id);
|
||||
if (form is null) return NotFound();
|
||||
if (form is null)
|
||||
return NotFound();
|
||||
|
||||
var config = Form.Parse(form.Config);
|
||||
return View(new ModifyForm { Name = form.Name, FormConfig = config.ToString(), Public = form.Public });
|
||||
@@ -95,7 +96,11 @@ public class UIFormsController : Controller
|
||||
{
|
||||
var formData = new FormData
|
||||
{
|
||||
Id = id, StoreId = storeId, Name = modifyForm.Name, Config = modifyForm.FormConfig,Public = modifyForm.Public
|
||||
Id = id,
|
||||
StoreId = storeId,
|
||||
Name = modifyForm.Name,
|
||||
Config = modifyForm.FormConfig,
|
||||
Public = modifyForm.Public
|
||||
};
|
||||
var isNew = id is null;
|
||||
await _formDataService.AddOrUpdateForm(formData);
|
||||
@@ -123,7 +128,8 @@ public class UIFormsController : Controller
|
||||
await _formDataService.RemoveForm(id, storeId);
|
||||
TempData.SetStatusMessageModel(new StatusMessageModel
|
||||
{
|
||||
Severity = StatusMessageModel.StatusSeverity.Success, Message = "Form removed"
|
||||
Severity = StatusMessageModel.StatusSeverity.Success,
|
||||
Message = "Form removed"
|
||||
});
|
||||
return RedirectToAction("FormsList", new { storeId });
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Configuration.Provider;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
@@ -26,6 +27,8 @@ using BTCPayServer.Payments.Lightning;
|
||||
using BTCPayServer.Payments.PayJoin;
|
||||
using BTCPayServer.PayoutProcessors;
|
||||
using BTCPayServer.Plugins;
|
||||
using BTCPayServer.Rating;
|
||||
using BTCPayServer.Rating.Providers;
|
||||
using BTCPayServer.Security;
|
||||
using BTCPayServer.Security.Bitpay;
|
||||
using BTCPayServer.Security.Greenfield;
|
||||
@@ -42,6 +45,7 @@ using BTCPayServer.Services.PaymentRequests;
|
||||
using BTCPayServer.Services.Rates;
|
||||
using BTCPayServer.Services.Stores;
|
||||
using BTCPayServer.Services.Wallets;
|
||||
using ExchangeSharp;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -61,10 +65,6 @@ using NBXplorer.DerivationStrategy;
|
||||
using Newtonsoft.Json;
|
||||
using NicolasDorier.RateLimits;
|
||||
using Serilog;
|
||||
using ExchangeSharp;
|
||||
using BTCPayServer.Rating;
|
||||
using System.Configuration.Provider;
|
||||
using BTCPayServer.Rating.Providers;
|
||||
#if ALTCOINS
|
||||
using BTCPayServer.Services.Altcoins.Monero;
|
||||
using BTCPayServer.Services.Altcoins.Zcash;
|
||||
|
||||
@@ -349,7 +349,8 @@ namespace BTCPayServer.Plugins.PointOfSale.Controllers
|
||||
}
|
||||
entity.Metadata.SetAdditionalData("receiptData", receiptData);
|
||||
|
||||
if (formResponseJObject is null) return;
|
||||
if (formResponseJObject is null)
|
||||
return;
|
||||
var meta = entity.Metadata.ToJObject();
|
||||
meta.Merge(formResponseJObject);
|
||||
entity.Metadata = InvoiceMetadata.FromJObject(meta);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace BTCPayServer
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Threading;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BTCPayServer.Abstractions.Contracts;
|
||||
using BTCPayServer.Plugins.Test.Services;
|
||||
|
||||
Reference in New Issue
Block a user