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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 619853ce9733f541d03c4f5267ff59da66383941256b56970953bfec703f6600
4
- data.tar.gz: 2c3b3bb84032287482bbde88fca5e85c947b6f557da73e165f4c5a593e629d44
3
+ metadata.gz: b7c622f96124e2196fcc336d8295d30fef83a2efc296890d841aec4ef8376e50
4
+ data.tar.gz: c0e18b541a27073c6026703acd7e8eeae0b1ce6867f55f8d4847451b9eaef812
5
5
  SHA512:
6
- metadata.gz: a987cf173047507e67e5e693bcba5b59cbc914818261dddc1edfbeecf3cc5609a70f3db96e5da7b3a8e05f4aaf09ce6aab7acb22efe3665b622f1ab2a2a95f9f
7
- data.tar.gz: 25180a6200be501ef89c6a647c0975018c14e7b34084c58ed8430e679a86f0fac38752f8c3591df56b8bda16a2084cf545f469f1ddb80eddcc23b76718dd4d36
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.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
- def validate!(schema, payload)
16
- check!(FIELDS.fetch(schema), payload, "payslip_non_pii")
17
- check_lump_sum_types!(payload) if schema == AUSTRALIAN_PAYSLIP_V2_SCHEMA
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 check!(allowed, value, path)
33
+ def convert!(allowed, value, path)
32
34
  case allowed
33
- when Hash then check_object!(allowed, value, path)
34
- when Array then check_array!(allowed.first, value, path)
35
- when "decimal" then check_decimal!(value, path)
36
- else check_scalar!(value, path)
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 :check!
41
+ private_class_method :convert!
40
42
 
41
- def check_object!(allowed, value, path)
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.each do |key, child|
46
+ value.to_h do |key, child|
45
47
  raise ArgumentError, "#{path}.#{key} is not permitted" unless allowed.key?(key)
46
48
 
47
- check!(allowed.fetch(key), child, "#{path}.#{key}")
49
+ [key, convert!(allowed.fetch(key), child, "#{path}.#{key}")]
48
50
  end
49
51
  end
50
- private_class_method :check_object!
52
+ private_class_method :convert_object!
51
53
 
52
- def check_array!(allowed, value, path)
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| check!(allowed, child, "#{path}[#{index}]") }
57
+ value.each_with_index.map { |child, index| convert!(allowed, child, "#{path}[#{index}]") }
56
58
  end
57
- private_class_method :check_array!
59
+ private_class_method :convert_array!
58
60
 
59
- def check_decimal!(value, path)
60
- return if value.is_a?(String) && DECIMAL_PATTERN.match?(value)
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 :check_decimal!
67
+ private_class_method :decimal!
65
68
 
66
- def check_scalar!(value, path)
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 :check_scalar!
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
- NonPiiV2.validate!(schema, wire_payslip) if [AUSTRALIAN_PAYSLIP_V2_SCHEMA, NEW_ZEALAND_PAYSLIP_V2_SCHEMA].include?(schema)
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!(schema, 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!(schema, 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
- def validate_v2_currency!(payslip_non_pii)
67
- return if SUPPORTED_V2_CURRENCIES.include?(value(payslip_non_pii, :currency))
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)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Verifiabl
4
4
  module Issuer
5
- VERSION = "1.0.0"
5
+ VERSION = "1.0.1"
6
6
  end
7
7
  end
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.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-19 00:00:00.000000000 Z
11
+ date: 2026-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64