webtranslateit-payday 1.7.2 → 1.7.4

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: 59ef0d55e5bb70dab72d78727e46907e75b49c959346f3d6f9282c5ddde202df
4
- data.tar.gz: 221ddccb98e0ee6c239c770261b67f2e98d73a29f4862bda59eaed686cc88133
3
+ metadata.gz: 655aa13a2a0c729008a5bce34e5e8de25b5fafd1f3e571995addf916413f74f8
4
+ data.tar.gz: 7d78b88d6886fbfceb45377b0c25c3cdbc6b3886a33003460cc2f68490004f0c
5
5
  SHA512:
6
- metadata.gz: 01a66a64216ead7641340f677b324e705459812759864043e02e48bc542fa71b02a76048c9981b5b64e2f7f3e592e525bb5a9080bc84d5046ab8ffdb67d87538
7
- data.tar.gz: 0b3c6eba860fb22dadae435310aed5d4d0a74812e27db53d6fe6580d3162f05ee7f017e487ff254e27fc67f233229feda3f77ecf0733f0cd2b5a7ec73b37640a
6
+ metadata.gz: 36a5311dd8d6858c70a8b00a47bc675beb3de3c72827e0b5eb330f7113566051723dfa1f9cdbe636d745363bd02b3458e861803c2d0f481e7269805ae0c2d95e
7
+ data.tar.gz: 5342f87b7e7d2568bc50141463557e8929ae1f678cdbdfb7776cdeb560fdaf215bd8b4f7b4fa8588b861befe38330225777a94783af558434ab671f3440cb2f7
@@ -14,10 +14,10 @@ jobs:
14
14
  runs-on: ubuntu-latest
15
15
  strategy:
16
16
  matrix:
17
- ruby-version: ['3.2', '3.3', '3.4']
17
+ ruby-version: ['3.2', '3.3', '3.4', '4.0']
18
18
 
19
19
  steps:
20
- - uses: actions/checkout@v6
20
+ - uses: actions/checkout@v7
21
21
  - name: Set up Ruby
22
22
  # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
23
23
  # change this to (see https://github.com/ruby/setup-ruby#versioning):
@@ -35,7 +35,7 @@ jobs:
35
35
 
36
36
  steps:
37
37
  - name: Checkout repository
38
- uses: actions/checkout@v6
38
+ uses: actions/checkout@v7
39
39
 
40
40
  - name: Install ruby and gems
41
41
  uses: ruby/setup-ruby@v1
@@ -5,11 +5,6 @@ on:
5
5
  # branches to consider in the event; optional, defaults to all
6
6
  branches:
7
7
  - main
8
- # pull_request event is required only for autolabeler
9
- pull_request:
10
- # Only following types are handled by the action, but one can default to all as well
11
- types: [opened, reopened, synchronize]
12
-
13
8
  jobs:
14
9
  update_release_draft:
15
10
  runs-on: ubuntu-latest
@@ -20,7 +15,7 @@ jobs:
20
15
  # echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV
21
16
 
22
17
  # Drafts your next Release notes as Pull Requests are merged into "master"
23
- - uses: release-drafter/release-drafter@v6
18
+ - uses: release-drafter/release-drafter@v7
24
19
  # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
25
20
  # with:
26
21
  # config-name: my-config.yml
data/.rubocop.yml CHANGED
@@ -7,7 +7,7 @@ inherit_from:
7
7
  - .rubocop_todo.yml
8
8
 
9
9
  AllCops:
10
- TargetRubyVersion: 3.1
10
+ TargetRubyVersion: 3.2
11
11
  Exclude:
12
12
  - lib/generators/**/*
13
13
 
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.7.4 (2026-08-13)
4
+
5
+ * Pass `enable_web_requests: false` when rendering SVG logos. Logos are read from local files, so nothing needs fetching over the network. This silences prawn-svg's deprecation warning and keeps behaviour stable when prawn-svg 1.0 flips the default to `false`.
6
+
7
+ ## 1.7.3 (2026-02-16)
8
+
9
+ * Add retention support (e.g. Spanish IRPF). Set `retention_rate` on an invoice to apply a post-tax deduction calculated as a percentage of the subtotal. The retention amount is displayed as a negative line in the PDF and subtracted from the total. Customize the label with `retention_description` or via the `payday.invoice.retention` i18n key.
10
+
3
11
  ## 1.7.1 (2025-12-01)
