xrechnung 0.4.0 → 0.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/Gemfile.lock +1 -2
- data/lib/xrechnung/allowance_charge.rb +6 -3
- data/lib/xrechnung/invoice_line.rb +7 -0
- data/lib/xrechnung/party_identification.rb +9 -1
- data/lib/xrechnung/payee_party.rb +36 -0
- data/lib/xrechnung/payment_mandate.rb +29 -0
- data/lib/xrechnung/payment_means.rb +6 -0
- data/lib/xrechnung/tax_category.rb +6 -5
- data/lib/xrechnung/version.rb +1 -1
- data/lib/xrechnung.rb +35 -11
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb9e44c799aaa06982ea5b1fde9dda518822ad63b88c0519f43a85f4bd29ab7d
|
4
|
+
data.tar.gz: e4e84a5c0bd1c7e049b2944c513c3ab8b682d750dbaadbf37f5169e75b716315
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 676b9a6e8140f39b2b12b64abf869c97cd6a5353e369e2d8d26e86d0e4242ad7c31141b084a351492b20b085901b3f891732fd4cc12ac497c4ac0e53b277ed66
|
7
|
+
data.tar.gz: 50e8c1b14ae64fae08567276627446a67ea3a70a4fda48e80a8ce96024c78b24331d9487677d1f18c5fb1fbb5f71c98b64769fbccb042d50271ee2b791037157
|
data/Gemfile.lock
CHANGED
@@ -24,7 +24,7 @@ module Xrechnung
|
|
24
24
|
|
25
25
|
# @!attribute base_amount
|
26
26
|
# @return [Xrechnung::Currency]
|
27
|
-
member :base_amount, type: Xrechnung::Currency
|
27
|
+
member :base_amount, type: Xrechnung::Currency, optional: true
|
28
28
|
|
29
29
|
# @!attribute tax_category
|
30
30
|
# @return [Xrechnung::TaxCategory]
|
@@ -35,7 +35,7 @@ module Xrechnung
|
|
35
35
|
kwargs[:amount] = Currency::EUR(kwargs[:amount])
|
36
36
|
end
|
37
37
|
|
38
|
-
unless kwargs[:base_amount].is_a?(Currency)
|
38
|
+
unless kwargs[:base_amount].is_a?(Currency) || kwargs[:base_amount].nil?
|
39
39
|
kwargs[:base_amount] = Currency::EUR(kwargs[:base_amount])
|
40
40
|
end
|
41
41
|
|
@@ -60,7 +60,10 @@ module Xrechnung
|
|
60
60
|
end
|
61
61
|
|
62
62
|
xml.cbc :Amount, *amount.xml_args
|
63
|
-
|
63
|
+
|
64
|
+
if base_amount
|
65
|
+
xml.cbc :BaseAmount, *base_amount.xml_args
|
66
|
+
end
|
64
67
|
|
65
68
|
tax_category&.to_xml(xml)
|
66
69
|
end
|
@@ -28,6 +28,10 @@ module Xrechnung
|
|
28
28
|
# @return [Xrechnung::Price]
|
29
29
|
member :price, type: Xrechnung::Price
|
30
30
|
|
31
|
+
# @!attribute allowance_charges
|
32
|
+
# @return [Array<Xrechnung::AllowanceCharge>]
|
33
|
+
member :allowance_charges, type: Array, default: []
|
34
|
+
|
31
35
|
def initialize(**kwargs)
|
32
36
|
unless kwargs[:line_extension_amount].is_a?(Currency)
|
33
37
|
kwargs[:line_extension_amount] = Currency::EUR(kwargs[:line_extension_amount])
|
@@ -43,6 +47,9 @@ module Xrechnung
|
|
43
47
|
xml.cbc :LineExtensionAmount, *line_extension_amount.xml_args
|
44
48
|
|
45
49
|
invoice_period&.to_xml(xml) unless self.class.members[:invoice_period].optional && invoice_period.nil?
|
50
|
+
allowance_charges.each do |allowance_charge|
|
51
|
+
allowance_charge.to_xml(xml)
|
52
|
+
end
|
46
53
|
item&.to_xml(xml)
|
47
54
|
price&.to_xml(xml)
|
48
55
|
end
|
@@ -6,10 +6,18 @@ module Xrechnung
|
|
6
6
|
# @return [String]
|
7
7
|
member :id, type: String
|
8
8
|
|
9
|
+
# @!attribute scheme_id
|
10
|
+
# @return [String]
|
11
|
+
member :scheme_id, type: String, optional: true
|
12
|
+
|
9
13
|
# noinspection RubyResolve
|
10
14
|
def to_xml(xml)
|
11
15
|
xml.cac :PartyIdentification do
|
12
|
-
|
16
|
+
if scheme_id
|
17
|
+
xml.cbc :ID, id, schemeID: scheme_id
|
18
|
+
else
|
19
|
+
xml.cbc :ID, id
|
20
|
+
end
|
13
21
|
end
|
14
22
|
end
|
15
23
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Xrechnung
|
2
|
+
# <cac:PayeeParty>
|
3
|
+
# <cac:PartyIdentification>
|
4
|
+
# <cbc:ID schemeID="SEPA">FR932874294</cbc:ID>
|
5
|
+
# </cac:PartyIdentification>
|
6
|
+
# <cac:PartyName>
|
7
|
+
# <cbc:Name>Payee Name Ltd</cbc:Name>
|
8
|
+
# </cac:PartyName>
|
9
|
+
# </cac:PayeeParty>
|
10
|
+
class PayeeParty
|
11
|
+
include MemberContainer
|
12
|
+
|
13
|
+
# @!attribute id
|
14
|
+
# @return [String]
|
15
|
+
member :id, type: String
|
16
|
+
|
17
|
+
# @!attribute name
|
18
|
+
# @return [String]
|
19
|
+
member :name, type: String, optional: true
|
20
|
+
|
21
|
+
# noinspection RubyResolve
|
22
|
+
def to_xml(xml)
|
23
|
+
xml.cac :PayeeParty do
|
24
|
+
xml.cac :PartyIdentification do
|
25
|
+
xml.cbc :ID, id, schemeID: "SEPA"
|
26
|
+
end
|
27
|
+
|
28
|
+
if name
|
29
|
+
xml.cac :PartyName do
|
30
|
+
xml.cbc :Name, name
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Xrechnung
|
2
|
+
# <cac:PaymentMandate>
|
3
|
+
# <cbc:ID>SEPA-MANDAT-123</cbc:ID>
|
4
|
+
# <cac:PayerFinancialAccount>
|
5
|
+
# <cbc:ID>DE02500105170137075030</cbc:ID>
|
6
|
+
# </cac:PayerFinancialAccount>
|
7
|
+
# </cac:PaymentMandate>
|
8
|
+
class PaymentMandate
|
9
|
+
include MemberContainer
|
10
|
+
|
11
|
+
# @!attribute id
|
12
|
+
# @return [String]
|
13
|
+
member :id, type: String
|
14
|
+
|
15
|
+
# @!attribute payer_financial_account_id
|
16
|
+
# @return [String]
|
17
|
+
member :payer_financial_account_id, type: String
|
18
|
+
|
19
|
+
# noinspection RubyResolve
|
20
|
+
def to_xml(xml)
|
21
|
+
xml.cac :PaymentMandate do
|
22
|
+
xml.cbc :ID, id
|
23
|
+
xml.cac :PayerFinancialAccount do
|
24
|
+
xml.cbc :ID, payer_financial_account_id
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -20,10 +20,16 @@ module Xrechnung
|
|
20
20
|
# @return [Xrechnung::PayeeFinancialAccount]
|
21
21
|
member :payee_financial_account, type: Xrechnung::PayeeFinancialAccount
|
22
22
|
|
23
|
+
# @!attribute payment_mandate
|
24
|
+
# @return [Xrechnung::PaymentMandate]
|
25
|
+
member :payment_mandate, type: Xrechnung::PaymentMandate, optional: true
|
26
|
+
|
23
27
|
# noinspection RubyResolve
|
24
28
|
def to_xml(xml)
|
25
29
|
xml.cbc :PaymentMeansCode, payment_means_code
|
26
30
|
payee_financial_account&.to_xml(xml)
|
31
|
+
payment_mandate&.to_xml(xml)
|
32
|
+
xml.target!
|
27
33
|
end
|
28
34
|
end
|
29
35
|
end
|
@@ -23,7 +23,7 @@ module Xrechnung
|
|
23
23
|
|
24
24
|
# @!attribute percent
|
25
25
|
# @return [BigDecimal]
|
26
|
-
member :percent, type: BigDecimal, transform_value: ->(v) { BigDecimal(v, 0) }
|
26
|
+
member :percent, type: BigDecimal, transform_value: ->(v) { v.nil? ? nil : BigDecimal(v, 0) }
|
27
27
|
|
28
28
|
# @!attribute tax_scheme_id
|
29
29
|
# @return [String]
|
@@ -41,15 +41,16 @@ module Xrechnung
|
|
41
41
|
def to_xml(xml, root_tag_name: :TaxCategory)
|
42
42
|
xml.cac root_tag_name do
|
43
43
|
xml.cbc :ID, id
|
44
|
-
xml.cbc :Percent, format("%.2f", percent)
|
45
|
-
xml.cac :TaxScheme do
|
46
|
-
xml.cbc :ID, tax_scheme_id
|
47
|
-
end
|
44
|
+
xml.cbc :Percent, format("%.2f", percent) unless percent.nil?
|
48
45
|
|
49
46
|
unless tax_exemption_reason_code.nil?
|
50
47
|
xml.cbc :TaxExemptionReasonCode, tax_exemption_reason_code
|
51
48
|
xml.cbc :TaxExemptionReason, tax_exemption_reason
|
52
49
|
end
|
50
|
+
|
51
|
+
xml.cac :TaxScheme do
|
52
|
+
xml.cbc :ID, tax_scheme_id
|
53
|
+
end
|
53
54
|
end
|
54
55
|
end
|
55
56
|
end
|
data/lib/xrechnung/version.rb
CHANGED
data/lib/xrechnung.rb
CHANGED
@@ -11,6 +11,8 @@ require "xrechnung/party_tax_scheme"
|
|
11
11
|
require "xrechnung/postal_address"
|
12
12
|
require "xrechnung/party"
|
13
13
|
require "xrechnung/payee_financial_account"
|
14
|
+
require "xrechnung/payment_mandate"
|
15
|
+
require "xrechnung/payee_party"
|
14
16
|
require "xrechnung/payment_means"
|
15
17
|
require "xrechnung/tax_total"
|
16
18
|
require "xrechnung/tax_category"
|
@@ -117,7 +119,7 @@ module Xrechnung
|
|
117
119
|
#
|
118
120
|
# @!attribute purchase_order_reference
|
119
121
|
# @return [String]
|
120
|
-
member :purchase_order_reference, type: String
|
122
|
+
member :purchase_order_reference, type: String, optional: true
|
121
123
|
|
122
124
|
# Sales order reference BT-14
|
123
125
|
#
|
@@ -195,7 +197,7 @@ module Xrechnung
|
|
195
197
|
#
|
196
198
|
# @!attribute contract_document_reference_id
|
197
199
|
# @return [String]
|
198
|
-
member :contract_document_reference_id, type: String
|
200
|
+
member :contract_document_reference_id, type: String, optional: true
|
199
201
|
|
200
202
|
# Project reference BT-11
|
201
203
|
#
|
@@ -203,7 +205,7 @@ module Xrechnung
|
|
203
205
|
#
|
204
206
|
# @!attribute project_reference_id
|
205
207
|
# @return [String]
|
206
|
-
member :project_reference_id, type: String
|
208
|
+
member :project_reference_id, type: String, optional: true
|
207
209
|
|
208
210
|
# SELLER TAX REPRESENTATIVE PARTY BG-11
|
209
211
|
#
|
@@ -223,6 +225,15 @@ module Xrechnung
|
|
223
225
|
# @return [Xrechnung::PaymentMeans]
|
224
226
|
member :payment_means, type: Xrechnung::PaymentMeans
|
225
227
|
|
228
|
+
# PAYEE PARTY BG-10
|
229
|
+
#
|
230
|
+
# A group of business terms providing information about the Payee, i.e. the role that receives
|
231
|
+
# the payment. Shall be used when the Payee is different from the Seller.
|
232
|
+
#
|
233
|
+
# @!attribute payee_party
|
234
|
+
# @return [Xrechnung::PayeeParty]
|
235
|
+
member :payee_party, type: Xrechnung::PayeeParty, optional: true
|
236
|
+
|
226
237
|
# Payment terms BT-20
|
227
238
|
#
|
228
239
|
# Eine Textbeschreibung der Zahlungsbedingungen, die für den fälligen Zahlungsbetrag gelten (einschließlich
|
@@ -300,10 +311,15 @@ module Xrechnung
|
|
300
311
|
|
301
312
|
invoice_period&.to_xml(xml) unless self.class.members[:invoice_period].optional && invoice_period.nil?
|
302
313
|
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
314
|
+
unless self.class.members[:purchase_order_reference].optional && purchase_order_reference.nil? &&
|
315
|
+
self.class.members[:sales_order_reference].optional && sales_order_reference.nil?
|
316
|
+
xml.cac :OrderReference do
|
317
|
+
unless self.class.members[:purchase_order_reference].optional && purchase_order_reference.nil?
|
318
|
+
xml.cbc :ID, purchase_order_reference
|
319
|
+
end
|
320
|
+
unless self.class.members[:sales_order_reference].optional && sales_order_reference.nil?
|
321
|
+
xml.cbc :SalesOrderID, sales_order_reference
|
322
|
+
end
|
307
323
|
end
|
308
324
|
end
|
309
325
|
|
@@ -313,12 +329,16 @@ module Xrechnung
|
|
313
329
|
end
|
314
330
|
end
|
315
331
|
|
316
|
-
|
317
|
-
xml.
|
332
|
+
unless self.class.members[:contract_document_reference_id].optional && contract_document_reference_id.nil?
|
333
|
+
xml.cac :ContractDocumentReference do
|
334
|
+
xml.cbc :ID, contract_document_reference_id
|
335
|
+
end
|
318
336
|
end
|
319
337
|
|
320
|
-
|
321
|
-
xml.
|
338
|
+
unless self.class.members[:project_reference_id].optional && project_reference_id.nil?
|
339
|
+
xml.cac :ProjectReference do
|
340
|
+
xml.cbc :ID, project_reference_id
|
341
|
+
end
|
322
342
|
end
|
323
343
|
|
324
344
|
xml.cac :AccountingSupplierParty do
|
@@ -339,6 +359,10 @@ module Xrechnung
|
|
339
359
|
payment_means&.to_xml(xml)
|
340
360
|
end
|
341
361
|
|
362
|
+
unless self.class.members[:payee_party].optional && payee_party.nil?
|
363
|
+
payee_party&.to_xml(xml)
|
364
|
+
end
|
365
|
+
|
342
366
|
xml.cac :PaymentTerms do
|
343
367
|
xml.cbc :Note, payment_terms_note
|
344
368
|
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.
|
4
|
+
version: 0.5.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-12-
|
11
|
+
date: 2024-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: builder
|
@@ -88,6 +88,8 @@ files:
|
|
88
88
|
- lib/xrechnung/party_legal_entity.rb
|
89
89
|
- lib/xrechnung/party_tax_scheme.rb
|
90
90
|
- lib/xrechnung/payee_financial_account.rb
|
91
|
+
- lib/xrechnung/payee_party.rb
|
92
|
+
- lib/xrechnung/payment_mandate.rb
|
91
93
|
- lib/xrechnung/payment_means.rb
|
92
94
|
- lib/xrechnung/postal_address.rb
|
93
95
|
- lib/xrechnung/price.rb
|