xrechnung 0.2.0 → 0.4.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: 4f041dd061b2cbafddf1f119d5dd735030f5090385ae705e4a078fba9308e3c4
4
- data.tar.gz: bdb51353f944c7560ef64f6f908f45eed508212d357d3e28bd95ba4c8a0b24d7
3
+ metadata.gz: aaeaf454239e2b041ce88d3a72425f4f1ebda1d59d94841c7a671348cccf951b
4
+ data.tar.gz: 7ae97721b0273ec83cb32374d33460ea15417f1d773827a2f775898bd5d04aa8
5
5
  SHA512:
6
- metadata.gz: 01ecec735fd1d6df67c83ff14a722b48d8fae9191d27f200b12efeb9d810045c54cf8534a0dee6d41d9935a24edf25589b4b872c9c37d14bf11b0b12263bfef9
7
- data.tar.gz: 682358abc94767c051821749ef42d7bb92f8e687bd6d47b4085dda99e95f5fe52ee4edf8fd99029a2bc37426afd4699ab397eb55c5adeca24a3d56cc5918db7d
6
+ metadata.gz: f4b6a5ef7f761911a6338ac812a9ca93d098800967348b38ab14dc0aa056085a98ec2ac8bc5ce4e63f5056aa4e969d2b2bbd0d5c9832eeae14636dba9c6b4d4e
7
+ data.tar.gz: f13a513b06fa1953254e37a11eaffb8d4b236d4c021e7f614c47df9d3a422e4fb0b5648c26df299321d69c343abae6cc29d2e6b64c19cf5407699e733d0117fe
@@ -1,6 +1,6 @@
1
1
  name: Ruby
2
2
 
3
- on: [push, fork]
3
+ on: [push, pull_request]
4
4
 
5
5
  jobs:
6
6
  test:
@@ -8,7 +8,7 @@ jobs:
8
8
  name: Ruby ${{ matrix.ruby }}
9
9
  strategy:
10
10
  matrix:
11
- ruby: ['2.7', '3.0', '3.2']
11
+ ruby: ['3.0', '3.2', '3.3']
12
12
 
13
13
  steps:
14
14
  - uses: actions/checkout@v4
@@ -1,6 +1,6 @@
1
1
  name: Validate spec fixtures
2
2
 
3
- on: push
3
+ on: [push, pull_request]
4
4
 
5
5
  jobs:
6
6
  validate:
@@ -16,7 +16,7 @@ jobs:
16
16
 
17
17
  - uses: ruby/setup-ruby@v1
18
18
  with:
19
- ruby-version: "2.7"
19
+ ruby-version: "3.2"
20
20
  bundler-cache: true
21
21
 
22
22
  - name: Prepare validator
data/.gitignore CHANGED
@@ -14,6 +14,7 @@
14
14
  .ruby-version
15
15
  .ruby-gemset
16
16
  .gems/
17
+ *.gem
17
18
 
18
19
  # validator working directory
19
20
  validator/
data/.rubocop.yml CHANGED
@@ -12,7 +12,7 @@ AllCops:
12
12
  - Gemfile
13
13
  DisplayCopNames: true
14
14
  StyleGuideCopsOnly: false
15
- TargetRubyVersion: 2.7
15
+ TargetRubyVersion: 3.0
16
16
 
17
17
  ## Layout Cops - https://docs.rubocop.org/rubocop/cops_layout.html
18
18
 
data/Gemfile.lock CHANGED
@@ -1,74 +1,80 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- xrechnung (0.2.0)
4
+ xrechnung (0.3.0)
5
5
  builder (~> 3.2)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
10
  ast (2.4.2)
11
- builder (3.2.4)
11
+ bigdecimal (3.1.8)
12
+ builder (3.3.0)
13
+ csv (3.3.0)
12
14
  diff-lcs (1.5.1)
13
- httparty (0.21.0)
15
+ httparty (0.22.0)
16
+ csv
14
17
  mini_mime (>= 1.0.0)
15
18
  multi_xml (>= 0.5.2)
