This commit is contained in:
NicolasDorier
2017-09-13 16:56:33 +09:00
parent 95b45da25a
commit b17a2fc1db
10 changed files with 18 additions and 18 deletions

View File

@@ -12,7 +12,7 @@ namespace BTCPayServer.Controllers
{ {
public IActionResult Index() public IActionResult Index()
{ {
return View(); return View("Home");
} }
public IActionResult About() public IActionResult About()

View File

@@ -21,7 +21,7 @@ namespace BTCPayServer.Controllers
[HttpGet] [HttpGet]
[Route("i/{invoiceId}")] [Route("i/{invoiceId}")]
[AcceptMediaTypeConstraint("application/bitcoin-paymentrequest", false)] [AcceptMediaTypeConstraint("application/bitcoin-paymentrequest", false)]
public async Task<IActionResult> Payment(string invoiceId) public async Task<IActionResult> Checkout(string invoiceId)
{ {
var invoice = await _InvoiceRepository.GetInvoice(null, invoiceId); var invoice = await _InvoiceRepository.GetInvoice(null, invoiceId);
if(invoice == null) if(invoice == null)
@@ -91,7 +91,7 @@ namespace BTCPayServer.Controllers
[HttpGet] [HttpGet]
[Route("Invoices")] [Route("Invoices")]
[BitpayAPIConstraint(false)] [BitpayAPIConstraint(false)]
public async Task<IActionResult> Index(string searchTerm = null, int skip = 0, int count = 20) public async Task<IActionResult> ListInvoices(string searchTerm = null, int skip = 0, int count = 20)
{ {
var store = await FindStore(User); var store = await FindStore(User);
var model = new InvoicesModel(); var model = new InvoicesModel();
@@ -150,7 +150,7 @@ namespace BTCPayServer.Controllers
}, store); }, store);
StatusMessage = $"Invoice {result.Data.Id} just created!"; StatusMessage = $"Invoice {result.Data.Id} just created!";
return RedirectToAction("Index"); return RedirectToAction("ListInvoices");
} }
[HttpPost] [HttpPost]

View File

