verifiabl-issuer 1.0.0 → 1.0.1
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 +4 -4
- data/CHANGELOG.md +14 -0
- data/README.md +3 -2
- data/lib/verifiabl/issuer/non_pii_v2.rb +26 -21
- data/lib/verifiabl/issuer/serialization.rb +4 -1
- data/lib/verifiabl/issuer/validation.rb +5 -6
- data/lib/verifiabl/issuer/version.rb +1 -1
- 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: b7c622f96124e2196fcc336d8295d30fef83a2efc296890d841aec4ef8376e50
|
|
4
|
+
data.tar.gz: c0e18b541a27073c6026703acd7e8eeae0b1ce6867f55f8d4847451b9eaef812
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d36cfeaf56c836a4cd99d5786697668664b9003bf15c3689a50034bb1e9285aa93675ace858eff1cab65b6033ee64bffb3656290a61bd9c11e643881aa83918e
|
|
7
|
+
data.tar.gz: dd8bd433cd88d3ab01373608eab57476afbb2770d922a4c0f22ea238dd8d0d2bd62a154a8aa30699785c68b3e8efb7a24dd0aaf93a9d2ae3b159cfeb9408bc64
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,20 @@ All notable changes to the Verifiabl Ruby SDK will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
## Unreleased
|
|
6
6
|
|
|
7
|
+
## [1.0.1] - 2026-10-20
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- AU2 and NZ2 codes may be Symbols, such as `currency: :AUD` or
|
|
12
|
+
`type: :lump_sum`. The gem converts them to Strings before its checks, so
|
|
13
|
+
every check treats both forms alike. Amounts must still be Strings.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- An AU2 earnings line with `type: :lump_sum` (a Symbol) and no
|
|
18
|
+
`lump_sum_type` now raises `ArgumentError`, as the String form already did.
|
|
19
|
+
1.0.0 sent it without the code.
|
|
20
|
+
|
|
7
21
|
## [1.0.0] - 2026-10-19
|
|
8
22
|
|
|
9
23
|
First stable release. The public API now follows Semantic Versioning.
|
data/README.md
CHANGED
|
@@ -9,7 +9,7 @@ client, RBS signatures, and packed-gem consumer qualification.
|
|
|
9
9
|
Add the stable release to your bundle:
|
|
10
10
|
|
|
11
11
|
```ruby
|
|
12
|
-
gem "verifiabl-issuer", "1.0.
|
|
12
|
+
gem "verifiabl-issuer", "1.0.1"
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
Then run `bundle install`.
|
|
@@ -225,7 +225,8 @@ both jurisdictions. An AU2 `lump_sum` line takes a `lump_sum_type` from
|
|
|
225
225
|
an `etp_component` from `ETP_COMPONENTS`. Use their strings in your normal
|
|
226
226
|
payslip hash; the lists do not restrict input or add local enum validation,
|
|
227
227
|
and the API may accept a new code before this gem is updated. The gem raises
|
|
228
|
-
before sending an AU2 `lump_sum` line without a `lump_sum_type`.
|
|
228
|
+
before sending an AU2 `lump_sum` line without a `lump_sum_type`. A code may
|
|
229
|
+
also be a Symbol, such as `type: :lump_sum`; the gem sends it as a String.
|
|
229
230
|
Printed-text fields such as `tax_code` and `pay_cycle` are not code sets.
|
|
230
231
|
|
|
231
232
|
### Self-managed barcode flow
|
|
@@ -12,9 +12,11 @@ module Verifiabl
|
|
|
12
12
|
|
|
13
13
|
module_function
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
# Returns the payload with Symbol codes as Strings, so later checks see what JSON encoding sends.
|
|
16
|
+
def to_wire!(schema, payload)
|
|
17
|
+
wire = convert!(FIELDS.fetch(schema), payload, "payslip_non_pii")
|
|
18
|
+
check_lump_sum_types!(wire) if schema == AUSTRALIAN_PAYSLIP_V2_SCHEMA
|
|
19
|
+
wire
|
|
18
20
|
end
|
|
19
21
|
|
|
20
22
|
# The API still accepts a bare lump sum from older SDKs, but a lump sum without its STP2 code
|
|
@@ -28,45 +30,48 @@ module Verifiabl
|
|
|
28
30
|
end
|
|
29
31
|
private_class_method :check_lump_sum_types!
|
|
30
32
|
|
|
31
|
-
def
|
|
33
|
+
def convert!(allowed, value, path)
|
|
32
34
|
case allowed
|
|
33
|
-
when Hash then
|
|
34
|
-
when Array then
|
|
35
|
-
when "decimal" then
|
|
36
|
-
else
|
|
35
|
+
when Hash then convert_object!(allowed, value, path)
|
|
36
|
+
when Array then convert_array!(allowed.first, value, path)
|
|
37
|
+
when "decimal" then decimal!(value, path)
|
|
38
|
+
else scalar!(value, path)
|
|
37
39
|
end
|
|
38
40
|
end
|
|
39
|
-
private_class_method :
|
|
41
|
+
private_class_method :convert!
|
|
40
42
|
|
|
41
|
-
def
|
|
43
|
+
def convert_object!(allowed, value, path)
|
|
42
44
|
raise ArgumentError, "#{path} must be an object" unless value.is_a?(Hash)
|
|
43
45
|
|
|
44
|
-
value.
|
|
46
|
+
value.to_h do |key, child|
|
|
45
47
|
raise ArgumentError, "#{path}.#{key} is not permitted" unless allowed.key?(key)
|
|
46
48
|
|
|
47
|
-
|
|
49
|
+
[key, convert!(allowed.fetch(key), child, "#{path}.#{key}")]
|
|
48
50
|
end
|
|
49
51
|
end
|
|
50
|
-
private_class_method :
|
|
52
|
+
private_class_method :convert_object!
|
|
51
53
|
|
|
52
|
-
def
|
|
54
|
+
def convert_array!(allowed, value, path)
|
|
53
55
|
raise ArgumentError, "#{path} must be an array" unless value.is_a?(Array)
|
|
54
56
|
|
|
55
|
-
value.each_with_index { |child, index|
|
|
57
|
+
value.each_with_index.map { |child, index| convert!(allowed, child, "#{path}[#{index}]") }
|
|
56
58
|
end
|
|
57
|
-
private_class_method :
|
|
59
|
+
private_class_method :convert_array!
|
|
58
60
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
# Amounts stay Strings only, so the SDK never guesses at a number's text.
|
|
62
|
+
def decimal!(value, path)
|
|
63
|
+
return value if value.is_a?(String) && DECIMAL_PATTERN.match?(value)
|
|
61
64
|
|
|
62
65
|
raise ArgumentError, "#{path} must be a plain decimal String, for example \"1234.56\""
|
|
63
66
|
end
|
|
64
|
-
private_class_method :
|
|
67
|
+
private_class_method :decimal!
|
|
65
68
|
|
|
66
|
-
def
|
|
69
|
+
def scalar!(value, path)
|
|
67
70
|
raise ArgumentError, "#{path} must be a scalar" if value.is_a?(Hash) || value.is_a?(Array)
|
|
71
|
+
|
|
72
|
+
value.is_a?(Symbol) ? value.to_s : value
|
|
68
73
|
end
|
|
69
|
-
private_class_method :
|
|
74
|
+
private_class_method :scalar!
|
|
70
75
|
end
|
|
71
76
|
end
|
|
72
77
|
end
|
|
@@ -12,7 +12,10 @@ module Verifiabl
|
|
|
12
12
|
def registration_to_wire(schema:, issued_at:, payslip_non_pii:, encryption_metadata:)
|
|
13
13
|
Validation.registration!(schema: schema, issued_at: issued_at, payslip_non_pii: payslip_non_pii, encryption_metadata: encryption_metadata)
|
|
14
14
|
wire_payslip = stringify_keys(payslip_non_pii)
|
|
15
|
-
|
|
15
|
+
if [AUSTRALIAN_PAYSLIP_V2_SCHEMA, NEW_ZEALAND_PAYSLIP_V2_SCHEMA].include?(schema)
|
|
16
|
+
wire_payslip = NonPiiV2.to_wire!(schema, wire_payslip)
|
|
17
|
+
Validation.v2_currency!(wire_payslip)
|
|
18
|
+
end
|
|
16
19
|
{
|
|
17
20
|
"schema" => schema,
|
|
18
21
|
"issued_at" => serialize_time(issued_at),
|
|
@@ -14,7 +14,7 @@ module Verifiabl
|
|
|
14
14
|
|
|
15
15
|
def registration!(schema:, issued_at:, payslip_non_pii:, encryption_metadata:)
|
|
16
16
|
registration_envelope!(schema:, issued_at:, encryption_metadata:)
|
|
17
|
-
validate_payslip_non_pii!(
|
|
17
|
+
validate_payslip_non_pii!(payslip_non_pii)
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def registration_envelope!(schema:, issued_at:, encryption_metadata:)
|
|
@@ -55,20 +55,19 @@ module Verifiabl
|
|
|
55
55
|
end
|
|
56
56
|
private_class_method :validate_encryption_metadata!
|
|
57
57
|
|
|
58
|
-
def validate_payslip_non_pii!(
|
|
58
|
+
def validate_payslip_non_pii!(payslip_non_pii)
|
|
59
59
|
raise ArgumentError, "payslip_non_pii must be a Hash" unless payslip_non_pii.is_a?(Hash)
|
|
60
60
|
validate_iso_date!(value(payslip_non_pii, :period_start), "period_start") if key?(payslip_non_pii, :period_start)
|
|
61
61
|
validate_iso_date!(value(payslip_non_pii, :period_end), "period_end") if key?(payslip_non_pii, :period_end)
|
|
62
|
-
validate_v2_currency!(payslip_non_pii) if [AUSTRALIAN_PAYSLIP_V2_SCHEMA, NEW_ZEALAND_PAYSLIP_V2_SCHEMA].include?(schema)
|
|
63
62
|
end
|
|
64
63
|
private_class_method :validate_payslip_non_pii!
|
|
65
64
|
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
# Takes the wire payslip, so a Symbol code has already become a String.
|
|
66
|
+
def v2_currency!(wire_payslip)
|
|
67
|
+
return if SUPPORTED_V2_CURRENCIES.include?(wire_payslip["currency"])
|
|
68
68
|
|
|
69
69
|
raise ArgumentError, "currency is required and must be a supported ISO 4217 currency code, for example AUD"
|
|
70
70
|
end
|
|
71
|
-
private_class_method :validate_v2_currency!
|
|
72
71
|
|
|
73
72
|
def validate_issued_at!(issued_at)
|
|
74
73
|
return if issued_at.is_a?(Time)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: verifiabl-issuer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Verifiabl
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-10-
|
|
11
|
+
date: 2026-10-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: base64
|