@cratis/pi 7.8.0 → 7.9.1
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.
- package/package/corpus/agents/screenplay-modeler.md +10 -2
- package/package/corpus/agents/screenplay-renderer.md +13 -0
- package/package/corpus/agents/screenplay-reviewer.md +10 -0
- package/package/corpus/agents/slice-implementer.md +16 -2
- package/package/corpus/skills/cratis-application-slice-conformance/LICENSE +7 -0
- package/package/corpus/skills/cratis-application-slice-conformance/SKILL.md +9 -3
- package/package/corpus/skills/cratis-application-slice-conformance/references/build-prompts.md +151 -0
- package/package/corpus/skills/cratis-application-slice-conformance/references/checklists.md +37 -2
- package/package/corpus/skills/cratis-application-slice-conformance/references/contract-and-precedence.md +4 -1
- package/package/corpus/skills/cratis-application-slice-conformance/references/provenance.md +15 -14
- package/package/corpus/skills/cratis-application-slice-conformance/verification.json +36 -7
- package/package/corpus/skills/cratis-application-slice-specifications/LICENSE +7 -0
- package/package/corpus/skills/cratis-application-slice-specifications/references/provenance.md +11 -13
- package/package/corpus/skills/cratis-arc-react-page/LICENSE +7 -0
- package/package/corpus/skills/cratis-arc-react-page/references/provenance.md +13 -6
- package/package/corpus/skills/cratis-chronicle-reactor/LICENSE +7 -0
- package/package/corpus/skills/cratis-chronicle-reactor/SKILL.md +1 -1
- package/package/corpus/skills/cratis-chronicle-reactor/references/provenance.md +7 -3
- package/package/corpus/skills/cratis-chronicle-read-model-specifications/LICENSE +7 -0
- package/package/corpus/skills/cratis-chronicle-read-model-specifications/references/provenance.md +13 -9
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/LICENSE +5 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/SKILL.md +4 -1
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/audit-format.md +17 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/automation-patterns.md +14 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/integration-contracts.md +30 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/provenance.md +17 -10
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/translation-patterns.md +2 -2
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/verification.json +3 -1
- package/package/corpus/skills/cratis-screenplay-discovery/LICENSE +5 -0
- package/package/corpus/skills/cratis-screenplay-discovery/SKILL.md +10 -7
- package/package/corpus/skills/cratis-screenplay-discovery/references/plotting-and-handoff.md +37 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/provenance.md +18 -9
- package/package/corpus/skills/cratis-screenplay-discovery/references/storming-loop.md +1 -1
- package/package/corpus/skills/cratis-screenplay-discovery/verification.json +5 -1
- package/package/corpus/skills/cratis-screenplay-event-modeling/LICENSE +7 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/SKILL.md +18 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/provenance.md +19 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/verification.json +8 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/LICENSE +5 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/SKILL.md +19 -20
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/candidate-inventory.md +101 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/provenance.md +17 -1
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/ui-observation.md +65 -23
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/verification.json +56 -10
- package/package/corpus/skills/cratis-screenplay-model-review/LICENSE +5 -0
- package/package/corpus/skills/cratis-screenplay-model-review/SKILL.md +22 -10
- package/package/corpus/skills/cratis-screenplay-model-review/references/business-questions.md +54 -3
- package/package/corpus/skills/cratis-screenplay-model-review/references/checklist.md +17 -3
- package/package/corpus/skills/cratis-screenplay-model-review/references/provenance.md +12 -7
- package/package/corpus/skills/cratis-screenplay-model-review/references/report-template.md +10 -1
- package/package/corpus/skills/cratis-screenplay-model-review/references/review-questions.md +11 -1
- package/package/corpus/skills/cratis-screenplay-model-review/verification.json +4 -1
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/LICENSE +5 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/SKILL.md +21 -21
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/completeness-self-check.md +37 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/per-turn-protocol.md +50 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/phases.md +12 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/provenance.md +22 -16
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/reasoning-notes.md +15 -1
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/stop-or-assume.md +16 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/verification.json +5 -1
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/LICENSE +7 -0
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/SKILL.md +7 -4
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/drift-and-ledger.md +1 -1
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/gap-fill-handoff.md +19 -4
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/provenance.md +11 -13
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/verification.json +32 -7
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/LICENSE +7 -2
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/SKILL.md +14 -1
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/invoicing-dues-design.md +259 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/invoicing-dues-example.md +414 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/provenance.md +19 -10
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-catalogue.md +6 -2
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-examples.md +200 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/view-and-story-specs.md +54 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/verification.json +4 -1
- package/package/corpus/skills/cratis-screenplay-slice-design/LICENSE +5 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/SKILL.md +45 -43
- package/package/corpus/skills/cratis-screenplay-slice-design/references/command-inventory.md +13 -1
- package/package/corpus/skills/cratis-screenplay-slice-design/references/field-lineage.md +4 -2
- package/package/corpus/skills/cratis-screenplay-slice-design/references/provenance.md +28 -7
- package/package/corpus/skills/cratis-screenplay-slice-design/references/read-model-design.md +69 -3
- package/package/corpus/skills/cratis-screenplay-slice-design/references/slicing.md +31 -3
- package/package/corpus/skills/cratis-screenplay-slice-design/verification.json +24 -0
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/LICENSE +5 -0
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/SKILL.md +6 -0
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/boundaries.md +20 -1
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/provenance.md +15 -1
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/stream-patterns.md +69 -0
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/verification.json +3 -1
- package/package/corpus/skills/cratis-screenplay-toolchain/LICENSE +7 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/SKILL.md +3 -1
- package/package/corpus/skills/cratis-screenplay-toolchain/references/provenance.md +12 -3
- package/package/corpus/skills/cratis-screenplay-ui-composition/LICENSE +7 -0
- package/package/corpus/skills/cratis-screenplay-ui-composition/references/provenance.md +14 -7
- package/package.json +1 -1
|
@@ -62,7 +62,9 @@ question is not four approvals.
|
|
|
62
62
|
`open: <case>`, `question: <id>` or `gap: <code>`. "Fewer specs" is never a reason; a
|
|
63
63
|
declaration (constraint, policy) or another command's denial is not a spec.
|
|
64
64
|
5. **Per read model, decide the shape**: single-transition specs only, or also a lifecycle
|
|
65
|
-
family (cumulative givens). Write the decision and reason in the matrix
|
|
65
|
+
family (cumulative givens). Write the decision and reason in the matrix, before drafting any
|
|
66
|
+
payload: one line per read model. One schema reused for every command and view may indicate
|
|
67
|
+
the per-view judgment was skipped: check for a recorded reason per view before concluding.
|
|
66
68
|
6. **Example data**: a small cast per feature; reuse only where meaning agrees; preserve
|
|
67
69
|
existing intentional fixtures (`references/scenario-catalogue.md` "Example data").
|
|
68
70
|
7. **Draft commands**: happy path, each rule, denial, duplicates and retries, competing claims,
|
|
@@ -141,6 +143,13 @@ target requirements.
|
|
|
141
143
|
- Every read model has population, update and (where it removes) removal specs.
|
|
142
144
|
- Alternative paths, compensation and external failure are specified or carry a reason.
|
|
143
145
|
- Each matrix cell holds a value; each `n/a` is a domain reason.
|
|
146
|
+
- No command has only two specs (success and one rejection) unless every other type was reviewed
|
|
147
|
+
and found inapplicable for a domain reason.
|
|
148
|
+
- Read models are a separate, equally mandatory pass: a model with dozens of command specs and no
|
|
149
|
+
read-model spec is not scenario-complete. Population, then update or removal where an event
|
|
150
|
+
supersedes a row.
|
|
151
|
+
- The why behind each business rule is written down (slice `description`), not only the what.
|
|
152
|
+
- Good and bad forms of givens, outcomes and rejections: `references/scenario-examples.md`.
|
|
144
153
|
|
|
145
154
|
### Review questions
|
|
146
155
|
- Where is this invariant enforced, and what does the loser of a race see (enforced or declared)?
|
|
@@ -191,6 +200,10 @@ scope is reported as explicitly incomplete); V1 passes with the tool named in
|
|
|
191
200
|
- `references/scenario-catalogue.md` - each type: ask, applies when, n/a when, shape, traps; example data.
|
|
192
201
|
- `references/view-and-story-specs.md` - view specs, lifecycle families, ordering, lag.
|
|
193
202
|
- `references/coverage-matrix.md` - obligations from declarations, template, worked matrix.
|
|
203
|
+
- `references/scenario-examples.md` - compact worked examples per category, good and bad forms,
|
|
204
|
+
list and todo-list views; copied from the complete `references/invoicing-dues-example.md`
|
|
205
|
+
(runnable) and, for compensation, `references/invoicing-dues-design.md` (design mode: holds the
|
|
206
|
+
stored-state rules, does not bind).
|
|
194
207
|
- `references/scenario-workshop.md` - facilitation guide for group scenario sessions.
|
|
195
208
|
- `references/chronicle-verification.md` - guarantees that need more than a `.play` outcome.
|
|
196
209
|
- `references/spec-forms-by-mode.md` - admitted forms in design, executable, renderable.
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
# Invoicing and dues: design-mode document for the stored-state rules
|
|
2
|
+
|
|
3
|
+
**Design mode, not binding-ready by design.** This document states the stored-state rules of the
|
|
4
|
+
invoicing example as the skill requires (`reads <View>` + `require ... message`, marked NOT
|
|
5
|
+
enforced in the slice `description`, target named). It compiles (V1, warnings as errors) but
|
|
6
|
+
does not bind at Screenplay 4.64.0, and the only blockers are `reads` (PLAY0271) and `require` over
|
|
7
|
+
a view (PLAY0268), so no specification here runs (V3 blocked). `PaymentReceived` has its producer
|
|
8
|
+
here (the capture and `ReceivedTranslator`), so nothing else blocks: with every `reads` and
|
|
9
|
+
`require` line removed the document binds. The rules cover an unknown invoice, voiding a paid
|
|
10
|
+
invoice, reversing without a received payment and a second reversal (`ReceivedPayments` drops the
|
|
11
|
+
row on `PaymentReversed`). It is not a full coverage example: for that see `berth-reservations.md`.
|
|
12
|
+
Keep those lines: they state real intent and are never
|
|
13
|
+
replaced by prose. The runnable counterpart, which holds no stored-state rule, is
|
|
14
|
+
`invoicing-dues-example.md`; `scenario-examples.md` copies `ReversingAReceivedPayment` from here.
|
|
15
|
+
|
|
16
|
+
```screenplay
|
|
17
|
+
// Needs the standalone screenplay compiler (ESM v6)
|
|
18
|
+
// Scenario coverage design-mode example: stored-state rules of invoicing club dues (complete document).
|
|
19
|
+
// Design mode: `reads` is PLAY0271 and `require` over a view is PLAY0268 at binding (the only
|
|
20
|
+
// blockers), so this model compiles but is not executable; the specifications below do not run. The runnable counterpart
|
|
21
|
+
// is invoicing-dues-example.md.
|
|
22
|
+
// Target enforcement of every rule here: Arc [ProtectedDecision] with DecisionRead<T> (Arc v22.39.0
|
|
23
|
+
// or later, not in a Stage-rendered application), or a Chronicle DCB; Screenplay#129/#209.
|
|
24
|
+
|
|
25
|
+
concept InvoiceId : Uuid
|
|
26
|
+
concept MemberId : Uuid
|
|
27
|
+
concept GatewayOutcome : Enum
|
|
28
|
+
captured
|
|
29
|
+
declined
|
|
30
|
+
|
|
31
|
+
policy IsAccounts
|
|
32
|
+
require role "Accounts"
|
|
33
|
+
|
|
34
|
+
module Invoicing
|
|
35
|
+
feature Dues
|
|
36
|
+
authorize IsAccounts
|
|
37
|
+
|
|
38
|
+
slice StateChange IssueInvoice
|
|
39
|
+
description "Issues one invoice per invoice id (declared here so the rules below have an invoice to refer to)."
|
|
40
|
+
command IssueInvoice
|
|
41
|
+
invoiceId InvoiceId identifier
|
|
42
|
+
member MemberId
|
|
43
|
+
amount Decimal
|
|
44
|
+
produces InvoiceIssued
|
|
45
|
+
for invoiceId
|
|
46
|
+
member = member
|
|
47
|
+
amount = amount
|
|
48
|
+
event InvoiceIssued
|
|
49
|
+
member MemberId
|
|
50
|
+
amount Decimal
|
|
51
|
+
constraint IssueOnce
|
|
52
|
+
unique event InvoiceIssued
|
|
53
|
+
|
|
54
|
+
slice StateView OpenInvoices
|
|
55
|
+
description "Todo list: membership means 'still to collect'. The rules below read it (it lags: an unguarded read is not protection)."
|
|
56
|
+
readmodel OpenInvoice
|
|
57
|
+
invoiceId InvoiceId
|
|
58
|
+
member MemberId
|
|
59
|
+
amount Decimal
|
|
60
|
+
query OpenInvoiceById => OpenInvoice optional
|
|
61
|
+
by invoiceId InvoiceId
|
|
62
|
+
projection OpenInvoices => OpenInvoice
|
|
63
|
+
from InvoiceIssued
|
|
64
|
+
invoiceId = $eventSourceId
|
|
65
|
+
member = member
|
|
66
|
+
amount = amount
|
|
67
|
+
remove with PaymentReceived
|
|
68
|
+
remove with InvoiceVoided
|
|
69
|
+
remove with InvoiceSettled
|
|
70
|
+
slice StateView ReceivedPayments
|
|
71
|
+
description "Which invoices have a received, not yet reversed payment: PaymentReversed removes the row, so a second reversal finds none."
|
|
72
|
+
readmodel ReceivedPayment
|
|
73
|
+
invoiceId InvoiceId
|
|
74
|
+
query ReceivedPaymentById => ReceivedPayment optional
|
|
75
|
+
by invoiceId InvoiceId
|
|
76
|
+
projection ReceivedPayments => ReceivedPayment
|
|
77
|
+
from PaymentReceived
|
|
78
|
+
invoiceId = $eventSourceId
|
|
79
|
+
remove with PaymentReversed
|
|
80
|
+
|
|
81
|
+
slice Translate PaymentGatewayResults
|
|
82
|
+
description "Gives PaymentReceived its producer (the same capture and translator as invoicing-dues-example.md): reference -> correlation key (our invoice id); outcome -> translated to our enum. PaymentReceived is OUR fact; PaymentGatewayResultReceived is the provider's."
|
|
83
|
+
capture PaymentGatewayResults
|
|
84
|
+
source webhook
|
|
85
|
+
path /webhooks/payments/results
|
|
86
|
+
key reference
|
|
87
|
+
map
|
|
88
|
+
outcome = outcome translate
|
|
89
|
+
"C" => captured
|
|
90
|
+
"D" => declined
|
|
91
|
+
append PaymentGatewayResultReceived
|
|
92
|
+
when outcome
|
|
93
|
+
outcome = $.outcome
|
|
94
|
+
reason = $.reason
|
|
95
|
+
reaction ReceivedTranslator
|
|
96
|
+
when PaymentGatewayResultReceived
|
|
97
|
+
outcome
|
|
98
|
+
produces PaymentReceived
|
|
99
|
+
where outcome == "captured"
|
|
100
|
+
event PaymentGatewayResultReceived
|
|
101
|
+
outcome GatewayOutcome
|
|
102
|
+
reason String
|
|
103
|
+
event PaymentReceived
|
|
104
|
+
|
|
105
|
+
slice StateChange SettleOrVoidInvoice
|
|
106
|
+
description "An invoice ends either settled or voided, never both (SettleOrVoid, enforced at append). NOT enforced in the model today: that the invoice exists and is still open (settling) and that only an open, unpaid invoice may be voided. Stated as `reads OpenInvoice` + `require` (PLAY0271/PLAY0268 at binding; Screenplay#129/#209). Target: Arc [ProtectedDecision] with DecisionRead, or a Chronicle DCB. Requirements to test in the target: settling an unknown invoice is rejected; voiding a paid invoice is rejected; voiding an open invoice succeeds."
|
|
107
|
+
command SettleInvoice
|
|
108
|
+
invoiceId InvoiceId identifier
|
|
109
|
+
reads OpenInvoice as invoice by invoiceId // stated intent, unprotected (PLAY0271 at binding)
|
|
110
|
+
validate
|
|
111
|
+
require invoice.amount > 0
|
|
112
|
+
message "Only an open invoice can be settled" // NOT enforced: the view lags (PLAY0268 at binding)
|
|
113
|
+
produces InvoiceSettled
|
|
114
|
+
for invoiceId
|
|
115
|
+
command VoidInvoice
|
|
116
|
+
invoiceId InvoiceId identifier
|
|
117
|
+
reason String
|
|
118
|
+
reads OpenInvoice as invoice by invoiceId // stated intent, unprotected (PLAY0271 at binding)
|
|
119
|
+
validate
|
|
120
|
+
require invoice.amount > 0
|
|
121
|
+
message "Only an open, unpaid invoice can be voided" // NOT enforced: the view lags (PLAY0268 at binding)
|
|
122
|
+
produces InvoiceVoided
|
|
123
|
+
for invoiceId
|
|
124
|
+
reason = reason
|
|
125
|
+
event InvoiceSettled
|
|
126
|
+
event InvoiceVoided
|
|
127
|
+
reason String
|
|
128
|
+
constraint SettleOrVoid
|
|
129
|
+
unique event InvoiceSettled
|
|
130
|
+
unique event InvoiceVoided
|
|
131
|
+
|
|
132
|
+
specification SettlingAnOpenInvoice
|
|
133
|
+
given caller
|
|
134
|
+
authenticated
|
|
135
|
+
role "Accounts"
|
|
136
|
+
given InvoiceIssued
|
|
137
|
+
for "9c1f0a52-6a4e-4b1c-9f55-0d2c7b8e1a01"
|
|
138
|
+
member = "6f1c2a8e-0b1d-4d55-9a3e-2f6a7c1d0e11"
|
|
139
|
+
amount = 130
|
|
140
|
+
when SettleInvoice
|
|
141
|
+
invoiceId = "9c1f0a52-6a4e-4b1c-9f55-0d2c7b8e1a01"
|
|
142
|
+
then InvoiceSettled
|
|
143
|
+
for "9c1f0a52-6a4e-4b1c-9f55-0d2c7b8e1a01"
|
|
144
|
+
|
|
145
|
+
specification RejectingSettlementOfAnUnknownInvoice
|
|
146
|
+
given caller
|
|
147
|
+
authenticated
|
|
148
|
+
role "Accounts"
|
|
149
|
+
when SettleInvoice
|
|
150
|
+
invoiceId = "9c1f0a52-6a4e-4b1c-9f55-0d2c7b8e1a01"
|
|
151
|
+
then error "Only an open invoice can be settled"
|
|
152
|
+
|
|
153
|
+
specification RejectingTheVoidingOfAPaidInvoice
|
|
154
|
+
given caller
|
|
155
|
+
authenticated
|
|
156
|
+
role "Accounts"
|
|
157
|
+
given InvoiceIssued
|
|
158
|
+
for "9c1f0a52-6a4e-4b1c-9f55-0d2c7b8e1a01"
|
|
159
|
+
member = "6f1c2a8e-0b1d-4d55-9a3e-2f6a7c1d0e11"
|
|
160
|
+
amount = 130
|
|
161
|
+
given PaymentReceived
|
|
162
|
+
for "9c1f0a52-6a4e-4b1c-9f55-0d2c7b8e1a01"
|
|
163
|
+
when VoidInvoice
|
|
164
|
+
invoiceId = "9c1f0a52-6a4e-4b1c-9f55-0d2c7b8e1a01"
|
|
165
|
+
reason = "Issued in error"
|
|
166
|
+
then error "Only an open, unpaid invoice can be voided"
|
|
167
|
+
|
|
168
|
+
slice StateChange ReversePayment
|
|
169
|
+
description "Compensation for a received payment. NOT enforced in the model today: that a payment was received and not yet reversed (so a second reversal is refused). Stated as `reads ReceivedPayment` + `require` (PLAY0271/PLAY0268 at binding). Target: a protected decision read of the payment (keyed by the invoice source id). RefundRequested is the request recorded by the reaction; it does not show a refund was delivered, and the gateway's own answer is a later external fact. Requirements to test in the target: reversing without a received payment is rejected; a second reversal of the same payment is rejected; a correct reversal records PaymentReversed and RefundRequested. Open question: OpenInvoices dropped the invoice on PaymentReceived and nothing re-adds it on PaymentReversed, so a reversed invoice can be neither settled nor voided and leaves the still-to-collect list; whether a reversal reopens the invoice is undecided."
|
|
170
|
+
command ReversePayment
|
|
171
|
+
invoiceId InvoiceId identifier
|
|
172
|
+
amount Decimal
|
|
173
|
+
reads ReceivedPayment as payment by invoiceId // stated intent, unprotected (PLAY0271 at binding)
|
|
174
|
+
validate
|
|
175
|
+
require payment.invoiceId == invoiceId
|
|
176
|
+
message "Only a received, not yet reversed payment can be reversed" // NOT enforced: the view lags (PLAY0268 at binding)
|
|
177
|
+
produces PaymentReversed
|
|
178
|
+
for invoiceId
|
|
179
|
+
amount = amount
|
|
180
|
+
event PaymentReversed
|
|
181
|
+
amount Decimal
|
|
182
|
+
|
|
183
|
+
specification ReversingAReceivedPayment
|
|
184
|
+
given caller
|
|
185
|
+
authenticated
|
|
186
|
+
role "Accounts"
|
|
187
|
+
given InvoiceIssued
|
|
188
|
+
for "9c1f0a52-6a4e-4b1c-9f55-0d2c7b8e1a01"
|
|
189
|
+
member = "6f1c2a8e-0b1d-4d55-9a3e-2f6a7c1d0e11"
|
|
190
|
+
amount = 130
|
|
191
|
+
given PaymentReceived
|
|
192
|
+
for "9c1f0a52-6a4e-4b1c-9f55-0d2c7b8e1a01"
|
|
193
|
+
when ReversePayment
|
|
194
|
+
invoiceId = "9c1f0a52-6a4e-4b1c-9f55-0d2c7b8e1a01"
|
|
195
|
+
amount = 130
|
|
196
|
+
then PaymentReversed
|
|
197
|
+
for "9c1f0a52-6a4e-4b1c-9f55-0d2c7b8e1a01"
|
|
198
|
+
amount = 130
|
|
199
|
+
then RefundRequested
|
|
200
|
+
for "9c1f0a52-6a4e-4b1c-9f55-0d2c7b8e1a01"
|
|
201
|
+
amount = 130
|
|
202
|
+
|
|
203
|
+
specification RejectingAReversalWithoutAReceivedPayment
|
|
204
|
+
given caller
|
|
205
|
+
authenticated
|
|
206
|
+
role "Accounts"
|
|
207
|
+
given InvoiceIssued
|
|
208
|
+
for "9c1f0a52-6a4e-4b1c-9f55-0d2c7b8e1a01"
|
|
209
|
+
member = "6f1c2a8e-0b1d-4d55-9a3e-2f6a7c1d0e11"
|
|
210
|
+
amount = 130
|
|
211
|
+
when ReversePayment
|
|
212
|
+
invoiceId = "9c1f0a52-6a4e-4b1c-9f55-0d2c7b8e1a01"
|
|
213
|
+
amount = 130
|
|
214
|
+
then error "Only a received, not yet reversed payment can be reversed"
|
|
215
|
+
|
|
216
|
+
specification RejectingASecondReversal
|
|
217
|
+
given caller
|
|
218
|
+
authenticated
|
|
219
|
+
role "Accounts"
|
|
220
|
+
given InvoiceIssued
|
|
221
|
+
for "9c1f0a52-6a4e-4b1c-9f55-0d2c7b8e1a01"
|
|
222
|
+
member = "6f1c2a8e-0b1d-4d55-9a3e-2f6a7c1d0e11"
|
|
223
|
+
amount = 130
|
|
224
|
+
given PaymentReceived
|
|
225
|
+
for "9c1f0a52-6a4e-4b1c-9f55-0d2c7b8e1a01"
|
|
226
|
+
given PaymentReversed
|
|
227
|
+
for "9c1f0a52-6a4e-4b1c-9f55-0d2c7b8e1a01"
|
|
228
|
+
amount = 130
|
|
229
|
+
when ReversePayment
|
|
230
|
+
invoiceId = "9c1f0a52-6a4e-4b1c-9f55-0d2c7b8e1a01"
|
|
231
|
+
amount = 130
|
|
232
|
+
then error "Only a received, not yet reversed payment can be reversed"
|
|
233
|
+
|
|
234
|
+
specification RefusingAReversalWithoutTheAccountsRole
|
|
235
|
+
given caller
|
|
236
|
+
authenticated
|
|
237
|
+
when ReversePayment
|
|
238
|
+
invoiceId = "9c1f0a52-6a4e-4b1c-9f55-0d2c7b8e1a01"
|
|
239
|
+
amount = 130
|
|
240
|
+
then denied
|
|
241
|
+
|
|
242
|
+
slice Automation RequestRefunds
|
|
243
|
+
reaction RefundRequester
|
|
244
|
+
description "Records a refund request for every reversed payment; ends at RefundRequested"
|
|
245
|
+
when PaymentReversed
|
|
246
|
+
amount
|
|
247
|
+
produces RefundRequested
|
|
248
|
+
amount = amount
|
|
249
|
+
event RefundRequested
|
|
250
|
+
amount Decimal
|
|
251
|
+
|
|
252
|
+
specification RequestingARefundAfterAReversal
|
|
253
|
+
when append PaymentReversed
|
|
254
|
+
for "9c1f0a52-6a4e-4b1c-9f55-0d2c7b8e1a01"
|
|
255
|
+
amount = 130
|
|
256
|
+
then RefundRequested
|
|
257
|
+
for "9c1f0a52-6a4e-4b1c-9f55-0d2c7b8e1a01"
|
|
258
|
+
amount = 130
|
|
259
|
+
```
|