16
- json (2.7.1)
19
+ json (2.9.0)
17
20
  language_server-protocol (3.17.0.3)
18
21
  mini_mime (1.1.5)
19
22
  multi_xml (0.6.0)
20
- parallel (1.24.0)
21
- parser (3.3.0.5)
23
+ parallel (1.26.3)
24
+ parser (3.3.6.0)
22
25
  ast (~> 2.4.1)
23
26
  racc
24
- racc (1.7.3)
27
+ racc (1.8.1)
25
28
  rainbow (3.1.1)
26
- rake (13.1.0)
27
- regexp_parser (2.9.0)
28
- rexml (3.2.6)
29
+ rake (13.2.1)
30
+ regexp_parser (2.9.3)
29
31
  rspec (3.13.0)
30
32
  rspec-core (~> 3.13.0)
31
33
  rspec-expectations (~> 3.13.0)
32
34
  rspec-mocks (~> 3.13.0)
33
- rspec-core (3.13.0)
35
+ rspec-core (3.13.2)
34
36
  rspec-support (~> 3.13.0)
35
- rspec-expectations (3.13.0)
37
+ rspec-expectations (3.13.3)
36
38
  diff-lcs (>= 1.2.0, < 2.0)
37
39
  rspec-support (~> 3.13.0)
38
- rspec-mocks (3.13.0)
40
+ rspec-mocks (3.13.2)
39
41
  diff-lcs (>= 1.2.0, < 2.0)
40
42
  rspec-support (~> 3.13.0)
41
- rspec-support (3.13.1)
42
- rubocop (1.62.1)
43
+ rspec-support (3.13.2)
44
+ rubocop (1.69.1)
43
45
  json (~> 2.3)
44
46
  language_server-protocol (>= 3.17.0)
45
47
  parallel (~> 1.10)
46
48
  parser (>= 3.3.0.2)
47
49
  rainbow (>= 2.2.2, < 4.0)
48
- regexp_parser (>= 1.8, < 3.0)
49
- rexml (>= 3.2.5, < 4.0)
50
- rubocop-ast (>= 1.31.1, < 2.0)
50
+ regexp_parser (>= 2.9.3, < 3.0)
51
+ rubocop-ast (>= 1.36.2, < 2.0)
51
52
  ruby-progressbar (~> 1.7)
52
- unicode-display_width (>= 2.4.0, < 3.0)
53
- rubocop-ast (1.31.2)
54
- parser (>= 3.3.0.4)
55
- rubocop-capybara (2.20.0)
53
+ unicode-display_width (>= 2.4.0, < 4.0)
54
+ rubocop-ast (1.36.2)
55
+ parser (>= 3.3.1.0)
56
+ rubocop-capybara (2.21.0)
56
57
  rubocop (~> 1.41)
57
- rubocop-factory_bot (2.25.1)
58
- rubocop (~> 1.41)
59
- rubocop-rspec (2.27.1)
58
+ rubocop-factory_bot (2.26.1)
59
+ rubocop (~> 1.61)
60
+ rubocop-rspec (2.31.0)
60
61
  rubocop (~> 1.40)
61
62
  rubocop-capybara (~> 2.17)
62
63
  rubocop-factory_bot (~> 2.22)
64
+ rubocop-rspec_rails (~> 2.28)
65
+ rubocop-rspec_rails (2.29.1)
66
+ rubocop (~> 1.61)
63
67
  ruby-progressbar (1.13.0)
64
68
  rubyzip (2.3.2)
65
- unicode-display_width (2.5.0)
69
+ unicode-display_width (3.1.2)
70
+ unicode-emoji (~> 4.0, >= 4.0.4)
71
+ unicode-emoji (4.0.4)
66
72
 
67
73
  PLATFORMS
68
74
  ruby
69
75
 
70
76
  DEPENDENCIES
71
- httparty
77
+ httparty (~> 0.22)
72
78
  rake (~> 13.0)
73
79
  rspec (~> 3.0)
74
80
  rubocop-rspec (~> 2.1)
