Browse Source

monitoring incoming payment

master
Christian Rotzoll 6 years ago
parent
commit
57f679f68a
  1. 41
      home.admin/BBcreateInvoice.sh

41
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."
while :
do
read -n1 key
if [ "$key" = "y" ]; then
/home/admin/XXdisplayQR.sh
result=$(lncli --chain=${network} --network=${chain}net lookupinvoice ${rhash})
echo $result
# wait 2 seconds for key input
read -n 1 -t 2 keyPressed
# 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
shred qr.txt
rm -f qr.txt
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."
/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
fi

Loading…
Cancel
Save