@hyperscale0/hsx 2.0.2 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/src/cli.d.ts +1 -1
- package/dist/src/diagnostics.d.ts.map +1 -1
- package/dist/src/diagnostics.js +9 -0
- package/dist/src/diagnostics.js.map +1 -1
- package/dist/src/std-bundle.js +1 -1
- package/dist/src/std-bundle.js.map +1 -1
- package/dist/src/typecheck.d.ts.map +1 -1
- package/dist/src/typecheck.js +126 -5
- package/dist/src/typecheck.js.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/docs/llms-full.txt +10 -2
- package/docs/llms.txt +2 -2
- package/docs/reference/cli.md +2 -2
- package/docs/reference/diagnostics.md +9 -1
- package/docs/reference/grammar.md +1 -1
- package/docs/reference/std/advance.md +1 -1
- package/docs/reference/std/cancellable_booking.md +1 -1
- package/docs/reference/std/captured_payment.md +1 -1
- package/docs/reference/std/conditional_disbursement.md +1 -1
- package/docs/reference/std/credit_facility.md +1 -1
- package/docs/reference/std/held_payment.md +1 -1
- package/docs/reference/std/instant_transfer.md +1 -1
- package/docs/reference/std/metered.md +1 -1
- package/docs/reference/std/pooled_split.md +1 -1
- package/docs/reference/std/premium_forward.md +1 -1
- package/docs/reference/std/reconciled_payout.md +1 -1
- package/docs/reference/std/recurring_collection.md +1 -1
- package/docs/reference/std/rotating_pool.md +1 -1
- package/docs/reference/std/scheduled.md +1 -1
- package/docs/reference/std/security_deposit.md +1 -1
- package/docs/reference/std/settlement_batch.md +1 -1
- package/docs/reference/std/swap.md +1 -1
- package/docs/reference/std/threshold_pool.md +1 -1
- package/docs/reference/std/weighted_distribution.md +1 -1
- package/docs/reference/types.md +1 -1
- package/docs/reference/udl-output.md +1 -1
- package/package.json +3 -3
- package/src/diagnostics.ts +9 -0
- package/src/std-bundle.ts +1 -1
- package/src/typecheck.ts +170 -5
- package/src/version.ts +1 -1
- package/std/money_flows/held_payment.hsx +23 -10
|
@@ -39,6 +39,7 @@ module std.money_flows.held_payment
|
|
|
39
39
|
// - `cancel_charge_bps`: Optional cancellation charge in basis points. Declaring it gives the settlement a
|
|
40
40
|
// quoted cancellation: `quote_cancellation` prices the charge and the refund and freezes both,
|
|
41
41
|
// `cancel` pays the refund to the payer, and `retain_cancellation_charge` pays the charge to the payee.
|
|
42
|
+
// A zero charge keeps the flow with a zero fee.
|
|
42
43
|
// - `cancel_offer_life`: ISO 8601 duration a cancellation quote stays open, required with `cancel_charge_bps`.
|
|
43
44
|
//
|
|
44
45
|
// ### Decision ports
|
|
@@ -70,6 +71,8 @@ export instrument held_payment<C>(payer: party, payee: party, amount: money<C>,
|
|
|
70
71
|
let(payee_fee): get(fees, payee);
|
|
71
72
|
let(payer_fee_kind): kind(payer_fee);
|
|
72
73
|
let(payee_fee_kind): kind(payee_fee);
|
|
74
|
+
let(has_cancel_quote): if_eq(kind(cancel_charge_bps), "boolean", false, true);
|
|
75
|
+
let(has_charge): if_eq(cancel_charge_bps, 0, false, true);
|
|
73
76
|
when_eq(payee_fee_kind, binding) {
|
|
74
77
|
when(on_cancel) {
|
|
75
78
|
unsupported {
|
|
@@ -79,7 +82,7 @@ export instrument held_payment<C>(payer: party, payee: party, amount: money<C>,
|
|
|
79
82
|
}
|
|
80
83
|
}
|
|
81
84
|
}
|
|
82
|
-
when(
|
|
85
|
+
when(has_cancel_quote) {
|
|
83
86
|
when(on_cancel) {
|
|
84
87
|
unsupported {
|
|
85
88
|
code: HSX1110;
|
|
@@ -110,10 +113,10 @@ export instrument held_payment<C>(payer: party, payee: party, amount: money<C>,
|
|
|
110
113
|
}
|
|
111
114
|
}
|
|
112
115
|
when(cancel_offer_life) {
|
|
113
|
-
when_not(
|
|
116
|
+
when_not(has_cancel_quote) {
|
|
114
117
|
unsupported {
|
|
115
118
|
code: HSX1110;
|
|
116
|
-
message: "cancel_offer_life needs
|
|
119
|
+
message: "cancel_offer_life needs cancel_charge_bps to quote";
|
|
117
120
|
fix: "declare the cancellation charge in basis points, or drop cancel_offer_life";
|
|
118
121
|
}
|
|
119
122
|
}
|
|
@@ -202,7 +205,7 @@ export instrument held_payment<C>(payer: party, payee: party, amount: money<C>,
|
|
|
202
205
|
when_not(cancel_splits) {
|
|
203
206
|
states created funded disputed released;
|
|
204
207
|
when(on_cancel) { states cancelled; }
|
|
205
|
-
when(
|
|
208
|
+
when(has_cancel_quote) { states cancellation_quoted cancelled settled; }
|
|
206
209
|
states abandoned;
|
|
207
210
|
}
|
|
208
211
|
when(cancel_splits) { states created funding_1 funded disputed releasing_1 released cancelling_1 cancelled abandoned; }
|
|
@@ -219,14 +222,14 @@ export instrument held_payment<C>(payer: party, payee: party, amount: money<C>,
|
|
|
219
222
|
when_not(payee_fee) {
|
|
220
223
|
when_not(cancel_splits) {
|
|
221
224
|
on fund_piece_1: created -> funded;
|
|
222
|
-
when_not(
|
|
225
|
+
when_not(has_cancel_quote) {
|
|
223
226
|
on [release_name]: funded -> released;
|
|
224
227
|
when(release_deadline) { on release_on_deadline: funded -> released; }
|
|
225
228
|
}
|
|
226
|
-
when(
|
|
229
|
+
when(has_cancel_quote) {
|
|
227
230
|
on [release_name]: funded | cancellation_quoted -> released;
|
|
228
231
|
when(release_deadline) { on release_on_deadline: funded | cancellation_quoted -> released; }
|
|
229
|
-
on quote_cancellation: funded -> cancellation_quoted;
|
|
232
|
+
on quote_cancellation: funded | cancellation_quoted -> cancellation_quoted;
|
|
230
233
|
on cancel: cancellation_quoted -> cancelled;
|
|
231
234
|
on retain_cancellation_charge: cancelled -> settled;
|
|
232
235
|
}
|
|
@@ -275,7 +278,12 @@ export instrument held_payment<C>(payer: party, payee: party, amount: money<C>,
|
|
|
275
278
|
on unfund_piece_1: funding_1 | abandoning_1 -> abandoned;
|
|
276
279
|
}
|
|
277
280
|
}
|
|
278
|
-
|
|
281
|
+
when_not(has_cancel_quote) {
|
|
282
|
+
on dispute: funded -> disputed;
|
|
283
|
+
}
|
|
284
|
+
when(has_cancel_quote) {
|
|
285
|
+
on dispute: funded | cancellation_quoted -> disputed;
|
|
286
|
+
}
|
|
279
287
|
on resume: disputed -> funded;
|
|
280
288
|
on abandon: created -> abandoned;
|
|
281
289
|
}
|
|
@@ -520,7 +528,7 @@ export instrument held_payment<C>(payer: party, payee: party, amount: money<C>,
|
|
|
520
528
|
steps: [];
|
|
521
529
|
}
|
|
522
530
|
}
|
|
523
|
-
when(
|
|
531
|
+
when(has_cancel_quote) {
|
|
524
532
|
action quote_cancellation {
|
|
525
533
|
agent_description: concat("Price the cancellation and hold that price open. No money moves. The charge the ", words(payee), " keeps and the refund the ", words(payer), " gets back are worked out here and frozen for ", cancel_offer_life, ", after which a fresh call prices it again. Call cancel to spend the quote.");
|
|
526
534
|
summary: "Price the cancellation and hold that price open";
|
|
@@ -554,7 +562,12 @@ export instrument held_payment<C>(payer: party, payee: party, amount: money<C>,
|
|
|
554
562
|
let(metadata_phase): "metadata.phase";
|
|
555
563
|
agent_description: concat("Pay the quoted cancellation charge out of escrow to the ", words(payee), ". This moves money and does not reverse. The settlement must already be cancelled, so the figure is the one the quote fixed and the escrow ends empty.");
|
|
556
564
|
summary: concat("Pay the quoted cancellation charge to the ", words(payee));
|
|
557
|
-
|
|
565
|
+
when(has_charge) {
|
|
566
|
+
moves: [{ key: charge; operation: internal_transfer.create; bind: { amount: { from: instance; path: refs.cancellationChargeAmount; }; currency: { from: instance; path: fields.currency; }; destinationAccountId: { from: instance; path: concat("fields.", payee_account_field); }; [metadata_instrument]: { from: const; value: instrument; }; [metadata_instance]: { from: instance; path: instrumentInstanceId; }; [metadata_phase]: { from: const; value: retain_cancellation_charge; }; productId: { from: instance; path: productId; }; sourceAccountId: { from: instance; path: refs.escrowAccountId; }; }; capture: { retainCancellationChargeTransferId: transferId; }; }];
|
|
567
|
+
}
|
|
568
|
+
when_not(has_charge) {
|
|
569
|
+
moves: [];
|
|
570
|
+
}
|
|
558
571
|
steps: [];
|
|
559
572
|
}
|
|
560
573
|
}
|