4
12
 
5
13
  * Relax dependency on rqrcode.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- webtranslateit-payday (1.7.2)
4
+ webtranslateit-payday (1.7.4)
5
5
  activesupport (>= 7, < 9)
6
6
  i18n (~> 1.12, < 2)
7
7
  money (>= 6.16, < 8.0)
@@ -14,44 +14,53 @@ PATH
14
14
  GEM
15
15
  remote: https://rubygems.org/
16
16
  specs:
17
- activesupport (7.2.3)
17
+ activesupport (8.1.3.1)
18
18
  base64
19
- benchmark (>= 0.3)
20
19
  bigdecimal
21
20
  concurrent-ruby (~> 1.0, >= 1.3.1)
22
21
  connection_pool (>= 2.2.5)
23
22
  drb
24
23
  i18n (>= 1.6, < 2)
24
+ json
25
25
  logger (>= 1.4.2)
26
26
  minitest (>= 5.1)
27
27
  securerandom (>= 0.3)
28
28
  tzinfo (~> 2.0, >= 2.0.5)
29
- addressable (2.8.7)
30
- public_suffix (>= 2.0.2, < 7.0)
29
+ uri (>= 0.13.1)
30
+ addressable (2.9.0)
31
+ public_suffix (>= 2.0.2, < 8.0)
31
32
  ast (2.4.3)
32
33
  base64 (0.3.0)
33
- benchmark (0.5.0)
34
34
  bigdecimal (3.3.1)
35
35
  chunky_png (1.4.0)
36
36
  coderay (1.1.3)
37
- concurrent-ruby (1.3.5)
38
- connection_pool (2.5.4)
39
- css_parser (1.21.1)
37
+ concurrent-ruby (1.3.8)
38
+ connection_pool (3.0.2)
39
+ css_parser (1.22.0)
40
40
  addressable
41
41
  diff-lcs (1.6.2)
42
42
  drb (2.2.3)
43
- ffi (1.17.1-arm64-darwin)
44
- ffi (1.17.1-x86_64-darwin)
45
- ffi (1.17.1-x86_64-linux-gnu)
46
- formatador (1.1.0)
47
- guard (2.19.1)
43
+ ffi (1.17.4)
44
+ ffi (1.17.4-aarch64-linux-gnu)
45
+ ffi (1.17.4-aarch64-linux-musl)
46
+ ffi (1.17.4-aarch64-mingw-ucrt)
47
+ ffi (1.17.4-arm-linux-gnu)
48
+ ffi (1.17.4-arm-linux-musl)
49
+ ffi (1.17.4-arm64-darwin)
50
+ ffi (1.17.4-x86-linux-gnu)
51
+ ffi (1.17.4-x86-linux-musl)
52
+ ffi (1.17.4-x86_64-darwin)
53
+ ffi (1.17.4-x86_64-linux-gnu)
54
+ ffi (1.17.4-x86_64-linux-musl)
55
+ formatador (1.2.3)
56
+ reline
57
+ guard (2.20.2)
48
58
  formatador (>= 0.2.4)
49
59
  listen (>= 2.7, < 4.0)
50
60
  logger (~> 1.6)
51
61
  lumberjack (>= 1.0.12, < 2.0)
52
62
  nenv (~> 0.1)
53
63
  notiffany (~> 0.0)
54
- ostruct (~> 0.6)
55
64
  pry (>= 0.13.0)
56
65
  shellany (~> 0.0)
57
66
  thor (>= 0.18.1)
@@ -63,29 +72,32 @@ GEM
63
72
  guard-rubocop (1.5.0)
64
73
  guard (~> 2.0)
65
74
  rubocop (< 2.0)
66
- i18n (1.14.7)
75
+ i18n (1.15.2)
67
76
  concurrent-ruby (~> 1.0)
68
- json (2.16.0)
69
- language_server-protocol (3.17.0.5)
77
+ io-console (0.8.2)
78
+ json (2.21.2)
79
+ language_server-protocol (3.17.0.6)
70
80
  lint_roller (1.1.0)
71
- listen (3.9.0)
81
+ listen (3.10.0)
82
+ logger
72
83
  rb-fsevent (~> 0.10, >= 0.10.3)
73
84
  rb-inotify (~> 0.9, >= 0.9.10)
