webtranslateit-payday 2.1.1 → 2.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e997f24c5936a24f8deb333262cdfb74ecf989ddd229052797211579748a8f8c
4
- data.tar.gz: af5120a7dd9edd4a7cf8e980d5090f2c20a2d1e0c32d654aa711c93b777cc429
3
+ metadata.gz: d20c4b16690aff8ce6b55701f16bc9d4276b1cc5c0bc729a66d1b2a1b1e9551e
4
+ data.tar.gz: 3ca918d5b25fbc3c52aa6076d374013b576a8be33691b835a934d37f2b100198
5
5
  SHA512:
6
- metadata.gz: 73f336ccbb26a4e1ab7b98ca3f95cd407e5730d7508884c361049e1ad1120b6a09f02609f44f5edb4e492d5dff0563c3021c16fc72e67756926c50463308875e
7
- data.tar.gz: ab853437c9e8d4bcdb647bde8535e0d0a5e18a9e93e5d132be4cebaccec844a5e649915123ac4216d50f832c79604905a3d7eb755b5e5dbae59cfa957d749126
6
+ metadata.gz: f531c74f975b2f33a89d3c0607a0143acf678572d4af2020e8444f1112e1326e7a214b349f0ca48089ec15433ee45b0c1996b0bc59939ef91ae3146dcd27c1f3
7
+ data.tar.gz: 005f6eaf3f2e619eaddc28f06c99293722c45a9a120cd2200a2f5c2158161ee8782691fa50b7ece4904fc31c215b42ce7672655ba1c287a5b2f780044e180069
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 2.1.2 (2026-11-08)
4
+
5
+ * Internal refactoring, no behaviour change: rates and line item values are parsed through one `Payday.to_decimal` (#323).
6
+
3
7
  ## 2.1.1 (2026-11-08)
4
8
 
5
9
  * An invoice that defines `date_format` now has its dates formatted with it, the way it could already override `currency`, `invoice_logo`, `page_size`, `company_name` and `company_details`. Every one of those is read through the new `Config#value_for(invoice, property)` (#319, #321). `Payday::Invoice` has no `date_format`, so its output is unchanged.
@@ -26,17 +26,17 @@ module Payday
26
26
 
27
27
  # The tax rate that we're applying, as a BigDecimal
28
28
  def tax_rate=(value)
29
- @tax_rate = to_rate(value)
29
+ @tax_rate = Payday.to_decimal(value)
30
30
  end
31
31
 
32
32
  # Shipping rate
33
33
  def shipping_rate=(value)
34
- @shipping_rate = to_rate(value)
34
+ @shipping_rate = Payday.to_decimal(value)
35
35
  end
36
36
 
37
37
  # Retention rate (e.g. IRPF). Applied as a percentage of the subtotal and deducted from the total.
38
38
  def retention_rate=(value)
39
- @retention_rate = to_rate(value)
39
+ @retention_rate = Payday.to_decimal(value)
40
40
  end
41
41
 
42
42
  # Adds a line item
@@ -44,13 +44,6 @@ module Payday
44
44
  line_items << Payday::LineItem.new(options)
45
45
  end
46
46
 
47
- private
48
-
49
- # A blank rate (nil, "", " ") is 0.
50
- def to_rate(value)
51
- BigDecimal(value.to_s.presence || 0)
52
- end
53
-
54
47
  end
55
48
 
56
49
  end
@@ -29,24 +29,17 @@ module Payday
29
29
 
30
30
  # Sets the quantity of this {LineItem}
31
31
  def quantity=(value)
32
- @quantity = to_decimal(value)
32
+ @quantity = Payday.to_decimal(value)
33
33
  end
34
34
 
35
35
  # Sets the price for this {LineItem}
36
36
  def price=(value)
37
- @price = to_decimal(value)
37
+ @price = Payday.to_decimal(value)
38
38
  end
39
39
 
40
40
  # Sets the predefined_amount for this {LineItem}
41
41
  def predefined_amount=(value)
42
- @predefined_amount = to_decimal(value)
43
- end
44
-
45
- private
46
-
47
- # A blank value (nil, "", " ") is 0.
48
- def to_decimal(value)
49
- BigDecimal(value.to_s.presence || 0)
42
+ @predefined_amount = Payday.to_decimal(value)
50
43
  end
51
44
 
52
45
  end
data/lib/payday.rb CHANGED
@@ -18,4 +18,10 @@ require 'time'
18
18
  I18n.load_path.concat(Dir[File.expand_path('../config/locales/*.yml', __dir__)])
19
19
 
20
20
  module Payday
21
+
22
+ # A blank value (nil, "", " ") is 0.
23
+ def self.to_decimal(value)
24
+ BigDecimal(value.to_s.presence || 0)
25
+ end
26
+
21
27
  end
data/payday.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'webtranslateit-payday'
5
- s.version = '2.1.1'
5
+ s.version = '2.1.2'
6
6
  s.required_ruby_version = '>= 3.2'
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ['Alan Johnson', 'Edouard Briere']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webtranslateit-payday
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alan Johnson