upiqr 1.3.22 → 1.3.25

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.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +4 -2
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: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)))})}
1
+ var __awaiter=this&&this.__awaiter||function(t,i,n,c){function u(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(e,n){function a(t){try{o(c.next(t))}catch(t){n(t)}}function r(t){try{o(c["throw"](t))}catch(t){n(t)}}function o(t){t.done?e(t.value):u(t.value).then(a,r)}o((c=c.apply(t,i||[])).next())})};import QRCode from"qrcode";function validate({pa:t,pn:e}){if(!t||!e)return"Virtual payee's address/name is compulsory";if(t.length<5||e.length<4)return"Virtual payee's address/name is too short.";return""}export default function upiqr(t,e){return __awaiter(this,arguments,void 0,function*({payeeVPA:t,payeeName:e,payeeMerchantCode:n,transactionId:a,transactionRef:r,transactionNote:o,amount:i,minimumAmount:c,currency:u},s){const f={pa:t,pn:e};if(i)f["am"]=i;if(c)f["mam"]=c;if(u)f["cu"]=u;if(n)f["mc"]=n;if(a)f["tid"]=a;if(r)f["tr"]=r;if(o)f["tn"]=o;const p=validate(f);if(p)throw new Error(p);const m="upi://pay?"+new URLSearchParams(f).toString();try{const l=yield QRCode.toDataURL(m,s);return{qr:l,intent:m}}catch(t){throw new Error("Unable to generate UPI QR Code.\n"+t)}})}upiqr({payeeVPA:"example@upi",payeeName:"Example Name"}).then(console.log).catch(console.error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "upiqr",
3
- "version": "1.3.22",
3
+ "version": "1.3.25",
4
4
  "description": "Generate NPCI's UPI QR code along with UPI intent link, By using it any payment is possible from UPI enabled apps.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -45,6 +45,8 @@
45
45
  "devDependencies": {
46
46
  "@types/node": "^20.5.6",
47
47
  "@types/qrcode": "^1.5.1",
48
- "typescript": "^5.2.2"
48
+ "jsmin": "^1.0.1",
49
+ "typescript": "^5.2.2",
50
+ "uglify-js": "^3.19.3"
49
51
  }
50
52
  }