From 94865815c7c6d7be1a3cb0e33cc04aa2d931d55b Mon Sep 17 00:00:00 2001 From: Kukks Date: Fri, 29 Oct 2021 14:50:18 +0200 Subject: [PATCH] Quick fixes before release --- BTCPayServer/Controllers/InvoiceController.UI.cs | 11 +++++++++-- BTCPayServer/Controllers/InvoiceController.cs | 1 + .../LightningLike/LightningLikePayoutHandler.cs | 2 +- BTCPayServer/LNURL/LNURLController.cs | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/BTCPayServer/Controllers/InvoiceController.UI.cs b/BTCPayServer/Controllers/InvoiceController.UI.cs index 250fd4f45..e31d2629a 100644 --- a/BTCPayServer/Controllers/InvoiceController.UI.cs +++ b/BTCPayServer/Controllers/InvoiceController.UI.cs @@ -236,7 +236,14 @@ namespace BTCPayServer.Controllers case RefundSteps.SelectPaymentMethod: model.RefundStep = RefundSteps.SelectRate; model.Title = "What to refund?"; - var paymentMethod = invoice.GetPaymentMethods()[paymentMethodId]; + var pms = invoice.GetPaymentMethods(); + var paymentMethod = pms.SingleOrDefault(method => method.GetId() == paymentMethodId); + + //TODO: Make this clean + if (paymentMethod is null && paymentMethodId.PaymentType == LightningPaymentType.Instance) + { + paymentMethod = pms[new PaymentMethodId(paymentMethodId.CryptoCode, PaymentTypes.LNURLPay)]; + } var cryptoPaid = paymentMethod.Calculate().Paid.ToDecimal(MoneyUnit.BTC); var paidCurrency = Math.Round(cryptoPaid * paymentMethod.Rate, @@ -335,7 +342,7 @@ namespace BTCPayServer.Controllers var ppId = await _paymentHostedService.CreatePullPayment(createPullPayment); this.TempData.SetStatusMessageModel(new StatusMessageModel() { - Html = "Refund successfully created!
Share the link to this page with a customer.
The customer needs to enter their address and claim the refund.
Once a customer claims the refund, you will get a notification and would need to approve and initiate it from your Wallet > Manage > Payouts.", + Html = "Refund successfully created!
Share the link to this page with a customer.
The customer needs to enter their address and claim the refund.
Once a customer claims the refund, you will get a notification and would need to approve and initiate it from your Store > Payouts.", Severity = StatusMessageModel.StatusSeverity.Success }); (await ctx.Invoices.FindAsync(new[] { invoice.Id }, cancellationToken: cancellationToken)).CurrentRefundId = ppId; diff --git a/BTCPayServer/Controllers/InvoiceController.cs b/BTCPayServer/Controllers/InvoiceController.cs index cbbead887..37a6dbf20 100644 --- a/BTCPayServer/Controllers/InvoiceController.cs +++ b/BTCPayServer/Controllers/InvoiceController.cs @@ -160,6 +160,7 @@ namespace BTCPayServer.Controllers { var storeBlob = store.GetStoreBlob(); var entity = _InvoiceRepository.CreateNewInvoice(); + entity.ServerUrl = serverUrl; entity.ExpirationTime = entity.InvoiceTime + (invoice.Checkout.Expiration ?? storeBlob.InvoiceExpiration); entity.MonitoringExpiration = entity.ExpirationTime + (invoice.Checkout.Monitoring ?? storeBlob.MonitoringExpiration); if (invoice.Metadata != null) diff --git a/BTCPayServer/Data/Payouts/LightningLike/LightningLikePayoutHandler.cs b/BTCPayServer/Data/Payouts/LightningLike/LightningLikePayoutHandler.cs index a725e73bb..c3aa7159c 100644 --- a/BTCPayServer/Data/Payouts/LightningLike/LightningLikePayoutHandler.cs +++ b/BTCPayServer/Data/Payouts/LightningLike/LightningLikePayoutHandler.cs @@ -75,7 +75,7 @@ namespace BTCPayServer.Data.Payouts.LightningLike catch (FormatException) { } - catch (HttpRequestException) + catch { return (null, "The LNURL / Lightning Address provided was not online."); } diff --git a/BTCPayServer/LNURL/LNURLController.cs b/BTCPayServer/LNURL/LNURLController.cs index 6c80a9125..f73c10381 100644 --- a/BTCPayServer/LNURL/LNURLController.cs +++ b/BTCPayServer/LNURL/LNURLController.cs @@ -252,7 +252,7 @@ namespace BTCPayServer }, Currency = currencyCode, Type = invoiceAmount is null ? InvoiceType.TopUp : InvoiceType.Standard, - }, store, Request.GetAbsoluteUri(""), additionalTags); + }, store, Request.GetAbsoluteRoot(), additionalTags); if (i.Type != InvoiceType.TopUp) { min = i.GetPaymentMethod(pmi).Calculate().Due.ToDecimal(MoneyUnit.Satoshi);