data/Rakefile CHANGED
@@ -4,19 +4,19 @@ require "rspec/core/rake_task"
4
4
 
5
5
  RSpec::Core::RakeTask.new(:spec)
6
6
 
7
- task :default => :spec
7
+ task default: :spec
8
8
 
9
9
  namespace :validator do
10
10
  VALIDATOR_SOURCES = {
11
- tool: {
12
- filename: "validator/validationtool-1.4.1-standalone.jar",
13
- release_url: "https://github.com/itplr-kosit/validator/releases/download/v1.4.1/validationtool-1.4.1.zip",
11
+ tool: {
12
+ filename: "validator/validationtool-1.5.0-standalone.jar",
13
+ release_url: "https://github.com/itplr-kosit/validator/releases/download/v1.5.0/validator-1.5.0-distribution.zip",
14
14
  },
15
15
  scenarios: {
16
16
  filename: "validator/scenarios.xml",
17
- release_url: "https://github.com/itplr-kosit/validator-configuration-xrechnung/releases/download/release-2023-05-12/validator-configuration-xrechnung_2.3.1_2023-05-12.zip",
18
- }
19
- }
17
+ release_url: "https://github.com/itplr-kosit/validator-configuration-xrechnung/releases/download/release-2024-10-31/validator-configuration-xrechnung_3.0.2_2024-10-31.zip",
18
+ },
19
+ }.freeze
20
20
 
21
21
  VALIDATOR_SOURCES.each do |_, v|
22
22
  base = Pathname.new(__dir__).join("validator")
@@ -50,6 +50,6 @@ namespace :validator do
50
50
  tool = VALIDATOR_SOURCES[:tool][:filename]
51
51
  scenarios = VALIDATOR_SOURCES[:scenarios][:filename]
52
52
 
53
- sh "java -jar #{tool} -s #{scenarios} --output-directory #{output} --html --disable-gui #{fixtures}"
53
+ sh "java -jar #{tool} -r validator -s #{scenarios} --output-directory #{output} --html #{fixtures}"
54
54
  end
55
55
  end
@@ -6,6 +6,18 @@ module Xrechnung
6
6
  # @return [TrueClass, FalseClass]
7
7
  member :charge_indicator, type: [TrueClass, FalseClass]
8
8
 
9
+ # @!attribute allowance_charge_reason_code
10
+ # @return [String]
11
+ member :allowance_charge_reason_code, type: Integer
12
+
13
+ # @!attribute allowance_charge_reason
14
+ # @return [String]
15
+ member :allowance_charge_reason, type: String
16
+
17
+ # @!attribute multiplier_factor_numeric
18
+ # @return [BigDecimal]
19
+ member :multiplier_factor_numeric, type: BigDecimal, transform_value: ->(v) { BigDecimal(v, 0) }
20
+
9
21
  # @!attribute amount
10
22
  # @return [Xrechnung::Currency]
11
23
  member :amount, type: Xrechnung::Currency
@@ -14,9 +26,19 @@ module Xrechnung
14
26
  # @return [Xrechnung::Currency]
15
27
  member :base_amount, type: Xrechnung::Currency
16
28
 
29
+ # @!attribute tax_category
30
+ # @return [Xrechnung::TaxCategory]
31
+ member :tax_category, type: Xrechnung::TaxCategory
32
+
17
33
  def initialize(**kwargs)
18
- kwargs[:amount] = Currency::EUR(kwargs[:amount])
19
- kwargs[:base_amount] = Currency::EUR(kwargs[:base_amount])
34
+ unless kwargs[:amount].is_a?(Currency)
35
+ kwargs[:amount] = Currency::EUR(kwargs[:amount])
36
+ end
37
+
38
+ unless kwargs[:base_amount].is_a?(Currency)
39
+ kwargs[:base_amount] = Currency::EUR(kwargs[:base_amount])
40
+ end
41
+
20
42
  super(**kwargs)
21
43
  end
22
44
 
@@ -24,8 +46,23 @@ module Xrechnung
24
46
  def to_xml(xml)
