-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
48 lines (43 loc) · 885 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
const qr = require('qr-image');
function createSepaQr (options = {}) {
const {
serviceTag = 'BCD',
version = '002',
characterSet = createSepaQr.UTF_8,
identification = 'SCT',
bic = '',
name = '',
iban,
amount = 0.01,
purpose = '',
remittance = '',
information = '',
...qrOptions
} = options;
qrOptions.ec_level = 'M';
return qr.image(
[
serviceTag,
version,
characterSet,
identification,
bic,
name,
iban,
`EUR${amount}`,
purpose,
remittance,
information
].join('\n'),
qrOptions
);
};
createSepaQr.UTF_8 = 1;
createSepaQr.ISO_8859_1 = 2;
createSepaQr.ISO_8859_2 = 3;
createSepaQr.ISO_8859_4 = 4;
createSepaQr.ISO_8859_5 = 5;
createSepaQr.ISO_8859_7 = 6;
createSepaQr.ISO_8859_10 = 7;
createSepaQr.ISO_8859_15 = 8;
module.exports = createSepaQr;