Remove useless properties

This commit is contained in:
nicolas.dorier
2024-10-07 15:49:56 +09:00
parent 0a2d8880ba
commit ef0ba7b0c4
12 changed files with 14 additions and 54 deletions

View File

@@ -711,21 +711,6 @@ namespace BTCPayServer.Controllers
return View(model); return View(model);
} }
[HttpGet("invoice-noscript")]
public async Task<IActionResult> CheckoutNoScript(string? invoiceId, string? id = null, string? paymentMethodId = null, [FromQuery] string? lang = null)
{
//Keep compatibility with Bitpay
invoiceId = invoiceId ?? id;
//
if (invoiceId is null)
return NotFound();
var model = await GetInvoiceModel(invoiceId, paymentMethodId is null ? null : PaymentMethodId.Parse(paymentMethodId), lang);
if (model == null)
return NotFound();
return View(model);
}
private async Task<PaymentModel?> GetInvoiceModel(string invoiceId, PaymentMethodId? paymentMethodId, string? lang) private async Task<PaymentModel?> GetInvoiceModel(string invoiceId, PaymentMethodId? paymentMethodId, string? lang)
{ {
var invoice = await _InvoiceRepository.GetInvoice(invoiceId); var invoice = await _InvoiceRepository.GetInvoice(invoiceId);

View File

@@ -13,7 +13,6 @@ namespace BTCPayServer.Payments.Bitcoin
context.RegisterCheckoutUI(new CheckoutUIPaymentMethodSettings context.RegisterCheckoutUI(new CheckoutUIPaymentMethodSettings
{ {
ExtensionPartial = "Bitcoin/BitcoinLikeMethodCheckout", ExtensionPartial = "Bitcoin/BitcoinLikeMethodCheckout",
CheckoutBodyVueComponentName = "BitcoinLikeMethodCheckout"
}); });
} }
} }

View File

@@ -63,6 +63,5 @@ namespace BTCPayServer.Payments
public class CheckoutUIPaymentMethodSettings public class CheckoutUIPaymentMethodSettings
{ {
public string? ExtensionPartial { get; set; } public string? ExtensionPartial { get; set; }
public string? CheckoutBodyVueComponentName { get; set; }
} }
} }

View File

@@ -16,8 +16,7 @@ namespace BTCPayServer.Payments.LNURLPay
context.RegisterPaymentMethodDetails("LNURL/AdditionalPaymentMethodDetails"); context.RegisterPaymentMethodDetails("LNURL/AdditionalPaymentMethodDetails");
context.RegisterCheckoutUI(new CheckoutUIPaymentMethodSettings() context.RegisterCheckoutUI(new CheckoutUIPaymentMethodSettings()
{ {
ExtensionPartial = "Lightning/LightningLikeMethodCheckout", ExtensionPartial = "Lightning/LightningLikeMethodCheckout"
CheckoutBodyVueComponentName = "LightningLikeMethodCheckout"
}); });
} }
} }

View File

@@ -12,8 +12,7 @@ namespace BTCPayServer.Payments.Lightning
{ {
context.RegisterCheckoutUI(new CheckoutUIPaymentMethodSettings() context.RegisterCheckoutUI(new CheckoutUIPaymentMethodSettings()
{ {
ExtensionPartial = "Lightning/LightningLikeMethodCheckout", ExtensionPartial = "Lightning/LightningLikeMethodCheckout"
CheckoutBodyVueComponentName = "LightningLikeMethodCheckout"
}); });
} }
} }

View File

@@ -112,8 +112,7 @@ namespace BTCPayServer.Services.Altcoins.Monero.Payments
{ {
return new CheckoutUIPaymentMethodSettings return new CheckoutUIPaymentMethodSettings
{ {
ExtensionPartial = "Bitcoin/BitcoinLikeMethodCheckout", ExtensionPartial = "Bitcoin/BitcoinLikeMethodCheckout"
CheckoutBodyVueComponentName = "BitcoinLikeMethodCheckout"
}; };
} }

View File

