Skip to main content
IntentLang
← All examples

CreateInvoice

examples/CreateInvoice.intent

CreateInvoice.intent
1# CreateInvoice.intent
2# The canonical mission: notes, guarantees, never-rules, targets, and verification.
3
4mission CreateInvoice
5
6note pm:
7 One placed order should become one invoice, even if checkout retries.
8
9note beginner:
10 This mission is about safe invoice creation, not charging the card.
11
12goal
13 Generate an invoice from approved orders
14
15why
16 Customers need accurate invoices that are auditable and never duplicated.
17
18requires
19 Customer
20 ApprovedOrders
21
22input
23 customer: Customer
24 orders: List<Order>
25 idempotencyKey: IdempotencyKey
26 note beginner:
27 A retry key. The same key returns the same invoice instead of creating another.
28 note qa:
29 Send the same order twice with the same idempotency key and expect one invoice.
30
31output
32 invoice: Invoice
33
34guarantees
35 invoice.total is never negative
36 duplicate invoices are not created
37 every invoice is auditable
38
39guarantee duplicate invoices are not created
40 because duplicate billing damages customer trust
41 note risk:
42 Duplicate billing creates refunds, support tickets, finance cleanup, and lost trust.
43 verify duplicate prevention test
44
45never
46 create invoice for unapproved order
47 expose payment token in logs
48
49never expose payment token in logs
50 because logs may be visible to support and observability tools
51 note security:
52 Payment tokens must not appear in logs, events, debug output, proof artifacts, or AI context.
53 verify security scan
54
55target
56 TypeScript
57 DotNet
58 OpenAPI
59 Tests
60 Markdown
61 Mermaid
62
63style
64 CleanArchitecture
65 CQRS
66
67verify
68 unit tests
69 duplicate prevention test
70 audit trail test
71 security scan
Draft syntax. This file is illustrative and does not run yet.