@hyperscale0/udl 2.6.1 → 3.0.0

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.
Files changed (213) hide show
  1. package/CHANGELOG.md +2 -330
  2. package/LICENSING.md +1 -2
  3. package/README.md +3 -114
  4. package/TRADEMARKS.md +2 -2
  5. package/dist/diagnostics.d.ts +21 -201
  6. package/dist/diagnostics.d.ts.map +1 -1
  7. package/dist/diagnostics.js +29 -193
  8. package/dist/diagnostics.js.map +1 -1
  9. package/dist/evolution.d.ts +3 -132
  10. package/dist/evolution.d.ts.map +1 -1
  11. package/dist/evolution.js +29 -633
  12. package/dist/evolution.js.map +1 -1
  13. package/dist/finance.d.ts +5 -72
  14. package/dist/finance.d.ts.map +1 -1
  15. package/dist/finance.js +233 -737
  16. package/dist/finance.js.map +1 -1
  17. package/dist/index.d.ts +7 -18
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +7 -12
  20. package/dist/index.js.map +1 -1
  21. package/dist/instrument-references.d.ts.map +1 -1
  22. package/dist/instrument-references.js +3 -2
  23. package/dist/instrument-references.js.map +1 -1
  24. package/dist/schema.d.ts +2079 -4564
  25. package/dist/schema.d.ts.map +1 -1
  26. package/dist/schema.js +270 -1609
  27. package/dist/schema.js.map +1 -1
  28. package/dist/validation.d.ts +8 -104
  29. package/dist/validation.d.ts.map +1 -1
  30. package/dist/validation.js +653 -3271
  31. package/dist/validation.js.map +1 -1
  32. package/docs/README.md +147 -14
  33. package/package.json +7 -11
  34. package/spec/README.md +151 -164
  35. package/spec/darb.udl.json +249 -0
  36. package/spec/udl.schema.json +4104 -3202
  37. package/src/diagnostics.ts +51 -246
  38. package/src/evolution.ts +39 -1045
  39. package/src/finance.ts +287 -1127
  40. package/src/index.ts +18 -142
  41. package/src/instrument-references.ts +3 -2
  42. package/src/schema.ts +285 -1843
  43. package/src/validation.ts +870 -5611
  44. package/conformance/README.md +0 -82
  45. package/conformance/evolution/action-contract.expected.json +0 -10
  46. package/conformance/evolution/action-contract.live.udl +0 -44
  47. package/conformance/evolution/action-contract.next.udl +0 -45
  48. package/conformance/evolution/product-identity.expected.json +0 -10
  49. package/conformance/evolution/product-identity.live.udl +0 -55
  50. package/conformance/evolution/product-identity.next.udl +0 -55
  51. package/conformance/evolution/version-required.expected.json +0 -10
  52. package/conformance/evolution/version-required.live.udl +0 -55
  53. package/conformance/evolution/version-required.next.udl +0 -58
  54. package/conformance/invalid/action-without-transition.expected.json +0 -10
  55. package/conformance/invalid/action-without-transition.udl +0 -60
  56. package/conformance/invalid/agent-description-too-long.expected.json +0 -10
  57. package/conformance/invalid/agent-description-too-long.udl +0 -57
  58. package/conformance/invalid/blank-title.expected.json +0 -10
  59. package/conformance/invalid/blank-title.udl +0 -54
  60. package/conformance/invalid/call-binds-results.expected.json +0 -10
  61. package/conformance/invalid/call-binds-results.udl +0 -314
  62. package/conformance/invalid/call-unknown-action.expected.json +0 -10
  63. package/conformance/invalid/call-unknown-action.udl +0 -314
  64. package/conformance/invalid/composition-dial-duplicate-key.expected.json +0 -10
  65. package/conformance/invalid/composition-dial-duplicate-key.udl +0 -73
  66. package/conformance/invalid/depth-budget.expected.json +0 -10
  67. package/conformance/invalid/depth-budget.udl +0 -49
  68. package/conformance/invalid/duplicate-subject.expected.json +0 -10
  69. package/conformance/invalid/duplicate-subject.udl +0 -230
  70. package/conformance/invalid/forged-effects.expected.json +0 -10
  71. package/conformance/invalid/forged-effects.udl +0 -76
  72. package/conformance/invalid/format-version.expected.json +0 -10
  73. package/conformance/invalid/format-version.udl +0 -54
  74. package/conformance/invalid/instrument-id-not-snake-case.expected.json +0 -10
  75. package/conformance/invalid/instrument-id-not-snake-case.udl +0 -54
  76. package/conformance/invalid/invalid-aggregate-gate-shape.expected.json +0 -10
  77. package/conformance/invalid/invalid-aggregate-gate-shape.udl +0 -1819
  78. package/conformance/invalid/invalid-check-duration.expected.json +0 -10
  79. package/conformance/invalid/invalid-check-duration.udl +0 -219
  80. package/conformance/invalid/invalid-dial-anchor.expected.json +0 -10
  81. package/conformance/invalid/invalid-dial-anchor.udl +0 -219
  82. package/conformance/invalid/invalid-exception-parent-ref.expected.json +0 -10
  83. package/conformance/invalid/invalid-exception-parent-ref.udl +0 -2487
  84. package/conformance/invalid/invalid-exposure-shape.expected.json +0 -10
  85. package/conformance/invalid/invalid-exposure-shape.udl +0 -1819
  86. package/conformance/invalid/invalid-journeys.expected.json +0 -10
  87. package/conformance/invalid/invalid-journeys.udl +0 -77
  88. package/conformance/invalid/invalid-remainder.expected.json +0 -10
  89. package/conformance/invalid/invalid-remainder.udl +0 -220
  90. package/conformance/invalid/invalid-schema-keyword.expected.json +0 -10
  91. package/conformance/invalid/invalid-schema-keyword.udl +0 -220
  92. package/conformance/invalid/invalid-utf8.expected.json +0 -10
  93. package/conformance/invalid/invalid-utf8.udl +0 -1
  94. package/conformance/invalid/leaf-effect-mismatch.expected.json +0 -10
  95. package/conformance/invalid/leaf-effect-mismatch.udl +0 -314
  96. package/conformance/invalid/malformed-json.expected.json +0 -10
  97. package/conformance/invalid/malformed-json.udl +0 -1
  98. package/conformance/invalid/missing-create-action.expected.json +0 -10
  99. package/conformance/invalid/missing-create-action.udl +0 -48
  100. package/conformance/invalid/missing-exception-amount-field.expected.json +0 -10
  101. package/conformance/invalid/missing-exception-amount-field.udl +0 -2487
  102. package/conformance/invalid/missing-exception-contract.expected.json +0 -14
  103. package/conformance/invalid/missing-exception-contract.udl +0 -2523
  104. package/conformance/invalid/missing-exception-reason-field.expected.json +0 -10
  105. package/conformance/invalid/missing-exception-reason-field.udl +0 -2487
  106. package/conformance/invalid/not-an-object.expected.json +0 -10
  107. package/conformance/invalid/not-an-object.udl +0 -1
  108. package/conformance/invalid/payout-reconcile-not-a-bank-debit.expected.json +0 -10
  109. package/conformance/invalid/payout-reconcile-not-a-bank-debit.udl +0 -259
  110. package/conformance/invalid/piece-plan-without-partition.expected.json +0 -10
  111. package/conformance/invalid/piece-plan-without-partition.udl +0 -305
  112. package/conformance/invalid/private-action-independent-approval.expected.json +0 -10
  113. package/conformance/invalid/private-action-independent-approval.udl +0 -314
  114. package/conformance/invalid/quote-freeze-set-incomplete.expected.json +0 -10
  115. package/conformance/invalid/quote-freeze-set-incomplete.udl +0 -261
  116. package/conformance/invalid/quote-named-reference-gate.expected.json +0 -10
  117. package/conformance/invalid/quote-named-reference-gate.udl +0 -50
  118. package/conformance/invalid/reconcile-named-reference-gate.expected.json +0 -10
  119. package/conformance/invalid/reconcile-named-reference-gate.udl +0 -50
  120. package/conformance/invalid/unfund-order-not-reversed.expected.json +0 -10
  121. package/conformance/invalid/unfund-order-not-reversed.udl +0 -314
  122. package/conformance/invalid/unknown-key.expected.json +0 -10
  123. package/conformance/invalid/unknown-key.udl +0 -55
  124. package/conformance/invalid/unknown-reference-gate-field.expected.json +0 -10
  125. package/conformance/invalid/unknown-reference-gate-field.udl +0 -1819
  126. package/conformance/invalid/unknown-required-field.expected.json +0 -10
  127. package/conformance/invalid/unknown-required-field.udl +0 -220
  128. package/conformance/invalid/unreachable-state.expected.json +0 -10
  129. package/conformance/invalid/unreachable-state.udl +0 -55
  130. package/conformance/invalid/wrong-exception-amount-field.expected.json +0 -10
  131. package/conformance/invalid/wrong-exception-amount-field.udl +0 -2487
  132. package/conformance/invalid/wrong-exception-reason-field.expected.json +0 -10
  133. package/conformance/invalid/wrong-exception-reason-field.udl +0 -2487
  134. package/conformance/valid/agent-description.expected.json +0 -6
  135. package/conformance/valid/agent-description.udl +0 -66
  136. package/conformance/valid/attested.expected.json +0 -6
  137. package/conformance/valid/attested.udl +0 -251
  138. package/conformance/valid/cards.expected.json +0 -6
  139. package/conformance/valid/cards.udl +0 -1579
  140. package/conformance/valid/commerce-escrow.expected.json +0 -6
  141. package/conformance/valid/commerce-escrow.udl +0 -1512
  142. package/conformance/valid/compiled-crowdfunding.expected.json +0 -6
  143. package/conformance/valid/compiled-crowdfunding.udl +0 -1843
  144. package/conformance/valid/compiled-watch-club.expected.json +0 -6
  145. package/conformance/valid/compiled-watch-club.udl +0 -2486
  146. package/conformance/valid/complete-contract.expected.json +0 -6
  147. package/conformance/valid/complete-contract.udl +0 -218
  148. package/conformance/valid/effect-signatures.expected.json +0 -6
  149. package/conformance/valid/effect-signatures.udl +0 -75
  150. package/conformance/valid/hand-edited.expected.json +0 -6
  151. package/conformance/valid/hand-edited.udl +0 -1
  152. package/conformance/valid/insured-car-marketplace.expected.json +0 -6
  153. package/conformance/valid/insured-car-marketplace.udl +0 -1050
  154. package/conformance/valid/insured-travel.expected.json +0 -6
  155. package/conformance/valid/insured-travel.udl +0 -3469
  156. package/conformance/valid/minimal.expected.json +0 -6
  157. package/conformance/valid/minimal.udl +0 -62
  158. package/conformance/valid/piece-plan-calls.expected.json +0 -6
  159. package/conformance/valid/piece-plan-calls.udl +0 -314
  160. package/conformance/valid/protection.expected.json +0 -6
  161. package/conformance/valid/protection.udl +0 -1551
  162. package/conformance/valid/string-escaping.expected.json +0 -6
  163. package/conformance/valid/string-escaping.udl +0 -54
  164. package/conformance/valid/vocabulary.expected.json +0 -6
  165. package/conformance/valid/vocabulary.udl +0 -2012
  166. package/dist/allocation.d.ts +0 -60
  167. package/dist/allocation.d.ts.map +0 -1
  168. package/dist/allocation.js +0 -177
  169. package/dist/allocation.js.map +0 -1
  170. package/dist/check-profiles.d.ts +0 -57
  171. package/dist/check-profiles.d.ts.map +0 -1
  172. package/dist/check-profiles.js +0 -62
  173. package/dist/check-profiles.js.map +0 -1
  174. package/dist/distribution.d.ts +0 -15
  175. package/dist/distribution.d.ts.map +0 -1
  176. package/dist/distribution.js +0 -49
  177. package/dist/distribution.js.map +0 -1
  178. package/dist/effects.d.ts +0 -58
  179. package/dist/effects.d.ts.map +0 -1
  180. package/dist/effects.js +0 -1126
  181. package/dist/effects.js.map +0 -1
  182. package/dist/reference.d.ts +0 -3
  183. package/dist/reference.d.ts.map +0 -1
  184. package/dist/reference.js +0 -28
  185. package/dist/reference.js.map +0 -1
  186. package/dist/vocabulary.d.ts +0 -23
  187. package/dist/vocabulary.d.ts.map +0 -1
  188. package/dist/vocabulary.js +0 -1052
  189. package/dist/vocabulary.js.map +0 -1
  190. package/docs/funding-custody.md +0 -165
  191. package/docs/guide/01-a-document.md +0 -37
  192. package/docs/guide/02-money-steps.md +0 -23
  193. package/docs/guide/03-laws.md +0 -18
  194. package/docs/guide/04-fees-and-remainder.md +0 -36
  195. package/docs/guide/05-checks-updates-dials.md +0 -7
  196. package/docs/guide/06-effects.md +0 -11
  197. package/docs/guide/07-evolution.md +0 -11
  198. package/docs/guide/08-implementing.md +0 -13
  199. package/docs/guide/09-schedules-and-allocation.md +0 -132
  200. package/docs/llms-full.txt +0 -2008
  201. package/docs/llms.txt +0 -14
  202. package/docs/piece-plans.md +0 -148
  203. package/docs/reference/canonical.md +0 -16
  204. package/docs/reference/clauses.md +0 -1585
  205. package/docs/reference/cli.md +0 -24
  206. package/docs/reference/diagnostics.md +0 -38
  207. package/skills/udl/SKILL.md +0 -28
  208. package/src/allocation.ts +0 -259
  209. package/src/check-profiles.ts +0 -80
  210. package/src/distribution.ts +0 -61
  211. package/src/effects.ts +0 -1920
  212. package/src/reference.ts +0 -31
  213. package/src/vocabulary.ts +0 -1635
