From 7b337bde49c6932848f90b8a591330ee1cd3b957 Mon Sep 17 00:00:00 2001 From: rockstardev Date: Thu, 30 May 2019 13:59:01 -0500 Subject: [PATCH 1/4] Restoring table border styling done by KayBeSee --- BTCPayServer/Views/Invoice/Invoice.cshtml | 8 ++-- BTCPayServer/Views/Server/Rates.cshtml | 2 +- BTCPayServer/wwwroot/main/css/site.css | 55 ++++++++++++++++++++++- 3 files changed, 59 insertions(+), 6 deletions(-) diff --git a/BTCPayServer/Views/Invoice/Invoice.cshtml b/BTCPayServer/Views/Invoice/Invoice.cshtml index 831cbf37a..2863e84ef 100644 --- a/BTCPayServer/Views/Invoice/Invoice.cshtml +++ b/BTCPayServer/Views/Invoice/Invoice.cshtml @@ -35,7 +35,7 @@

Information

- +
@@ -93,7 +93,7 @@

Buyer information

-
Store @Model.StoreName
+
@@ -134,7 +134,7 @@ @if (Model.PosData.Count == 0) {

Product information

-
Name @Model.BuyerInformation.BuyerName
+
@@ -161,7 +161,7 @@

Product information

-
Item code @Model.ProductInformation.ItemCode
+
diff --git a/BTCPayServer/Views/Server/Rates.cshtml b/BTCPayServer/Views/Server/Rates.cshtml index 1dcf9bea6..21fe1d3a2 100644 --- a/BTCPayServer/Views/Server/Rates.cshtml +++ b/BTCPayServer/Views/Server/Rates.cshtml @@ -37,7 +37,7 @@ @if(Model.RateLimits != null) {
Current Bitcoin Average Quotas:
-
Item code @Model.ProductInformation.ItemCode
+
diff --git a/BTCPayServer/wwwroot/main/css/site.css b/BTCPayServer/wwwroot/main/css/site.css index 3a1b9d86a..623edccca 100644 --- a/BTCPayServer/wwwroot/main/css/site.css +++ b/BTCPayServer/wwwroot/main/css/site.css @@ -16,7 +16,7 @@ } -.only-for-js, .input-group-clear{ +.only-for-js, .input-group-clear { display: none; } @@ -27,6 +27,59 @@ border-radius: 4px; } +.table { + background: #fff; + border: 1px solid #DFE3E8; + border-radius: 4px; + border-collapse: separate !important; + border-spacing: 0px !important; + margin-top: 16px; + margin-bottom: 16px; +} + +.table thead > tr { + height: 36px; +} + +.table thead th { + border-bottom: none; + border-top: none; + vertical-align: middle; + padding: 4px 12px 4px 12px; +} + +.table tbody tr:hover { + background-color: #f8fafc; +} + +.table tr { + height: 36px; +} + + .table th { + display: table-cell; + padding: 4px 12px 4px 12px; + vertical-align: middle; + } + + .table td { + display: table-cell; + padding: 4px 12px 4px 12px; + text-align: left; + color: #12161B; + font-size: 0.8125rem; + font-weight: 400; + vertical-align: middle; + } + +.removetopborder tr:first-child td { + border-top: none; +} + +.removetopborder tr:first-child th { + border-top: none; +} + a.nav-link { color: #66788A; } From 5c6643270baac6b2b5f87b516b4e41ab0b3f72db Mon Sep 17 00:00:00 2001 From: rockstardev Date: Thu, 30 May 2019 15:15:39 -0500 Subject: [PATCH 2/4] Bugfixing path to crypto image Will need to move all these paths to absolute, rather than relative --- BTCPayServer/Controllers/InvoiceController.UI.cs | 4 ++-- BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentHandler.cs | 2 +- .../Payments/Lightning/LightningLikePaymentHandler.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/BTCPayServer/Controllers/InvoiceController.UI.cs b/BTCPayServer/Controllers/InvoiceController.UI.cs index d25e0fb5b..983da5016 100644 --- a/BTCPayServer/Controllers/InvoiceController.UI.cs +++ b/BTCPayServer/Controllers/InvoiceController.UI.cs @@ -210,7 +210,7 @@ namespace BTCPayServer.Controllers return View(model); } -//TODO: abstract + //TODO: abstract private async Task GetInvoiceModel(string invoiceId, PaymentMethodId paymentMethodId) { var invoice = await _InvoiceRepository.GetInvoice(invoiceId); @@ -324,7 +324,7 @@ namespace BTCPayServer.Controllers PaymentMethodName = availableCryptoHandler.GetPaymentMethodName(availableCryptoPaymentMethodId), IsLightning = kv.GetId().PaymentType == PaymentTypes.LightningLike, - CryptoImage = Request.GetRelativePathOrAbsolute(availableCryptoHandler.GetCryptoImage(availableCryptoPaymentMethodId)), + CryptoImage = "/" + availableCryptoHandler.GetCryptoImage(availableCryptoPaymentMethodId), Link = Url.Action(nameof(Checkout), new { diff --git a/BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentHandler.cs b/BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentHandler.cs index f5d3de0d9..9159f7fc5 100644 --- a/BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentHandler.cs +++ b/BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentHandler.cs @@ -48,7 +48,7 @@ namespace BTCPayServer.Payments.Bitcoin var network = _networkProvider.GetNetwork(model.CryptoCode); model.IsLightning = false; model.PaymentMethodName = GetPaymentMethodName(network); - model.CryptoImage = GetCryptoImage(network); + model.CryptoImage = "/" + GetCryptoImage(network); model.InvoiceBitcoinUrl = cryptoInfo.PaymentUrls.BIP21; model.InvoiceBitcoinUrlQR = cryptoInfo.PaymentUrls.BIP21; } diff --git a/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs b/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs index b30674b5a..e0bfda0bc 100644 --- a/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs +++ b/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs @@ -207,7 +207,7 @@ namespace BTCPayServer.Payments.Lightning var network = _networkProvider.GetNetwork(model.CryptoCode); model.IsLightning = true; model.PaymentMethodName = GetPaymentMethodName(network); - model.CryptoImage = GetCryptoImage(network); + model.CryptoImage = "/"+ GetCryptoImage(network); model.InvoiceBitcoinUrl = cryptoInfo.PaymentUrls.BOLT11; model.InvoiceBitcoinUrlQR = cryptoInfo.PaymentUrls.BOLT11.ToUpperInvariant(); } From dcaf0463a7da06b7cda836695f1cdc277d57b82a Mon Sep 17 00:00:00 2001 From: rockstardev Date: Thu, 30 May 2019 16:37:55 -0500 Subject: [PATCH 3/4] Displaying notification for extra transaction if paidPartial --- .../Views/Invoice/Checkout-Body.cshtml | 3 + .../wwwroot/checkout/css/normalizer.css | 69 ++++++++++++------- BTCPayServer/wwwroot/checkout/js/core.js | 42 ++++++++--- BTCPayServer/wwwroot/locales/en.json | 6 +- 4 files changed, 81 insertions(+), 39 deletions(-) diff --git a/BTCPayServer/Views/Invoice/Checkout-Body.cshtml b/BTCPayServer/Views/Invoice/Checkout-Body.cshtml index 7b035e8e9..5a655f745 100644 --- a/BTCPayServer/Views/Invoice/Checkout-Body.cshtml +++ b/BTCPayServer/Views/Invoice/Checkout-Body.cshtml @@ -109,6 +109,9 @@ +
+ {{$t("NotPaid_ExtraTransaction")}} +
{{$t("Order Amount")}}
diff --git a/BTCPayServer/wwwroot/checkout/css/normalizer.css b/BTCPayServer/wwwroot/checkout/css/normalizer.css index 94b9b222d..fa440f64f 100644 --- a/BTCPayServer/wwwroot/checkout/css/normalizer.css +++ b/BTCPayServer/wwwroot/checkout/css/normalizer.css @@ -9448,10 +9448,10 @@ strong { margin-bottom: 5px; } -.payment__scan svg { - width: 256px; - height: 256px; -} + .payment__scan svg { + width: 256px; + height: 256px; + } .payment__scan__checkmark-wrapper { display: flex; @@ -11202,6 +11202,16 @@ language-selector { opacity: 1; } + +.extraPayment { + background: #E5465A; + color: #fff; + font-weight: 500; + letter-spacing: .5px; + font-size: 12px; + padding: 2px 1rem; +} + line-items { background: #FBFBFB; border-top: 1px solid rgba(238, 238, 238, 0.5); @@ -11470,56 +11480,63 @@ low-fee-timeline { height: 32px; margin-bottom: 10px; } + .changelly-component .general__spinner bp-spinner { width: 50px; height: 50px; - } -.changelly-component .general__spinner bp-spinner svg { - margin: 0; -} + .changelly-component .general__spinner bp-spinner svg { + margin: 0; + } .changelly-component .retry-button { border-radius: 5px; border: 1px solid #a9a9a9; background: #fff; color: #000; - min-width:100px; + min-width: 100px; padding-left: 0.8rem; padding-right: 0.8rem; min-height: 30px; word-break: break-all; } -.changelly-component .retry-button :hover{ - border-color: #7f7f7f; -} + .changelly-component .retry-button :hover { + border-color: #7f7f7f; + } .changelly-component .prettydropdown li img { - width:20px; + width: 20px; margin-right: 5px; } -#prettydropdown-DefaultLang{ - min-width:200px; -} -#prettydropdown-DefaultLang ul{ - width:100%; -} -#prettydropdown-DefaultLang ul li{ - width:100% !important; +#prettydropdown-DefaultLang { + min-width: 200px; } -[v-cloak] > * { display:none } -[v-cloak]::before { content: "" } + #prettydropdown-DefaultLang ul { + width: 100%; + } + + #prettydropdown-DefaultLang ul li { + width: 100% !important; + } + +[v-cloak] > * { + display: none +} + +[v-cloak]::before { + content: "" +} .btn-link { color: #329F80; } -.btn-link:hover { - color: #24725B; -} + .btn-link:hover { + color: #24725B; + } diff --git a/BTCPayServer/wwwroot/checkout/js/core.js b/BTCPayServer/wwwroot/checkout/js/core.js index 23cb6fcd0..01a725e02 100644 --- a/BTCPayServer/wwwroot/checkout/js/core.js +++ b/BTCPayServer/wwwroot/checkout/js/core.js @@ -107,6 +107,11 @@ function onDataCallback(jsonData) { jsonData.orderAmount = numberFormatted(jsonData.orderAmount * SATOSHIME); } + // expand line items to show details on amount due for multi-transaction payment + if (checkoutCtrl.srvModel.txCount === 1 && jsonData.txCount > 1) { + onlyExpandLineItems(); + } + // updating ui checkoutCtrl.srvModel = jsonData; } @@ -140,10 +145,31 @@ function lndToggleNode() { checkoutCtrl.scanDisplayQr = checkoutCtrl.srvModel.peerInfo; } +var lineItemsExpanded = false; +function toggleLineItems() { + $("line-items").toggleClass("expanded"); + lineItemsExpanded ? $("line-items").slideUp() : $("line-items").slideDown(); + lineItemsExpanded = !lineItemsExpanded; + + $(".buyerTotalLine").toggleClass("expanded"); + $(".single-item-order__right__btc-price__chevron").toggleClass("expanded"); +} + +function onlyExpandLineItems() { + if (!lineItemsExpanded) { + toggleLineItems(); + } +} + + // private methods $(document).ready(function () { // initialize onDataCallback(srvModel); + // initial expand of line items to show error message if multiple payments needed + if (srvModel.status === "new" && srvModel.txCount > 1) { + onlyExpandLineItems(); + } // check if the Document expired if (srvModel.expirationSeconds > 0) { @@ -166,6 +192,11 @@ $(document).ready(function () { jQuery("invoice").fadeIn(300); // eof initialize + + // Expand Line-Items + $(".buyerTotalLine").click(function () { + toggleLineItems(); + }); // FUNCTIONS function hideEmailForm() { @@ -297,17 +328,6 @@ $(document).ready(function () { // function to load contents in different language should go there }); - // Expand Line-Items - var lineItemsExpanded = false; - $(".buyerTotalLine").click(function () { - $("line-items").toggleClass("expanded"); - lineItemsExpanded ? $("line-items").slideUp() : $("line-items").slideDown(); - lineItemsExpanded = !lineItemsExpanded; - - $(".buyerTotalLine").toggleClass("expanded"); - $(".single-item-order__right__btc-price__chevron").toggleClass("expanded"); - }); - // Timer Countdown && Progress bar function progressStart(timerMax) { var end = new Date(); // Setup Time Variable, should come from server diff --git a/BTCPayServer/wwwroot/locales/en.json b/BTCPayServer/wwwroot/locales/en.json index 55b0c03b9..de8574231 100644 --- a/BTCPayServer/wwwroot/locales/en.json +++ b/BTCPayServer/wwwroot/locales/en.json @@ -1,3 +1,4 @@ + { "NOTICE_WARN": "THIS CODE HAS BEEN AUTOMATICALLY GENERATED FROM TRANSIFEX, IF YOU WISH TO HELP TRANSLATION COME ON THE SLACK http://slack.btcpayserver.org TO REQUEST PERMISSION TO https://www.transifex.com/btcpayserver/btcpayserver/", "code": "en", @@ -46,5 +47,6 @@ "txCount_plural": "{{count}} transactions", "Pay with CoinSwitch": "Pay with CoinSwitch", "Pay with Changelly": "Pay with Changelly", - "Close": "Close" -} \ No newline at end of file + "Close": "Close", + "NotPaid_ExtraTransaction": "The invoice hasn't been paid in full. Please send another transaction to cover amount Due." +} From 0f58f6da368f11ecb92963c8afe96aacc3a691de Mon Sep 17 00:00:00 2001 From: Kukks Date: Fri, 31 May 2019 08:00:32 +0200 Subject: [PATCH 4/4] fix cryptoimage --- BTCPayServer/Controllers/InvoiceController.UI.cs | 6 ++++-- BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentHandler.cs | 1 - .../Payments/Lightning/LightningLikePaymentHandler.cs | 1 - 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/BTCPayServer/Controllers/InvoiceController.UI.cs b/BTCPayServer/Controllers/InvoiceController.UI.cs index 983da5016..1d17e2be6 100644 --- a/BTCPayServer/Controllers/InvoiceController.UI.cs +++ b/BTCPayServer/Controllers/InvoiceController.UI.cs @@ -269,6 +269,7 @@ namespace BTCPayServer.Controllers (1m + (changelly.AmountMarkupPercentage / 100m))) : (decimal?)null; + var paymentMethodHandler = invoice.PaymentMethodHandlerDictionary[paymentMethodId]; var model = new PaymentModel() { CryptoCode = network.CryptoCode, @@ -279,6 +280,7 @@ namespace BTCPayServer.Controllers HtmlTitle = storeBlob.HtmlTitle ?? "BTCPay Invoice", CustomCSSLink = storeBlob.CustomCSS?.AbsoluteUri, CustomLogoLink = storeBlob.CustomLogo?.AbsoluteUri, + CryptoImage = Request.GetRelativePathOrAbsolute(paymentMethodHandler.GetCryptoImage(paymentMethodId)), LightningAmountInSatoshi = storeBlob.LightningAmountInSatoshi, BtcAddress = paymentMethodDetails.GetPaymentDestination(), BtcDue = accounting.Due.ToString(), @@ -324,7 +326,7 @@ namespace BTCPayServer.Controllers PaymentMethodName = availableCryptoHandler.GetPaymentMethodName(availableCryptoPaymentMethodId), IsLightning = kv.GetId().PaymentType == PaymentTypes.LightningLike, - CryptoImage = "/" + availableCryptoHandler.GetCryptoImage(availableCryptoPaymentMethodId), + CryptoImage = Request.GetRelativePathOrAbsolute(availableCryptoHandler.GetCryptoImage(availableCryptoPaymentMethodId)), Link = Url.Action(nameof(Checkout), new { @@ -337,7 +339,7 @@ namespace BTCPayServer.Controllers .ToList() }; - invoice.PaymentMethodHandlerDictionary[paymentMethod.GetId()].PreparePaymentModel(model, dto); + paymentMethodHandler.PreparePaymentModel(model, dto); model.PaymentMethodId = paymentMethodId.ToString(); var expiration = TimeSpan.FromSeconds(model.ExpirationSeconds); model.TimeLeft = expiration.PrettyPrint(); diff --git a/BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentHandler.cs b/BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentHandler.cs index 9159f7fc5..4ca7878a9 100644 --- a/BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentHandler.cs +++ b/BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentHandler.cs @@ -48,7 +48,6 @@ namespace BTCPayServer.Payments.Bitcoin var network = _networkProvider.GetNetwork(model.CryptoCode); model.IsLightning = false; model.PaymentMethodName = GetPaymentMethodName(network); - model.CryptoImage = "/" + GetCryptoImage(network); model.InvoiceBitcoinUrl = cryptoInfo.PaymentUrls.BIP21; model.InvoiceBitcoinUrlQR = cryptoInfo.PaymentUrls.BIP21; } diff --git a/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs b/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs index e0bfda0bc..6da7e387d 100644 --- a/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs +++ b/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs @@ -207,7 +207,6 @@ namespace BTCPayServer.Payments.Lightning var network = _networkProvider.GetNetwork(model.CryptoCode); model.IsLightning = true; model.PaymentMethodName = GetPaymentMethodName(network); - model.CryptoImage = "/"+ GetCryptoImage(network); model.InvoiceBitcoinUrl = cryptoInfo.PaymentUrls.BOLT11; model.InvoiceBitcoinUrlQR = cryptoInfo.PaymentUrls.BOLT11.ToUpperInvariant(); }
Quota period @Model.RateLimits.TotalPeriod.TimeString()