mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 14:04:26 +01:00
Code formatting updates (#4502)
* Editorconfig: Add space_before_self_closing setting This was a difference between the way dotnet-format and Rider format code. See https://www.jetbrains.com/help/rider/EditorConfig_Index.html * Editorconfig: Keep 4 spaces indentation for Swagger JSON files They are all formatted that way, let's keep it like that. * Apply dotnet-format, mostly white-space related changes
This commit is contained in:
@@ -37,26 +37,26 @@ namespace BTCPayServer.Controllers
|
||||
var cryptoCode = isSats ? "BTC" : request.CryptoCode;
|
||||
var amount = new Money(request.Amount, isSats ? MoneyUnit.Satoshi : MoneyUnit.BTC);
|
||||
var network = _NetworkProvider.GetNetwork<BTCPayNetwork>(cryptoCode).NBitcoinNetwork;
|
||||
var paymentMethodId = new [] {store.GetDefaultPaymentId()}
|
||||
var paymentMethodId = new[] { store.GetDefaultPaymentId() }
|
||||
.Concat(store.GetEnabledPaymentIds(_NetworkProvider))
|
||||
.FirstOrDefault(p => p?.ToString() == request.PaymentMethodId);
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
var paymentMethod = invoice.GetPaymentMethod(paymentMethodId);
|
||||
var destination = paymentMethod?.GetPaymentMethodDetails().GetPaymentDestination();
|
||||
|
||||
|
||||
switch (paymentMethod?.GetId().PaymentType)
|
||||
{
|
||||
case BitcoinPaymentType:
|
||||
var address = BitcoinAddress.Create(destination, network);
|
||||
var txid = (await cheater.CashCow.SendToAddressAsync(address, amount)).ToString();
|
||||
|
||||
|
||||
return Ok(new
|
||||
{
|
||||
Txid = txid,
|
||||
AmountRemaining = (paymentMethod.Calculate().Due - amount).ToUnit(MoneyUnit.BTC),
|
||||
SuccessMessage = $"Created transaction {txid}"
|
||||
SuccessMessage = $"Created transaction {txid}"
|
||||
});
|
||||
|
||||
case LightningPaymentType:
|
||||
@@ -75,7 +75,7 @@ namespace BTCPayServer.Controllers
|
||||
{
|
||||
Txid = paymentHash,
|
||||
AmountRemaining = (paymentMethod.Calculate().TotalDue - paid).ToUnit(MoneyUnit.BTC),
|
||||
SuccessMessage = $"Sent payment {paymentHash}"
|
||||
SuccessMessage = $"Sent payment {paymentHash}"
|
||||
});
|
||||
}
|
||||
return UnprocessableEntity(new
|
||||
@@ -91,7 +91,7 @@ namespace BTCPayServer.Controllers
|
||||
AmountRemaining = invoice.Price
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user