@plasius/economy 0.3.0 → 0.3.2
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/README.md +44 -1
- package/dist/index.cjs +1363 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +241 -2
- package/dist/index.d.ts +241 -2
- package/dist/index.js +1342 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -120,7 +120,11 @@ const payloadForApprovedHashAdapter = canonicalTransactionPayload(transaction);
|
|
|
120
120
|
```
|
|
121
121
|
|
|
122
122
|
The package produces canonical bytes but deliberately leaves SHA-256/HSM
|
|
123
|
-
signing to an approved infrastructure adapter.
|
|
123
|
+
signing to an approved infrastructure adapter. Metadata keys and posting IDs
|
|
124
|
+
are ordered with locale-independent UTF-16 code-unit comparison. Their
|
|
125
|
+
validated ASCII alphabet makes that ordering identical to PostgreSQL
|
|
126
|
+
`COLLATE "C"`; adapters must hash the exact UTF-8 bytes returned by
|
|
127
|
+
`canonicalTransactionPayload()`.
|
|
124
128
|
|
|
125
129
|
## Source-lot policy and allocations
|
|
126
130
|
|
|
@@ -168,6 +172,45 @@ versions, exact payout values, and beneficiary/wallet IDs. ayeT and BitLabs lots
|
|
|
168
172
|
are structurally restricted to `same-user-only`; changing a provider-earned lot
|
|
169
173
|
to household-allocatable is rejected.
|
|
170
174
|
|
|
175
|
+
### Deterministic paid-acquisition lifecycle
|
|
176
|
+
|
|
177
|
+
`PurchaseIntentLifecycleV1` adds receipts and optimistic versions around the
|
|
178
|
+
unchanged `PurchaseIntentV1`. `reducePurchaseIntentTransitions()` canonicalizes
|
|
179
|
+
out-of-order checkout, payment, credit, expiry, cancellation, and dispute
|
|
180
|
+
evidence. Exact retries collapse, conflicting ID reuse fails, and one intent
|
|
181
|
+
can emit at most one stable intent-ID-scoped credit instruction. The transition
|
|
182
|
+
name is `checkout-bound`; the published compatible intent status remains
|
|
183
|
+
`checkout-created`.
|
|
184
|
+
|
|
185
|
+
`reserveRollingPurchaseCaps()` mirrors one exact GBP-minor-unit reservation
|
|
186
|
+
into payer and household aggregates. Both expected versions must match and both
|
|
187
|
+
returned versions must be committed in one serializable transaction.
|
|
188
|
+
Settlement keeps the amount in the rolling window; release and expiry free it.
|
|
189
|
+
Exact command replays are no-ops, including after finalization. GBP minor units
|
|
190
|
+
use canonical non-negative signed-64-bit strings through
|
|
191
|
+
`parseGbpMinorUnits()` and `serializeGbpMinorUnits()`.
|
|
192
|
+
|
|
193
|
+
`PaidLotLifecycleV1` separately preserves early-backer retained basis:
|
|
194
|
+
|
|
195
|
+
- a dispute hold leaves retained basis unchanged;
|
|
196
|
+
- a dispute win releases only the hold;
|
|
197
|
+
- refunds, lost disputes, direct chargebacks, and the one permitted reversal
|
|
198
|
+
reduce retained basis exactly;
|
|
199
|
+
- partial outcomes retain their unreversed remainder;
|
|
200
|
+
- `createEarlyBackerRetentionFromPaidLot()` supplies a current
|
|
201
|
+
`PaidLotRetentionV1` for recalculation.
|
|
202
|
+
|
|
203
|
+
Retained basis is not a spendable-balance claim. Before a compensation commits,
|
|
204
|
+
the authoritative service must atomically reclaim allocated-but-unused value,
|
|
205
|
+
reject value already spent or otherwise unavailable, append balanced journal
|
|
206
|
+
postings, update source-lot/lifecycle projections, save idempotency evidence,
|
|
207
|
+
and append the outbox. This package contains none of those provider or
|
|
208
|
+
persistence adapters.
|
|
209
|
+
|
|
210
|
+
These contracts do not enable checkout. The site must still enforce
|
|
211
|
+
`economy.tokens.shopify.enabled`, payer/household authorization, legal gates,
|
|
212
|
+
provider-signature verification, and server-derived purchase facts.
|
|
213
|
+
|
|
171
214
|
`BASELINE_MONTHLY_SUBSCRIPTION_PLAN` preserves the provider-neutral future £10
|
|
172
215
|
monthly/100 Token shape with `enabled: false`. Spend-request contracts likewise
|
|
173
216
|
exist for future use but this package does not enable their creation.
|