@smartkomm/plexus-cli 0.1.283 → 0.1.284

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.
@@ -1 +1 @@
1
- 73782a31d65d911af686812692ca7f8e2659fd4e937d8ab2cc9d498fa82f6965
1
+ 1f4413ee845feb635bd8de186d7b139bd025b5c7e911d986ff0998aee2d06450
@@ -186,6 +186,7 @@ whole is the operator's (ask them; do not try).
186
186
  | [feedback/create-and-triage-feedback.md](references/feedback/create-and-triage-feedback.md) | Plattform | File platform feedback, assign it, list it, and file it as a GitHub issue with its screenshot. |
187
187
  | [feedback/manage-feedback-tags.md](references/feedback/manage-feedback-tags.md) | Plattform | Maintain the feedback tag catalogue and tag many items at once. |
188
188
  | [feedback/work-a-feedback-item.md](references/feedback/work-a-feedback-item.md) | Plattform | Reply to a feedback item, set its status and deadline, link items, move it to another tenant, sync GitHub state. |
189
+ | [finance/import-paper-contracts.md](references/finance/import-paper-contracts.md) | Mandant | Import signed paper contracts from contract twins (plan, then apply). |
189
190
  | [finance/change-contract-grant.md](references/finance/change-contract-grant.md) | Mandant | Change a running contract's grants or reductions from a month on. |
190
191
  | [leads/list-leads.md](references/leads/list-leads.md) | Mandant | List a tenant's prospects. |
191
192
  | [learning-groups/import-classes-from-csv.md](references/learning-groups/import-classes-from-csv.md) | Mandant | Import a school's classes from a class list (CSV + mapping file) as learning groups of a school year. |
@@ -1,7 +1,7 @@
1
1
  # plexus-cli command reference
2
2
 
3
3
  Generated from the commands the CLI registers — do not edit; `plexus-cli <command> --help` prints the same.
4
- 301 commands. Every network command also takes `--env <local|staging|prod>`, `--tenant <slug>`,
4
+ 303 commands. Every network command also takes `--env <local|staging|prod>`, `--tenant <slug>`,
5
5
  `--json` (raw JSON instead of a table) and `--allow-prod` (required for a writing run against production).
6
6
 
