mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 14:34:23 +01:00
Require non interactivity for boltcard payments (#6289)
This commit is contained in:
@@ -65,6 +65,6 @@ public class UIBoltcardController : Controller
|
|||||||
if (!cardKey.CheckSunMac(c, piccData))
|
if (!cardKey.CheckSunMac(c, piccData))
|
||||||
return BadRequest(new LNUrlStatusResponse { Status = "ERROR", Reason = "Replayed or expired query" });
|
return BadRequest(new LNUrlStatusResponse { Status = "ERROR", Reason = "Replayed or expired query" });
|
||||||
LNURLController.ControllerContext.HttpContext = HttpContext;
|
LNURLController.ControllerContext.HttpContext = HttpContext;
|
||||||
return await LNURLController.GetLNURLForPullPayment("BTC", registration.PullPaymentId, pr, $"{p}-{c}", cancellationToken);
|
return await LNURLController.GetLNURLForPullPayment("BTC", registration.PullPaymentId, pr, $"{p}-{c}", true, cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,11 +102,11 @@ namespace BTCPayServer
|
|||||||
[HttpGet("withdraw/pp/{pullPaymentId}")]
|
[HttpGet("withdraw/pp/{pullPaymentId}")]
|
||||||
public Task<IActionResult> GetLNURLForPullPayment(string cryptoCode, string pullPaymentId, [FromQuery] string pr, CancellationToken cancellationToken)
|
public Task<IActionResult> GetLNURLForPullPayment(string cryptoCode, string pullPaymentId, [FromQuery] string pr, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return GetLNURLForPullPayment(cryptoCode, pullPaymentId, pr, pullPaymentId, cancellationToken);
|
return GetLNURLForPullPayment(cryptoCode, pullPaymentId, pr, pullPaymentId, false, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
[NonAction]
|
[NonAction]
|
||||||
internal async Task<IActionResult> GetLNURLForPullPayment(string cryptoCode, string pullPaymentId, string pr, string k1, CancellationToken cancellationToken)
|
internal async Task<IActionResult> GetLNURLForPullPayment(string cryptoCode, string pullPaymentId, string pr, string k1, bool nonInteractiveOnly, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var network = GetNetwork(cryptoCode);
|
var network = GetNetwork(cryptoCode);
|
||||||
if (network is null || !network.SupportLightning)
|
if (network is null || !network.SupportLightning)
|
||||||
@@ -175,8 +175,18 @@ namespace BTCPayServer
|
|||||||
});
|
});
|
||||||
var processorBlob = processors.FirstOrDefault()?.HasTypedBlob<LightningAutomatedPayoutBlob>().GetBlob();
|
var processorBlob = processors.FirstOrDefault()?.HasTypedBlob<LightningAutomatedPayoutBlob>().GetBlob();
|
||||||
var instantProcessing = processorBlob?.ProcessNewPayoutsInstantly is true;
|
var instantProcessing = processorBlob?.ProcessNewPayoutsInstantly is true;
|
||||||
|
if (nonInteractiveOnly && !instantProcessing)
|
||||||
|
{
|
||||||
|
return BadRequest(new LNUrlStatusResponse { Status = "ERROR", Reason = "Payment cancelled: The payer must activate the lightning automated payment process and must check \"Process approved payouts instantly\"." });
|
||||||
|
}
|
||||||
|
|
||||||
var interval = processorBlob?.Interval.TotalMinutes;
|
var interval = processorBlob?.Interval.TotalMinutes;
|
||||||
var autoApprove = pp.GetBlob().AutoApproveClaims;
|
var autoApprove = pp.GetBlob().AutoApproveClaims;
|
||||||
|
if (nonInteractiveOnly && !autoApprove)
|
||||||
|
{
|
||||||
|
return BadRequest(new LNUrlStatusResponse { Status = "ERROR", Reason = "Payment cancelled: The payer must activate \"Automatically approve claims\" in the settings of the pull payment." });
|
||||||
|
}
|
||||||
|
|
||||||
var claimResponse = await _pullPaymentHostedService.Claim(new ClaimRequest
|
var claimResponse = await _pullPaymentHostedService.Claim(new ClaimRequest
|
||||||
{
|
{
|
||||||
Destination = new BoltInvoiceClaimDestination(pr, result),
|
Destination = new BoltInvoiceClaimDestination(pr, result),
|
||||||
|
|||||||
Reference in New Issue
Block a user