25
47
  xml.cac :AllowanceCharge do
26
48
  xml.cbc :ChargeIndicator, charge_indicator
49
+
50
+ if allowance_charge_reason_code
51
+ xml.cbc :AllowanceChargeReasonCode, allowance_charge_reason_code
52
+ end
53
+
54
+ if allowance_charge_reason
55
+ xml.cbc :AllowanceChargeReason, allowance_charge_reason
56
+ end
57
+
58
+ if multiplier_factor_numeric
59
+ xml.cbc :MultiplierFactorNumeric, format("%.2f", multiplier_factor_numeric)
60
+ end
61
+
27
62
  xml.cbc :Amount, *amount.xml_args
28
63
  xml.cbc :BaseAmount, *base_amount.xml_args
64
+
65
+ tax_category&.to_xml(xml)
29
66
  end
30
67
  end
31
68
  end
@@ -8,7 +8,7 @@ module Xrechnung
8
8
  end
9
9
 
10
10
  def xml_args
11
- [value_to_s, currencyID: currency_id]
11
+ [value_to_s, { currencyID: currency_id }]
12
12
  end
13
13
  end
14
14
 
@@ -29,7 +29,9 @@ module Xrechnung
29
29
  member :price, type: Xrechnung::Price
30
30
 
31
31
  def initialize(**kwargs)
32
- kwargs[:line_extension_amount] = Currency::EUR(kwargs[:line_extension_amount])
32
+ unless kwargs[:line_extension_amount].is_a?(Currency)
33
+ kwargs[:line_extension_amount] = Currency::EUR(kwargs[:line_extension_amount])
34
+ end
33
35
  super(**kwargs)
34
36
  end
35
37
 
@@ -40,9 +42,7 @@ module Xrechnung
40
42
  xml.cbc :InvoicedQuantity, invoiced_quantity.amount_to_s, unitCode: invoiced_quantity.unit_code
41
43
  xml.cbc :LineExtensionAmount, *line_extension_amount.xml_args
42
44
 
43
- unless self.class.members[:invoice_period].optional && invoice_period.nil?
44
- invoice_period&.to_xml(xml)
45
- end
45
+ invoice_period&.to_xml(xml) unless self.class.members[:invoice_period].optional && invoice_period.nil?
46
46
  item&.to_xml(xml)
47
47
  price&.to_xml(xml)
48
48
  end
@@ -14,6 +14,14 @@ module Xrechnung
14
14
  # @return [Xrechnung::Id]
15
15
  member :standard_item_identification_id, type: Xrechnung::Id, optional: true
16
16
 
17
+ # @!attribute buyers_item_identification_id
18
+ # @return [Xrechnung::Id]
19
+ member :buyers_item_identification_id, type: Xrechnung::Id, optional: true
20
+
21
+ # @!attribute sellers_item_identification_id
22
+ # @return [Xrechnung::Id]
23
+ member :sellers_item_identification_id, type: Xrechnung::Id, optional: true
24
+
17
25
  # @!attribute commodity_classification
18
26
  # @return [Xrechnung::TaxCategory]
19
27
  member :commodity_classification, type: Xrechnung::TaxCategory
@@ -23,16 +31,31 @@ module Xrechnung
23
31
  member :classified_tax_category, type: Xrechnung::TaxCategory
24
32
 
25
33
  # noinspection RubyResolve
26
- def to_xml(xml)
34
+ def to_xml(xml) # rubocop:disable Metrics
27
35
  xml.cac :Item do
28
36
  xml.cbc :Description, description
29
37
  xml.cbc :Name, name
38
+
30
39
  unless standard_item_identification_id.nil?
31
40
  xml.cac :StandardItemIdentification do
32
41
  xml.cbc :ID, standard_item_identification_id.id, schemeID: standard_item_identification_id.scheme_id
33
42
  end
34
43
  end
