diff --git a/home.admin/BBcreateInvoice.sh b/home.admin/BBcreateInvoice.sh index e7e712d..d75d508 100755 --- a/home.admin/BBcreateInvoice.sh +++ b/home.admin/BBcreateInvoice.sh @@ -66,7 +66,6 @@ else # echo "******************************" # echo "${result}" - rhash=$(echo "$result" | grep r_hash | cut -d '"' -f4) payReq=$(echo "$result" | grep pay_req | cut -d '"' -f4) echo -e "${payReq}" > qr.txt @@ -77,32 +76,36 @@ else echo "Here is your invoice" echo "********************" echo + ./XXaptInstall.sh qrencode + qrencode -t ANSI256 < /home/admin/qr.txt + echo echo "Give this Invoice/PaymentRequest to someone to pay it:" echo echo "${payReq}" echo - echo "Do you want to see the invoice QR-code in this terminal? (Y/N)" + echo "Monitoring Incomming Payment with:" + echo "lncli --chain=${network} --network=${chain}net lookupinvoice ${rhash}" + echo "Press x and hold to skip to menu." - read -n1 key - if [ "$key" = "y" ]; then - /home/admin/XXdisplayQR.sh - fi + while : + do - shred qr.txt - rm -f qr.txt + result=$(lncli --chain=${network} --network=${chain}net lookupinvoice ${rhash}) + echo $result + + # wait 2 seconds for key input + read -n 1 -t 2 keyPressed - clear - echo "************" - echo "What's next?" - echo "************" - echo - echo "You can use" - echo - echo "lncli --chain=${network} --network=${chain}net lookupinvoice ${rhash}" - echo - echo "to check the payment." + # check if user wants to abort session + if [ "${keyPressed}" = "x" ]; then + echo "Returning to menu - invoice is still valid." + break + fi + + done /home/admin/XXdisplayQRlcd_hide.sh - # TODO: Offer to go into monitor for incommin payment loop. - # Or simply start the loop and show success status when payment occured + shred qr.txt + rm -f qr.txt + fi