qr-bills 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/qr-bills/qr-html-layout.rb +213 -212
- data/lib/qr-bills/qr-params.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4e0c50076c6306674c5b1c294d5da24aad2338309f43804cc0ece61eaf7d455
|
4
|
+
data.tar.gz: 4e6b79aab92d32c4dce909d5e7da99f1c6ad130940169abde7d4fba81e7b0854
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4e718704b85a1aa0dc9ab40b82418a076671df9c6cabc0256c53373c3b65bbf261157706446dce0015860c6631b3b84c8e57bfc55e762b3d628862ebbb14cea
|
7
|
+
data.tar.gz: fd9afcd5a8c5e84653ecfce7ca6c0c9201680bb0092d8eae9218a454b1018a34e2f5712a68892504efbe6e988ef5ea8120935043eff67c62d621e2bcc56f63a3
|
@@ -8,229 +8,230 @@ module QRHTMLLayout
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def self.html_layout(params)
|
11
|
-
I18n.
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
11
|
+
I18n.with_locale(params[:bill_params][:language]) do
|
12
|
+
layout = "<div class=\"bill_container\">\n"
|
13
|
+
layout += " <div class=\"receipt_section\">\n"
|
14
|
+
layout += " <div class=\"title\">#{I18n.t("qrbills.receipt").capitalize}</div>\n"
|
15
|
+
layout += " <div class=\"subtitle payable_to\">#{I18n.t("qrbills.account").capitalize} / #{I18n.t("qrbills.payable_to").capitalize}</div>\n"
|
16
|
+
layout += " <div class=\"qrcontent\">\n"
|
17
|
+
layout += " #{params[:bill_params][:creditor][:iban]}<br/>\n"
|
18
|
+
layout += " #{params[:bill_params][:creditor][:address][:name]}<br/>\n"
|
19
|
+
layout += " #{params[:bill_params][:creditor][:address][:line1]} #{params[:bill_params][:creditor][:address][:line2]}<br/>\n"
|
20
|
+
layout += " #{params[:bill_params][:creditor][:address][:postal_code]} #{params[:bill_params][:creditor][:address][:town]}<br/>\n"
|
21
|
+
layout += " </div>\n"
|
22
|
+
layout += " <div><br/></div>\n"
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
24
|
+
if !params[:bill_params][:reference].nil? && !params[:bill_params][:reference].empty?
|
25
|
+
layout += " <div class=\"subtitle reference\">#{I18n.t("qrbills.reference").capitalize}</div>\n"
|
26
|
+
layout += " <div class=\"reference\">\n"
|
27
|
+
layout += " #{params[:bill_params][:reference]}<br/>\n"
|
28
|
+
layout += " </div>\n"
|
29
|
+
layout += " <div><br/></div>\n"
|
30
|
+
end
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
32
|
+
layout += " <div class=\"subtitle payable_by\">#{I18n.t("qrbills.payable_by").capitalize}</div>\n"
|
33
|
+
layout += " <div class=\"payable_by\">\n"
|
34
|
+
layout += " #{params[:bill_params][:debtor][:address][:name]}<br/>\n"
|
35
|
+
layout += " #{params[:bill_params][:debtor][:address][:line1]} #{params[:bill_params][:debtor][:address][:line2]}<br/>\n"
|
36
|
+
layout += " #{params[:bill_params][:debtor][:address][:postal_code]} #{params[:bill_params][:debtor][:address][:town]}<br/>\n"
|
37
|
+
layout += " </div>\n"
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
39
|
+
layout += " <div class=\"amount\">\n"
|
40
|
+
layout += " <div class=\"currency\">\n"
|
41
|
+
layout += " <span class=\"amount_header subtitle\">#{I18n.t("qrbills.currency").capitalize}</span><br/>\n"
|
42
|
+
layout += " #{params[:bill_params][:currency]}<br/>\n"
|
43
|
+
layout += " </div>\n"
|
44
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
|
-
|
45
|
+
layout += " <div class=\"amount_value\">\n"
|
46
|
+
layout += " <span class=\"amount_header subtitle\">#{I18n.t("qrbills.amount").capitalize}</span><br/>\n"
|
47
|
+
layout += " #{format('%.2f', params[:bill_params][:amount])}<br/>\n"
|
48
|
+
layout += " </div>\n"
|
49
|
+
layout += " </div>\n"
|
50
|
+
|
51
|
+
layout += " <div class=\"acceptance_point\">\n"
|
52
|
+
layout += " #{I18n.t("qrbills.acceptance_point").capitalize}<br/>\n"
|
53
|
+
layout += " </div>\n"
|
54
|
+
|
55
|
+
layout += " </div>\n"
|
56
|
+
layout += " <div class=\"payment_section\">\n"
|
57
|
+
layout += " <div class=\"left_column\">\n"
|
58
|
+
layout += " <div class=\"title\">#{I18n.t("qrbills.payment_part").capitalize}</div>\n"
|
59
|
+
layout += " <div class=\"qr_code\"><img src=\"#{params[:qrcode_filepath]}\" /></div>\n"
|
60
|
+
layout += " <div class=\"amount\">\n"
|
61
|
+
layout += " <div class=\"currency\">\n"
|
62
|
+
layout += " <span class=\"amount_header subtitle\">#{I18n.t("qrbills.currency").capitalize}</span><br/>\n"
|
63
|
+
layout += " #{params[:bill_params][:currency]}<br/>\n"
|
64
|
+
layout += " </div>\n"
|
65
|
+
|
66
|
+
layout += " <div class=\"amount_value\">\n"
|
67
|
+
layout += " <span class=\"amount_header subtitle\">#{I18n.t("qrbills.amount").capitalize}</span><br/>\n"
|
68
|
+
layout += " #{format('%.2f',params[:bill_params][:amount])}<br/>\n"
|
69
|
+
layout += " </div>\n"
|
70
|
+
layout += " </div>\n"
|
71
|
+
|
72
|
+
layout += " <div class=\"further_information\">\n"
|
73
73
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
74
|
+
if !params[:bill_params][:bill_information_coded].nil? && !params[:bill_params][:bill_information_coded].empty?
|
75
|
+
layout += " <span class=\"finfo_header\">#{I18n.t("qrbills.name").capitalize} AV1:</span> #{params[:bill_params][:bill_information_coded]}\n"
|
76
|
+
end
|
77
|
+
|
78
|
+
if !params[:bill_params][:alternative_scheme_parameters].nil? && !params[:bill_params][:alternative_scheme_parameters].empty?
|
79
|
+
layout += " <span class=\"finfo_header\">#{I18n.t("qrbills.name").capitalize} AV2:</span> #{params[:bill_params][:alternative_scheme_parameters]}\n"
|
80
|
+
end
|
81
81
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
82
|
+
layout += " </div>\n"
|
83
|
+
layout += " </div>\n"
|
84
|
+
layout += " <div class=\"right_column\">\n"
|
85
|
+
layout += " <div class=\"subtitle payable_to\">#{I18n.t("qrbills.account").capitalize} / #{I18n.t("qrbills.payable_to").capitalize}</div>\n"
|
86
|
+
layout += " <div class=\"qrcontent\">\n"
|
87
|
+
layout += " #{params[:bill_params][:creditor][:iban]}<br/>\n"
|
88
|
+
layout += " #{params[:bill_params][:creditor][:address][:name]}<br/>\n"
|
89
|
+
layout += " #{params[:bill_params][:creditor][:address][:line1]} #{params[:bill_params][:creditor][:address][:line2]}<br/>\n"
|
90
|
+
layout += " #{params[:bill_params][:creditor][:address][:postal_code]} #{params[:bill_params][:creditor][:address][:town]}<br/>\n"
|
91
|
+
layout += " </div>\n"
|
92
|
+
layout += " <div><br/></div>\n"
|
93
93
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
94
|
+
if !params[:bill_params][:reference].nil? && !params[:bill_params][:reference].empty?
|
95
|
+
layout += " <div class=\"subtitle reference\">#{I18n.t("qrbills.reference").capitalize}</div>\n"
|
96
|
+
layout += " <div class=\"reference\">\n"
|
97
|
+
layout += " #{params[:bill_params][:reference]}<br/>\n"
|
98
|
+
layout += " </div>\n"
|
99
|
+
layout += " <div><br/></div>\n"
|
100
|
+
end
|
101
101
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
102
|
+
if !params[:bill_params][:additionally_information].nil? && !params[:bill_params][:additionally_information].empty?
|
103
|
+
layout += " <div class=\"subtitle additional_information\">#{I18n.t("qrbills.additional_information").capitalize}</div>\n"
|
104
|
+
layout += " <div class=\"additional_information\">\n"
|
105
|
+
layout += " #{params[:bill_params][:additionally_information]}<br/>\n"
|
106
|
+
layout += " </div>\n"
|
107
|
+
layout += " <div><br/></div>\n"
|
108
|
+
end
|
109
109
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
110
|
+
layout += " <div class=\"subtitle payable_by\">#{I18n.t("qrbills.payable_by").capitalize}</div>\n"
|
111
|
+
layout += " <div class=\"payable_by\">\n"
|
112
|
+
layout += " #{params[:bill_params][:debtor][:address][:name]}<br/>\n"
|
113
|
+
layout += " #{params[:bill_params][:debtor][:address][:line1]} #{params[:bill_params][:debtor][:address][:line2]}<br/>\n"
|
114
|
+
layout += " #{params[:bill_params][:debtor][:address][:postal_code]} #{params[:bill_params][:debtor][:address][:town]}<br/>\n"
|
115
|
+
layout += " </div>\n"
|
116
|
+
layout += " </div>\n"
|
117
|
+
layout += " </div>\n"
|
118
|
+
layout += "</div>\n"
|
119
|
+
|
120
|
+
layout += "<style>\n"
|
121
|
+
layout += " @font-face{ \n"
|
122
|
+
layout += " font-family: \"liberation_sansregular\";\n"
|
123
|
+
layout += " src: url(\"#{params[:fonts][:eot]}\");\n"
|
124
|
+
layout += " src: url(\"#{params[:fonts][:eot]}?#iefix\") format(\"embedded-opentype\"),\n"
|
125
|
+
layout += " url(\"#{params[:fonts][:woff]}\") format(\"woff\"),\n"
|
126
|
+
layout += " url(\"#{params[:fonts][:ttf]}\") format(\"truetype\"),\n"
|
127
|
+
layout += " url(\"#{params[:fonts][:svg]}#liberation_sansregular\") format(\"svg\");\n"
|
128
|
+
layout += " font-weight: normal;\n"
|
129
|
+
layout += " font-style: normal;\n"
|
130
|
+
layout += " }\n"
|
131
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
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
132
|
+
layout += " .bill_container {\n"
|
133
|
+
layout += " width: 210mm;\n"
|
134
|
+
layout += " height: 105mm;\n"
|
135
|
+
layout += " font-family: \"liberation_sansregular\";\n"
|
136
|
+
layout += " border: 1px solid #ccc;\n"
|
137
|
+
layout += " }\n"
|
138
|
+
|
139
|
+
layout += " .bill_container:after {\n"
|
140
|
+
layout += " content: \"\";\n"
|
141
|
+
layout += " display: table;\n"
|
142
|
+
layout += " clear: both;\n"
|
143
|
+
layout += " }\n"
|
144
|
+
|
145
|
+
layout += " .receipt_section {\n"
|
146
|
+
layout += " width: 52mm;\n"
|
147
|
+
layout += " height: 95mm;\n"
|
148
|
+
layout += " padding: 5mm;\n"
|
149
|
+
layout += " float: left;\n"
|
150
|
+
layout += " font-size: 8pt;\n"
|
151
|
+
layout += " border-right: 1px dotted #ccc;\n"
|
152
|
+
layout += " }\n"
|
153
|
+
|
154
|
+
layout += " .payment_section {\n"
|
155
|
+
layout += " width: 137mm;\n"
|
156
|
+
layout += " height: 95mm;\n"
|
157
|
+
layout += " float: left;\n"
|
158
|
+
layout += " padding: 5mm;\n"
|
159
|
+
layout += " font-size: 10pt;\n"
|
160
|
+
layout += " }\n"
|
161
|
+
|
162
|
+
layout += " .payment_section .left_column {\n"
|
163
|
+
layout += " height: 95mm;\n"
|
164
|
+
layout += " width: 46mm;\n"
|
165
|
+
layout += " float: left;\n"
|
166
|
+
layout += " margin-right: 5mm;\n"
|
167
|
+
layout += " }\n"
|
168
|
+
|
169
|
+
layout += " .payment_section .right_column {\n"
|
170
|
+
layout += " height: 95mm;\n"
|
171
|
+
layout += " width: 86mm;\n"
|
172
|
+
layout += " float: left;\n"
|
173
|
+
layout += " }\n"
|
174
|
+
|
175
|
+
layout += " .qr_code {\n"
|
176
|
+
layout += " padding: 5mm 0mm 5mm 0mm;\n"
|
177
|
+
layout += " height: 46mm;\n"
|
178
|
+
layout += " width: 46mm;\n"
|
179
|
+
layout += " }\n"
|
180
|
+
|
181
|
+
layout += " .qr_code img {\n"
|
182
|
+
layout += " height: 46mm;\n"
|
183
|
+
layout += " width: 46mm;\n"
|
184
|
+
layout += " }\n"
|
185
|
+
|
186
|
+
layout += " .amount {\n"
|
187
|
+
layout += " margin-top: 15px;\n"
|
188
|
+
layout += " }\n"
|
189
|
+
|
190
|
+
layout += " .amount .currency {\n"
|
191
|
+
layout += " float: left;\n"
|
192
|
+
layout += " margin-right: 15px;\n"
|
193
|
+
layout += " }\n"
|
194
|
+
|
195
|
+
layout += " .title {\n"
|
196
|
+
layout += " font-weight: bold;\n"
|
197
|
+
layout += " font-size: 11pt;\n"
|
198
|
+
layout += " }\n"
|
199
|
+
|
200
|
+
layout += " .receipt_section .subtitle {\n"
|
201
|
+
layout += " font-weight: bold;\n"
|
202
|
+
layout += " font-size: 6pt;\n"
|
203
|
+
layout += " line-height: 9pt;\n"
|
204
|
+
layout += " }\n"
|
205
|
+
|
206
|
+
layout += " .receipt_section .acceptance_point {\n"
|
207
|
+
layout += " font-weight: bold;\n"
|
208
|
+
layout += " text-align: right;\n"
|
209
|
+
layout += " font-size: 6pt;\n"
|
210
|
+
layout += " line-height: 8pt;\n"
|
211
|
+
layout += " padding-top: 5mm;\n"
|
212
|
+
layout += " }\n"
|
213
|
+
|
214
|
+
layout += " .payment_section .subtitle {\n"
|
215
|
+
layout += " font-weight: bold;\n"
|
216
|
+
layout += " font-size: 8pt;\n"
|
217
|
+
layout += " line-height: 11pt;\n"
|
218
|
+
layout += " }\n"
|
219
|
+
|
220
|
+
layout += " .payment_section .amount {\n"
|
221
|
+
layout += " height: 22mm;\n"
|
222
|
+
layout += " margin-top: 40px;\n"
|
223
|
+
layout += " }\n"
|
224
224
|
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
225
|
+
layout += " .payment_section .further_information {\n"
|
226
|
+
layout += " font-size: 7pt;\n"
|
227
|
+
layout += " }\n"
|
228
|
+
|
229
|
+
layout += " .payment_section .finfo_header {\n"
|
230
|
+
layout += " font-weight: bold;\n"
|
231
|
+
layout += " } \n"
|
232
|
+
layout += "</style>\n"
|
233
233
|
|
234
|
-
|
234
|
+
return layout
|
235
|
+
end
|
235
236
|
end
|
236
237
|
end
|
data/lib/qr-bills/qr-params.rb
CHANGED
@@ -17,7 +17,7 @@ module QRParams
|
|
17
17
|
path: File.expand_path("#{File.dirname(__FILE__)}/../../config/locales")
|
18
18
|
},
|
19
19
|
bill_params: {
|
20
|
-
language:
|
20
|
+
language: I18n.locale,
|
21
21
|
amount: 0.0,
|
22
22
|
currency: "CHF",
|
23
23
|
reference_type: "", # QRR = QR reference, SCOR = Creditor reference, NON = without reference
|
@@ -122,4 +122,4 @@ module QRParams
|
|
122
122
|
|
123
123
|
true
|
124
124
|
end
|
125
|
-
end
|
125
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qr-bills
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Damiano Radice
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|