2022-11-02 10:21:33 +01:00
|
|
|
@using BTCPayServer.BIP78.Sender
|
|
|
|
@model BTCPayServer.Models.InvoicingModels.PaymentModel
|
|
|
|
|
|
|
|
<template id="bitcoin-method-checkout-template">
|
2023-02-08 07:47:38 +01:00
|
|
|
@await Component.InvokeAsync("UiExtensionPoint", new {location = "checkout-v2-bitcoin-pre-content", model = Model})
|
2022-11-02 10:21:33 +01:00
|
|
|
<div class="payment-box">
|
2023-02-10 03:23:48 +01:00
|
|
|
<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">
|
2023-01-12 02:41:33 +01:00
|
|
|
<div>
|
|
|
|
<qrcode :value="model.invoiceBitcoinUrlQR" tag="div" :options="qrOptions" />
|
|
|
|
</div>
|
|
|
|
<img class="qr-icon" :src="model.cryptoImage" :alt="model.paymentMethodName"/>
|
2022-11-24 00:53:32 +01:00
|
|
|
<small class="qr-text" id="QR_Text_@Model.PaymentMethodId" v-t="'qr_text'"></small>
|
|
|
|
</div>
|
2023-01-12 02:41:33 +01:00
|
|
|
<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>
|
2023-02-08 07:47:38 +01:00
|
|
|
<div v-if="lightning" class="input-group mt-3">
|
2023-01-12 02:41:33 +01:00
|
|
|
<div class="form-floating">
|
2023-02-08 07:47:38 +01:00
|
|
|
<input id="Lightning_@Model.PaymentMethodId" class="form-control-plaintext" readonly="readonly" :value="lightning" />
|
|
|
|
<label for="Lightning_@Model.PaymentMethodId" v-t="'lightning'"></label>
|
2023-01-12 02:41:33 +01:00
|
|
|
</div>
|
2023-02-08 07:47:38 +01:00
|
|
|
<button type="button" class="btn btn-link" data-clipboard-target="#Lightning_@Model.PaymentMethodId" :data-clipboard-confirm="$t('copy_confirm')" v-t="'copy'"></button>
|
2023-01-12 02:41:33 +01:00
|
|
|
</div>
|
2023-02-22 07:53:14 +01:00
|
|
|
<a v-if="model.invoiceBitcoinUrl" class="btn btn-primary rounded-pill w-100 mt-4" target="_top" id="PayInWallet"
|
2022-11-24 00:53:32 +01:00
|
|
|
:href="model.invoiceBitcoinUrl" :title="$t(hasPayjoin ? 'BIP21 payment link with PayJoin support' : 'BIP21 payment link')" v-t="'pay_in_wallet'"></a>
|
2023-02-08 07:47:38 +01:00
|
|
|
@await Component.InvokeAsync("UiExtensionPoint", new {location = "checkout-v2-bitcoin-post-content", model = Model})
|
2022-11-02 10:21:33 +01:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
Vue.component('BitcoinLikeMethodCheckout', {
|
2022-11-24 00:53:32 +01:00
|
|
|
props: ["model"],
|
2022-11-02 10:21:33 +01:00
|
|
|
template: "#bitcoin-method-checkout-template",
|
|
|
|
components: {
|
|
|
|
qrcode: VueQrcode
|
|
|
|
},
|
2022-11-24 00:53:32 +01:00
|
|
|
data () {
|
|
|
|
// currentTab is needed for backwards-compatibility with old plugin versions
|
|
|
|
return { currentTab: undefined };
|
|
|
|
},
|
2022-11-02 10:21:33 +01:00
|
|
|
computed: {
|
|
|
|
hasPayjoin () {
|
2022-11-24 00:53:32 +01:00
|
|
|
return this.model.invoiceBitcoinUrl.indexOf('@PayjoinClient.BIP21EndpointKey=') !== -1;
|
2023-01-12 02:41:33 +01:00
|
|
|
},
|
2023-02-08 07:47:38 +01:00
|
|
|
lightning () {
|
|
|
|
const match = this.model.invoiceBitcoinUrl.match(/[&?]lightning=(.*)&?/i);
|
2023-01-12 02:41:33 +01:00
|
|
|
return match ? match[1].toLowerCase() : null;
|
2022-11-02 10:21:33 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|