LNURL updates (#4501)

This commit is contained in:
d11n
2023-01-05 14:41:18 +01:00
committed by GitHub
parent 099d65032a
commit eb90fab640
5 changed files with 17 additions and 21 deletions

View File

@@ -3,7 +3,6 @@ using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using BTCPayServer.Abstractions.Constants;
@@ -17,7 +16,6 @@ using BTCPayServer.Data.Payouts.LightningLike;
using BTCPayServer.Events;
using BTCPayServer.HostedServices;
using BTCPayServer.Lightning;
using BTCPayServer.Models.AppViewModels;
using BTCPayServer.Payments;
using BTCPayServer.Payments.Lightning;
using BTCPayServer.Plugins.PointOfSale.Models;
@@ -31,7 +29,6 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Routing;
using NBitcoin;
using NBitcoin.Crypto;
using Newtonsoft.Json;
using MarkPayoutRequest = BTCPayServer.HostedServices.MarkPayoutRequest;
@@ -528,7 +525,7 @@ namespace BTCPayServer
if ((i.ReceiptOptions?.Enabled ??blob.ReceiptOptions.Enabled ) is true)
{
successAction =
new LNURLPayRequest.LNURLPayRequestCallbackResponse.LNURLPayRequestSuccessActionUrl()
new LNURLPayRequest.LNURLPayRequestCallbackResponse.LNURLPayRequestSuccessActionUrl
{
Tag = "url",
Description = "Thank you for your purchase. Here is your receipt",
@@ -582,16 +579,17 @@ namespace BTCPayServer
return BadRequest(new LNUrlStatusResponse
{
Status = "ERROR",
Reason = "Lightning node could not generate invoice with a VALID description hash"
Reason = "Lightning node could not generate invoice with a valid description hash"
});
}
}
catch (Exception)
catch (Exception ex)
{
return BadRequest(new LNUrlStatusResponse
{
Status = "ERROR",
Reason = "Lightning node could not generate invoice with description hash"
Reason = "Lightning node could not generate invoice with description hash" + (
string.IsNullOrEmpty(ex.Message) ? "" : $": {ex.Message}")
});
}
@@ -638,8 +636,7 @@ namespace BTCPayServer
Status = "ERROR", Reason = "Invoice not in a valid payable state"
});
}
[Authorize(AuthenticationSchemes = AuthenticationSchemes.Cookie)]
[Authorize(Policy = Policies.CanModifyStoreSettings, AuthenticationSchemes = AuthenticationSchemes.Cookie)]
[HttpGet("~/stores/{storeId}/plugins/lightning-address")]