35
- xml.cac :CommodityClassification, commodity_classification
44
+
45
+ unless buyers_item_identification_id.nil?
46
+ xml.cac :BuyersItemIdentification do
47
+ xml.cbc :ID, buyers_item_identification_id.id
48
+ end
49
+ end
50
+
51
+ unless sellers_item_identification_id.nil?
52
+ xml.cac :SellersItemIdentification do
53
+ xml.cbc :ID, sellers_item_identification_id.id
54
+ end
55
+ end
56
+
57
+ xml.cac :CommodityClassification, commodity_classification unless commodity_classification.nil?
58
+
36
59
  classified_tax_category&.to_xml(xml, root_tag_name: :ClassifiedTaxCategory)
37
60
  end
38
61
  end
@@ -3,7 +3,7 @@ module Xrechnung
3
3
  include MemberContainer
4
4
 
5
5
  transform_currency = ->(v) {
6
- Currency::EUR(v)
6
+ v.is_a?(Currency) ? v : Currency::EUR(v)
7
7
  }
8
8
 
9
9
  # @!attribute line_extension_amount
@@ -43,7 +43,7 @@ module Xrechnung
43
43
  self.class.members.each_key do |name|
44
44
  next if self[name].nil?
45
45
 
46
- xml.cbc :"#{name.to_s.split("_").map(&:capitalize).join}", *self[name].xml_args
46
+ xml.cbc :"#{name.to_s.split('_').map(&:capitalize).join}", *self[name].xml_args
47
47
  end
48
48
  xml.target!
49
49
  end
@@ -47,6 +47,9 @@ module Xrechnung
47
47
  private
48
48
 
49
49
  def party_body(xml)
50
+ xml.cbc :EndpointID, contact&.electronic_mail, schemeID: "EM" if contact&.electronic_mail
51
+
52
+ party_identification&.to_xml(xml)
50
53
  unless name.nil? # if blank? -> empty name tag
51
54
  xml.cac :PartyName do
52
55
  if name == ""
@@ -56,7 +59,6 @@ module Xrechnung
56
59
  end
57
60
  end
58
61
  end
59
- party_identification&.to_xml(xml)
60
62
  postal_address&.to_xml(xml)
61
63
  party_tax_scheme&.to_xml(xml)
62
64
  party_legal_entity&.to_xml(xml)
@@ -2,6 +2,10 @@ module Xrechnung
2
2
  class PartyLegalEntity
3
3
  include MemberContainer
4
4
 
5
+ # @!attribute company_id
6
+ # @return [String]
7
+ member :company_id, type: String
8
+
5
9
  # @!attribute registration_name
6
10
  # @return [String]
7
11
  member :registration_name, type: String
@@ -10,6 +14,7 @@ module Xrechnung
10
14
  def to_xml(xml)
11
15
  xml.cac :PartyLegalEntity do
12
16
  xml.cbc :RegistrationName, registration_name
17
+ xml.cbc(:CompanyID, company_id) unless company_id.nil?
13
18
  end
14
19
  end
15
20
  end
@@ -15,7 +15,7 @@ module Xrechnung
15
15
  member :allowance_charge, type: Xrechnung::AllowanceCharge
16
16
 
17
17
  def initialize(**kwargs)
18
- kwargs[:price_amount] = Currency::EUR(kwargs[:price_amount])
18
+ kwargs[:price_amount] = Currency::EUR(kwargs[:price_amount]) unless kwargs[:price_amount].is_a?(Currency)
19
19
  super(**kwargs)
20
20
  end
21
21
 
@@ -23,7 +23,7 @@ module Xrechnung
23
23
  def to_xml(xml)
24
24
  xml.cac :Price do
25
25
  xml.cbc :PriceAmount, *price_amount.xml_args
26
- xml.cbc :BaseQuantity, *base_quantity.xml_args
26
+ xml.cbc(:BaseQuantity, *base_quantity.xml_args) unless base_quantity.nil?
27
27
  allowance_charge&.to_xml(xml)
28
28
  end
29
29
  end
@@ -4,9 +4,8 @@ module Xrechnung
4
4
  format("%0.2f", amount)
5
5
  end
6
6
 
7
-
8
7
  def xml_args
