2022-11-02 10:21:33 +01:00
|
|
|
@using BTCPayServer.BIP78.Sender
|
2023-05-05 10:00:55 +02:00
|
|
|
@using BTCPayServer.Components.TruncateCenter
|
|
|
|
@using BTCPayServer.Abstractions.TagHelpers
|
2022-11-02 10:21:33 +01:00
|
|
|
@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-03-19 21:43:38 +01:00
|
|
|
<div v-if="model.invoiceBitcoinUrlQR" class="qr-container" :data-qr-value="model.invoiceBitcoinUrlQR" :data-clipboard="model.btcAddress">
|
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
|
|
|
</div>
|
2023-01-12 02:41:33 +01:00
|
|
|
<div v-if="model.btcAddress" class="input-group mt-3">
|
2023-05-05 10:00:55 +02:00
|
|
|
<div class="form-floating" id="Address_@Model.PaymentMethodId">
|
|
|
|
<vc:truncate-center text="model.btcAddress" is-vue="true" padding="15" elastic="true" classes="form-control-plaintext" />
|
|
|
|
<label v-t="{ path: 'address', args: { paymentMethod: model.paymentMethodName }}"></label>
|
2023-01-12 02:41:33 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2023-02-08 07:47:38 +01:00
|
|
|
<div v-if="lightning" class="input-group mt-3">
|
2023-05-05 10:00:55 +02:00
|
|
|
<div class="form-floating" id="Lightning_@Model.PaymentMethodId">
|
|
|
|
<vc:truncate-center text="lightning" is-vue="true" padding="15" elastic="true" classes="form-control-plaintext" />
|
|
|
|
<label v-t="'lightning'"></label>
|
2023-01-12 02:41:33 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2023-08-24 06:37:27 +02:00
|
|
|
<a v-if="model.invoiceBitcoinUrl && model.showPayInWalletButton" class="btn btn-primary rounded-pill w-100 mt-4" 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>
|