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 +4 -4
- data/lib/secretariat/invoice.rb +7 -2
- data/lib/secretariat/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 101180b4e01b5fab64b9362975b172d91ecebf1926f22d9128339f8c1599084e
|
4
|
+
data.tar.gz: '0795397ea1963f7f8de510bafc929b5590ff52586b1f96b0a8e3b77ec01b1867'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f21836d1199fd2d1bcf36eb7bda5c2bfcdfc73154e0281200002d5b19bd30ef07c4b5d7b18a400f978637ada150fe7a95efec9623e71267dbbe3cfc7d230d6c9
|
7
|
+
data.tar.gz: d5e574f2a06c3cf7f929b045a58c60867e7986a2f451484aee5ac4cf7185cdae36fc1fd0890a941ef2c330362544043d93a5561a906d09a32d55104c6c10ef83
|
data/lib/secretariat/invoice.rb
CHANGED
@@ -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
|
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
|
|
data/lib/secretariat/version.rb
CHANGED