mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-03-13 11:35:51 +01:00
Merge pull request #6288 from NicolasDorier/bettershowwarnings
Show warnings if NFC payment isn't complete
This commit is contained in:
commit
d50d2f9ca0
6 changed files with 19 additions and 5 deletions
|
@ -33,7 +33,7 @@
|
|||
|
||||
<script>
|
||||
Vue.component(@Safe.Json(BitcoinCheckoutModelExtension.CheckoutBodyComponentName), {
|
||||
props: ['model', 'nfcSupported', 'nfcScanning', 'nfcErrorMessage'],
|
||||
props: ['model', 'nfcSupported', 'nfcScanning', 'nfcErrorMessage', 'nfcWarningMessage'],
|
||||
template: @Safe.Json("#" + BitcoinCheckoutModelExtension.CheckoutBodyComponentName),
|
||||
components: {
|
||||
qrcode: VueQrcode
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
<script>
|
||||
Vue.component(@Safe.Json(LNCheckoutModelExtension.CheckoutBodyComponentName), {
|
||||
props: ['model', 'nfcSupported', 'nfcScanning', 'nfcErrorMessage'],
|
||||
props: ['model', 'nfcSupported', 'nfcScanning', 'nfcErrorMessage', 'nfcWarningMessage'],
|
||||
template: @Safe.Json("#" + LNCheckoutModelExtension.CheckoutBodyComponentName),
|
||||
components: {
|
||||
qrcode: VueQrcode
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<template id="lnurl-withdraw-template">
|
||||
<div v-if="display" class="mt-4" id="NFC">
|
||||
<div v-if="nfcErrorMessage" class="alert alert-danger" v-text="nfcErrorMessage"></div>
|
||||
<div v-if="nfcWarningMessage" class="alert alert-warning" v-text="nfcWarningMessage"></div>
|
||||
<button class="btn btn-secondary rounded-pill w-100" type="button" id="PayByNFC"
|
||||
:disabled="nfcScanning || submitting" v-on:click="handleClick">{{btnText}}</button>
|
||||
</div>
|
||||
|
@ -12,7 +13,8 @@ Vue.component("lnurl-withdraw-checkout", {
|
|||
model: Object,
|
||||
nfcSupported: Boolean,
|
||||
nfcScanning: Boolean,
|
||||
nfcErrorMessage: String
|
||||
nfcErrorMessage: String,
|
||||
nfcWarningMessage: String
|
||||
},
|
||||
computed: {
|
||||
display () {
|
||||
|
|
|
@ -1 +1,7 @@
|
|||
<lnurl-withdraw-checkout :model="model" :nfc-supported="nfcSupported" :nfc-scanning="nfcScanning" :nfc-error-message="nfcErrorMessage" v-on="$listeners" />
|
||||
<lnurl-withdraw-checkout
|
||||
:model="model"
|
||||
:nfc-supported="nfcSupported"
|
||||
:nfc-scanning="nfcScanning"
|
||||
:nfc-error-message="nfcErrorMessage"
|
||||
:nfc-warning-message="nfcWarningMessage"
|
||||
v-on="$listeners" />
|
||||
|
|
|
@ -113,6 +113,7 @@
|
|||
:nfc-scanning="nfc.scanning"
|
||||
:nfc-supported="nfc.supported"
|
||||
:nfc-error-message="nfc.errorMessage"
|
||||
:nfc-warning-message="nfc.warningMessage"
|
||||
v-on:start-nfc-scan="startNFCScan"
|
||||
v-on:handle-nfc-data="handleNFCData"
|
||||
v-on:handle-nfc-error="handleNFCError"
|
||||
|
|
|
@ -110,6 +110,7 @@ function initApp() {
|
|||
scanning: false,
|
||||
submitting: false,
|
||||
errorMessage: null,
|
||||
warningMessage: null,
|
||||
permissionGranted: false,
|
||||
readerAbortController: null
|
||||
}
|
||||
|
@ -436,9 +437,13 @@ function initApp() {
|
|||
this.playSound('nfcRead');
|
||||
this.$set(this.nfc, 'submitting', true);
|
||||
this.$set(this.nfc, 'errorMessage', null);
|
||||
this.$set(this.nfc, 'warningMessage', null);
|
||||
},
|
||||
handleNFCResult() { // child component reports result for handling the data
|
||||
handleNFCResult(message) { // child component reports result for handling the data
|
||||
this.$set(this.nfc, 'submitting', false);
|
||||
if (message) {
|
||||
this.$set(this.nfc, 'warningMessage', message);
|
||||
}
|
||||
},
|
||||
handleNFCError(message) {
|
||||
// internal or via child component reporting failure of handling the data
|
||||
|
|
Loading…
Add table
Reference in a new issue