9
- [amount_to_s, unitCode: unit_code]
8
+ [amount_to_s, { unitCode: unit_code }]
10
9
  end
11
10
  end
12
11
  end
@@ -29,6 +29,14 @@ module Xrechnung
29
29
  # @return [String]
30
30
  member :tax_scheme_id, type: String, default: "VAT"
31
31
 
32
+ # @!attribute tax_exemption_reason_code
33
+ # @return [String]
34
+ member :tax_exemption_reason_code, type: String
35
+
36
+ # @!attribute tax_exemption_reason
37
+ # @return [String]
38
+ member :tax_exemption_reason, type: String
39
+
32
40
  # noinspection RubyResolve
33
41
  def to_xml(xml, root_tag_name: :TaxCategory)
34
42
  xml.cac root_tag_name do
@@ -37,6 +45,11 @@ module Xrechnung
37
45
  xml.cac :TaxScheme do
38
46
  xml.cbc :ID, tax_scheme_id
39
47
  end
48
+
49
+ unless tax_exemption_reason_code.nil?
50
+ xml.cbc :TaxExemptionReasonCode, tax_exemption_reason_code
51
+ xml.cbc :TaxExemptionReason, tax_exemption_reason
52
+ end
40
53
  end
41
54
  end
42
55
  end
@@ -1,3 +1,3 @@
1
1
  module Xrechnung
2
- VERSION = "0.2.0"
2
+ VERSION = "0.4.0".freeze
3
3
  end
data/lib/xrechnung.rb CHANGED
@@ -30,6 +30,22 @@ module Xrechnung
30
30
  class Document
31
31
  include MemberContainer
32
32
 
33
+ # Default customization specs
34
+ DEFAULT_CUSTOMIZATION_ID = "urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0"
35
+ DEFAULT_PROFILE_ID = "urn:fdc:peppol.eu:2017:poacc:billing:01:1.0"
36
+
37
+ # Document customization identifier
38
+ #
39
+ # @!attribute customization_id
40
+ # @return [String]
41
+ member :customization_id, type: String, default: DEFAULT_CUSTOMIZATION_ID
42
+
43
+ # Document profile identifier
44
+ #
45
+ # @!attribute profile_id
46
+ # @return [String]
47
+ member :profile_id, type: String, default: DEFAULT_PROFILE_ID
48
+
33
49
  # Invoice number BT-1
34
50
  #
35
51
  # Eine eindeutige Kennung der Rechnung, die diese im System des Verkäufers identifiziert.
@@ -147,7 +163,7 @@ module Xrechnung
147
163
  #
148
164
  # @!attribute tax_currency_code
149
165
  # @return [String]
150
- member :tax_currency_code, type: String, default: "EUR"
166
+ member :tax_currency_code, type: String
151
167
 
152
168
  # Buyer reference BT-10
153
169
  #
@@ -245,6 +261,17 @@ module Xrechnung
245
261
  # @return [Array]
246
262
  member :invoice_lines, type: Array, default: []
247
263
 
264
+ # DOCUMENT LEVEL ALLOWANCES AND CHARGES BG-20, BG-21
265
+ #
266
+ # A group of business terms providing information about allowances
267
+ # applicable to the Invoice as a whole. A group of business terms providing
268
+ # information about charges and taxes other than VAT, applicable to the
269
+ # Invoice as a whole.
270
+ #
271
+ # @!attribute allowance_charges
272
+ # @return [Array]
273
+ member :allowance_charges, type: Array, default: []
274
+
248
275
  def to_xml(indent: 2, target: "")
249
276
  xml = Builder::XmlMarkup.new(indent: indent, target: target)
250
277
  xml.instruct! :xml, version: "1.0", encoding: "UTF-8"
@@ -255,7 +282,8 @@ module Xrechnung
255
282
  "xmlns:cbc" => "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2",
256
283
  "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
257
284
  "xsi:schemaLocation" => "urn:oasis:names:specification:ubl:schema:xsd:Invoice-2 http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-Invoice-2.1.xsd" do