@@ -3,7 +3,7 @@
@using BTCPayServer.Abstractions.TagHelpers @using BTCPayServer.Abstractions.TagHelpers
@model BTCPayServer.Models.InvoicingModels.PaymentModel @model BTCPayServer.Models.InvoicingModels.PaymentModel
<template id="bitcoin-method-checkout-template"> <template id="checkout-template">
@await Component.InvokeAsync("UiExtensionPoint", new {location = "checkout-bitcoin-pre-content", model = Model}) @await Component.InvokeAsync("UiExtensionPoint", new {location = "checkout-bitcoin-pre-content", model = Model})
<div class="payment-box"> <div class="payment-box">
<div v-if="model.invoiceBitcoinUrlQR" class="qr-container" :data-qr-value="model.invoiceBitcoinUrlQR" :data-clipboard="model.invoiceBitcoinUrl" data-clipboard-confirm-element="#Address_@Model.PaymentMethodId [data-clipboard]"> <div v-if="model.invoiceBitcoinUrlQR" class="qr-container" :data-qr-value="model.invoiceBitcoinUrlQR" :data-clipboard="model.invoiceBitcoinUrl" data-clipboard-confirm-element="#Address_@Model.PaymentMethodId [data-clipboard]">
@@ -31,9 +31,9 @@
</template> </template>
<script> <script>
Vue.component('BitcoinLikeMethodCheckout', { Vue.component('checkout-template', {
props: ['model', 'nfcSupported', 'nfcScanning', 'nfcErrorMessage'], props: ['model', 'nfcSupported', 'nfcScanning', 'nfcErrorMessage'],
template: "#bitcoin-method-checkout-template", template: "#checkout-template",
components: { components: {
qrcode: VueQrcode qrcode: VueQrcode
}, },

View File

@@ -1,8 +0,0 @@
@model PaymentModel
<div>
<p>To complete payment, please send <b>@(Model.IsUnsetTopUp ? "any amount of" : Model.BtcDue) @Model.CryptoCode</b> to <b style="word-break: break-word;">@Model.BtcAddress</b></p>
<p>Time remaining: @Model.TimeLeft</p>
<p>
<a href="@Model.InvoiceBitcoinUrl" style="word-break: break-word;" rel="noreferrer noopener">@Model.InvoiceBitcoinUrl</a>
</p>
</div>

View File

@@ -1,6 +1,6 @@
@model BTCPayServer.Models.InvoicingModels.PaymentModel @model BTCPayServer.Models.InvoicingModels.PaymentModel
<template id="lightning-method-checkout-template"> <template id="checkout-template">
<div class="payment-box"> <div class="payment-box">
@await Component.InvokeAsync("UiExtensionPoint" , new { location="checkout-lightning-pre-content", model = Model}) @await Component.InvokeAsync("UiExtensionPoint" , new { location="checkout-lightning-pre-content", model = Model})
<div v-if="model.invoiceBitcoinUrlQR" class="qr-container" :data-qr-value="model.invoiceBitcoinUrlQR" :data-clipboard="model.invoiceBitcoinUrl" data-clipboard-confirm-element="#Lightning_@Model.PaymentMethodId [data-clipboard]"> <div v-if="model.invoiceBitcoinUrlQR" class="qr-container" :data-qr-value="model.invoiceBitcoinUrlQR" :data-clipboard="model.invoiceBitcoinUrl" data-clipboard-confirm-element="#Lightning_@Model.PaymentMethodId [data-clipboard]">
@@ -23,9 +23,9 @@
</template> </template>
<script> <script>
Vue.component('LightningLikeMethodCheckout', { Vue.component('checkout-template', {
props: ['model', 'nfcSupported', 'nfcScanning', 'nfcErrorMessage'], props: ['model', 'nfcSupported', 'nfcScanning', 'nfcErrorMessage'],
template: "#lightning-method-checkout-template", template: "#checkout-template",
components: { components: {
qrcode: VueQrcode qrcode: VueQrcode
}, },

View File

@@ -1,12 +0,0 @@
@model PaymentModel
<div>
<p>To complete payment, please send <b>@Model.BtcDue @Model.CryptoCode</b> to <b style="word-break: break-word;">@Model.BtcAddress</b></p>
<p>Time remaining: @Model.TimeLeft</p>
<p>
<a href="@Model.InvoiceBitcoinUrl" style="word-break: break-word;" rel="noreferrer noopener">@Model.InvoiceBitcoinUrl</a>
</p>
@if (!string.IsNullOrEmpty(Model.PeerInfo))
{
<p>Peer Info: <b>@Model.PeerInfo</b></p>
}
</div>

View File

@@ -17,7 +17,7 @@
@functions { @functions {
private string ToJsValue(object value) private string ToJsValue(object value)
{ {
return Safe.Json(value).ToString()?.Replace("\"", "'"); return Safe.Json(value?.ToString()).ToString()?.Replace("\"", "'");
} }
} }
<!DOCTYPE html> <!DOCTYPE html>
@@ -108,7 +108,7 @@
</div> </div>
</div> </div>
} }
<component v-if="paymentMethodComponent" :is="paymentMethodComponent" <component v-if="paymentMethodComponent" :is="paymentMethodComponent"
:model="srvModel" :model="srvModel"
:nfc-scanning="nfc.scanning" :nfc-scanning="nfc.scanning"
:nfc-supported="nfc.supported" :nfc-supported="nfc.supported"

View File

@@ -152,7 +152,7 @@ function initApp() {
btcPaid () { btcPaid () {
return this.asNumber(this.srvModel.btcPaid); return this.asNumber(this.srvModel.btcPaid);
}, },
pmId () { pmId() {
return this.paymentMethodId || this.srvModel.paymentMethodId; return this.paymentMethodId || this.srvModel.paymentMethodId;
}, },
minutesLeft () { minutesLeft () {
@@ -174,10 +174,10 @@ function initApp() {
paymentMethodIds () { paymentMethodIds () {
return this.srvModel.availableCryptos.map(function (c) { return c.paymentMethodId }); return this.srvModel.availableCryptos.map(function (c) { return c.paymentMethodId });
}, },
paymentMethodComponent () { paymentMethodComponent() {
return this.isPluginPaymentMethod return this.isPluginPaymentMethod
? `${this.pmId}Checkout` ? `${this.pmId}Checkout`
: this.srvModel.activated && this.srvModel.uiSettings.checkoutBodyVueComponentName; : this.srvModel.activated && 'checkout-template';
}, },
isPluginPaymentMethod () { isPluginPaymentMethod () {
return !this.paymentMethodIds.includes(this.pmId); return !this.paymentMethodIds.includes(this.pmId);