@@ -1,2523 +0,0 @@
1
- {
2
- "instruments": [
3
- {
4
- "actionOrder": [
5
- "create",
6
- "pay_piece_1",
7
- "pay_piece_2",
8
- "collect_service_fee"
9
- ],
10
- "actions": {
11
- "collect_service_fee": {
12
- "agentDescription": "Finish the payment and collect the service fee the member owes on top of the amount. Both pieces must already be paid. When the product charges no payer fee this only closes the payment out.",
13
- "effects": {
14
- "moves": [
15
- {
16
- "signature": "moves.transfer.internal",
17
- "source": "moves[0]"
18
- }
19
- ]
20
- },
21
- "moves": [
22
- {
23
- "bind": {
24
- "amount": {
25
- "from": "instance",
26
- "path": "fields.checkoutFee"
27
- },
28
- "currency": {
29
- "from": "instance",
30
- "path": "fields.currency"
31
- },
32
- "destinationAccountId": {
33
- "from": "instance",
34
- "path": "fields.platformAccountId"
35
- },
36
- "metadata.instrumentId": {
37
- "from": "const",
38
- "value": "purchase"
39
- },
40
- "metadata.instrumentInstanceId": {
41
- "from": "instance",
42
- "path": "instrumentInstanceId"
43
- },
44
- "metadata.phase": {
45
- "from": "const",
46
- "value": "collect_service_fee"
47
- },
48
- "productId": {
49
- "from": "instance",
50
- "path": "productId"
51
- },
52
- "sourceAccountId": {
53
- "from": "instance",
54
- "path": "fields.memberAccountId"
55
- }
56
- },
57
- "capture": {
58
- "collectServiceFeeTransferTransferId": "transferId"
59
- },
60
- "key": "transfer",
61
- "operation": "internal_transfer.create"
62
- }
63
- ],
64
- "publicAction": "collectServiceFeePurchase",
65
- "steps": [],
66
- "summary": "Collect the payer-side service fee"
67
- },
68
- "create": {
69
- "agentDescription": "Open the payment row before anything moves. The caller supplies the purchasePrice, the currency, and both party accounts. Fee and derived pieces are computed from the purchasePrice, callers never supply them. Call pay piece 1 to move the money.",
70
- "moves": [],
71
- "publicAction": "createPurchase",
72
- "steps": [],
73
- "summary": "Create a purchase payment"
74
- },
75
- "pay_piece_1": {
76
- "agentDescription": "Move the first piece from the member to the seller. The payment must be created. This moves the whole amount unless the product carves a payee fee, in which case it moves the net share and pay piece 2 takes the fee.",
77
- "effects": {
78
- "moves": [
79
- {
80
- "signature": "moves.transfer.internal",
81
- "source": "moves[0]"
82
- }
83
- ]
84
- },
85
- "moves": [
86
- {
87
- "bind": {
88
- "amount": {
89
- "from": "instance",
90
- "path": "fields.netOfCarvedFeeAmount"
91
- },
92
- "currency": {
93
- "from": "instance",
94
- "path": "fields.currency"
95
- },
96
- "destinationAccountId": {
97
- "from": "instance",
98
- "path": "fields.sellerAccountId"
99
- },
100
- "metadata.instrumentId": {
101
- "from": "const",
102
- "value": "purchase"
103
- },
104
- "metadata.instrumentInstanceId": {
105
- "from": "instance",
106
- "path": "instrumentInstanceId"
107
- },
108
- "metadata.phase": {
109
- "from": "const",
110
- "value": "pay_piece_1"
111
- },
112
- "productId": {
113
- "from": "instance",
114
- "path": "productId"
115
- },
116
- "sourceAccountId": {
117
- "from": "instance",
118
- "path": "fields.memberAccountId"
119
- }
120
- },
121
- "capture": {
122
- "payPiece1TransferTransferId": "transferId"
123
- },
124
- "key": "transfer",
125
- "operation": "internal_transfer.create"
126
- }
127
- ],
128
- "publicAction": "payPiece1Purchase",
129
- "steps": [],
130
- "summary": "Pay piece 1 of the amount through"
131
- },
132
- "pay_piece_2": {
133
- "agentDescription": "Move the carved platform fee out of the amount. Call this after pay piece 1. When the product carves no seller fee this only steps the payment forward and moves nothing.",
134
- "effects": {
135
- "moves": [
136
- {
137
- "signature": "moves.transfer.internal",
138
- "source": "moves[0]"
139
- }
140
- ]
141
- },
142
- "moves": [
143
- {
144
- "bind": {
145
- "amount": {
146
- "from": "instance",
147
- "path": "fields.carvedFeeAmount"
148
- },
149
- "currency": {
150
- "from": "instance",
151
- "path": "fields.currency"
152
- },
153
- "destinationAccountId": {
154
- "from": "instance",
155
- "path": "fields.platformAccountId"
156
- },
157
- "metadata.instrumentId": {
158
- "from": "const",
159
- "value": "purchase"
160
- },
161
- "metadata.instrumentInstanceId": {
162
- "from": "instance",
163
- "path": "instrumentInstanceId"
164
- },
165
- "metadata.phase": {
166
- "from": "const",
167
- "value": "pay_piece_2"
168
- },
169
- "productId": {
170
- "from": "instance",
171
- "path": "productId"
172
- },
173
- "sourceAccountId": {
174
- "from": "instance",
175
- "path": "fields.memberAccountId"
176
- }
177
- },
178
- "capture": {
179
- "payPiece2TransferTransferId": "transferId"
180
- },
181
- "key": "transfer",
182
- "operation": "internal_transfer.create"
183
- }
184
- ],
185
- "publicAction": "payPiece2Purchase",
186
- "steps": [],
187
- "summary": "Pay piece 2 of the amount through"
188
- }
189
- },
190
- "agentDescription": "Reach for instant transfer when the member pays the seller straight through with no custody step. The money leaves and lands in one call. Pick deposit when the money must be held first, and captured payment when the payee takes it in slices.",
191
- "description": "Instant transfer: the member pays purchasePrice straight through to the seller, no custody",
192
- "feeRules": [
193
- {
194
- "amountField": "checkoutFee",
195
- "baseField": "purchasePrice",
196
- "bearerField": "memberAccountId",
197
- "position": "on_top",
198
- "rule": {
199
- "currencyField": "currency",
200
- "field": "checkoutFee",
201
- "kind": "exact"
202
- }
203
- },
204
- {
205
- "amountField": "carvedFeeAmount",
206
- "baseField": "purchasePrice",
207
- "bearerField": "sellerAccountId",
208
- "position": "carved",
209
- "rule": {
210
- "kind": "tiered",
211
- "tiers": [
212
- {
213
- "fromInclusive": "0",
214
- "rule": {
215
- "bps": 100,
216
- "kind": "bps"
217
- },
218
- "toExclusive": "10000"
219
- },
220
- {
221
- "fromInclusive": "10000",
222
- "rule": {
223
- "currencyField": "currency",
224
- "field": "highValueFee",
225
- "kind": "exact"
226
- }
227
- }
228
- ]
229
- }
230
- }
231
- ],
232
- "fields": {
233
- "carvedFeeAmount": {
234
- "description": "The carved platform fee selected from purchasePrice",
235
- "pattern": "^[1-9][0-9]{0,17}$",
236
- "type": "string"
237
- },
238
- "checkoutFee": {
239
- "description": "Immutable exact member fee in SAR minor units",
240
- "pattern": "^[1-9][0-9]{0,17}$",
241
- "type": "string"
242
- },
243
- "currency": {
244
- "description": "ISO 4217 currency code",
245
- "maxLength": 3,
246
- "minLength": 3,
247
- "pattern": "^[A-Z]{3}$",
248
- "type": "string"
249
- },
250
- "highValueFee": {
251
- "description": "Immutable exact seller fee in SAR minor units",
252
- "pattern": "^[1-9][0-9]{0,17}$",
253
- "type": "string"
254
- },
255
- "memberAccountId": {
256
- "description": "The member account",
257
- "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
258
- "type": "string",
259
- "x-hyperscale-reference-filter": {
260
- "column": "role",
261
- "values": [
262
- "customer_balance"
263
- ]
264
- }
265
- },
266
- "netOfCarvedFeeAmount": {
267
- "description": "The remainder of purchasePrice after the carved platform fee",
268
- "pattern": "^[1-9][0-9]{0,17}$",
269
- "type": "string"
270
- },
271
- "platformAccountId": {
272
- "description": "The product fee collection account",
273
- "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
274
- "type": "string",
275
- "x-hyperscale-fee-collection-port": true,
276
- "x-hyperscale-reference-filter": {
277
- "column": "role",
278
- "values": [
279
- "customer_balance",
280
- "product_revenue"
281
- ]
282
- }
283
- },
284
- "purchasePrice": {
285
- "description": "The gross amount in SAR minor units; the piece fields below partition it exactly",
286
- "pattern": "^[1-9][0-9]{0,17}$",
287
- "type": "string"
288
- },
289
- "sellerAccountId": {
290
- "description": "The seller account",
291
- "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
292
- "type": "string",
293
- "x-hyperscale-reference-filter": {
294
- "column": "role",
295
- "values": [
296
- "customer_balance"
297
- ]
298
- }
299
- }
300
- },
301
- "id": "purchase",
302
- "idPrefix": "purc",
303
- "lifecycle": {
304
- "initial": "created",
305
- "states": [
306
- "created",
307
- "paying_1",
308
- "paying_2",
309
- "paid"
310
- ],
311
- "transitions": {
312
- "collect_service_fee": {
313
- "from": [
314
- "paying_2"
315
- ],
316
- "to": "paid"
317
- },
318
- "pay_piece_1": {
319
- "from": [
320
- "created"
321
- ],
322
- "to": "paying_1"
323
- },
324
- "pay_piece_2": {
325
- "from": [
326
- "paying_1"
327
- ],
328
- "to": "paying_2"
329
- }
330
- }
331
- },
332
- "parties": {
333
- "beneficiary": "sellerAccountId",
334
- "payer": "memberAccountId"
335
- },
336
- "partitions": [
337
- {
338
- "pieceFields": [
339
- "netOfCarvedFeeAmount",
340
- "carvedFeeAmount"
341
- ],
342
- "totalField": "purchasePrice"
343
- }
344
- ],
345
- "required": [
346
- "memberAccountId",
347
- "sellerAccountId",
348
- "platformAccountId",
349
- "purchasePrice",
350
- "netOfCarvedFeeAmount",
351
- "checkoutFee",
352
- "highValueFee",
353
- "currency"
354
- ],
355
- "summary": "Instant payment from member to seller",
356
- "title": "Purchase"
357
- },
358
- {
359
- "actionOrder": [
360
- "create",
361
- "place_deposit",
362
- "assess_watch",
363
- "return_deposit"
364
- ],
365
- "actions": {
366
- "assess_watch": {
367
- "agentDescription": "Claim the held deposit for the seller. The deposit must be in held. The reservation settles here, whole or up to the decided amount with the exact remainder released back to the member. There is no return afterwards.",
368
- "decidedAmount": {
369
- "boundField": "depositAmount",
370
- "field": "damageAmount",
371
- "remainderAction": "return_deposit"
372
- },
373
- "effects": {
374
- "decides": [
375
- {
376
- "signature": "decides.tenant_port",
377
- "source": "port"
378
- }
379
- ],
380
- "moves": [
381
- {
382
- "signature": "moves.transfer.internal",
383
- "source": "moves[0]"
384
- },
385
- {
386
- "signature": "moves.transfer.internal",
387
- "source": "moves[1]"
388
- }
389
- ]
390
- },
391
- "input": {
392
- "additionalProperties": false,
393
- "properties": {
394
- "damageAmount": {
395
- "description": "Caller-decided amount in minor units",
396
- "pattern": "^(0|[1-9][0-9]{0,17})$",
397
- "type": "string"
398
- },
399
- "evidence": {
400
- "description": "Required decision reference retained in the operation receipt",
401
- "maxLength": 180,
402
- "minLength": 1,
403
- "type": "string"
404
- }
405
- },
406
- "required": [
407
- "damageAmount",
408
- "evidence"
409
- ],
410
- "type": "object"
411
- },
412
- "moves": [
413
- {
414
- "bind": {
415
- "amount": {
416
- "from": "input",
417
- "path": "damageAmount"
418
- },
419
- "currency": {
420
- "from": "instance",
421
- "path": "fields.currency"
422
- },
423
- "postMode": {
424
- "from": "const",
425
- "value": "partial_only"
426
- },
427
- "transferId": {
428
- "from": "instance",
429
- "path": "refs.placeDepositReservationTransferId"
430
- }
431
- },
432
- "key": "post",
433
- "operation": "internal_transfer.post"
434
- },
435
- {
436
- "bind": {
437
- "reason": {
438
- "from": "const",
439
- "value": "Return the unclaimed deposit remainder"
440
- },
441
- "transferId": {
442
- "from": "instance",
443
- "path": "refs.placeDepositReservationTransferId"
444
- }
445
- },
446
- "key": "remainder",
447
- "operation": "internal_transfer.void"
448
- }
449
- ],
450
- "port": {
451
- "allowedParties": [
452
- "beneficiary"
453
- ]
454
- },
455
- "publicAction": "assessWatchInspectionDeposit",
456
- "steps": [],
457
- "summary": "Claim the deposit for the seller through assess_watch"
458
- },
459
- "create": {
460
- "agentDescription": "Open the deposit row before anything is reserved. The caller supplies the depositAmount, the currency, and the member and seller accounts. Nothing is reserved yet, call place deposit next.",
461
- "moves": [],
462
- "publicAction": "createInspectionDeposit",
463
- "steps": [],
464
- "summary": "Create a inspection deposit"
465
- },
466
- "place_deposit": {
467
- "agentDescription": "Reserve the depositAmount against the member's account in the seller's favor. The deposit must be created. The money is held, not paid: the claim posts it to the seller and the return releases it back.",
468
- "effects": {
469
- "holds": [
470
- {
471
- "signature": "holds.reserve",
472
- "source": "moves[0]"
473
- }
474
- ],
475
- "moves": [
476
- {
477
- "signature": "moves.transfer.internal",
478
- "source": "moves[0]"
479
- }
480
- ]
481
- },
482
- "moves": [
483
- {
484
- "bind": {
485
- "amount": {
486
- "from": "instance",
487
- "path": "fields.depositAmount"
488
- },
489
- "currency": {
490
- "from": "instance",
491
- "path": "fields.currency"
492
- },
493
- "destinationAccountId": {
494
- "from": "instance",
495
- "path": "fields.sellerAccountId"
496
- },
497
- "metadata.instrumentId": {
498
- "from": "const",
499
- "value": "inspection_deposit"
500
- },
501
- "metadata.instrumentInstanceId": {
502
- "from": "instance",
503
- "path": "instrumentInstanceId"
504
- },
505
- "metadata.phase": {
506
- "from": "const",
507
- "value": "place_deposit"
508
- },
509
- "productId": {
510
- "from": "instance",
511
- "path": "productId"
512
- },
513
- "sourceAccountId": {
514
- "from": "instance",
515
- "path": "fields.memberAccountId"
516
- }
517
- },
518
- "capture": {
519
- "placeDepositReservationTransferId": "transferId"
520
- },
521
- "key": "reservation",
522
- "operation": "internal_transfer.reserve"
523
- }
524
- ],
525
- "publicAction": "placeDepositInspectionDeposit",
526
- "steps": [],
527
- "summary": "Reserve the depositAmount against the member's account"
528
- },
529
- "return_deposit": {
530
- "agentDescription": "Return the held deposit to the member. The deposit must be in held and unclaimed. This releases the reservation whole and the seller receives nothing.",
531
- "effects": {
532
- "moves": [
533
- {
534
- "signature": "moves.transfer.internal",
535
- "source": "moves[0]"
536
- }
537
- ]
538
- },
539
- "moves": [
540
- {
541
- "bind": {
542
- "reason": {
543
- "from": "const",
544
- "value": "Deposit returned in full"
545
- },
546
- "transferId": {
547
- "from": "instance",
548
- "path": "refs.placeDepositReservationTransferId"
549
- }
550
- },
551
- "key": "void",
552
- "operation": "internal_transfer.void"
553
- }
554
- ],
555
- "publicAction": "returnDepositInspectionDeposit",
556
- "steps": [],
557
- "summary": "Return the deposit to the member through return_deposit"
558
- }
559
- },
560
- "agentDescription": "Reach for security deposit when money is reserved against the member in the seller's favor and later claimed or returned. The funds stay reserved and move only on the claim. Pick captured payment when the holder takes the money in slices, and instant transfer when nothing is held.",
561
- "description": "Deposit: the depositAmount is reserved against the member's account in the seller's favor, then damageAmount is claimed and the exact remainder returned, or the deposit is returned in full",
562
- "fields": {
563
- "currency": {
564
- "description": "ISO 4217 currency code",
565
- "maxLength": 3,
566
- "minLength": 3,
567
- "pattern": "^[A-Z]{3}$",
568
- "type": "string"
569
- },
570
- "depositAmount": {
571
- "description": "The deposit amount in SAR minor units, reserved in full and fully accounted on claim or return",
572
- "pattern": "^[1-9][0-9]{0,17}$",
573
- "type": "string"
574
- },
575
- "memberAccountId": {
576
- "description": "The member account",
577
- "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
578
- "type": "string",
579
- "x-hyperscale-reference-filter": {
580
- "column": "role",
581
- "values": [
582
- "customer_balance"
583
- ]
584
- }
585
- },
586
- "sellerAccountId": {
587
- "description": "The seller account",
588
- "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
589
- "type": "string",
590
- "x-hyperscale-reference-filter": {
591
- "column": "role",
592
- "values": [
593
- "customer_balance"
594
- ]
595
- }
596
- }
597
- },
598
- "id": "inspection_deposit",
599
- "idPrefix": "id",
600
- "lifecycle": {
601
- "initial": "created",
602
- "states": [
603
- "created",
604
- "held",
605
- "claimed",
606
- "returned"
607
- ],
608
- "transitions": {
609
- "assess_watch": {
610
- "from": [
611
- "held"
612
- ],
613
- "to": "claimed"
614
- },
615
- "place_deposit": {
616
- "from": [
617
- "created"
618
- ],
619
- "to": "held"
620
- },
621
- "return_deposit": {
622
- "from": [
623
- "held"
624
- ],
625
- "to": "returned"
626
- }
627
- }
628
- },
629
- "parties": {
630
- "beneficiary": "sellerAccountId",
631
- "payer": "memberAccountId"
632
- },
633
- "required": [
634
- "memberAccountId",
635
- "sellerAccountId",
636
- "depositAmount",
637
- "currency"
638
- ],
639
- "summary": "Refundable deposit from member held for seller",
640
- "title": "Inspection deposit"
641
- },
642
- {
643
- "actionOrder": [
644
- "create",
645
- "open_period",
646
- "collect_period",
647
- "cancel_membership"
648
- ],
649
- "actions": {
650
- "cancel_membership": {
651
- "agentDescription": "Cancel the open schedule for good and drain any period liability still standing. Only the payer may call it, and the reference fields the port declares are required. No further period opens and there is no reactivation.",
652
- "captureInput": {
653
- "reason": "reason"
654
- },
655
- "effects": {
656
- "decides": [
657
- {
658
- "signature": "decides.tenant_port",
659
- "source": "port"
660
- }
661
- ]
662
- },
663
- "input": {
664
- "additionalProperties": false,
665
- "properties": {
666
- "reason": {
667
- "description": "Required decision reference retained in the operation receipt",
668
- "maxLength": 180,
669
- "minLength": 1,
670
- "type": "string"
671
- }
672
- },
673
- "required": [
674
- "reason"
675
- ],
676
- "type": "object"
677
- },
678
- "moves": [],
679
- "port": {
680
- "allowedParties": [
681
- "payer"
682
- ]
683
- },
684
- "publicAction": "cancelMembershipMembership",
685
- "steps": [],
686
- "summary": "Cancel the open schedule and drain any period liability"
687
- },
688
- "collect_period": {
689
- "agentDescription": "Collect one open period charge from the payer, with the mandate evidence reference kept in the receipt. A period must be open. Only the payer may call it. This moves the period amount and does not reverse.",
690
- "captureInput": {
691
- "mandateEvidenceReference": "evidenceReference"
692
- },
693
- "effects": {
694
- "decides": [
695
- {
696
- "signature": "decides.tenant_port",
697
- "source": "port"
698
- }
699
- ],
700
- "moves": [
701
- {
702
- "signature": "moves.transfer.internal",
703
- "source": "moves[0]"
704
- }
705
- ]
706
- },
707
- "input": {
708
- "additionalProperties": false,
709
- "properties": {
710
- "evidenceReference": {
711
- "description": "Required decision reference retained in the operation receipt",
712
- "maxLength": 180,
713
- "minLength": 1,
714
- "type": "string"
715
- }
716
- },
717
- "required": [
718
- "evidenceReference"
719
- ],
720
- "type": "object"
721
- },
722
- "moves": [
723
- {
724
- "bind": {
725
- "amount": {
726
- "from": "instance",
727
- "path": "fields.monthlyFee"
728
- },
729
- "currency": {
730
- "from": "instance",
731
- "path": "fields.currency"
732
- },
733
- "destinationAccountId": {
734
- "from": "instance",
735
- "path": "fields.clubAccountId"
736
- },
737
- "metadata.instrumentId": {
738
- "from": "const",
739
- "value": "membership"
740
- },
741
- "metadata.instrumentInstanceId": {
742
- "from": "instance",
743
- "path": "instrumentInstanceId"
744
- },
745
- "metadata.phase": {
746
- "from": "const",
747
- "value": "collect_period"
748
- },
749
- "productId": {
750
- "from": "instance",
751
- "path": "productId"
752
- },
753
- "sourceAccountId": {
754
- "from": "instance",
755
- "path": "fields.memberAccountId"
756
- }
757
- },
758
- "capture": {
759
- "collectPeriodPeriodCollectionTransferId": "transferId"
760
- },
761
- "key": "period_collection",
762
- "operation": "internal_transfer.create"
763
- }
764
- ],
765
- "port": {
766
- "allowedParties": [
767
- "payer"
768
- ]
769
- },
770
- "publicAction": "collectPeriodMembership",
771
- "steps": [],
772
- "summary": "Collect one authored period charge with mandate evidence"
773
- },
774
- "create": {
775
- "agentDescription": "Create the open obligation before its first period anchor. No money moves. The charge for one period and the first anchor are fixed here, and periods then open on their own.",
776
- "moves": [],
777
- "publicAction": "createMembership",
778
- "steps": [],
779
- "summary": "Create the open obligation before its first anchor"
780
- },
781
- "open_period": {
782
- "due": {
783
- "every": {
784
- "delinquency": "parent_policy",
785
- "drainAction": "cancel_membership",
786
- "liability": "one_open",
787
- "period": {
788
- "calendar": "gregorian",
789
- "monthEnd": "clamp_to_last_day",
790
- "months": 1
791
- },
792
- "untilAction": "cancel_membership"
793
- },
794
- "field": "firstPeriodAt"
795
- },
796
- "effects": {
797
- "schedules": [
798
- {
799
- "signature": "schedules.due",
800
- "source": "due"
801
- }
802
- ]
803
- },
804
- "moves": [],
805
- "steps": [],
806
- "summary": "Open exactly one period liability without moving money"
807
- }
808
- },
809
- "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.",
810
- "description": "Open monthly obligation for member; one period liability at a time",
811
- "fields": {
812
- "clubAccountId": {
813
- "description": "The club account",
814
- "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
815
- "type": "string",
816
- "x-hyperscale-reference-filter": {
817
- "column": "role",
818
- "values": [
819
- "customer_balance"
820
- ]
821
- }
822
- },
823
- "currency": {
824
- "const": "SAR",
825
- "description": "ISO 4217 currency code",
826
- "type": "string"
827
- },
828
- "firstPeriodAt": {
829
- "description": "First period anchor; missing Gregorian month days clamp to the target month's final day",
830
- "format": "hyperscale-date-time",
831
- "type": "string"
832
- },
833
- "memberAccountId": {
834
- "description": "The member account",
835
- "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
836
- "type": "string",
837
- "x-hyperscale-reference-filter": {
838
- "column": "role",
839
- "values": [
840
- "customer_balance"
841
- ]
842
- }
843
- },
844
- "monthlyFee": {
845
- "description": "Exact charge for one P1M period in SAR minor units",
846
- "pattern": "^[1-9][0-9]{0,17}$",
847
- "type": "string"
848
- }
849
- },
850
- "id": "membership",
851
- "idPrefix": "memb",
852
- "lifecycle": {
853
- "initial": "active",
854
- "states": [
855
- "active",
856
- "period_open",
857
- "canceled"
858
- ],
859
- "transitions": {
860
- "cancel_membership": {
861
- "from": [
862
- "active",
863
- "period_open"
864
- ],
865
- "to": "canceled"
866
- },
867
- "collect_period": {
868
- "from": [
869
- "period_open"
870
- ],
871
- "to": "active"
872
- },
873
- "open_period": {
874
- "from": [
875
- "active"
876
- ],
877
- "to": "period_open"
878
- }
879
- }
880
- },
881
- "parties": {
882
- "beneficiary": "clubAccountId",
883
- "payer": "memberAccountId"
884
- },
885
- "required": [
886
- "memberAccountId",
887
- "clubAccountId",
888
- "monthlyFee",
889
- "currency",
890
- "firstPeriodAt"
891
- ],
892
- "summary": "Open P1M obligation for member",
893
- "title": "Membership"
894
- },
895
- {
896
- "actionOrder": [
897
- "abandon",
898
- "cancel",
899
- "create",
900
- "dispute",
901
- "fund",
902
- "post",
903
- "release"
904
- ],
905
- "actions": {
906
- "abandon": {
907
- "agentDescription": "Walk away from a trade that never funded. Only a created trade abandons, and its escrow account must hold nothing, so there is nothing to refund. No money moves.",
908
- "moves": [],
909
- "publicAction": "abandonMemberTrade",
910
- "requiresDrainedAccount": {
911
- "path": "refs.escrowAccountId"
912
- },
913
- "steps": [],
914
- "summary": "Abandon the trade before its atomic funding batch"
915
- },
916
- "cancel": {
917
- "agentDescription": "Unwind a funded trade before release. Both principals return from escrow to their own sides in one batch. The trade must be funded and not yet released. The service fees taken at funding stay with the platform.",
918
- "effects": {
919
- "moves": [
920
- {
921
- "signature": "moves.transfer.internal",
922
- "source": "moves[0]"
923
- },
924
- {
925
- "signature": "moves.transfer.internal",
926
- "source": "moves[1]"
927
- }
928
- ]
929
- },
930
- "moves": [
931
- {
932
- "bind": {
933
- "amount": {
934
- "from": "instance",
935
- "path": "fields.memberPays"
936
- },
937
- "currency": {
938
- "from": "instance",
939
- "path": "fields.currency"
940
- },
941
- "destinationAccountId": {
942
- "from": "instance",
943
- "path": "fields.memberAccountId"
944
- },
945
- "metadata.instrumentId": {
946
- "from": "const",
947
- "value": "member_trade"
948
- },
949
- "metadata.instrumentInstanceId": {
950
- "from": "instance",
951
- "path": "instrumentInstanceId"
952
- },
953
- "metadata.phase": {
954
- "from": "const",
955
- "value": "cancel"
956
- },
957
- "productId": {
958
- "from": "instance",
959
- "path": "productId"
960
- },
961
- "sourceAccountId": {
962
- "from": "instance",
963
- "path": "refs.escrowAccountId"
964
- }
965
- },
966
- "capture": {
967
- "cancelSideARefundTransferId": "transferId"
968
- },
969
- "key": "side_a_refund",
970
- "operation": "internal_transfer.create"
971
- },
972
- {
973
- "bind": {
974
- "amount": {
975
- "from": "instance",
976
- "path": "fields.sellerPays"
977
- },
978
- "currency": {
979
- "from": "instance",
980
- "path": "fields.currency"
981
- },
982
- "destinationAccountId": {
983
- "from": "instance",
984
- "path": "fields.sellerAccountId"
985
- },
986
- "metadata.instrumentId": {
987
- "from": "const",
988
- "value": "member_trade"
989
- },
990
- "metadata.instrumentInstanceId": {
991
- "from": "instance",
992
- "path": "instrumentInstanceId"
993
- },
994
- "metadata.phase": {
995
- "from": "const",
996
- "value": "cancel"
997
- },
998
- "productId": {
999
- "from": "instance",
1000
- "path": "productId"
1001
- },
1002
- "sourceAccountId": {
1003
- "from": "instance",
1004
- "path": "refs.escrowAccountId"
1005
- }
1006
- },
1007
- "capture": {
1008
- "cancelSideBRefundTransferId": "transferId"
1009
- },
1010
- "key": "side_b_refund",
1011
- "operation": "internal_transfer.create"
1012
- }
1013
- ],
1014
- "publicAction": "cancelMemberTrade",
1015
- "steps": [],
1016
- "summary": "Cancel and return both trade principals atomically"
1017
- },
1018
- "create": {
1019
- "agentDescription": "Open a trade and provision its escrow account. No money moves. Both principals and both exact service fees are fixed here and cannot change afterwards.",
1020
- "moves": [],
1021
- "publicAction": "createMemberTrade",
1022
- "steps": [
1023
- {
1024
- "bind": {
1025
- "currency": {
1026
- "from": "instance",
1027
- "path": "fields.currency"
1028
- },
1029
- "owner.id": {
1030
- "from": "instance",
1031
- "path": "productId"
1032
- },
1033
- "owner.type": {
1034
- "from": "const",
1035
- "value": "product"
1036
- },
1037
- "productId": {
1038
- "from": "instance",
1039
- "path": "productId"
1040
- },
1041
- "role": {
1042
- "from": "const",
1043
- "value": "product_escrow"
1044
- }
1045
- },
1046
- "capture": {
1047
- "escrowAccountId": "accountId"
1048
- },
1049
- "operation": "account.escrow.provision"
1050
- }
1051
- ],
1052
- "summary": "Create a member trade atomic trade"
1053
- },
1054
- "dispute": {
1055
- "agentDescription": "Claw back a released trade inside its dispute window. Both cross-payment reservations void and both principals return from escrow in one batch. The trade must be released and the clawback moment must not have passed. Either trading party may call it.",
1056
- "deadline": {
1057
- "field": "clawbackAt"
1058
- },
1059
- "effects": {
1060
- "decides": [
1061
- {
1062
- "signature": "decides.tenant_port",
1063
- "source": "port"
1064
- }
1065
- ],
1066
- "moves": [
1067
- {
1068
- "signature": "moves.transfer.internal",
1069
- "source": "moves[0]"
1070
- },
1071
- {
1072
- "signature": "moves.transfer.internal",
1073
- "source": "moves[1]"
1074
- },
1075
- {
1076
- "signature": "moves.transfer.internal",
1077
- "source": "moves[2]"
1078
- },
1079
- {
1080
- "signature": "moves.transfer.internal",
1081
- "source": "moves[3]"
1082
- }
1083
- ],
1084
- "schedules": [
1085
- {
1086
- "signature": "schedules.deadline",
1087
- "source": "deadline"
1088
- }
1089
- ]
1090
- },
1091
- "moves": [
1092
- {
1093
- "bind": {
1094
- "reason": {
1095
- "from": "const",
1096
- "value": "Whole trade disputed inside the clawback window"
1097
- },
1098
- "transferId": {
1099
- "from": "instance",
1100
- "path": "refs.releaseSideATransferId"
1101
- }
1102
- },
1103
- "key": "side_a_void",
1104
- "operation": "internal_transfer.void"
1105
- },
1106
- {
1107
- "bind": {
1108
- "reason": {
1109
- "from": "const",
1110
- "value": "Whole trade disputed inside the clawback window"
1111
- },
1112
- "transferId": {
1113
- "from": "instance",
1114
- "path": "refs.releaseSideBTransferId"
1115
- }
1116
- },
1117
- "key": "side_b_void",
1118
- "operation": "internal_transfer.void"
1119
- },
1120
- {
1121
- "bind": {
1122
- "amount": {
1123
- "from": "instance",
1124
- "path": "fields.memberPays"
1125
- },
1126
- "currency": {
1127
- "from": "instance",
1128
- "path": "fields.currency"
1129
- },
1130
- "destinationAccountId": {
1131
- "from": "instance",
1132
- "path": "fields.memberAccountId"
1133
- },
1134
- "metadata.clawbackOfTransferId": {
1135
- "from": "instance",
1136
- "path": "refs.releaseSideATransferId"
1137
- },
1138
- "metadata.instrumentId": {
1139
- "from": "const",
1140
- "value": "member_trade"
1141
- },
1142
- "metadata.instrumentInstanceId": {
1143
- "from": "instance",
1144
- "path": "instrumentInstanceId"
1145
- },
1146
- "metadata.phase": {
1147
- "from": "const",
1148
- "value": "dispute"
1149
- },
1150
- "productId": {
1151
- "from": "instance",
1152
- "path": "productId"
1153
- },
1154
- "sourceAccountId": {
1155
- "from": "instance",
1156
- "path": "refs.escrowAccountId"
1157
- }
1158
- },
1159
- "capture": {
1160
- "disputeSideARefundTransferId": "transferId"
1161
- },
1162
- "key": "side_a_refund",
1163
- "operation": "internal_transfer.create"
1164
- },
1165
- {
1166
- "bind": {
1167
- "amount": {
1168
- "from": "instance",
1169
- "path": "fields.sellerPays"
1170
- },
1171
- "currency": {
1172
- "from": "instance",
1173
- "path": "fields.currency"
1174
- },
1175
- "destinationAccountId": {
1176
- "from": "instance",
1177
- "path": "fields.sellerAccountId"
1178
- },
1179
- "metadata.clawbackOfTransferId": {
1180
- "from": "instance",
1181
- "path": "refs.releaseSideBTransferId"
1182
- },
1183
- "metadata.instrumentId": {
1184
- "from": "const",
1185
- "value": "member_trade"
1186
- },
1187
- "metadata.instrumentInstanceId": {
1188
- "from": "instance",
1189
- "path": "instrumentInstanceId"
1190
- },
1191
- "metadata.phase": {
1192
- "from": "const",
1193
- "value": "dispute"
1194
- },
1195
- "productId": {
1196
- "from": "instance",
1197
- "path": "productId"
1198
- },
1199
- "sourceAccountId": {
1200
- "from": "instance",
1201
- "path": "refs.escrowAccountId"
1202
- }
1203
- },
1204
- "capture": {
1205
- "disputeSideBRefundTransferId": "transferId"
1206
- },
1207
- "key": "side_b_refund",
1208
- "operation": "internal_transfer.create"
1209
- }
1210
- ],
1211
- "port": {
1212
- "allowedParties": [
1213
- "payer",
1214
- "beneficiary"
1215
- ]
1216
- },
1217
- "publicAction": "disputeMemberTrade",
1218
- "steps": [],
1219
- "summary": "Void both reservations, then refund both principals atomically"
1220
- },
1221
- "fund": {
1222
- "agentDescription": "Fund both sides at once. Each side pays its principal into escrow and its service fee to the platform account, four transfers in one batch. The trade must be created and unfunded. This moves real money from both parties.",
1223
- "effects": {
1224
- "moves": [
1225
- {
1226
- "signature": "moves.collection.pay_in",
1227
- "source": "moves[0]"
1228
- },
1229
- {
1230
- "signature": "moves.collection.pay_in",
1231
- "source": "moves[1]"
1232
- },
1233
- {
1234
- "signature": "moves.transfer.internal",
1235
- "source": "moves[2]"
1236
- },
1237
- {
1238
- "signature": "moves.transfer.internal",
1239
- "source": "moves[3]"
1240
- }
1241
- ]
1242
- },
1243
- "moves": [
1244
- {
1245
- "bind": {
1246
- "amount": {
1247
- "from": "instance",
1248
- "path": "fields.memberPays"
1249
- },
1250
- "currency": {
1251
- "from": "instance",
1252
- "path": "fields.currency"
1253
- },
1254
- "destinationAccountId": {
1255
- "from": "instance",
1256
- "path": "refs.escrowAccountId"
1257
- },
1258
- "metadata.instrumentId": {
1259
- "from": "const",
1260
- "value": "member_trade"
1261
- },
1262
- "metadata.instrumentInstanceId": {
1263
- "from": "instance",
1264
- "path": "instrumentInstanceId"
1265
- },
1266
- "metadata.phase": {
1267
- "from": "const",
1268
- "value": "fund"
1269
- },
1270
- "productId": {
1271
- "from": "instance",
1272
- "path": "productId"
1273
- },
1274
- "sourceAccountId": {
1275
- "from": "instance",
1276
- "path": "fields.memberAccountId"
1277
- }
1278
- },
1279
- "capture": {
1280
- "fundSideAPrincipalTransferId": "transferId"
1281
- },
1282
- "key": "side_a_principal",
1283
- "operation": "internal_transfer.create"
1284
- },
1285
- {
1286
- "bind": {
1287
- "amount": {
1288
- "from": "instance",
1289
- "path": "fields.sellerPays"
1290
- },
1291
- "currency": {
1292
- "from": "instance",
1293
- "path": "fields.currency"
1294
- },
1295
- "destinationAccountId": {
1296
- "from": "instance",
1297
- "path": "refs.escrowAccountId"
1298
- },
1299
- "metadata.instrumentId": {
1300
- "from": "const",
1301
- "value": "member_trade"
1302
- },
1303
- "metadata.instrumentInstanceId": {
1304
- "from": "instance",
1305
- "path": "instrumentInstanceId"
1306
- },
1307
- "metadata.phase": {
1308
- "from": "const",
1309
- "value": "fund"
1310
- },
1311
- "productId": {
1312
- "from": "instance",
1313
- "path": "productId"
1314
- },
1315
- "sourceAccountId": {
1316
- "from": "instance",
1317
- "path": "fields.sellerAccountId"
1318
- }
1319
- },
1320
- "capture": {
1321
- "fundSideBPrincipalTransferId": "transferId"
1322
- },
1323
- "key": "side_b_principal",
1324
- "operation": "internal_transfer.create"
1325
- },
1326
- {
1327
- "bind": {
1328
- "amount": {
1329
- "from": "instance",
1330
- "path": "fields.memberTradeFee"
1331
- },
1332
- "currency": {
1333
- "from": "instance",
1334
- "path": "fields.currency"
1335
- },
1336
- "destinationAccountId": {
1337
- "from": "instance",
1338
- "path": "fields.platformAccountId"
1339
- },
1340
- "metadata.instrumentId": {
1341
- "from": "const",
1342
- "value": "member_trade"
1343
- },
1344
- "metadata.instrumentInstanceId": {
1345
- "from": "instance",
1346
- "path": "instrumentInstanceId"
1347
- },
1348
- "metadata.phase": {
1349
- "from": "const",
1350
- "value": "fund"
1351
- },
1352
- "productId": {
1353
- "from": "instance",
1354
- "path": "productId"
1355
- },
1356
- "sourceAccountId": {
1357
- "from": "instance",
1358
- "path": "fields.memberAccountId"
1359
- }
1360
- },
1361
- "capture": {
1362
- "fundSideAServiceFeeTransferId": "transferId"
1363
- },
1364
- "key": "side_a_service_fee",
1365
- "operation": "internal_transfer.create"
1366
- },
1367
- {
1368
- "bind": {
1369
- "amount": {
1370
- "from": "instance",
1371
- "path": "fields.sellerTradeFee"
1372
- },
1373
- "currency": {
1374
- "from": "instance",
1375
- "path": "fields.currency"
1376
- },
1377
- "destinationAccountId": {
1378
- "from": "instance",
1379
- "path": "fields.platformAccountId"
1380
- },
1381
- "metadata.instrumentId": {
1382
- "from": "const",
1383
- "value": "member_trade"
1384
- },
1385
- "metadata.instrumentInstanceId": {
1386
- "from": "instance",
1387
- "path": "instrumentInstanceId"
1388
- },
1389
- "metadata.phase": {
1390
- "from": "const",
1391
- "value": "fund"
1392
- },
1393
- "productId": {
1394
- "from": "instance",
1395
- "path": "productId"
1396
- },
1397
- "sourceAccountId": {
1398
- "from": "instance",
1399
- "path": "fields.sellerAccountId"
1400
- }
1401
- },
1402
- "capture": {
1403
- "fundSideBServiceFeeTransferId": "transferId"
1404
- },
1405
- "key": "side_b_service_fee",
1406
- "operation": "internal_transfer.create"
1407
- }
1408
- ],
1409
- "publicAction": "fundMemberTrade",
1410
- "steps": [],
1411
- "summary": "Fund both trade sides and collect on-top fees atomically"
1412
- },
1413
- "post": {
1414
- "due": {
1415
- "field": "clawbackAt"
1416
- },
1417
- "effects": {
1418
- "moves": [
1419
- {
1420
- "signature": "moves.transfer.internal",
1421
- "source": "moves[0]"
1422
- },
1423
- {
1424
- "signature": "moves.transfer.internal",
1425
- "source": "moves[1]"
1426
- }
1427
- ],
1428
- "schedules": [
1429
- {
1430
- "signature": "schedules.due",
1431
- "source": "due"
1432
- }
1433
- ]
1434
- },
1435
- "moves": [
1436
- {
1437
- "bind": {
1438
- "transferId": {
1439
- "from": "instance",
1440
- "path": "refs.releaseSideATransferId"
1441
- }
1442
- },
1443
- "key": "side_a",
1444
- "operation": "internal_transfer.post"
1445
- },
1446
- {
1447
- "bind": {
1448
- "transferId": {
1449
- "from": "instance",
1450
- "path": "refs.releaseSideBTransferId"
1451
- }
1452
- },
1453
- "key": "side_b",
1454
- "operation": "internal_transfer.post"
1455
- }
1456
- ],
1457
- "steps": [],
1458
- "summary": "Post both trade reservations when the clawback window matures"
1459
- },
1460
- "release": {
1461
- "agentDescription": "Reserve each side's principal for the other side and start the dispute window. The trade must be funded. Money is reserved, not settled. It posts on its own when the window matures, and dispute unwinds it before then. Either trading party may call it.",
1462
- "effects": {
1463
- "decides": [
1464
- {
1465
- "signature": "decides.tenant_port",
1466
- "source": "port"
1467
- }
1468
- ],
1469
- "holds": [
1470
- {
1471
- "signature": "holds.reserve",
1472
- "source": "moves[0]"
1473
- },
1474
- {
1475
- "signature": "holds.reserve",
1476
- "source": "moves[1]"
1477
- }
1478
- ],
1479
- "moves": [
1480
- {
1481
- "signature": "moves.transfer.internal",
1482
- "source": "moves[0]"
1483
- },
1484
- {
1485
- "signature": "moves.transfer.internal",
1486
- "source": "moves[1]"
1487
- }
1488
- ]
1489
- },
1490
- "moves": [
1491
- {
1492
- "bind": {
1493
- "amount": {
1494
- "from": "instance",
1495
- "path": "fields.memberPays"
1496
- },
1497
- "currency": {
1498
- "from": "instance",
1499
- "path": "fields.currency"
1500
- },
1501
- "destinationAccountId": {
1502
- "from": "instance",
1503
- "path": "fields.sellerAccountId"
1504
- },
1505
- "metadata.clawbackAt": {
1506
- "from": "instance",
1507
- "path": "fields.clawbackAt"
1508
- },
1509
- "metadata.instrumentId": {
1510
- "from": "const",
1511
- "value": "member_trade"
1512
- },
1513
- "metadata.instrumentInstanceId": {
1514
- "from": "instance",
1515
- "path": "instrumentInstanceId"
1516
- },
1517
- "metadata.phase": {
1518
- "from": "const",
1519
- "value": "release"
1520
- },
1521
- "productId": {
1522
- "from": "instance",
1523
- "path": "productId"
1524
- },
1525
- "sourceAccountId": {
1526
- "from": "instance",
1527
- "path": "refs.escrowAccountId"
1528
- }
1529
- },
1530
- "capture": {
1531
- "releaseSideATransferId": "transferId"
1532
- },
1533
- "key": "side_a",
1534
- "operation": "internal_transfer.reserve"
1535
- },
1536
- {
1537
- "bind": {
1538
- "amount": {
1539
- "from": "instance",
1540
- "path": "fields.sellerPays"
1541
- },
1542
- "currency": {
1543
- "from": "instance",
1544
- "path": "fields.currency"
1545
- },
1546
- "destinationAccountId": {
1547
- "from": "instance",
1548
- "path": "fields.memberAccountId"
1549
- },
1550
- "metadata.clawbackAt": {
1551
- "from": "instance",
1552
- "path": "fields.clawbackAt"
1553
- },
1554
- "metadata.instrumentId": {
1555
- "from": "const",
1556
- "value": "member_trade"
1557
- },
1558
- "metadata.instrumentInstanceId": {
1559
- "from": "instance",
1560
- "path": "instrumentInstanceId"
1561
- },
1562
- "metadata.phase": {
1563
- "from": "const",
1564
- "value": "release"
1565
- },
1566
- "productId": {
1567
- "from": "instance",
1568
- "path": "productId"
1569
- },
1570
- "sourceAccountId": {
1571
- "from": "instance",
1572
- "path": "refs.escrowAccountId"
1573
- }
1574
- },
1575
- "capture": {
1576
- "releaseSideBTransferId": "transferId"
1577
- },
1578
- "key": "side_b",
1579
- "operation": "internal_transfer.reserve"
1580
- }
1581
- ],
1582
- "port": {
1583
- "allowedParties": [
1584
- "payer",
1585
- "beneficiary"
1586
- ]
1587
- },
1588
- "publicAction": "releaseMemberTrade",
1589
- "setsAt": {
1590
- "field": "clawbackAt",
1591
- "offset": "P14D"
1592
- },
1593
- "steps": [],
1594
- "summary": "Reserve both cross-payments for the whole-trade clawback window"
1595
- }
1596
- },
1597
- "agentDescription": "Reach for swap when two named parties pay each other in one atomic trade and neither leg may settle alone. Both principals fund one escrow together, both cross-payments reserve together, and one dispute unwinds both. A single payer paying a single payee is instant transfer instead.",
1598
- "description": "Atomic swap between member and seller; half-funded and half-released states do not exist",
1599
- "distinctParties": true,
1600
- "feeRules": [
1601
- {
1602
- "amountField": "memberTradeFee",
1603
- "baseField": "memberPays",
1604
- "bearerField": "memberAccountId",
1605
- "position": "on_top",
1606
- "rule": {
1607
- "currencyField": "currency",
1608
- "field": "memberTradeFee",
1609
- "kind": "exact"
1610
- }
1611
- },
1612
- {
1613
- "amountField": "sellerTradeFee",
1614
- "baseField": "sellerPays",
1615
- "bearerField": "sellerAccountId",
1616
- "position": "on_top",
1617
- "rule": {
1618
- "currencyField": "currency",
1619
- "field": "sellerTradeFee",
1620
- "kind": "exact"
1621
- }
1622
- }
1623
- ],
1624
- "fields": {
1625
- "clawbackAt": {
1626
- "description": "Machine-owned end of the P14D whole-trade dispute window",
1627
- "format": "hyperscale-date-time",
1628
- "type": "string"
1629
- },
1630
- "currency": {
1631
- "description": "ISO 4217 currency code",
1632
- "maxLength": 3,
1633
- "minLength": 3,
1634
- "pattern": "^[A-Z]{3}$",
1635
- "type": "string"
1636
- },
1637
- "memberAccountId": {
1638
- "description": "The member account",
1639
- "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
1640
- "type": "string",
1641
- "x-hyperscale-reference-filter": {
1642
- "column": "role",
1643
- "values": [
1644
- "customer_balance"
1645
- ]
1646
- }
1647
- },
1648
- "memberPays": {
1649
- "description": "Side A amount in SAR minor units, held against the whole trade",
1650
- "pattern": "^[1-9][0-9]{0,17}$",
1651
- "type": "string"
1652
- },
1653
- "memberTradeFee": {
1654
- "description": "Immutable exact member service fee in SAR minor units",
1655
- "pattern": "^[1-9][0-9]{0,17}$",
1656
- "type": "string"
1657
- },
1658
- "platformAccountId": {
1659
- "description": "The product fee collection account",
1660
- "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
1661
- "type": "string",
1662
- "x-hyperscale-fee-collection-port": true,
1663
- "x-hyperscale-reference-filter": {
1664
- "column": "role",
1665
- "values": [
1666
- "customer_balance",
1667
- "product_revenue"
1668
- ]
1669
- }
1670
- },
1671
- "sellerAccountId": {
1672
- "description": "The seller account",
1673
- "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
1674
- "type": "string",
1675
- "x-hyperscale-reference-filter": {
1676
- "column": "role",
1677
- "values": [
1678
- "customer_balance"
1679
- ]
1680
- }
1681
- },
1682
- "sellerPays": {
1683
- "description": "Side B amount in SAR minor units, held against the whole trade",
1684
- "pattern": "^[1-9][0-9]{0,17}$",
1685
- "type": "string"
1686
- },
1687
- "sellerTradeFee": {
1688
- "description": "Immutable exact seller service fee in SAR minor units",
1689
- "pattern": "^[1-9][0-9]{0,17}$",
1690
- "type": "string"
1691
- }
1692
- },
1693
- "id": "member_trade",
1694
- "idPrefix": "mt",
1695
- "lifecycle": {
1696
- "initial": "created",
1697
- "states": [
1698
- "created",
1699
- "abandoned",
1700
- "funded",
1701
- "cancelled",
1702
- "released",
1703
- "settled",
1704
- "clawed_back"
1705
- ],
1706
- "transitions": {
1707
- "abandon": {
1708
- "from": [
1709
- "created"
1710
- ],
1711
- "to": "abandoned"
1712
- },
1713
- "cancel": {
1714
- "from": [
1715
- "funded"
1716
- ],
1717
- "to": "cancelled"
1718
- },
1719
- "dispute": {
1720
- "from": [
1721
- "released"
1722
- ],
1723
- "to": "clawed_back"
1724
- },
1725
- "fund": {
1726
- "from": [
1727
- "created"
1728
- ],
1729
- "to": "funded"
1730
- },
1731
- "post": {
1732
- "from": [
1733
- "released"
1734
- ],
1735
- "to": "settled"
1736
- },
1737
- "release": {
1738
- "from": [
1739
- "funded"
1740
- ],
1741
- "to": "released"
1742
- }
1743
- }
1744
- },
1745
- "parties": {
1746
- "beneficiary": "sellerAccountId",
1747
- "payer": "memberAccountId"
1748
- },
1749
- "required": [
1750
- "memberAccountId",
1751
- "sellerAccountId",
1752
- "platformAccountId",
1753
- "memberPays",
1754
- "sellerPays",
1755
- "memberTradeFee",
1756
- "sellerTradeFee",
1757
- "currency"
1758
- ],
1759
- "summary": "Two-party atomic trade between member and seller",
1760
- "title": "Member trade"
1761
- },
1762
- {
1763
- "actionOrder": [
1764
- "create",
1765
- "close",
1766
- "calculate",
1767
- "approve",
1768
- "instruct",
1769
- "acknowledge_payout",
1770
- "reconcile"
1771
- ],
1772
- "actions": {
1773
- "acknowledge_payout": {
1774
- "agentDescription": "Record the beneficiary confirmation that the payout landed, with the reference kept in the receipt. The batch must already be instructed. Only the payout destination may call it. No money moves.",
1775
- "captureInput": {
1776
- "acknowledgementReference": "acknowledgementReference"
1777
- },
1778
- "effects": {
1779
- "decides": [
1780
- {
1781
- "signature": "decides.tenant_port",
1782
- "source": "port"
1783
- }
1784
- ]
1785
- },
1786
- "input": {
1787
- "additionalProperties": false,
1788
- "properties": {
1789
- "acknowledgementReference": {
1790
- "description": "Required decision reference retained in the operation receipt",
1791
- "maxLength": 180,
1792
- "minLength": 1,
1793
- "type": "string"
1794
- }
1795
- },
1796
- "required": [
1797
- "acknowledgementReference"
1798
- ],
1799
- "type": "object"
1800
- },
1801
- "moves": [],
1802
- "port": {
1803
- "allowedParties": [
1804
- "beneficiary"
1805
- ]
1806
- },
1807
- "publicAction": "acknowledgePayoutSellerPayout",
1808
- "steps": [],
1809
- "summary": "Record the tenant's payout acknowledgement in the receipt"
1810
- },
1811
- "approve": {
1812
- "agentDescription": "Sign off on the frozen net payable. The batch must already be calculated. Nothing is recomputed and no money moves. This is the gate instruct waits on.",
1813
- "moves": [],
1814
- "publicAction": "approveSellerPayout",
1815
- "steps": [],
1816
- "summary": "Approve the frozen payable without recomputing it"
1817
- },
1818
- "calculate": {
1819
- "agentDescription": "Prove and freeze the one net payable from gross captures plus credit adjustments minus debit adjustments. The batch must be closed first. A zero or negative net is refused, so a batch in deficit never reaches a payout. No money moves.",
1820
- "moves": [],
1821
- "publicAction": "calculateSellerPayout",
1822
- "signedSum": {
1823
- "amountRef": "netPayable",
1824
- "onNegative": "refuse",
1825
- "onZero": "refuse",
1826
- "sources": [
1827
- {
1828
- "amountField": "amount",
1829
- "instrumentId": "seller_payout_capture_entry",
1830
- "refField": "sellerPayoutId",
1831
- "sign": "add",
1832
- "statuses": [
1833
- "accrued"
1834
- ],
1835
- "subtotalRef": "grossCaptureAmount"
1836
- },
1837
- {
1838
- "amountField": "amount",
1839
- "instrumentId": "seller_payout_credit_adjustment",
1840
- "refField": "sellerPayoutId",
1841
- "sign": "add",
1842
- "statuses": [
1843
- "applied"
1844
- ],
1845
- "subtotalRef": "creditAdjustmentAmount"
1846
- },
1847
- {
1848
- "amountField": "amount",
1849
- "instrumentId": "seller_payout_debit_adjustment",
1850
- "refField": "sellerPayoutId",
1851
- "sign": "subtract",
1852
- "statuses": [
1853
- "applied"
1854
- ],
1855
- "subtotalRef": "debitAdjustmentAmount"
1856
- }
1857
- ]
1858
- },
1859
- "steps": [],
1860
- "summary": "Prove and freeze the one signed net payable amount"
1861
- },
1862
- "close": {
1863
- "due": {
1864
- "field": "closeAt"
1865
- },
1866
- "effects": {
1867
- "schedules": [
1868
- {
1869
- "signature": "schedules.due",
1870
- "source": "due"
1871
- }
1872
- ]
1873
- },
1874
- "moves": [],
1875
- "steps": [],
1876
- "summary": "Freeze the batch and stop all new entries"
1877
- },
1878
- "create": {
1879
- "agentDescription": "Open a batch that capture entries and adjustments can accrue into. No money moves. The batch keeps taking entries until its close date freezes it.",
1880
- "moves": [],
1881
- "publicAction": "createSellerPayout",
1882
- "steps": [],
1883
- "summary": "Open a seller payout"
1884
- },
1885
- "instruct": {
1886
- "agentDescription": "Create one external payout for the frozen net payable, drawn on the settlement account and sent to the stored beneficiary. The batch must be approved. This moves money off the platform and is idempotent, so a retry never pays twice.",
1887
- "effects": {
1888
- "moves": [
1889
- {
1890
- "signature": "moves.payout.external",
1891
- "source": "payout"
1892
- }
1893
- ]
1894
- },
1895
- "moves": [],
1896
- "payout": {
1897
- "amount": "refs.netPayable",
1898
- "beneficiaryField": "payoutBeneficiaryId",
1899
- "beneficiaryPartyField": "payoutDestinationAccountId",
1900
- "capture": "payoutId",
1901
- "currencyField": "currency",
1902
- "sourceAccountField": "clubAccountId",
1903
- "speed": "standard"
1904
- },
1905
- "publicAction": "instructSellerPayout",
1906
- "steps": [],
1907
- "summary": "Create one idempotent payout from the frozen net payable"
1908
- },
1909
- "reconcile": {
1910
- "due": {
1911
- "field": "closeAt",
1912
- "offset": "P30D"
1913
- },
1914
- "effects": {
1915
- "reads": [
1916
- {
1917
- "signature": "reads.reconcile",
1918
- "source": "reconcile[0]"
1919
- }
1920
- ],
1921
- "schedules": [
1922
- {
1923
- "signature": "schedules.due",
1924
- "source": "due"
1925
- }
1926
- ]
1927
- },
1928
- "moves": [],
1929
- "reconcile": [
1930
- {
1931
- "amount": "refs.netPayable",
1932
- "capture": "settlementEvidenceId",
1933
- "counterpartyRef": "payoutId",
1934
- "currencyField": "currency",
1935
- "direction": "debit",
1936
- "evidence": "statement_line",
1937
- "exception": {
1938
- "childInstrumentId": "seller_payout_debit_adjustment",
1939
- "maxOpen": 1,
1940
- "refField": "sellerPayoutId"
1941
- },
1942
- "match": {
1943
- "law": "exact"
1944
- },
1945
- "within": {
1946
- "offset": "P30D"
1947
- }
1948
- }
1949
- ],
1950
- "steps": [],
1951
- "summary": "Match durable evidence that the payout settled"
1952
- }
1953
- },
1954
- "agentDescription": "Reach for settlement batch when many charges over a period roll up into one payout. Capture entries and adjustments accrue against an open batch, the batch freezes on its close date, calculate proves one signed net payable, and instruct sends a single external payout. Weighted distribution goes the other way, one amount out to many recipients.",
1955
- "description": "Immutable batch of capture lineage and signed adjustments that creates one payout",
1956
- "fields": {
1957
- "closeAt": {
1958
- "description": "Date the open batch freezes against later entries",
1959
- "format": "hyperscale-date-time",
1960
- "type": "string"
1961
- },
1962
- "clubAccountId": {
1963
- "description": "The club account",
1964
- "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
1965
- "type": "string",
1966
- "x-hyperscale-reference-filter": {
1967
- "column": "role",
1968
- "values": [
1969
- "customer_balance"
1970
- ]
1971
- }
1972
- },
1973
- "currency": {
1974
- "description": "ISO 4217 currency code",
1975
- "maxLength": 3,
1976
- "minLength": 3,
1977
- "pattern": "^[A-Z]{3}$",
1978
- "type": "string"
1979
- },
1980
- "payoutBeneficiaryId": {
1981
- "description": "Beneficiary ID for the payout instruction",
1982
- "pattern": "^ben_(sandbox|live)_[a-z0-9]{8,64}$",
1983
- "type": "string"
1984
- },
1985
- "payoutDestinationAccountId": {
1986
- "description": "The payout destination account",
1987
- "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
1988
- "type": "string",
1989
- "x-hyperscale-reference-filter": {
1990
- "column": "role",
1991
- "values": [
1992
- "customer_balance"
1993
- ]
1994
- }
1995
- }
1996
- },
1997
- "id": "seller_payout",
1998
- "idPrefix": "sp",
1999
- "lifecycle": {
2000
- "initial": "open",
2001
- "states": [
2002
- "open",
2003
- "closed",
2004
- "calculated",
2005
- "approved",
2006
- "instructed",
2007
- "acknowledged",
2008
- "reconciled"
2009
- ],
2010
- "transitions": {
2011
- "acknowledge_payout": {
2012
- "from": [
2013
- "instructed"
2014
- ],
2015
- "to": "acknowledged"
2016
- },
2017
- "approve": {
2018
- "from": [
2019
- "calculated"
2020
- ],
2021
- "to": "approved"
2022
- },
2023
- "calculate": {
2024
- "from": [
2025
- "closed"
2026
- ],
2027
- "to": "calculated"
2028
- },
2029
- "close": {
2030
- "from": [
2031
- "open"
2032
- ],
2033
- "to": "closed"
2034
- },
2035
- "instruct": {
2036
- "from": [
2037
- "approved"
2038
- ],
2039
- "to": "instructed"
2040
- },
2041
- "reconcile": {
2042
- "from": [
2043
- "instructed",
2044
- "acknowledged"
2045
- ],
2046
- "to": "reconciled"
2047
- }
2048
- }
2049
- },
2050
- "parties": {
2051
- "beneficiary": "payoutDestinationAccountId",
2052
- "payer": "clubAccountId"
2053
- },
2054
- "required": [
2055
- "payoutDestinationAccountId",
2056
- "clubAccountId",
2057
- "closeAt",
2058
- "currency",
2059
- "payoutBeneficiaryId"
2060
- ],
2061
- "summary": "Payout batch from club to payout destination",
2062
- "title": "Seller payout"
2063
- },
2064
- {
2065
- "actionOrder": [
2066
- "create",
2067
- "accrue"
2068
- ],
2069
- "actions": {
2070
- "accrue": {
2071
- "agentDescription": "Count this capture toward the batch gross total. The entry must be created and its batch still open, because a closed batch admits nothing new. No money moves.",
2072
- "effects": {
2073
- "reads": [
2074
- {
2075
- "signature": "reads.requires_refs",
2076
- "source": "requiresRefs"
2077
- }
2078
- ]
2079
- },
2080
- "moves": [],
2081
- "publicAction": "accrueSellerPayoutCaptureEntry",
2082
- "requiresRefs": [
2083
- {
2084
- "field": "sellerPayoutId",
2085
- "match": {
2086
- "fields.currency": "fields.currency"
2087
- },
2088
- "statuses": [
2089
- "open"
2090
- ]
2091
- }
2092
- ],
2093
- "steps": [],
2094
- "summary": "Accrue the capture entry into the open batch"
2095
- },
2096
- "create": {
2097
- "agentDescription": "Record one capture with its source reference against an open batch. The batch must be open and share the currency. No money moves, and the entry counts toward the net payable only once it accrues.",
2098
- "effects": {
2099
- "reads": [
2100
- {
2101
- "signature": "reads.requires_refs",
2102
- "source": "requiresRefs"
2103
- }
2104
- ]
2105
- },
2106
- "moves": [],
2107
- "publicAction": "createSellerPayoutCaptureEntry",
2108
- "requiresRefs": [
2109
- {
2110
- "field": "sellerPayoutId",
2111
- "match": {
2112
- "fields.currency": "fields.currency"
2113
- },
2114
- "statuses": [
2115
- "open"
2116
- ]
2117
- }
2118
- ],
2119
- "steps": [],
2120
- "summary": "Create a capture lineage entry on an open batch"
2121
- }
2122
- },
2123
- "agentDescription": "One gross capture that belongs to an open batch. Record one per source capture so the net payable keeps its lineage back to the original charge.",
2124
- "description": "One gross capture entry linked to an open payout batch",
2125
- "fields": {
2126
- "amount": {
2127
- "description": "Gross captured amount in minor units",
2128
- "pattern": "^[1-9][0-9]{0,17}$",
2129
- "type": "string"
2130
- },
2131
- "captureReference": {
2132
- "description": "Immutable source capture reference",
2133
- "maxLength": 180,
2134
- "minLength": 1,
2135
- "type": "string"
2136
- },
2137
- "currency": {
2138
- "description": "ISO 4217 currency code",
2139
- "maxLength": 3,
2140
- "minLength": 3,
2141
- "pattern": "^[A-Z]{3}$",
2142
- "type": "string"
2143
- },
2144
- "sellerPayoutId": {
2145
- "description": "Open batch this capture entry accrues into",
2146
- "pattern": "^sp_(sandbox|live)_[a-z0-9]{8,64}$",
2147
- "type": "string"
2148
- }
2149
- },
2150
- "id": "seller_payout_capture_entry",
2151
- "idPrefix": "spce",
2152
- "lifecycle": {
2153
- "initial": "created",
2154
- "states": [
2155
- "created",
2156
- "accrued"
2157
- ],
2158
- "transitions": {
2159
- "accrue": {
2160
- "from": [
2161
- "created"
2162
- ],
2163
- "to": "accrued"
2164
- }
2165
- }
2166
- },
2167
- "required": [
2168
- "amount",
2169
- "currency",
2170
- "sellerPayoutId",
2171
- "captureReference"
2172
- ],
2173
- "summary": "Gross capture lineage entry",
2174
- "title": "Seller payout Capture Entry"
2175
- },
2176
- {
2177
- "actionOrder": [
2178
- "create",
2179
- "adjust",
2180
- "correct"
2181
- ],
2182
- "actions": {
2183
- "adjust": {
2184
- "agentDescription": "Apply the credit adjustment so calculate counts it. The adjustment must be created and its batch still open. No money moves. The effect shows up in the batch net payable.",
2185
- "effects": {
2186
- "reads": [
2187
- {
2188
- "signature": "reads.requires_refs",
2189
- "source": "requiresRefs"
2190
- }
2191
- ]
2192
- },
2193
- "moves": [],
2194
- "publicAction": "adjustSellerPayoutCreditAdjustment",
2195
- "requiresRefs": [
2196
- {
2197
- "field": "sellerPayoutId",
2198
- "match": {
2199
- "fields.currency": "fields.currency"
2200
- },
2201
- "statuses": [
2202
- "open"
2203
- ]
2204
- }
2205
- ],
2206
- "steps": [],
2207
- "summary": "Apply the credit adjustment to the open batch"
2208
- },
2209
- "correct": {
2210
- "agentDescription": "Apply this adjustment as a correction on the open batch it names. Use it when the batch carrying the original entry has already closed, because a closed batch never changes. The adjustment must be created and no money moves.",
2211
- "effects": {
2212
- "reads": [
2213
- {
2214
- "signature": "reads.requires_refs",
2215
- "source": "requiresRefs"
2216
- }
2217
- ]
2218
- },
2219
- "moves": [],
2220
- "publicAction": "correctSellerPayoutCreditAdjustment",
2221
- "requiresRefs": [
2222
- {
2223
- "field": "sellerPayoutId",
2224
- "match": {
2225
- "fields.currency": "fields.currency"
2226
- },
2227
- "statuses": [
2228
- "open"
2229
- ]
2230
- }
2231
- ],
2232
- "steps": [],
2233
- "summary": "Record a later correction on this open batch instead of changing the closed source batch"
2234
- },
2235
- "create": {
2236
- "agentDescription": "Record a credit adjustment on an open batch, naming the capture reference it corrects. The batch must be open and share the currency. No money moves, and the adjustment counts only once it is applied.",
2237
- "effects": {
2238
- "reads": [
2239
- {
2240
- "signature": "reads.requires_refs",
2241
- "source": "requiresRefs"
2242
- }
2243
- ]
2244
- },
2245
- "moves": [],
2246
- "publicAction": "createSellerPayoutCreditAdjustment",
2247
- "requiresRefs": [
2248
- {
2249
- "field": "sellerPayoutId",
2250
- "match": {
2251
- "fields.currency": "fields.currency"
2252
- },
2253
- "statuses": [
2254
- "open"
2255
- ]
2256
- }
2257
- ],
2258
- "steps": [],
2259
- "summary": "Create a credit adjustment on an open batch"
2260
- }
2261
- },
2262
- "agentDescription": "One credit adjustment against an open batch, carrying the capture reference it corrects. Credit adjustments add to the net payable and debit adjustments subtract from it, so a late correction lands on the current open batch instead of reopening a closed one.",
2263
- "description": "One credit adjustment linked to an open payout batch; closed batches stay unchanged",
2264
- "fields": {
2265
- "adjustmentReference": {
2266
- "description": "Immutable explicit adjustment reference",
2267
- "maxLength": 180,
2268
- "minLength": 1,
2269
- "type": "string"
2270
- },
2271
- "amount": {
2272
- "description": "Credit adjustment amount in minor units",
2273
- "pattern": "^[1-9][0-9]{0,17}$",
2274
- "type": "string"
2275
- },
2276
- "captureReference": {
2277
- "description": "Original capture reference that this adjustment corrects",
2278
- "maxLength": 180,
2279
- "minLength": 1,
2280
- "type": "string"
2281
- },
2282
- "currency": {
2283
- "description": "ISO 4217 currency code",
2284
- "maxLength": 3,
2285
- "minLength": 3,
2286
- "pattern": "^[A-Z]{3}$",
2287
- "type": "string"
2288
- },
2289
- "externalReversalReference": {
2290
- "description": "Optional externally decided reversal reference",
2291
- "maxLength": 180,
2292
- "minLength": 1,
2293
- "type": "string"
2294
- },
2295
- "feeReference": {
2296
- "description": "Optional fee entry reference",
2297
- "maxLength": 180,
2298
- "minLength": 1,
2299
- "type": "string"
2300
- },
2301
- "sellerPayoutId": {
2302
- "description": "Open batch this adjustment applies to",
2303
- "pattern": "^sp_(sandbox|live)_[a-z0-9]{8,64}$",
2304
- "type": "string"
2305
- }
2306
- },
2307
- "id": "seller_payout_credit_adjustment",
2308
- "idPrefix": "spca",
2309
- "lifecycle": {
2310
- "initial": "created",
2311
- "states": [
2312
- "created",
2313
- "applied"
2314
- ],
2315
- "transitions": {
2316
- "adjust": {
2317
- "from": [
2318
- "created"
2319
- ],
2320
- "to": "applied"
2321
- },
2322
- "correct": {
2323
- "from": [
2324
- "created"
2325
- ],
2326
- "to": "applied"
2327
- }
2328
- }
2329
- },
2330
- "required": [
2331
- "amount",
2332
- "currency",
2333
- "adjustmentReference",
2334
- "sellerPayoutId",
2335
- "captureReference"
2336
- ],
2337
- "summary": "Credit adjustment with capture lineage",
2338
- "title": "Seller payout Credit Adjustment"
2339
- },
2340
- {
2341
- "actionOrder": [
2342
- "create",
2343
- "adjust",
2344
- "correct"
2345
- ],
2346
- "actions": {
2347
- "adjust": {
2348
- "agentDescription": "Apply the debit adjustment so calculate counts it. The adjustment must be created and its batch still open. No money moves. The effect shows up in the batch net payable.",
2349
- "effects": {
2350
- "reads": [
2351
- {
2352
- "signature": "reads.requires_refs",
2353
- "source": "requiresRefs"
2354
- }
2355
- ]
2356
- },
2357
- "moves": [],
2358
- "publicAction": "adjustSellerPayoutDebitAdjustment",
2359
- "requiresRefs": [
2360
- {
2361
- "field": "sellerPayoutId",
2362
- "match": {
2363
- "fields.currency": "fields.currency"
2364
- },
2365
- "statuses": [
2366
- "open"
2367
- ]
2368
- }
2369
- ],
2370
- "steps": [],
2371
- "summary": "Apply the debit adjustment to the open batch"
2372
- },
2373
- "correct": {
2374
- "agentDescription": "Apply this adjustment as a correction on the open batch it names. Use it when the batch carrying the original entry has already closed, because a closed batch never changes. The adjustment must be created and no money moves.",
2375
- "effects": {
2376
- "reads": [
2377
- {
2378
- "signature": "reads.requires_refs",
2379
- "source": "requiresRefs"
2380
- }
2381
- ]
2382
- },
2383
- "moves": [],
2384
- "publicAction": "correctSellerPayoutDebitAdjustment",
2385
- "requiresRefs": [
2386
- {
2387
- "field": "sellerPayoutId",
2388
- "match": {
2389
- "fields.currency": "fields.currency"
2390
- },
2391
- "statuses": [
2392
- "open"
2393
- ]
2394
- }
2395
- ],
2396
- "steps": [],
2397
- "summary": "Record a later correction on this open batch instead of changing the closed source batch"
2398
- },
2399
- "create": {
2400
- "agentDescription": "Record a debit adjustment on an open batch, naming the capture reference it corrects. The batch must be open and share the currency. No money moves, and the adjustment counts only once it is applied.",
2401
- "effects": {
2402
- "reads": [
2403
- {
2404
- "signature": "reads.requires_refs",
2405
- "source": "requiresRefs"
2406
- }
2407
- ]
2408
- },
2409
- "moves": [],
2410
- "publicAction": "createSellerPayoutDebitAdjustment",
2411
- "requiresRefs": [
2412
- {
2413
- "field": "sellerPayoutId",
2414
- "match": {
2415
- "fields.currency": "fields.currency"
2416
- },
2417
- "statuses": [
2418
- "open"
2419
- ]
2420
- }
2421
- ],
2422
- "steps": [],
2423
- "summary": "Create a debit adjustment on an open batch"
2424
- }
2425
- },
2426
- "agentDescription": "One debit adjustment against an open batch, carrying the capture reference it corrects. Credit adjustments add to the net payable and debit adjustments subtract from it, so a late correction lands on the current open batch instead of reopening a closed one.",
2427
- "description": "One debit adjustment linked to an open payout batch; closed batches stay unchanged",
2428
- "fields": {
2429
- "adjustmentReference": {
2430
- "description": "Immutable explicit adjustment reference",
2431
- "maxLength": 180,
2432
- "minLength": 1,
2433
- "type": "string"
2434
- },
2435
- "amount": {
2436
- "description": "Debit adjustment amount in minor units",
2437
- "pattern": "^[1-9][0-9]{0,17}$",
2438
- "type": "string"
2439
- },
2440
- "captureReference": {
2441
- "description": "Original capture reference that this adjustment corrects",
2442
- "maxLength": 180,
2443
- "minLength": 1,
2444
- "type": "string"
2445
- },
2446
- "currency": {
2447
- "description": "ISO 4217 currency code",
2448
- "maxLength": 3,
2449
- "minLength": 3,
2450
- "pattern": "^[A-Z]{3}$",
2451
- "type": "string"
2452
- },
2453
- "externalReversalReference": {
2454
- "description": "Optional externally decided reversal reference",
2455
- "maxLength": 180,
2456
- "minLength": 1,
2457
- "type": "string"
2458
- },
2459
- "feeReference": {
2460
- "description": "Optional fee entry reference",
2461
- "maxLength": 180,
2462
- "minLength": 1,
2463
- "type": "string"
2464
- },
2465
- "sellerPayoutId": {
2466
- "description": "Open batch this adjustment applies to",
2467
- "pattern": "^sp_(sandbox|live)_[a-z0-9]{8,64}$",
2468
- "type": "string"
2469
- }
2470
- },
2471
- "id": "seller_payout_debit_adjustment",
2472
- "idPrefix": "spda",
2473
- "lifecycle": {
2474
- "initial": "created",
2475
- "states": [
2476
- "created",
2477
- "applied"
2478
- ],
2479
- "transitions": {
2480
- "adjust": {
2481
- "from": [
2482
- "created"
2483
- ],
2484
- "to": "applied"
2485
- },
2486
- "correct": {
2487
- "from": [
2488
- "created"
2489
- ],
2490
- "to": "applied"
2491
- }
2492
- }
2493
- },
2494
- "required": [
2495
- "amount",
2496
- "currency",
2497
- "adjustmentReference",
2498
- "sellerPayoutId",
2499
- "captureReference"
2500
- ],
2501
- "summary": "Debit adjustment with capture lineage",
2502
- "title": "Seller payout Debit Adjustment"
2503
- }
2504
- ],
2505
- "product": "watch_club",
2506
- "subjects": [
2507
- {
2508
- "declaredValue": "optional",
2509
- "kind": "watch",
2510
- "schema": {
2511
- "additionalProperties": false,
2512
- "properties": {},
2513
- "type": "object"
2514
- },
2515
- "title": "Watch",
2516
- "version": 1
2517
- }
2518
- ],
2519
- "title": "Watch club",
2520
- "udl": 1,
2521
- "version": 1
2522
- }
2523
-