bysquare 2.12.0 → 2.12.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 +27 -56
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -11
package/README.md
CHANGED
|
@@ -4,15 +4,17 @@
|
|
|
4
4
|
the Slovak Banking Association in 2013. It is incorporated into a variety of
|
|
5
5
|
invoices, reminders and other payment regulations.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Why
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
It's simple, I couldn't find any implementation of "PAY by square" standard for
|
|
10
|
+
JavaScript, so I decided to create one and share it with the community to help
|
|
11
|
+
individuals and businesses to create QR codes for their invoices.
|
|
11
12
|
|
|
12
|
-
##
|
|
13
|
+
## Features
|
|
13
14
|
|
|
14
|
-
-
|
|
15
|
-
-
|
|
15
|
+
- TypeScript support
|
|
16
|
+
- Compatible with Slovak banking apps
|
|
17
|
+
- Runtime-independent JavaScript implementation
|
|
16
18
|
|
|
17
19
|
## Installation
|
|
18
20
|
|
|
@@ -24,30 +26,13 @@ invoices, reminders and other payment regulations.
|
|
|
24
26
|
[mozzila-esm]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
|
|
25
27
|
[mozzila-import]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import
|
|
26
28
|
|
|
27
|
-
### npm
|
|
29
|
+
### npm
|
|
28
30
|
|
|
29
31
|
```sh
|
|
30
|
-
npm install bysquare
|
|
32
|
+
$ npm install bysquare
|
|
31
33
|
```
|
|
32
34
|
|
|
33
|
-
###
|
|
34
|
-
|
|
35
|
-
```sh
|
|
36
|
-
npm install --global bysquare
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
### deno
|
|
40
|
-
|
|
41
|
-
Since `v1.28+` import from npm registry using `npm:` prefix.
|
|
42
|
-
|
|
43
|
-
```ts
|
|
44
|
-
import {
|
|
45
|
-
decode,
|
|
46
|
-
encode,
|
|
47
|
-
} from "npm:bysquare@latest";
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### Browser
|
|
35
|
+
### browser
|
|
51
36
|
|
|
52
37
|
```html
|
|
53
38
|
<script type="module">
|
|
@@ -80,6 +65,14 @@ const qrstring = simplePayment({
|
|
|
80
65
|
|
|
81
66
|
For more complex data use `encode` and `decode` functions:
|
|
82
67
|
|
|
68
|
+
> [!NOTE]
|
|
69
|
+
> Encoded data are without diacritics
|
|
70
|
+
>
|
|
71
|
+
> The library removes all diacritics from the input data to ensure maximum
|
|
72
|
+
> compatibility, as not all banks support diacritics, which may lead to errors.
|
|
73
|
+
> If you need to retain diacritics, disable deburr option when encoding data -
|
|
74
|
+
> `encode(model, { deburr: false })`.
|
|
75
|
+
|
|
83
76
|
```ts
|
|
84
77
|
import {
|
|
85
78
|
CurrencyCode,
|
|
@@ -113,13 +106,17 @@ const model = decode(qrstring);
|
|
|
113
106
|
|
|
114
107
|
## CLI
|
|
115
108
|
|
|
109
|
+
```sh
|
|
110
|
+
$ npm install --global bysquare
|
|
111
|
+
```
|
|
112
|
+
|
|
116
113
|
### Encode
|
|
117
114
|
|
|
118
115
|
Encode JSON or JSONL data from files and print the corresponding QR code.
|
|
119
116
|
|
|
120
117
|
```sh
|
|
121
|
-
|
|
122
|
-
|
|
118
|
+
$ bysquare --encode file1.json file2.json...
|
|
119
|
+
$ bysquare --encode file.jsonl
|
|
123
120
|
```
|
|
124
121
|
|
|
125
122
|
### Decode
|
|
@@ -128,40 +125,14 @@ Decode the specified QR code string and print the corresponding JSON data. The
|
|
|
128
125
|
qrstring argument should be a valid QR code string.
|
|
129
126
|
|
|
130
127
|
```sh
|
|
131
|
-
|
|
128
|
+
$ bysquare --decode <qrstring>
|
|
132
129
|
```
|
|
133
130
|
|
|
134
131
|
## How it works
|
|
135
132
|
|
|
136
133
|
### Encoding sequence
|
|
137
134
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
## Platform support
|
|
141
|
-
|
|
142
|
-
I mainly focus on LTS versions of Node.js and try to use the most idiomatic
|
|
143
|
-
ECMAScript possible to avoid specific runtime coupling.
|
|
144
|
-
|
|
145
|
-
This doesn't mean that the library won't work on older versions, but it might
|
|
146
|
-
not be as reliable.
|
|
147
|
-
|
|
148
|
-
As of `v1.28`, Deno now includes built-in support for npm modules and is ready
|
|
149
|
-
to use without additional setup, showing its improved maturity.
|
|
150
|
-
|
|
151
|
-
### Node.js & Deno
|
|
152
|
-
|
|
153
|
-
- Node.js `v18` and later.
|
|
154
|
-
- Deno `v1.28` and later.
|
|
155
|
-
|
|
156
|
-
### Browser
|
|
157
|
-
|
|
158
|
-
The latest version of Chrome, Firefox, and Safari.
|
|
159
|
-
|
|
160
|
-
## Troubleshooting & Recommendations
|
|
161
|
-
|
|
162
|
-
### Encoded data are without diacritics
|
|
163
|
-
|
|
164
|
-
The library removes all diacritics from the input data to ensure maximum compatibility, as not all banks support diacritics, which may lead to errors. If you need to retain diacritics, disable deburr option when encoding data - `encode(model, { deburr: false })`.
|
|
135
|
+
<image src="./docs/logic.svg" alt="encode" width="500px">
|
|
165
136
|
|
|
166
137
|
## Related
|
|
167
138
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Filip Seman
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
1
6
|
export { decode, detect, parse } from "./decode.js";
|
|
2
7
|
export { encode, generate } from "./encode.js";
|
|
3
8
|
export { validateDataModel, ValidationErrorMessage } from "./validations.js";
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Filip Seman
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
1
6
|
export { decode, detect, parse } from "./decode.js";
|
|
2
7
|
export { encode, generate } from "./encode.js";
|
|
3
8
|
export { validateDataModel, ValidationErrorMessage } from "./validations.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/base32hex.
|
|
1
|
+
{"root":["../src/base32hex.ts","../src/cli.ts","../src/crc32.ts","../src/deburr.ts","../src/decode.ts","../src/encode.ts","../src/helpers.ts","../src/index.ts","../src/test_assets.ts","../src/types.ts","../src/validations.ts"],"version":"5.6.2"}
|
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.12.
|
|
4
|
+
"version": "2.12.1",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"funding": "https://github.com/sponsors/xseman",
|
|
7
7
|
"homepage": "https://github.com/xseman/bysquare#readme",
|
|
@@ -17,18 +17,15 @@
|
|
|
17
17
|
"url": "git+https://github.com/xseman/bysquare.git"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
|
-
"prebuild": "tsc --build --clean",
|
|
21
20
|
"build": "tsc --build",
|
|
22
21
|
"fmt": "dprint fmt",
|
|
23
22
|
"fmt:check": "dprint check",
|
|
24
23
|
"typecheck": "tsc --noEmit",
|
|
25
|
-
"version": "git checkout develop && npm test",
|
|
26
|
-
"postversion": "echo 'Now run npm run build && npm publish'",
|
|
27
24
|
"test": "TS_NODE_TRANSPILE_ONLY=true node --test --experimental-test-coverage --loader=ts-node/esm --no-warnings src/*.test.ts",
|
|
28
25
|
"test:watch": "TS_NODE_TRANSPILE_ONLY=true node --test --watch --loader=ts-node/esm --no-warnings src/*.test.ts"
|
|
29
26
|
},
|
|
30
27
|
"dependencies": {
|
|
31
|
-
"lzma1": "0.0.
|
|
28
|
+
"lzma1": "0.0.5",
|
|
32
29
|
"validator": "^13.12.0"
|
|
33
30
|
},
|
|
34
31
|
"devDependencies": {
|
|
@@ -41,7 +38,6 @@
|
|
|
41
38
|
"type": "module",
|
|
42
39
|
"bin": "./dist/cli.js",
|
|
43
40
|
"types": "./dist/index.d.ts",
|
|
44
|
-
"module": "./dist/index.js",
|
|
45
41
|
"exports": {
|
|
46
42
|
".": {
|
|
47
43
|
"import": "./dist/index.js"
|
|
@@ -50,9 +46,5 @@
|
|
|
50
46
|
"files": [
|
|
51
47
|
"dist",
|
|
52
48
|
"!dist/*.test.*"
|
|
53
|
-
]
|
|
54
|
-
"engines": {
|
|
55
|
-
"node": ">=16",
|
|
56
|
-
"npm": ">=7"
|
|
57
|
-
}
|
|
49
|
+
]
|
|
58
50
|
}
|