7
7
  - [Admission (offline)](#admission-offline) (1)
@@ -12,7 +12,7 @@ Generated from the commands the CLI registers — do not edit; `plexus-cli <comm
12
12
  - [Config (offline)](#config-offline) (4)
13
13
  - [Config (school token)](#config-school-token) (6)
14
14
  - [Contracts (platform operator)](#contracts-platform-operator) (5)
15
- - [Contracts (school token)](#contracts-school-token) (19)
15
+ - [Contracts (school token)](#contracts-school-token) (21)
16
16
  - [Feedback (platform operator)](#feedback-platform-operator) (21)
17
17
  - [Files (school token)](#files-school-token) (3)
18
18
  - [Identity (own account)](#identity-own-account) (5)
@@ -627,6 +627,20 @@ Replace an applied grant from the 1st of a month: the old one ends the day befor
627
627
  | `--evidence <value>` (required) | Why the family gets it, as a JSON object — e.g. {"rank":2,"proof":"Bescheid Stadt 03.11."} |
628
628
  | `--from <value>` (required) | First day of the new grant (YYYY-MM-01) |
629
629
 
630
+ ### `contract twin apply <twin-file> ...`
631
+
632
+ Import contract twins: each signed paper contract becomes a contract with its scan as revision 1
633
+
634
+ - **Right:** school token — a module permission inside one school (the school's own administrator runs it)
635
+ - **Effect:** write — needs `--env`; on production also `--allow-prod`
636
+
637
+ ### `contract twin plan <twin-file> ...`
638
+
639
+ Check contract twins (signed paper contracts) against the tenant and show what apply would write
640
+
641
+ - **Right:** school token — a module permission inside one school (the school's own administrator runs it)
642
+ - **Effect:** read — changes nothing on the deployment
643
+
630
644
  ### `generator list`
631
645
 
632
646
  List generator identities and their versions.
@@ -0,0 +1,146 @@
1
+ # Import signed paper contracts (contract twins)
2
+
3
+ **When to use:** a school has contracts that were signed on paper (often filled in
4
+ by hand), and they should become ordinary contracts in Plexus — parties, agreed
5
+ amounts, the SEPA mandate, the scan as the signed document, the signatures. A
6
+ generic import cannot read handwriting, so every paper is first described by a
7
+ **contract twin**: one JSON file per contract that holds what is on the paper and
8
+ how it maps onto the contract. `contract twin plan` checks twins, `contract twin
9
+ apply` imports them.
10
+
11
+ ## Prerequisites
12
+
13
+ - A token with contract work held school-wide (`finanzen_vertraege.contracts.manage`).
14
+ - The master data is imported: every person a twin names is found by the import
15
+ identity of the master-data import (source key, table and primary key), never
16
+ by name.
17
+ - The contract kinds (generator keys), the Träger (`legal_entities` key), the
18
+ articles (`configKey`) and — for an enrollment — the program run and stage
19
+ (`key`) exist in the tenant.
20
+ - Per contract, ONE PDF next to its twin: the contract and its mandate joined
21
+ (for example with `pdfunite contract.pdf mandate.pdf merged.pdf`).
22
+ - Customer files stay on the machine that reads them: no upload anywhere but
23
+ through this command.
24
+
25
+ ## The twin (format `plexus.contractTwin/1`)
26
+
27
+ ```json
28
+ {
29
+ "format": "plexus.contractTwin/1",
30
+ "key": "<stable key, e.g. school/<pupil number>/school-contract>",
31
+ "paperForm": "<printed form, e.g. footer 'Stand 2020'>",
32
+ "document": { "file": "merged/<name>.pdf", "sha256": "<lower-case hex>" },
33
+ "read": {
34
+ "<file id>": {
35
+ "fee": { "monthlyTotal": { "value": "267,50", "normalized": 267.5, "confidence": "certain",
36
+ "source": { "file": "<file id>", "page": 2, "field": "Entgelt" } } }
37
+ }
38
+ },
39
+ "contract": {
40
+ "generator": "<generator key>",
41
+ "traeger": "<legal entity key>",
42
+ "scope": "<contract label>",
43
+ "activeFrom": { "value": "2021-08-01", "from": ["<file id>.contract.start"] },
44
+ "parties": [
45
+ { "id": "child", "ref": { "sourceKey": "…", "sourceTable": "…", "sourcePrimaryKey": "…" },
46
+ "role": "beneficiary", "invoiceRecipient": false, "liabilityType": "none", "liabilityShare": 0 },
47
+ { "id": "mother", "ref": { "…": "…" }, "role": "debtor", "invoiceRecipient": true,
48
+ "liabilityType": "joint_and_several", "liabilityShare": 100,
49
+ "name": { "value": "<as read>", "from": ["<file id>.partners[0].name"] } }
50
+ ],
51
+ "lines": [
52
+ { "article": "<article key>", "amount": { "value": 267.5, "from": ["<file id>.fee.monthlyTotal"] },
53
+ "period": "month", "status": "active", "enrollment": { "programRun": "<run key>" } },
54
+ { "article": "<article key>", "amount": { "value": 150, "from": ["…"] }, "period": "once",
55
+ "activeFrom": { "value": "2021-08-01", "from": ["…"] }, "activeTo": { "value": "2021-08-31", "from": ["…"] },
56
+ "status": "ended" }
57
+ ],
58
+ "paymentMethods": [
59
+ { "id": "sepa", "owner": "mother", "accountHolderName": { "value": "…", "from": ["…"] },
60
+ "iban": { "value": "…", "from": ["…"] }, "mandateSignedAt": { "value": "2021-05-26", "from": ["…"] } }
61
+ ],
62
+ "allocations": [ { "payer": { "paymentMethod": "sepa" }, "sharePct": 100 } ],
63
+ "signers": [
64
+ { "signer": "mother", "signedOn": { "value": "2021-05-26", "from": ["…"] } },
65
+ { "signer": "traeger", "signedOn": { "value": "2021-05-27", "from": ["…"] },
66
+ "representativeName": { "value": "<name read, or the printed line>", "from": ["…"] } }
67
+ ]
68
+ }
69
+ }
70
+ ```
71
+
72
+ - **Readings** carry `confidence` (`certain`, `probable`, `unclear`) and `source`
73
+ (file, page, printed label). An unclear reading has `value: null` and its
74
+ `candidates`; it is never guessed.
75
+ - **Every value taken from the paper names its readings in `from`** and must equal
76
+ each (its `normalized` form when it has one). A value that relies on an unclear
77
+ reading, or differs from its reading, refuses the twin.
78
+ - `iban: null` imports the mandate without an IBAN (unreadable, or failing its
79
+ check digits): it then names no BIC, reference or date (they stay on the scan),
80
+ and nothing is collected until the school confirms the account. With an IBAN,
81
+ `mandateSignedAt` is required.
82
+ - `signedOn: null` declares a signature line that is empty on the paper; the
83
+ contract then stays unsigned and is not billed. The Träger and every debtor are
84
+ declared signers.
85
+ - `enrollment` on a line: the pupil's one enrollment in that run is linked to the
86
+ contract (it then justifies the pupil's role); without one, a new enrollment is
87
+ written. `stage` and `startDate` are optional. Such a line runs as long as its
88
+ enrollment and names no dates of its own; lines on one run share one enrollment.
89
+ - A line without `enrollment` names `activeFrom` (not before the contract's). An
90
+ ended line (`status: "ended"`) names its end (`activeTo`) — a one-time fee of
91
+ the past, kept as content, never charged.
92
+ - Parties: a debtor owes a share (`several` or `joint_and_several`), the debtors'
93
+ shares total 100; the beneficiary owes none. Allocations total 100 per scope
94
+ (the contract, or one line). Amounts are euros with at most two decimals.
95
+
96
+ ## Steps
97
+
98
+ 1. Check every twin — nothing is written:
99
+
100
+ ```bash
101
+ plexus-cli --env <env> --tenant <slug> contract twin plan twins/*.twin.json
102
+ ```
103
+
104
+ One row per twin: `create` or `unchanged`, the lines, `link`/`create` per
105
+ enrollment, `create`/`reuse`/`withoutIban` per payment method, whether every
106
+ signature is on the paper, the month the school's charge runs catch up from
107
+ (`chargedFrom`), and warnings by code and twin id: `nameDiffers` (a name read
108
+ differs from the master data), `mandateKept` (the account's earlier mandate
109
+ stays). A refused twin shows its reasons; exit code 2.
110
+
111
+ 2. Import:
112
+
113
+ ```bash
114
+ plexus-cli --env <env> --tenant <slug> contract twin apply twins/*.twin.json
115
+ ```
116
+
117
+ Each twin is planned again; an unchanged one is skipped, a new one uploads its
118
+ PDF and is written in one transaction. The row names the new contract id.
119
+
120
+ ## Verify
121
+
122
+ - `plan` again: every imported twin reads `unchanged` with its contract id.
123
+ - On the contract page: revision 1 is the scan, the signatures are marked as
124
+ paper scans, the Träger's signature carries the name from the paper.
125
+
126
+ ## Idempotency / gotchas
127
+
128
+ - Same key, same twin: nothing happens — the checksum is the twin's content, so a
129
+ reformatted file is the same twin. Same key, changed content: refused — correct
130
+ the contract itself, never by importing again.
131
+ - A second contract of the same kind for the same pupil is refused, whatever made
132
+ the first.
133
+ - An IBAN is checked by its check digits; one that fails is refused — set
134
+ `iban: null` and ask the school.
135
+ - Two mandates of one account holder on one IBAN become one payment method; its
136
+ mandate date is the earliest.
137
+ - A fully signed contract is an ordinary contract: a school with the finance module
138
+ bills it from the next monthly run, catching up every month back to
139
+ `chargedFrom` (the school's first charge run), never before. Months the school
140
+ already billed elsewhere since then are billed again — check `chargedFrom`
141
+ before `apply`.
142
+ - The output names keys, decisions and counts, never a name or an IBAN.
143
+
144
+ ## Related
145
+
146
+ - [Change a contract grant](./change-contract-grant.md)