gobl 0.9.0 → 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -13
- data/data/regimes/co.json +55 -1
- data/data/regimes/es.json +570 -64
- data/data/regimes/it.json +1182 -0
- data/lib/{gobl → generated/gobl}/bill/charge.rb +1 -1
- data/lib/{gobl → generated/gobl}/bill/delivery.rb +1 -1
- data/lib/{gobl → generated/gobl}/bill/discount.rb +1 -1
- data/lib/{gobl → generated/gobl}/bill/document_reference.rb +1 -1
- data/lib/{gobl → generated/gobl}/bill/invoice.rb +19 -8
- data/lib/{gobl → generated/gobl}/bill/line.rb +3 -3
- data/lib/{gobl → generated/gobl}/bill/line_charge.rb +1 -1
- data/lib/{gobl → generated/gobl}/bill/line_discount.rb +1 -1
- data/lib/{gobl → generated/gobl}/bill/ordering.rb +1 -1
- data/lib/{gobl → generated/gobl}/bill/outlay.rb +3 -3
- data/lib/{gobl → generated/gobl}/bill/payment.rb +1 -1
- data/lib/{gobl → generated/gobl}/bill/preceding.rb +23 -23
- data/lib/{gobl → generated/gobl}/bill/tax.rb +4 -4
- data/lib/{gobl → generated/gobl}/bill/totals.rb +5 -5
- data/lib/{gobl → generated/gobl}/cal/date.rb +2 -2
- data/lib/{gobl → generated/gobl}/cal/period.rb +3 -3
- data/lib/{gobl → generated/gobl}/cbc/code.rb +3 -3
- data/lib/{gobl → generated/gobl}/cbc/key.rb +2 -2
- data/lib/{gobl → generated/gobl}/cbc/meta.rb +1 -1
- data/lib/{gobl → generated/gobl}/cbc/note.rb +6 -6
- data/lib/{gobl → generated/gobl}/cbc/stamp.rb +3 -3
- data/lib/{gobl → generated/gobl}/currency/code.rb +7 -4
- data/lib/{gobl → generated/gobl}/currency/exchange_rate.rb +3 -3
- data/lib/generated/gobl/document.rb +16 -0
- data/lib/{gobl → generated/gobl}/dsig/digest.rb +3 -3
- data/lib/{gobl → generated/gobl}/dsig/signature.rb +2 -2
- data/lib/{gobl → generated/gobl}/envelope.rb +5 -5
- data/lib/{gobl → generated/gobl}/header.rb +4 -4
- data/lib/{gobl → generated/gobl}/i18n/string.rb +1 -1
- data/lib/{gobl → generated/gobl}/l10n/code.rb +2 -2
- data/lib/{gobl → generated/gobl}/l10n/country_code.rb +7 -4
- data/lib/{gobl → generated/gobl}/note/message.rb +4 -4
- data/lib/{gobl → generated/gobl}/org/address.rb +2 -2
- data/lib/{gobl → generated/gobl}/org/coordinates.rb +1 -1
- data/lib/{gobl → generated/gobl}/org/email.rb +2 -2
- data/lib/generated/gobl/org/identity.rb +38 -0
- data/lib/{gobl → generated/gobl}/org/image.rb +1 -1
- data/lib/{gobl → generated/gobl}/org/inbox.rb +3 -3
- data/lib/{gobl → generated/gobl}/org/item.rb +10 -10
- data/lib/{gobl → generated/gobl}/org/name.rb +3 -3
- data/lib/{gobl → generated/gobl}/org/party.rb +7 -7
- data/lib/{gobl → generated/gobl}/org/person.rb +2 -7
- data/lib/{gobl → generated/gobl}/org/registration.rb +1 -1
- data/lib/{gobl → generated/gobl}/org/telephone.rb +2 -2
- data/lib/{gobl → generated/gobl}/org/unit.rb +8 -3
- data/lib/{gobl → generated/gobl}/org/website.rb +2 -2
- data/lib/{gobl → generated/gobl}/pay/advance.rb +3 -3
- data/lib/{gobl → generated/gobl}/pay/card.rb +3 -3
- data/lib/{gobl → generated/gobl}/pay/credit_transfer.rb +1 -1
- data/lib/{gobl → generated/gobl}/pay/direct_debit.rb +1 -1
- data/lib/{gobl → generated/gobl}/pay/due_date.rb +3 -3
- data/lib/{gobl → generated/gobl}/pay/instructions.rb +19 -4
- data/lib/{gobl → generated/gobl}/pay/online.rb +2 -2
- data/lib/{gobl → generated/gobl}/pay/terms.rb +19 -4
- data/lib/{gobl → generated/gobl}/tax/category.rb +14 -4
- data/lib/{gobl → generated/gobl}/tax/category_total.rb +5 -5
- data/lib/{gobl → generated/gobl}/tax/combo.rb +7 -2
- data/lib/{gobl → generated/gobl}/tax/identity.rb +16 -6
- data/lib/generated/gobl/tax/key_definition.rb +38 -0
- data/lib/generated/gobl/tax/preceding_definitions.rb +27 -0
- data/lib/{gobl → generated/gobl}/tax/rate.rb +11 -4
- data/lib/{gobl → generated/gobl}/tax/rate_total.rb +4 -4
- data/lib/{gobl → generated/gobl}/tax/rate_total_surcharge.rb +3 -3
- data/lib/{gobl → generated/gobl}/tax/rate_value.rb +2 -2
- data/lib/{gobl → generated/gobl}/tax/regime.rb +19 -9
- data/lib/generated/gobl/tax/scenario.rb +37 -0
- data/lib/generated/gobl/tax/scenario_set.rb +29 -0
- data/lib/{gobl → generated/gobl}/tax/set.rb +1 -1
- data/lib/generated/gobl/tax/tag.rb +33 -0
- data/lib/{gobl → generated/gobl}/tax/total.rb +2 -2
- data/lib/{gobl → generated/gobl}/tax/zone.rb +2 -2
- data/lib/{gobl → generated/gobl}/uuid/uuid.rb +2 -2
- data/lib/gobl/enum.rb +8 -56
- data/lib/gobl/version.rb +1 -1
- data/lib/gobl.rb +1 -0
- metadata +75 -76
- data/lib/gobl/bill/invoice_type.rb +0 -30
- data/lib/gobl/cbc/note_key.rb +0 -48
- data/lib/gobl/document.rb +0 -13
- data/lib/gobl/org/item_code.rb +0 -28
- data/lib/gobl/pay/method_key.rb +0 -30
- data/lib/gobl/pay/term_key.rb +0 -33
- data/lib/gobl/tax/scheme.rb +0 -44
- data/lib/gobl/tax/source_key.rb +0 -28
- data/lib/gobl/value.rb +0 -77
@@ -3,7 +3,7 @@
|
|
3
3
|
##
|
4
4
|
## DO NOT EDIT - This file was generated automatically.
|
5
5
|
##
|
6
|
-
## Generated with GOBL v0.
|
6
|
+
## Generated with GOBL v0.38.0
|
7
7
|
##
|
8
8
|
|
9
9
|
module GOBL
|
@@ -16,12 +16,12 @@ module GOBL
|
|
16
16
|
# @!attribute [r] code
|
17
17
|
# @return [GOBL::CBC::Code]
|
18
18
|
property :code, GOBL::CBC::Code
|
19
|
-
|
19
|
+
validates_presence_of :code
|
20
20
|
|
21
21
|
# @!attribute [r] name
|
22
22
|
# @return [GOBL::I18n::String]
|
23
23
|
property :name, GOBL::I18n::String
|
24
|
-
|
24
|
+
validates_presence_of :name
|
25
25
|
|
26
26
|
# @!attribute [r] desc
|
27
27
|
# @return [GOBL::I18n::String]
|
@@ -36,7 +36,17 @@ module GOBL
|
|
36
36
|
# Specific tax definitions inside this category.
|
37
37
|
# @return [Array<Rate>]
|
38
38
|
property :rates, [Rate]
|
39
|
-
|
39
|
+
validates_presence_of :rates
|
40
|
+
|
41
|
+
# @!attribute [r] tags
|
42
|
+
# Tags contains a set of tag definitions that can be applied for this tax category.
|
43
|
+
# @return [Array<Tag>]
|
44
|
+
property :tags, [Tag]
|
45
|
+
|
46
|
+
# @!attribute [r] meta
|
47
|
+
# Meta contains additional information about the category that is relevant for local frequently used formats.
|
48
|
+
# @return [GOBL::CBC::Meta]
|
49
|
+
property :meta, GOBL::CBC::Meta
|
40
50
|
end
|
41
51
|
end
|
42
52
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
##
|
4
4
|
## DO NOT EDIT - This file was generated automatically.
|
5
5
|
##
|
6
|
-
## Generated with GOBL v0.
|
6
|
+
## Generated with GOBL v0.38.0
|
7
7
|
##
|
8
8
|
|
9
9
|
module GOBL
|
@@ -16,7 +16,7 @@ module GOBL
|
|
16
16
|
# @!attribute [r] code
|
17
17
|
# @return [GOBL::CBC::Code]
|
18
18
|
property :code, GOBL::CBC::Code
|
19
|
-
|
19
|
+
validates_presence_of :code
|
20
20
|
|
21
21
|
# @!attribute [r] retained
|
22
22
|
# @return [Boolean]
|
@@ -25,17 +25,17 @@ module GOBL
|
|
25
25
|
# @!attribute [r] rates
|
26
26
|
# @return [Array<RateTotal>]
|
27
27
|
property :rates, [RateTotal]
|
28
|
-
|
28
|
+
validates_presence_of :rates
|
29
29
|
|
30
30
|
# @!attribute [r] base
|
31
31
|
# @return [GOBL::Num::Amount]
|
32
32
|
property :base, GOBL::Num::Amount
|
33
|
-
|
33
|
+
validates_presence_of :base
|
34
34
|
|
35
35
|
# @!attribute [r] amount
|
36
36
|
# @return [GOBL::Num::Amount]
|
37
37
|
property :amount, GOBL::Num::Amount
|
38
|
-
|
38
|
+
validates_presence_of :amount
|
39
39
|
|
40
40
|
# @!attribute [r] surcharge
|
41
41
|
# @return [GOBL::Num::Amount]
|
@@ -3,7 +3,7 @@
|
|
3
3
|
##
|
4
4
|
## DO NOT EDIT - This file was generated automatically.
|
5
5
|
##
|
6
|
-
## Generated with GOBL v0.
|
6
|
+
## Generated with GOBL v0.38.0
|
7
7
|
##
|
8
8
|
|
9
9
|
module GOBL
|
@@ -17,7 +17,7 @@ module GOBL
|
|
17
17
|
# Tax category code from those available inside a region.
|
18
18
|
# @return [GOBL::CBC::Code]
|
19
19
|
property :cat, GOBL::CBC::Code
|
20
|
-
|
20
|
+
validates_presence_of :cat
|
21
21
|
|
22
22
|
# @!attribute [r] rate
|
23
23
|
# Rate within a category to apply.
|
@@ -33,6 +33,11 @@ module GOBL
|
|
33
33
|
# Some countries require an additional surcharge (calculated if rate present).
|
34
34
|
# @return [GOBL::Num::Percentage]
|
35
35
|
property :surcharge, GOBL::Num::Percentage
|
36
|
+
|
37
|
+
# @!attribute [r] tags
|
38
|
+
# Additional data may be required in some regimes, the tags property helps reference them.
|
39
|
+
# @return [Array<GOBL::CBC::Key>]
|
40
|
+
property :tags, [GOBL::CBC::Key]
|
36
41
|
end
|
37
42
|
end
|
38
43
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
##
|
4
4
|
## DO NOT EDIT - This file was generated automatically.
|
5
5
|
##
|
6
|
-
## Generated with GOBL v0.
|
6
|
+
## Generated with GOBL v0.38.0
|
7
7
|
##
|
8
8
|
|
9
9
|
module GOBL
|
@@ -22,22 +22,32 @@ module GOBL
|
|
22
22
|
# ISO country code for Where the tax identity was issued.
|
23
23
|
# @return [GOBL::L10n::CountryCode]
|
24
24
|
property :country, GOBL::L10n::CountryCode
|
25
|
-
|
25
|
+
validates_presence_of :country
|
26
26
|
|
27
27
|
# @!attribute [r] zone
|
28
28
|
# Where inside the country the tax identity holder is based for tax purposes like a village, town, district, city, county, state or province. For some areas, this could be a regular post or zip code. See the regime packages for specific validation rules.
|
29
29
|
# @return [GOBL::L10n::Code]
|
30
30
|
property :zone, GOBL::L10n::Code
|
31
31
|
|
32
|
+
# Enumeration of possible values for {#source} with their corresponding descriptions
|
33
|
+
SOURCE_ENUM = {
|
34
|
+
'tax-agency' => 'Sourced directly from a tax agency',
|
35
|
+
'passport' => 'A passport document',
|
36
|
+
'national' => 'National ID Card or similar',
|
37
|
+
'permit' => 'Residential or similar permit',
|
38
|
+
'other' => 'An other type of source not listed'
|
39
|
+
}.freeze
|
40
|
+
|
32
41
|
# @!attribute [r] source
|
33
42
|
# What is the source document of the tax identity.
|
34
|
-
# @return [
|
35
|
-
property :source,
|
43
|
+
# @return [GOBL::CBC::Key]
|
44
|
+
property :source, GOBL::CBC::Key
|
45
|
+
validates_inclusion_of :source, in: SOURCE_ENUM.keys, allow_blank: true
|
36
46
|
|
37
47
|
# @!attribute [r] code
|
38
48
|
# Normalized code shown on the original identity document.
|
39
|
-
# @return [
|
40
|
-
property :code,
|
49
|
+
# @return [GOBL::CBC::Code]
|
50
|
+
property :code, GOBL::CBC::Code
|
41
51
|
|
42
52
|
# @!attribute [r] meta
|
43
53
|
# Additional details that may be required.
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
##
|
4
|
+
## DO NOT EDIT - This file was generated automatically.
|
5
|
+
##
|
6
|
+
## Generated with GOBL v0.38.0
|
7
|
+
##
|
8
|
+
|
9
|
+
module GOBL
|
10
|
+
module Tax
|
11
|
+
# KeyDefinition defines properties of a key that is specific for a regime.
|
12
|
+
class KeyDefinition < GOBL::Object
|
13
|
+
# The Schema ID of the GOBL KeyDefinition structure
|
14
|
+
SCHEMA_ID = 'https://gobl.org/draft-0/tax/regime#/$defs/KeyDefinition'
|
15
|
+
|
16
|
+
# @!attribute [r] key
|
17
|
+
# Actual key value.
|
18
|
+
# @return [GOBL::CBC::Key]
|
19
|
+
property :key, GOBL::CBC::Key
|
20
|
+
validates_presence_of :key
|
21
|
+
|
22
|
+
# @!attribute [r] name
|
23
|
+
# Short name for the key, if relevant.
|
24
|
+
# @return [GOBL::I18n::String]
|
25
|
+
property :name, GOBL::I18n::String
|
26
|
+
|
27
|
+
# @!attribute [r] desc
|
28
|
+
# Description offering more details about when the key should be used.
|
29
|
+
# @return [GOBL::I18n::String]
|
30
|
+
property :desc, GOBL::I18n::String
|
31
|
+
|
32
|
+
# @!attribute [r] meta
|
33
|
+
# Any additional data that might be relevant in some regimes?
|
34
|
+
# @return [GOBL::CBC::Meta]
|
35
|
+
property :meta, GOBL::CBC::Meta
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
##
|
4
|
+
## DO NOT EDIT - This file was generated automatically.
|
5
|
+
##
|
6
|
+
## Generated with GOBL v0.38.0
|
7
|
+
##
|
8
|
+
|
9
|
+
module GOBL
|
10
|
+
module Tax
|
11
|
+
# PrecedingDefinitions contains details about what can be defined in Invoice preceding document data.
|
12
|
+
class PrecedingDefinitions < GOBL::Object
|
13
|
+
# The Schema ID of the GOBL PrecedingDefinitions structure
|
14
|
+
SCHEMA_ID = 'https://gobl.org/draft-0/tax/regime#/$defs/PrecedingDefinitions'
|
15
|
+
|
16
|
+
# @!attribute [r] corrections
|
17
|
+
# Corrections contains a list of all the keys that can be used to identify a correction.
|
18
|
+
# @return [Array<KeyDefinition>]
|
19
|
+
property :corrections, [KeyDefinition]
|
20
|
+
|
21
|
+
# @!attribute [r] correction_methods
|
22
|
+
# CorrectionMethods describe the methods used to correct an invoice.
|
23
|
+
# @return [Array<KeyDefinition>]
|
24
|
+
property :correction_methods, [KeyDefinition]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
##
|
4
4
|
## DO NOT EDIT - This file was generated automatically.
|
5
5
|
##
|
6
|
-
## Generated with GOBL v0.
|
6
|
+
## Generated with GOBL v0.38.0
|
7
7
|
##
|
8
8
|
|
9
9
|
module GOBL
|
@@ -17,14 +17,16 @@ module GOBL
|
|
17
17
|
# Key identifies this rate within the system
|
18
18
|
# @return [GOBL::CBC::Key]
|
19
19
|
property :key, GOBL::CBC::Key
|
20
|
-
|
20
|
+
validates_presence_of :key
|
21
21
|
|
22
22
|
# @!attribute [r] name
|
23
|
+
# Human name of the rate
|
23
24
|
# @return [GOBL::I18n::String]
|
24
25
|
property :name, GOBL::I18n::String
|
25
|
-
|
26
|
+
validates_presence_of :name
|
26
27
|
|
27
28
|
# @!attribute [r] desc
|
29
|
+
# Useful description of the rate.
|
28
30
|
# @return [GOBL::I18n::String]
|
29
31
|
property :desc, GOBL::I18n::String
|
30
32
|
|
@@ -32,7 +34,12 @@ module GOBL
|
|
32
34
|
# Values contains a list of Value objects that contain the current and historical percentage values for the rate and additional filters. Order is important, newer values should come before older values.
|
33
35
|
# @return [Array<RateValue>]
|
34
36
|
property :values, [RateValue]
|
35
|
-
|
37
|
+
validates_presence_of :values
|
38
|
+
|
39
|
+
# @!attribute [r] meta
|
40
|
+
# Meta contains additional information about the rate that is relevant for local frequently used implementations.
|
41
|
+
# @return [GOBL::CBC::Meta]
|
42
|
+
property :meta, GOBL::CBC::Meta
|
36
43
|
end
|
37
44
|
end
|
38
45
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
##
|
4
4
|
## DO NOT EDIT - This file was generated automatically.
|
5
5
|
##
|
6
|
-
## Generated with GOBL v0.
|
6
|
+
## Generated with GOBL v0.38.0
|
7
7
|
##
|
8
8
|
|
9
9
|
module GOBL
|
@@ -20,18 +20,18 @@ module GOBL
|
|
20
20
|
# @!attribute [r] base
|
21
21
|
# @return [GOBL::Num::Amount]
|
22
22
|
property :base, GOBL::Num::Amount
|
23
|
-
|
23
|
+
validates_presence_of :base
|
24
24
|
|
25
25
|
# @!attribute [r] percent
|
26
26
|
# @return [GOBL::Num::Percentage]
|
27
27
|
property :percent, GOBL::Num::Percentage
|
28
|
-
|
28
|
+
validates_presence_of :percent
|
29
29
|
|
30
30
|
# @!attribute [r] amount
|
31
31
|
# Total amount of rate, excluding surcharges
|
32
32
|
# @return [GOBL::Num::Amount]
|
33
33
|
property :amount, GOBL::Num::Amount
|
34
|
-
|
34
|
+
validates_presence_of :amount
|
35
35
|
|
36
36
|
# @!attribute [r] surcharge
|
37
37
|
# @return [RateTotalSurcharge]
|
@@ -3,7 +3,7 @@
|
|
3
3
|
##
|
4
4
|
## DO NOT EDIT - This file was generated automatically.
|
5
5
|
##
|
6
|
-
## Generated with GOBL v0.
|
6
|
+
## Generated with GOBL v0.38.0
|
7
7
|
##
|
8
8
|
|
9
9
|
module GOBL
|
@@ -16,12 +16,12 @@ module GOBL
|
|
16
16
|
# @!attribute [r] percent
|
17
17
|
# @return [GOBL::Num::Percentage]
|
18
18
|
property :percent, GOBL::Num::Percentage
|
19
|
-
|
19
|
+
validates_presence_of :percent
|
20
20
|
|
21
21
|
# @!attribute [r] amount
|
22
22
|
# @return [GOBL::Num::Amount]
|
23
23
|
property :amount, GOBL::Num::Amount
|
24
|
-
|
24
|
+
validates_presence_of :amount
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
##
|
4
4
|
## DO NOT EDIT - This file was generated automatically.
|
5
5
|
##
|
6
|
-
## Generated with GOBL v0.
|
6
|
+
## Generated with GOBL v0.38.0
|
7
7
|
##
|
8
8
|
|
9
9
|
module GOBL
|
@@ -27,7 +27,7 @@ module GOBL
|
|
27
27
|
# Percent rate that should be applied
|
28
28
|
# @return [GOBL::Num::Percentage]
|
29
29
|
property :percent, GOBL::Num::Percentage
|
30
|
-
|
30
|
+
validates_presence_of :percent
|
31
31
|
|
32
32
|
# @!attribute [r] surcharge
|
33
33
|
# An additional surcharge to apply.
|
@@ -3,7 +3,7 @@
|
|
3
3
|
##
|
4
4
|
## DO NOT EDIT - This file was generated automatically.
|
5
5
|
##
|
6
|
-
## Generated with GOBL v0.
|
6
|
+
## Generated with GOBL v0.38.0
|
7
7
|
##
|
8
8
|
|
9
9
|
module GOBL
|
@@ -17,13 +17,13 @@ module GOBL
|
|
17
17
|
# Name of the country
|
18
18
|
# @return [GOBL::I18n::String]
|
19
19
|
property :name, GOBL::I18n::String
|
20
|
-
|
20
|
+
validates_presence_of :name
|
21
21
|
|
22
22
|
# @!attribute [r] country
|
23
23
|
# Country code for the region
|
24
24
|
# @return [GOBL::L10n::CountryCode]
|
25
25
|
property :country, GOBL::L10n::CountryCode
|
26
|
-
|
26
|
+
validates_presence_of :country
|
27
27
|
|
28
28
|
# @!attribute [r] zone
|
29
29
|
# Specific Locality, region, city, province, county, or similar code inside the country, if needed.
|
@@ -39,18 +39,28 @@ module GOBL
|
|
39
39
|
# Currency used by the country.
|
40
40
|
# @return [GOBL::Currency::Code]
|
41
41
|
property :currency, GOBL::Currency::Code
|
42
|
-
|
42
|
+
validates_presence_of :currency
|
43
43
|
|
44
|
-
# @!attribute [r]
|
45
|
-
#
|
46
|
-
# @return [Array<
|
47
|
-
property :
|
44
|
+
# @!attribute [r] tags
|
45
|
+
# Tags that can be applied at the document level to identify additional considerations.
|
46
|
+
# @return [Array<Tag>]
|
47
|
+
property :tags, [Tag]
|
48
|
+
|
49
|
+
# @!attribute [r] scenarios
|
50
|
+
# Sets of scenario definitions for the regime.
|
51
|
+
# @return [Array<ScenarioSet>]
|
52
|
+
property :scenarios, [ScenarioSet]
|
53
|
+
|
54
|
+
# @!attribute [r] preceding
|
55
|
+
# Configuration details for preceding options.
|
56
|
+
# @return [PrecedingDefinitions]
|
57
|
+
property :preceding, PrecedingDefinitions
|
48
58
|
|
49
59
|
# @!attribute [r] categories
|
50
60
|
# List of tax categories.
|
51
61
|
# @return [Array<Category>]
|
52
62
|
property :categories, [Category]
|
53
|
-
|
63
|
+
validates_presence_of :categories
|
54
64
|
end
|
55
65
|
end
|
56
66
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
##
|
4
|
+
## DO NOT EDIT - This file was generated automatically.
|
5
|
+
##
|
6
|
+
## Generated with GOBL v0.38.0
|
7
|
+
##
|
8
|
+
|
9
|
+
module GOBL
|
10
|
+
module Tax
|
11
|
+
# Scenario is used to describe a tax scenario of a document based on the combination of document type and tag used.
|
12
|
+
class Scenario < GOBL::Object
|
13
|
+
# The Schema ID of the GOBL Scenario structure
|
14
|
+
SCHEMA_ID = 'https://gobl.org/draft-0/tax/regime#/$defs/Scenario'
|
15
|
+
|
16
|
+
# @!attribute [r] type
|
17
|
+
# Type of document, if present.
|
18
|
+
# @return [Array<GOBL::CBC::Key>]
|
19
|
+
property :type, [GOBL::CBC::Key]
|
20
|
+
|
21
|
+
# @!attribute [r] tags
|
22
|
+
# Tag that was applied to the document
|
23
|
+
# @return [Array<GOBL::CBC::Key>]
|
24
|
+
property :tags, [GOBL::CBC::Key]
|
25
|
+
|
26
|
+
# @!attribute [r] note
|
27
|
+
# A note to be added to the document if the scenario is applied.
|
28
|
+
# @return [GOBL::CBC::Note]
|
29
|
+
property :note, GOBL::CBC::Note
|
30
|
+
|
31
|
+
# @!attribute [r] meta
|
32
|
+
# Any additional local meta data that may be useful in integrations.
|
33
|
+
# @return [GOBL::CBC::Meta]
|
34
|
+
property :meta, GOBL::CBC::Meta
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
##
|
4
|
+
## DO NOT EDIT - This file was generated automatically.
|
5
|
+
##
|
6
|
+
## Generated with GOBL v0.38.0
|
7
|
+
##
|
8
|
+
|
9
|
+
module GOBL
|
10
|
+
module Tax
|
11
|
+
# ScenarioSet is a collection of tax scenarios for a given schema that can be used to determine special codes or notes that need to be included in the final document.
|
12
|
+
class ScenarioSet < GOBL::Object
|
13
|
+
# The Schema ID of the GOBL ScenarioSet structure
|
14
|
+
SCHEMA_ID = 'https://gobl.org/draft-0/tax/regime#/$defs/ScenarioSet'
|
15
|
+
|
16
|
+
# @!attribute [r] schema
|
17
|
+
# Partial or complete schema URL for the document type
|
18
|
+
# @return [String]
|
19
|
+
property :schema, String
|
20
|
+
validates_presence_of :schema
|
21
|
+
|
22
|
+
# @!attribute [r] list
|
23
|
+
# List of scenarios for the schema
|
24
|
+
# @return [Array<Scenario>]
|
25
|
+
property :list, [Scenario]
|
26
|
+
validates_presence_of :list
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
##
|
4
|
+
## DO NOT EDIT - This file was generated automatically.
|
5
|
+
##
|
6
|
+
## Generated with GOBL v0.38.0
|
7
|
+
##
|
8
|
+
|
9
|
+
module GOBL
|
10
|
+
module Tax
|
11
|
+
# Tag describes a tax tag that can be used to identify additional requirements in an electronic invoice.
|
12
|
+
class Tag < GOBL::Object
|
13
|
+
# The Schema ID of the GOBL Tag structure
|
14
|
+
SCHEMA_ID = 'https://gobl.org/draft-0/tax/regime#/$defs/Tag'
|
15
|
+
|
16
|
+
# @!attribute [r] key
|
17
|
+
# Key used to identify the tag
|
18
|
+
# @return [GOBL::CBC::Key]
|
19
|
+
property :key, GOBL::CBC::Key
|
20
|
+
validates_presence_of :key
|
21
|
+
|
22
|
+
# @!attribute [r] name
|
23
|
+
# Name of this tag.
|
24
|
+
# @return [GOBL::I18n::String]
|
25
|
+
property :name, GOBL::I18n::String
|
26
|
+
|
27
|
+
# @!attribute [r] meta
|
28
|
+
# Additional local
|
29
|
+
# @return [GOBL::CBC::Meta]
|
30
|
+
property :meta, GOBL::CBC::Meta
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
##
|
4
4
|
## DO NOT EDIT - This file was generated automatically.
|
5
5
|
##
|
6
|
-
## Generated with GOBL v0.
|
6
|
+
## Generated with GOBL v0.38.0
|
7
7
|
##
|
8
8
|
|
9
9
|
module GOBL
|
@@ -22,7 +22,7 @@ module GOBL
|
|
22
22
|
# Total value of all the taxes applied.
|
23
23
|
# @return [GOBL::Num::Amount]
|
24
24
|
property :sum, GOBL::Num::Amount
|
25
|
-
|
25
|
+
validates_presence_of :sum
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
##
|
4
4
|
## DO NOT EDIT - This file was generated automatically.
|
5
5
|
##
|
6
|
-
## Generated with GOBL v0.
|
6
|
+
## Generated with GOBL v0.38.0
|
7
7
|
##
|
8
8
|
|
9
9
|
module GOBL
|
@@ -17,7 +17,7 @@ module GOBL
|
|
17
17
|
# Unique zone code.
|
18
18
|
# @return [GOBL::L10n::Code]
|
19
19
|
property :code, GOBL::L10n::Code
|
20
|
-
|
20
|
+
validates_presence_of :code
|
21
21
|
|
22
22
|
# @!attribute [r] name
|
23
23
|
# Name of the zone to be use if a locality or region is not applicable.
|
@@ -3,13 +3,13 @@
|
|
3
3
|
##
|
4
4
|
## DO NOT EDIT - This file was generated automatically.
|
5
5
|
##
|
6
|
-
## Generated with GOBL v0.
|
6
|
+
## Generated with GOBL v0.38.0
|
7
7
|
##
|
8
8
|
|
9
9
|
module GOBL
|
10
10
|
module UUID
|
11
11
|
# Universally Unique Identifier. We only recommend using versions 1 and 4 within GOBL.
|
12
|
-
class UUID <
|
12
|
+
class UUID < String
|
13
13
|
# The Schema ID of the GOBL UUID structure
|
14
14
|
SCHEMA_ID = 'https://gobl.org/draft-0/uuid/uuid'
|
15
15
|
end
|
data/lib/gobl/enum.rb
CHANGED
@@ -3,69 +3,21 @@
|
|
3
3
|
module GOBL
|
4
4
|
# Base class for single value structures in the GOBL schema that have a controlled set
|
5
5
|
# of values associated to them (i.e., an enumeration) that may constrain them
|
6
|
-
|
7
|
-
|
6
|
+
module Enum
|
7
|
+
def self.included(base)
|
8
|
+
base.include ActiveModel::Validations
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
#
|
12
|
-
# @param value [Symbol, String, #to_s] the value of the object
|
13
|
-
#
|
14
|
-
# @return [Enum] the enum value instance corresponding to the given value
|
15
|
-
def initialize(value)
|
16
|
-
if value.is_a? Symbol
|
17
|
-
self._value = value_from_sym(value) || value.to_s
|
18
|
-
else
|
19
|
-
super
|
10
|
+
base.class_eval do
|
11
|
+
validate :valid_enum_value, if: :strict_enum?
|
20
12
|
end
|
21
13
|
end
|
22
14
|
|
23
|
-
# Returns the description of the current enum value
|
24
|
-
#
|
25
|
-
# @return [String] the description of the current enum value
|
26
15
|
def description
|
27
|
-
self.class::ENUM.fetch(
|
16
|
+
self.class::ENUM.fetch(self, self)
|
28
17
|
end
|
29
18
|
|
30
|
-
|
31
|
-
|
32
|
-
# not (`false`)
|
33
|
-
def method_missing(method_name, *args, &block)
|
34
|
-
if (value = self.class.find_by_inquirer(method_name))
|
35
|
-
self == value
|
36
|
-
else
|
37
|
-
super
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
# @api private
|
42
|
-
def respond_to_missing?(method_name, include_private = false)
|
43
|
-
self.class.find_by_inquirer(method_name) || super
|
44
|
-
end
|
45
|
-
|
46
|
-
class << self
|
47
|
-
# Returns an array with all the enumerated objects of this type
|
48
|
-
#
|
49
|
-
# @return [Array<#{name}>] the array of enumerated objects
|
50
|
-
def all
|
51
|
-
self::ENUM.keys.map { |key| new(key) }
|
52
|
-
end
|
53
|
-
|
54
|
-
# @api private
|
55
|
-
def find_by_sym(sym)
|
56
|
-
all.find { |object| object.to_sym == sym }
|
57
|
-
end
|
58
|
-
|
59
|
-
# @api private
|
60
|
-
def find_by_inquirer(method_name)
|
61
|
-
method_name =~ /(.+)\?$/ && find_by_sym(Regexp.last_match(1).to_sym)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
private
|
66
|
-
|
67
|
-
def value_from_sym(sym)
|
68
|
-
self.class.find_by_sym(sym)&.to_s
|
19
|
+
def valid_enum_value
|
20
|
+
errors.add(:base, "Value \"#{self}\" is not within the allowed values of the enumeration") unless self.class::ENUM.key?(self)
|
69
21
|
end
|
70
22
|
end
|
71
23
|
end
|
data/lib/gobl/version.rb
CHANGED