upiqr 1.0.43 → 1.1.0
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 -1
- package/dist/index.js +16 -1
- package/package.json +2 -1
- package/dist/utils/helper.d.ts +0 -5
- package/dist/utils/helper.js +0 -16
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
import QRCode from 'qrcode';
|
|
2
|
-
|
|
2
|
+
function validateParams({ pa, pn }) {
|
|
3
|
+
let error = '';
|
|
4
|
+
if (!pa || !pn)
|
|
5
|
+
return "Virtual Payee's Address/Payee's Name is compulsory";
|
|
6
|
+
if ((pa === null || pa === void 0 ? void 0 : pa.length) < 5 || (pn === null || pn === void 0 ? void 0 : pn.length) < 4)
|
|
7
|
+
return "Virtual Payee's Address/Payee's Name is too short.";
|
|
8
|
+
return error;
|
|
9
|
+
}
|
|
10
|
+
function buildUrl(params) {
|
|
11
|
+
let url = this, qs = "";
|
|
12
|
+
for (let [key, value] of Object.entries(params))
|
|
13
|
+
qs += encodeURIComponent(key) + "=" + encodeURIComponent(value) + "&";
|
|
14
|
+
if (qs.length > 0)
|
|
15
|
+
url = url + qs;
|
|
16
|
+
return url;
|
|
17
|
+
}
|
|
3
18
|
export default function upiqr({ payeeVPA: pa, payeeName: pn, payeeMerchantCode: me, transactionId: tid, transactionRef: tr, transactionNote: tn, amount: am, minimumAmount: mam, currency: cu, }) {
|
|
4
19
|
return new Promise((resolve, reject) => {
|
|
5
20
|
let error = validateParams({ pa, pn });
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "upiqr",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
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",
|
|
7
|
+
"type": "module",
|
|
7
8
|
"files": [
|
|
8
9
|
"dist",
|
|
9
10
|
"LICENSE",
|
package/dist/utils/helper.d.ts
DELETED
package/dist/utils/helper.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export function validateParams({ pa, pn }) {
|
|
2
|
-
let error = '';
|
|
3
|
-
if (!pa || !pn)
|
|
4
|
-
return "Virtual Payee's Address/Payee's Name is compulsory";
|
|
5
|
-
if ((pa === null || pa === void 0 ? void 0 : pa.length) < 5 || (pn === null || pn === void 0 ? void 0 : pn.length) < 4)
|
|
6
|
-
return "Virtual Payee's Address/Payee's Name is too short.";
|
|
7
|
-
return error;
|
|
8
|
-
}
|
|
9
|
-
export function buildUrl(params) {
|
|
10
|
-
let url = this, qs = "";
|
|
11
|
-
for (let [key, value] of Object.entries(params))
|
|
12
|
-
qs += encodeURIComponent(key) + "=" + encodeURIComponent(value) + "&";
|
|
13
|
-
if (qs.length > 0)
|
|
14
|
-
url = url + qs;
|
|
15
|
-
return url;
|
|
16
|
-
}
|