From 887da5aa9a26a9185b4e67376e2c20e93f9ba934 Mon Sep 17 00:00:00 2001 From: bitcoinshirt <36959754+bitcoinshirt@users.noreply.github.com> Date: Sat, 5 Jan 2019 22:22:19 +0100 Subject: [PATCH 1/5] new year --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 9fdebb0ec..e8df95432 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2017-2018 btcpayserver +Copyright (c) 2017-2019 btcpayserver Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From c93f217033ca682daee8f623c38ff3b6a121fec7 Mon Sep 17 00:00:00 2001 From: britttttk <39231115+britttttk@users.noreply.github.com> Date: Tue, 8 Jan 2019 18:32:07 -0700 Subject: [PATCH 2/5] Fix minimum registration password length --- BTCPayServer/Hosting/Startup.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BTCPayServer/Hosting/Startup.cs b/BTCPayServer/Hosting/Startup.cs index 1308ddd98..21e4b21b9 100644 --- a/BTCPayServer/Hosting/Startup.cs +++ b/BTCPayServer/Hosting/Startup.cs @@ -99,7 +99,7 @@ namespace BTCPayServer.Hosting services.Configure(options => { options.Password.RequireDigit = false; - options.Password.RequiredLength = 7; + options.Password.RequiredLength = 6; options.Password.RequireLowercase = false; options.Password.RequireNonAlphanumeric = false; options.Password.RequireUppercase = false; From 65fb2e992e79e0bc12beda0c8a0accb72660ee87 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Wed, 9 Jan 2019 17:16:52 +0900 Subject: [PATCH 3/5] Round InvoiceDue and PaidCurrency in export --- .../Services/Invoices/Export/InvoiceExport.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/BTCPayServer/Services/Invoices/Export/InvoiceExport.cs b/BTCPayServer/Services/Invoices/Export/InvoiceExport.cs index f9ad840f5..f0812b5f8 100644 --- a/BTCPayServer/Services/Invoices/Export/InvoiceExport.cs +++ b/BTCPayServer/Services/Invoices/Export/InvoiceExport.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Threading.Tasks; using BTCPayServer.Payments.Bitcoin; using BTCPayServer.Services.Invoices; +using BTCPayServer.Services.Rates; using Newtonsoft.Json; namespace BTCPayServer.Services.Invoices.Export @@ -12,10 +13,12 @@ namespace BTCPayServer.Services.Invoices.Export public class InvoiceExport { public BTCPayNetworkProvider Networks { get; } + public CurrencyNameTable Currencies { get; } - public InvoiceExport(BTCPayNetworkProvider networks) + public InvoiceExport(BTCPayNetworkProvider networks, CurrencyNameTable currencies) { Networks = networks; + Currencies = currencies; } public string Process(InvoiceEntity[] invoices, string fileFormat) { @@ -52,6 +55,7 @@ namespace BTCPayServer.Services.Invoices.Export private IEnumerable convertFromDb(InvoiceEntity invoice) { var exportList = new List(); + var currency = Currencies.GetNumberFormatInfo(invoice.ProductInformation.Currency, true); var invoiceDue = invoice.ProductInformation.Price; // in this first version we are only exporting invoices that were paid @@ -60,7 +64,6 @@ namespace BTCPayServer.Services.Invoices.Export // not accounted payments are payments which got double spent like RBfed if (!payment.Accounted) continue; - var cryptoCode = payment.GetPaymentMethodId().CryptoCode; var pdata = payment.GetCryptoPaymentData(); @@ -77,13 +80,13 @@ namespace BTCPayServer.Services.Invoices.Export PaymentType = payment.GetPaymentMethodId().PaymentType == Payments.PaymentTypes.BTCLike ? "OnChain" : "OffChain", Destination = payment.GetCryptoPaymentData().GetDestination(Networks.GetNetwork(cryptoCode)), Paid = pdata.GetValue().ToString(CultureInfo.InvariantCulture), - PaidCurrency = (pdata.GetValue() * pmethod.Rate).ToString(CultureInfo.InvariantCulture), + PaidCurrency = Math.Round(pdata.GetValue() * pmethod.Rate, currency.NumberDecimalDigits).ToString(CultureInfo.InvariantCulture), // Adding NetworkFee because Paid doesn't take into account network fees // so if fee is 10000 satoshis, customer can essentially send infinite number of tx // and merchant effectivelly would receive 0 BTC, invoice won't be paid // while looking just at export you could sum Paid and assume merchant "received payments" NetworkFee = payment.NetworkFee.ToString(CultureInfo.InvariantCulture), - InvoiceDue = invoiceDue, + InvoiceDue = Math.Round(invoiceDue, currency.NumberDecimalDigits), OrderId = invoice.OrderId, StoreId = invoice.StoreId, InvoiceId = invoice.Id, From 8f299d77916b16b97599ef7b911989946a1c1144 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Wed, 9 Jan 2019 17:25:46 +0900 Subject: [PATCH 4/5] Fix build --- BTCPayServer/Controllers/InvoiceController.UI.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BTCPayServer/Controllers/InvoiceController.UI.cs b/BTCPayServer/Controllers/InvoiceController.UI.cs index 0af59b2d2..fdf1402f2 100644 --- a/BTCPayServer/Controllers/InvoiceController.UI.cs +++ b/BTCPayServer/Controllers/InvoiceController.UI.cs @@ -493,7 +493,7 @@ namespace BTCPayServer.Controllers [BitpayAPIConstraint(false)] public async Task Export(string format, string searchTerm = null) { - var model = new InvoiceExport(_NetworkProvider); + var model = new InvoiceExport(_NetworkProvider, _CurrencyNameTable); var invoices = await ListInvoicesProcess(searchTerm, 0, int.MaxValue); var res = model.Process(invoices, format); From e29d1480a652c34459687059b5cd425bc3b8f973 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Wed, 9 Jan 2019 17:28:30 +0900 Subject: [PATCH 5/5] Add link to doc for export --- BTCPayServer/Views/Invoice/ListInvoices.cshtml | 1 + 1 file changed, 1 insertion(+) diff --git a/BTCPayServer/Views/Invoice/ListInvoices.cshtml b/BTCPayServer/Views/Invoice/ListInvoices.cshtml index c3a877d1b..315441bd9 100644 --- a/BTCPayServer/Views/Invoice/ListInvoices.cshtml +++ b/BTCPayServer/Views/Invoice/ListInvoices.cshtml @@ -49,6 +49,7 @@ +