secretariat 3.4.0 → 3.5.0

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: f1a42571c7c3ceb77877659b076fbd8974ee661843dbc4f4d294012163a4c99f
4
- data.tar.gz: 871cf260400cdf9470c867572a77d6ac5d109886b30b9d99120bbbfa94b5f950
3
+ metadata.gz: 101180b4e01b5fab64b9362975b172d91ecebf1926f22d9128339f8c1599084e
4
+ data.tar.gz: '0795397ea1963f7f8de510bafc929b5590ff52586b1f96b0a8e3b77ec01b1867'
5
5
  SHA512:
6
- metadata.gz: e69622419e9e48946ddf0dc4921515a02fa3e8c1f53cd1fd23cd14c89d7f2470718e8d220a4c9594142a768db4c143452efd93607917b230c28e9bb647ec537d
7
- data.tar.gz: f5c1da6eea2d10742eebb2ae95993026f74ee6968ac630caaa2f38face0c26b03e401d6204752b14e816af8c408d8052843e77071bc6b68f37200bd3607099f6
6
+ metadata.gz: f21836d1199fd2d1bcf36eb7bda5c2bfcdfc73154e0281200002d5b19bd30ef07c4b5d7b18a400f978637ada150fe7a95efec9623e71267dbbe3cfc7d230d6c9
7
+ data.tar.gz: d5e574f2a06c3cf7f929b045a58c60867e7986a2f451484aee5ac4cf7185cdae36fc1fd0890a941ef2c330362544043d93a5561a906d09a32d55104c6c10ef83
@@ -113,7 +113,12 @@ module Secretariat
113
113
  @errors << "Base amount and summed tax base amount deviate: #{basis} / #{summed_tax_base_amount}"
114
114
  return false
115
115
  end
116
- if tax_calculation_method != :NONE
116
+ if tax_calculation_method == :ITEM_BASED
117
+ line_items_tax_amount = line_items.sum(&:tax_amount)
118
+ if tax_amount != line_items_tax_amount
119
+ @errors << "Tax amount #{tax_amount} and summed up item tax amounts #{line_items_tax_amount} deviate"
120
+ end
121
+ elsif tax_calculation_method != :NONE
117
122
  taxes.each do |tax|
118
123
  calc_tax = tax.base_amount * BigDecimal(tax.tax_percent) / BigDecimal(100)
119
124
  calc_tax = calc_tax.round(2)
@@ -167,7 +172,7 @@ module Secretariat
167
172
  raise ValidationError.new("Invoice is invalid", errors)
168
173
  end
169
174
 
170
- builder = Nokogiri::XML::Builder.new do |xml|
175
+ builder = Nokogiri::XML::Builder.new(encoding: "UTF-8") do |xml|
171
176
 
172
177
  root = by_version(version, 'CrossIndustryDocument', 'CrossIndustryInvoice')
173
178
 
@@ -15,5 +15,5 @@ limitations under the License.
15
15
  =end
16
16
 
17
17
  module Secretariat
18
- VERSION = '3.4.0'
18
+ VERSION = '3.5.0'
19
19
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: secretariat
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0
4
+ version: 3.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Krutisch