mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-20 13:34:37 +01:00
LNURL controller refactoring
By moving the `amount is null` check up, this prevents cases in which the `paymentMethodDetails.GeneratedBoltAmount != amount` check fails because of amount being null.
This commit is contained in:
parent
8c8a5a4f5e
commit
de24a6e71b
1 changed files with 16 additions and 16 deletions
|
@ -524,8 +524,21 @@ namespace BTCPayServer
|
|||
Url = _linkGenerator.GetUriByAction(HttpContext, "InvoiceReceipt", "UIInvoice", new { invoiceId})
|
||||
};
|
||||
}
|
||||
if (amount.HasValue && string.IsNullOrEmpty(paymentMethodDetails.BOLT11) ||
|
||||
paymentMethodDetails.GeneratedBoltAmount != amount)
|
||||
|
||||
if (amount is null)
|
||||
{
|
||||
return Ok(new LNURLPayRequest
|
||||
{
|
||||
Tag = "payRequest",
|
||||
MinSendable = min,
|
||||
MaxSendable = max,
|
||||
CommentAllowed = lnurlSupportedPaymentMethod.LUD12Enabled ? 2000 : 0,
|
||||
Metadata = metadata,
|
||||
Callback = new Uri(Request.GetCurrentUrl())
|
||||
});
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(paymentMethodDetails.BOLT11) || paymentMethodDetails.GeneratedBoltAmount != amount)
|
||||
{
|
||||
var client =
|
||||
_lightningLikePaymentHandler.CreateLightningClient(
|
||||
|
@ -589,7 +602,7 @@ namespace BTCPayServer
|
|||
});
|
||||
}
|
||||
|
||||
if (amount.HasValue && paymentMethodDetails.GeneratedBoltAmount == amount)
|
||||
if (paymentMethodDetails.GeneratedBoltAmount == amount)
|
||||
{
|
||||
if (lnurlSupportedPaymentMethod.LUD12Enabled && paymentMethodDetails.ProvidedComment != comment)
|
||||
{
|
||||
|
@ -604,19 +617,6 @@ namespace BTCPayServer
|
|||
SuccessAction = successAction
|
||||
});
|
||||
}
|
||||
|
||||
if (amount is null)
|
||||
{
|
||||
return Ok(new LNURLPayRequest
|
||||
{
|
||||
Tag = "payRequest",
|
||||
MinSendable = min,
|
||||
MaxSendable = max,
|
||||
CommentAllowed = lnurlSupportedPaymentMethod.LUD12Enabled ? 2000 : 0,
|
||||
Metadata = metadata,
|
||||
Callback = new Uri(Request.GetCurrentUrl())
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return BadRequest(new LNUrlStatusResponse
|
||||
|
|
Loading…
Add table
Reference in a new issue