mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 14:34:23 +01:00
fix permissions
This commit is contained in:
@@ -102,7 +102,7 @@ namespace BTCPayServer.Tests
|
|||||||
var publicApps = user.GetController<AppsPublicController>();
|
var publicApps = user.GetController<AppsPublicController>();
|
||||||
|
|
||||||
|
|
||||||
Assert.IsType<NotFoundResult>(await anonAppPubsController.ContributeToCrowdfund(appId, new ContributeToCrowdfund()
|
Assert.IsType<NotFoundObjectResult>(await anonAppPubsController.ContributeToCrowdfund(appId, new ContributeToCrowdfund()
|
||||||
{
|
{
|
||||||
Amount = new decimal(0.01)
|
Amount = new decimal(0.01)
|
||||||
}));
|
}));
|
||||||
@@ -110,7 +110,7 @@ namespace BTCPayServer.Tests
|
|||||||
Assert.IsType<NotFoundResult>(await anonAppPubsController.ViewCrowdfund(appId, string.Empty));
|
Assert.IsType<NotFoundResult>(await anonAppPubsController.ViewCrowdfund(appId, string.Empty));
|
||||||
|
|
||||||
//Scenario 2: Not Enabled But Admin - Allowed
|
//Scenario 2: Not Enabled But Admin - Allowed
|
||||||
Assert.IsType<OkObjectResult>(await anonAppPubsController.ContributeToCrowdfund(appId, new ContributeToCrowdfund()
|
Assert.IsType<OkObjectResult>(await publicApps.ContributeToCrowdfund(appId, new ContributeToCrowdfund()
|
||||||
{
|
{
|
||||||
RedirectToCheckout = false,
|
RedirectToCheckout = false,
|
||||||
Amount = new decimal(0.01)
|
Amount = new decimal(0.01)
|
||||||
|
|||||||
@@ -144,15 +144,15 @@ namespace BTCPayServer.Controllers
|
|||||||
var choices = _AppsHelper.Parse(settings.PerksTemplate, settings.TargetCurrency);
|
var choices = _AppsHelper.Parse(settings.PerksTemplate, settings.TargetCurrency);
|
||||||
var choice = choices.FirstOrDefault(c => c.Id == request.ChoiceKey);
|
var choice = choices.FirstOrDefault(c => c.Id == request.ChoiceKey);
|
||||||
if (choice == null)
|
if (choice == null)
|
||||||
return NotFound();
|
return NotFound("Incorrect option provided");
|
||||||
title = choice.Title;
|
title = choice.Title;
|
||||||
price = choice.Price.Value;
|
price = choice.Price.Value;
|
||||||
if (request.Amount > price)
|
if (request.Amount > price)
|
||||||
price = request.Amount;
|
price = request.Amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings.EnforceTargetAmount && info.TargetAmount.HasValue && price >
|
if (isAdmin || (settings.EnforceTargetAmount && info.TargetAmount.HasValue && price >
|
||||||
(info.TargetAmount - (info.Info.CurrentAmount + info.Info.CurrentPendingAmount)))
|
(info.TargetAmount - (info.Info.CurrentAmount + info.Info.CurrentPendingAmount))))
|
||||||
{
|
{
|
||||||
return NotFound("Contribution Amount is more than is currently allowed.");
|
return NotFound("Contribution Amount is more than is currently allowed.");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user