upiqr 1.0.42 → 1.0.44

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/dist/index.js CHANGED
@@ -1,5 +1,20 @@
1
1
  import QRCode from 'qrcode';
2
- import { buildUrl, validateParams } from './utils/helper';
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,6 +1,6 @@
1
1
  {
2
2
  "name": "upiqr",
3
- "version": "1.0.42",
3
+ "version": "1.0.44",
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",
@@ -1,5 +0,0 @@
1
- export declare function validateParams({ pa, pn }: {
2
- pa: string | undefined;
3
- pn: string | undefined;
4
- }): string;
5
- export declare function buildUrl(this: string, params: object): string;
@@ -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
- }