bysquare 2.8.0 → 2.8.1

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 CHANGED
@@ -1,8 +1,5 @@
1
1
  # bysquare
2
2
 
3
- ![version][version]
4
- ![build][build]
5
-
6
3
  Simple JavaScript library to encode and decode "PAY by square" string.
7
4
 
8
5
  **What is `PAY by square`?**
@@ -17,55 +14,58 @@ This library doesn't have a specific opinion and how the QR code string is
17
14
  transformed into images depends on how you implement it. See
18
15
  [examples](./docs/examples/).
19
16
 
20
- ## Install
17
+ ## Features
18
+
19
+ - Encode data to qr string
20
+ - Decode data to json
21
+ - Detect bysquare from qr string
22
+
23
+ ## Installation
21
24
 
22
25
  **NOTE**: This package is native [ESM][mozzila-esm] and no longer provides a
23
26
  CommonJS export. If your project uses CommonJS, you will have to convert to ESM
24
27
  or use the dynamic [`import()`][mozzila-import] function.
25
28
 
26
- **npm registry**
29
+ [mozzila-esm]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
30
+ [mozzila-import]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import
31
+
32
+ ### npm registry
27
33
 
28
34
  ```sh
29
35
  npm install bysquare
30
36
  ```
31
37
 
32
- **Browser**
38
+ ### CLI Node `v18+`
33
39
 
34
- ```html
35
- <script type="module">
36
- import { encode, decode } from "https://esm.sh/bysquare@2.7.1/";
37
- </script>
40
+ ```sh
41
+ npm install --global bysquare
38
42
  ```
39
43
 
40
- **Deno** `v1.28+` using npm prefix
44
+ ### deno
45
+
46
+ Since `v1.28+` import from npm registry using `npm:` prefix.
41
47
 
42
48
  ```ts
43
- import { encode, decode } from "npm:bysquare@2.7.1";
49
+ import { decode, encode } from "npm:bysquare@2.8.0";
44
50
  ```
45
51
 
46
- **CLI** (Node.JS `v18`+)
52
+ ### Browser
47
53
 
48
- ```sh
49
- npm install --global bysquare
54
+ ```html
55
+ <script type="module">
56
+ import { encode, decode } from "https://esm.sh/bysquare@2.8.0/";
57
+ </script>
50
58
  ```
51
59
 
52
- # How it works
60
+ ## How it works
53
61
 
54
- ## Encoding sequence
62
+ ### Encoding sequence
55
63
 
56
64
  ![logic](./docs/uml/logic.svg)
57
65
 
58
- # API
59
-
60
- ```ts
61
- encode(model: DataModel, options?: Options): string
62
- decode(qr: string): DataModel
63
- detect(qr: string): Boolean
64
- ```
65
-
66
- # Usage
66
+ ## Usage
67
67
 
68
- ## Encode
68
+ ### Encode
69
69
 
70
70
  ```ts
71
71
  import { CurrencyCode, DataModel, encode, PaymentOptions } from "bysquare";
@@ -89,13 +89,13 @@ const qrString = encode({
89
89
  });
90
90
  ```
91
91
 
92
- ## Decode
92
+ ### Decode
93
93
 
94
94
  ```ts
95
95
  import { decode } from "bysquare";
96
96
 
97
97
  const model = decode(
98
- "0405QH8090IFU27IV0J6HGGLIOTIBVHNQQJQ6LAVGNBT363HR13JC6CB54HSI0KH9FCRASHNQBSKAQD2LJ4AU400UVKDNDPFRKLOBEVVVU0QJ000"
98
+ "0405QH8090IFU27IV0J6HGGLIOTIBVHNQQJQ6LAVGNBT363HR13JC6CB54HSI0KH9FCRASHNQBSKAQD2LJ4AU400UVKDNDPFRKLOBEVVVU0QJ000",
99
99
  );
100
100
 
101
101
  // {
@@ -115,9 +115,9 @@ const model = decode(
115
115
  //
116
116
  ```
117
117
 
118
- # CLI
118
+ ## CLI
119
119
 
120
- ## Encode
120
+ ### Encode
121
121
 
122
122
  Encode JSON or JSONL data from files and print the corresponding QR code.
123
123
 
@@ -126,7 +126,7 @@ npx bysquare --encode file1.json file2.json...
126
126
  npx bysquare --encode file.jsonl
127
127
  ```
128
128
 
129
- ## Decode
129
+ ### Decode
130
130
 
131
131
  Decode the specified QR code string and print the corresponding JSON data. The
132
132
  qrstring argument should be a valid QR code string.
@@ -135,16 +135,31 @@ qrstring argument should be a valid QR code string.
135
135
  npx bysquare --decode <qrstring>
136
136
  ```
137
137
 
138
- ## Related
138
+ ## Platform support
139
139
 
