prawn-swiss_qr_bill 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/prawn/swiss_qr_bill/reference.rb +14 -8
- data/lib/prawn/swiss_qr_bill/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c557c856c20a70bceddb8203bca2fe9f178d089d61ec4e4c834faf744d3ac3be
|
4
|
+
data.tar.gz: 7e80215d72f150895b7ac341b4ccdc03f85187ef68a22811d2fa9da81f61aa17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9be4ccc1aa68143a96a61cdd3c0650a70ea14003d047ea67cebd62065d60f9d9d1740df1cc79033705d4d9e35d95e63ee80ca69c3d9249636bc87a307eb88d9f
|
7
|
+
data.tar.gz: f3f5fe1f9a636bbe5f4091fc943ae38b750c099cf6a4c282a26b47823d7e0a032f652763533b4a7027e2354cf3b5fc97ee33ef18488a06a9e39d10008b12e01c
|
@@ -53,7 +53,7 @@ module Prawn
|
|
53
53
|
def valid_check_digits?
|
54
54
|
case @type
|
55
55
|
when 'QRR'
|
56
|
-
check_digits == modulo10_recursive(number)
|
56
|
+
check_digits == Reference.modulo10_recursive(number)
|
57
57
|
when 'SCOR'
|
58
58
|
scor_to_i % 97 == 1
|
59
59
|
end
|
@@ -75,18 +75,24 @@ module Prawn
|
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
def modulo10_recursive(reference)
|
78
|
+
# Generate a check digit with modulo 10 recursive:
|
79
|
+
#
|
80
|
+
# Can be used as an instance method:
|
81
|
+
#
|
82
|
+
# Prawn::SwissQRBill::Reference.modulo10_recursive("2202202029999")
|
83
|
+
# # will return 1
|
84
|
+
def self.modulo10_recursive(reference)
|
85
85
|
numbers = reference.to_s.chars.map(&:to_i)
|
86
86
|
report = numbers.inject(0) { |memo, c| MODULO_TABLE[memo][c] }
|
87
87
|
|
88
88
|
(10 - report) % 10
|
89
89
|
end
|
90
|
+
|
91
|
+
private
|
92
|
+
|
93
|
+
def standardize(reference)
|
94
|
+
reference.to_s.strip.gsub(/\s+/, '').upcase
|
95
|
+
end
|
90
96
|
end
|
91
97
|
end
|
92
98
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prawn-swiss_qr_bill
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mischa Schindowski
|
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
|
@@ -215,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
215
215
|
- !ruby/object:Gem::Version
|
216
216
|
version: '0'
|
217
217
|
requirements: []
|
218
|
-
rubygems_version: 3.
|
218
|
+
rubygems_version: 3.2.32
|
219
219
|
signing_key:
|
220
220
|
specification_version: 4
|
221
221
|
summary: Swiss QR-Bill PDFs in Ruby with Prawn
|