@hyperscale0/hsx 1.0.0-beta.1 → 1.0.0-rc.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/CHANGELOG.md +41 -9
- package/LICENSING.md +3 -3
- package/README.md +37 -149
- package/TRADEMARKS.md +4 -4
- package/dist/src/ast.d.ts +129 -10
- package/dist/src/ast.d.ts.map +1 -1
- package/dist/src/cli.d.ts +2 -1
- package/dist/src/cli.d.ts.map +1 -1
- package/dist/src/cli.js +148 -12
- package/dist/src/cli.js.map +1 -1
- package/dist/src/compile.d.ts +41 -4
- package/dist/src/compile.d.ts.map +1 -1
- package/dist/src/compile.js +82 -15
- package/dist/src/compile.js.map +1 -1
- package/dist/src/cost.d.ts +78 -0
- package/dist/src/cost.d.ts.map +1 -0
- package/dist/src/cost.js +369 -0
- package/dist/src/cost.js.map +1 -0
- package/dist/src/diagnostics.d.ts +11 -0
- package/dist/src/diagnostics.d.ts.map +1 -0
- package/dist/src/diagnostics.js +420 -0
- package/dist/src/diagnostics.js.map +1 -0
- package/dist/src/emit.d.ts +35 -0
- package/dist/src/emit.d.ts.map +1 -0
- package/dist/src/emit.js +359 -0
- package/dist/src/emit.js.map +1 -0
- package/dist/src/entry-overrides.d.ts +17 -3
- package/dist/src/entry-overrides.d.ts.map +1 -1
- package/dist/src/entry-overrides.js +180 -35
- package/dist/src/entry-overrides.js.map +1 -1
- package/dist/src/format.d.ts +10 -0
- package/dist/src/format.d.ts.map +1 -0
- package/dist/src/format.js +183 -0
- package/dist/src/format.js.map +1 -0
- package/dist/src/index.d.ts +10 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +8 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/ir.d.ts +66 -0
- package/dist/src/ir.d.ts.map +1 -0
- package/dist/src/ir.js +15 -0
- package/dist/src/ir.js.map +1 -0
- package/dist/src/lex.d.ts +9 -1
- package/dist/src/lex.d.ts.map +1 -1
- package/dist/src/lex.js +50 -4
- package/dist/src/lex.js.map +1 -1
- package/dist/src/limits.d.ts +2 -3
- package/dist/src/limits.d.ts.map +1 -1
- package/dist/src/limits.js +2 -3
- package/dist/src/limits.js.map +1 -1
- package/dist/src/modules.d.ts +36 -0
- package/dist/src/modules.d.ts.map +1 -0
- package/dist/src/modules.js +372 -0
- package/dist/src/modules.js.map +1 -0
- package/dist/src/parse.d.ts.map +1 -1
- package/dist/src/parse.js +590 -17
- package/dist/src/parse.js.map +1 -1
- package/dist/src/typecheck.d.ts +8 -0
- package/dist/src/typecheck.d.ts.map +1 -0
- package/dist/src/typecheck.js +2958 -0
- package/dist/src/typecheck.js.map +1 -0
- package/dist/src/version.d.ts +4 -15
- package/dist/src/version.d.ts.map +1 -1
- package/dist/src/version.js +4 -15
- package/dist/src/version.js.map +1 -1
- package/docs/README.md +23 -0
- package/docs/guide/01-first-program.md +24 -0
- package/docs/guide/02-money.md +25 -0
- package/docs/guide/03-instruments.md +22 -0
- package/docs/guide/04-lifecycles.md +25 -0
- package/docs/guide/05-fees-and-splits.md +45 -0
- package/docs/guide/06-schedules.md +22 -0
- package/docs/guide/07-composition.md +46 -0
- package/docs/guide/08-writing-a-module.md +26 -0
- package/docs/guide/09-cost.md +24 -0
- package/docs/guide/10-diagnostics.md +27 -0
- package/docs/llms-full.txt +1738 -0
- package/docs/llms.txt +45 -0
- package/docs/reference/cli.md +33 -0
- package/docs/reference/diagnostics.md +619 -0
- package/docs/reference/grammar.md +39 -0
- package/docs/reference/std/advance.md +35 -0
- package/docs/reference/std/cancellable_booking.md +35 -0
- package/docs/reference/std/captured_payment.md +43 -0
- package/docs/reference/std/conditional_disbursement.md +33 -0
- package/docs/reference/std/credit_facility.md +35 -0
- package/docs/reference/std/held_payment.md +64 -0
- package/docs/reference/std/instant_transfer.md +30 -0
- package/docs/reference/std/metered.md +27 -0
- package/docs/reference/std/pooled_split.md +26 -0
- package/docs/reference/std/premium_forward.md +39 -0
- package/docs/reference/std/reconciled_payout.md +33 -0
- package/docs/reference/std/recurring_collection.md +25 -0
- package/docs/reference/std/rotating_pool.md +42 -0
- package/docs/reference/std/scheduled.md +51 -0
- package/docs/reference/std/security_deposit.md +46 -0
- package/docs/reference/std/settlement_batch.md +42 -0
- package/docs/reference/std/swap.md +46 -0
- package/docs/reference/std/threshold_pool.md +47 -0
- package/docs/reference/std/weighted_distribution.md +39 -0
- package/docs/reference/types.md +20 -0
- package/docs/reference/udl-output.md +14 -0
- package/docs/sessions/2026-09-02-two-instruments.hsx +21 -0
- package/docs/sessions/2026-09-02-two-instruments.md +41 -0
- package/examples/01-first-program/README.md +45 -0
- package/examples/01-first-program/tip-jar.hsx +17 -0
- package/examples/02-imports-and-archetypes/README.md +99 -0
- package/examples/02-imports-and-archetypes/photo-booth.hsx +37 -0
- package/examples/03-diagnostics/README.md +68 -0
- package/examples/03-diagnostics/corner-shop-fixed.hsx +22 -0
- package/examples/03-diagnostics/corner-shop.hsx +19 -0
- package/examples/04-complete-product/README.md +87 -0
- package/examples/04-complete-product/study-hall.hsx +67 -0
- package/examples/05-watch-club/README.md +9 -0
- package/examples/05-watch-club/watch-club.hsx +124 -0
- package/examples/README.md +18 -0
- package/examples/advance/README.md +3 -0
- package/examples/advance/advance.hsx +13 -0
- package/examples/advance/advance.udl +339 -0
- package/examples/cancellable_booking/README.md +3 -0
- package/examples/cancellable_booking/cancellable_booking.hsx +14 -0
- package/examples/cancellable_booking/cancellable_booking.udl +391 -0
- package/examples/captured_payment/README.md +3 -0
- package/examples/captured_payment/captured_payment.hsx +21 -0
- package/examples/captured_payment/captured_payment.udl +677 -0
- package/examples/conditional_disbursement/README.md +3 -0
- package/examples/conditional_disbursement/conditional_disbursement.hsx +17 -0
- package/examples/conditional_disbursement/conditional_disbursement.udl +412 -0
- package/examples/cost-table.json +386 -0
- package/examples/credit_facility/README.md +3 -0
- package/examples/credit_facility/credit_facility.hsx +27 -0
- package/examples/credit_facility/credit_facility.udl +1373 -0
- package/examples/held_payment/README.md +3 -0
- package/examples/held_payment/held_payment.hsx +13 -0
- package/examples/held_payment/held_payment.udl +507 -0
- package/examples/instant_transfer/README.md +3 -0
- package/examples/instant_transfer/instant_transfer.hsx +16 -0
- package/examples/instant_transfer/instant_transfer.udl +364 -0
- package/examples/metered/README.md +3 -0
- package/examples/metered/metered.hsx +13 -0
- package/examples/metered/metered.udl +247 -0
- package/examples/pooled_split/README.md +3 -0
- package/examples/pooled_split/pooled_split.hsx +15 -0
- package/examples/pooled_split/pooled_split.udl +425 -0
- package/examples/premium_forward/README.md +3 -0
- package/examples/premium_forward/premium_forward.hsx +19 -0
- package/examples/premium_forward/premium_forward.udl +594 -0
- package/examples/reconciled_payout/README.md +3 -0
- package/examples/reconciled_payout/reconciled_payout.hsx +13 -0
- package/examples/reconciled_payout/reconciled_payout.udl +303 -0
- package/examples/recurring_collection/README.md +3 -0
- package/examples/recurring_collection/recurring_collection.hsx +21 -0
- package/examples/recurring_collection/recurring_collection.udl +1130 -0
- package/examples/rotating_pool/README.md +3 -0
- package/examples/rotating_pool/rotating_pool.hsx +18 -0
- package/examples/rotating_pool/rotating_pool.udl +4352 -0
- package/examples/scheduled/README.md +3 -0
- package/examples/scheduled/scheduled.hsx +12 -0
- package/examples/scheduled/scheduled.udl +335 -0
- package/examples/security_deposit/README.md +3 -0
- package/examples/security_deposit/security_deposit.hsx +21 -0
- package/examples/security_deposit/security_deposit.udl +293 -0
- package/examples/settlement_batch/README.md +3 -0
- package/examples/settlement_batch/settlement_batch.hsx +19 -0
- package/examples/settlement_batch/settlement_batch.udl +753 -0
- package/examples/swap/README.md +3 -0
- package/examples/swap/swap.hsx +19 -0
- package/examples/swap/swap.udl +876 -0
- package/examples/threshold_pool/README.md +3 -0
- package/examples/threshold_pool/threshold_pool.hsx +16 -0
- package/examples/threshold_pool/threshold_pool.udl +667 -0
- package/examples/weighted_distribution/README.md +3 -0
- package/examples/weighted_distribution/weighted_distribution.hsx +20 -0
- package/examples/weighted_distribution/weighted_distribution.udl +337 -0
- package/package.json +19 -6
- package/skills/hsx/SKILL.md +483 -0
- package/src/ast.ts +163 -9
- package/src/cli.ts +164 -12
- package/src/compile.ts +160 -20
- package/src/cost.ts +579 -0
- package/src/diagnostics.ts +442 -0
- package/src/emit.ts +447 -0
- package/src/entry-overrides.ts +263 -48
- package/src/format.ts +261 -0
- package/src/index.ts +32 -4
- package/src/ir.ts +99 -0
- package/src/lex.ts +59 -4
- package/src/limits.ts +2 -3
- package/src/modules.ts +444 -0
- package/src/parse.ts +655 -21
- package/src/typecheck.ts +3876 -0
- package/src/version.ts +4 -16
- package/std/SEMANTICS.md +130 -0
- package/std/settlements/advance.hsx +177 -0
- package/std/settlements/cancellable_booking.hsx +87 -0
- package/std/settlements/captured_payment.hsx +144 -0
- package/std/settlements/conditional_disbursement.hsx +185 -0
- package/std/settlements/credit_facility.hsx +167 -0
- package/std/settlements/held_payment.hsx +578 -0
- package/std/settlements/index.hsx +3 -0
- package/std/settlements/instant_transfer.hsx +190 -0
- package/std/settlements/metered.hsx +67 -0
- package/std/settlements/pooled_split.hsx +68 -0
- package/std/settlements/premium_forward.hsx +257 -0
- package/std/settlements/reconciled_payout.hsx +77 -0
- package/std/settlements/recurring_collection.hsx +27 -0
- package/std/settlements/rotating_pool.hsx +252 -0
- package/std/settlements/scheduled.hsx +641 -0
- package/std/settlements/security_deposit.hsx +166 -0
- package/std/settlements/settlement_batch.hsx +122 -0
- package/std/settlements/swap.hsx +1114 -0
- package/std/settlements/threshold_pool.hsx +221 -0
- package/std/settlements/weighted_distribution.hsx +141 -0
- package/dist/src/archetypes.d.ts +0 -17
- package/dist/src/archetypes.d.ts.map +0 -1
- package/dist/src/archetypes.js +0 -327
- package/dist/src/archetypes.js.map +0 -1
- package/dist/src/check.d.ts +0 -12
- package/dist/src/check.d.ts.map +0 -1
- package/dist/src/check.js +0 -1910
- package/dist/src/check.js.map +0 -1
- package/dist/src/lower.d.ts +0 -146
- package/dist/src/lower.d.ts.map +0 -1
- package/dist/src/lower.js +0 -4570
- package/dist/src/lower.js.map +0 -1
- package/dist/src/model.d.ts +0 -467
- package/dist/src/model.d.ts.map +0 -1
- package/dist/src/model.js +0 -15
- package/dist/src/model.js.map +0 -1
- package/spec/hsx-ir.schema.json +0 -920
- package/src/archetypes.ts +0 -340
- package/src/check.ts +0 -2938
- package/src/lower.ts +0 -5416
- package/src/model.ts +0 -519
|
@@ -0,0 +1,1130 @@
|
|
|
1
|
+
{
|
|
2
|
+
"instruments": [
|
|
3
|
+
{
|
|
4
|
+
"actionOrder": [
|
|
5
|
+
"create",
|
|
6
|
+
"approve",
|
|
7
|
+
"collect_installment_1",
|
|
8
|
+
"mark_installment_1_delinquent",
|
|
9
|
+
"collect_installment_2",
|
|
10
|
+
"mark_installment_2_delinquent",
|
|
11
|
+
"complete",
|
|
12
|
+
"write_off"
|
|
13
|
+
],
|
|
14
|
+
"actions": {
|
|
15
|
+
"approve": {
|
|
16
|
+
"agentDescription": "Approve the draft obligation and freeze its principal partition and due anchors. The obligation must be in draft. No money moves. Where the product advances funds, approve is what makes advance available.",
|
|
17
|
+
"moves": [],
|
|
18
|
+
"publicAction": "approveObligation",
|
|
19
|
+
"steps": [],
|
|
20
|
+
"summary": "Approve the immutable principal partition and stored anchors"
|
|
21
|
+
},
|
|
22
|
+
"collect_installment_1": {
|
|
23
|
+
"due": {
|
|
24
|
+
"field": "firstDueAt"
|
|
25
|
+
},
|
|
26
|
+
"effects": {
|
|
27
|
+
"reads": [
|
|
28
|
+
{
|
|
29
|
+
"signature": "reads.requires_aggregate",
|
|
30
|
+
"source": "requiresAggregate"
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
"schedules": [
|
|
34
|
+
{
|
|
35
|
+
"signature": "schedules.due",
|
|
36
|
+
"source": "due"
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
"moves": [],
|
|
41
|
+
"requiresAggregate": [
|
|
42
|
+
{
|
|
43
|
+
"check": {
|
|
44
|
+
"amountField": "amount",
|
|
45
|
+
"kind": "sum_exactly",
|
|
46
|
+
"targetField": "installment1Amount"
|
|
47
|
+
},
|
|
48
|
+
"instrumentId": "obligation_installment_1_payment",
|
|
49
|
+
"over": "children",
|
|
50
|
+
"refField": "obligationId",
|
|
51
|
+
"statuses": [
|
|
52
|
+
"paid"
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"steps": [],
|
|
57
|
+
"summary": "Close delinquent installment 1 after linked payments reach its stored amount"
|
|
58
|
+
},
|
|
59
|
+
"collect_installment_2": {
|
|
60
|
+
"due": {
|
|
61
|
+
"field": "firstDueAt",
|
|
62
|
+
"offset": "P30D"
|
|
63
|
+
},
|
|
64
|
+
"effects": {
|
|
65
|
+
"reads": [
|
|
66
|
+
{
|
|
67
|
+
"signature": "reads.requires_aggregate",
|
|
68
|
+
"source": "requiresAggregate"
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
"schedules": [
|
|
72
|
+
{
|
|
73
|
+
"signature": "schedules.due",
|
|
74
|
+
"source": "due"
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
"moves": [],
|
|
79
|
+
"requiresAggregate": [
|
|
80
|
+
{
|
|
81
|
+
"check": {
|
|
82
|
+
"amountField": "amount",
|
|
83
|
+
"kind": "sum_exactly",
|
|
84
|
+
"targetField": "installment2Amount"
|
|
85
|
+
},
|
|
86
|
+
"instrumentId": "obligation_installment_2_payment",
|
|
87
|
+
"over": "children",
|
|
88
|
+
"refField": "obligationId",
|
|
89
|
+
"statuses": [
|
|
90
|
+
"paid"
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
],
|
|
94
|
+
"steps": [],
|
|
95
|
+
"summary": "Close delinquent installment 2 after linked payments reach its stored amount"
|
|
96
|
+
},
|
|
97
|
+
"complete": {
|
|
98
|
+
"due": {
|
|
99
|
+
"field": "firstDueAt",
|
|
100
|
+
"offset": "P30D"
|
|
101
|
+
},
|
|
102
|
+
"effects": {
|
|
103
|
+
"reads": [
|
|
104
|
+
{
|
|
105
|
+
"signature": "reads.requires_aggregate",
|
|
106
|
+
"source": "requiresAggregate"
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
"schedules": [
|
|
110
|
+
{
|
|
111
|
+
"signature": "schedules.due",
|
|
112
|
+
"source": "due"
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
},
|
|
116
|
+
"moves": [],
|
|
117
|
+
"requiresAggregate": [
|
|
118
|
+
{
|
|
119
|
+
"check": {
|
|
120
|
+
"amountField": "amount",
|
|
121
|
+
"kind": "sum_exactly",
|
|
122
|
+
"targetField": "installment1Amount"
|
|
123
|
+
},
|
|
124
|
+
"instrumentId": "obligation_installment_1_payment",
|
|
125
|
+
"over": "children",
|
|
126
|
+
"refField": "obligationId",
|
|
127
|
+
"statuses": [
|
|
128
|
+
"paid"
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"check": {
|
|
133
|
+
"amountField": "amount",
|
|
134
|
+
"kind": "sum_exactly",
|
|
135
|
+
"targetField": "installment2Amount"
|
|
136
|
+
},
|
|
137
|
+
"instrumentId": "obligation_installment_2_payment",
|
|
138
|
+
"over": "children",
|
|
139
|
+
"refField": "obligationId",
|
|
140
|
+
"statuses": [
|
|
141
|
+
"paid"
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
],
|
|
145
|
+
"steps": [],
|
|
146
|
+
"summary": "Close the obligation only after every stored anchor is paid exactly"
|
|
147
|
+
},
|
|
148
|
+
"create": {
|
|
149
|
+
"agentDescription": "Create the obligation in draft with its principal split across stored installment anchors. Approve is the next call. Where the product declares a derived fee, creating the obligation also moves that fee from its bearer to the platform account.",
|
|
150
|
+
"moves": [],
|
|
151
|
+
"publicAction": "createObligation",
|
|
152
|
+
"steps": [],
|
|
153
|
+
"summary": "Create a obligation obligation"
|
|
154
|
+
},
|
|
155
|
+
"mark_installment_1_delinquent": {
|
|
156
|
+
"due": {
|
|
157
|
+
"field": "firstDueAt"
|
|
158
|
+
},
|
|
159
|
+
"effects": {
|
|
160
|
+
"reads": [
|
|
161
|
+
{
|
|
162
|
+
"signature": "reads.requires_aggregate",
|
|
163
|
+
"source": "requiresAggregate"
|
|
164
|
+
}
|
|
165
|
+
],
|
|
166
|
+
"schedules": [
|
|
167
|
+
{
|
|
168
|
+
"signature": "schedules.due",
|
|
169
|
+
"source": "due"
|
|
170
|
+
}
|
|
171
|
+
]
|
|
172
|
+
},
|
|
173
|
+
"moves": [],
|
|
174
|
+
"requiresAggregate": [
|
|
175
|
+
{
|
|
176
|
+
"check": {
|
|
177
|
+
"amountField": "amount",
|
|
178
|
+
"kind": "sum_below",
|
|
179
|
+
"targetField": "installment1Amount"
|
|
180
|
+
},
|
|
181
|
+
"instrumentId": "obligation_installment_1_payment",
|
|
182
|
+
"over": "children",
|
|
183
|
+
"refField": "obligationId",
|
|
184
|
+
"statuses": [
|
|
185
|
+
"paid"
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
],
|
|
189
|
+
"setsAt": {
|
|
190
|
+
"field": "installment1DelinquentAfter",
|
|
191
|
+
"marker": true,
|
|
192
|
+
"offset": "PT1S"
|
|
193
|
+
},
|
|
194
|
+
"steps": [],
|
|
195
|
+
"summary": "Mark installment 1 delinquent only when its due anchor is unmet"
|
|
196
|
+
},
|
|
197
|
+
"mark_installment_2_delinquent": {
|
|
198
|
+
"due": {
|
|
199
|
+
"field": "firstDueAt",
|
|
200
|
+
"offset": "P30D"
|
|
201
|
+
},
|
|
202
|
+
"effects": {
|
|
203
|
+
"reads": [
|
|
204
|
+
{
|
|
205
|
+
"signature": "reads.requires_aggregate",
|
|
206
|
+
"source": "requiresAggregate"
|
|
207
|
+
}
|
|
208
|
+
],
|
|
209
|
+
"schedules": [
|
|
210
|
+
{
|
|
211
|
+
"signature": "schedules.due",
|
|
212
|
+
"source": "due"
|
|
213
|
+
}
|
|
214
|
+
]
|
|
215
|
+
},
|
|
216
|
+
"moves": [],
|
|
217
|
+
"requiresAggregate": [
|
|
218
|
+
{
|
|
219
|
+
"check": {
|
|
220
|
+
"amountField": "amount",
|
|
221
|
+
"kind": "sum_below",
|
|
222
|
+
"targetField": "installment2Amount"
|
|
223
|
+
},
|
|
224
|
+
"instrumentId": "obligation_installment_2_payment",
|
|
225
|
+
"over": "children",
|
|
226
|
+
"refField": "obligationId",
|
|
227
|
+
"statuses": [
|
|
228
|
+
"paid"
|
|
229
|
+
]
|
|
230
|
+
}
|
|
231
|
+
],
|
|
232
|
+
"setsAt": {
|
|
233
|
+
"field": "installment2DelinquentAfter",
|
|
234
|
+
"marker": true,
|
|
235
|
+
"offset": "PT1S"
|
|
236
|
+
},
|
|
237
|
+
"steps": [],
|
|
238
|
+
"summary": "Mark installment 2 delinquent only when its due anchor is unmet"
|
|
239
|
+
},
|
|
240
|
+
"write_off": {
|
|
241
|
+
"agentDescription": "Write off the remaining exposure and stop the obligation. No money moves and nothing is refunded. This is the bookkeeping exit for debt that will not be collected. A written-off obligation never returns to repayment.",
|
|
242
|
+
"moves": [],
|
|
243
|
+
"publicAction": "writeOffObligation",
|
|
244
|
+
"steps": [],
|
|
245
|
+
"summary": "Write off the remaining exposure without moving money"
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
"agentDescription": "Reach for scheduled when one payer owes one payee on a calendar. It covers a plan of fixed installments partitioning one total, an obligation whose installments are paid through child payment records and can go delinquent, and an open period charge that repeats until a cancel port fires. Rotating pool is for a group taking turns.",
|
|
249
|
+
"aggregateInvariants": [
|
|
250
|
+
{
|
|
251
|
+
"childField": "amount",
|
|
252
|
+
"childInstrumentId": "obligation_installment_1_payment",
|
|
253
|
+
"childRefField": "obligationId",
|
|
254
|
+
"childStatuses": [
|
|
255
|
+
"paid"
|
|
256
|
+
],
|
|
257
|
+
"parentField": "installment1Amount"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"childField": "amount",
|
|
261
|
+
"childInstrumentId": "obligation_installment_2_payment",
|
|
262
|
+
"childRefField": "obligationId",
|
|
263
|
+
"childStatuses": [
|
|
264
|
+
"paid"
|
|
265
|
+
],
|
|
266
|
+
"parentField": "installment2Amount"
|
|
267
|
+
}
|
|
268
|
+
],
|
|
269
|
+
"description": "Installment obligation for debtor; repayment source pays recipient against exact stored anchors",
|
|
270
|
+
"fields": {
|
|
271
|
+
"currency": {
|
|
272
|
+
"description": "ISO 4217 currency code",
|
|
273
|
+
"maxLength": 3,
|
|
274
|
+
"minLength": 3,
|
|
275
|
+
"pattern": "^[A-Z]{3}$",
|
|
276
|
+
"type": "string"
|
|
277
|
+
},
|
|
278
|
+
"debtorAccountId": {
|
|
279
|
+
"description": "The debtor account",
|
|
280
|
+
"pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
|
|
281
|
+
"type": "string",
|
|
282
|
+
"x-hyperscale-reference-filter": {
|
|
283
|
+
"column": "role",
|
|
284
|
+
"values": [
|
|
285
|
+
"customer_balance"
|
|
286
|
+
]
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
"firstDueAt": {
|
|
290
|
+
"description": "Due date of the first installment; later anchors use fixed offsets of P30D",
|
|
291
|
+
"format": "hyperscale-date-time",
|
|
292
|
+
"type": "string"
|
|
293
|
+
},
|
|
294
|
+
"installment1Amount": {
|
|
295
|
+
"description": "Stored amount for installment 1 of 2 (carries the integer-division remainder)",
|
|
296
|
+
"pattern": "^[1-9][0-9]{0,17}$",
|
|
297
|
+
"type": "string"
|
|
298
|
+
},
|
|
299
|
+
"installment1DelinquentAfter": {
|
|
300
|
+
"description": "Machine-set marker proving installment 1 reached its stored due date while unpaid",
|
|
301
|
+
"format": "hyperscale-date-time",
|
|
302
|
+
"type": "string"
|
|
303
|
+
},
|
|
304
|
+
"installment2Amount": {
|
|
305
|
+
"description": "Stored amount for installment 2 of 2",
|
|
306
|
+
"pattern": "^[1-9][0-9]{0,17}$",
|
|
307
|
+
"type": "string"
|
|
308
|
+
},
|
|
309
|
+
"installment2DelinquentAfter": {
|
|
310
|
+
"description": "Machine-set marker proving installment 2 reached its stored due date while unpaid",
|
|
311
|
+
"format": "hyperscale-date-time",
|
|
312
|
+
"type": "string"
|
|
313
|
+
},
|
|
314
|
+
"principal": {
|
|
315
|
+
"description": "The principal in SAR minor units; the stored installment anchors partition it exactly",
|
|
316
|
+
"pattern": "^[1-9][0-9]{0,17}$",
|
|
317
|
+
"type": "string"
|
|
318
|
+
},
|
|
319
|
+
"recipientAccountId": {
|
|
320
|
+
"description": "The recipient account",
|
|
321
|
+
"pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
|
|
322
|
+
"type": "string",
|
|
323
|
+
"x-hyperscale-reference-filter": {
|
|
324
|
+
"column": "role",
|
|
325
|
+
"values": [
|
|
326
|
+
"customer_balance"
|
|
327
|
+
]
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
"repaymentSourceAccountId": {
|
|
331
|
+
"description": "The repayment source account",
|
|
332
|
+
"pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
|
|
333
|
+
"type": "string",
|
|
334
|
+
"x-hyperscale-reference-filter": {
|
|
335
|
+
"column": "role",
|
|
336
|
+
"values": [
|
|
337
|
+
"customer_balance"
|
|
338
|
+
]
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
"id": "obligation",
|
|
343
|
+
"idPrefix": "obli",
|
|
344
|
+
"lifecycle": {
|
|
345
|
+
"initial": "draft",
|
|
346
|
+
"states": [
|
|
347
|
+
"draft",
|
|
348
|
+
"active",
|
|
349
|
+
"installment_1_delinquent",
|
|
350
|
+
"installment_2_delinquent",
|
|
351
|
+
"written_off",
|
|
352
|
+
"repaid"
|
|
353
|
+
],
|
|
354
|
+
"transitions": {
|
|
355
|
+
"approve": {
|
|
356
|
+
"from": [
|
|
357
|
+
"draft"
|
|
358
|
+
],
|
|
359
|
+
"to": "active"
|
|
360
|
+
},
|
|
361
|
+
"collect_installment_1": {
|
|
362
|
+
"from": [
|
|
363
|
+
"installment_1_delinquent",
|
|
364
|
+
"installment_2_delinquent"
|
|
365
|
+
],
|
|
366
|
+
"to": "active"
|
|
367
|
+
},
|
|
368
|
+
"collect_installment_2": {
|
|
369
|
+
"from": [
|
|
370
|
+
"installment_1_delinquent",
|
|
371
|
+
"installment_2_delinquent"
|
|
372
|
+
],
|
|
373
|
+
"to": "active"
|
|
374
|
+
},
|
|
375
|
+
"complete": {
|
|
376
|
+
"from": [
|
|
377
|
+
"active",
|
|
378
|
+
"installment_1_delinquent",
|
|
379
|
+
"installment_2_delinquent"
|
|
380
|
+
],
|
|
381
|
+
"to": "repaid"
|
|
382
|
+
},
|
|
383
|
+
"mark_installment_1_delinquent": {
|
|
384
|
+
"from": [
|
|
385
|
+
"active",
|
|
386
|
+
"installment_2_delinquent"
|
|
387
|
+
],
|
|
388
|
+
"to": "installment_1_delinquent"
|
|
389
|
+
},
|
|
390
|
+
"mark_installment_2_delinquent": {
|
|
391
|
+
"from": [
|
|
392
|
+
"active",
|
|
393
|
+
"installment_1_delinquent"
|
|
394
|
+
],
|
|
395
|
+
"to": "installment_2_delinquent"
|
|
396
|
+
},
|
|
397
|
+
"write_off": {
|
|
398
|
+
"from": [
|
|
399
|
+
"draft",
|
|
400
|
+
"active",
|
|
401
|
+
"installment_1_delinquent",
|
|
402
|
+
"installment_2_delinquent"
|
|
403
|
+
],
|
|
404
|
+
"to": "written_off"
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
},
|
|
408
|
+
"parties": {
|
|
409
|
+
"beneficiary": "recipientAccountId",
|
|
410
|
+
"payer": "repaymentSourceAccountId"
|
|
411
|
+
},
|
|
412
|
+
"partitions": [
|
|
413
|
+
{
|
|
414
|
+
"pieceFields": [
|
|
415
|
+
"installment1Amount",
|
|
416
|
+
"installment2Amount"
|
|
417
|
+
],
|
|
418
|
+
"totalField": "principal"
|
|
419
|
+
}
|
|
420
|
+
],
|
|
421
|
+
"required": [
|
|
422
|
+
"recipientAccountId",
|
|
423
|
+
"repaymentSourceAccountId",
|
|
424
|
+
"debtorAccountId",
|
|
425
|
+
"currency",
|
|
426
|
+
"principal",
|
|
427
|
+
"firstDueAt",
|
|
428
|
+
"installment1Amount",
|
|
429
|
+
"installment2Amount"
|
|
430
|
+
],
|
|
431
|
+
"summary": "2-anchor obligation for debtor",
|
|
432
|
+
"title": "Obligation"
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
"actionOrder": [
|
|
436
|
+
"create",
|
|
437
|
+
"repay",
|
|
438
|
+
"refund"
|
|
439
|
+
],
|
|
440
|
+
"actions": {
|
|
441
|
+
"create": {
|
|
442
|
+
"agentDescription": "Open a payment record against installment 1. The parent obligation must be live. No money moves yet. Repay is what pays.",
|
|
443
|
+
"effects": {
|
|
444
|
+
"reads": [
|
|
445
|
+
{
|
|
446
|
+
"signature": "reads.requires_refs",
|
|
447
|
+
"source": "requiresRefs"
|
|
448
|
+
}
|
|
449
|
+
]
|
|
450
|
+
},
|
|
451
|
+
"moves": [],
|
|
452
|
+
"publicAction": "createObligationInstallment1Payment",
|
|
453
|
+
"requiresRefs": [
|
|
454
|
+
{
|
|
455
|
+
"bind": {
|
|
456
|
+
"currency": "fields.currency",
|
|
457
|
+
"recipientAccountId": "fields.recipientAccountId",
|
|
458
|
+
"repaymentSourceAccountId": "fields.repaymentSourceAccountId"
|
|
459
|
+
},
|
|
460
|
+
"field": "obligationId",
|
|
461
|
+
"statuses": [
|
|
462
|
+
"active",
|
|
463
|
+
"installment_1_delinquent",
|
|
464
|
+
"installment_2_delinquent"
|
|
465
|
+
]
|
|
466
|
+
}
|
|
467
|
+
],
|
|
468
|
+
"steps": [],
|
|
469
|
+
"summary": "Create a payment record for installment 1"
|
|
470
|
+
},
|
|
471
|
+
"refund": {
|
|
472
|
+
"agentDescription": "Return one whole installment 1 payment to the payer. The record must be paid, and the refund is always its full amount, so split a payment across records when a partial refund could be needed. This moves money back.",
|
|
473
|
+
"effects": {
|
|
474
|
+
"moves": [
|
|
475
|
+
{
|
|
476
|
+
"signature": "moves.transfer.internal",
|
|
477
|
+
"source": "moves[0]"
|
|
478
|
+
}
|
|
479
|
+
],
|
|
480
|
+
"reads": [
|
|
481
|
+
{
|
|
482
|
+
"signature": "reads.requires_refs",
|
|
483
|
+
"source": "requiresRefs"
|
|
484
|
+
}
|
|
485
|
+
]
|
|
486
|
+
},
|
|
487
|
+
"moves": [
|
|
488
|
+
{
|
|
489
|
+
"bind": {
|
|
490
|
+
"amount": {
|
|
491
|
+
"from": "instance",
|
|
492
|
+
"path": "fields.amount"
|
|
493
|
+
},
|
|
494
|
+
"currency": {
|
|
495
|
+
"from": "instance",
|
|
496
|
+
"path": "fields.currency"
|
|
497
|
+
},
|
|
498
|
+
"destinationAccountId": {
|
|
499
|
+
"from": "instance",
|
|
500
|
+
"path": "fields.repaymentSourceAccountId"
|
|
501
|
+
},
|
|
502
|
+
"metadata.instrumentId": {
|
|
503
|
+
"from": "const",
|
|
504
|
+
"value": "obligation_installment_1_payment"
|
|
505
|
+
},
|
|
506
|
+
"metadata.instrumentInstanceId": {
|
|
507
|
+
"from": "instance",
|
|
508
|
+
"path": "instrumentInstanceId"
|
|
509
|
+
},
|
|
510
|
+
"metadata.phase": {
|
|
511
|
+
"from": "const",
|
|
512
|
+
"value": "refund"
|
|
513
|
+
},
|
|
514
|
+
"productId": {
|
|
515
|
+
"from": "instance",
|
|
516
|
+
"path": "productId"
|
|
517
|
+
},
|
|
518
|
+
"sourceAccountId": {
|
|
519
|
+
"from": "instance",
|
|
520
|
+
"path": "fields.recipientAccountId"
|
|
521
|
+
}
|
|
522
|
+
},
|
|
523
|
+
"capture": {
|
|
524
|
+
"refundRefundTransferId": "transferId"
|
|
525
|
+
},
|
|
526
|
+
"key": "refund",
|
|
527
|
+
"operation": "internal_transfer.create"
|
|
528
|
+
}
|
|
529
|
+
],
|
|
530
|
+
"publicAction": "refundObligationInstallment1Payment",
|
|
531
|
+
"requiresRefs": [
|
|
532
|
+
{
|
|
533
|
+
"field": "obligationId",
|
|
534
|
+
"match": {
|
|
535
|
+
"fields.currency": "fields.currency",
|
|
536
|
+
"fields.recipientAccountId": "fields.recipientAccountId",
|
|
537
|
+
"fields.repaymentSourceAccountId": "fields.repaymentSourceAccountId"
|
|
538
|
+
},
|
|
539
|
+
"statuses": [
|
|
540
|
+
"active",
|
|
541
|
+
"installment_1_delinquent",
|
|
542
|
+
"installment_2_delinquent"
|
|
543
|
+
]
|
|
544
|
+
}
|
|
545
|
+
],
|
|
546
|
+
"steps": [],
|
|
547
|
+
"summary": "Refund this one stored installment 1 payment whole"
|
|
548
|
+
},
|
|
549
|
+
"repay": {
|
|
550
|
+
"agentDescription": "Pay this record's amount toward installment 1. The record must be created and its obligation live. Refused when this amount plus the records already paid against that installment would pass the stored amount. This moves the payer's money. Where a mandate applies, only the payer may call it and an evidence reference is required.",
|
|
551
|
+
"captureInput": {
|
|
552
|
+
"mandateEvidenceReference": "evidenceReference"
|
|
553
|
+
},
|
|
554
|
+
"effects": {
|
|
555
|
+
"decides": [
|
|
556
|
+
{
|
|
557
|
+
"signature": "decides.tenant_port",
|
|
558
|
+
"source": "port"
|
|
559
|
+
}
|
|
560
|
+
],
|
|
561
|
+
"moves": [
|
|
562
|
+
{
|
|
563
|
+
"signature": "moves.transfer.internal",
|
|
564
|
+
"source": "moves[0]"
|
|
565
|
+
}
|
|
566
|
+
],
|
|
567
|
+
"reads": [
|
|
568
|
+
{
|
|
569
|
+
"signature": "reads.requires_refs",
|
|
570
|
+
"source": "requiresRefs"
|
|
571
|
+
}
|
|
572
|
+
]
|
|
573
|
+
},
|
|
574
|
+
"input": {
|
|
575
|
+
"additionalProperties": false,
|
|
576
|
+
"properties": {
|
|
577
|
+
"evidenceReference": {
|
|
578
|
+
"description": "Required decision reference retained in the operation receipt",
|
|
579
|
+
"maxLength": 180,
|
|
580
|
+
"minLength": 1,
|
|
581
|
+
"type": "string"
|
|
582
|
+
}
|
|
583
|
+
},
|
|
584
|
+
"required": [
|
|
585
|
+
"evidenceReference"
|
|
586
|
+
],
|
|
587
|
+
"type": "object"
|
|
588
|
+
},
|
|
589
|
+
"moves": [
|
|
590
|
+
{
|
|
591
|
+
"bind": {
|
|
592
|
+
"amount": {
|
|
593
|
+
"from": "instance",
|
|
594
|
+
"path": "fields.amount"
|
|
595
|
+
},
|
|
596
|
+
"currency": {
|
|
597
|
+
"from": "instance",
|
|
598
|
+
"path": "fields.currency"
|
|
599
|
+
},
|
|
600
|
+
"destinationAccountId": {
|
|
601
|
+
"from": "instance",
|
|
602
|
+
"path": "fields.recipientAccountId"
|
|
603
|
+
},
|
|
604
|
+
"metadata.instrumentId": {
|
|
605
|
+
"from": "const",
|
|
606
|
+
"value": "obligation_installment_1_payment"
|
|
607
|
+
},
|
|
608
|
+
"metadata.instrumentInstanceId": {
|
|
609
|
+
"from": "instance",
|
|
610
|
+
"path": "instrumentInstanceId"
|
|
611
|
+
},
|
|
612
|
+
"metadata.phase": {
|
|
613
|
+
"from": "const",
|
|
614
|
+
"value": "repay"
|
|
615
|
+
},
|
|
616
|
+
"productId": {
|
|
617
|
+
"from": "instance",
|
|
618
|
+
"path": "productId"
|
|
619
|
+
},
|
|
620
|
+
"sourceAccountId": {
|
|
621
|
+
"from": "instance",
|
|
622
|
+
"path": "fields.repaymentSourceAccountId"
|
|
623
|
+
}
|
|
624
|
+
},
|
|
625
|
+
"capture": {
|
|
626
|
+
"repayRepaymentTransferId": "transferId"
|
|
627
|
+
},
|
|
628
|
+
"key": "repayment",
|
|
629
|
+
"operation": "internal_transfer.create"
|
|
630
|
+
}
|
|
631
|
+
],
|
|
632
|
+
"port": {
|
|
633
|
+
"allowedParties": [
|
|
634
|
+
"payer"
|
|
635
|
+
]
|
|
636
|
+
},
|
|
637
|
+
"publicAction": "repayObligationInstallment1Payment",
|
|
638
|
+
"requiresExposure": [
|
|
639
|
+
{
|
|
640
|
+
"amountField": "amount",
|
|
641
|
+
"anchorField": "obligationId",
|
|
642
|
+
"capField": "installment1Amount",
|
|
643
|
+
"capOnAnchor": true,
|
|
644
|
+
"childInstrumentId": "obligation_installment_1_payment",
|
|
645
|
+
"statuses": [
|
|
646
|
+
"paid"
|
|
647
|
+
]
|
|
648
|
+
}
|
|
649
|
+
],
|
|
650
|
+
"requiresRefs": [
|
|
651
|
+
{
|
|
652
|
+
"field": "obligationId",
|
|
653
|
+
"match": {
|
|
654
|
+
"fields.currency": "fields.currency",
|
|
655
|
+
"fields.recipientAccountId": "fields.recipientAccountId",
|
|
656
|
+
"fields.repaymentSourceAccountId": "fields.repaymentSourceAccountId"
|
|
657
|
+
},
|
|
658
|
+
"statuses": [
|
|
659
|
+
"active",
|
|
660
|
+
"installment_1_delinquent",
|
|
661
|
+
"installment_2_delinquent"
|
|
662
|
+
]
|
|
663
|
+
}
|
|
664
|
+
],
|
|
665
|
+
"steps": [],
|
|
666
|
+
"summary": "Pay a partial or full amount against installment 1"
|
|
667
|
+
}
|
|
668
|
+
},
|
|
669
|
+
"agentDescription": "One payment against installment 1 of the obligation. Payments can be partial, so create a record, repay it, and the parent installment closes once its paid records sum to the stored anchor amount.",
|
|
670
|
+
"description": "One partial or full payment bound to installment 1 of obligation; the operation name fixes the anchor and obligationId fixes the obligation",
|
|
671
|
+
"fields": {
|
|
672
|
+
"amount": {
|
|
673
|
+
"description": "Positive payment amount capped with its paid siblings at installment1Amount",
|
|
674
|
+
"pattern": "^[1-9][0-9]{0,17}$",
|
|
675
|
+
"type": "string"
|
|
676
|
+
},
|
|
677
|
+
"currency": {
|
|
678
|
+
"description": "ISO 4217 currency code",
|
|
679
|
+
"maxLength": 3,
|
|
680
|
+
"minLength": 3,
|
|
681
|
+
"pattern": "^[A-Z]{3}$",
|
|
682
|
+
"type": "string"
|
|
683
|
+
},
|
|
684
|
+
"obligationId": {
|
|
685
|
+
"description": "The exact obligation this payment belongs to",
|
|
686
|
+
"pattern": "^obli_(sandbox|live)_[a-z0-9]{8,64}$",
|
|
687
|
+
"type": "string"
|
|
688
|
+
},
|
|
689
|
+
"recipientAccountId": {
|
|
690
|
+
"description": "The recipient account",
|
|
691
|
+
"pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
|
|
692
|
+
"type": "string",
|
|
693
|
+
"x-hyperscale-reference-filter": {
|
|
694
|
+
"column": "role",
|
|
695
|
+
"values": [
|
|
696
|
+
"customer_balance"
|
|
697
|
+
]
|
|
698
|
+
}
|
|
699
|
+
},
|
|
700
|
+
"repaymentSourceAccountId": {
|
|
701
|
+
"description": "The repayment source account",
|
|
702
|
+
"pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
|
|
703
|
+
"type": "string",
|
|
704
|
+
"x-hyperscale-reference-filter": {
|
|
705
|
+
"column": "role",
|
|
706
|
+
"values": [
|
|
707
|
+
"customer_balance"
|
|
708
|
+
]
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
},
|
|
712
|
+
"id": "obligation_installment_1_payment",
|
|
713
|
+
"idPrefix": "zzaa",
|
|
714
|
+
"lifecycle": {
|
|
715
|
+
"initial": "created",
|
|
716
|
+
"states": [
|
|
717
|
+
"created",
|
|
718
|
+
"paid",
|
|
719
|
+
"refunded"
|
|
720
|
+
],
|
|
721
|
+
"transitions": {
|
|
722
|
+
"refund": {
|
|
723
|
+
"from": [
|
|
724
|
+
"paid"
|
|
725
|
+
],
|
|
726
|
+
"to": "refunded"
|
|
727
|
+
},
|
|
728
|
+
"repay": {
|
|
729
|
+
"from": [
|
|
730
|
+
"created"
|
|
731
|
+
],
|
|
732
|
+
"to": "paid"
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
},
|
|
736
|
+
"parties": {
|
|
737
|
+
"beneficiary": "recipientAccountId",
|
|
738
|
+
"payer": "repaymentSourceAccountId"
|
|
739
|
+
},
|
|
740
|
+
"required": [
|
|
741
|
+
"recipientAccountId",
|
|
742
|
+
"repaymentSourceAccountId",
|
|
743
|
+
"amount",
|
|
744
|
+
"currency",
|
|
745
|
+
"obligationId"
|
|
746
|
+
],
|
|
747
|
+
"summary": "Anchor-bound payment for installment 1",
|
|
748
|
+
"title": "Obligation Installment 1 Payment"
|
|
749
|
+
},
|
|
750
|
+
{
|
|
751
|
+
"actionOrder": [
|
|
752
|
+
"create",
|
|
753
|
+
"repay",
|
|
754
|
+
"refund"
|
|
755
|
+
],
|
|
756
|
+
"actions": {
|
|
757
|
+
"create": {
|
|
758
|
+
"agentDescription": "Open a payment record against installment 2. The parent obligation must be live. No money moves yet. Repay is what pays.",
|
|
759
|
+
"effects": {
|
|
760
|
+
"reads": [
|
|
761
|
+
{
|
|
762
|
+
"signature": "reads.requires_refs",
|
|
763
|
+
"source": "requiresRefs"
|
|
764
|
+
}
|
|
765
|
+
]
|
|
766
|
+
},
|
|
767
|
+
"moves": [],
|
|
768
|
+
"publicAction": "createObligationInstallment2Payment",
|
|
769
|
+
"requiresRefs": [
|
|
770
|
+
{
|
|
771
|
+
"bind": {
|
|
772
|
+
"currency": "fields.currency",
|
|
773
|
+
"recipientAccountId": "fields.recipientAccountId",
|
|
774
|
+
"repaymentSourceAccountId": "fields.repaymentSourceAccountId"
|
|
775
|
+
},
|
|
776
|
+
"field": "obligationId",
|
|
777
|
+
"statuses": [
|
|
778
|
+
"active",
|
|
779
|
+
"installment_1_delinquent",
|
|
780
|
+
"installment_2_delinquent"
|
|
781
|
+
]
|
|
782
|
+
}
|
|
783
|
+
],
|
|
784
|
+
"steps": [],
|
|
785
|
+
"summary": "Create a payment record for installment 2"
|
|
786
|
+
},
|
|
787
|
+
"refund": {
|
|
788
|
+
"agentDescription": "Return one whole installment 2 payment to the payer. The record must be paid, and the refund is always its full amount, so split a payment across records when a partial refund could be needed. This moves money back.",
|
|
789
|
+
"effects": {
|
|
790
|
+
"moves": [
|
|
791
|
+
{
|
|
792
|
+
"signature": "moves.transfer.internal",
|
|
793
|
+
"source": "moves[0]"
|
|
794
|
+
}
|
|
795
|
+
],
|
|
796
|
+
"reads": [
|
|
797
|
+
{
|
|
798
|
+
"signature": "reads.requires_refs",
|
|
799
|
+
"source": "requiresRefs"
|
|
800
|
+
}
|
|
801
|
+
]
|
|
802
|
+
},
|
|
803
|
+
"moves": [
|
|
804
|
+
{
|
|
805
|
+
"bind": {
|
|
806
|
+
"amount": {
|
|
807
|
+
"from": "instance",
|
|
808
|
+
"path": "fields.amount"
|
|
809
|
+
},
|
|
810
|
+
"currency": {
|
|
811
|
+
"from": "instance",
|
|
812
|
+
"path": "fields.currency"
|
|
813
|
+
},
|
|
814
|
+
"destinationAccountId": {
|
|
815
|
+
"from": "instance",
|
|
816
|
+
"path": "fields.repaymentSourceAccountId"
|
|
817
|
+
},
|
|
818
|
+
"metadata.instrumentId": {
|
|
819
|
+
"from": "const",
|
|
820
|
+
"value": "obligation_installment_2_payment"
|
|
821
|
+
},
|
|
822
|
+
"metadata.instrumentInstanceId": {
|
|
823
|
+
"from": "instance",
|
|
824
|
+
"path": "instrumentInstanceId"
|
|
825
|
+
},
|
|
826
|
+
"metadata.phase": {
|
|
827
|
+
"from": "const",
|
|
828
|
+
"value": "refund"
|
|
829
|
+
},
|
|
830
|
+
"productId": {
|
|
831
|
+
"from": "instance",
|
|
832
|
+
"path": "productId"
|
|
833
|
+
},
|
|
834
|
+
"sourceAccountId": {
|
|
835
|
+
"from": "instance",
|
|
836
|
+
"path": "fields.recipientAccountId"
|
|
837
|
+
}
|
|
838
|
+
},
|
|
839
|
+
"capture": {
|
|
840
|
+
"refundRefundTransferId": "transferId"
|
|
841
|
+
},
|
|
842
|
+
"key": "refund",
|
|
843
|
+
"operation": "internal_transfer.create"
|
|
844
|
+
}
|
|
845
|
+
],
|
|
846
|
+
"publicAction": "refundObligationInstallment2Payment",
|
|
847
|
+
"requiresRefs": [
|
|
848
|
+
{
|
|
849
|
+
"field": "obligationId",
|
|
850
|
+
"match": {
|
|
851
|
+
"fields.currency": "fields.currency",
|
|
852
|
+
"fields.recipientAccountId": "fields.recipientAccountId",
|
|
853
|
+
"fields.repaymentSourceAccountId": "fields.repaymentSourceAccountId"
|
|
854
|
+
},
|
|
855
|
+
"statuses": [
|
|
856
|
+
"active",
|
|
857
|
+
"installment_1_delinquent",
|
|
858
|
+
"installment_2_delinquent"
|
|
859
|
+
]
|
|
860
|
+
}
|
|
861
|
+
],
|
|
862
|
+
"steps": [],
|
|
863
|
+
"summary": "Refund this one stored installment 2 payment whole"
|
|
864
|
+
},
|
|
865
|
+
"repay": {
|
|
866
|
+
"agentDescription": "Pay this record's amount toward installment 2. The record must be created and its obligation live. Refused when this amount plus the records already paid against that installment would pass the stored amount. This moves the payer's money. Where a mandate applies, only the payer may call it and an evidence reference is required.",
|
|
867
|
+
"captureInput": {
|
|
868
|
+
"mandateEvidenceReference": "evidenceReference"
|
|
869
|
+
},
|
|
870
|
+
"effects": {
|
|
871
|
+
"decides": [
|
|
872
|
+
{
|
|
873
|
+
"signature": "decides.tenant_port",
|
|
874
|
+
"source": "port"
|
|
875
|
+
}
|
|
876
|
+
],
|
|
877
|
+
"moves": [
|
|
878
|
+
{
|
|
879
|
+
"signature": "moves.transfer.internal",
|
|
880
|
+
"source": "moves[0]"
|
|
881
|
+
}
|
|
882
|
+
],
|
|
883
|
+
"reads": [
|
|
884
|
+
{
|
|
885
|
+
"signature": "reads.requires_refs",
|
|
886
|
+
"source": "requiresRefs"
|
|
887
|
+
}
|
|
888
|
+
]
|
|
889
|
+
},
|
|
890
|
+
"input": {
|
|
891
|
+
"additionalProperties": false,
|
|
892
|
+
"properties": {
|
|
893
|
+
"evidenceReference": {
|
|
894
|
+
"description": "Required decision reference retained in the operation receipt",
|
|
895
|
+
"maxLength": 180,
|
|
896
|
+
"minLength": 1,
|
|
897
|
+
"type": "string"
|
|
898
|
+
}
|
|
899
|
+
},
|
|
900
|
+
"required": [
|
|
901
|
+
"evidenceReference"
|
|
902
|
+
],
|
|
903
|
+
"type": "object"
|
|
904
|
+
},
|
|
905
|
+
"moves": [
|
|
906
|
+
{
|
|
907
|
+
"bind": {
|
|
908
|
+
"amount": {
|
|
909
|
+
"from": "instance",
|
|
910
|
+
"path": "fields.amount"
|
|
911
|
+
},
|
|
912
|
+
"currency": {
|
|
913
|
+
"from": "instance",
|
|
914
|
+
"path": "fields.currency"
|
|
915
|
+
},
|
|
916
|
+
"destinationAccountId": {
|
|
917
|
+
"from": "instance",
|
|
918
|
+
"path": "fields.recipientAccountId"
|
|
919
|
+
},
|
|
920
|
+
"metadata.instrumentId": {
|
|
921
|
+
"from": "const",
|
|
922
|
+
"value": "obligation_installment_2_payment"
|
|
923
|
+
},
|
|
924
|
+
"metadata.instrumentInstanceId": {
|
|
925
|
+
"from": "instance",
|
|
926
|
+
"path": "instrumentInstanceId"
|
|
927
|
+
},
|
|
928
|
+
"metadata.phase": {
|
|
929
|
+
"from": "const",
|
|
930
|
+
"value": "repay"
|
|
931
|
+
},
|
|
932
|
+
"productId": {
|
|
933
|
+
"from": "instance",
|
|
934
|
+
"path": "productId"
|
|
935
|
+
},
|
|
936
|
+
"sourceAccountId": {
|
|
937
|
+
"from": "instance",
|
|
938
|
+
"path": "fields.repaymentSourceAccountId"
|
|
939
|
+
}
|
|
940
|
+
},
|
|
941
|
+
"capture": {
|
|
942
|
+
"repayRepaymentTransferId": "transferId"
|
|
943
|
+
},
|
|
944
|
+
"key": "repayment",
|
|
945
|
+
"operation": "internal_transfer.create"
|
|
946
|
+
}
|
|
947
|
+
],
|
|
948
|
+
"port": {
|
|
949
|
+
"allowedParties": [
|
|
950
|
+
"payer"
|
|
951
|
+
]
|
|
952
|
+
},
|
|
953
|
+
"publicAction": "repayObligationInstallment2Payment",
|
|
954
|
+
"requiresExposure": [
|
|
955
|
+
{
|
|
956
|
+
"amountField": "amount",
|
|
957
|
+
"anchorField": "obligationId",
|
|
958
|
+
"capField": "installment2Amount",
|
|
959
|
+
"capOnAnchor": true,
|
|
960
|
+
"childInstrumentId": "obligation_installment_2_payment",
|
|
961
|
+
"statuses": [
|
|
962
|
+
"paid"
|
|
963
|
+
]
|
|
964
|
+
}
|
|
965
|
+
],
|
|
966
|
+
"requiresRefs": [
|
|
967
|
+
{
|
|
968
|
+
"field": "obligationId",
|
|
969
|
+
"match": {
|
|
970
|
+
"fields.currency": "fields.currency",
|
|
971
|
+
"fields.recipientAccountId": "fields.recipientAccountId",
|
|
972
|
+
"fields.repaymentSourceAccountId": "fields.repaymentSourceAccountId"
|
|
973
|
+
},
|
|
974
|
+
"statuses": [
|
|
975
|
+
"active",
|
|
976
|
+
"installment_1_delinquent",
|
|
977
|
+
"installment_2_delinquent"
|
|
978
|
+
]
|
|
979
|
+
}
|
|
980
|
+
],
|
|
981
|
+
"steps": [],
|
|
982
|
+
"summary": "Pay a partial or full amount against installment 2"
|
|
983
|
+
}
|
|
984
|
+
},
|
|
985
|
+
"agentDescription": "One payment against installment 2 of the obligation. Payments can be partial, so create a record, repay it, and the parent installment closes once its paid records sum to the stored anchor amount.",
|
|
986
|
+
"description": "One partial or full payment bound to installment 2 of obligation; the operation name fixes the anchor and obligationId fixes the obligation",
|
|
987
|
+
"fields": {
|
|
988
|
+
"amount": {
|
|
989
|
+
"description": "Positive payment amount capped with its paid siblings at installment2Amount",
|
|
990
|
+
"pattern": "^[1-9][0-9]{0,17}$",
|
|
991
|
+
"type": "string"
|
|
992
|
+
},
|
|
993
|
+
"currency": {
|
|
994
|
+
"description": "ISO 4217 currency code",
|
|
995
|
+
"maxLength": 3,
|
|
996
|
+
"minLength": 3,
|
|
997
|
+
"pattern": "^[A-Z]{3}$",
|
|
998
|
+
"type": "string"
|
|
999
|
+
},
|
|
1000
|
+
"obligationId": {
|
|
1001
|
+
"description": "The exact obligation this payment belongs to",
|
|
1002
|
+
"pattern": "^obli_(sandbox|live)_[a-z0-9]{8,64}$",
|
|
1003
|
+
"type": "string"
|
|
1004
|
+
},
|
|
1005
|
+
"recipientAccountId": {
|
|
1006
|
+
"description": "The recipient account",
|
|
1007
|
+
"pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
|
|
1008
|
+
"type": "string",
|
|
1009
|
+
"x-hyperscale-reference-filter": {
|
|
1010
|
+
"column": "role",
|
|
1011
|
+
"values": [
|
|
1012
|
+
"customer_balance"
|
|
1013
|
+
]
|
|
1014
|
+
}
|
|
1015
|
+
},
|
|
1016
|
+
"repaymentSourceAccountId": {
|
|
1017
|
+
"description": "The repayment source account",
|
|
1018
|
+
"pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
|
|
1019
|
+
"type": "string",
|
|
1020
|
+
"x-hyperscale-reference-filter": {
|
|
1021
|
+
"column": "role",
|
|
1022
|
+
"values": [
|
|
1023
|
+
"customer_balance"
|
|
1024
|
+
]
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
},
|
|
1028
|
+
"id": "obligation_installment_2_payment",
|
|
1029
|
+
"idPrefix": "zzab",
|
|
1030
|
+
"lifecycle": {
|
|
1031
|
+
"initial": "created",
|
|
1032
|
+
"states": [
|
|
1033
|
+
"created",
|
|
1034
|
+
"paid",
|
|
1035
|
+
"refunded"
|
|
1036
|
+
],
|
|
1037
|
+
"transitions": {
|
|
1038
|
+
"refund": {
|
|
1039
|
+
"from": [
|
|
1040
|
+
"paid"
|
|
1041
|
+
],
|
|
1042
|
+
"to": "refunded"
|
|
1043
|
+
},
|
|
1044
|
+
"repay": {
|
|
1045
|
+
"from": [
|
|
1046
|
+
"created"
|
|
1047
|
+
],
|
|
1048
|
+
"to": "paid"
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
},
|
|
1052
|
+
"parties": {
|
|
1053
|
+
"beneficiary": "recipientAccountId",
|
|
1054
|
+
"payer": "repaymentSourceAccountId"
|
|
1055
|
+
},
|
|
1056
|
+
"required": [
|
|
1057
|
+
"recipientAccountId",
|
|
1058
|
+
"repaymentSourceAccountId",
|
|
1059
|
+
"amount",
|
|
1060
|
+
"currency",
|
|
1061
|
+
"obligationId"
|
|
1062
|
+
],
|
|
1063
|
+
"summary": "Anchor-bound payment for installment 2",
|
|
1064
|
+
"title": "Obligation Installment 2 Payment"
|
|
1065
|
+
},
|
|
1066
|
+
{
|
|
1067
|
+
"actionOrder": [
|
|
1068
|
+
"create",
|
|
1069
|
+
"collect",
|
|
1070
|
+
"end"
|
|
1071
|
+
],
|
|
1072
|
+
"actions": {
|
|
1073
|
+
"collect": {
|
|
1074
|
+
"agentDescription": "Record one due installment as collected. The collection must still be active, and it stays active afterwards so the next installment can follow. It moves no money.",
|
|
1075
|
+
"moves": [],
|
|
1076
|
+
"publicAction": "collectCollection",
|
|
1077
|
+
"steps": [],
|
|
1078
|
+
"summary": "Collect one due installment"
|
|
1079
|
+
},
|
|
1080
|
+
"create": {
|
|
1081
|
+
"agentDescription": "Open the collection so installments can be recorded against it. This is the first call and the collection starts active. It moves no money.",
|
|
1082
|
+
"moves": [],
|
|
1083
|
+
"publicAction": "createCollection",
|
|
1084
|
+
"steps": [],
|
|
1085
|
+
"summary": "Create a bounded recurring collection"
|
|
1086
|
+
},
|
|
1087
|
+
"end": {
|
|
1088
|
+
"agentDescription": "Close the collection so no further installment can be recorded. Only an active collection can end, and ended is final. It moves no money.",
|
|
1089
|
+
"moves": [],
|
|
1090
|
+
"publicAction": "endCollection",
|
|
1091
|
+
"steps": [],
|
|
1092
|
+
"summary": "End future collections"
|
|
1093
|
+
}
|
|
1094
|
+
},
|
|
1095
|
+
"agentDescription": "Reach for collection to track a bounded run of scheduled collections, one call per recorded installment. It carries no amount and no account, and every action only advances its own state. A settlement that debits an account on a schedule is a different shape.",
|
|
1096
|
+
"fields": {},
|
|
1097
|
+
"id": "collection",
|
|
1098
|
+
"idPrefix": "coll",
|
|
1099
|
+
"lifecycle": {
|
|
1100
|
+
"initial": "active",
|
|
1101
|
+
"states": [
|
|
1102
|
+
"active",
|
|
1103
|
+
"ended"
|
|
1104
|
+
],
|
|
1105
|
+
"transitions": {
|
|
1106
|
+
"collect": {
|
|
1107
|
+
"from": [
|
|
1108
|
+
"active"
|
|
1109
|
+
],
|
|
1110
|
+
"to": "active"
|
|
1111
|
+
},
|
|
1112
|
+
"end": {
|
|
1113
|
+
"from": [
|
|
1114
|
+
"active"
|
|
1115
|
+
],
|
|
1116
|
+
"to": "ended"
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
},
|
|
1120
|
+
"required": [],
|
|
1121
|
+
"summary": "Collection instrument",
|
|
1122
|
+
"title": "Collection"
|
|
1123
|
+
}
|
|
1124
|
+
],
|
|
1125
|
+
"product": "recurring_collection_example",
|
|
1126
|
+
"subjects": [],
|
|
1127
|
+
"title": "Recurring collection example",
|
|
1128
|
+
"udl": 1,
|
|
1129
|
+
"version": 1
|
|
1130
|
+
}
|