@@ -21,6 +21,10 @@ window.app = Vue.createApp({
2121 atmMode : false ,
2222 atmToken : '' ,
2323 nfcTagReading : false ,
24+ lnaddressDialog : {
25+ show : false ,
26+ lnaddress : ''
27+ } ,
2428 lastPaymentsDialog : {
2529 show : false ,
2630 data : [ ]
@@ -283,6 +287,29 @@ window.app = Vue.createApp({
283287 LNbits . utils . notifyApiError ( error )
284288 } )
285289 } ,
290+ lnaddressSubmit ( ) {
291+ LNbits . api
292+ . request (
293+ 'GET' ,
294+ `/tpos/api/v1/tposs/lnaddresscheck?lnaddress=${ encodeURIComponent ( this . lnaddressDialog . lnaddress ) } ` ,
295+ null
296+ )
297+ . then ( response => {
298+ if ( response . data ) {
299+ this . $q . localStorage . set (
300+ 'tpos.lnaddress' ,
301+ this . lnaddressDialog . lnaddress
302+ )
303+ this . lnaddressDialog . show = false
304+ this . lnaddress = true
305+ }
306+ } )
307+ . catch ( error => {
308+ const errorMessage =
309+ error . response ?. data ?. detail || 'An unknown error occurred.'
310+ LNbits . utils . notifyApiError ( errorMessage )
311+ } )
312+ } ,
286313 atmGetWithdraw ( ) {
287314 var dialog = this . invoiceDialog
288315 if ( this . sat > this . withdrawMaximum ) {
@@ -452,7 +479,9 @@ window.app = Vue.createApp({
452479 taxValue : this . cartTax
453480 }
454481 }
455-
482+ if ( this . lnaddress ) {
483+ params . user_lnaddress = this . lnaddressDialog . lnaddress
484+ }
456485 axios
457486 . post ( `/tpos/api/v1/tposs/${ this . tposId } /invoices` , params )
458487 . then ( response => {
@@ -630,6 +659,7 @@ window.app = Vue.createApp({
630659 . request ( 'GET' , `/tpos/api/v1/rate/${ this . currency } ` )
631660 . then ( response => {
632661 this . exchangeRate = response . data . rate
662+ console . log ( this . exchangeRate )
633663 Quasar . Loading . hide ( )
634664 } )
635665 . catch ( e => console . error ( e ) )
@@ -669,6 +699,15 @@ window.app = Vue.createApp({
669699 handleColorScheme ( val ) {
670700 this . $q . localStorage . set ( 'lnbits.tpos.color' , val )
671701 } ,
702+ clearLNaddress ( ) {
703+ this . $q . localStorage . remove ( 'tpos.lnaddress' )
704+ this . lnaddressDialog . lnaddress = ''
705+ const url = new URL ( window . location . href )
706+ url . searchParams . delete ( 'lnaddress' )
707+ window . history . replaceState ( { } , document . title , url . toString ( ) )
708+ this . lnaddressDialog . show = true
709+ this . lnaddress = false
710+ } ,
672711 extractCategories ( items ) {
673712 let categories = new Set ( )
674713 items
@@ -718,6 +757,8 @@ window.app = Vue.createApp({
718757 this . pinDisabled = tpos . withdraw_pin_disabled
719758 this . taxInclusive = tpos . tax_inclusive
720759 this . taxDefault = tpos . tax_default
760+ this . tposLNaddress = tpos . lnaddress
761+ this . tposLNaddressCut = tpos . lnaddress_cut
721762
722763 this . tip_options = tpos . tip_options == 'null' ? null : tpos . tip_options
723764
@@ -735,6 +776,23 @@ window.app = Vue.createApp({
735776 this . showPoS = false
736777 this . categories = this . extractCategories ( this . items )
737778 }
779+ if ( this . tposLNaddress ) {
780+ this . lnaddressDialog . lnaddress =
781+ this . $q . localStorage . getItem ( 'tpos.lnaddress' )
782+ if ( lnaddressparam != '' ) {
783+ this . lnaddressDialog . lnaddress = lnaddressparam
784+ this . $q . localStorage . set (
785+ 'tpos.lnaddress' ,
786+ this . lnaddressDialog . lnaddress
787+ )
788+ this . lnaddress = true
789+ } else if ( ! this . lnaddressDialog . lnaddress ) {
790+ this . lnaddress = false
791+ this . lnaddressDialog . show = true
792+ } else {
793+ this . lnaddress = true
794+ }
795+ }
738796
739797 window . addEventListener ( 'keyup' , event => {
740798 // do nothing if the event was already processed
0 commit comments