thiswebshoprules

git clone https://git.tarina.org/thiswebshoprules
Log | Files | Refs

payln.html (2955B)


      1 $def with (lninvoice,invoice,bag,productname,digitalkey,db,getprice,getrate,ordertype,pendinginfo,eur_to_sat)
      2 $ qr = '/static/qr/' + invoice['invoice_key'] + '.png'
      3 <script>
      4 function copy() {
      5   let textarea = document.getElementById("payreq");
      6   textarea.select();
      7   document.execCommand("copy");
      8 }
      9 </script>
     10 
     11 <div id="container">
     12 <br>
     13 <br>
     14 $if lninvoice['status'] != 'paid':
     15     <meta http-equiv="refresh" content="30" />
     16     <a href="/checkout">Go back!</a>
     17     <br>
     18     <h2>Pay with Bitcoin Lightning</h2>
     19 $else:
     20     <h3>Payment recieved!</h3>
     21     $if digitalkey:
     22         <p>link to your digital goodies is in your mail!</p><br>
     23     <img src="/static/jamesfrancothanks.gif" style="width:300px"><br>
     24     <a href="/">Back to beginning</a>
     25     <br>
     26 in your order:<br> 
     27 $ totsats=0
     28 $ toteuro=0
     29 $for i in bag: 
     30     $ goodies = db.query("SELECT * FROM soundlink WHERE id='" +i.product+"';")
     31     $code:
     32         price = getprice(i.product)
     33         quantity = i.quantity
     34         p_totsats=i.quantity*price[0]
     35         p_toteuro=i.quantity*price[1]
     36     $i.quantity x $productname(i.product)
     37     $p_totsats $p_toteuro&euro;<br>
     38     $for g in goodies:
     39         $if g.soundname[-5:] == '.jpeg' or g.soundname[-4:] == '.png':
     40             <img src="/static/img/thumb/$g.soundname" style="width:120px">
     41             <br>
     42     $code:
     43         totsats += p_totsats
     44         toteuro += p_toteuro
     45 
     46 $if ordertype() == 'digital':
     47     <h2>Digital goods will be shipped to your email once invoice paid..</h2>
     48 $else:
     49     $ shippinginfo = db.select('shipping', where="country='" + pendinginfo.country + "'", what='price, days')[0]
     50     Shipping cost to $pendinginfo.country is <br>$eur_to_sat(shippinginfo.price) Satoshi or ~ $(shippinginfo.price/100)&euro; <br>
     51     Shipping estimate is $shippinginfo.days days<br>
     52     $code:
     53         totsats += eur_to_sat(shippinginfo.price)
     54         toteuro += shippinginfo.price/100
     55     <pre>
     56     First Name: $pendinginfo.firstname
     57     Last Name: $pendinginfo.lastname
     58     Country: $pendinginfo.country
     59     Address: $pendinginfo.address
     60     Town: $pendinginfo.town
     61     Postalcode: $pendinginfo.postalcode
     62     Email: $pendinginfo.email
     63     </pre>
     64 
     65 <br>
     66 $if totsats > 0:
     67     total: $totsats Satoshi $(toteuro)&euro;
     68     with rate: $getrate()&euro;/₿
     69 
     70 <br>
     71 Order is only reserved once paid.
     72 <br>
     73 <br>
     74 
     75 $if totsats > 0:
     76     <br>
     77     total: $totsats Satoshi or $toteuro &euro;<br>
     78     with rate: $getrate()&euro;/₿
     79     <h2>status: $lninvoice['status']</h2>
     80 <br>
     81 <a href="lightning:$lninvoice['bolt11']"><img src="$qr"></a>
     82 <div id='hash'>
     83 <h2>id:</h2>
     84 <textarea id='payid'>
     85 $lninvoice['label']
     86 </textarea>
     87 <h2>bolt11:</h2>
     88 <textarea id='payreq'>
     89 $lninvoice['bolt11']
     90 </textarea>
     91 <br>
     92 <button id="copybutton" onclick="copy()">Copy</button>
     93 <button id="backbutton" autofocus onclick="parent.location='/paybtc/$invoice.invoice_key'">Pay with Bitcoin on-chain</button>
     94 </div>
     95 
     96 <br>
     97 <br>
     98 
     99 <a href="/checkout">Go back!</a>
    100 
    101 <br>
    102 </div>
    103 <br>
    104 <br>
    105 <br>
    106 <br>