qr-bills 0.0.1 → 0.2.2
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.
- checksums.yaml +5 -5
- data/config/locales/qrbills.de.yml +17 -0
- data/config/locales/qrbills.en.yml +17 -0
- data/config/locales/qrbills.fr.yml +17 -0
- data/config/locales/qrbills.it.yml +17 -0
- data/lib/qr-bills.rb +56 -2
- data/lib/qr-bills/qr-creditor-reference.rb +75 -0
- data/lib/qr-bills/qr-exceptions.rb +6 -0
- data/lib/qr-bills/qr-generator.rb +105 -0
- data/lib/qr-bills/qr-html-layout.rb +235 -0
- data/lib/qr-bills/qr-params.rb +98 -0
- data/web/assets/fonts/LiberationSans-Regular.eot +0 -0
- data/web/assets/fonts/LiberationSans-Regular.svg +356 -0
- data/web/assets/fonts/LiberationSans-Regular.ttf +0 -0
- data/web/assets/fonts/LiberationSans-Regular.woff +0 -0
- data/web/assets/images/amoint_40x15mm.png +0 -0
- data/web/assets/images/payable_by_65x25mm.png +0 -0
- data/web/assets/images/scissors_symbol.png +0 -0
- data/web/assets/images/swiss_cross.png +0 -0
- metadata +121 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 673b6c6cd7948ecf8121a1cff9462c6d60a7c8b1022078fae2eb463919885dc7
|
4
|
+
data.tar.gz: 765e8d32630c70b9b8441e0cc8613821ba8e683bd9324293adc3ebdea4ec785d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bcb1a9f90fae5d55d14d2452212a47a29fa6049e9f1f86cc9ed682824424614a5909095b69aa0adc4f2b8d1f092fcc9fd56316b8742c559ba571acaaaba7a282
|
7
|
+
data.tar.gz: 58723203eeb46a9948ed5d37fcb35603c2e6abb7a294d351c30c7f3e26629fc0a4eecfd493aa947cef794a25fdc56c6a73432f57be3a373ce5c9fe2146c1b28d
|
@@ -0,0 +1,17 @@
|
|
1
|
+
de:
|
2
|
+
qrbills:
|
3
|
+
payment_part: Zahlteil
|
4
|
+
account: Konto
|
5
|
+
payable_to: Zahlbar an
|
6
|
+
reference: Referenz
|
7
|
+
additional_information: zusätzliche Informationen
|
8
|
+
further_information: weitere Informationen
|
9
|
+
currency: Währung
|
10
|
+
amount: Betrag
|
11
|
+
receipt: Empfangsschein
|
12
|
+
acceptance_point: Annahmestelle
|
13
|
+
separate_before_paying_in: Vor der Einzahlung abzutrennen
|
14
|
+
payable_by: Zahlbar durch
|
15
|
+
payable_by_name_addr: Zahlbar durch (Name/Adresse)
|
16
|
+
in_favour_of: Zugunsten
|
17
|
+
name: Name
|
@@ -0,0 +1,17 @@
|
|
1
|
+
en:
|
2
|
+
qrbills:
|
3
|
+
payment_part: payment part
|
4
|
+
account: account
|
5
|
+
payable_to: payable to
|
6
|
+
reference: reference
|
7
|
+
additional_information: additional information
|
8
|
+
further_information: further information
|
9
|
+
currency: currency
|
10
|
+
amount: amount
|
11
|
+
receipt: receipt
|
12
|
+
acceptance_point: acceptance point
|
13
|
+
separate_before_paying_in: separate before paying in
|
14
|
+
payable_by: payable by
|
15
|
+
payable_by_name_addr: payable by (name/address)
|
16
|
+
in_favour_of: in favour of
|
17
|
+
name: nom
|
@@ -0,0 +1,17 @@
|
|
1
|
+
fr:
|
2
|
+
qrbills:
|
3
|
+
payment_part: section paiement
|
4
|
+
account: compte
|
5
|
+
payable_to: payable à
|
6
|
+
reference: référence
|
7
|
+
additional_information: informations additionnelles
|
8
|
+
further_information: informations supplémentaires
|
9
|
+
currency: monnaie
|
10
|
+
amount: montant
|
11
|
+
receipt: récépissé
|
12
|
+
acceptance_point: èpomt de dépôt
|
13
|
+
separate_before_paying_in: à détacher avant le versement
|
14
|
+
payable_by: payable par
|
15
|
+
payable_by_name_addr: payable par (nom/adresse)
|
16
|
+
in_favour_of: en faveur de
|
17
|
+
name: name
|
@@ -0,0 +1,17 @@
|
|
1
|
+
it:
|
2
|
+
qrbills:
|
3
|
+
payment_part: "sezione pagamento"
|
4
|
+
account: conto
|
5
|
+
payable_to: "pagabile a"
|
6
|
+
reference: riferimento
|
7
|
+
additional_information: "informazioni aggiuntive"
|
8
|
+
further_information: "informazioni supplementari"
|
9
|
+
currency: valuta
|
10
|
+
amount: importo
|
11
|
+
receipt: ricevuta
|
12
|
+
acceptance_point: "punto di accettazione"
|
13
|
+
separate_before_paying_in: "da staccare prima del versamento"
|
14
|
+
payable_by: pagabile da
|
15
|
+
payable_by_name_addr: pagabile da (nome/indirizzo)
|
16
|
+
in_favour_of: a favore di
|
17
|
+
name: nome
|
data/lib/qr-bills.rb
CHANGED
@@ -1,5 +1,59 @@
|
|
1
|
+
require 'i18n'
|
2
|
+
require 'qr-bills/qr-exceptions'
|
3
|
+
require 'qr-bills/qr-params'
|
4
|
+
require 'qr-bills/qr-html-layout'
|
5
|
+
require 'qr-bills/qr-creditor-reference'
|
6
|
+
|
1
7
|
class QRBills
|
2
|
-
def self.
|
3
|
-
|
8
|
+
def self.generate(qr_params)
|
9
|
+
|
10
|
+
# params validation
|
11
|
+
if qr_params.has_key?(:bill_type)
|
12
|
+
|
13
|
+
if !QRParams.valid?(qr_params)
|
14
|
+
raise QRExceptions::INVALID_PARAMETERS + ": params validation check failed"
|
15
|
+
end
|
16
|
+
|
17
|
+
if !qr_params[:output_params][:format] == "html"
|
18
|
+
raise QRExceptions::NOT_SUPPORTED + ": html is the only output format supported so far"
|
19
|
+
end
|
20
|
+
|
21
|
+
else
|
22
|
+
raise QRExceptions::INVALID_PARAMETERS + ": bill type param not set"
|
23
|
+
end
|
24
|
+
|
25
|
+
# init translator sets
|
26
|
+
I18n.load_path << File.join(qr_params[:locales][:path], "qrbills.it.yml")
|
27
|
+
I18n.load_path << File.join(qr_params[:locales][:path], "qrbills.en.yml")
|
28
|
+
I18n.load_path << File.join(qr_params[:locales][:path], "qrbills.de.yml")
|
29
|
+
I18n.load_path << File.join(qr_params[:locales][:path], "qrbills.fr.yml")
|
30
|
+
I18n.default_locale = :it
|
31
|
+
|
32
|
+
bill = {
|
33
|
+
params: qr_params,
|
34
|
+
output: QRHTMLLayout.create(qr_params)
|
35
|
+
}
|
36
|
+
|
37
|
+
return bill
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.create_creditor_reference(reference)
|
41
|
+
return QRCreditorReference.create(reference)
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.get_qr_params
|
45
|
+
QRParams.get_qr_params
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.get_qrbill_with_qr_reference_type
|
49
|
+
QRParams::QR_BILL_WITH_QR_REFERENCE
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.get_qrbill_with_creditor_reference_type
|
53
|
+
QRParams::QR_BILL_WITH_CREDITOR_REFERENCE
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.get_qrbill_without_reference_type
|
57
|
+
QRParams::QR_BILL_WITOUTH_REFERENCE
|
4
58
|
end
|
5
59
|
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'qr-bills/qr-exceptions'
|
2
|
+
|
3
|
+
# implement Creditor Reference ISO 11649 generator
|
4
|
+
class QRCreditorReference
|
5
|
+
PREFIX = "RF"
|
6
|
+
|
7
|
+
@char_values = {
|
8
|
+
"A": 10,
|
9
|
+
"B": 11,
|
10
|
+
"C": 12,
|
11
|
+
"D": 13,
|
12
|
+
"E": 14,
|
13
|
+
"F": 15,
|
14
|
+
"G": 16,
|
15
|
+
"H": 17,
|
16
|
+
"I": 18,
|
17
|
+
"J": 19,
|
18
|
+
"K": 20,
|
19
|
+
"L": 21,
|
20
|
+
"M": 22,
|
21
|
+
"N": 23,
|
22
|
+
"O": 24,
|
23
|
+
"P": 25,
|
24
|
+
"Q": 26,
|
25
|
+
"R": 27,
|
26
|
+
"S": 28,
|
27
|
+
"T": 29,
|
28
|
+
"U": 30,
|
29
|
+
"V": 31,
|
30
|
+
"W": 32,
|
31
|
+
"X": 33,
|
32
|
+
"Y": 34,
|
33
|
+
"Z": 35
|
34
|
+
}
|
35
|
+
|
36
|
+
def self.create(reference)
|
37
|
+
reference = reference.delete(' ')
|
38
|
+
chars = reference.split('')
|
39
|
+
|
40
|
+
if chars.size == 0
|
41
|
+
raise QRExceptions::INVALID_PARAMETERS + ": provided reference too short: must be at least one char"
|
42
|
+
end
|
43
|
+
|
44
|
+
# max 25 chars: 2 chars (RF) + 2 chars (check code) + 21 chars (reference)
|
45
|
+
if chars.size > 21
|
46
|
+
raise QRExceptions::INVALID_PARAMETERS + ": provided reference too long: must be less than 21 chars"
|
47
|
+
end
|
48
|
+
|
49
|
+
reference_val = ""
|
50
|
+
|
51
|
+
chars.each do |c|
|
52
|
+
reference_val += get_char_value(c).to_s
|
53
|
+
end
|
54
|
+
|
55
|
+
# put RF+00 at the end to resolve check code
|
56
|
+
reference_val += @char_values["R".to_sym].to_s + @char_values["F".to_sym].to_s + "00"
|
57
|
+
|
58
|
+
# get check code
|
59
|
+
check_code = 98 - (reference_val.to_i % 97)
|
60
|
+
|
61
|
+
if check_code < 10
|
62
|
+
check_code = "0" + check_code.to_s
|
63
|
+
end
|
64
|
+
|
65
|
+
return PREFIX + check_code.to_s + reference
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.get_char_value(char)
|
69
|
+
if char =~ /[0-9]/
|
70
|
+
return char.to_i
|
71
|
+
end
|
72
|
+
|
73
|
+
return @char_values[char.upcase.to_sym]
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,105 @@
|
|
1
|
+
require 'rqrcode'
|
2
|
+
require 'rmagick'
|
3
|
+
include Magick
|
4
|
+
|
5
|
+
class QRGenerator
|
6
|
+
# payload:
|
7
|
+
# "SPC\r\n" + # indicator for swiss qr code: SPC (swiss payments code)
|
8
|
+
# "0200\r\n" + # version of the specifications, 0200 = v2.0
|
9
|
+
# "1\r\n" + # character set code: 1 = utf-8 restricted to the latin character set
|
10
|
+
# "CH4431999123000889012\r\n" + # iban of the creditor (payable to)
|
11
|
+
# "S\r\n" + # adress type: S = structured address, K = combined address elements (2 lines)
|
12
|
+
# "Robert Schneider AG\r\n" + # creditor's name or company, max 70 characters
|
13
|
+
# "Via Casa Postale\r\n" + # structured address: creditor's address street; combined address: address line 1 street and building number
|
14
|
+
# "1268/2/22\r\n" + # structured address: creditor's building number; combined address: address line 2 including postal code and town
|
15
|
+
# "2501\r\n" + # creditor's postal code
|
16
|
+
# "Biel\r\n" + # creditor's town
|
17
|
+
# "CH\r\n" + # creditor's country
|
18
|
+
# "\r\n" + # optional: ultimate creditor's address type: S/K
|
19
|
+
# "\r\n" + # optional: ultimate creditor's name/company
|
20
|
+
# "\r\n" + # optional: ultimate creditor's street or address line 1
|
21
|
+
# "\r\n" + # optional: ultimate creditor's building number or address line 2
|
22
|
+
# "\r\n" + # optional: ultimate creditor's postal code
|
23
|
+
# "\r\n" + # optional: ultimate creditor's town
|
24
|
+
# "\r\n" + # optional: ultimate creditor's country
|
25
|
+
# "123949.75\r\n" + # amount
|
26
|
+
# "CHF\r\n" + # currency
|
27
|
+
# "S\r\n"+ # debtor's address type (S/K) (payable by)
|
28
|
+
# "Pia-Maria Rutschmann-Schnyder\r\n" + # debtor's name / company
|
29
|
+
# "Grosse Marktgasse\r\n" + # debtor's street or address line 1
|
30
|
+
# "28/5\r\n" + # debtor's building number or address line 2
|
31
|
+
# "9400\r\n" + # debtor's postal code
|
32
|
+
# "Rorschach\r\n" + # debtor's town
|
33
|
+
# "CH\r\n" + # debtor's country
|
34
|
+
# "QRR\r\n" + # reference type: QRR = QR reference, SCOR = Creditor reference, NON = without reference
|
35
|
+
# "210000000003139471430009017\r\n" + # reference QR Reference: 27 chars check sum modulo 10 recursive, Creditor reference max 25 chars
|
36
|
+
# "Beachten sie unsere Sonderangebotswoche bis 23.02.2017!\r\n" + # additional information unstructured message max 140 chars
|
37
|
+
# "EPD\r\n" + # fixed indicator for EPD (end payment data)
|
38
|
+
# "//S1/10/10201409/11/181105/40/0:30\r\n" + # bill information coded for automated booking of payment, data is not forwarded with the payment
|
39
|
+
# "eBill/B/41010560425610173"; # alternative scheme paramaters, max 100 chars
|
40
|
+
|
41
|
+
def self.create(params, qrcode_path)
|
42
|
+
create_qr(params, qrcode_path)
|
43
|
+
add_swiss_cross(qrcode_path, qrcode_path)
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.create_qr(params, qrcode_path)
|
47
|
+
payload = "SPC\r\n"
|
48
|
+
payload += "0200\r\n"
|
49
|
+
payload += "1\r\n"
|
50
|
+
payload += "#{params[:bill_params][:creditor][:iban].delete(' ')}\r\n"
|
51
|
+
payload += "#{params[:bill_params][:creditor][:address][:type]}\r\n"
|
52
|
+
payload += "#{params[:bill_params][:creditor][:address][:name]}\r\n"
|
53
|
+
payload += "#{params[:bill_params][:creditor][:address][:line1]}\r\n"
|
54
|
+
payload += "#{params[:bill_params][:creditor][:address][:line2]}\r\n"
|
55
|
+
payload += "#{params[:bill_params][:creditor][:address][:postal_code]}\r\n"
|
56
|
+
payload += "#{params[:bill_params][:creditor][:address][:town]}\r\n"
|
57
|
+
payload += "#{params[:bill_params][:creditor][:address][:country]}\r\n"
|
58
|
+
payload += "\r\n"
|
59
|
+
payload += "\r\n"
|
60
|
+
payload += "\r\n"
|
61
|
+
payload += "\r\n"
|
62
|
+
payload += "\r\n"
|
63
|
+
payload += "\r\n"
|
64
|
+
payload += "\r\n"
|
65
|
+
payload += "#{params[:bill_params][:amount]}\r\n"
|
66
|
+
payload += "#{params[:bill_params][:currency]}\r\n"
|
67
|
+
payload += "#{params[:bill_params][:debtor][:address][:type]}\r\n"
|
68
|
+
payload += "#{params[:bill_params][:debtor][:address][:name]}\r\n"
|
69
|
+
payload += "#{params[:bill_params][:debtor][:address][:line1]}\r\n"
|
70
|
+
payload += "#{params[:bill_params][:debtor][:address][:line2]}\r\n"
|
71
|
+
payload += "#{params[:bill_params][:debtor][:address][:postal_code]}\r\n"
|
72
|
+
payload += "#{params[:bill_params][:debtor][:address][:town]}\r\n"
|
73
|
+
payload += "#{params[:bill_params][:debtor][:address][:country]}\r\n"
|
74
|
+
payload += "#{params[:bill_params][:reference_type]}\r\n"
|
75
|
+
payload += "#{params[:bill_params][:reference].delete(' ')}\r\n"
|
76
|
+
payload += "#{params[:bill_params][:additionally_information]}\r\n"
|
77
|
+
payload += "EPD\r\n"
|
78
|
+
payload += "#{params[:bill_params][:bill_information_coded]}\r\n"
|
79
|
+
payload += "#{params[:bill_params][:alternative_scheme_paramters]}\r\n"
|
80
|
+
|
81
|
+
qrcode = RQRCode::QRCode.new(payload)
|
82
|
+
|
83
|
+
png = qrcode.as_png(
|
84
|
+
bit_depth: 1,
|
85
|
+
border_modules: 0,
|
86
|
+
color_mode: ChunkyPNG::COLOR_GRAYSCALE,
|
87
|
+
color: 'black',
|
88
|
+
file: nil,
|
89
|
+
fill: 'white',
|
90
|
+
module_px_size: 10,
|
91
|
+
resize_exactly_to: false,
|
92
|
+
resize_gte_to: false,
|
93
|
+
size: 1024,
|
94
|
+
)
|
95
|
+
|
96
|
+
IO.binwrite(qrcode_path, png.to_s)
|
97
|
+
end
|
98
|
+
|
99
|
+
def self.add_swiss_cross(qrcode_path, final_path)
|
100
|
+
qr_image = Image.read(qrcode_path)[0]
|
101
|
+
swiss_cross = Image.read(File.expand_path("#{File.dirname(__FILE__)}/../../web/assets/images/swiss_cross.png"))[0]
|
102
|
+
final_qr = qr_image.composite(swiss_cross, CenterGravity, OverCompositeOp)
|
103
|
+
final_qr.write(final_path)
|
104
|
+
end
|
105
|
+
end
|
@@ -0,0 +1,235 @@
|
|
1
|
+
require 'qr-bills/qr-generator'
|
2
|
+
|
3
|
+
class QRHTMLLayout
|
4
|
+
|
5
|
+
def self.create(params)
|
6
|
+
QRGenerator.create(params, params[:qrcode_filepath])
|
7
|
+
return html_layout(params)
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.html_layout(params)
|
11
|
+
layout = "<div class=\"bill_container\">\n"
|
12
|
+
layout += " <div class=\"receipt_section\">\n"
|
13
|
+
layout += " <div class=\"title\">#{I18n.t("qrbills.receipt").capitalize}</div>\n"
|
14
|
+
layout += " <div class=\"subtitle payable_to\">#{I18n.t("qrbills.account").capitalize} / #{I18n.t("qrbills.payable_to").capitalize}</div>\n"
|
15
|
+
layout += " <div class=\"qrcontent\">\n"
|
16
|
+
layout += " #{params[:bill_params][:creditor][:iban]}<br/>\n"
|
17
|
+
layout += " #{params[:bill_params][:creditor][:address][:name]}<br/>\n"
|
18
|
+
layout += " #{params[:bill_params][:creditor][:address][:line1]} #{params[:bill_params][:creditor][:address][:line2]}<br/>\n"
|
19
|
+
layout += " #{params[:bill_params][:creditor][:address][:postal_code]} #{params[:bill_params][:creditor][:address][:town]}<br/>\n"
|
20
|
+
layout += " </div>\n"
|
21
|
+
layout += " <div><br/></div>\n"
|
22
|
+
|
23
|
+
if !params[:bill_params][:reference].nil? && !params[:bill_params][:reference].empty?
|
24
|
+
layout += " <div class=\"subtitle reference\">#{I18n.t("qrbills.reference").capitalize}</div>\n"
|
25
|
+
layout += " <div class=\"reference\">\n"
|
26
|
+
layout += " #{params[:bill_params][:reference]}<br/>\n"
|
27
|
+
layout += " </div>\n"
|
28
|
+
layout += " <div><br/></div>\n"
|
29
|
+
end
|
30
|
+
|
31
|
+
layout += " <div class=\"subtitle payable_by\">#{I18n.t("qrbills.payable_by").capitalize}</div>\n"
|
32
|
+
layout += " <div class=\"payable_by\">\n"
|
33
|
+
layout += " #{params[:bill_params][:debtor][:address][:name]}<br/>\n"
|
34
|
+
layout += " #{params[:bill_params][:debtor][:address][:line1]} #{params[:bill_params][:debtor][:address][:line2]}<br/>\n"
|
35
|
+
layout += " #{params[:bill_params][:debtor][:address][:postal_code]} #{params[:bill_params][:debtor][:address][:town]}<br/>\n"
|
36
|
+
layout += " </div>\n"
|
37
|
+
|
38
|
+
layout += " <div class=\"amount\">\n"
|
39
|
+
layout += " <div class=\"currency\">\n"
|
40
|
+
layout += " <span class=\"amount_header subtitle\">#{I18n.t("qrbills.currency").capitalize}</span><br/>\n"
|
41
|
+
layout += " #{params[:bill_params][:currency]}<br/>\n"
|
42
|
+
layout += " </div>\n"
|
43
|
+
|
44
|
+
layout += " <div class=\"amount_value\">\n"
|
45
|
+
layout += " <span class=\"amount_header subtitle\">#{I18n.t("qrbills.amount").capitalize}</span><br/>\n"
|
46
|
+
layout += " #{params[:bill_params][:amount]}<br/>\n"
|
47
|
+
layout += " </div>\n"
|
48
|
+
layout += " </div>\n"
|
49
|
+
|
50
|
+
layout += " <div class=\"acceptance_point\">\n"
|
51
|
+
layout += " #{I18n.t("qrbills.acceptance_point").capitalize}<br/>\n"
|
52
|
+
layout += " </div>\n"
|
53
|
+
|
54
|
+
layout += " </div>\n"
|
55
|
+
layout += " <div class=\"payment_section\">\n"
|
56
|
+
layout += " <div class=\"left_column\">\n"
|
57
|
+
layout += " <div class=\"title\">#{I18n.t("qrbills.payment_part").capitalize}</div>\n"
|
58
|
+
layout += " <div class=\"qr_code\"><img src=\"#{params[:qrcode_filepath]}\" /></div>\n"
|
59
|
+
layout += " <div class=\"amount\">\n"
|
60
|
+
layout += " <div class=\"currency\">\n"
|
61
|
+
layout += " <span class=\"amount_header subtitle\">#{I18n.t("qrbills.currency").capitalize}</span><br/>\n"
|
62
|
+
layout += " #{params[:bill_params][:currency]}<br/>\n"
|
63
|
+
layout += " </div>\n"
|
64
|
+
|
65
|
+
layout += " <div class=\"amount_value\">\n"
|
66
|
+
layout += " <span class=\"amount_header subtitle\">#{I18n.t("qrbills.amount").capitalize}</span><br/>\n"
|
67
|
+
layout += " #{params[:bill_params][:amount]}<br/>\n"
|
68
|
+
layout += " </div>\n"
|
69
|
+
layout += " </div>\n"
|
70
|
+
|
71
|
+
layout += " <div class=\"further_information\">\n"
|
72
|
+
|
73
|
+
if !params[:bill_params][:bill_information_coded].nil? && !params[:bill_params][:bill_information_coded].empty?
|
74
|
+
layout += " <span class=\"finfo_header\">#{I18n.t("qrbills.name").capitalize} AV1:</span> #{params[:bill_params][:bill_information_coded]}\n"
|
75
|
+
end
|
76
|
+
|
77
|
+
if !params[:bill_params][:alternative_scheme_paramters].nil? && !params[:bill_params][:alternative_scheme_paramters].empty?
|
78
|
+
layout += " <span class=\"finfo_header\">#{I18n.t("qrbills.name").capitalize} AV2:</span> #{params[:bill_params][:alternative_scheme_paramters]}\n"
|
79
|
+
end
|
80
|
+
|
81
|
+
layout += " </div>\n"
|
82
|
+
layout += " </div>\n"
|
83
|
+
layout += " <div class=\"right_column\">\n"
|
84
|
+
layout += " <div class=\"subtitle payable_to\">#{I18n.t("qrbills.account").capitalize} / #{I18n.t("qrbills.payable_to").capitalize}</div>\n"
|
85
|
+
layout += " <div class=\"qrcontent\">\n"
|
86
|
+
layout += " #{params[:bill_params][:creditor][:iban]}<br/>\n"
|
87
|
+
layout += " #{params[:bill_params][:creditor][:address][:name]}<br/>\n"
|
88
|
+
layout += " #{params[:bill_params][:creditor][:address][:line1]} #{params[:bill_params][:creditor][:address][:line2]}<br/>\n"
|
89
|
+
layout += " #{params[:bill_params][:creditor][:address][:postal_code]} #{params[:bill_params][:creditor][:address][:town]}<br/>\n"
|
90
|
+
layout += " </div>\n"
|
91
|
+
layout += " <div><br/></div>\n"
|
92
|
+
|
93
|
+
if !params[:bill_params][:reference].nil? && !params[:bill_params][:reference].empty?
|
94
|
+
layout += " <div class=\"subtitle reference\">#{I18n.t("qrbills.reference").capitalize}</div>\n"
|
95
|
+
layout += " <div class=\"reference\">\n"
|
96
|
+
layout += " #{params[:bill_params][:reference]}<br/>\n"
|
97
|
+
layout += " </div>\n"
|
98
|
+
layout += " <div><br/></div>\n"
|
99
|
+
end
|
100
|
+
|
101
|
+
if !params[:bill_params][:additionally_information].nil? && !params[:bill_params][:additionally_information].empty?
|
102
|
+
layout += " <div class=\"subtitle additional_information\">#{I18n.t("qrbills.additional_information").capitalize}</div>\n"
|
103
|
+
layout += " <div class=\"additional_information\">\n"
|
104
|
+
layout += " #{params[:bill_params][:additionally_information]}<br/>\n"
|
105
|
+
layout += " </div>\n"
|
106
|
+
layout += " <div><br/></div>\n"
|
107
|
+
end
|
108
|
+
|
109
|
+
layout += " <div class=\"subtitle payable_by\">#{I18n.t("qrbills.payable_by").capitalize}</div>\n"
|
110
|
+
layout += " <div class=\"payable_by\">\n"
|
111
|
+
layout += " #{params[:bill_params][:debtor][:address][:name]}<br/>\n"
|
112
|
+
layout += " #{params[:bill_params][:debtor][:address][:line1]} #{params[:bill_params][:debtor][:address][:line2]}<br/>\n"
|
113
|
+
layout += " #{params[:bill_params][:debtor][:address][:postal_code]} #{params[:bill_params][:debtor][:address][:town]}<br/>\n"
|
114
|
+
layout += " </div>\n"
|
115
|
+
layout += " </div>\n"
|
116
|
+
layout += " </div>\n"
|
117
|
+
layout += "</div>\n"
|
118
|
+
|
119
|
+
layout += "<style>\n"
|
120
|
+
layout += " @font-face{ \n"
|
121
|
+
layout += " font-family: \"liberation_sansregular\";\n"
|
122
|
+
layout += " src: url(\"#{params[:fonts][:eot]}\");\n"
|
123
|
+
layout += " src: url(\"#{params[:fonts][:eot]}?#iefix\") format(\"embedded-opentype\"),\n"
|
124
|
+
layout += " url(\"#{params[:fonts][:woff]}\") format(\"woff\"),\n"
|
125
|
+
layout += " url(\"#{params[:fonts][:ttf]}\") format(\"truetype\"),\n"
|
126
|
+
layout += " url(\"#{params[:fonts][:svg]}#liberation_sansregular\") format(\"svg\");\n"
|
127
|
+
layout += " font-weight: normal;\n"
|
128
|
+
layout += " font-style: normal;\n"
|
129
|
+
layout += " }\n"
|
130
|
+
|
131
|
+
layout += " .bill_container {\n"
|
132
|
+
layout += " width: 210mm;\n"
|
133
|
+
layout += " height: 105mm;\n"
|
134
|
+
layout += " font-family: \"liberation_sansregular\";\n"
|
135
|
+
layout += " border: 1px solid #ccc;\n"
|
136
|
+
layout += " }\n"
|
137
|
+
|
138
|
+
layout += " .bill_container:after {\n"
|
139
|
+
layout += " content: \"\";\n"
|
140
|
+
layout += " display: table;\n"
|
141
|
+
layout += " clear: both;\n"
|
142
|
+
layout += " }\n"
|
143
|
+
|
144
|
+
layout += " .receipt_section {\n"
|
145
|
+
layout += " width: 52mm;\n"
|
146
|
+
layout += " height: 95mm;\n"
|
147
|
+
layout += " padding: 5mm;\n"
|
148
|
+
layout += " float: left;\n"
|
149
|
+
layout += " font-size: 8pt;\n"
|
150
|
+
layout += " border-right: 1px dotted #ccc;\n"
|
151
|
+
layout += " }\n"
|
152
|
+
|
153
|
+
layout += " .payment_section {\n"
|
154
|
+
layout += " width: 137mm;\n"
|
155
|
+
layout += " height: 95mm;\n"
|
156
|
+
layout += " float: left;\n"
|
157
|
+
layout += " padding: 5mm;\n"
|
158
|
+
layout += " font-size: 10pt;\n"
|
159
|
+
layout += " }\n"
|
160
|
+
|
161
|
+
layout += " .payment_section .left_column {\n"
|
162
|
+
layout += " height: 95mm;\n"
|
163
|
+
layout += " width: 46mm;\n"
|
164
|
+
layout += " float: left;\n"
|
165
|
+
layout += " margin-right: 5mm;\n"
|
166
|
+
layout += " }\n"
|
167
|
+
|
168
|
+
layout += " .payment_section .right_column {\n"
|
169
|
+
layout += " height: 95mm;\n"
|
170
|
+
layout += " width: 86mm;\n"
|
171
|
+
layout += " float: left;\n"
|
172
|
+
layout += " }\n"
|
173
|
+
|
174
|
+
layout += " .qr_code {\n"
|
175
|
+
layout += " padding: 5mm 0mm 5mm 0mm;\n"
|
176
|
+
layout += " height: 46mm;\n"
|
177
|
+
layout += " width: 46mm;\n"
|
178
|
+
layout += " }\n"
|
179
|
+
|
180
|
+
layout += " .qr_code img {\n"
|
181
|
+
layout += " height: 46mm;\n"
|
182
|
+
layout += " width: 46mm;\n"
|
183
|
+
layout += " }\n"
|
184
|
+
|
185
|
+
layout += " .amount {\n"
|
186
|
+
layout += " margin-top: 15px;\n"
|
187
|
+
layout += " }\n"
|
188
|
+
|
189
|
+
layout += " .amount .currency {\n"
|
190
|
+
layout += " float: left;\n"
|
191
|
+
layout += " margin-right: 15px;\n"
|
192
|
+
layout += " }\n"
|
193
|
+
|
194
|
+
layout += " .title {\n"
|
195
|
+
layout += " font-weight: bold;\n"
|
196
|
+
layout += " font-size: 11pt;\n"
|
197
|
+
layout += " }\n"
|
198
|
+
|
199
|
+
layout += " .receipt_section .subtitle {\n"
|
200
|
+
layout += " font-weight: bold;\n"
|
201
|
+
layout += " font-size: 6pt;\n"
|
202
|
+
layout += " line-height: 9pt;\n"
|
203
|
+
layout += " }\n"
|
204
|
+
|
205
|
+
layout += " .receipt_section .acceptance_point {\n"
|
206
|
+
layout += " font-weight: bold;\n"
|
207
|
+
layout += " text-align: right;\n"
|
208
|
+
layout += " font-size: 6pt;\n"
|
209
|
+
layout += " line-height: 8pt;\n"
|
210
|
+
layout += " padding-top: 5mm;\n"
|
211
|
+
layout += " }\n"
|
212
|
+
|
213
|
+
layout += " .payment_section .subtitle {\n"
|
214
|
+
layout += " font-weight: bold;\n"
|
215
|
+
layout += " font-size: 8pt;\n"
|
216
|
+
layout += " line-height: 11pt;\n"
|
217
|
+
layout += " }\n"
|
218
|
+
|
219
|
+
layout += " .payment_section .amount {\n"
|
220
|
+
layout += " height: 22mm;\n"
|
221
|
+
layout += " margin-top: 40px;\n"
|
222
|
+
layout += " }\n"
|
223
|
+
|
224
|
+
layout += " .payment_section .further_information {\n"
|
225
|
+
layout += " font-size: 7pt;\n"
|
226
|
+
layout += " }\n"
|
227
|
+
|
228
|
+
layout += " .payment_section .finfo_header {\n"
|
229
|
+
layout += " font-weight: bold;\n"
|
230
|
+
layout += " } \n"
|
231
|
+
layout += "</style>\n"
|
232
|
+
|
233
|
+
return layout
|
234
|
+
end
|
235
|
+
end
|