Errors not working in PointOfSale (#1141)

This commit is contained in:
nicolas.dorier 2019-11-14 20:55:18 +09:00
parent 6900964c03
commit bcb85e2084
No known key found for this signature in database
GPG key ID: 6618763EF09186FE
2 changed files with 36 additions and 19 deletions

View file

@ -165,6 +165,8 @@ namespace BTCPayServer.Controllers
} }
} }
var store = await _AppService.GetStore(app); var store = await _AppService.GetStore(app);
try
{
var invoice = await _InvoiceController.CreateInvoiceCore(new CreateInvoiceRequest() var invoice = await _InvoiceController.CreateInvoiceCore(new CreateInvoiceRequest()
{ {
ItemCode = choice?.Id, ItemCode = choice?.Id,
@ -186,6 +188,17 @@ namespace BTCPayServer.Controllers
cancellationToken); cancellationToken);
return RedirectToAction(nameof(InvoiceController.Checkout), "Invoice", new { invoiceId = invoice.Data.Id }); return RedirectToAction(nameof(InvoiceController.Checkout), "Invoice", new { invoiceId = invoice.Data.Id });
} }
catch (BitpayHttpException e)
{
TempData.SetStatusMessageModel(new StatusMessageModel()
{
Html = e.Message.Replace("\n", "<br />", StringComparison.OrdinalIgnoreCase),
Severity = StatusMessageModel.StatusSeverity.Error,
AllowDismiss = true
});
return RedirectToAction(nameof(ViewPointOfSale), new { appId = appId });
}
}
[HttpGet] [HttpGet]
[Route("/apps/{appId}/crowdfund")] [Route("/apps/{appId}/crowdfund")]

View file

@ -185,6 +185,10 @@
</td> </td>
</tr> </tr>
</script> </script>
@if (this.TempData.HasStatusMessage())
{
<partial name="_StatusMessage" />
}
@if (Model.EnableShoppingCart) @if (Model.EnableShoppingCart)
{ {