@hyperscale0/hsx 5.8.0 → 6.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.
- package/CHANGELOG.md +14 -0
- package/README.md +3 -4
- package/bin/hsx.ts +0 -5
- package/dist/bin/hsx.d.ts +0 -4
- package/dist/bin/hsx.d.ts.map +1 -1
- package/dist/bin/hsx.js +0 -4
- package/dist/bin/hsx.js.map +1 -1
- package/dist/src/compile.d.ts.map +1 -1
- package/dist/src/compile.js +0 -20
- package/dist/src/compile.js.map +1 -1
- package/dist/src/examples-bundle.d.ts.map +1 -1
- package/dist/src/examples-bundle.js +0 -1
- package/dist/src/examples-bundle.js.map +1 -1
- package/dist/src/headers.d.ts +1 -1
- package/dist/src/headers.d.ts.map +1 -1
- package/dist/src/headers.js +0 -1
- package/dist/src/headers.js.map +1 -1
- package/dist/src/std-bundle.d.ts.map +1 -1
- package/dist/src/std-bundle.js +1 -2
- package/dist/src/std-bundle.js.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/docs/README.md +16 -19
- package/package.json +5 -6
- package/src/compile.ts +0 -21
- package/src/examples-bundle.ts +0 -1
- package/src/headers.ts +0 -1
- package/src/std-bundle.ts +1 -2
- package/src/version.ts +1 -1
- package/std/reporting.hsx +105 -676
- package/docs/examples.md +0 -22
- package/docs/headers.md +0 -46
- package/examples/travel.hsx +0 -29
- package/std/travel.hsx +0 -123
package/docs/examples.md
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# Sample programs
|
|
2
|
-
|
|
3
|
-
Each file is an authored program. Object creation enters no agreement; an attachment may expose its instrument create action by name. Compilation alone does not prove a complete business flow.
|
|
4
|
-
|
|
5
|
-
| Program | Headers | Business |
|
|
6
|
-
| --- | --- | --- |
|
|
7
|
-
| [Team expense cards](../examples/cards.hsx) | cards | A company issues expense cards to employees and reserves each supplier payment before capture. |
|
|
8
|
-
| [Small business collections](../examples/collections.hsx) | collections, financing | A business lender refers overdue instalments to an agency with limits on collection contacts. |
|
|
9
|
-
| [Used device sales](../examples/escrow.hsx) | escrow | Buyers fund a used device purchase, then accept delivery or raise a dispute before release. |
|
|
10
|
-
| [Tuition instalments](../examples/financing.hsx) | financing | A tuition lender funds a student's fees over three interest-free instalments with borrowing limits. |
|
|
11
|
-
| [Device insurance](../examples/insurance.hsx) | insurance, money | A device retailer collects the purchase price and attaches cover with a claim review process. |
|
|
12
|
-
| [Community business lending](../examples/lending.hsx) | lending, financing, wallet | A lending composition with limit approvals, wallet commitments and cash distribution transitions. |
|
|
13
|
-
| [Financed car sales](../examples/library.hsx) | escrow, financing | A minimal financed car sale connects escrow to a three-instalment plan and lending limits. |
|
|
14
|
-
| [Freelance marketplace](../examples/marketplace.hsx) | marketplace, escrow | Freelancers publish offers and clients place orders with funds held until work is accepted. |
|
|
15
|
-
| [Tutoring studio](../examples/money.hsx) | money | A tutoring studio collects a fixed fee for each lesson and can cancel unpaid bookings. |
|
|
16
|
-
| [Equipment rental](../examples/rental-deposit.hsx) | | A business rents equipment with a 1000 SAR deposit and a single 50 SAR late fee. On-time return refunds 1000 SAR; late return pays the operator 50 SAR and refunds 950 SAR. |
|
|
17
|
-
| [Repair approvals](../examples/repair-approval.hsx) | | A repair shop records inspection and approval evidence before it can complete a job. |
|
|
18
|
-
| [Equipment loan reports](../examples/reporting.hsx) | reporting, financing | An equipment lender keeps an ageing report over its financed purchases and recorded repayments. |
|
|
19
|
-
| [Savings circle](../examples/savings.hsx) | savings | Six members contribute to a shared pot and receive it in their agreed calendar order. |
|
|
20
|
-
| [Car financing](../examples/serviced.hsx) | escrow, financing, collections | A car finance company services loans with late charges, payment reminders and early repayment. |
|
|
21
|
-
| [Travel agency](../examples/travel.hsx) | travel, insurance | A travel agency takes deposits for an insured holiday and pays its supplier after confirmation. |
|
|
22
|
-
| [Workshop credits](../examples/wallet.hsx) | wallet | Members prepay for workshop visits and the studio reserves each spend before charging it. |
|
package/docs/headers.md
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# Header inventory
|
|
2
|
-
|
|
3
|
-
Attach library instruments inside authored object kinds. Each program selects policies through typed tunables.
|
|
4
|
-
Bind party parameters to owner, actor, operator or declared parties. Configure declared businesses per Build. The authoringTemplate source is an attach fragment for an object block. An attachment may expose create by name; clock and parent actions remain internal.
|
|
5
|
-
`ref<T>[]` accepts one reference or up to 16 references as one policy.
|
|
6
|
-
|
|
7
|
-
| Instrument | Tunables |
|
|
8
|
-
| --- | --- |
|
|
9
|
-
| money.transfer | `payer: party`, `payee: party`, `amount: money = runtime` |
|
|
10
|
-
| money.hold | `payer: party`, `payee: party`, `amount: money = runtime` |
|
|
11
|
-
| money.split | `payer: party`, `amount: money = runtime`, `shares: split = { programOperator: 100% }` |
|
|
12
|
-
| money.schedule | `payer: party`, `payee: party`, `amount: money = runtime`, `count: integer(1, 366) = 12` |
|
|
13
|
-
| money.pool | `payer: party`, `payee: party`, `target: money`, `closes: date` |
|
|
14
|
-
| money.swap | `first: party`, `second: party`, `first_amount: money`, `second_amount: money`, `expires: date` |
|
|
15
|
-
| money.payout | `payer: party`, `payee: party`, `adapter: text`, `max_age: duration`, `amount: money = runtime` |
|
|
16
|
-
| money.metered | `payer: party`, `payee: party`, `unit_price: money`, `units: integer = 1`, `fee: fee = { seller: 0% }` |
|
|
17
|
-
| marketplace.listing | `seller: party` |
|
|
18
|
-
| marketplace.order | `listing: ref<marketplace.listing>`, `buyer: party` |
|
|
19
|
-
| marketplace.reservation | `listing: ref<marketplace.listing>`, `funds: ref<escrow.hold>`, `converters: ref[]`, `buyer: party`, `seller: party`, `expires_after: duration = 48h`, `deposit: money = 1000 SAR`, `cancellation_refund: percent = 100%`, `expiry_refund: percent = 100%`, `retained_to: party = programOperator`, `operator: party = programOperator`, `competing_quotes: enum(allowed, blocked) = allowed` |
|
|
20
|
-
| escrow.hold | `payer: party = party(person)`, `payee: party = programOperator`, `accept_within: duration = 48h`, `fee: fee = { seller: 0%, tax: 0% }`, `dispute: policy = { refund_after: return_verified }` |
|
|
21
|
-
| wallet.balance | `holder: party`, `spend_limit: money = 100000 SAR` |
|
|
22
|
-
| wallet.spend | `wallet: ref<wallet.balance>`, `payee: party` |
|
|
23
|
-
| financing.installments | `months: integer(1, 366)`, `charge_limit: integer(1, 3) = 3`, `profit: percent`, `disburse_to: enum(funds, borrower) = funds`, `profit_earned: enum(on_payment, by_schedule, at_disbursement) = on_payment`, `apply: enum(fines_profit_principal, principal_profit, pro_rata) = fines_profit_principal`, `payoff_rebate: percent = 100%`, `write_off_after: duration = 90d`, `max_extension: duration = 90d`, `max_amendments: integer(0, 366) = 2`, `waiver_limit: percent = 100%`, `amendment_expiry: duration = 7d`, `payoff_quote_expiry: duration = 1h`, `allow_overdue: enum(allowed, blocked) = allowed`, `assessed_fines: enum(carry, require_waiver) = carry`, `down_payment: percent = 0%`, `funds: ref<escrow.hold>?`, `borrower: party = party(person)`, `capital: party = programOperator`, `share: percent = 0%`, `limits: ref<financing.limits> = object(financing.limits)`, `portfolio: ref<financing.portfolio_limit> = object(financing.portfolio_limit)` |
|
|
24
|
-
| financing.late_charge | `on: ref<financing.installments>[]`, `grace: duration = 3d`, `fine: money = 50 SAR`, `cap: money = 25 SAR`, `fines_to: party = programOperator`, `costs_to: party = programOperator`, `borrower: party = party(person)` |
|
|
25
|
-
| financing.limits | `per_borrower: money`, `borrower: party = party(person)`, `active_plans: integer = 1` |
|
|
26
|
-
| financing.portfolio_limit | `limit: money` |
|
|
27
|
-
| financing.credit_line | `borrower: party = programOperator`, `adapter: text`, `limit: money`, `expires: date` |
|
|
28
|
-
| financing.advance | `line: ref<financing.credit_line>`, `amount: money = runtime` |
|
|
29
|
-
| lending.round | `borrower: party`, `plan: ref<financing.installments> = object(financing.installments)`, `operator: party = programOperator`, `minimum_ticket: money = 100 SAR`, `investor_cap: percent = 20%`, `commitments: ref<lending.commitment> = object(lending.commitment)` |
|
|
30
|
-
| lending.commitment | `round: ref<lending.round>`, `wallet: ref<wallet.balance>`, `investor: party = party(person)` |
|
|
31
|
-
| lending.distribution | `round: ref<lending.round>`, `receipt: ref`, `commitments: ref<lending.commitment> = object(lending.commitment)`, `mode: enum(cash, loss) = cash`, `residual_to: party = programOperator`, `operator: party = programOperator`, `fee: percent = 1%`, `tax: percent = 15%` |
|
|
32
|
-
| insurance.cover | `holder: party`, `adapter: text`, `commission: percent = 0%`, `broker: party = programOperator`, `covers: ref`, `premium: money = runtime` |
|
|
33
|
-
| insurance.claim | `cover: ref<insurance.cover>`, `inspector: party` |
|
|
34
|
-
| collections.case | `on: ref<financing.installments>[]`, `agency: party`, `capital: party = programOperator`, `overdue: duration = 3d`, `fee: percent = 20%` |
|
|
35
|
-
| collections.contact | `case: ref<collections.case>[]`, `agency: party`, `max_contacts: integer = 10`, `window: duration = 30d`, `contact_from: integer(0, 23) = 8`, `contact_until: integer(1, 23) = 20`, `timezone: text = "Asia/Riyadh"`; contact_from less_than contact_until |
|
|
36
|
-
| collections.reminder | `on: ref<financing.installments>[]`, `operator: party = programOperator`, `before_days: integer(0, 366) = 3`, `overdue_days: integer(1, 366) = 1`, `max_per_day: integer(1, 10) = 1`, `send_from: integer(0, 23) = 8`, `send_until: integer(1, 24) = 20`, `timezone: text = "Asia/Riyadh"`; send_from less_than send_until |
|
|
37
|
-
| travel.package | `price: money`, `supplier_cost: money`, `departure: date`; supplier_cost at_most price |
|
|
38
|
-
| travel.booking | `package: ref<travel.package>`, `buyer: party`, `supplier: party`, `operator: party = programOperator`, `cover: ref<insurance.cover>`, `deposit: percent = 30%`, `balance_before: duration = 14d`, `confirm_within: duration = 24h`, `tax: percent = 15%`, `early_before: duration = 30d`, `middle_before: duration = 15d`, `middle_penalty: percent = 10%`, `late_penalty: percent = 30%`; early_before greater_than middle_before |
|
|
39
|
-
| cards.cardholder | `holder: party` |
|
|
40
|
-
| cards.card | `holder: ref<cards.cardholder>`, `spend_limit: money` |
|
|
41
|
-
| cards.authorization | `card: ref<cards.card>`, `merchant: party`, `issuer: party = programOperator` |
|
|
42
|
-
| cards.transaction | `authorization: ref<cards.authorization>` |
|
|
43
|
-
| cards.dispute | `transaction: ref<cards.transaction>`, `issuer: party = programOperator`, `within: duration = 90d` |
|
|
44
|
-
| savings.circle | `contribution: money`, `members: integer(1, 60)`, `starts: date`, `memberships: ref<savings.membership> = object(savings.membership)` |
|
|
45
|
-
| savings.membership | `circle: ref<savings.circle>`, `member: party` |
|
|
46
|
-
| reporting.portfolio | `on: ref<financing.installments>[]`, `default_days: integer(1, 3650) = 90`, `retention_years: integer(1, 100) = 10`, `aging_first_days: integer(1, 3650) = 30`, `aging_second_days: integer(1, 3650) = 60`, `aging_third_days: integer(1, 3650) = 90`, `ratio_scale: integer(1, 1000000) = 10000`, `ratio_rounding: enum(floor, halfUp) = floor`, `lock_wait_ms: integer(1, 2000) = 2000`, `capture_ms: integer(1, 10000) = 10000`, `max_rows: integer(1, 100000) = 10000`, `max_join_rows: integer(1, 1000000) = 100000`, `max_bytes: integer(1024, 16777216) = 8388608`; aging_first_days less_than aging_second_days, aging_second_days less_than aging_third_days |
|
package/examples/travel.hsx
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// A travel agency takes deposits for an insured holiday and pays its supplier after confirmation.
|
|
2
|
-
program travel_agency "Travel agency"
|
|
3
|
-
use travel
|
|
4
|
-
use insurance
|
|
5
|
-
party hotel: business
|
|
6
|
-
|
|
7
|
-
object holiday "Holiday booking" {
|
|
8
|
-
fields { destination: text, leadTraveller: text }
|
|
9
|
-
columns: [destination, leadTraveller]
|
|
10
|
-
attach trip = travel.package {
|
|
11
|
-
expose create as create_trip
|
|
12
|
-
price: 5000 SAR, supplier_cost: 3500 SAR, departure: 2027-07-01
|
|
13
|
-
expose publish as publish_trip
|
|
14
|
-
}
|
|
15
|
-
// Bind travel_insurer to an ADL adapter before creating cover. Premiums net of commission go to its account.
|
|
16
|
-
attach protection = insurance.cover {
|
|
17
|
-
expose create as create_protection
|
|
18
|
-
holder: actor, adapter: "travel_insurer", commission: 10%, covers: reservation
|
|
19
|
-
expose activate as activate_cover
|
|
20
|
-
}
|
|
21
|
-
attach reservation = travel.booking {
|
|
22
|
-
expose create as create_reservation
|
|
23
|
-
package: trip, buyer: actor, supplier: hotel, cover: protection
|
|
24
|
-
expose deposit as pay_deposit
|
|
25
|
-
expose balance as pay_balance
|
|
26
|
-
expose confirm as confirm_completion
|
|
27
|
-
expose cancel_early as cancel_booking
|
|
28
|
-
}
|
|
29
|
-
}
|
package/std/travel.hsx
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
header travel
|
|
2
|
-
|
|
3
|
-
// Economics: Booking funds and refunds are principal. Supplier payments are payouts,
|
|
4
|
-
// tax is pass-through, and the company margin is earning. An outside operator
|
|
5
|
-
// receives a participant payout instead of company earnings.
|
|
6
|
-
|
|
7
|
-
// Publish a package before booking.create. Expose deposit, balance and confirm
|
|
8
|
-
// separately. Deposit needs pending premium slices whose cover is active, and
|
|
9
|
-
// collects those premiums in addition to booking cash. Balance is due by balanceAt.
|
|
10
|
-
// Expose cancel_early, cancel_middle and cancel_late for the desired booking paths.
|
|
11
|
-
// Early returns all held booking cash, whether deposit-only or fully paid. Middle
|
|
12
|
-
// returns held minus the original deposit; a deposit-only booking gets zero.
|
|
13
|
-
// Supplier penalty is based on supplierCost; tax applies to retained margin,
|
|
14
|
-
// and the bound operator receives the remainder. Late returns no buyer cash.
|
|
15
|
-
// Middle opens at earlyAt and ends at lateAt, which is middleAt plus 1ms; late
|
|
16
|
-
// starts there. Default_balance can already cancel a deposit_paid booking at
|
|
17
|
-
// balanceAt, after which no booking cancellation is reachable. Clock order matters.
|
|
18
|
-
// Booking refunds exclude insurance premiums, broker commission and all balances
|
|
19
|
-
// outside booking.held. Expose cover.cancel independently to refund eligible paid
|
|
20
|
-
// premium periods before startsAt; slice.refund is parent-owned. Active/expired
|
|
21
|
-
// premium periods remain excluded. Confirmation timeout returns the full booking
|
|
22
|
-
// price from paid only. A penalty above held cash or retained deposit refuses;
|
|
23
|
-
// this header does not subsidize a shortfall or reduce the configured penalty.
|
|
24
|
-
|
|
25
|
-
// Cost: booking.create declares one owned account. Deposit also invokes premium
|
|
26
|
-
// collections; cancellation declares the selected refund, penalty, tax and retained
|
|
27
|
-
// moves. Run hsx cost for bounded counts. Supplier penalties are business terms,
|
|
28
|
-
// not compiler or executor fees.
|
|
29
|
-
|
|
30
|
-
instrument package(price: money, supplier_cost: money, departure: date) {
|
|
31
|
-
constraints { supplier_cost: at_most(price) }
|
|
32
|
-
summary: "Immutable package price, supplier cost and departure."
|
|
33
|
-
fields { price: money = price, supplierCost: money = supplier_cost, departure: date = departure }
|
|
34
|
-
lifecycle { states: [draft, published, closed], initial: draft }
|
|
35
|
-
action create { requires self.supplierCost <= self.price }
|
|
36
|
-
action publish { from: draft, to: published }
|
|
37
|
-
action close { from: published, to: closed, actor: clock, due: { at: self.departure } }
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
instrument booking(package: ref<travel.package>, buyer: party, supplier: party, operator: party = programOperator, cover: ref<insurance.cover>, deposit: percent = 30%, balance_before: duration = 14d, confirm_within: duration = 24h, tax: percent = 15%, early_before: duration = 30d, middle_before: duration = 15d, middle_penalty: percent = 10%, late_penalty: percent = 30%) {
|
|
41
|
-
constraints { early_before: greater_than(middle_before) }
|
|
42
|
-
summary: "A deposited booking with three cancellation bands and confirmation."
|
|
43
|
-
fields {
|
|
44
|
-
package: ref<package>, buyer: account of buyer, supplier: account of supplier
|
|
45
|
-
price: money = self.package.price, supplierCost: money = self.package.supplierCost
|
|
46
|
-
deposit: money = rate(self.price, deposit), balance: money = subtract(self.price, self.deposit)
|
|
47
|
-
margin: money = subtract(self.price, self.supplierCost)
|
|
48
|
-
tax: money = rate(self.margin, tax), operatorNet: money = subtract(self.margin, self.tax)
|
|
49
|
-
middlePenalty: money = rate(self.supplierCost, middle_penalty)
|
|
50
|
-
latePenalty: money = rate(self.supplierCost, late_penalty)
|
|
51
|
-
balanceAt: date = before(self.package.departure, balance_before)
|
|
52
|
-
earlyAt: date = before(self.package.departure, early_before)
|
|
53
|
-
middleAt: date = before(self.package.departure, middle_before)
|
|
54
|
-
lateAt: date = after(self.middleAt, 1ms)
|
|
55
|
-
confirmBy: date = after(self.package.departure, confirm_within)
|
|
56
|
-
held: account of self
|
|
57
|
-
refund: money?, retainedMargin: money?, retainedTax: money?, retainedNet: money?
|
|
58
|
-
}
|
|
59
|
-
lifecycle { states: [created, deposit_paid, paid, completed, cancelled, refunded], initial: created }
|
|
60
|
-
action create {
|
|
61
|
-
requires self.package in [published]
|
|
62
|
-
}
|
|
63
|
-
action deposit { allowZero: true, requires self.price > "0";
|
|
64
|
-
from: created, to: deposit_paid, actor: { party: buyer }, deadline: { at: self.balanceAt }
|
|
65
|
-
requires count of { instrument: child(cover, slice), reference: "covers", anchor: self.id, states: [pending], limit: 366 } >= 1
|
|
66
|
-
moves self.deposit from buyer to self.held economics { purpose: principal, sourceParty: buyer }
|
|
67
|
-
invoke: [{ selection: { instrument: child(cover, slice), reference: "covers", anchor: self.id, states: [pending], limit: 366 }, action: collect, input: {} }]
|
|
68
|
-
}
|
|
69
|
-
action balance { allowZero: true, requires self.price > "0";
|
|
70
|
-
from: deposit_paid, to: paid, actor: { party: buyer }, deadline: { at: self.balanceAt }
|
|
71
|
-
moves self.balance from buyer to self.held economics { purpose: principal, sourceParty: buyer }
|
|
72
|
-
}
|
|
73
|
-
action confirm { allowZero: true, requires self.price > "0";
|
|
74
|
-
from: paid, to: completed, actor: { party: operator }
|
|
75
|
-
due: { at: self.package.departure }, deadline: { at: self.confirmBy }
|
|
76
|
-
moves self.supplierCost from self.held to supplier economics { purpose: participant_payout, sourceParty: programOperator }
|
|
77
|
-
moves self.tax from self.held to programTax economics { purpose: pass_through, sourceParty: programOperator }
|
|
78
|
-
moves self.operatorNet from self.held to operator economics { recipient: operator, company: { purpose: earning, sourceParty: buyer }, participant: { purpose: participant_payout, sourceParty: programOperator } }
|
|
79
|
-
}
|
|
80
|
-
action timeout {
|
|
81
|
-
from: paid, to: refunded, actor: clock, due: { at: self.confirmBy }
|
|
82
|
-
moves self.price from self.held to buyer economics { purpose: principal, sourceParty: programOperator }
|
|
83
|
-
}
|
|
84
|
-
action cancel_early { allowZero: true, purpose: option, requires self.price > "0";
|
|
85
|
-
from: [deposit_paid, paid], to: cancelled, actor: { party: buyer }, deadline: { at: self.earlyAt }
|
|
86
|
-
moves self.held.balance from self.held to buyer economics { purpose: principal, sourceParty: programOperator }
|
|
87
|
-
}
|
|
88
|
-
action cancel_middle { allowZero: true, purpose: option, requires self.price > "0";
|
|
89
|
-
from: [deposit_paid, paid], to: cancelled, actor: { party: buyer }, due: { at: self.earlyAt }, deadline: { at: self.lateAt }
|
|
90
|
-
calculate: [
|
|
91
|
-
{ target: refund, op: "subtract", base: { field: self.held.balance }, subtract: [{ field: self.deposit }] }
|
|
92
|
-
{ target: retainedMargin, op: "subtract", base: { field: self.deposit }, subtract: [{ field: self.middlePenalty }] }
|
|
93
|
-
{ target: retainedTax, op: "rate", base: { field: self.retainedMargin }, bps: { literal: tax }, rounding: "floor" }
|
|
94
|
-
{ target: retainedNet, op: "subtract", base: { field: self.retainedMargin }, subtract: [{ field: self.retainedTax }] }
|
|
95
|
-
]
|
|
96
|
-
moves self.refund from self.held to buyer economics { purpose: principal, sourceParty: programOperator }
|
|
97
|
-
moves self.middlePenalty from self.held to supplier economics { purpose: participant_payout, sourceParty: programOperator }
|
|
98
|
-
moves self.retainedTax from self.held to programTax economics { purpose: pass_through, sourceParty: programOperator }
|
|
99
|
-
moves self.retainedNet from self.held to operator economics { recipient: operator, company: { purpose: earning, sourceParty: buyer }, participant: { purpose: participant_payout, sourceParty: programOperator } }
|
|
100
|
-
}
|
|
101
|
-
action cancel_late { allowZero: true, purpose: option, requires self.price > "0";
|
|
102
|
-
from: [deposit_paid, paid], to: cancelled, actor: { party: buyer }, due: { at: self.lateAt }
|
|
103
|
-
calculate: [
|
|
104
|
-
{ target: retainedMargin, op: "subtract", base: { field: self.held.balance }, subtract: [{ field: self.latePenalty }] }
|
|
105
|
-
{ target: retainedTax, op: "rate", base: { field: self.retainedMargin }, bps: { literal: tax }, rounding: "floor" }
|
|
106
|
-
{ target: retainedNet, op: "subtract", base: { field: self.retainedMargin }, subtract: [{ field: self.retainedTax }] }
|
|
107
|
-
]
|
|
108
|
-
moves self.latePenalty from self.held to supplier economics { purpose: participant_payout, sourceParty: programOperator }
|
|
109
|
-
moves self.retainedTax from self.held to programTax economics { purpose: pass_through, sourceParty: programOperator }
|
|
110
|
-
moves self.retainedNet from self.held to operator economics { recipient: operator, company: { purpose: earning, sourceParty: buyer }, participant: { purpose: participant_payout, sourceParty: programOperator } }
|
|
111
|
-
}
|
|
112
|
-
action default_balance { allowZero: true, requires self.price > "0";
|
|
113
|
-
from: deposit_paid, to: cancelled, actor: clock, due: { at: self.balanceAt }
|
|
114
|
-
calculate: [
|
|
115
|
-
{ target: retainedMargin, op: "subtract", base: { field: self.held.balance }, subtract: [{ field: self.latePenalty }] }
|
|
116
|
-
{ target: retainedTax, op: "rate", base: { field: self.retainedMargin }, bps: { literal: tax }, rounding: "floor" }
|
|
117
|
-
{ target: retainedNet, op: "subtract", base: { field: self.retainedMargin }, subtract: [{ field: self.retainedTax }] }
|
|
118
|
-
]
|
|
119
|
-
moves self.latePenalty from self.held to supplier economics { purpose: participant_payout, sourceParty: programOperator }
|
|
120
|
-
moves self.retainedTax from self.held to programTax economics { purpose: pass_through, sourceParty: programOperator }
|
|
121
|
-
moves self.retainedNet from self.held to operator economics { recipient: operator, company: { purpose: earning, sourceParty: buyer }, participant: { purpose: participant_payout, sourceParty: programOperator } }
|
|
122
|
-
}
|
|
123
|
-
}
|