mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 14:34:23 +01:00
Adding support for noscript invoices
This commit is contained in:
@@ -188,7 +188,7 @@ namespace BTCPayServer.Controllers
|
|||||||
//Keep compatibility with Bitpay
|
//Keep compatibility with Bitpay
|
||||||
invoiceId = invoiceId ?? id;
|
invoiceId = invoiceId ?? id;
|
||||||
id = invoiceId;
|
id = invoiceId;
|
||||||
////
|
//
|
||||||
|
|
||||||
var model = await GetInvoiceModel(invoiceId, paymentMethodId == null ? null : PaymentMethodId.Parse(paymentMethodId));
|
var model = await GetInvoiceModel(invoiceId, paymentMethodId == null ? null : PaymentMethodId.Parse(paymentMethodId));
|
||||||
if (model == null)
|
if (model == null)
|
||||||
@@ -213,6 +213,23 @@ namespace BTCPayServer.Controllers
|
|||||||
return View(nameof(Checkout), model);
|
return View(nameof(Checkout), model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[Route("invoice-noscript")]
|
||||||
|
public async Task<IActionResult> CheckoutNoScript(string invoiceId, string id = null, string paymentMethodId = null)
|
||||||
|
{
|
||||||
|
//Keep compatibility with Bitpay
|
||||||
|
invoiceId = invoiceId ?? id;
|
||||||
|
id = invoiceId;
|
||||||
|
//
|
||||||
|
|
||||||
|
var model = await GetInvoiceModel(invoiceId, paymentMethodId == null ? null : PaymentMethodId.Parse(paymentMethodId));
|
||||||
|
if (model == null)
|
||||||
|
return NotFound();
|
||||||
|
|
||||||
|
return View(nameof(CheckoutNoScript), model);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private async Task<PaymentModel> GetInvoiceModel(string invoiceId, PaymentMethodId paymentMethodId)
|
private async Task<PaymentModel> GetInvoiceModel(string invoiceId, PaymentMethodId paymentMethodId)
|
||||||
{
|
{
|
||||||
var invoice = await _InvoiceRepository.GetInvoice(invoiceId);
|
var invoice = await _InvoiceRepository.GetInvoice(invoiceId);
|
||||||
|
|||||||
@@ -51,9 +51,9 @@
|
|||||||
|
|
||||||
<p>Alternatively, click below to continue to our HTML-only invoice.</p>
|
<p>Alternatively, click below to continue to our HTML-only invoice.</p>
|
||||||
|
|
||||||
<form action="/invoice-noscript" method="GET">
|
<a href="/invoice-noscript?id=@Model.InvoiceId" style="text-decoration: underline; color: blue">
|
||||||
<button style="text-decoration: underline; color: blue">Continue to javascript-disabled invoice ></button>
|
Continue to javascript-disabled invoice >
|
||||||
</form>
|
</a>
|
||||||
</center>
|
</center>
|
||||||
</noscript>
|
</noscript>
|
||||||
|
|
||||||
|
|||||||
49
BTCPayServer/Views/Invoice/CheckoutNoScript.cshtml
Normal file
49
BTCPayServer/Views/Invoice/CheckoutNoScript.cshtml
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
@model PaymentModel
|
||||||
|
@{
|
||||||
|
Layout = null;
|
||||||
|
}
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||||
|
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
|
<META NAME="robots" CONTENT="noindex,nofollow">
|
||||||
|
<title>@Model.HtmlTitle</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Pay with @Model.StoreName</h1>
|
||||||
|
@if (Model.Status == "new")
|
||||||
|
{
|
||||||
|
<div>
|
||||||
|
<p>To complete payment, please send <b>@Model.BtcDue @Model.CryptoCode</b> to <b>@Model.BtcAddress</b></p>
|
||||||
|
<p>Time remaining: @Model.TimeLeft</p>
|
||||||
|
<p><a href="@Model.InvoiceBitcoinUrl">@Model.InvoiceBitcoinUrl</a></p>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
else if (Model.Status == "paid" || Model.Status == "complete" || Model.Status == "confirmed")
|
||||||
|
{
|
||||||
|
<div>
|
||||||
|
<p>This invoice has been paid</p>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
else if (Model.Status == "expired" || Model.Status == "invalid")
|
||||||
|
{
|
||||||
|
<div>
|
||||||
|
<p>This invoice has expired</p>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<div>
|
||||||
|
<p>Non-supported state of invoice</p>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
<p>
|
||||||
|
<a href="/i/@Model.InvoiceId">Go back to Javascript enabled invoice</a>
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -11513,7 +11513,7 @@ low-fee-timeline {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[v-cloak] > * { display:none }
|
[v-cloak] > * { display:none }
|
||||||
[v-cloak]::before { content: "loading…" }
|
[v-cloak]::before { content: "" }
|
||||||
|
|
||||||
|
|
||||||
.btn-link {
|
.btn-link {
|
||||||
|
|||||||
Reference in New Issue
Block a user