mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 14:34:23 +01:00
Normalize greenfield responses for 404s (#3220)
This commit is contained in:
@@ -30,11 +30,12 @@ namespace BTCPayServer.Controllers.GreenField
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("~/api/v1/api-keys/current")]
|
[HttpGet("~/api/v1/api-keys/current")]
|
||||||
public async Task<ActionResult<ApiKeyData>> GetKey()
|
public async Task<IActionResult> GetKey()
|
||||||
{
|
{
|
||||||
if (!ControllerContext.HttpContext.GetAPIKey(out var apiKey))
|
if (!ControllerContext.HttpContext.GetAPIKey(out var apiKey))
|
||||||
{
|
{
|
||||||
return NotFound();
|
return
|
||||||
|
this.CreateAPIError(404, "api-key-not-found", "The api key was not present.");
|
||||||
}
|
}
|
||||||
var data = await _apiKeyRepository.GetKey(apiKey);
|
var data = await _apiKeyRepository.GetKey(apiKey);
|
||||||
return Ok(FromModel(data));
|
return Ok(FromModel(data));
|
||||||
@@ -44,8 +45,7 @@ namespace BTCPayServer.Controllers.GreenField
|
|||||||
[Authorize(Policy = Policies.Unrestricted, AuthenticationSchemes = AuthenticationSchemes.Greenfield)]
|
[Authorize(Policy = Policies.Unrestricted, AuthenticationSchemes = AuthenticationSchemes.Greenfield)]
|
||||||
public async Task<IActionResult> CreateKey(CreateApiKeyRequest request)
|
public async Task<IActionResult> CreateKey(CreateApiKeyRequest request)
|
||||||
{
|
{
|
||||||
if (request is null)
|
request ??= new CreateApiKeyRequest();
|
||||||
return NotFound();
|
|
||||||
request.Permissions ??= System.Array.Empty<Permission>();
|
request.Permissions ??= System.Array.Empty<Permission>();
|
||||||
var key = new APIKeyData()
|
var key = new APIKeyData()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ namespace BTCPayServer.Controllers.GreenField
|
|||||||
private readonly BTCPayNetworkProvider _btcPayNetworkProvider;
|
private readonly BTCPayNetworkProvider _btcPayNetworkProvider;
|
||||||
private readonly ISettingsRepository _settingsRepository;
|
private readonly ISettingsRepository _settingsRepository;
|
||||||
private readonly IAuthorizationService _authorizationService;
|
private readonly IAuthorizationService _authorizationService;
|
||||||
|
|
||||||
protected LightningNodeApiController(BTCPayNetworkProvider btcPayNetworkProvider,
|
protected LightningNodeApiController(BTCPayNetworkProvider btcPayNetworkProvider,
|
||||||
ISettingsRepository settingsRepository,
|
ISettingsRepository settingsRepository,
|
||||||
IAuthorizationService authorizationService)
|
IAuthorizationService authorizationService)
|
||||||
@@ -95,11 +94,6 @@ namespace BTCPayServer.Controllers.GreenField
|
|||||||
public virtual async Task<IActionResult> OpenChannel(string cryptoCode, OpenLightningChannelRequest request)
|
public virtual async Task<IActionResult> OpenChannel(string cryptoCode, OpenLightningChannelRequest request)
|
||||||
{
|
{
|
||||||
var lightningClient = await GetLightningClient(cryptoCode, true);
|
var lightningClient = await GetLightningClient(cryptoCode, true);
|
||||||
if (lightningClient == null)
|
|
||||||
{
|
|
||||||
return NotFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (request?.NodeURI is null)
|
if (request?.NodeURI is null)
|
||||||
{
|
{
|
||||||
ModelState.AddModelError(nameof(request.NodeURI),
|
ModelState.AddModelError(nameof(request.NodeURI),
|
||||||
@@ -166,11 +160,6 @@ namespace BTCPayServer.Controllers.GreenField
|
|||||||
public virtual async Task<IActionResult> GetDepositAddress(string cryptoCode)
|
public virtual async Task<IActionResult> GetDepositAddress(string cryptoCode)
|
||||||
{
|
{
|
||||||
var lightningClient = await GetLightningClient(cryptoCode, true);
|
var lightningClient = await GetLightningClient(cryptoCode, true);
|
||||||
if (lightningClient == null)
|
|
||||||
{
|
|
||||||
return NotFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Ok(new JValue((await lightningClient.GetDepositAddress()).ToString()));
|
return Ok(new JValue((await lightningClient.GetDepositAddress()).ToString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,18 +196,8 @@ namespace BTCPayServer.Controllers.GreenField
|
|||||||
public virtual async Task<IActionResult> GetInvoice(string cryptoCode, string id)
|
public virtual async Task<IActionResult> GetInvoice(string cryptoCode, string id)
|
||||||
{
|
{
|
||||||
var lightningClient = await GetLightningClient(cryptoCode, false);
|
var lightningClient = await GetLightningClient(cryptoCode, false);
|
||||||
|
|
||||||
if (lightningClient == null)
|
|
||||||
{
|
|
||||||
return NotFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
var inv = await lightningClient.GetInvoice(id);
|
var inv = await lightningClient.GetInvoice(id);
|
||||||
if (inv == null)
|
return inv == null ? this.CreateAPIError(404, "invoice-not-found", "Impossible to find a lightning invoice with this id") : Ok(ToModel(inv));
|
||||||
{
|
|
||||||
return this.CreateAPIError(404, "invoice-not-found", "Impossible to find a lightning invoice with this id");
|
|
||||||
}
|
|
||||||
return Ok(ToModel(inv));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual async Task<IActionResult> CreateInvoice(string cryptoCode, CreateLightningInvoiceRequest request)
|
public virtual async Task<IActionResult> CreateInvoice(string cryptoCode, CreateLightningInvoiceRequest request)
|
||||||
|
|||||||
@@ -568,7 +568,7 @@ namespace BTCPayServer.Controllers.GreenField
|
|||||||
public override async Task<PaymentRequestData> GetPaymentRequest(string storeId, string paymentRequestId,
|
public override async Task<PaymentRequestData> GetPaymentRequest(string storeId, string paymentRequestId,
|
||||||
CancellationToken token = default)
|
CancellationToken token = default)
|
||||||
{
|
{
|
||||||
return GetFromActionResult(await _paymentRequestController.GetPaymentRequest(storeId, paymentRequestId));
|
return GetFromActionResult<PaymentRequestData>(await _paymentRequestController.GetPaymentRequest(storeId, paymentRequestId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task ArchivePaymentRequest(string storeId, string paymentRequestId,
|
public override async Task ArchivePaymentRequest(string storeId, string paymentRequestId,
|
||||||
@@ -594,7 +594,7 @@ namespace BTCPayServer.Controllers.GreenField
|
|||||||
|
|
||||||
public override async Task<ApiKeyData> GetCurrentAPIKeyInfo(CancellationToken token = default)
|
public override async Task<ApiKeyData> GetCurrentAPIKeyInfo(CancellationToken token = default)
|
||||||
{
|
{
|
||||||
return GetFromActionResult(await _apiKeysController.GetKey());
|
return GetFromActionResult<ApiKeyData>(await _apiKeysController.GetKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task<ApiKeyData> CreateAPIKey(CreateApiKeyRequest request,
|
public override async Task<ApiKeyData> CreateAPIKey(CreateApiKeyRequest request,
|
||||||
@@ -734,7 +734,7 @@ namespace BTCPayServer.Controllers.GreenField
|
|||||||
|
|
||||||
public override async Task<StoreData> GetStore(string storeId, CancellationToken token = default)
|
public override async Task<StoreData> GetStore(string storeId, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
return GetFromActionResult(await _storesController.GetStore(storeId));
|
return GetFromActionResult<StoreData>(_storesController.GetStore(storeId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task RemoveStore(string storeId, CancellationToken token = default)
|
public override async Task RemoveStore(string storeId, CancellationToken token = default)
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ namespace BTCPayServer.Controllers.GreenField
|
|||||||
|
|
||||||
if (items.Count == 0)
|
if (items.Count == 0)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotificationNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Ok(ToModel(items.Items.First()));
|
return Ok(ToModel(items.Items.First()));
|
||||||
@@ -71,7 +71,7 @@ namespace BTCPayServer.Controllers.GreenField
|
|||||||
|
|
||||||
if (items.Count == 0)
|
if (items.Count == 0)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotificationNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Ok(ToModel(items.First()));
|
return Ok(ToModel(items.First()));
|
||||||
@@ -101,5 +101,9 @@ namespace BTCPayServer.Controllers.GreenField
|
|||||||
Link = string.IsNullOrEmpty(entity.ActionLink) ? null : new Uri(entity.ActionLink)
|
Link = string.IsNullOrEmpty(entity.ActionLink) ? null : new Uri(entity.ActionLink)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
private IActionResult NotificationNotFound()
|
||||||
|
{
|
||||||
|
return this.CreateAPIError(404, "notification-not-found", "The notification was not found");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,14 +42,14 @@ namespace BTCPayServer.Controllers.GreenField
|
|||||||
|
|
||||||
[Authorize(Policy = Policies.CanViewPaymentRequests, AuthenticationSchemes = AuthenticationSchemes.Greenfield)]
|
[Authorize(Policy = Policies.CanViewPaymentRequests, AuthenticationSchemes = AuthenticationSchemes.Greenfield)]
|
||||||
[HttpGet("~/api/v1/stores/{storeId}/payment-requests/{paymentRequestId}")]
|
[HttpGet("~/api/v1/stores/{storeId}/payment-requests/{paymentRequestId}")]
|
||||||
public async Task<ActionResult<Client.Models.PaymentRequestData>> GetPaymentRequest(string storeId, string paymentRequestId)
|
public async Task<IActionResult> GetPaymentRequest(string storeId, string paymentRequestId)
|
||||||
{
|
{
|
||||||
var pr = await _paymentRequestRepository.FindPaymentRequests(
|
var pr = await _paymentRequestRepository.FindPaymentRequests(
|
||||||
new PaymentRequestQuery() { StoreId = storeId, Ids = new[] { paymentRequestId } });
|
new PaymentRequestQuery() { StoreId = storeId, Ids = new[] { paymentRequestId } });
|
||||||
|
|
||||||
if (pr.Total == 0)
|
if (pr.Total == 0)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return PaymentRequestNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Ok(FromModel(pr.Items.First()));
|
return Ok(FromModel(pr.Items.First()));
|
||||||
@@ -58,13 +58,13 @@ namespace BTCPayServer.Controllers.GreenField
|
|||||||
[Authorize(Policy = Policies.CanModifyPaymentRequests,
|
[Authorize(Policy = Policies.CanModifyPaymentRequests,
|
||||||
AuthenticationSchemes = AuthenticationSchemes.Greenfield)]
|
AuthenticationSchemes = AuthenticationSchemes.Greenfield)]
|
||||||
[HttpDelete("~/api/v1/stores/{storeId}/payment-requests/{paymentRequestId}")]
|
[HttpDelete("~/api/v1/stores/{storeId}/payment-requests/{paymentRequestId}")]
|
||||||
public async Task<ActionResult> ArchivePaymentRequest(string storeId, string paymentRequestId)
|
public async Task<IActionResult> ArchivePaymentRequest(string storeId, string paymentRequestId)
|
||||||
{
|
{
|
||||||
var pr = await _paymentRequestRepository.FindPaymentRequests(
|
var pr = await _paymentRequestRepository.FindPaymentRequests(
|
||||||
new PaymentRequestQuery() { StoreId = storeId, Ids = new[] { paymentRequestId }, IncludeArchived = false });
|
new PaymentRequestQuery() { StoreId = storeId, Ids = new[] { paymentRequestId }, IncludeArchived = false });
|
||||||
if (pr.Total == 0)
|
if (pr.Total == 0)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return PaymentRequestNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
var updatedPr = pr.Items.First();
|
var updatedPr = pr.Items.First();
|
||||||
@@ -112,7 +112,7 @@ namespace BTCPayServer.Controllers.GreenField
|
|||||||
new PaymentRequestQuery() { StoreId = storeId, Ids = new[] { paymentRequestId } });
|
new PaymentRequestQuery() { StoreId = storeId, Ids = new[] { paymentRequestId } });
|
||||||
if (pr.Total == 0)
|
if (pr.Total == 0)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return PaymentRequestNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
var updatedPr = pr.Items.First();
|
var updatedPr = pr.Items.First();
|
||||||
@@ -164,5 +164,10 @@ namespace BTCPayServer.Controllers.GreenField
|
|||||||
CustomCSSLink = blob.CustomCSSLink
|
CustomCSSLink = blob.CustomCSSLink
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IActionResult PaymentRequestNotFound()
|
||||||
|
{
|
||||||
|
return this.CreateAPIError(404, "payment-request-not-found", "The payment request was not found");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -227,8 +227,6 @@ namespace BTCPayServer.Controllers.GreenField
|
|||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
public async Task<IActionResult> CreatePayout(string pullPaymentId, CreatePayoutRequest request)
|
public async Task<IActionResult> CreatePayout(string pullPaymentId, CreatePayoutRequest request)
|
||||||
{
|
{
|
||||||
if (request is null)
|
|
||||||
return NotFound();
|
|
||||||
if (!PaymentMethodId.TryParse(request?.PaymentMethod, out var paymentMethodId))
|
if (!PaymentMethodId.TryParse(request?.PaymentMethod, out var paymentMethodId))
|
||||||
{
|
{
|
||||||
ModelState.AddModelError(nameof(request.PaymentMethod), "Invalid payment method");
|
ModelState.AddModelError(nameof(request.PaymentMethod), "Invalid payment method");
|
||||||
|
|||||||
@@ -77,11 +77,7 @@ namespace BTCPayServer.Controllers.GreenField
|
|||||||
[HttpGet("~/api/v1/stores/{storeId}/payment-methods/LNURLPay/{cryptoCode}")]
|
[HttpGet("~/api/v1/stores/{storeId}/payment-methods/LNURLPay/{cryptoCode}")]
|
||||||
public IActionResult GetLNURLPayPaymentMethod(string storeId, string cryptoCode)
|
public IActionResult GetLNURLPayPaymentMethod(string storeId, string cryptoCode)
|
||||||
{
|
{
|
||||||
if (!GetNetwork(cryptoCode, out BTCPayNetwork _))
|
AssertCryptoCodeWallet(cryptoCode, out _);
|
||||||
{
|
|
||||||
return NotFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
var method = GetExistingLNURLPayPaymentMethod(cryptoCode);
|
var method = GetExistingLNURLPayPaymentMethod(cryptoCode);
|
||||||
if (method is null)
|
if (method is null)
|
||||||
{
|
{
|
||||||
@@ -97,10 +93,8 @@ namespace BTCPayServer.Controllers.GreenField
|
|||||||
string storeId,
|
string storeId,
|
||||||
string cryptoCode)
|
string cryptoCode)
|
||||||
{
|
{
|
||||||
if (!GetNetwork(cryptoCode, out BTCPayNetwork _))
|
|
||||||
{
|
AssertCryptoCodeWallet(cryptoCode, out _);
|
||||||
return NotFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
var id = new PaymentMethodId(cryptoCode, PaymentTypes.LNURLPay);
|
var id = new PaymentMethodId(cryptoCode, PaymentTypes.LNURLPay);
|
||||||
var store = Store;
|
var store = Store;
|
||||||
@@ -116,10 +110,7 @@ namespace BTCPayServer.Controllers.GreenField
|
|||||||
{
|
{
|
||||||
var paymentMethodId = new PaymentMethodId(cryptoCode, PaymentTypes.LNURLPay);
|
var paymentMethodId = new PaymentMethodId(cryptoCode, PaymentTypes.LNURLPay);
|
||||||
|
|
||||||
if (!GetNetwork(cryptoCode, out var network))
|
AssertCryptoCodeWallet(cryptoCode, out _);
|
||||||
{
|
|
||||||
return NotFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
var lnMethod = StoreLightningNetworkPaymentMethodsController.GetExistingLightningLikePaymentMethod(_btcPayNetworkProvider,
|
var lnMethod = StoreLightningNetworkPaymentMethodsController.GetExistingLightningLikePaymentMethod(_btcPayNetworkProvider,
|
||||||
cryptoCode, Store);
|
cryptoCode, Store);
|
||||||
@@ -169,12 +160,12 @@ namespace BTCPayServer.Controllers.GreenField
|
|||||||
paymentMethod.UseBech32Scheme, paymentMethod.EnableForStandardInvoices
|
paymentMethod.UseBech32Scheme, paymentMethod.EnableForStandardInvoices
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
private void AssertCryptoCodeWallet(string cryptoCode, out BTCPayNetwork network)
|
||||||
private bool GetNetwork(string cryptoCode, [MaybeNullWhen(false)] out BTCPayNetwork network)
|
|
||||||
{
|
{
|
||||||
network = _btcPayNetworkProvider.GetNetwork<BTCPayNetwork>(cryptoCode);
|
network = _btcPayNetworkProvider.GetNetwork<BTCPayNetwork>(cryptoCode);
|
||||||
network = network?.SupportLightning is true ? network : null;
|
if (network is null)
|
||||||
return network != null;
|
throw new JsonHttpException(this.CreateAPIError(404, "unknown-cryptocode", "This crypto code isn't set up in this BTCPay Server instance"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,11 +18,8 @@ namespace BTCPayServer.Controllers.GreenField
|
|||||||
public async Task<IActionResult> GenerateOnChainWallet(string storeId, string cryptoCode,
|
public async Task<IActionResult> GenerateOnChainWallet(string storeId, string cryptoCode,
|
||||||
GenerateWalletRequest request)
|
GenerateWalletRequest request)
|
||||||
{
|
{
|
||||||
var network = _btcPayNetworkProvider.GetNetwork<BTCPayNetwork>(cryptoCode);
|
|
||||||
if (network is null)
|
AssertCryptoCodeWallet(cryptoCode, out var network, out var wallet);
|
||||||
{
|
|
||||||
return NotFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_walletProvider.IsAvailable(network))
|
if (!_walletProvider.IsAvailable(network))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -151,7 +151,8 @@ namespace BTCPayServer.Controllers.GreenField
|
|||||||
var addr = await _walletReceiveService.UnReserveAddress(new WalletId(storeId, cryptoCode));
|
var addr = await _walletReceiveService.UnReserveAddress(new WalletId(storeId, cryptoCode));
|
||||||
if (addr is null)
|
if (addr is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return this.CreateAPIError("no-reserved-address",
|
||||||
|
$"There was no reserved address for {cryptoCode} on this store.");
|
||||||
}
|
}
|
||||||
return Ok();
|
return Ok();
|
||||||
}
|
}
|
||||||
@@ -210,7 +211,7 @@ namespace BTCPayServer.Controllers.GreenField
|
|||||||
var tx = await wallet.FetchTransaction(derivationScheme.AccountDerivation, uint256.Parse(transactionId));
|
var tx = await wallet.FetchTransaction(derivationScheme.AccountDerivation, uint256.Parse(transactionId));
|
||||||
if (tx is null)
|
if (tx is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return this.CreateAPIError(404, "transaction-not-found", "The transaction was not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
var walletId = new WalletId(storeId, cryptoCode);
|
var walletId = new WalletId(storeId, cryptoCode);
|
||||||
@@ -523,8 +524,7 @@ namespace BTCPayServer.Controllers.GreenField
|
|||||||
network = _btcPayNetworkProvider.GetNetwork<BTCPayNetwork>(cryptoCode);
|
network = _btcPayNetworkProvider.GetNetwork<BTCPayNetwork>(cryptoCode);
|
||||||
if (network is null)
|
if (network is null)
|
||||||
{
|
{
|
||||||
actionResult = NotFound();
|
throw new JsonHttpException(this.CreateAPIError(404, "unknown-cryptocode", "This crypto code isn't set up in this BTCPay Server instance"));
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -42,14 +42,14 @@ namespace BTCPayServer.Controllers.GreenField
|
|||||||
|
|
||||||
[Authorize(Policy = Policies.CanViewStoreSettings, AuthenticationSchemes = AuthenticationSchemes.Greenfield)]
|
[Authorize(Policy = Policies.CanViewStoreSettings, AuthenticationSchemes = AuthenticationSchemes.Greenfield)]
|
||||||
[HttpGet("~/api/v1/stores/{storeId}")]
|
[HttpGet("~/api/v1/stores/{storeId}")]
|
||||||
public Task<ActionResult<Client.Models.StoreData>> GetStore(string storeId)
|
public IActionResult GetStore(string storeId)
|
||||||
{
|
{
|
||||||
var store = HttpContext.GetStoreData();
|
var store = HttpContext.GetStoreData();
|
||||||
if (store == null)
|
if (store == null)
|
||||||
{
|
{
|
||||||
return Task.FromResult<ActionResult<Client.Models.StoreData>>(NotFound());
|
return StoreNotFound();
|
||||||
}
|
}
|
||||||
return Task.FromResult<ActionResult<Client.Models.StoreData>>(Ok(FromModel(store)));
|
return Ok(FromModel(store));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Authorize(Policy = Policies.CanModifyStoreSettings, AuthenticationSchemes = AuthenticationSchemes.Greenfield)]
|
[Authorize(Policy = Policies.CanModifyStoreSettings, AuthenticationSchemes = AuthenticationSchemes.Greenfield)]
|
||||||
@@ -59,7 +59,7 @@ namespace BTCPayServer.Controllers.GreenField
|
|||||||
var store = HttpContext.GetStoreData();
|
var store = HttpContext.GetStoreData();
|
||||||
if (store == null)
|
if (store == null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return StoreNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_storeRepository.CanDeleteStores())
|
if (!_storeRepository.CanDeleteStores())
|
||||||
@@ -96,7 +96,7 @@ namespace BTCPayServer.Controllers.GreenField
|
|||||||
var store = HttpContext.GetStoreData();
|
var store = HttpContext.GetStoreData();
|
||||||
if (store == null)
|
if (store == null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return StoreNotFound();
|
||||||
}
|
}
|
||||||
var validationResult = Validate(request);
|
var validationResult = Validate(request);
|
||||||
if (validationResult != null)
|
if (validationResult != null)
|
||||||
@@ -215,5 +215,10 @@ namespace BTCPayServer.Controllers.GreenField
|
|||||||
|
|
||||||
return !ModelState.IsValid ? this.CreateValidationError(ModelState) : null;
|
return !ModelState.IsValid ? this.CreateValidationError(ModelState) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IActionResult StoreNotFound()
|
||||||
|
{
|
||||||
|
return this.CreateAPIError(404, "store-not-found", "The store was not found");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user