Rename more legacy fields

This commit is contained in:
nicolas.dorier 2024-10-07 21:14:37 +09:00
parent 968223a953
commit 68f24e47cd
No known key found for this signature in database
GPG Key ID: 6618763EF09186FE
8 changed files with 13 additions and 17 deletions

View File

@ -322,7 +322,7 @@ namespace BTCPayServer.Tests
var checkout =
(Models.InvoicingModels.CheckoutModel)((JsonResult)controller.GetStatus(invoice.Id)
.GetAwaiter().GetResult()).Value;
Assert.Single(checkout.AvailableCryptos);
Assert.Single(checkout.AvailablePaymentMethods);
Assert.Equal("LTC", checkout.PaymentMethodCurrency);
//////////////////////
@ -477,7 +477,7 @@ namespace BTCPayServer.Tests
var checkout =
(Models.InvoicingModels.CheckoutModel)((JsonResult)controller.GetStatus(invoice.Id, null)
.GetAwaiter().GetResult()).Value;
Assert.Single(checkout.AvailableCryptos);
Assert.Single(checkout.AvailablePaymentMethods);
Assert.Equal("BTC", checkout.PaymentMethodCurrency);
Assert.Single(invoice.PaymentCodes);
@ -538,7 +538,7 @@ namespace BTCPayServer.Tests
controller = tester.PayTester.GetController<UIInvoiceController>(null);
checkout = (Models.InvoicingModels.CheckoutModel)((JsonResult)controller.GetStatus(invoice.Id, "LTC")
.GetAwaiter().GetResult()).Value;
Assert.Equal(2, checkout.AvailableCryptos.Count);
Assert.Equal(2, checkout.AvailablePaymentMethods.Count);
Assert.Equal("LTC", checkout.PaymentMethodCurrency);
Assert.Equal(2, invoice.PaymentCodes.Count());

View File

@ -910,11 +910,11 @@ namespace BTCPayServer.Controllers
// The Tweak is part of the PaymentMethodFee, but let's not show it in the UI as it's negligible.
NetworkFee = prompt.PaymentMethodFee - prompt.TweakFee,
StoreId = store.Id,
AvailableCryptos = invoice.GetPaymentPrompts()
AvailablePaymentMethods = invoice.GetPaymentPrompts()
.Select(kv =>
{
var handler = _handlers[kv.PaymentMethodId];
return new CheckoutModel.AvailableCrypto
return new CheckoutModel.AvailablePaymentMethod
{
Displayed = displayedPaymentMethods.Contains(kv.PaymentMethodId),
PaymentMethodId = kv.PaymentMethodId,

View File

@ -10,7 +10,7 @@ namespace BTCPayServer.Models.InvoicingModels
public class CheckoutModel
{
public string CheckoutBodyComponentName { get; set; }
public class AvailableCrypto
public class AvailablePaymentMethod
{
[JsonConverter(typeof(PaymentMethodIdJsonConverter))]
public PaymentMethodId PaymentMethodId { get; set; }
@ -29,7 +29,7 @@ namespace BTCPayServer.Models.InvoicingModels
public string DefaultLang { get; set; }
public bool ShowPayInWalletButton { get; set; }
public bool ShowStoreHeader { get; set; }
public List<AvailableCrypto> AvailableCryptos { get; set; } = new();
public List<AvailablePaymentMethod> AvailablePaymentMethods { get; set; } = new();
public bool IsModal { get; set; }
public bool IsUnsetTopUp { get; set; }
public bool OnChainWithLnInvoiceFallback { get; set; }

View File

@ -15,12 +15,9 @@ namespace BTCPayServer.Plugins.NFC
public override void Execute(IServiceCollection applicationBuilder)
{
applicationBuilder.AddSingleton<IUIExtension>(new UIExtension("NFC/CheckoutEnd",
"checkout-end"));
applicationBuilder.AddSingleton<IUIExtension>(new UIExtension("NFC/LNURLNFCPostContent",
"checkout-lightning-post-content"));
applicationBuilder.AddSingleton<IUIExtension>(new UIExtension("NFC/LNURLNFCPostContent",
"checkout-bitcoin-post-content"));
applicationBuilder.AddUIExtension("checkout-end", "NFC/CheckoutEnd");
applicationBuilder.AddUIExtension("checkout-lightning-post-content", "NFC/LNURLNFCPostContent");
applicationBuilder.AddUIExtension("checkout-bitcoin-post-content", "NFC/LNURLNFCPostContent");
base.Execute(applicationBuilder);
}
}

View File

@ -19,7 +19,7 @@ Vue.component("lnurl-withdraw-checkout", {
const {
onChainWithLnInvoiceFallback: isUnified,
paymentMethodId: activePaymentMethodId,
availableCryptos: availablePaymentMethods,
availablePaymentMethods: availablePaymentMethods,
invoiceBitcoinUrl: paymentUrl
} = this.model
const lnurlwAvailable =

View File

@ -12,7 +12,7 @@
ViewData["StoreBranding"] = Model.StoreBranding;
Csp.UnsafeEval();
var hasPaymentPlugins = UiExtensions.Any(extension => extension.Location == "checkout-payment-method");
var displayedPaymentMethods = Model.AvailableCryptos.Where(c => c.Displayed).ToList();
var displayedPaymentMethods = Model.AvailablePaymentMethods.Where(c => c.Displayed).ToList();
}
@functions {
private string ToJsValue(object value)

View File

@ -1,7 +1,6 @@
@model CheckoutModel
@{
Layout = null;
var displayedPaymentMethods = Model.AvailableCryptos.Where(a => a.Displayed).ToList();
}
<!DOCTYPE html>
<html>

View File

@ -172,7 +172,7 @@ function initApp() {
: null;
},
paymentMethodIds () {
return this.srvModel.availableCryptos.map(function (c) { return c.paymentMethodId });
return this.srvModel.availablePaymentMethod.map(function (c) { return c.paymentMethodId });
},
paymentMethodComponent() {
return this.isPluginPaymentMethod