Quick fixes before release

This commit is contained in:
Kukks 2021-10-29 14:50:18 +02:00
parent 33754933d5
commit 94865815c7
4 changed files with 12 additions and 4 deletions

View file

@ -236,7 +236,14 @@ namespace BTCPayServer.Controllers
case RefundSteps.SelectPaymentMethod: case RefundSteps.SelectPaymentMethod:
model.RefundStep = RefundSteps.SelectRate; model.RefundStep = RefundSteps.SelectRate;
model.Title = "What to refund?"; 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 cryptoPaid = paymentMethod.Calculate().Paid.ToDecimal(MoneyUnit.BTC);
var paidCurrency = var paidCurrency =
Math.Round(cryptoPaid * paymentMethod.Rate, Math.Round(cryptoPaid * paymentMethod.Rate,
@ -335,7 +342,7 @@ namespace BTCPayServer.Controllers
var ppId = await _paymentHostedService.CreatePullPayment(createPullPayment); var ppId = await _paymentHostedService.CreatePullPayment(createPullPayment);
this.TempData.SetStatusMessageModel(new StatusMessageModel() this.TempData.SetStatusMessageModel(new StatusMessageModel()
{ {
Html = "Refund successfully created!<br />Share the link to this page with a customer.<br />The customer needs to enter their address and claim the refund.<br />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!<br />Share the link to this page with a customer.<br />The customer needs to enter their address and claim the refund.<br />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 Severity = StatusMessageModel.StatusSeverity.Success
}); });
(await ctx.Invoices.FindAsync(new[] { invoice.Id }, cancellationToken: cancellationToken)).CurrentRefundId = ppId; (await ctx.Invoices.FindAsync(new[] { invoice.Id }, cancellationToken: cancellationToken)).CurrentRefundId = ppId;

View file

@ -160,6 +160,7 @@ namespace BTCPayServer.Controllers
{ {
var storeBlob = store.GetStoreBlob(); var storeBlob = store.GetStoreBlob();
var entity = _InvoiceRepository.CreateNewInvoice(); var entity = _InvoiceRepository.CreateNewInvoice();
entity.ServerUrl = serverUrl;
entity.ExpirationTime = entity.InvoiceTime + (invoice.Checkout.Expiration ?? storeBlob.InvoiceExpiration); entity.ExpirationTime = entity.InvoiceTime + (invoice.Checkout.Expiration ?? storeBlob.InvoiceExpiration);
entity.MonitoringExpiration = entity.ExpirationTime + (invoice.Checkout.Monitoring ?? storeBlob.MonitoringExpiration); entity.MonitoringExpiration = entity.ExpirationTime + (invoice.Checkout.Monitoring ?? storeBlob.MonitoringExpiration);
if (invoice.Metadata != null) if (invoice.Metadata != null)

View file

@ -75,7 +75,7 @@ namespace BTCPayServer.Data.Payouts.LightningLike
catch (FormatException) catch (FormatException)
{ {
} }
catch (HttpRequestException) catch
{ {
return (null, "The LNURL / Lightning Address provided was not online."); return (null, "The LNURL / Lightning Address provided was not online.");
} }

View file

@ -252,7 +252,7 @@ namespace BTCPayServer
}, },
Currency = currencyCode, Currency = currencyCode,
Type = invoiceAmount is null ? InvoiceType.TopUp : InvoiceType.Standard, Type = invoiceAmount is null ? InvoiceType.TopUp : InvoiceType.Standard,
}, store, Request.GetAbsoluteUri(""), additionalTags); }, store, Request.GetAbsoluteRoot(), additionalTags);
if (i.Type != InvoiceType.TopUp) if (i.Type != InvoiceType.TopUp)
{ {
min = i.GetPaymentMethod(pmi).Calculate().Due.ToDecimal(MoneyUnit.Satoshi); min = i.GetPaymentMethod(pmi).Calculate().Due.ToDecimal(MoneyUnit.Satoshi);