upiqr 1.3.20 → 1.3.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,9 +25,8 @@ This package will work on client and server.
|
|
|
25
25
|
payeeVPA: "bhar4t@upi",
|
|
26
26
|
payeeName: "Bharat Sahu"
|
|
27
27
|
})
|
|
28
|
-
.then(({ qr
|
|
28
|
+
.then(({ qr }) => {
|
|
29
29
|
console.log(qr) // data:image/png;base64,eR0lGODP...
|
|
30
|
-
console.log(intent) // upi://pay?pa=bhar4t@upi&pn=Bhar...
|
|
31
30
|
})
|
|
32
31
|
.catch(console.error)
|
|
33
32
|
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import QRCode from"qrcode";function validate({pa:e,pn:t}){if(!e||!t)return"Virtual payee's address/name is compulsory";if(e.length<5||t.length<4)return"Virtual payee's address/name is too short.";return""}export default function upiqr({payeeVPA:e,payeeName:t,payeeMerchantCode:r,transactionId:n,transactionRef:a,transactionNote:o,amount:i,minimumAmount:
|
|
1
|
+
import QRCode from"qrcode";function validate({pa:e,pn:t}){if(!e||!t)return"Virtual payee's address/name is compulsory";if(e.length<5||t.length<4)return"Virtual payee's address/name is too short.";return""}export default function upiqr({payeeVPA:e,payeeName:t,payeeMerchantCode:r,transactionId:n,transactionRef:a,transactionNote:o,amount:i,minimumAmount:s,currency:c},m){const u=Object.assign({pa:e,pn:t},Object.fromEntries(Object.entries({am:i,mam:s,cu:c,mc:r,tid:n,tr:a,tn:o}).filter(([e,t])=>t)));const p=validate(u);if(p)return Promise.reject(new Error(p));const d="upi://pay?"+new URLSearchParams(u).toString();return new Promise((t,r)=>{QRCode.toDataURL(d,m).then(e=>t({qr:e,intent:d})).catch(e=>r(new Error("Unable to generate UPI QR Code.\n"+e)))})}
|
package/package.json
CHANGED