mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-22 06:21:44 +01:00
feat: provide store info to modify-lnurlp-request
filter (#6312)
adds store data to the filter using a new `StoreLNURLPayRequest` class which simply adds a `Store` member. closes: https://github.com/btcpayserver/btcpayserver/issues/6301
This commit is contained in:
parent
7b6a115adc
commit
b670097592
2 changed files with 20 additions and 5 deletions
|
@ -19,6 +19,7 @@ using BTCPayServer.HostedServices;
|
|||
using BTCPayServer.Lightning;
|
||||
using BTCPayServer.Payments;
|
||||
using BTCPayServer.Payments.Lightning;
|
||||
using BTCPayServer.Payments.LNURLPay;
|
||||
using BTCPayServer.PayoutProcessors;
|
||||
using BTCPayServer.PayoutProcessors.Lightning;
|
||||
using BTCPayServer.Payouts;
|
||||
|
@ -402,7 +403,7 @@ namespace BTCPayServer
|
|||
return NotFound("Unknown username");
|
||||
|
||||
LNURLPayRequest lnurlRequest;
|
||||
|
||||
|
||||
// Check core and fall back to lookup Lightning Address via plugins
|
||||
var lightningAddressSettings = await _lightningAddressService.ResolveByAddress(username);
|
||||
if (lightningAddressSettings is null)
|
||||
|
@ -425,12 +426,13 @@ namespace BTCPayServer
|
|||
return NotFound("LNURL not available for store");
|
||||
|
||||
var blob = lightningAddressSettings.GetBlob();
|
||||
lnurlRequest = new LNURLPayRequest
|
||||
lnurlRequest = new StoreLNURLPayRequest
|
||||
{
|
||||
Tag = "payRequest",
|
||||
MinSendable = blob?.Min is decimal min ? new LightMoney(min, LightMoneyUnit.Satoshi) : null,
|
||||
MaxSendable = blob?.Max is decimal max ? new LightMoney(max, LightMoneyUnit.Satoshi) : null,
|
||||
CommentAllowed = lnUrlMethod.LUD12Enabled ? 2000 : 0
|
||||
CommentAllowed = lnUrlMethod.LUD12Enabled ? 2000 : 0,
|
||||
Store = store
|
||||
};
|
||||
|
||||
var lnUrlMetadata = new Dictionary<string, string>
|
||||
|
@ -473,10 +475,11 @@ namespace BTCPayServer
|
|||
Currency = blob?.CurrencyCode,
|
||||
Metadata = blob?.InvoiceMetadata
|
||||
},
|
||||
new LNURLPayRequest
|
||||
new StoreLNURLPayRequest
|
||||
{
|
||||
MinSendable = blob?.Min is decimal min ? new LightMoney(min, LightMoneyUnit.Satoshi) : null,
|
||||
MaxSendable = blob?.Max is decimal max ? new LightMoney(max, LightMoneyUnit.Satoshi) : null,
|
||||
Store = store,
|
||||
},
|
||||
new Dictionary<string, string>
|
||||
{
|
||||
|
@ -567,7 +570,7 @@ namespace BTCPayServer
|
|||
var pmi = GetLNUrlPaymentMethodId(cryptoCode, store, out var lnUrlMethod);
|
||||
if (pmi is null)
|
||||
return null;
|
||||
lnurlRequest ??= new LNURLPayRequest();
|
||||
lnurlRequest ??= new StoreLNURLPayRequest{Store = store};
|
||||
lnUrlMetadata ??= new Dictionary<string, string>();
|
||||
|
||||
var pm = i.GetPaymentPrompt(pmi);
|
||||
|
|
12
BTCPayServer/Payments/LNURLPay/StoreLNURLPayRequest.cs
Normal file
12
BTCPayServer/Payments/LNURLPay/StoreLNURLPayRequest.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
#nullable enable
|
||||
using BTCPayServer.Data;
|
||||
using LNURL;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace BTCPayServer.Payments.LNURLPay;
|
||||
|
||||
public class StoreLNURLPayRequest : LNURLPayRequest
|
||||
{
|
||||
[JsonIgnore]
|
||||
public StoreData? Store { get; set; }
|
||||
}
|
Loading…
Add table
Reference in a new issue