258
- xml.cbc :CustomizationID, "urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_2.3"
285
+ xml.cbc :CustomizationID, customization_id
286
+ xml.cbc :ProfileID, profile_id
259
287
  xml.cbc :ID, id
260
288
  xml.cbc :IssueDate, issue_date
261
289
  xml.cbc :DueDate, due_date
@@ -267,12 +295,10 @@ module Xrechnung
267
295
 
268
296
  xml.cbc :TaxPointDate, tax_point_date unless tax_point_date.nil?
269
297
  xml.cbc :DocumentCurrencyCode, document_currency_code
270
- xml.cbc :TaxCurrencyCode, tax_currency_code
298
+ xml.cbc :TaxCurrencyCode, tax_currency_code unless tax_currency_code.nil?
271
299
  xml.cbc :BuyerReference, buyer_reference
272
300
 
273
- unless self.class.members[:invoice_period].optional && invoice_period.nil?
274
- invoice_period&.to_xml(xml)
275
- end
301
+ invoice_period&.to_xml(xml) unless self.class.members[:invoice_period].optional && invoice_period.nil?
276
302
 
277
303
  xml.cac :OrderReference do
278
304
  xml.cbc :ID, purchase_order_reference
@@ -317,6 +343,10 @@ module Xrechnung
317
343
  xml.cbc :Note, payment_terms_note
318
344
  end
319
345
 
346
+ allowance_charges.each do |allowance_charge|
347
+ allowance_charge&.to_xml(xml)
348
+ end
349
+
320
350
  xml.cac :TaxTotal do
321
351
  tax_total&.to_xml(xml)
322
352
  end
data/xrechnung.gemspec CHANGED
@@ -1,4 +1,4 @@
1
- require_relative 'lib/xrechnung/version'
1
+ require_relative "lib/xrechnung/version"
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "xrechnung"
@@ -6,24 +6,24 @@ Gem::Specification.new do |spec|
6
6
  spec.authors = ["Julian Kornberger"]
7
7
  spec.email = ["jk+github@digineo.de"]
8
8
 
9
- spec.summary = %q{Library to create invoices in the XRechnung format.}
10
- spec.homepage = "https://github.com/digineo/xrechnung"
11
- spec.license = "MIT"
12
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
9
+ spec.summary = "Library to create invoices in the XRechnung format."
10
+ spec.homepage = "https://github.com/digineo/xrechnung"
11
+ spec.license = "MIT"
12
+ spec.required_ruby_version = Gem::Requirement.new(">= 3.0.0")
13
13
 
14
- spec.metadata["homepage_uri"] = spec.homepage
14
+ spec.metadata["homepage_uri"] = spec.homepage
15
15
  spec.metadata["source_code_uri"] = "https://github.com/digineo/xrechnung"
16
16
 
17
17
  # Specify which files should be added to the gem when it is released.
18
18
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
19
+ spec.files = Dir.chdir(File.expand_path(__dir__)) {
20
20
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
- end
21
+ }
22
22
 
23
23
  spec.require_paths = ["lib"]
24
24
 
25
25
  spec.add_dependency "builder", "~> 3.2"
26
26
 
27
- spec.add_development_dependency "httparty"
27
+ spec.add_development_dependency "httparty", "~> 0.22"
28
28
  spec.add_development_dependency "rubyzip", "~> 2.0"
29
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xrechnung
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Kornberger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-18 00:00:00.000000000 Z
11
+ date: 2024-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: httparty
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '0.22'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: '0.22'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rubyzip
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -111,14 +111,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
111
111
  requirements:
112
112
  - - ">="
113
113
  - !ruby/object:Gem::Version
114
- version: 2.3.0
114
+ version: 3.0.0
115
115
  required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  requirements:
117
117
  - - ">="
118
118
  - !ruby/object:Gem::Version
119
119
  version: '0'
120
120
  requirements: []
121
- rubygems_version: 3.1.6
121
+ rubygems_version: 3.5.19
122
122
  signing_key:
123
123
  specification_version: 4
124
124
  summary: Library to create invoices in the XRechnung format.