qr-bills 1.0.11 → 2.0.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d1e85a0928abfb125572539a4fbf99b331c789e2c21fd425b9c94736cb4fe8d8
4
- data.tar.gz: 59788940942a55e4f30cf13a17c9ae8a20aeab4a925633bb8967cf2cc8c59fc2
3
+ metadata.gz: 7fc173cb15d0093e2298fa873dcc9320b1485c093cee48f4ac6f8266bb0ea45a
4
+ data.tar.gz: acc76affa6b192d19dbc0b749440afe706af181127a2ae5337a161f13c889551
5
5
  SHA512:
6
- metadata.gz: f9549f75f73c43ec82593358bb088454ce462eef5aa6ad71b2b83f95d432918dd30733abe0818435fe077797b1b9a01c7c9a5f2712bfd47a59596800789ae49b
7
- data.tar.gz: 522b9bc62b6f80de240080390ca7a62a1ea116731bc2046d0339706c08b90f5a1be257bf31f5414bcb8a53529ada4cd410a3d7edf7195f958a22608551b2442e
6
+ metadata.gz: bd9cf2223b15f2e4a3d93e548d10e60f05dbf8d7862c9e635f51f24b6d10740b72c5016609521bd865411c7bb26085fb351ece7f3abeb6b996a90c7b6787bcda
7
+ data.tar.gz: daadbf86fc459a426fded5b081529941d9fe895ccdcd988eae21dca7dba14f913fe5b8b794fc16955a70fff4aa7a508c152168caa20a71485d2cac0325d199c2
@@ -19,8 +19,6 @@ module QRGenerator
19
19
  end
20
20
 
21
21
  def self.build_qrcode_png(bill_params, qrcode_path)
22
- warn('DEPRECATION WARNING: The qrcode_png format and qrcode_filepath parameter are deprecated and will be removed from qr-bills 1.1 (use png or svg instead)')
23
-
24
22
  final_qr = build_png(bill_params)
25
23
  final_qr.save(qrcode_path)
26
24
  final_qr
@@ -127,8 +125,8 @@ module QRGenerator
127
125
  payload += "#{bill_params[:creditor][:iban].delete(' ')}\r\n"
128
126
  payload += "#{bill_params[:creditor][:address][:type]}\r\n"
129
127
  payload += "#{bill_params[:creditor][:address][:name]}\r\n"
130
- payload += "#{bill_params[:creditor][:address][:line1]}\r\n"
131
- payload += "#{bill_params[:creditor][:address][:line2]}\r\n"
128
+ payload += "#{bill_params[:creditor][:address][:street_name]}\r\n"
129
+ payload += "#{bill_params[:creditor][:address][:building_number]}\r\n"
132
130
  payload += "#{bill_params[:creditor][:address][:postal_code]}\r\n"
133
131
  payload += "#{bill_params[:creditor][:address][:town]}\r\n"
134
132
  payload += "#{bill_params[:creditor][:address][:country]}\r\n"
@@ -143,8 +141,8 @@ module QRGenerator
143
141
  payload += "#{bill_params[:currency]}\r\n"
144
142
  payload += "#{bill_params[:debtor][:address][:type]}\r\n"
145
143
  payload += "#{bill_params[:debtor][:address][:name]}\r\n"
146
- payload += "#{bill_params[:debtor][:address][:line1]}\r\n"
147
- payload += "#{bill_params[:debtor][:address][:line2]}\r\n"
144
+ payload += "#{bill_params[:debtor][:address][:street_name]}\r\n"
145
+ payload += "#{bill_params[:debtor][:address][:building_number]}\r\n"
148
146
  payload += "#{bill_params[:debtor][:address][:postal_code]}\r\n"
149
147
  payload += "#{bill_params[:debtor][:address][:town]}\r\n"
150
148
  payload += "#{bill_params[:debtor][:address][:country]}\r\n"
@@ -154,5 +152,8 @@ module QRGenerator
154
152
  payload += "EPD\r\n"
155
153
  payload += "#{bill_params[:bill_information_coded]}\r\n"
156
154
  payload += "#{bill_params[:alternative_scheme_parameters]}\r\n"
155
+
156
+ payload.delete_suffix!("\r\n") while payload.end_with?("\r\n")
157
+ payload
157
158
  end
158
159
  end
@@ -248,9 +248,13 @@ module QRHTMLLayout
248
248
  def self.render_address(address)
249
249
  case address[:type]
250
250
  when 'S'
251
- format("%s<br>\n%s %s<br>\n%s %s<br>\n", address[:name], address[:line1], address[:line2], address[:postal_code], address[:town])
251
+ if address[:street_name].empty?
252
+ format("%s<br>\n%s %s<br>\n", address[:name], address[:postal_code], address[:town])
253
+ else
254
+ format("%s<br>\n%s %s<br>\n%s %s<br>\n", address[:name], address[:street_name], address[:building_number], address[:postal_code], address[:town])
255
+ end
252
256
  when 'K'
253
- format("%s<br>\n%s<br>\n%s<br>\n", address[:name], address[:line1], address[:line2])
257
+ raise ArgumentError, "#{QRExceptions::INVALID_PARAMETERS}: please move to type-S addresses, K-type is not supported anymore with and after v2.0.0 - params line1 and line2 doesn't exist anymore and are now street_name / building_number"
254
258
  end
255
259
  end
256
260
  end
@@ -30,8 +30,8 @@ module QRParams
30
30
  address: {
31
31
  type: "S",
32
32
  name: "",
33
- line1: "",
34
- line2: "",
33
+ street_name: "",
34
+ building_number: "",
35
35
  postal_code: "",
36
36
  town: "",
37
37
  country: "",
@@ -42,8 +42,8 @@ module QRParams
42
42
  address: {
43
43
  type: "S",
44
44
  name: "",
45
- line1: "",
46
- line2: "",
45
+ street_name: "",
46
+ building_number: "",
47
47
  postal_code: "",
48
48
  town: "",
49
49
  country: "",
@@ -80,7 +80,7 @@ module QRParams
80
80
  if params.dig(:bill_params, :currency) == "" || params.dig(:bill_params, :currency) == nil
81
81
  raise ArgumentError, "#{QRExceptions::INVALID_PARAMETERS}: currency cannot be blank"
82
82
  end
83
-
83
+
84
84
  true
85
85
  end
86
86
 
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.11
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Damiano Radice
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-09-30 00:00:00.000000000 Z
11
+ date: 2026-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n