140
- - <https://bysquare.com/>
141
- - <https://devel.cz/otazka/qr-kod-pay-by-square>
142
- - <https://github.com/matusf/pay-by-square>
143
- - <https://www.bsqr.co/schema/>
144
- - <https://www.sbaonline.sk/wp-content/uploads/2020/03/pay-by-square-specifications-1_1_0.pdf>
145
- - <https://www.vutbr.cz/studenti/zav-prace/detail/78439>
140
+ I mainly focus on LTS versions of Node.js and try to use the most idiomatic
141
+ ECMAScript possible to avoid specific runtime coupling.
146
142
 
147
- [build]: https://img.shields.io/github/actions/workflow/status/xseman/bysquare/tests.yml
148
- [version]: https://img.shields.io/npm/v/bysquare
149
- [mozzila-esm]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
150
- [mozzila-import]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import
143
+ This doesn't mean that the library won't work on older versions, but it might
144
+ not be as reliable.
145
+
146
+ As of `v1.28`, Deno now includes built-in support for npm modules and is ready
147
+ to use without additional setup, showing its improved maturity.
148
+
149
+ ### Node.js & Deno
150
+
151
+ - Node.js `v18` and later.
152
+ - Deno `v1.28` and later.
153
+
154
+ ### Browser
155
+
156
+ The latest version of Chrome, Firefox, and Safari.
157
+
158
+ ## Related
159
+
160
+ - <https://bysquare.com/>
161
+ - <https://devel.cz/otazka/qr-kod-pay-by-square>
162
+ - <https://github.com/matusf/pay-by-square>
163
+ - <https://www.bsqr.co/schema/>
164
+ - <https://www.sbaonline.sk/wp-content/uploads/2020/03/pay-by-square-specifications-1_1_0.pdf>
165
+ - <https://www.vutbr.cz/studenti/zav-prace/detail/78439>
package/dist/cli.js CHANGED
@@ -1,25 +1,25 @@
1
1
  #!/usr/bin/env node
2
2
  import { existsSync, readFileSync } from "node:fs";
3
- import { parseArgs } from "node:util";
4
3
  import process from "node:process";
5
- import { encode } from "./encode.js";
4
+ import { parseArgs } from "node:util";
6
5
  import { decode } from "./decode.js";
6
+ import { encode } from "./encode.js";
7
7
  const args = parseArgs({
8
8
  allowPositionals: true,
9
9
  options: {
10
10
  decode: {
11
11
  type: "string",
12
- short: "d"
12
+ short: "d",
13
13
  },
14
14
  encode: {
15
15
  type: "boolean",
16
- short: "e"
16
+ short: "e",
17
17
  },
18
18
  help: {
19
19
  type: "boolean",
20
- short: "h"
21
- }
22
- }
20
+ short: "h",
21
+ },
22
+ },
23
23
  });
