xrechnung 0.4.0 → 0.6.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/additional_document_reference.rb +34 -0
- data/lib/xrechnung/allowance_charge.rb +6 -3
- data/lib/xrechnung/attachment.rb +27 -0
- 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 +44 -18
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78c300f8df950e3c2c73b875bc6976833fea6d85b75f8a9702972f6833d8a1ad
|
4
|
+
data.tar.gz: b7104e08877570bf376a8adc108965729d641f8fb73c49962a80b891570d3900
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b68cacfa965ff9b830c5b635f6e866043e8a91756bae106c044475c0f5a69ce6a5759d9570361788ec80f45b04dc7c5279ce9930f3f3f4f496f1fad0b590168
|
7
|
+
data.tar.gz: b9604f5e4669e5284c50da9328587a6c0c64b1c04854276e2ceb0c5e2c3039ab22ec0c51662c775d95ab38cbe78fd13c2a64596ef1c78a5f0f2d7c4587c12275
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
require "xrechnung/attachment"
|
2
|
+
|
3
|
+
module Xrechnung
|
4
|
+
class AdditionalDocumentReference
|
5
|
+
include MemberContainer
|
6
|
+
|
7
|
+
# @!attribute id
|
8
|
+
# @return [String]
|
9
|
+
member :id, type: String
|
10
|
+
|
11
|
+
# @!attribute document_type
|
12
|
+
# @return [String]
|
13
|
+
member :document_type, type: String, optional: true
|
14
|
+
|
15
|
+
# @!attribute document_description
|
16
|
+
# @return [String]
|
17
|
+
member :document_description, type: String, optional: true
|
18
|
+
|
19
|
+
# @!attribute attachment
|
20
|
+
# @return [Xrechnung::Attachment]
|
21
|
+
member :attachment, type: Xrechnung::Attachment, optional: true
|
22
|
+
|
23
|
+
# noinspection RubyResolve
|
24
|
+
def to_xml(xml)
|
25
|
+
xml.cac :AdditionalDocumentReference do
|
26
|
+
xml.cbc :ID, id
|
27
|
+
xml.cbc :DocumentType, document_type
|
28
|
+
xml.cbc :DocumentDescription, document_description
|
29
|
+
|
30
|
+
attachment&.to_xml(xml)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -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
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "base64"
|
2
|
+
|
3
|
+
module Xrechnung
|
4
|
+
class Attachment
|
5
|
+
include MemberContainer
|
6
|
+
|
7
|
+
# @!attribute mime_code
|
8
|
+
# @return [String]
|
9
|
+
member :mime_code, type: String
|
10
|
+
|
11
|
+
# @!attribute filename
|
12
|
+
# @return [String]
|
13
|
+
member :filename, type: String
|
14
|
+
|
15
|
+
member :payload
|
16
|
+
|
17
|
+
# noinspection RubyResolve
|
18
|
+
def to_xml(xml)
|
19
|
+
xml.cac :Attachment do
|
20
|
+
xml.cbc :EmbeddedDocumentBinaryObject,
|
21
|
+
Base64.strict_encode64(payload),
|
22
|
+
mimeCode: mime_code,
|
23
|
+
filename: filename
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
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
@@ -4,6 +4,7 @@ require "xrechnung/currency"
|
|
4
4
|
require "xrechnung/quantity"
|
5
5
|
require "xrechnung/id"
|
6
6
|
require "xrechnung/member_container"
|
7
|
+
require "xrechnung/additional_document_reference"
|
7
8
|
require "xrechnung/contact"
|
8
9
|
require "xrechnung/party_identification"
|
9
10
|
require "xrechnung/party_legal_entity"
|
@@ -11,6 +12,8 @@ require "xrechnung/party_tax_scheme"
|
|
11
12
|
require "xrechnung/postal_address"
|
12
13
|
require "xrechnung/party"
|
13
14
|
require "xrechnung/payee_financial_account"
|
15
|
+
require "xrechnung/payment_mandate"
|
16
|
+
require "xrechnung/payee_party"
|
14
17
|
require "xrechnung/payment_means"
|
15
18
|
require "xrechnung/tax_total"
|
16
19
|
require "xrechnung/tax_category"
|
@@ -32,7 +35,7 @@ module Xrechnung
|
|
32
35
|
|
33
36
|
# Default customization specs
|
34
37
|
DEFAULT_CUSTOMIZATION_ID = "urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0"
|
35
|
-
DEFAULT_PROFILE_ID
|
38
|
+
DEFAULT_PROFILE_ID = "urn:fdc:peppol.eu:2017:poacc:billing:01:1.0"
|
36
39
|
|
37
40
|
# Document customization identifier
|
38
41
|
#
|
@@ -117,7 +120,7 @@ module Xrechnung
|
|
117
120
|
#
|
118
121
|
# @!attribute purchase_order_reference
|
119
122
|
# @return [String]
|
120
|
-
member :purchase_order_reference, type: String
|
123
|
+
member :purchase_order_reference, type: String, optional: true
|
121
124
|
|
122
125
|
# Sales order reference BT-14
|
123
126
|
#
|
@@ -185,6 +188,11 @@ module Xrechnung
|
|
185
188
|
# @return [Xrechnung::InvoiceDocumentReference]
|
186
189
|
member :billing_reference, type: Xrechnung::InvoiceDocumentReference, optional: true
|
187
190
|
|
191
|
+
# Additional supporting documents BG-24
|
192
|
+
# @!attribute additional_document_references
|
193
|
+
# @return [Array]
|
194
|
+
member :additional_document_references, type: Array, default: []
|
195
|
+
|
188
196
|
# @!attribute invoice_period
|
189
197
|
# @return [Xrechnung::InvoicePeriod]
|
190
198
|
member :invoice_period, type: Xrechnung::InvoicePeriod, optional: true
|
@@ -195,7 +203,7 @@ module Xrechnung
|
|
195
203
|
#
|
196
204
|
# @!attribute contract_document_reference_id
|
197
205
|
# @return [String]
|
198
|
-
member :contract_document_reference_id, type: String
|
206
|
+
member :contract_document_reference_id, type: String, optional: true
|
199
207
|
|
200
208
|
# Project reference BT-11
|
201
209
|
#
|
@@ -203,7 +211,7 @@ module Xrechnung
|
|
203
211
|
#
|
204
212
|
# @!attribute project_reference_id
|
205
213
|
# @return [String]
|
206
|
-
member :project_reference_id, type: String
|
214
|
+
member :project_reference_id, type: String, optional: true
|
207
215
|
|
208
216
|
# SELLER TAX REPRESENTATIVE PARTY BG-11
|
209
217
|
#
|
@@ -223,6 +231,15 @@ module Xrechnung
|
|
223
231
|
# @return [Xrechnung::PaymentMeans]
|
224
232
|
member :payment_means, type: Xrechnung::PaymentMeans
|
225
233
|
|
234
|
+
# PAYEE PARTY BG-10
|
235
|
+
#
|
236
|
+
# A group of business terms providing information about the Payee, i.e. the role that receives
|
237
|
+
# the payment. Shall be used when the Payee is different from the Seller.
|
238
|
+
#
|
239
|
+
# @!attribute payee_party
|
240
|
+
# @return [Xrechnung::PayeeParty]
|
241
|
+
member :payee_party, type: Xrechnung::PayeeParty, optional: true
|
242
|
+
|
226
243
|
# Payment terms BT-20
|
227
244
|
#
|
228
245
|
# Eine Textbeschreibung der Zahlungsbedingungen, die für den fälligen Zahlungsbetrag gelten (einschließlich
|
@@ -300,10 +317,15 @@ module Xrechnung
|
|
300
317
|
|
301
318
|
invoice_period&.to_xml(xml) unless self.class.members[:invoice_period].optional && invoice_period.nil?
|
302
319
|
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
320
|
+
unless self.class.members[:purchase_order_reference].optional && purchase_order_reference.nil? &&
|
321
|
+
self.class.members[:sales_order_reference].optional && sales_order_reference.nil?
|
322
|
+
xml.cac :OrderReference do
|
323
|
+
unless self.class.members[:purchase_order_reference].optional && purchase_order_reference.nil?
|
324
|
+
xml.cbc :ID, purchase_order_reference
|
325
|
+
end
|
326
|
+
unless self.class.members[:sales_order_reference].optional && sales_order_reference.nil?
|
327
|
+
xml.cbc :SalesOrderID, sales_order_reference
|
328
|
+
end
|
307
329
|
end
|
308
330
|
end
|
309
331
|
|
@@ -313,14 +335,20 @@ module Xrechnung
|
|
313
335
|
end
|
314
336
|
end
|
315
337
|
|
316
|
-
|
317
|
-
xml.
|
338
|
+
unless self.class.members[:contract_document_reference_id].optional && contract_document_reference_id.nil?
|
339
|
+
xml.cac :ContractDocumentReference do
|
340
|
+
xml.cbc :ID, contract_document_reference_id
|
341
|
+
end
|
318
342
|
end
|
319
343
|
|
320
|
-
|
321
|
-
xml.
|
344
|
+
unless self.class.members[:project_reference_id].optional && project_reference_id.nil?
|
345
|
+
xml.cac :ProjectReference do
|
346
|
+
xml.cbc :ID, project_reference_id
|
347
|
+
end
|
322
348
|
end
|
323
349
|
|
350
|
+
additional_document_references.each { _1.to_xml(xml) }
|
351
|
+
|
324
352
|
xml.cac :AccountingSupplierParty do
|
325
353
|
accounting_supplier_party&.to_xml(xml)
|
326
354
|
end
|
@@ -339,13 +367,13 @@ module Xrechnung
|
|
339
367
|
payment_means&.to_xml(xml)
|
340
368
|
end
|
341
369
|
|
370
|
+
payee_party&.to_xml(xml) unless self.class.members[:payee_party].optional && payee_party.nil?
|
371
|
+
|
342
372
|
xml.cac :PaymentTerms do
|
343
373
|
xml.cbc :Note, payment_terms_note
|
344
374
|
end
|
345
375
|
|
346
|
-
allowance_charges.each
|
347
|
-
allowance_charge&.to_xml(xml)
|
348
|
-
end
|
376
|
+
allowance_charges.each { _1.to_xml(xml) }
|
349
377
|
|
350
378
|
xml.cac :TaxTotal do
|
351
379
|
tax_total&.to_xml(xml)
|
@@ -355,9 +383,7 @@ module Xrechnung
|
|
355
383
|
legal_monetary_total&.to_xml(xml)
|
356
384
|
end
|
357
385
|
|
358
|
-
invoice_lines.each
|
359
|
-
invoice_line&.to_xml(xml)
|
360
|
-
end
|
386
|
+
invoice_lines.each { _1.to_xml(xml) }
|
361
387
|
end
|
362
388
|
|
363
389
|
target
|
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.6.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:
|
11
|
+
date: 2025-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: builder
|
@@ -73,7 +73,9 @@ files:
|
|
73
73
|
- bin/console
|
74
74
|
- bin/setup
|
75
75
|
- lib/xrechnung.rb
|
76
|
+
- lib/xrechnung/additional_document_reference.rb
|
76
77
|
- lib/xrechnung/allowance_charge.rb
|
78
|
+
- lib/xrechnung/attachment.rb
|
77
79
|
- lib/xrechnung/contact.rb
|
78
80
|
- lib/xrechnung/currency.rb
|
79
81
|
- lib/xrechnung/id.rb
|
@@ -88,6 +90,8 @@ files:
|
|
88
90
|
- lib/xrechnung/party_legal_entity.rb
|
89
91
|
- lib/xrechnung/party_tax_scheme.rb
|
90
92
|
- lib/xrechnung/payee_financial_account.rb
|
93
|
+
- lib/xrechnung/payee_party.rb
|
94
|
+
- lib/xrechnung/payment_mandate.rb
|
91
95
|
- lib/xrechnung/payment_means.rb
|
92
96
|
- lib/xrechnung/postal_address.rb
|
93
97
|
- lib/xrechnung/price.rb
|