@hyperscale0/hsx 2.4.0 → 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 (249) hide show
  1. package/CHANGELOG.md +2 -400
  2. package/README.md +3 -92
  3. package/dist/src/ast.d.ts +99 -310
  4. package/dist/src/ast.d.ts.map +1 -1
  5. package/dist/src/ast.js +16 -69
  6. package/dist/src/ast.js.map +1 -1
  7. package/dist/src/cli.d.ts +6 -19
  8. package/dist/src/cli.d.ts.map +1 -1
  9. package/dist/src/cli.js +76 -315
  10. package/dist/src/cli.js.map +1 -1
  11. package/dist/src/compile.d.ts +23 -73
  12. package/dist/src/compile.d.ts.map +1 -1
  13. package/dist/src/compile.js +1113 -148
  14. package/dist/src/compile.js.map +1 -1
  15. package/dist/src/cost.d.ts +8 -77
  16. package/dist/src/cost.d.ts.map +1 -1
  17. package/dist/src/cost.js +13 -422
  18. package/dist/src/cost.js.map +1 -1
  19. package/dist/src/format.d.ts +8 -7
  20. package/dist/src/format.d.ts.map +1 -1
  21. package/dist/src/format.js +9 -175
  22. package/dist/src/format.js.map +1 -1
  23. package/dist/src/headers.d.ts +35 -0
  24. package/dist/src/headers.d.ts.map +1 -0
  25. package/dist/src/headers.js +108 -0
  26. package/dist/src/headers.js.map +1 -0
  27. package/dist/src/index.d.ts +6 -12
  28. package/dist/src/index.d.ts.map +1 -1
  29. package/dist/src/index.js +4 -9
  30. package/dist/src/index.js.map +1 -1
  31. package/dist/src/lex.d.ts +8 -28
  32. package/dist/src/lex.d.ts.map +1 -1
  33. package/dist/src/lex.js +88 -146
  34. package/dist/src/lex.js.map +1 -1
  35. package/dist/src/parse.d.ts +4 -17
  36. package/dist/src/parse.d.ts.map +1 -1
  37. package/dist/src/parse.js +402 -1040
  38. package/dist/src/parse.js.map +1 -1
  39. package/dist/src/std-bundle.d.ts.map +1 -1
  40. package/dist/src/std-bundle.js +12 -20
  41. package/dist/src/std-bundle.js.map +1 -1
  42. package/dist/src/std-library.d.ts +1 -1
  43. package/dist/src/std-library.d.ts.map +1 -1
  44. package/dist/src/std-library.js +1 -5
  45. package/dist/src/std-library.js.map +1 -1
  46. package/dist/src/tunables.d.ts +7 -0
  47. package/dist/src/tunables.d.ts.map +1 -0
  48. package/dist/src/tunables.js +26 -0
  49. package/dist/src/tunables.js.map +1 -0
  50. package/dist/src/version.d.ts +2 -4
  51. package/dist/src/version.d.ts.map +1 -1
  52. package/dist/src/version.js +2 -4
  53. package/dist/src/version.js.map +1 -1
  54. package/docs/README.md +179 -41
  55. package/docs/headers.md +44 -0
  56. package/examples/cost-table.json +99 -751
  57. package/examples/library.hsx +59 -0
  58. package/package.json +9 -17
  59. package/src/ast.ts +82 -441
  60. package/src/cli.ts +77 -362
  61. package/src/compile.ts +1535 -247
  62. package/src/cost.ts +28 -671
  63. package/src/format.ts +12 -256
  64. package/src/headers.ts +126 -0
  65. package/src/index.ts +7 -39
  66. package/src/lex.ts +99 -195
  67. package/src/parse.ts +403 -1209
  68. package/src/std-bundle.ts +12 -20
  69. package/src/std-library.ts +2 -7
  70. package/src/tunables.ts +31 -0
  71. package/src/version.ts +2 -5
  72. package/std/approvals.hsx +17 -0
  73. package/std/cards.hsx +63 -0
  74. package/std/collections.hsx +31 -0
  75. package/std/escrow.hsx +43 -0
  76. package/std/financing.hsx +372 -0
  77. package/std/insurance.hsx +59 -0
  78. package/std/lending.hsx +115 -0
  79. package/std/marketplace.hsx +24 -0
  80. package/std/money.hsx +195 -0
  81. package/std/savings.hsx +44 -0
  82. package/std/travel.hsx +98 -0
  83. package/std/wallet.hsx +41 -0
  84. package/dist/src/diagnostics.d.ts +0 -13
  85. package/dist/src/diagnostics.d.ts.map +0 -1
  86. package/dist/src/diagnostics.js +0 -587
  87. package/dist/src/diagnostics.js.map +0 -1
  88. package/dist/src/emit.d.ts +0 -51
  89. package/dist/src/emit.d.ts.map +0 -1
  90. package/dist/src/emit.js +0 -192
  91. package/dist/src/emit.js.map +0 -1
  92. package/dist/src/entry-overrides.d.ts +0 -58
  93. package/dist/src/entry-overrides.d.ts.map +0 -1
  94. package/dist/src/entry-overrides.js +0 -284
  95. package/dist/src/entry-overrides.js.map +0 -1
  96. package/dist/src/ir.d.ts +0 -73
  97. package/dist/src/ir.d.ts.map +0 -1
  98. package/dist/src/ir.js +0 -15
  99. package/dist/src/ir.js.map +0 -1
  100. package/dist/src/limits.d.ts +0 -23
  101. package/dist/src/limits.d.ts.map +0 -1
  102. package/dist/src/limits.js +0 -23
  103. package/dist/src/limits.js.map +0 -1
  104. package/dist/src/lsp/server.d.ts +0 -32
  105. package/dist/src/lsp/server.d.ts.map +0 -1
  106. package/dist/src/lsp/server.js +0 -391
  107. package/dist/src/lsp/server.js.map +0 -1
  108. package/dist/src/modules.d.ts +0 -38
  109. package/dist/src/modules.d.ts.map +0 -1
  110. package/dist/src/modules.js +0 -372
  111. package/dist/src/modules.js.map +0 -1
  112. package/dist/src/typecheck.d.ts +0 -8
  113. package/dist/src/typecheck.d.ts.map +0 -1
  114. package/dist/src/typecheck.js +0 -4131
  115. package/dist/src/typecheck.js.map +0 -1
  116. package/docs/guide/01-first-program.md +0 -24
  117. package/docs/guide/02-money.md +0 -25
  118. package/docs/guide/03-instruments.md +0 -93
  119. package/docs/guide/04-lifecycles.md +0 -40
  120. package/docs/guide/05-fees-and-splits.md +0 -45
  121. package/docs/guide/06-schedules.md +0 -26
  122. package/docs/guide/07-composition.md +0 -52
  123. package/docs/guide/08-writing-a-module.md +0 -85
  124. package/docs/guide/09-cost.md +0 -24
  125. package/docs/guide/10-diagnostics.md +0 -27
  126. package/docs/llms-full.txt +0 -3684
  127. package/docs/llms.txt +0 -44
  128. package/docs/piece-plans.md +0 -120
  129. package/docs/playground.md +0 -55
  130. package/docs/reference/cli.md +0 -36
  131. package/docs/reference/diagnostics.md +0 -901
  132. package/docs/reference/grammar.md +0 -38
  133. package/docs/reference/std/advance.md +0 -112
  134. package/docs/reference/std/cancellable_booking.md +0 -159
  135. package/docs/reference/std/captured_payment.md +0 -115
  136. package/docs/reference/std/conditional_disbursement.md +0 -101
  137. package/docs/reference/std/credit_facility.md +0 -108
  138. package/docs/reference/std/held_payment.md +0 -173
  139. package/docs/reference/std/instant_transfer.md +0 -97
  140. package/docs/reference/std/metered.md +0 -89
  141. package/docs/reference/std/pooled_split.md +0 -95
  142. package/docs/reference/std/premium_forward.md +0 -119
  143. package/docs/reference/std/reconciled_payout.md +0 -103
  144. package/docs/reference/std/rotating_pool.md +0 -130
  145. package/docs/reference/std/scheduled.md +0 -136
  146. package/docs/reference/std/security_deposit.md +0 -138
  147. package/docs/reference/std/settlement_batch.md +0 -123
  148. package/docs/reference/std/swap.md +0 -133
  149. package/docs/reference/std/threshold_pool.md +0 -138
  150. package/docs/reference/std/weighted_distribution.md +0 -135
  151. package/docs/reference/types.md +0 -61
  152. package/docs/reference/udl-output.md +0 -13
  153. package/examples/01-first-program/README.md +0 -45
  154. package/examples/01-first-program/tip-jar.hsx +0 -17
  155. package/examples/02-imports-and-modules/README.md +0 -96
  156. package/examples/02-imports-and-modules/photo-booth.hsx +0 -37
  157. package/examples/03-diagnostics/README.md +0 -68
  158. package/examples/03-diagnostics/corner-shop-fixed.hsx +0 -22
  159. package/examples/03-diagnostics/corner-shop.hsx +0 -19
  160. package/examples/04-complete-product/README.md +0 -84
  161. package/examples/04-complete-product/study-hall.hsx +0 -67
  162. package/examples/05-authored-instrument/README.md +0 -5
  163. package/examples/05-authored-instrument/payment.hsx +0 -37
  164. package/examples/05-watch-club/README.md +0 -6
  165. package/examples/05-watch-club/watch-club.hsx +0 -123
  166. package/examples/README.md +0 -48
  167. package/examples/advance/README.md +0 -3
  168. package/examples/advance/advance.hsx +0 -13
  169. package/examples/advance/advance.udl +0 -367
  170. package/examples/cancellable_booking/README.md +0 -3
  171. package/examples/cancellable_booking/cancellable_booking.hsx +0 -14
  172. package/examples/cancellable_booking/cancellable_booking.udl +0 -413
  173. package/examples/captured_payment/README.md +0 -3
  174. package/examples/captured_payment/captured_payment.hsx +0 -17
  175. package/examples/captured_payment/captured_payment.udl +0 -686
  176. package/examples/conditional_disbursement/README.md +0 -3
  177. package/examples/conditional_disbursement/conditional_disbursement.hsx +0 -15
  178. package/examples/conditional_disbursement/conditional_disbursement.udl +0 -418
  179. package/examples/credit_facility/README.md +0 -3
  180. package/examples/credit_facility/credit_facility.hsx +0 -24
  181. package/examples/credit_facility/credit_facility.udl +0 -1396
  182. package/examples/held_payment/README.md +0 -3
  183. package/examples/held_payment/held_payment.hsx +0 -13
  184. package/examples/held_payment/held_payment.udl +0 -569
  185. package/examples/instant_transfer/README.md +0 -3
  186. package/examples/instant_transfer/instant_transfer.hsx +0 -16
  187. package/examples/instant_transfer/instant_transfer.udl +0 -376
  188. package/examples/metered/README.md +0 -3
  189. package/examples/metered/metered.hsx +0 -13
  190. package/examples/metered/metered.udl +0 -253
  191. package/examples/pooled_split/README.md +0 -3
  192. package/examples/pooled_split/pooled_split.hsx +0 -15
  193. package/examples/pooled_split/pooled_split.udl +0 -432
  194. package/examples/premium_forward/README.md +0 -3
  195. package/examples/premium_forward/premium_forward.hsx +0 -19
  196. package/examples/premium_forward/premium_forward.udl +0 -604
  197. package/examples/reconciled_payout/README.md +0 -3
  198. package/examples/reconciled_payout/reconciled_payout.hsx +0 -13
  199. package/examples/reconciled_payout/reconciled_payout.udl +0 -312
  200. package/examples/rotating_pool/README.md +0 -3
  201. package/examples/rotating_pool/rotating_pool.hsx +0 -18
  202. package/examples/rotating_pool/rotating_pool.udl +0 -4370
  203. package/examples/scheduled/README.md +0 -3
  204. package/examples/scheduled/scheduled.hsx +0 -12
  205. package/examples/scheduled/scheduled.udl +0 -355
  206. package/examples/security_deposit/README.md +0 -3
  207. package/examples/security_deposit/security_deposit.hsx +0 -21
  208. package/examples/security_deposit/security_deposit.udl +0 -320
  209. package/examples/settlement_batch/README.md +0 -3
  210. package/examples/settlement_batch/settlement_batch.hsx +0 -19
  211. package/examples/settlement_batch/settlement_batch.udl +0 -757
  212. package/examples/swap/README.md +0 -3
  213. package/examples/swap/swap.hsx +0 -19
  214. package/examples/swap/swap.udl +0 -892
  215. package/examples/threshold_pool/README.md +0 -3
  216. package/examples/threshold_pool/threshold_pool.hsx +0 -16
  217. package/examples/threshold_pool/threshold_pool.udl +0 -680
  218. package/examples/weighted_distribution/README.md +0 -3
  219. package/examples/weighted_distribution/weighted_distribution.hsx +0 -20
  220. package/examples/weighted_distribution/weighted_distribution.udl +0 -348
  221. package/skills/hsx/SKILL.md +0 -449
  222. package/src/diagnostics.ts +0 -620
  223. package/src/emit.ts +0 -282
  224. package/src/entry-overrides.ts +0 -428
  225. package/src/ir.ts +0 -113
  226. package/src/limits.ts +0 -22
  227. package/src/lsp/server.ts +0 -460
  228. package/src/modules.ts +0 -452
  229. package/src/typecheck.ts +0 -5381
  230. package/std/SEMANTICS.md +0 -44
  231. package/std/money_flows/advance.hsx +0 -235
  232. package/std/money_flows/cancellable_booking.hsx +0 -402
  233. package/std/money_flows/captured_payment.hsx +0 -220
  234. package/std/money_flows/conditional_disbursement.hsx +0 -226
  235. package/std/money_flows/credit_facility.hsx +0 -214
  236. package/std/money_flows/held_payment.hsx +0 -812
  237. package/std/money_flows/index.hsx +0 -4
  238. package/std/money_flows/instant_transfer.hsx +0 -231
  239. package/std/money_flows/metered.hsx +0 -104
  240. package/std/money_flows/pooled_split.hsx +0 -109
  241. package/std/money_flows/premium_forward.hsx +0 -307
  242. package/std/money_flows/reconciled_payout.hsx +0 -119
  243. package/std/money_flows/rotating_pool.hsx +0 -305
  244. package/std/money_flows/scheduled.hsx +0 -599
  245. package/std/money_flows/security_deposit.hsx +0 -248
  246. package/std/money_flows/settlement_batch.hsx +0 -173
  247. package/std/money_flows/swap.hsx +0 -1192
  248. package/std/money_flows/threshold_pool.hsx +0 -307
  249. package/std/money_flows/weighted_distribution.hsx +0 -237