24
24
  if (process.stdin.isTTY) {
25
25
  if (args.values.encode) {
@@ -32,14 +32,14 @@ if (process.stdin.isTTY) {
32
32
  console.error(`File ${file} doesn't exist`);
33
33
  process.exit(1);
34
34
  }
35
- if (file.endsWith(".json") === false &&
36
- file.endsWith(".jsonl") === false) {
35
+ if (file.endsWith(".json") === false
36
+ && file.endsWith(".jsonl") === false) {
37
37
  console.error(`Unsupported file format for ${file}`);
38
38
  process.exit(1);
39
39
  }
40
40
  const data = readFileSync(file, "utf8");
41
41
  if (file.endsWith(".jsonl")) {
42
- const lines = data.split('\n');
42
+ const lines = data.split("\n");
43
43
  for (const line of lines) {
44
44
  if (!line)
45
45
  continue;
@@ -58,8 +58,8 @@ if (process.stdin.isTTY) {
58
58
  console.log(JSON.stringify(decode(qrstring), null, 4));
59
59
  process.exit(0);
60
60
  }
61
- if (args.values.help ||
62
- Object.keys(args.values).length === 0) {
61
+ if (args.values.help
62
+ || Object.keys(args.values).length === 0) {
63
63
  console.log([
64
64
  "NAME",
65
65
  " bysquare - Simple Node.js library to generate and parse PAY bysquare standard",
@@ -96,7 +96,7 @@ if (process.stdin.isTTY) {
96
96
  ` ${process.argv[1]} --decode <qrstring>`,
97
97
  " Replace qrstring with the QR code string you want to decode.",
98
98
  " The program will parse the QR code string and print the resulting JSON data.",
99
- ""
99
+ "",
100
100
  ].join("\n"));
101
101
  }
102
102
  }
package/dist/decode.d.ts CHANGED
@@ -16,7 +16,6 @@ export declare const parse: typeof decode;
16
16
  * Decoding client data from QR Code 2005 symbol
17
17
  *
18
18
  * @see 3.16.
19
- *
20
19
  */
21
20
  export declare function decode(qr: string): DataModel;
22
21
  /**
package/dist/decode.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { decompress } from "lzma1";
2
2
  import { base32hex } from "rfc4648";
3
- import { PaymentOptions } from "./index.js";
4
3
  function cleanUndefined(obj) {
5
4
  Object.keys(obj).forEach((key) => {
6
5
  if (typeof obj[key] === "undefined") {
@@ -14,27 +13,27 @@ function cleanUndefined(obj) {
14
13
  * @see 3.14.
15
14
  */
16
15
  export function deserialize(qr) {
17
- const serialized = qr.split("\t");
18
- const invoiceId = serialized.shift();
16
+ const data = qr.split("\t");
17
+ const invoiceId = data.shift();
19
18
  const output = {
20
19
  invoiceId: invoiceId?.length ? invoiceId : undefined,
21
- payments: []
20
+ payments: new Array(),
22
21
  };
23
- const paymentslen = Number(serialized.shift());
22
+ const paymentslen = Number(data.shift());
24
23
  for (let i = 0; i < paymentslen; i++) {
25
- const paymentOptions = serialized.shift();
26
- const ammount = serialized.shift();
27
- const currency = serialized.shift();
28
- const dueDate = serialized.shift();
29
- const variables = serialized.shift();
30
- const constants = serialized.shift();
31
- const specifics = serialized.shift();
32
- const originatorRefInfo = serialized.shift();
33
- const paymentNote = serialized.shift();
24
+ const paymentOptions = data.shift();
25
+ const ammount = data.shift();
26
+ const currency = data.shift();
27
+ const dueDate = data.shift();
28
+ const variables = data.shift();
29
+ const constants = data.shift();
30
+ const specifics = data.shift();
31
+ const originatorRefInfo = data.shift();
32
+ const paymentNote = data.shift();
34
33
  let payment = {
35
34
  bankAccounts: [],
36
35
  type: Number(paymentOptions),
37
- currencyCode: currency,
36
+ currencyCode: currency ?? "EUR" /* CurrencyCode.EUR */,
38
37
  amount: ammount?.length
39
38
  ? Number(ammount)
40
39
  : undefined,
@@ -55,49 +54,49 @@ export function deserialize(qr) {
55
54
  : undefined,
56
55
  paymentNote: paymentNote?.length
57
56
  ? paymentNote
58
- : undefined
57
+ : undefined,
59
58
  };
60
- const accountslen = Number(serialized.shift());
59
+ const accountslen = Number(data.shift());
61
60
  for (let j = 0; j < accountslen; j++) {
62
- const iban = serialized.shift();
61
+ const iban = data.shift();
63
62
  if (iban === undefined || iban.length === 0) {
64
63
  throw new Error("Missing IBAN");
65
64
  }
66
- const bic = serialized.shift();
65
+ const bic = data.shift();
67
66
  const account = {
68
67
  iban: iban,
69
68
  bic: bic?.length
70
69
  ? bic
71
- : undefined
70
+ : undefined,
72
71
  };
73
72
  cleanUndefined(account);
74
73
  payment.bankAccounts.push(account);
75
74
  }
76
- serialized.shift(); // StandingOrderExt
77
- serialized.shift(); // DirectDebitExt
75
+ data.shift(); // StandingOrderExt
76
+ data.shift(); // DirectDebitExt
78
77
  // narrowing payment type
79
78
  switch (payment.type) {
80
- case PaymentOptions.PaymentOrder:
79
+ case 1 /* PaymentOptions.PaymentOrder */:
81
80
  break;
82
- case PaymentOptions.StandingOrder:
81
+ case 2 /* PaymentOptions.StandingOrder */:
83
82
  payment = {
84
83
  ...payment,
85
- day: Number(serialized.shift()),
86
- month: Number(serialized.shift()),
87
- periodicity: serialized.shift(),
88
- lastDate: serialized.shift()
84
+ day: Number(data.shift()),
85
+ month: Number(data.shift()),
86
+ periodicity: data.shift(),
87
+ lastDate: data.shift(),
89
88
  };
90
89
  break;
91
- case PaymentOptions.DirectDebit:
90
+ case 4 /* PaymentOptions.DirectDebit */:
92
91
  payment = {
93
92
  ...payment,
94
- directDebitScheme: Number(serialized.shift()),
95
- directDebitType: Number(serialized.shift()),
96
- mandateId: serialized.shift(),
97
- creditorId: serialized.shift(),
98
- contractId: serialized.shift(),
99
- maxAmount: Number(serialized.shift()),
100
- validTillDate: serialized.shift()
93
+ directDebitScheme: Number(data.shift()),
94
+ directDebitType: Number(data.shift()),
95
+ mandateId: data.shift(),
96
+ creditorId: data.shift(),
97
+ contractId: data.shift(),
98
+ maxAmount: Number(data.shift()),
99
+ validTillDate: data.shift(),
101
100
  };
102
101
  break;
103
102
  default:
@@ -107,9 +106,9 @@ export function deserialize(qr) {
107
106
  output.payments.push(payment);
108
107
  }
109
108
  for (let i = 0; i < paymentslen; i++) {
110
- const name = serialized.shift();
111
- const addressLine1 = serialized.shift();
112
- const addressLine2 = serialized.shift();
109
+ const name = data.shift();
110
+ const addressLine1 = data.shift();
111
+ const addressLine2 = data.shift();
113
112
  if (Boolean(name) || Boolean(addressLine1) || Boolean(addressLine2)) {
114
113
  const beneficiary = {
115
114
  name: name?.length
@@ -120,7 +119,7 @@ export function deserialize(qr) {
120
119
  : undefined,
121
120
  city: addressLine2?.length
122
121
  ? addressLine2
123
- : undefined
122
+ : undefined,
124
123
  };
125
124
  cleanUndefined(beneficiary);
126
125
  output.payments[i].beneficiary = beneficiary;
@@ -145,14 +144,15 @@ function bysquareHeaderDecoder(header) {
145
144
  bysquareType,
146
145
  version,
147
146
  documentType,
148
- reserved
147
+ reserved,
149
148
  };
150
149
  }
151
150
  export class DecodeError extends Error {
151
+ cause;
152
+ name = "DecodeError";
152
153
  constructor(cause, msg) {
153
154
  super(msg);
154
155
  this.cause = cause;
155
- this.name = "DecodeError";
156
156
  }
157
157
  }
158
158
  /** @deprecated */
@@ -161,12 +161,11 @@ export const parse = decode;
161
161
  * Decoding client data from QR Code 2005 symbol
162
162
  *
163
163
  * @see 3.16.
164
- *
165
164
  */
166
165
  export function decode(qr) {
167
166
  try {
168
167
  var bytes = base32hex.parse(qr, {
169
- loose: true
168
+ loose: true,
170
169
  });
171
170
  }
172
171
  catch (error) {
@@ -195,22 +194,25 @@ export function decode(qr) {
195
194
  const header = new Uint8Array([
196
195
  ...defaultProperties,
197
196
  ...defaultDictionarySize,
198
- ...uncompressedSize
197
+ ...uncompressedSize,
199
198
  ]);
200
199
  const payload = bytes.slice(4);
201
200
  const body = new Uint8Array([
202
201
  ...header,
203
- ...payload
202
+ ...payload,
204
203
  ]);
205
204
  try {
206
- var decompressed = new Uint8Array(decompress(body));
205
+ var decompressed = decompress(body);
207
206
  }
208
207
  catch (error) {
209
208
  throw new DecodeError(error, "LZMA decompression failed");
210
209
  }
210
+ if (typeof decompressed === "string") {
211
+ return deserialize(decompressed);
212
+ }
211
213
  const _checksum = decompressed.slice(0, 4);
212
214
  const decompressedBody = decompressed.slice(4);
213
- const decoded = new TextDecoder("utf-8").decode(decompressedBody);
215
+ const decoded = new TextDecoder("utf-8").decode(decompressedBody.buffer);
214
216
  return deserialize(decoded);
215
217
  }
216
218
  /**
@@ -222,7 +224,7 @@ export function decode(qr) {
222
224
  export function detect(qr) {
223
225
  try {
224
226
  var parsed = base32hex.parse(qr, {
225
- loose: true
227
+ loose: true,
226
228
  });
227
229
  }
228
230
  catch {
@@ -232,7 +234,7 @@ export function detect(qr) {
232
234
  return false;
233
235
  }
234
236
  const bysquareHeader = parsed.subarray(0, 2);
235
- const { bysquareType, version, documentType, reserved } = bysquareHeaderDecoder(bysquareHeader);
237
+ const { bysquareType, version, documentType, reserved, } = bysquareHeaderDecoder(bysquareHeader);
236
238
  const isValid = [bysquareType, version, documentType, reserved]
237
239
  .every((nibble, index) => {
238
240
  if (index === 1) {
package/dist/encode.js CHANGED
@@ -2,7 +2,6 @@ import crc32 from "crc-32";
2
2
  import deburr from "lodash.deburr";
3
3
  import { compress } from "lzma1";
4
4
  import { base32hex } from "rfc4648";
5
- import { PaymentOptions } from "./types.js";
6
5
  /**
7
6
  * Returns a 2 byte buffer that represents the header of the bysquare
8
7
  * specification
@@ -28,11 +27,11 @@ header = [
28
27
  if (!isValid) {
29
28
  throw new Error("Invalid header byte value, valid range <0,15>");
30
29
  }
31
- const [bySquareType, version, documentType, reserved] = header;
30
+ const [bySquareType, version, documentType, reserved,] = header;
32
31
  // Combine 4-nibbles to 2-bytes
33
32
  const mergedNibbles = Uint8Array.from([
34
33
  (bySquareType << 4) | (version << 0),
35
- (documentType << 4) | (reserved << 0)
34
+ (documentType << 4) | (reserved << 0),
36
35
  ]);
37
36
  return mergedNibbles;
38
37
  }
@@ -59,7 +58,7 @@ export function addChecksum(serialized) {
59
58
  const byteArray = new TextEncoder().encode(serialized);
60
59
  return Uint8Array.from([
61
60
  ...new Uint8Array(checksum),
62
- ...Uint8Array.from(byteArray)
61
+ ...Uint8Array.from(byteArray),
63
62
  ]);
64
63
  }
65
64
  /**
@@ -87,7 +86,7 @@ export function serialize(data) {
87
86
  serialized.push(ba.iban);
88
87
  serialized.push(ba.bic);
89
88
  }
90
- if (p.type === PaymentOptions.StandingOrder) {
89
+ if (p.type === 2 /* PaymentOptions.StandingOrder */) {
91
90
  serialized.push("1");
92
91
  serialized.push(p.day?.toString());
93
92
  serialized.push(p.month?.toString());
@@ -97,7 +96,7 @@ export function serialize(data) {
97
96
  else {
98
97
  serialized.push("0");
99
98
  }
100
- if (p.type === PaymentOptions.DirectDebit) {
99
+ if (p.type === 4 /* PaymentOptions.DirectDebit */) {
101
100
  serialized.push("1");
102
101
  serialized.push(p.directDebitScheme?.toString());
103
102
  serialized.push(p.directDebitType?.toString());
@@ -158,9 +157,9 @@ export function encode(model, options = { deburr: true }) {
158
157
  // ...headerBysquare([0x00, Version["1.1.0"], 0x00, 0x00]),
159
158
  ...headerBysquare([0x00, 0x00, 0x00, 0x00]),
160
159
  ...headerDataLength(withChecksum.byteLength),
161
- ...lzmaBody
160
+ ...lzmaBody,
162
161
  ]);
163
162
  return base32hex.stringify(output, {
164
- pad: false
163
+ pad: false,
165
164
  });
166
165
  }
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { encode, generate } from "./encode.js";
2
1
  export { decode, detect, parse } from "./decode.js";
2
+ export { encode, generate } from "./encode.js";
3
3
  export * from "./types.js";
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export { encode, generate } from "./encode.js";
2
1
  export { decode, detect, parse } from "./decode.js";
2
+ export { encode, generate } from "./encode.js";
3
3
  export * from "./types.js";
package/dist/types.d.ts CHANGED
@@ -19,7 +19,7 @@ export declare const enum Version {
19
19
  /**
20
20
  * Kalendárny mesiac.
21
21
  */
22
- export declare enum MonthClassifier {
22
+ export declare const enum MonthClassifier {
23
23
  January = 1,
24
24
  February = 2,
25
25
  March = 4,
@@ -38,7 +38,7 @@ export declare enum MonthClassifier {
38
38
  * medzi 1 a 31. Deň v týždni je číslo medzi 1 a 7 (1 = pondelok, 2=utorok, …, 7
39
39
  * = nedeľa).
40
40
  */
41
- export declare enum Periodicity {
41
+ export declare const enum Periodicity {
42
42
  Daily = "d",
43
43
  Weekly = "w",
44
44
  Biweekly = "b",
@@ -64,7 +64,7 @@ export type Day = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 1
64
64
  * - standingorder: trvalý príkaz, údaje sa vyplnia do StandingOrderExt
65
65
  * - directdebit: inkaso, údaje sa vyplnia do DirectDebitExt
66
66
  */
67
- export declare enum PaymentOptions {
67
+ export declare const enum PaymentOptions {
68
68
  PaymentOrder = 1,
69
69
  StandingOrder = 2,
70
70
  DirectDebit = 4
@@ -97,7 +97,7 @@ export type BankAccount = {
97
97
  * SEPA - Inkaso zodpovedá schéme
98
98
  * SEPA. other - iné
99
99
  */
100
- export declare enum DirectDebitScheme {
100
+ export declare const enum DirectDebitScheme {
101
101
  Other = 0,
102
102
  Sepa = 1
103
103
  }
@@ -109,7 +109,7 @@ export declare enum DirectDebitScheme {
109
109
  * one-off - jednorázové inkaso
110
110
  * recurrent - opakované inkaso
111
111
  */
112
- export declare enum DirectDebitType {
112
+ export declare const enum DirectDebitType {
113
113
  OneOff = 0,
114
114
  Recurrent = 1
115
115
  }
@@ -149,7 +149,7 @@ export type SimplePayment = {
149
149
  *
150
150
  * Mena v ISO 4217 formáte (3 písmená). Príklad: "EUR"
151
151
  */
152
- currencyCode: CurrencyCode;
152
+ currencyCode: string | CurrencyCode;
153
153
  /**
154
154
  * Formát YYYYMMDD
155
155
  *
@@ -210,7 +210,7 @@ export type StandingOrder = SimplePayment & {
210
210
  * medzi 1 a 31. Deň v týždni je číslo medzi 1 a 7 (1 = pondelok, 2 =utorok,
211
211
  * …, 7 = nedeľa).
212
212
  */
213
- day?: Day;
213
+ day?: number | Day;
214
214
  /**
215
215
  * Medzerou oddelený zoznam mesiacov, v ktoré sa má platba uskutočniť.
216
216
  */
@@ -286,7 +286,7 @@ export type DataModel = {
286
286
  /**
287
287
  * ISO-4217
288
288
  */
289
- export declare enum CurrencyCode {
289
+ export declare const enum CurrencyCode {
290
290
  AED = "AED",
291
291
  AFN = "AFN",
292
292
  ALL = "ALL",
package/dist/types.js CHANGED
@@ -1,235 +1 @@
1
- /**
2
- * Kalendárny mesiac.
3
- */
4
- export var MonthClassifier;
5
- (function (MonthClassifier) {
6
- MonthClassifier[MonthClassifier["January"] = 1] = "January";
7
- MonthClassifier[MonthClassifier["February"] = 2] = "February";
8
- MonthClassifier[MonthClassifier["March"] = 4] = "March";
9
- MonthClassifier[MonthClassifier["April"] = 8] = "April";
10
- MonthClassifier[MonthClassifier["May"] = 16] = "May";
11
- MonthClassifier[MonthClassifier["June"] = 32] = "June";
12
- MonthClassifier[MonthClassifier["July"] = 64] = "July";
13
- MonthClassifier[MonthClassifier["August"] = 128] = "August";
14
- MonthClassifier[MonthClassifier["September"] = 256] = "September";
15
- MonthClassifier[MonthClassifier["October"] = 512] = "October";
16
- MonthClassifier[MonthClassifier["November"] = 1024] = "November";
17
- MonthClassifier[MonthClassifier["December"] = 2048] = "December";
18
- })(MonthClassifier || (MonthClassifier = {}));
19
- /**
20
- * Deň platby vyplývajúci z opakovania (Periodicity). Deň v mesiaci je číslo
21
- * medzi 1 a 31. Deň v týždni je číslo medzi 1 a 7 (1 = pondelok, 2=utorok, …, 7
22
- * = nedeľa).
23
- */
24
- export var Periodicity;
25
- (function (Periodicity) {
26
- Periodicity["Daily"] = "d";
27
- Periodicity["Weekly"] = "w";
28
- Periodicity["Biweekly"] = "b";
29
- Periodicity["Monthly"] = "m";
30
- Periodicity["Bimonthly"] = "B";
31
- Periodicity["Quarterly"] = "q";
32
- Periodicity["Semiannually"] = "s";
33
- Periodicity["Annually"] = "a";
34
- })(Periodicity || (Periodicity = {}));
35
- /**
36
- * Možnosti platby sa dajú kombinovať. Oddeľujú sa medzerou a treba uviesť vždy
37
- * aspoň jednu z možností:
38
- *
39
- * - paymentorder: platobný príkaz
40
- * - standingorder: trvalý príkaz, údaje sa vyplnia do StandingOrderExt
41
- * - directdebit: inkaso, údaje sa vyplnia do DirectDebitExt
42
- */
43
- export var PaymentOptions;
44
- (function (PaymentOptions) {
45
- PaymentOptions[PaymentOptions["PaymentOrder"] = 1] = "PaymentOrder";
46
- PaymentOptions[PaymentOptions["StandingOrder"] = 2] = "StandingOrder";
47
- PaymentOptions[PaymentOptions["DirectDebit"] = 4] = "DirectDebit";
48
- })(PaymentOptions || (PaymentOptions = {}));
49
- /**
50
- * Inksaná schéma. Uvádza ja jedna z možností:
51
- *
52
- * SEPA - Inkaso zodpovedá schéme
53
- * SEPA. other - iné
54
- */
55
- export var DirectDebitScheme;
56
- (function (DirectDebitScheme) {
57
- DirectDebitScheme[DirectDebitScheme["Other"] = 0] = "Other";
58
- DirectDebitScheme[DirectDebitScheme["Sepa"] = 1] = "Sepa";
59
- })(DirectDebitScheme || (DirectDebitScheme = {}));
60
- /**
61
- * Maximálna dĺžka 1
62
- *
63
- * Typ inkasa. Uvádza ja jedna z možností:
64
- *
65
- * one-off - jednorázové inkaso
66
- * recurrent - opakované inkaso
67
- */
68
- export var DirectDebitType;
69
- (function (DirectDebitType) {
70
- DirectDebitType[DirectDebitType["OneOff"] = 0] = "OneOff";
71
- DirectDebitType[DirectDebitType["Recurrent"] = 1] = "Recurrent";
72
- })(DirectDebitType || (DirectDebitType = {}));
73
- /**
74
- * ISO-4217
75
- */
76
- export var CurrencyCode;
77
- (function (CurrencyCode) {
78
- CurrencyCode["AED"] = "AED";
79
- CurrencyCode["AFN"] = "AFN";
80
- CurrencyCode["ALL"] = "ALL";
81
- CurrencyCode["AMD"] = "AMD";
82
- CurrencyCode["ANG"] = "ANG";
83
- CurrencyCode["AOA"] = "AOA";
84
- CurrencyCode["ARS"] = "ARS";
85
- CurrencyCode["AUD"] = "AUD";
86
- CurrencyCode["AWG"] = "AWG";
87
- CurrencyCode["AZN"] = "AZN";
88
- CurrencyCode["BAM"] = "BAM";
89
- CurrencyCode["BBD"] = "BBD";
90
- CurrencyCode["BDT"] = "BDT";
91
- CurrencyCode["BGN"] = "BGN";
92
- CurrencyCode["BHD"] = "BHD";
93
- CurrencyCode["BIF"] = "BIF";
94
- CurrencyCode["BMD"] = "BMD";
95
- CurrencyCode["BND"] = "BND";
96
- CurrencyCode["BOB"] = "BOB";
97
- CurrencyCode["BRL"] = "BRL";
98
- CurrencyCode["BSD"] = "BSD";
99
- CurrencyCode["BTN"] = "BTN";
100
- CurrencyCode["BWP"] = "BWP";
101
- CurrencyCode["BYN"] = "BYN";
102
- CurrencyCode["BZD"] = "BZD";
103
- CurrencyCode["CAD"] = "CAD";
104
- CurrencyCode["CDF"] = "CDF";
105
- CurrencyCode["CHF"] = "CHF";
106
- CurrencyCode["CLP"] = "CLP";
107
- CurrencyCode["CNY"] = "CNY";
108
- CurrencyCode["COP"] = "COP";
109
- CurrencyCode["CRC"] = "CRC";
110
- CurrencyCode["CUC"] = "CUC";
111
- CurrencyCode["CUP"] = "CUP";
112
- CurrencyCode["CVE"] = "CVE";
113
- CurrencyCode["CZK"] = "CZK";
114
- CurrencyCode["DJF"] = "DJF";
115
- CurrencyCode["DKK"] = "DKK";
116
- CurrencyCode["DOP"] = "DOP";
117
- CurrencyCode["DZD"] = "DZD";
118
- CurrencyCode["EGP"] = "EGP";
119
- CurrencyCode["ERN"] = "ERN";
120
- CurrencyCode["ETB"] = "ETB";
121
- CurrencyCode["EUR"] = "EUR";
122
- CurrencyCode["FJD"] = "FJD";
123
- CurrencyCode["FKP"] = "FKP";
124
- CurrencyCode["GBP"] = "GBP";
125
- CurrencyCode["GEL"] = "GEL";
126
- CurrencyCode["GHS"] = "GHS";
127
- CurrencyCode["GIP"] = "GIP";
128
- CurrencyCode["GMD"] = "GMD";
129
- CurrencyCode["GNF"] = "GNF";
130
- CurrencyCode["GTQ"] = "GTQ";
131
- CurrencyCode["GYD"] = "GYD";
132
- CurrencyCode["HKD"] = "HKD";
133
- CurrencyCode["HNL"] = "HNL";
134
- CurrencyCode["HRK"] = "HRK";
135
- CurrencyCode["HTG"] = "HTG";
136
- CurrencyCode["HUF"] = "HUF";
137
- CurrencyCode["IDR"] = "IDR";
138
- CurrencyCode["ILS"] = "ILS";
139
- CurrencyCode["INR"] = "INR";
140
- CurrencyCode["IQD"] = "IQD";
141
- CurrencyCode["IRR"] = "IRR";
142
- CurrencyCode["ISK"] = "ISK";
143
- CurrencyCode["JMD"] = "JMD";
144
- CurrencyCode["JOD"] = "JOD";
145
- CurrencyCode["JPY"] = "JPY";
146
- CurrencyCode["KES"] = "KES";
147
- CurrencyCode["KGS"] = "KGS";
148
- CurrencyCode["KHR"] = "KHR";
149
- CurrencyCode["KMF"] = "KMF";
150
- CurrencyCode["KPW"] = "KPW";
151
- CurrencyCode["KRW"] = "KRW";
152
- CurrencyCode["KWD"] = "KWD";
153
- CurrencyCode["KYD"] = "KYD";
154
- CurrencyCode["KZT"] = "KZT";
155
- CurrencyCode["LAK"] = "LAK";
156
- CurrencyCode["LBP"] = "LBP";
157
- CurrencyCode["LKR"] = "LKR";
158
- CurrencyCode["LRD"] = "LRD";
159
- CurrencyCode["LSL"] = "LSL";
160
- CurrencyCode["LYD"] = "LYD";
161
- CurrencyCode["MAD"] = "MAD";
162
- CurrencyCode["MDL"] = "MDL";
163
- CurrencyCode["MGA"] = "MGA";
164
- CurrencyCode["MKD"] = "MKD";
165
- CurrencyCode["MMK"] = "MMK";
166
- CurrencyCode["MNT"] = "MNT";
167
- CurrencyCode["MOP"] = "MOP";
168
- CurrencyCode["MRU"] = "MRU";
169
- CurrencyCode["MUR"] = "MUR";
170
- CurrencyCode["MVR"] = "MVR";
171
- CurrencyCode["MWK"] = "MWK";
172
- CurrencyCode["MXN"] = "MXN";
173
- CurrencyCode["MYR"] = "MYR";
174
- CurrencyCode["MZN"] = "MZN";
175
- CurrencyCode["NAD"] = "NAD";
176
- CurrencyCode["NGN"] = "NGN";
177
- CurrencyCode["NIO"] = "NIO";
178
- CurrencyCode["NOK"] = "NOK";
179
- CurrencyCode["NPR"] = "NPR";
180
- CurrencyCode["NZD"] = "NZD";
181
- CurrencyCode["OMR"] = "OMR";
182
- CurrencyCode["PAB"] = "PAB";
183
- CurrencyCode["PEN"] = "PEN";
184
- CurrencyCode["PGK"] = "PGK";
185
- CurrencyCode["PHP"] = "PHP";
186
- CurrencyCode["PKR"] = "PKR";
187
- CurrencyCode["PLN"] = "PLN";
188
- CurrencyCode["PYG"] = "PYG";
189
- CurrencyCode["QAR"] = "QAR";
190
- CurrencyCode["RON"] = "RON";
191
- CurrencyCode["RSD"] = "RSD";
192
- CurrencyCode["RUB"] = "RUB";
193
- CurrencyCode["RWF"] = "RWF";
194
- CurrencyCode["SAR"] = "SAR";
195
- CurrencyCode["SBD"] = "SBD";
196
- CurrencyCode["SCR"] = "SCR";
197
- CurrencyCode["SDG"] = "SDG";
198
- CurrencyCode["SEK"] = "SEK";
199
- CurrencyCode["SGD"] = "SGD";
200
- CurrencyCode["SHP"] = "SHP";
201
- CurrencyCode["SLL"] = "SLL";
202
- CurrencyCode["SOS"] = "SOS";
203
- CurrencyCode["SRD"] = "SRD";
204
- CurrencyCode["SSP"] = "SSP";
205
- CurrencyCode["STN"] = "STN";
206
- CurrencyCode["SVC"] = "SVC";
207
- CurrencyCode["SYP"] = "SYP";
208
- CurrencyCode["SZL"] = "SZL";
209
- CurrencyCode["THB"] = "THB";
210
- CurrencyCode["TJS"] = "TJS";
211
- CurrencyCode["TMT"] = "TMT";
212
- CurrencyCode["TND"] = "TND";
213
- CurrencyCode["TOP"] = "TOP";
214
- CurrencyCode["TRY"] = "TRY";
215
- CurrencyCode["TTD"] = "TTD";
216
- CurrencyCode["TWD"] = "TWD";
217
- CurrencyCode["TZS"] = "TZS";
218
- CurrencyCode["UAH"] = "UAH";
219
- CurrencyCode["UGX"] = "UGX";
220
- CurrencyCode["USD"] = "USD";
221
- CurrencyCode["UYU"] = "UYU";
222
- CurrencyCode["UZS"] = "UZS";
223
- CurrencyCode["VES"] = "VES";
224
- CurrencyCode["VND"] = "VND";
225
- CurrencyCode["VUV"] = "VUV";
226
- CurrencyCode["WST"] = "WST";
227
- CurrencyCode["XAF"] = "XAF";
228
- CurrencyCode["XCD"] = "XCD";
229
- CurrencyCode["XOF"] = "XOF";
230
- CurrencyCode["XPF"] = "XPF";
231
- CurrencyCode["YER"] = "YER";
232
- CurrencyCode["ZAR"] = "ZAR";
233
- CurrencyCode["ZMW"] = "ZMW";
234
- CurrencyCode["ZWL"] = "ZWL";
235
- })(CurrencyCode || (CurrencyCode = {}));
1
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bysquare",
3
3
  "description": "It's a national standard for payment QR codes adopted by Slovak Banking Association (SBA)",
4
- "version": "2.8.0",
4
+ "version": "2.8.1",
5
5
  "license": "Apache-2.0",
6
6
  "funding": "https://github.com/sponsors/xseman",
7
7
  "homepage": "https://github.com/xseman/bysquare#readme",
@@ -19,12 +19,12 @@
19
19
  "scripts": {
20
20
  "prebuild": "tsc --build --clean",
21
21
  "build": "tsc --build",
22
- "format": "dprint fmt ./src/**/*",
22
+ "fmt": "dprint fmt ./src/**/*",
23
23
  "typecheck": "tsc --noEmit",
24
24
  "version": "git checkout develop && npm test",
25
25
  "postversion": "echo 'Now run npm run build && npm publish'",
26
- "test": "node --test --loader tsx --no-warnings src/*.test.ts",
27
- "test:watch": "node --test --watch --loader tsx --no-warnings src/*.test.ts"
26
+ "test": "TS_NODE_TRANSPILE_ONLY=true node --test --loader=ts-node/esm --no-warnings src/*.test.ts",
27
+ "test:watch": "TS_NODE_TRANSPILE_ONLY=true node --test --watch --loader=ts-node/esm --no-warnings src/*.test.ts"
28
28
  },
29
29
  "dependencies": {
30
30
  "crc-32": "~1.2.0",
@@ -34,10 +34,10 @@
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/lodash.deburr": "~4.1.0",
37
- "@types/node": ">=16.14",
38
- "dprint": "~0.41.0",
39
- "tsx": "~3.12.0",
40
- "typescript": "~5.0.0"
37
+ "@types/node": ">=18.18.2",
38
+ "dprint": "~0.43.0",
39
+ "ts-node": "~10.9.0",
40
+ "typescript": "~5.3.0"
41
41
  },
42
42
  "type": "module",
43
43
  "bin": "./dist/cli.js",
@@ -53,7 +53,7 @@
53
53
  "!dist/*.test.*"
54
54
  ],
55
55
  "engines": {
56
- "node": ">=16",
56
+ "node": ">=18.18.2",
57
57
  "npm": ">=7"
58
58
  }
59
59
  }