From 496067b98448163f1bb0acb419fd2fcef6ecad4a Mon Sep 17 00:00:00 2001 From: cachecleanerjeet Date: Wed, 4 Nov 2020 12:13:17 +0530 Subject: [PATCH] Fixed QR Gen Glitch --- README.md | 3 +-- api/index.js | 3 ++- js/pay.js | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1150a0e..444833f 100644 --- a/README.md +++ b/README.md @@ -17,11 +17,10 @@ *iv. Works with all UPI App.*
*v. Cool and Easy to Use Interface.*
*vi. No Tracking Script & Totally Ads free.*
-*vii. Configured for Multi Server Uses (Pay System in Another Server).*
### Best uses:
-*This will help Local Businesses to recieve their Payment via UPI Link. Because this is [MIT Licenced ](https://github.com/cachecleanerjeet/Upier/blob/master/LICENSE "MIT Licenced ")you can customize it however you need & impliment on your Business .*

+*This will help Local Businesses to recieve their Payment via UPI Link. Because this is [MIT Licenced ](https://github.com/cachecleanerjeet/Upier/blob/master/LICENSE "MIT Licenced ")you can customize it however you need & impliment on your Business.*

### Deploy:
*Everthing is pre-configured, You can just deploy it on Vercel*
diff --git a/api/index.js b/api/index.js index b87bb84..d26f3f9 100644 --- a/api/index.js +++ b/api/index.js @@ -2,7 +2,8 @@ var QRCode = require("qrcode-svg"); module.exports = (req, res) => { var url = req.query.url; + var urldecode = url.replace(/~/gi, "&") res.setHeader("Content-Type", "image/svg+xml"); res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate") - res.send(new QRCode(url).svg()); + res.send(new QRCode(urldecode).svg()); } \ No newline at end of file diff --git a/js/pay.js b/js/pay.js index 534d46e..c8de4be 100644 --- a/js/pay.js +++ b/js/pay.js @@ -14,15 +14,17 @@ if (virpa == null) { if (am == null) { document.getElementById("payingam").innerHTML = "You are paying"; var upilink = "upi://pay?pn=" + vpa + "&tn=UPIER&pa=" + vpa + "&cu=INR"; + var qr_string = "upi://pay?pn=" + vpa + "~tn=UPIER~pa=" + vpa + "~cu=INR" } else { var amount = params.get('amount'); var upilink = "upi://pay?pn=" + vpa + "&tn=UPIER&pa=" + vpa + "&cu=INR" + "&am=" + amount; + var qr_string = "upi://pay?pn=" + vpa + "~tn=UPIER~pa=" + vpa + "~cu=INR" + "~am=" + amount; document.getElementById("payingam").innerHTML = "You are paying " + amount + "₹"; } document.getElementById("vpa").innerHTML = vpa; - document.getElementById("qrcode").src = "../api?url=" + upilink; + document.getElementById("qrcode").src = "../api?url=" + qr_string; document.getElementById("upibtn").href = upilink; }