@@ -1,757 +0,0 @@
1
- {
2
- "instruments": [
3
- {
4
- "actionOrder": [
5
- "create",
6
- "close",
7
- "calculate",
8
- "approve",
9
- "instruct",
10
- "acknowledge_payout",
11
- "reconcile"
12
- ],
13
- "actions": {
14
- "acknowledge_payout": {
15
- "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.",
16
- "captureInput": {
17
- "acknowledgementReference": "acknowledgementReference"
18
- },
19
- "effects": {
20
- "decides": [
21
- {
22
- "signature": "decides.tenant_port",
23
- "source": "port"
24
- }
25
- ]
26
- },
27
- "input": {
28
- "additionalProperties": false,
29
- "properties": {
30
- "acknowledgementReference": {
31
- "description": "Required decision reference retained in the operation receipt",
32
- "maxLength": 180,
33
- "minLength": 1,
34
- "type": "string"
35
- }
36
- },
37
- "required": [
38
- "acknowledgementReference"
39
- ],
40
- "type": "object"
41
- },
42
- "moves": [],
43
- "port": {
44
- "allowedParties": [
45
- "beneficiary"
46
- ]
47
- },
48
- "publicAction": "acknowledgePayoutBatch",
49
- "steps": [],
50
- "summary": "Record the tenant's payout acknowledgement in the receipt"
51
- },
52
- "approve": {
53
- "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.",
54
- "moves": [],
55
- "publicAction": "approveBatch",
56
- "steps": [],
57
- "summary": "Approve the frozen payable without recomputing it"
58
- },
59
- "calculate": {
60
- "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.",
61
- "moves": [],
62
- "publicAction": "calculateBatch",
63
- "signedSum": {
64
- "amountRef": "netPayable",
65
- "onNegative": "refuse",
66
- "onZero": "refuse",
67
- "sources": [
68
- {
69
- "amountField": "amount",
70
- "instrumentId": "batch_capture_entry",
71
- "refField": "batchId",
72
- "sign": "add",
73
- "statuses": [
74
- "accrued"
75
- ],
76
- "subtotalRef": "grossCaptureAmount"
77
- },
78
- {
79
- "amountField": "amount",
80
- "instrumentId": "batch_credit_adjustment",
81
- "refField": "batchId",
82
- "sign": "add",
83
- "statuses": [
84
- "applied"
85
- ],
86
- "subtotalRef": "creditAdjustmentAmount"
87
- },
88
- {
89
- "amountField": "amount",
90
- "instrumentId": "batch_debit_adjustment",
91
- "refField": "batchId",
92
- "sign": "subtract",
93
- "statuses": [
94
- "applied"
95
- ],
96
- "subtotalRef": "debitAdjustmentAmount"
97
- }
98
- ]
99
- },
100
- "steps": [],
101
- "summary": "Prove and freeze the one signed net payable amount"
102
- },
103
- "close": {
104
- "due": {
105
- "field": "closeAt"
106
- },
107
- "effects": {
108
- "schedules": [
109
- {
110
- "signature": "schedules.due",
111
- "source": "due"
112
- }
113
- ]
114
- },
115
- "moves": [],
116
- "steps": [],
117
- "summary": "Freeze the batch and stop all new entries"
118
- },
119
- "create": {
120
- "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.",
121
- "moves": [],
122
- "publicAction": "createBatch",
123
- "steps": [],
124
- "summary": "Open a batch"
125
- },
126
- "instruct": {
127
- "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.",
128
- "effects": {
129
- "moves": [
130
- {
131
- "signature": "moves.payout.external",
132
- "source": "payout"
133
- }
134
- ]
135
- },
136
- "moves": [],
137
- "payout": {
138
- "amount": "refs.netPayable",
139
- "beneficiaryField": "payoutBeneficiaryId",
140
- "beneficiaryPartyField": "payoutDestinationAccountId",
141
- "capture": "payoutId",
142
- "currencyField": "currency",
143
- "sourceAccountField": "settlementAccountAccountId",
144
- "speed": "standard"
145
- },
146
- "publicAction": "instructBatch",
147
- "steps": [],
148
- "summary": "Create one idempotent payout from the frozen net payable"
149
- },
150
- "reconcile": {
151
- "due": {
152
- "field": "closeAt",
153
- "offset": "P30D"
154
- },
155
- "effects": {
156
- "reads": [
157
- {
158
- "signature": "reads.reconcile",
159
- "source": "reconcile[0]"
160
- }
161
- ],
162
- "schedules": [
163
- {
164
- "signature": "schedules.due",
165
- "source": "due"
166
- }
167
- ]
168
- },
169
- "moves": [],
170
- "reconcile": [
171
- {
172
- "amount": "refs.netPayable",
173
- "capture": "settlementEvidenceId",
174
- "counterpartyRef": "payoutId",
175
- "currencyField": "currency",
176
- "direction": "debit",
177
- "evidence": "statement_line",
178
- "exception": {
179
- "amountField": "amount",
180
- "childInstrumentId": "batch_debit_adjustment",
181
- "maxOpen": 1,
182
- "reasonField": "adjustmentReference",
183
- "refField": "batchId"
184
- },
185
- "match": {
186
- "law": "exact"
187
- },
188
- "within": {
189
- "offset": "P30D"
190
- }
191
- }
192
- ],
193
- "steps": [],
194
- "summary": "Match durable evidence that the payout settled"
195
- }
196
- },
197
- "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.",
198
- "description": "Immutable batch of capture lineage and signed adjustments that creates one payout",
199
- "fields": {
200
- "closeAt": {
201
- "description": "Date the open batch freezes against later entries",
202
- "format": "hyperscale-date-time",
203
- "type": "string"
204
- },
205
- "currency": {
206
- "description": "ISO 4217 currency code",
207
- "maxLength": 3,
208
- "minLength": 3,
209
- "pattern": "^[A-Z]{3}$",
210
- "type": "string"
211
- },
212
- "payoutBeneficiaryId": {
213
- "description": "Beneficiary ID for the payout instruction",
214
- "pattern": "^ben_(sandbox|live)_[a-z0-9]{8,64}$",
215
- "type": "string"
216
- },
217
- "payoutDestinationAccountId": {
218
- "description": "The payout destination account",
219
- "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
220
- "type": "string",
221
- "x-hyperscale-reference-filter": {
222
- "column": "role",
223
- "values": [
224
- "customer_balance"
225
- ]
226
- }
227
- },
228
- "settlementAccountAccountId": {
229
- "description": "The settlement account account",
230
- "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
231
- "type": "string",
232
- "x-hyperscale-reference-filter": {
233
- "column": "role",
234
- "values": [
235
- "customer_balance"
236
- ]
237
- }
238
- }
239
- },
240
- "id": "batch",
241
- "idPrefix": "batc",
242
- "lifecycle": {
243
- "initial": "open",
244
- "states": [
245
- "open",
246
- "closed",
247
- "calculated",
248
- "approved",
249
- "instructed",
250
- "acknowledged",
251
- "reconciled"
252
- ],
253
- "transitions": {
254
- "acknowledge_payout": {
255
- "from": [
256
- "instructed"
257
- ],
258
- "to": "acknowledged"
259
- },
260
- "approve": {
261
- "from": [
262
- "calculated"
263
- ],
264
- "to": "approved"
265
- },
266
- "calculate": {
267
- "from": [
268
- "closed"
269
- ],
270
- "to": "calculated"
271
- },
272
- "close": {
273
- "from": [
274
- "open"
275
- ],
276
- "to": "closed"
277
- },
278
- "instruct": {
279
- "from": [
280
- "approved"
281
- ],
282
- "to": "instructed"
283
- },
284
- "reconcile": {
285
- "from": [
286
- "instructed",
287
- "acknowledged"
288
- ],
289
- "to": "reconciled"
290
- }
291
- }
292
- },
293
- "parties": {
294
- "beneficiary": "payoutDestinationAccountId",
295
- "payer": "settlementAccountAccountId"
296
- },
297
- "required": [
298
- "payoutDestinationAccountId",
299
- "settlementAccountAccountId",
300
- "closeAt",
301
- "currency",
302
- "payoutBeneficiaryId"
303
- ],
304
- "summary": "Payout batch from settlement account to payout destination",
305
- "templateBinding": {
306
- "id": "settlement_batch",
307
- "parameters": {}
308
- },
309
- "title": "Batch"
310
- },
311
- {
312
- "actionOrder": [
313
- "create",
314
- "accrue"
315
- ],
316
- "actions": {
317
- "accrue": {
318
- "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.",
319
- "effects": {
320
- "reads": [
321
- {
322
- "signature": "reads.requires_refs",
323
- "source": "requiresRefs"
324
- }
325
- ]
326
- },
327
- "moves": [],
328
- "publicAction": "accrueBatchCaptureEntry",
329
- "requiresRefs": [
330
- {
331
- "field": "batchId",
332
- "match": {
333
- "fields.currency": "fields.currency"
334
- },
335
- "statuses": [
336
- "open"
337
- ]
338
- }
339
- ],
340
- "steps": [],
341
- "summary": "Accrue the capture entry into the open batch"
342
- },
343
- "create": {
344
- "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.",
345
- "effects": {
346
- "reads": [
347
- {
348
- "signature": "reads.requires_refs",
349
- "source": "requiresRefs"
350
- }
351
- ]
352
- },
353
- "moves": [],
354
- "publicAction": "createBatchCaptureEntry",
355
- "requiresRefs": [
356
- {
357
- "field": "batchId",
358
- "match": {
359
- "fields.currency": "fields.currency"
360
- },
361
- "statuses": [
362
- "open"
363
- ]
364
- }
365
- ],
366
- "steps": [],
367
- "summary": "Create a capture lineage entry on an open batch"
368
- }
369
- },
370
- "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.",
371
- "description": "One gross capture entry linked to an open payout batch",
372
- "fields": {
373
- "amount": {
374
- "description": "Gross captured amount in minor units",
375
- "pattern": "^[1-9][0-9]{0,17}$",
376
- "type": "string"
377
- },
378
- "batchId": {
379
- "description": "Open batch this capture entry accrues into",
380
- "pattern": "^batc_(sandbox|live)_[a-z0-9]{8,64}$",
381
- "type": "string"
382
- },
383
- "captureReference": {
384
- "description": "Immutable source capture reference",
385
- "maxLength": 180,
386
- "minLength": 1,
387
- "type": "string"
388
- },
389
- "currency": {
390
- "description": "ISO 4217 currency code",
391
- "maxLength": 3,
392
- "minLength": 3,
393
- "pattern": "^[A-Z]{3}$",
394
- "type": "string"
395
- }
396
- },
397
- "id": "batch_capture_entry",
398
- "idPrefix": "batcce",
399
- "lifecycle": {
400
- "initial": "created",
401
- "states": [
402
- "created",
403
- "accrued"
404
- ],
405
- "transitions": {
406
- "accrue": {
407
- "from": [
408
- "created"
409
- ],
410
- "to": "accrued"
411
- }
412
- }
413
- },
414
- "required": [
415
- "amount",
416
- "currency",
417
- "batchId",
418
- "captureReference"
419
- ],
420
- "summary": "Gross capture lineage entry",
421
- "title": "Batch Capture Entry"
422
- },
423
- {
424
- "actionOrder": [
425
- "create",
426
- "adjust",
427
- "correct"
428
- ],
429
- "actions": {
430
- "adjust": {
431
- "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.",
432
- "effects": {
433
- "reads": [
434
- {
435
- "signature": "reads.requires_refs",
436
- "source": "requiresRefs"
437
- }
438
- ]
439
- },
440
- "moves": [],
441
- "publicAction": "adjustBatchCreditAdjustment",
442
- "requiresRefs": [
443
- {
444
- "field": "batchId",
445
- "match": {
446
- "fields.currency": "fields.currency"
447
- },
448
- "statuses": [
449
- "open"
450
- ]
451
- }
452
- ],
453
- "steps": [],
454
- "summary": "Apply the credit adjustment to the open batch"
455
- },
456
- "correct": {
457
- "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.",
458
- "effects": {
459
- "reads": [
460
- {
461
- "signature": "reads.requires_refs",
462
- "source": "requiresRefs"
463
- }
464
- ]
465
- },
466
- "moves": [],
467
- "publicAction": "correctBatchCreditAdjustment",
468
- "requiresRefs": [
469
- {
470
- "field": "batchId",
471
- "match": {
472
- "fields.currency": "fields.currency"
473
- },
474
- "statuses": [
475
- "open"
476
- ]
477
- }
478
- ],
479
- "steps": [],
480
- "summary": "Record a later correction on this open batch instead of changing the closed source batch"
481
- },
482
- "create": {
483
- "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.",
484
- "effects": {
485
- "reads": [
486
- {
487
- "signature": "reads.requires_refs",
488
- "source": "requiresRefs"
489
- }
490
- ]
491
- },
492
- "moves": [],
493
- "publicAction": "createBatchCreditAdjustment",
494
- "requiresRefs": [
495
- {
496
- "field": "batchId",
497
- "match": {
498
- "fields.currency": "fields.currency"
499
- },
500
- "statuses": [
501
- "open"
502
- ]
503
- }
504
- ],
505
- "steps": [],
506
- "summary": "Create a credit adjustment on an open batch"
507
- }
508
- },
509
- "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.",
510
- "description": "One credit adjustment linked to an open payout batch; closed batches stay unchanged",
511
- "fields": {
512
- "adjustmentReference": {
513
- "description": "Immutable explicit adjustment reference",
514
- "maxLength": 180,
515
- "minLength": 1,
516
- "type": "string"
517
- },
518
- "amount": {
519
- "description": "Credit adjustment amount in minor units",
520
- "pattern": "^[1-9][0-9]{0,17}$",
521
- "type": "string"
522
- },
523
- "batchId": {
524
- "description": "Open batch this adjustment applies to",
525
- "pattern": "^batc_(sandbox|live)_[a-z0-9]{8,64}$",
526
- "type": "string"
527
- },
528
- "captureReference": {
529
- "description": "Original capture reference that this adjustment corrects",
530
- "maxLength": 180,
531
- "minLength": 1,
532
- "type": "string"
533
- },
534
- "currency": {
535
- "description": "ISO 4217 currency code",
536
- "maxLength": 3,
537
- "minLength": 3,
538
- "pattern": "^[A-Z]{3}$",
539
- "type": "string"
540
- },
541
- "feeReference": {
542
- "description": "Optional fee entry reference",
543
- "maxLength": 180,
544
- "minLength": 1,
545
- "type": "string"
546
- },
547
- "reversalReference": {
548
- "description": "Optional externally decided reversal reference",
549
- "maxLength": 180,
550
- "minLength": 1,
551
- "type": "string"
552
- }
553
- },
554
- "id": "batch_credit_adjustment",
555
- "idPrefix": "batcca",
556
- "lifecycle": {
557
- "initial": "created",
558
- "states": [
559
- "created",
560
- "applied"
561
- ],
562
- "transitions": {
563
- "adjust": {
564
- "from": [
565
- "created"
566
- ],
567
- "to": "applied"
568
- },
569
- "correct": {
570
- "from": [
571
- "created"
572
- ],
573
- "to": "applied"
574
- }
575
- }
576
- },
577
- "required": [
578
- "amount",
579
- "currency",
580
- "adjustmentReference",
581
- "batchId",
582
- "captureReference"
583
- ],
584
- "summary": "Credit adjustment with capture lineage",
585
- "title": "Batch Credit Adjustment"
586
- },
587
- {
588
- "actionOrder": [
589
- "create",
590
- "adjust",
591
- "correct"
592
- ],
593
- "actions": {
594
- "adjust": {
595
- "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.",
596
- "effects": {
597
- "reads": [
598
- {
599
- "signature": "reads.requires_refs",
600
- "source": "requiresRefs"
601
- }
602
- ]
603
- },
604
- "moves": [],
605
- "publicAction": "adjustBatchDebitAdjustment",
606
- "requiresRefs": [
607
- {
608
- "field": "batchId",
609
- "match": {
610
- "fields.currency": "fields.currency"
611
- },
612
- "statuses": [
613
- "open"
614
- ]
615
- }
616
- ],
617
- "steps": [],
618
- "summary": "Apply the debit adjustment to the open batch"
619
- },
620
- "correct": {
621
- "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.",
622
- "effects": {
623
- "reads": [
624
- {
625
- "signature": "reads.requires_refs",
626
- "source": "requiresRefs"
627
- }
628
- ]
629
- },
630
- "moves": [],
631
- "publicAction": "correctBatchDebitAdjustment",
632
- "requiresRefs": [
633
- {
634
- "field": "batchId",
635
- "match": {
636
- "fields.currency": "fields.currency"
637
- },
638
- "statuses": [
639
- "open"
640
- ]
641
- }
642
- ],
643
- "steps": [],
644
- "summary": "Record a later correction on this open batch instead of changing the closed source batch"
645
- },
646
- "create": {
647
- "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.",
648
- "effects": {
649
- "reads": [
650
- {
651
- "signature": "reads.requires_refs",
652
- "source": "requiresRefs"
653
- }
654
- ]
655
- },
656
- "moves": [],
657
- "publicAction": "createBatchDebitAdjustment",
658
- "requiresRefs": [
659
- {
660
- "field": "batchId",
661
- "match": {
662
- "fields.currency": "fields.currency"
663
- },
664
- "statuses": [
665
- "open"
666
- ]
667
- }
668
- ],
669
- "steps": [],
670
- "summary": "Create a debit adjustment on an open batch"
671
- }
672
- },
673
- "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.",
674
- "description": "One debit adjustment linked to an open payout batch; closed batches stay unchanged",
675
- "fields": {
676
- "adjustmentReference": {
677
- "description": "Immutable explicit adjustment reference",
678
- "maxLength": 180,
679
- "minLength": 1,
680
- "type": "string"
681
- },
682
- "amount": {
683
- "description": "Debit adjustment amount in minor units",
684
- "pattern": "^[1-9][0-9]{0,17}$",
685
- "type": "string"
686
- },
687
- "batchId": {
688
- "description": "Open batch this adjustment applies to",
689
- "pattern": "^batc_(sandbox|live)_[a-z0-9]{8,64}$",
690
- "type": "string"
691
- },
692
- "captureReference": {
693
- "description": "Original capture reference that this adjustment corrects",
694
- "maxLength": 180,
695
- "minLength": 1,
696
- "type": "string"
697
- },
698
- "currency": {
699
- "description": "ISO 4217 currency code",
700
- "maxLength": 3,
701
- "minLength": 3,
702
- "pattern": "^[A-Z]{3}$",
703
- "type": "string"
704
- },
705
- "feeReference": {
706
- "description": "Optional fee entry reference",
707
- "maxLength": 180,
708
- "minLength": 1,
709
- "type": "string"
710
- },
711
- "reversalReference": {
712
- "description": "Optional externally decided reversal reference",
713
- "maxLength": 180,
714
- "minLength": 1,
715
- "type": "string"
716
- }
717
- },
718
- "id": "batch_debit_adjustment",
719
- "idPrefix": "batcda",
720
- "lifecycle": {
721
- "initial": "created",
722
- "states": [
723
- "created",
724
- "applied"
725
- ],
726
- "transitions": {
727
- "adjust": {
728
- "from": [
729
- "created"
730
- ],
731
- "to": "applied"
732
- },
733
- "correct": {
734
- "from": [
735
- "created"
736
- ],
737
- "to": "applied"
738
- }
739
- }
740
- },
741
- "required": [
742
- "amount",
743
- "currency",
744
- "adjustmentReference",
745
- "batchId",
746
- "captureReference"
747
- ],
748
- "summary": "Debit adjustment with capture lineage",
749
- "title": "Batch Debit Adjustment"
750
- }
751
- ],
752
- "product": "settlement_batch_example",
753
- "subjects": [],
754
- "title": "Settlement batch example",
755
- "udl": 1,
756
- "version": 1
757
- }