facturx 0.1.0 → 0.2.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/CHANGELOG.md +10 -1
- data/NOTICE.md +2 -0
- data/README.md +27 -1
- data/lib/facturx/coerce.rb +74 -0
- data/lib/facturx/diagnostic.rb +20 -0
- data/lib/facturx/document.rb +45 -0
- data/lib/facturx/group.rb +5 -0
- data/lib/facturx/model/common.rb +8 -0
- data/lib/facturx/model/immutable.rb +75 -0
- data/lib/facturx/model/line.rb +14 -0
- data/lib/facturx/model/party.rb +10 -0
- data/lib/facturx/model/payment.rb +9 -0
- data/lib/facturx/model/reference.rb +7 -0
- data/lib/facturx/model/trade.rb +9 -0
- data/lib/facturx/model.rb +9 -0
- data/lib/facturx/pdf/extractor.rb +7 -4
- data/lib/facturx/reader/semantic_mapper/delivery_mapping.rb +43 -0
- data/lib/facturx/reader/semantic_mapper/document_mapping.rb +109 -0
- data/lib/facturx/reader/semantic_mapper/helpers.rb +114 -0
- data/lib/facturx/reader/semantic_mapper/line_mapping.rb +120 -0
- data/lib/facturx/reader/semantic_mapper/party_mapping.rb +90 -0
- data/lib/facturx/reader/semantic_mapper/payment_mapping.rb +71 -0
- data/lib/facturx/reader/semantic_mapper/trade_mapping.rb +83 -0
- data/lib/facturx/reader/semantic_mapper.rb +67 -0
- data/lib/facturx/reader/term_reader/coercion.rb +69 -0
- data/lib/facturx/reader/term_reader/unmapped.rb +37 -0
- data/lib/facturx/reader/term_reader.rb +124 -0
- data/lib/facturx/reader.rb +101 -0
- data/lib/facturx/reading.rb +23 -0
- data/lib/facturx/source_reader.rb +30 -0
- data/lib/facturx/term.rb +5 -0
- data/lib/facturx/terms/declaration.rb +20 -0
- data/lib/facturx/terms/declarations/adjustments.rb +230 -0
- data/lib/facturx/terms/declarations/delivery.rb +83 -0
- data/lib/facturx/terms/declarations/document.rb +223 -0
- data/lib/facturx/terms/declarations/groups.rb +356 -0
- data/lib/facturx/terms/declarations/lines.rb +166 -0
- data/lib/facturx/terms/declarations/parties.rb +609 -0
- data/lib/facturx/terms/declarations/payment.rb +106 -0
- data/lib/facturx/terms/declarations/products.rb +103 -0
- data/lib/facturx/terms/declarations/references.rb +72 -0
- data/lib/facturx/terms/declarations/taxes.rb +92 -0
- data/lib/facturx/terms/declarations/totals.rb +107 -0
- data/lib/facturx/terms/reference.rb +21 -0
- data/lib/facturx/terms.rb +109 -0
- data/lib/facturx/version.rb +1 -1
- data/lib/facturx.rb +14 -0
- metadata +45 -4
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Facturx::TermDeclarations::LINES = [
|
|
4
|
+
Facturx::TermDeclarations::Declaration.term(
|
|
5
|
+
'BT-126', :line, :id, 'BG-25',
|
|
6
|
+
'/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem' \
|
|
7
|
+
'/ram:AssociatedDocumentLineDocument/ram:LineID',
|
|
8
|
+
:string, nil,
|
|
9
|
+
basic: '1..1',
|
|
10
|
+
en16931: '1..1',
|
|
11
|
+
extended: '1..1'
|
|
12
|
+
),
|
|
13
|
+
Facturx::TermDeclarations::Declaration.term(
|
|
14
|
+
'BT-127', :line, :note, 'BG-25',
|
|
15
|
+
'/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem' \
|
|
16
|
+
'/ram:AssociatedDocumentLineDocument/ram:IncludedNote/ram:Content',
|
|
17
|
+
:string, nil,
|
|
18
|
+
basic: '0..1',
|
|
19
|
+
en16931: '0..1',
|
|
20
|
+
extended: '0..1'
|
|
21
|
+
),
|
|
22
|
+
Facturx::TermDeclarations::Declaration.term(
|
|
23
|
+
'BT-132', :line, :buyer_order_reference, 'BG-29',
|
|
24
|
+
'/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem' \
|
|
25
|
+
'/ram:SpecifiedLineTradeAgreement/ram:BuyerOrderReferencedDocument/ram:LineID',
|
|
26
|
+
:string, nil,
|
|
27
|
+
en16931: '0..1',
|
|
28
|
+
extended: '0..1'
|
|
29
|
+
),
|
|
30
|
+
Facturx::TermDeclarations::Declaration.term(
|
|
31
|
+
'BT-148', :line, :gross_price, 'BG-29',
|
|
32
|
+
'/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem' \
|
|
33
|
+
'/ram:SpecifiedLineTradeAgreement/ram:GrossPriceProductTradePrice/ram:ChargeAmount',
|
|
34
|
+
:decimal, nil,
|
|
35
|
+
basic: '0..1',
|
|
36
|
+
en16931: '0..1',
|
|
37
|
+
extended: '0..1'
|
|
38
|
+
),
|
|
39
|
+
Facturx::TermDeclarations::Declaration.term(
|
|
40
|
+
'BT-149-1', :line, :gross_price, 'BG-29',
|
|
41
|
+
'/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem' \
|
|
42
|
+
'/ram:SpecifiedLineTradeAgreement/ram:GrossPriceProductTradePrice/ram:BasisQuantity',
|
|
43
|
+
:decimal, nil,
|
|
44
|
+
basic: '0..1',
|
|
45
|
+
en16931: '0..1',
|
|
46
|
+
extended: '0..1'
|
|
47
|
+
),
|
|
48
|
+
Facturx::TermDeclarations::Declaration.term(
|
|
49
|
+
'BT-150-1', :line, :gross_price, 'BG-29',
|
|
50
|
+
'/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem' \
|
|
51
|
+
'/ram:SpecifiedLineTradeAgreement/ram:GrossPriceProductTradePrice/ram:BasisQuantity/@unitCode',
|
|
52
|
+
:string, nil,
|
|
53
|
+
basic: '0..1',
|
|
54
|
+
en16931: '0..1',
|
|
55
|
+
extended: '0..1'
|
|
56
|
+
),
|
|
57
|
+
Facturx::TermDeclarations::Declaration.term(
|
|
58
|
+
'BT-147-01', :line, :gross_price, 'BG-29',
|
|
59
|
+
'/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem' \
|
|
60
|
+
'/ram:SpecifiedLineTradeAgreement/ram:GrossPriceProductTradePrice/ram:AppliedTradeAllowanceCharge' \
|
|
61
|
+
'/ram:ChargeIndicator',
|
|
62
|
+
:boolean, nil,
|
|
63
|
+
basic: '0..1',
|
|
64
|
+
en16931: '0..1',
|
|
65
|
+
extended: '0..1'
|
|
66
|
+
),
|
|
67
|
+
Facturx::TermDeclarations::Declaration.term(
|
|
68
|
+
'BT-147-02', :line, :gross_price, 'BG-29',
|
|
69
|
+
'/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem' \
|
|
70
|
+
'/ram:SpecifiedLineTradeAgreement/ram:GrossPriceProductTradePrice/ram:AppliedTradeAllowanceCharge' \
|
|
71
|
+
'/ram:ChargeIndicator/udt:Indicator',
|
|
72
|
+
:boolean, nil,
|
|
73
|
+
basic: '1..1',
|
|
74
|
+
en16931: '1..1',
|
|
75
|
+
extended: '1..1'
|
|
76
|
+
),
|
|
77
|
+
Facturx::TermDeclarations::Declaration.term(
|
|
78
|
+
'BT-147', :line, :gross_price, 'BG-29',
|
|
79
|
+
'/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem' \
|
|
80
|
+
'/ram:SpecifiedLineTradeAgreement/ram:GrossPriceProductTradePrice/ram:AppliedTradeAllowanceCharge' \
|
|
81
|
+
'/ram:ActualAmount',
|
|
82
|
+
:decimal, nil,
|
|
83
|
+
basic: '0..1',
|
|
84
|
+
en16931: '0..1',
|
|
85
|
+
extended: '0..1'
|
|
86
|
+
),
|
|
87
|
+
Facturx::TermDeclarations::Declaration.term(
|
|
88
|
+
'BT-146', :line, :net_price, 'BG-29',
|
|
89
|
+
'/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem' \
|
|
90
|
+
'/ram:SpecifiedLineTradeAgreement/ram:NetPriceProductTradePrice/ram:ChargeAmount',
|
|
91
|
+
:decimal, nil,
|
|
92
|
+
basic: '1..1',
|
|
93
|
+
en16931: '1..1',
|
|
94
|
+
extended: '1..1'
|
|
95
|
+
),
|
|
96
|
+
Facturx::TermDeclarations::Declaration.term(
|
|
97
|
+
'BT-149', :line, :net_price, 'BG-29',
|
|
98
|
+
'/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem' \
|
|
99
|
+
'/ram:SpecifiedLineTradeAgreement/ram:NetPriceProductTradePrice/ram:BasisQuantity',
|
|
100
|
+
:decimal, nil,
|
|
101
|
+
basic: '0..1',
|
|
102
|
+
en16931: '0..1',
|
|
103
|
+
extended: '0..1'
|
|
104
|
+
),
|
|
105
|
+
Facturx::TermDeclarations::Declaration.term(
|
|
106
|
+
'BT-150', :line, :net_price, 'BG-29',
|
|
107
|
+
'/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem' \
|
|
108
|
+
'/ram:SpecifiedLineTradeAgreement/ram:NetPriceProductTradePrice/ram:BasisQuantity/@unitCode',
|
|
109
|
+
:string, nil,
|
|
110
|
+
basic: '0..1',
|
|
111
|
+
en16931: '0..1',
|
|
112
|
+
extended: '0..1'
|
|
113
|
+
),
|
|
114
|
+
Facturx::TermDeclarations::Declaration.term(
|
|
115
|
+
'BT-129', :line, :quantity, 'BG-25',
|
|
116
|
+
'/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem' \
|
|
117
|
+
'/ram:SpecifiedLineTradeDelivery/ram:BilledQuantity',
|
|
118
|
+
:decimal, nil,
|
|
119
|
+
basic: '1..1',
|
|
120
|
+
en16931: '1..1',
|
|
121
|
+
extended: '1..1'
|
|
122
|
+
),
|
|
123
|
+
Facturx::TermDeclarations::Declaration.term(
|
|
124
|
+
'BT-130', :line, :quantity, 'BG-25',
|
|
125
|
+
'/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem' \
|
|
126
|
+
'/ram:SpecifiedLineTradeDelivery/ram:BilledQuantity/@unitCode',
|
|
127
|
+
:string, nil,
|
|
128
|
+
basic: '1..1',
|
|
129
|
+
en16931: '1..1',
|
|
130
|
+
extended: '1..1'
|
|
131
|
+
),
|
|
132
|
+
Facturx::TermDeclarations::Declaration.term(
|
|
133
|
+
'BT-131', :line, :net_amount, 'BG-25',
|
|
134
|
+
'/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem' \
|
|
135
|
+
'/ram:SpecifiedLineTradeSettlement/ram:SpecifiedTradeSettlementLineMonetarySummation' \
|
|
136
|
+
'/ram:LineTotalAmount',
|
|
137
|
+
:decimal, 2,
|
|
138
|
+
basic: '1..1',
|
|
139
|
+
en16931: '1..1',
|
|
140
|
+
extended: '1..1'
|
|
141
|
+
),
|
|
142
|
+
Facturx::TermDeclarations::Declaration.term(
|
|
143
|
+
'BT-128', :line, :invoiced_object_identifier, 'BG-25',
|
|
144
|
+
'/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem' \
|
|
145
|
+
'/ram:SpecifiedLineTradeSettlement/ram:AdditionalReferencedDocument/ram:IssuerAssignedID',
|
|
146
|
+
:string, nil,
|
|
147
|
+
en16931: '0..1',
|
|
148
|
+
extended: '0..1'
|
|
149
|
+
),
|
|
150
|
+
Facturx::TermDeclarations::Declaration.term(
|
|
151
|
+
'BT-128-1', :line, :invoiced_object_identifier, 'BG-25',
|
|
152
|
+
'/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem' \
|
|
153
|
+
'/ram:SpecifiedLineTradeSettlement/ram:AdditionalReferencedDocument/ram:ReferenceTypeCode',
|
|
154
|
+
:string, nil,
|
|
155
|
+
en16931: '0..1',
|
|
156
|
+
extended: '0..1'
|
|
157
|
+
),
|
|
158
|
+
Facturx::TermDeclarations::Declaration.term(
|
|
159
|
+
'BT-133', :line, :buyer_accounting_reference, 'BG-25',
|
|
160
|
+
'/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem' \
|
|
161
|
+
'/ram:SpecifiedLineTradeSettlement/ram:ReceivableSpecifiedTradeAccountingAccount/ram:ID',
|
|
162
|
+
:string, nil,
|
|
163
|
+
en16931: '0..1',
|
|
164
|
+
extended: '0..1'
|
|
165
|
+
)
|
|
166
|
+
].freeze
|