74
85
  logger (1.7.0)
75
- lumberjack (1.2.10)
86
+ lumberjack (1.4.2)
76
87
  matrix (0.4.3)
77
88
  method_source (1.1.0)
78
- minitest (5.26.0)
79
- money (7.0.0)
89
+ minitest (6.0.6)
90
+ drb (~> 2.0)
91
+ prism (~> 1.5)
92
+ money (7.1.1)
80
93
  bigdecimal
81
94
  i18n (~> 1.9)
82
95
  nenv (0.3.0)
83
96
  notiffany (0.1.3)
84
97
  nenv (~> 0.1)
85
98
  shellany (~> 0.0)
86
- ostruct (0.6.1)
87
- parallel (1.27.0)
88
- parser (3.3.10.0)
99
+ parallel (1.28.0)
100
+ parser (3.3.12.0)
89
101
  ast (~> 2.4.1)
90
102
  racc
91
103
  pdf-core (0.10.0)
@@ -93,29 +105,32 @@ GEM
93
105
  matrix (~> 0.4)
94
106
  pdf-core (~> 0.10.0)
95
107
  ttfunk (~> 1.8)
96
- prawn-svg (0.38.1)
97
- css_parser (~> 1.6)
108
+ prawn-svg (0.40.3)
109
+ css_parser (>= 1.17.1, < 4)
98
110
  matrix (~> 0.4.2)
99
111
  prawn (>= 0.11.1, < 3)
100
112
  rexml (>= 3.4.2, < 4)
101
113
  prawn-table (0.2.2)
102
114
  prawn (>= 1.3.0, < 3.0.0)
103
- prism (1.6.0)
104
- pry (0.15.2)
115
+ prism (1.9.0)
116
+ pry (0.16.0)
105
117
  coderay (~> 1.1)
106
118
  method_source (~> 1.0)
107
- public_suffix (6.0.2)
119
+ reline (>= 0.6.0)
120
+ public_suffix (7.0.5)
108
121
  racc (1.8.1)
109
122
  rainbow (3.1.1)
110
123
  rb-fsevent (0.11.2)
111
124
  rb-inotify (0.11.1)
112
125
  ffi (~> 1.0)
113
- regexp_parser (2.11.3)
126
+ regexp_parser (2.12.0)
127
+ reline (0.6.3)
128
+ io-console (~> 0.5)
114
129
  rexml (3.4.4)
115
- rqrcode (3.1.1)
130
+ rqrcode (3.2.0)
116
131
  chunky_png (~> 1.0)
117
132
  rqrcode_core (~> 2.0)
118
- rqrcode_core (2.0.1)
133
+ rqrcode_core (2.1.0)
119
134
  rspec (3.13.2)
120
135
  rspec-core (~> 3.13.0)
121
136
  rspec-expectations (~> 3.13.0)
@@ -129,47 +144,56 @@ GEM
129
144
  diff-lcs (>= 1.2.0, < 2.0)
130
145
  rspec-support (~> 3.13.0)
131
146
  rspec-support (3.13.6)
132
- rubocop (1.81.7)
147
+ rubocop (1.89.0)
133
148
  json (~> 2.3)
134
149
  language_server-protocol (~> 3.17.0.2)
135
150
  lint_roller (~> 1.1.0)
136
- parallel (~> 1.10)
151
+ parallel (>= 1.10)
137
152
  parser (>= 3.3.0.2)
138
153
  rainbow (>= 2.2.2, < 4.0)
139
154
  regexp_parser (>= 2.9.3, < 3.0)
140
- rubocop-ast (>= 1.47.1, < 2.0)
155
+ rubocop-ast (>= 1.49.0, < 2.0)
141
156
  ruby-progressbar (~> 1.7)
142
157
  unicode-display_width (>= 2.4.0, < 4.0)
143
- rubocop-ast (1.48.0)
158
+ rubocop-ast (1.50.0)
144
159
  parser (>= 3.3.7.2)
145
- prism (~> 1.4)
160
+ prism (~> 1.7)
146
161
  rubocop-performance (1.26.1)
147
162
  lint_roller (~> 1.1)
148
163
  rubocop (>= 1.75.0, < 2.0)
149
164
  rubocop-ast (>= 1.47.1, < 2.0)
