mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 14:34:23 +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:
@@ -524,8 +524,21 @@ namespace BTCPayServer
|
|||||||
Url = _linkGenerator.GetUriByAction(HttpContext, "InvoiceReceipt", "UIInvoice", new { invoiceId})
|
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 =
|
var client =
|
||||||
_lightningLikePaymentHandler.CreateLightningClient(
|
_lightningLikePaymentHandler.CreateLightningClient(
|
||||||
@@ -589,7 +602,7 @@ namespace BTCPayServer
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (amount.HasValue && paymentMethodDetails.GeneratedBoltAmount == amount)
|
if (paymentMethodDetails.GeneratedBoltAmount == amount)
|
||||||
{
|
{
|
||||||
if (lnurlSupportedPaymentMethod.LUD12Enabled && paymentMethodDetails.ProvidedComment != comment)
|
if (lnurlSupportedPaymentMethod.LUD12Enabled && paymentMethodDetails.ProvidedComment != comment)
|
||||||
{
|
{
|
||||||
@@ -604,19 +617,6 @@ namespace BTCPayServer
|
|||||||
SuccessAction = successAction
|
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
|
return BadRequest(new LNUrlStatusResponse
|
||||||
|
|||||||
Reference in New Issue
Block a user