@@ -382,12 +382,12 @@ namespace BTCPayServer.Controllers
if(pairingCode != null && await _TokenRepository.PairWithAsync(pairingCode, store.Id)) if(pairingCode != null && await _TokenRepository.PairWithAsync(pairingCode, store.Id))
{ {
StatusMessage = "Pairing is successfull"; StatusMessage = "Pairing is successfull";
return RedirectToAction(nameof(Tokens)); return RedirectToAction(nameof(ListTokens));
} }
else else
{ {
StatusMessage = "Pairing failed"; StatusMessage = "Pairing failed";
return RedirectToAction(nameof(Tokens)); return RedirectToAction(nameof(ListTokens));
} }
} }
@@ -528,7 +528,7 @@ namespace BTCPayServer.Controllers
[HttpPost] [HttpPost]
[ValidateAntiForgeryToken] [ValidateAntiForgeryToken]
public async Task<IActionResult> AddToken(AddTokenViewModel model) public async Task<IActionResult> CreateToken(CreateTokenViewModel model)
{ {
if(!ModelState.IsValid) if(!ModelState.IsValid)
{ {
@@ -542,7 +542,7 @@ namespace BTCPayServer.Controllers
var link = pairing.CreateLink(url).ToString(); var link = pairing.CreateLink(url).ToString();
await _TokenRepository.PairWithAsync(pairing.ToString(), storeId); await _TokenRepository.PairWithAsync(pairing.ToString(), storeId);
StatusMessage = "New access token paired to this store"; StatusMessage = "New access token paired to this store";
return RedirectToAction("Tokens"); return RedirectToAction(nameof(ListTokens));
} }
private async Task<string> GetStoreId() private async Task<string> GetStoreId()
@@ -556,9 +556,9 @@ namespace BTCPayServer.Controllers
} }
[HttpGet] [HttpGet]
public IActionResult AddToken() public IActionResult CreateToken()
{ {
var model = new AddTokenViewModel(); var model = new CreateTokenViewModel();
model.Facade = "merchant"; model.Facade = "merchant";
if(_Env.IsDevelopment()) if(_Env.IsDevelopment())
{ {
@@ -572,11 +572,11 @@ namespace BTCPayServer.Controllers
{ {
await _TokenRepository.DeleteToken(sin, name); await _TokenRepository.DeleteToken(sin, name);
StatusMessage = "Token revoked"; StatusMessage = "Token revoked";
return RedirectToAction("Tokens"); return RedirectToAction(nameof(ListTokens));
} }
[HttpGet] [HttpGet]
public async Task<IActionResult> Tokens() public async Task<IActionResult> ListTokens()
{ {
var model = new TokensViewModel(); var model = new TokensViewModel();
var tokens = await _TokenRepository.GetTokensByPairedIdAsync(await GetStoreId()); var tokens = await _TokenRepository.GetTokensByPairedIdAsync(await GetStoreId());

View File

@@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace BTCPayServer.Models.ManageViewModels namespace BTCPayServer.Models.ManageViewModels
{ {
public class AddTokenViewModel public class CreateTokenViewModel
{ {
[PubKeyValidatorAttribute] [PubKeyValidatorAttribute]
public string PublicKey public string PublicKey

View File

@@ -50,7 +50,7 @@
<td>@invoice.InvoiceId</td> <td>@invoice.InvoiceId</td>
<td>@invoice.Status</td> <td>@invoice.Status</td>
<td>@invoice.AmountCurrency</td> <td>@invoice.AmountCurrency</td>
<td><a asp-action="Payment" asp-route-invoiceId="@invoice.InvoiceId">Go to payment</a></td> <td><a asp-action="Checkout" asp-route-invoiceId="@invoice.InvoiceId">Checkout</a></td>
</tr> </tr>
} }
</tbody> </tbody>

View File

@@ -1,4 +1,4 @@
@model AddTokenViewModel @model CreateTokenViewModel
@{ @{
ViewData["Title"] = "Create a new token"; ViewData["Title"] = "Create a new token";
ViewData.AddActivePage(ManageNavPages.Tokens); ViewData.AddActivePage(ManageNavPages.Tokens);
@@ -8,7 +8,7 @@
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
<form asp-action="AddToken" method="post"> <form asp-action="CreateToken" method="post">
<div class="form-group"> <div class="form-group">
<label asp-for="Label"></label> <label asp-for="Label"></label>
<input asp-for="Label" class="form-control" /> <input asp-for="Label" class="form-control" />

View File

@@ -9,7 +9,7 @@
@Html.Partial("_StatusMessage", Model.StatusMessage) @Html.Partial("_StatusMessage", Model.StatusMessage)
<div class="row"> <div class="row">
<div class="col-md-9"> <div class="col-md-9">
<a asp-action="AddToken" class="btn btn-success" role="button"><span class="glyphicon glyphicon-plus"></span>Create a new token</a> <a asp-action="CreateToken" class="btn btn-success" role="button"><span class="glyphicon glyphicon-plus"></span>Create a new token</a>
<table class="table"> <table class="table">
<thead class="thead-inverse"> <thead class="thead-inverse">
<tr> <tr>

View File

@@ -7,7 +7,7 @@
<ul class="nav nav-pills nav-stacked"> <ul class="nav nav-pills nav-stacked">
<li class="@ManageNavPages.IndexNavClass(ViewContext)"><a asp-action="Index">Profile</a></li> <li class="@ManageNavPages.IndexNavClass(ViewContext)"><a asp-action="Index">Profile</a></li>
<li class="@ManageNavPages.ChangePasswordNavClass(ViewContext)"><a asp-action="ChangePassword">Password</a></li> <li class="@ManageNavPages.ChangePasswordNavClass(ViewContext)"><a asp-action="ChangePassword">Password</a></li>
<li class="@ManageNavPages.TokensNavClass(ViewContext)"><a asp-action="Tokens">Access Tokens</a></li> <li class="@ManageNavPages.TokensNavClass(ViewContext)"><a asp-action="ListTokens">Access Tokens</a></li>
@if (hasExternalLogins) @if (hasExternalLogins)
{ {
<li class="@ManageNavPages.ExternalLoginsNavClass(ViewContext)"><a asp-action="ExternalLogins">External logins</a></li> <li class="@ManageNavPages.ExternalLoginsNavClass(ViewContext)"><a asp-action="ExternalLogins">External logins</a></li>