150
- rubocop-rspec (3.8.0)
165
+ rubocop-rspec (3.10.2)
151
166
  lint_roller (~> 1.1)
152
- rubocop (~> 1.81)
167
+ regexp_parser (>= 2.0)
168
+ rubocop (~> 1.86, >= 1.86.2)
153
169
  ruby-progressbar (1.13.0)
154
170
  securerandom (0.4.1)
155
171
  shellany (0.0.1)
156
- thor (1.3.2)
172
+ thor (1.5.0)
157
173
  ttfunk (1.8.0)
158
174
  bigdecimal (~> 3.1)
159
175
  tzinfo (2.0.6)
160
176
  concurrent-ruby (~> 1.0)
161
177
  unicode-display_width (3.2.0)
162
178
  unicode-emoji (~> 4.1)
163
- unicode-emoji (4.1.0)
164
- zeitwerk (2.7.1)
179
+ unicode-emoji (4.2.0)
180
+ uri (1.1.1)
181
+ zeitwerk (2.8.3)
165
182
 
166
183
  PLATFORMS
167
- arm64-darwin-21
168
- arm64-darwin-22
169
- arm64-darwin-23
170
- arm64-darwin-24
171
- x86_64-darwin-21
184
+ aarch64-linux-gnu
185
+ aarch64-linux-musl
186
+ aarch64-mingw-ucrt
187
+ arm-linux-gnu
188
+ arm-linux-musl
189
+ arm64-darwin
190
+ ruby
191
+ x86-linux-gnu
192
+ x86-linux-musl
193
+ x86_64-darwin
172
194
  x86_64-linux
195
+ x86_64-linux-gnu
196
+ x86_64-linux-musl
173
197
 
174
198
  DEPENDENCIES
175
199
  guard
@@ -183,4 +207,4 @@ DEPENDENCIES
183
207
  webtranslateit-payday!
184
208
 
185
209
  BUNDLED WITH
186
- 2.6.2
210
+ 4.0.18
@@ -14,6 +14,7 @@ de:
14
14
  subtotal: "Zwischensumme:"
15
15
  shipping: "Versand:"
16
16
  tax: "Steuern:"
17
+ retention: "Einbehaltung:"
17
18
  total: "Gesamt:"
18
19
  notes: "Anmerkungen"
19
20
  line_item:
@@ -14,6 +14,7 @@ en:
14
14
  subtotal: "Subtotal:"
15
15
  shipping: "Shipping:"
16
16
  tax: "Tax:"
17
+ retention: "Retention:"
17
18
  total: "Total:"
18
19
  notes: "Notes:"
19
20
  line_item:
@@ -14,6 +14,7 @@ es:
14
14
  subtotal: "Subtotal:"
15
15
  shipping: "Envío:"
16
16
  tax: "Impuesto:"
17
+ retention: "Retención IRPF:"
17
18
  total: "Total:"
18
19
  notes: "Notas:"
19
20
  line_item:
@@ -14,6 +14,7 @@ fr:
14
14
  subtotal: "Sous-total :"
15
15
  shipping: "Livraison :"
16
16
  tax: "Taxes :"
17
+ retention: "Retenue :"
17
18
  total: "Total :"
18
19
  notes: "Notes :"
19
20
  line_item:
@@ -13,6 +13,7 @@ nl:
13
13
  subtotal: "Subtotaal:"
14
14
  shipping: "Levering:"
15
15
  tax: "Btw:"
16
+ retention: "Inhouding:"
16
17
  total: "Totaal:"
17
18
  notes: "Opmerkingen"
18
19
  line_item:
@@ -12,6 +12,7 @@ zh-CN:
12
12
  subtotal: "小计:"
13
13
  shipping: "邮费:"
14
14
  tax: "税费:"
15
+ retention: "扣缴:"
15
16
  total: "总计:"
16
17
  notes: "备注"
17
18
  line_item:
@@ -4,6 +4,9 @@ class CreatePaydayTables < ActiveRecord::Migration
4
4
  # invoices will work without anything but bill_to, but there are quite a few options for the fields you can save, like ship_to
5
5
  # due_at, refunded_at, and paid_at
6
6
  t.string :bill_to
7
+ t.decimal :tax_rate
8
+ t.decimal :shipping_rate
9
+ t.decimal :retention_rate
7
10
 
8
11
  t.timestamps
9
12
  end
