fortnox-api 1.0.0.rc15 → 1.0.0.rc16
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 +19 -1
- data/lib/fortnox/types/housework.rb +57 -0
- data/lib/fortnox/types.rb +1 -12
- data/lib/fortnox/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7350800553373489f35a73af7206ae013a6004024b53db948e2778e85c0f61b5
|
|
4
|
+
data.tar.gz: 359f4b9fb46a0b17aa67180b977021a9bcab6653a722043df93954ccc68b470d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c9f62481c8990889206483a455a6f8b6c11060c4f60aad75c8ebbe97825efa5747f7176506a1de69e66df0d0d56592b35d713154a4a033176da5646bc8c7aa2d
|
|
7
|
+
data.tar.gz: a2e684f757d98304b7ed7e08c167900abaecb027fb31b291b59d1fe57c5cc0f89753e3d0110d9f8cd01c90ce36964c09c28d7b85b8474ea9758507366e647672
|
data/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,23 @@ and this project adheres to
|
|
|
8
8
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
|
+
## [1.0.0.rc16] - 2026-08-19
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **Housework types grouped by tax reduction type.**
|
|
16
|
+
`Fortnox::Types::HOUSEWORK_TYPES_BY_TAX_REDUCTION` maps `'rot'`, `'rut'`
|
|
17
|
+
and `'green'` to the housework types a document of that type may carry,
|
|
18
|
+
with `ROT_HOUSEWORK_TYPES`, `RUT_HOUSEWORK_TYPES`, `GREEN_HOUSEWORK_TYPES`
|
|
19
|
+
and `ANY_TAX_REDUCTION_HOUSEWORK_TYPES` available individually. Fortnox
|
|
20
|
+
enforces the grouping — a document declaring one reduction type is
|
|
21
|
+
rejected outright if it carries a row from another ("Dokument med
|
|
22
|
+
skattereduktionstypen 'rut' får inte innehålla rader med ...") — but the
|
|
23
|
+
gem previously exposed only the flat `CURRENT_HOUSEWORK_TYPES`, leaving
|
|
24
|
+
every consumer to hard-code the split in order to build a UI that cannot
|
|
25
|
+
produce an unsaveable document. `OTHERCOSTS` and `EMPTYHOUSEWORK` mark a
|
|
26
|
+
row as not being housework and appear under every reduction type.
|
|
27
|
+
|
|
11
28
|
## [1.0.0.rc15] - 2026-08-18
|
|
12
29
|
|
|
13
30
|
### Fixed
|
|
@@ -419,7 +436,8 @@ for the full list of breaking changes.
|
|
|
419
436
|
For changes prior to the 1.0 rewrite, see the
|
|
420
437
|
[0.x changelog](https://github.com/accodeing/fortnox-api/blob/v0.9.2/CHANGELOG.md).
|
|
421
438
|
|
|
422
|
-
[Unreleased]: https://github.com/accodeing/fortnox-api/compare/v1.0.0.
|
|
439
|
+
[Unreleased]: https://github.com/accodeing/fortnox-api/compare/v1.0.0.rc16...HEAD
|
|
440
|
+
[1.0.0.rc16]: https://github.com/accodeing/fortnox-api/compare/v1.0.0.rc15...v1.0.0.rc16
|
|
423
441
|
[1.0.0.rc15]: https://github.com/accodeing/fortnox-api/compare/v1.0.0.rc14...v1.0.0.rc15
|
|
424
442
|
[1.0.0.rc14]: https://github.com/accodeing/fortnox-api/compare/v1.0.0.rc13...v1.0.0.rc14
|
|
425
443
|
[1.0.0.rc13]: https://github.com/accodeing/fortnox-api/compare/v1.0.0.rc12...v1.0.0.rc13
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Fortnox
|
|
4
|
+
module Types
|
|
5
|
+
# The housework (ROT/RUT/green) categories a document row can carry.
|
|
6
|
+
#
|
|
7
|
+
# Should be included in Fortnox::Types, so every constant here is also reachable
|
|
8
|
+
# as `Fortnox::Types::CURRENT_HOUSEWORK_TYPES` and friends.
|
|
9
|
+
module Housework
|
|
10
|
+
# Which tax reduction each housework type belongs to. Fortnox enforces
|
|
11
|
+
# this: a document declaring one reduction type is rejected outright if
|
|
12
|
+
# it carries a row from another, with "Dokument med
|
|
13
|
+
# skattereduktionstypen 'rut' får inte innehålla rader med ...".
|
|
14
|
+
# Consumers building a UI need the grouping to keep users from
|
|
15
|
+
# assembling a document that cannot be saved.
|
|
16
|
+
ROT_HOUSEWORK_TYPES = [
|
|
17
|
+
'CONSTRUCTION', 'ELECTRICITY', 'GLASSMETALWORK', 'GROUNDDRAINAGEWORK',
|
|
18
|
+
'MASONRY', 'PAINTINGWALLPAPERING', 'HVAC'
|
|
19
|
+
].freeze
|
|
20
|
+
|
|
21
|
+
RUT_HOUSEWORK_TYPES = [
|
|
22
|
+
'MAJORAPPLIANCEREPAIR', 'MOVINGSERVICES', 'ITSERVICES', 'CLEANING',
|
|
23
|
+
'TEXTILECLOTHING', 'SNOWPLOWING', 'GARDENING', 'BABYSITTING',
|
|
24
|
+
'OTHERCARE', 'FURNISHING', 'HOMEMAINTENANCE', 'TRANSPORTATIONSERVICES',
|
|
25
|
+
'WASHINGANDCAREOFCLOTHING'
|
|
26
|
+
].freeze
|
|
27
|
+
|
|
28
|
+
GREEN_HOUSEWORK_TYPES = [
|
|
29
|
+
'SOLARCELLS', 'STORAGESELFPRODUCEDELECTRICITY',
|
|
30
|
+
'CHARGINGSTATIONELECTRICVEHICLE'
|
|
31
|
+
].freeze
|
|
32
|
+
|
|
33
|
+
# Accepted under any tax reduction type. Both mark a row as not being
|
|
34
|
+
# housework and must be sent with `housework` false.
|
|
35
|
+
ANY_TAX_REDUCTION_HOUSEWORK_TYPES = ['OTHERCOSTS', 'EMPTYHOUSEWORK'].freeze
|
|
36
|
+
|
|
37
|
+
# Every type Fortnox still accepts on a new document — the groups above
|
|
38
|
+
# are the definition, this is only their sum. Anything added to a group
|
|
39
|
+
# lands here, and in the HouseworkTypes enum, on its own.
|
|
40
|
+
CURRENT_HOUSEWORK_TYPES = (
|
|
41
|
+
ROT_HOUSEWORK_TYPES + RUT_HOUSEWORK_TYPES + GREEN_HOUSEWORK_TYPES +
|
|
42
|
+
ANY_TAX_REDUCTION_HOUSEWORK_TYPES
|
|
43
|
+
).freeze
|
|
44
|
+
|
|
45
|
+
# Fortnox no longer grants a reduction for these, but old documents
|
|
46
|
+
# still come back carrying them, so the enum has to accept them.
|
|
47
|
+
LEGACY_HOUSEWORK_TYPES = ['COOKING', 'TUTORING'].freeze
|
|
48
|
+
|
|
49
|
+
# The types a document may carry, keyed by its tax reduction type.
|
|
50
|
+
HOUSEWORK_TYPES_BY_TAX_REDUCTION = {
|
|
51
|
+
'rot' => (ROT_HOUSEWORK_TYPES + ANY_TAX_REDUCTION_HOUSEWORK_TYPES).freeze,
|
|
52
|
+
'rut' => (RUT_HOUSEWORK_TYPES + ANY_TAX_REDUCTION_HOUSEWORK_TYPES).freeze,
|
|
53
|
+
'green' => (GREEN_HOUSEWORK_TYPES + ANY_TAX_REDUCTION_HOUSEWORK_TYPES).freeze
|
|
54
|
+
}.freeze
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
data/lib/fortnox/types.rb
CHANGED
|
@@ -6,6 +6,7 @@ require 'dry-types'
|
|
|
6
6
|
module Fortnox
|
|
7
7
|
module Types
|
|
8
8
|
include Dry.Types()
|
|
9
|
+
include Housework
|
|
9
10
|
|
|
10
11
|
# Booleans reach us as strings whenever the caller is a Rails app passing
|
|
11
12
|
# controller params through. Resource attributes already coerce those:
|
|
@@ -23,18 +24,6 @@ module Fortnox
|
|
|
23
24
|
'AMOUNT', 'PERCENT'
|
|
24
25
|
)
|
|
25
26
|
|
|
26
|
-
CURRENT_HOUSEWORK_TYPES = [
|
|
27
|
-
'CONSTRUCTION', 'ELECTRICITY', 'GLASSMETALWORK', 'GROUNDDRAINAGEWORK',
|
|
28
|
-
'MASONRY', 'PAINTINGWALLPAPERING', 'HVAC', 'MAJORAPPLIANCEREPAIR',
|
|
29
|
-
'MOVINGSERVICES', 'ITSERVICES', 'CLEANING', 'TEXTILECLOTHING',
|
|
30
|
-
'SNOWPLOWING', 'GARDENING', 'BABYSITTING', 'OTHERCARE', 'OTHERCOSTS',
|
|
31
|
-
'FURNISHING', 'HOMEMAINTENANCE', 'TRANSPORTATIONSERVICES',
|
|
32
|
-
'WASHINGANDCAREOFCLOTHING', 'SOLARCELLS', 'STORAGESELFPRODUCEDELECTRICITY',
|
|
33
|
-
'CHARGINGSTATIONELECTRICVEHICLE', 'EMPTYHOUSEWORK'
|
|
34
|
-
].freeze
|
|
35
|
-
|
|
36
|
-
LEGACY_HOUSEWORK_TYPES = ['COOKING', 'TUTORING'].freeze
|
|
37
|
-
|
|
38
27
|
HouseworkTypes = Types::Strict::String.enum(
|
|
39
28
|
*(CURRENT_HOUSEWORK_TYPES + LEGACY_HOUSEWORK_TYPES)
|
|
40
29
|
)
|
data/lib/fortnox/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fortnox-api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.0.
|
|
4
|
+
version: 1.0.0.rc16
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jonas Schubert Erlandsson
|
|
@@ -11,7 +11,7 @@ authors:
|
|
|
11
11
|
autorequire:
|
|
12
12
|
bindir: bin
|
|
13
13
|
cert_chain: []
|
|
14
|
-
date: 2026-08-
|
|
14
|
+
date: 2026-08-19 00:00:00.000000000 Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: base64
|
|
@@ -120,6 +120,7 @@ files:
|
|
|
120
120
|
- lib/fortnox/structs/invoice_row.rb
|
|
121
121
|
- lib/fortnox/structs/order_row.rb
|
|
122
122
|
- lib/fortnox/types.rb
|
|
123
|
+
- lib/fortnox/types/housework.rb
|
|
123
124
|
- lib/fortnox/version.rb
|
|
124
125
|
homepage: https://github.com/accodeing/fortnox
|
|
125
126
|
licenses:
|