Do not allow 0 amount invocies for crowdfund and payment requests

This commit is contained in:
Kukks 2020-03-16 09:06:40 +01:00 committed by rockstardev
parent 36bd76248b
commit ca00caa4a4
2 changed files with 8 additions and 0 deletions

View File

@ -237,6 +237,10 @@ namespace BTCPayServer.Controllers
[EnableCors(CorsPolicies.All)]
public async Task<IActionResult> ContributeToCrowdfund(string appId, ContributeToCrowdfund request, CancellationToken cancellationToken)
{
if (request.Amount <= 0)
{
return NotFound("Please provide an amount greater than 0");
}
var app = await _AppService.GetApp(appId, AppType.Crowdfund, true);
if (app == null)

View File

@ -225,6 +225,10 @@ namespace BTCPayServer.Controllers
public async Task<IActionResult> PayPaymentRequest(string id, bool redirectToInvoice = true,
decimal? amount = null, CancellationToken cancellationToken = default)
{
if (amount.HasValue && amount.Value <= 0)
{
return BadRequest("Please provide an amount greater than 0");
}
var result = await _PaymentRequestService.GetPaymentRequest(id, GetUserId());
if (result == null)
{