@@ -8,10 +8,10 @@ module Payday
8
8
  include Payday::Invoiceable
9
9
 
10
10
  attr_accessor :invoice_number, :bill_to, :ship_to, :notes, :line_items, :shipping_description,
11
- :tax_description, :due_at, :paid_at, :refunded_at, :currency, :invoice_details, :invoice_date,
12
- :qr_code
11
+ :tax_description, :retention_description, :due_at, :paid_at, :refunded_at, :currency,
12
+ :invoice_details, :invoice_date, :qr_code
13
13
 
14
- attr_reader :tax_rate, :shipping_rate
14
+ attr_reader :tax_rate, :shipping_rate, :retention_rate
15
15
 
16
16
  # rubocop:todo Metrics/PerceivedComplexity
17
17
  # rubocop:todo Metrics/MethodLength
@@ -26,6 +26,8 @@ module Payday
26
26
  self.shipping_description = options[:shipping_description] || nil
27
27
  self.tax_rate = options[:tax_rate] || nil
28
28
  self.tax_description = options[:tax_description] || nil
29
+ self.retention_rate = options[:retention_rate] || nil
30
+ self.retention_description = options[:retention_description] || nil
29
31
  self.due_at = options[:due_at] || nil
30
32
  self.paid_at = options[:paid_at] || nil
31
33
  self.refunded_at = options[:refunded_at] || nil
@@ -50,6 +52,12 @@ module Payday
50
52
  @shipping_rate = BigDecimal(value.to_s)
51
53
  end
52
54
 
55
+ # Retention rate (e.g. IRPF). Applied as a percentage of the subtotal and deducted from the total.
56
+ def retention_rate=(value)
57
+ value = 0 if value.to_s.blank?
58
+ @retention_rate = BigDecimal(value.to_s)
59
+ end
60
+
53
61
  # Adds a line item
54
62
  def add_line_item(options = {})
55
63
  line_items << Payday::LineItem.new(options)
@@ -49,9 +49,19 @@ module Payday
49
49
  end
50
50
  end
51
51
 
52
+ # Calculates the retention (e.g. IRPF) as a percentage of the subtotal.
53
+ # This is a post-tax deduction subtracted from the total.
54
+ def retention
55
+ if defined?(retention_rate)
56
+ subtotal * retention_rate / 100
57
+ else
58
+ 0
59
+ end
60
+ end
61
+
52
62
  # Calculates the total for this invoice.
53
63
  def total
54
- subtotal + tax + shipping
64
+ subtotal + tax + shipping - retention
55
65
  end
56
66
 
57
67
  def overdue?
@@ -80,7 +80,11 @@ module Payday
80
80
  end
81
81
 
82
82
  if File.extname(image) == '.svg'
83
- logo_info = pdf.svg(File.read(image), at: pdf.bounds.top_left, width: width, height: height)
83
+ # Logos are read from local files, so there is nothing to fetch over the network.
84
+ # Passing this explicitly also silences prawn-svg's deprecation warning and keeps
85
+ # behaviour stable when prawn-svg 1.0 flips the default to false.
86
+ logo_info = pdf.svg(File.read(image), at: pdf.bounds.top_left, width: width, height: height,
87
+ enable_web_requests: false)
84
88
  logo_height = logo_info[:height]
85
89
  else
86
90
  logo_info = pdf.image(image, at: pdf.bounds.top_left, width: width, height: height)
@@ -223,8 +227,9 @@ module Payday
223
227
  end
224
228
  # rubocop:enable Metrics/MethodLength
225
229
 
230
+ # rubocop:todo Metrics/PerceivedComplexity
226
231
  # rubocop:todo Metrics/MethodLength
227
- def self.totals_lines(invoice, pdf) # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
232
+ def self.totals_lines(invoice, pdf) # rubocop:todo Metrics/AbcSize, Metrics/MethodLength, Metrics/PerceivedComplexity
228
233
  table_data = []
229
234
  table_data << [
230
235
  bold_cell(pdf, I18n.t('payday.invoice.subtotal', default: 'Subtotal:')),
@@ -255,6 +260,21 @@ module Payday
255
260
  align: :right)
256
261
  ]
257
262
  end
