Maintaining AppId reference

This commit is contained in:
rockstardev 2018-08-22 12:59:55 +02:00
parent 5b5a2e8c25
commit 4111b8a5a3
4 changed files with 7 additions and 5 deletions

View file

@ -33,7 +33,8 @@ namespace BTCPayServer.Controllers
ButtonSize = 2, ButtonSize = 2,
UrlRoot = appUrl, UrlRoot = appUrl,
CurrencyDropdown = currencyDropdown, CurrencyDropdown = currencyDropdown,
PayButtonImageUrl = appUrl + "/img/paybutton/pay.png" PayButtonImageUrl = appUrl + "/img/paybutton/pay.png",
AppId = appId
}; };
return View(model); return View(model);
} }
@ -55,7 +56,6 @@ namespace BTCPayServer.Controllers
public async Task<IActionResult> PayButtonHandle(string appId, [FromForm]PayButtonViewModel model) public async Task<IActionResult> PayButtonHandle(string appId, [FromForm]PayButtonViewModel model)
{ {
var app = await GetApp(appId, AppType.PayButton); var app = await GetApp(appId, AppType.PayButton);
var settings = app.GetSettings<PointOfSaleSettings>();
var store = await GetStore(app); var store = await GetStore(app);
// TODO: extract validation to model // TODO: extract validation to model

View file

@ -21,6 +21,8 @@ namespace BTCPayServer.Models.AppViewModels
[EmailAddress] [EmailAddress]
public string NotifyEmail { get; set; } public string NotifyEmail { get; set; }
public string AppId { get; set; }
// Data that influences Pay Button UI, but not invoice creation // Data that influences Pay Button UI, but not invoice creation
public string UrlRoot { get; set; } public string UrlRoot { get; set; }
public List<string> CurrencyDropdown { get; set; } public List<string> CurrencyDropdown { get; set; }

View file

@ -3,10 +3,10 @@
<div class="container" id="payButtonCtrl"> <div class="container" id="payButtonCtrl">
<div class="row"> <div class="row">
<form method="POST" action="http://127.0.0.1:14142/apps/3jVExUHqRkGi4eaJEFCTxw5zjk14VAFzoVZXZJ3fbwED/pay"> <form method="POST" action="http://127.0.0.1:14142/apps/3VLNNTSLKex8s3Twp3VVgTcvDjueewhsWtJa9ErU1YtD/pay">
<input type="hidden" name="price" value="10" /> <input type="hidden" name="price" value="10" />
<input type="hidden" name="currency" value="USD" /> <input type="hidden" name="currency" value="USD" />
<input type="image" src="http://127.0.0.1:14142/img/paywithbtcpay.png" name="submit" style="width:209px" alt="Pay with BtcPay, Self-Hosted Bitcoin Payment Processor"> <input type="image" src="http://127.0.0.1:14142/img/paybutton/pay.png" name="submit" style="width:209px" alt="Pay with BtcPay, Self-Hosted Bitcoin Payment Processor">
</form> </form>
</div> </div>

View file

@ -27,7 +27,7 @@ function inputChanges(event, buttonSize) {
srvModel.buttonSize = buttonSize; srvModel.buttonSize = buttonSize;
} }
var html = '&lt;form method="POST" action="' + srvModel.urlRoot + '/apps/3jVExUHqRkGi4eaJEFCTxw5zjk14VAFzoVZXZJ3fbwED/pay"&gt;'; var html = '&lt;form method="POST" action="' + srvModel.urlRoot + '/apps/'+ srvModel.appId +'/pay"&gt;';
html += addinput("price", srvModel.price); html += addinput("price", srvModel.price);
if (srvModel.currency) { if (srvModel.currency) {
html += addinput("currency", srvModel.currency); html += addinput("currency", srvModel.currency);