mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-25 15:10:00 +01:00
* Checkout: Allow NFC/LNURL-W whenever LNURL is available With what we have in master right now, we display NFC only for top-up invoices. With these changes, we display NFC in all cases, where LNURL is available. Note that this hides LNURL from the list of selectable payment methods, it's only available to use the NFC — and explicitely selectable only for the edge case of top-up invoice + non-unified QR (as before). Rationale: Now that we got NFC tightly integrated, it doesn't make sense to support the NFC experience only for top-up invoices. With this we bring back LNURL for regular invoices as well, but don't make it selectable and use it only for the NFC functionality. * Fix LNURL condition * Improve and test NFC/LNURL display condition Restores what was fixed in #4660. * Fix and test Lightning-only case * Add cache busting for locales
55 lines
3.1 KiB
Text
55 lines
3.1 KiB
Text
@using BTCPayServer.BIP78.Sender
|
|
@model BTCPayServer.Models.InvoicingModels.PaymentModel
|
|
|
|
<template id="bitcoin-method-checkout-template">
|
|
@await Component.InvokeAsync("UiExtensionPoint", new {location = "checkout-v2-bitcoin-pre-content", model = Model})
|
|
<div class="payment-box">
|
|
<div v-if="model.invoiceBitcoinUrlQR" class="qr-container" :data-qr-value="model.invoiceBitcoinUrlQR" :data-clipboard="model.btcAddress" data-clipboard-confirm-element="QR_Text_@Model.PaymentMethodId">
|
|
<div>
|
|
<qrcode :value="model.invoiceBitcoinUrlQR" tag="div" :options="qrOptions" />
|
|
</div>
|
|
<img class="qr-icon" :src="model.cryptoImage" :alt="model.paymentMethodName"/>
|
|
<small class="qr-text" id="QR_Text_@Model.PaymentMethodId" v-t="'qr_text'"></small>
|
|
</div>
|
|
<div v-if="model.btcAddress" class="input-group mt-3">
|
|
<div class="form-floating">
|
|
<input id="Address_@Model.PaymentMethodId" class="form-control-plaintext" readonly="readonly" :value="model.btcAddress">
|
|
<label for="Address_@Model.PaymentMethodId" v-t="{ path: 'address', args: { paymentMethod: model.paymentMethodName }}"></label>
|
|
</div>
|
|
<button type="button" class="btn btn-link" data-clipboard-target="#Address_@Model.PaymentMethodId" :data-clipboard-confirm="$t('copy_confirm')" v-t="'copy'"></button>
|
|
</div>
|
|
<div v-if="lightning" class="input-group mt-3">
|
|
<div class="form-floating">
|
|
<input id="Lightning_@Model.PaymentMethodId" class="form-control-plaintext" readonly="readonly" :value="lightning" />
|
|
<label for="Lightning_@Model.PaymentMethodId" v-t="'lightning'"></label>
|
|
</div>
|
|
<button type="button" class="btn btn-link" data-clipboard-target="#Lightning_@Model.PaymentMethodId" :data-clipboard-confirm="$t('copy_confirm')" v-t="'copy'"></button>
|
|
</div>
|
|
<a v-if="model.invoiceBitcoinUrl" class="btn btn-primary rounded-pill w-100 mt-4" target="_top" id="PayInWallet"
|
|
:href="model.invoiceBitcoinUrl" :title="$t(hasPayjoin ? 'BIP21 payment link with PayJoin support' : 'BIP21 payment link')" v-t="'pay_in_wallet'"></a>
|
|
@await Component.InvokeAsync("UiExtensionPoint", new {location = "checkout-v2-bitcoin-post-content", model = Model})
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
Vue.component('BitcoinLikeMethodCheckout', {
|
|
props: ["model"],
|
|
template: "#bitcoin-method-checkout-template",
|
|
components: {
|
|
qrcode: VueQrcode
|
|
},
|
|
data () {
|
|
// currentTab is needed for backwards-compatibility with old plugin versions
|
|
return { currentTab: undefined };
|
|
},
|
|
computed: {
|
|
hasPayjoin () {
|
|
return this.model.invoiceBitcoinUrl.indexOf('@PayjoinClient.BIP21EndpointKey=') !== -1;
|
|
},
|
|
lightning () {
|
|
const match = this.model.invoiceBitcoinUrl.match(/[&?]lightning=(.*)&?/i);
|
|
return match ? match[1].toLowerCase() : null;
|
|
}
|
|
}
|
|
});
|
|
</script>
|