263
+
264
+ if invoice.retention_rate.positive?
265
+ retention_description = if invoice.retention_description.nil?
266
+ I18n.t('payday.invoice.retention', default: 'Retention:')
267
+ else
268
+ invoice.retention_description
269
+ end
270
+
271
+ table_data << [
272
+ bold_cell(pdf, retention_description),
273
+ cell(pdf, number_to_currency(-invoice.retention, invoice),
274
+ align: :right)
275
+ ]
276
+ end
277
+
258
278
  table_data << [
259
279
  bold_cell(pdf, I18n.t('payday.invoice.total', default: 'Total:'),
260
280
  size: 12),
@@ -268,6 +288,7 @@ module Payday
268
288
  end
269
289
  end
270
290
  # rubocop:enable Metrics/MethodLength
291
+ # rubocop:enable Metrics/PerceivedComplexity
271
292
 
272
293
  def self.notes(invoice, pdf) # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
273
294
  return unless defined?(invoice.notes) && invoice.notes
data/payday.gemspec CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'webtranslateit-payday'
5
- s.version = '1.7.2'
6
- s.required_ruby_version = '>= 3.1'
5
+ s.version = '1.7.4'
6
+ s.required_ruby_version = '>= 3.2'
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ['Alan Johnson', 'Edouard Briere']
9
9
  s.email = ['edouard@webtranslateit.com']
data/spec/invoice_spec.rb CHANGED
@@ -75,6 +75,41 @@ module Payday # rubocop:todo Metrics/ModuleLength
75
75
  expect(i.total).to eq(BigDecimal(1243))
76
76
  end
77
77
 
78
+ it 'returns zero retention when no retention_rate is set' do
79
+ i = described_class.new
80
+ i.line_items << LineItem.new(price: 100, quantity: 1, description: 'Service')
81
+
82
+ expect(i.retention).to eq(BigDecimal(0))
83
+ end
84
+
85
+ it 'calculates retention correctly as a percentage of the subtotal' do
86
+ i = described_class.new(retention_rate: 15.0)
87
+ i.line_items << LineItem.new(price: 200, quantity: 5, description: 'Service')
88
+
89
+ expect(i.retention).to eq(BigDecimal(150))
90
+ end
91
+
92
+ # rubocop:todo RSpec/MultipleExpectations
93
+ it 'calculates total with retention deducted (IRPF example: 500 + 21% VAT - 19% IRPF = 510)' do # rubocop:todo RSpec/ExampleLength, RSpec/MultipleExpectations
94
+ # rubocop:enable RSpec/MultipleExpectations
95
+ i = described_class.new(tax_rate: 21.0, retention_rate: 19.0)
96
+ i.line_items << LineItem.new(price: 500, quantity: 1, description: 'Consulting')
97
+
98
+ expect(i.subtotal).to eq(BigDecimal(500))
99
+ expect(i.tax).to eq(BigDecimal(105))
100
+ expect(i.retention).to eq(BigDecimal(95))
101
+ expect(i.total).to eq(BigDecimal(510))
102
+ end
103
+
104
+ it 'calculates total with tax, shipping, and retention combined' do
105
+ i = described_class.new(tax_rate: 10.0, shipping_rate: 20, retention_rate: 5.0)
106
+ i.line_items << LineItem.new(price: 100, quantity: 10, description: 'Widgets')
107
+
108
+ # subtotal: 1000, tax: 100, shipping: 20, retention: 50
109
+ # total: 1000 + 100 + 20 - 50 = 1070
110
+ expect(i.total).to eq(BigDecimal(1070))
111
+ end
112
+
78
113
  it "is overdue when it's past date and unpaid" do
79
114
  i = described_class.new(due_at: Date.today - 1)
80
115
  expect(i.overdue?).to be(true)
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: 1.7.2
4
+ version: 1.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alan Johnson
@@ -236,14 +236,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
236
236
  requirements:
237
237
  - - ">="
238
238
  - !ruby/object:Gem::Version
239
- version: '3.1'
239
+ version: '3.2'
240
240
  required_rubygems_version: !ruby/object:Gem::Requirement
241
241
  requirements:
242
242
  - - ">="
243
243
  - !ruby/object:Gem::Version
244
244
  version: '0'
245
245
  requirements: []
246
- rubygems_version: 3.6.9
246
+ rubygems_version: 4.0.16
247
247
  specification_version: 4
248
248
  summary: A simple library for rendering invoices.
249
249
  test_files: []