From 3ab69046b09dd862b4e771454164ed0d7379ac92 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Fri, 4 May 2018 02:01:43 +0900 Subject: [PATCH] Add overpaid column Fix #149 --- .../Controllers/InvoiceController.UI.cs | 1 + .../InvoicingModels/InvoiceDetailsModel.cs | 1 + BTCPayServer/Views/Invoice/Invoice.cshtml | 23 +++++++++++++------ 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/BTCPayServer/Controllers/InvoiceController.UI.cs b/BTCPayServer/Controllers/InvoiceController.UI.cs index a34ee14e2..93bd37004 100644 --- a/BTCPayServer/Controllers/InvoiceController.UI.cs +++ b/BTCPayServer/Controllers/InvoiceController.UI.cs @@ -75,6 +75,7 @@ namespace BTCPayServer.Controllers cryptoPayment.PaymentMethod = ToString(paymentMethodId); cryptoPayment.Due = accounting.Due.ToString() + $" {paymentMethodId.CryptoCode}"; cryptoPayment.Paid = accounting.CryptoPaid.ToString() + $" {paymentMethodId.CryptoCode}"; + cryptoPayment.Overpaid = (accounting.DueUncapped > Money.Zero ? Money.Zero : -accounting.DueUncapped).ToString() + $" {paymentMethodId.CryptoCode}"; var onchainMethod = data.GetPaymentMethodDetails() as Payments.Bitcoin.BitcoinLikeOnChainPaymentMethod; if (onchainMethod != null) diff --git a/BTCPayServer/Models/InvoicingModels/InvoiceDetailsModel.cs b/BTCPayServer/Models/InvoicingModels/InvoiceDetailsModel.cs index 36b270c2b..32717a939 100644 --- a/BTCPayServer/Models/InvoicingModels/InvoiceDetailsModel.cs +++ b/BTCPayServer/Models/InvoicingModels/InvoiceDetailsModel.cs @@ -18,6 +18,7 @@ namespace BTCPayServer.Models.InvoicingModels public string Address { get; internal set; } public string Rate { get; internal set; } public string PaymentUrl { get; internal set; } + public string Overpaid { get; set; } } public class AddressModel { diff --git a/BTCPayServer/Views/Invoice/Invoice.cshtml b/BTCPayServer/Views/Invoice/Invoice.cshtml index 18446e0ab..66f4674e4 100644 --- a/BTCPayServer/Views/Invoice/Invoice.cshtml +++ b/BTCPayServer/Views/Invoice/Invoice.cshtml @@ -11,6 +11,7 @@ .smMaxWidth { max-width: 200px; } + @@media (min-width: 768px) { .smMaxWidth { max-width: 400px; @@ -166,10 +167,14 @@ Rate Paid Due + @if(Model.StatusException == "paidOver") + { + Overpaid + } - @foreach (var payment in Model.CryptoPayments) + @foreach(var payment in Model.CryptoPayments) { @payment.PaymentMethod @@ -177,13 +182,17 @@ @payment.Rate @payment.Paid @payment.Due + @if(Model.StatusException == "paidOver") + { + @payment.Overpaid + } } - @if (Model.OnChainPayments.Count > 0) + @if(Model.OnChainPayments.Count > 0) {
@@ -198,7 +207,7 @@ - @foreach (var payment in Model.OnChainPayments) + @foreach(var payment in Model.OnChainPayments) { var replaced = payment.Replaced ? "class='linethrough'" : ""; @@ -217,7 +226,7 @@
} - @if (Model.OffChainPayments.Count > 0) + @if(Model.OffChainPayments.Count > 0) {
@@ -230,7 +239,7 @@ - @foreach (var payment in Model.OffChainPayments) + @foreach(var payment in Model.OffChainPayments) { @payment.Crypto @@ -253,7 +262,7 @@ - @foreach (var address in Model.Addresses) + @foreach(var address in Model.Addresses) { var current = address.Current ? "font-weight-bold" : ""; @@ -277,7 +286,7 @@ - @foreach (var evt in Model.Events) + @foreach(var evt in Model.Events) { @evt.Timestamp