-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.ts
161 lines (133 loc) · 3.88 KB
/
types.ts
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
export interface Data {
/**
* Creditor related data.
*/
creditor: Creditor;
/**
* The currency to be used. **3 characters.**.
*/
currency: "CHF" | "EUR" | "GBP" | "USD";
/**
* Additional information. **Max 140 characters.**.
*
* Bill information contain coded information for automated booking of the payment. The data is not forwarded with the payment.
*/
additionalInformation?: string;
/**
* The amount. **Max. 12 digits.**.
*/
amount?: number;
/**
* Alternative scheme. **Max. 100 characters.**.
*
* Parameter character chain of the alternative scheme according to the syntax definition in the [“Alternative scheme” section](https://www.paymentstandards.ch/dam/downloads/ig-qr-bill-en.pdf).
*/
av1?: string;
/**
* Alternative scheme. **Max. 100 characters.**.
*
* Parameter character chain of the alternative scheme according to the syntax definition in the [“Alternative scheme” section](https://www.paymentstandards.ch/dam/downloads/ig-qr-bill-en.pdf).
*/
av2?: string;
/**
* Debtor related data.
*/
debtor?: Debtor;
/**
* A message. **Max. 140 characters.**.
*
* Message can be used to indicate the payment purpose or for additional textual information about payments with a structured reference.
*/
message?: string;
/**
* A reference number. **Max 27 characters.**.
*
* QR-IBAN: Maximum 27 characters. Must be filled if a QR-IBAN is used.
* Creditor Reference (ISO 11649): Maximum 25 characters.
*/
reference?: string;
}
export interface Debtor {
/**
* Address. **Max 70 characters.**.
*/
address: string;
/**
* City. **Max 35 characters.**.
*/
city: string;
/**
* Country code. **2 characters.**.
*/
country: string;
/**
* Name. **Max. 70 characters.**.
*/
name: string;
/**
* Postal code. **Max 16 characters.**.
*/
zip: number | string;
/**
* Building number. **Max 16 characters.**.
*/
buildingNumber?: number | string;
}
export interface Creditor extends Debtor {
/**
* The IBAN. **21 characters.**.
*/
account: string;
}
interface QRBillOptions {
/**
* Font used for the QR-Bill.
* Fonts other than Helvetica must be registered in the PDFKit document. {@link http://pdfkit.org/docs/text.html#fonts}.
*
* @default 'Helvetica'
* @example
* ```ts
* // Register the font
* pdf.registerFont("Liberation-Sans", "path/to/LiberationSans-Regular.ttf");
* pdf.registerFont("Liberation-Sans-Bold", "path/to/LiberationSans-Bold.ttf");
*
* const qrBill = new SwissQRBill(data, { fontName: "Liberation-Sans" });
* ```
*/
fontName?: "Arial" | "Frutiger" | "Helvetica" | "Liberation Sans";
/**
* The language with which the bill is rendered.
*
* @default `DE`
*/
language?: "DE" | "EN" | "FR" | "IT";
/**
* Whether you want render the outlines. This option may be disabled if you use perforated paper.
*
* @default `true`
*/
outlines?: boolean;
/**
* Whether you want to show the scissors icons or the text `Separate before paying in`.
*
* **Warning:** Setting **scissors** to false sets **separate** to true. To disable scissors and separate, you have to set both options to false.
*
* @default `true`
*/
scissors?: boolean;
}
export interface PDFOptions extends QRBillOptions {
/**
* Whether you want to show the text `Separate before paying in` rather than the scissors icons.
*
* **Warning:** Setting **separate** to true sets **scissors** to false. To disable scissors and separate, you have to set both options to false.
*
* @default `false`
*/
separate?: boolean;
}
export interface SVGOptions extends QRBillOptions {
}
export type Language = Exclude<QRBillOptions["language"], undefined>;
export type FontName = Exclude<QRBillOptions["fontName"], undefined>;
export type Currency = Exclude<Data["currency"], undefined>;