@percayso-community/cayso-contracts 0.23.0 → 0.24.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/dist/assurance.js CHANGED
@@ -488,6 +488,7 @@ export const OPERATION_FOR_ROUTE = {
488
488
  placeQuote: 'place-quote',
489
489
  withdrawQuote: 'withdraw-quote',
490
490
  requestBuyBack: 'request-buy-back',
491
+ marketplaceOrder: 'settle-marketplace-order',
491
492
  version: null,
492
493
  };
493
494
  /**
package/dist/client.d.ts CHANGED
@@ -70,6 +70,7 @@
70
70
  import type { BuyBackMade, BuyBackRequest, CitizenMarketViewed, QuotePlaced, QuoteRequest, QuoteWithdrawalRequest, QuoteWithdrawn } from './citizen-market.js';
71
71
  import type { CitizenshipFounderClaimed, CitizenshipView } from './citizenship.js';
72
72
  import type { CommercialPaymentMade, CommercialPaymentRequest } from './commercial-payment.js';
73
+ import type { MarketplaceOrderRequest, MarketplaceOrderSettled } from './marketplace-settlement.js';
73
74
  import type { OrganisationView } from './organisation.js';
74
75
  import type { PurchaseAuthorised, PurchaseCancelled, PurchaseRequest, PurchaseResult, PurchaseTerminal } from './purchase.js';
75
76
  import type { WalletView } from './wallet.js';
@@ -251,6 +252,18 @@ export interface CaysoClient {
251
252
  * and means nothing moved and nothing is paid.
252
253
  */
253
254
  requestBuyBack(req: BuyBackRequest): Promise<BuyBackMade>;
255
+ /**
256
+ * Present Store Platform's signed order to settle a house-publisher marketplace sale
257
+ * under the buyer's assertion (`settle-marketplace-order`, CAY-0082 §2, CAY-0083 §3),
258
+ * and receive Cayso's signed receipt — or REPLAY a sale already settled.
259
+ *
260
+ * Safe to repeat with no key of its own: the idempotency key is inside the signed
261
+ * order, and presenting the same order again answers the receipt already written
262
+ * (CAY-0082 §4). A refusal arrives as a thrown {@link CaysoApiError} whose `code` is
263
+ * a `MarketplaceOrderRefusal` member, one of the gate's codes, or a seam code, and
264
+ * means nothing moved.
265
+ */
266
+ settleMarketplaceOrder(req: MarketplaceOrderRequest): Promise<MarketplaceOrderSettled>;
254
267
  getVersion(): Promise<CaysoVersion>;
255
268
  }
256
269
  /**
package/dist/client.js CHANGED
@@ -260,6 +260,16 @@ function buildClient(options, internals) {
260
260
  idempotencyKey: req.idempotencyKey,
261
261
  });
262
262
  },
263
+ async settleMarketplaceOrder(req) {
264
+ return requestJson({
265
+ method: ROUTES.marketplaceOrder.method,
266
+ path: ROUTES.marketplaceOrder.path,
267
+ // Safe to repeat: the key is inside the signed order, and the same order
268
+ // presented again answers the receipt already written, never a second sale.
269
+ idempotent: true,
270
+ body: req,
271
+ });
272
+ },
263
273
  async getPurchase(purchaseId) {
264
274
  return requestJson({
265
275
  method: ROUTES.purchaseResult.method,
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export const CONTRACT_SCHEMA = {
17
- "contractVersion": "0.23.0",
17
+ "contractVersion": "0.24.0",
18
18
  "packageName": "@percayso-community/cayso-contracts",
19
19
  "capabilities": {
20
20
  "wallet": "cayso.wallet",
@@ -73,6 +73,10 @@ export const CONTRACT_SCHEMA = {
73
73
  "method": "POST",
74
74
  "path": "/api/buy-backs"
75
75
  },
76
+ "marketplaceOrder": {
77
+ "method": "POST",
78
+ "path": "/api/marketplace/orders"
79
+ },
76
80
  "version": {
77
81
  "method": "GET",
78
82
  "path": "/api/version"
@@ -591,6 +595,15 @@ export const CONTRACT_SCHEMA = {
591
595
  {
592
596
  "literal": "receipt_signing_not_configured"
593
597
  },
598
+ {
599
+ "literal": "marketplace_order_keys_not_configured"
600
+ },
601
+ {
602
+ "literal": "marketplace_order_store_not_configured"
603
+ },
604
+ {
605
+ "literal": "third_party_marketplace_sale_not_served"
606
+ },
594
607
  {
595
608
  "literal": "invalid_request"
596
609
  },
package/dist/errors.d.ts CHANGED
@@ -151,6 +151,25 @@ export type CaysoApiErrorCode =
151
151
  * start.
152
152
  */
153
153
  | 'receipt_signing_not_configured'
154
+ /**
155
+ * This deployment holds no registry of Store Platform order keys, so no signed
156
+ * order can be verified and no marketplace operation is served (CAY-0083 §4).
157
+ * Empty by default: a closed door, never a permissive one.
158
+ */
159
+ | 'marketplace_order_keys_not_configured'
160
+ /**
161
+ * No marketplace sale store is wired, or this deployment has not been told which
162
+ * wallet is the Treasury a house-publisher sale is charged to (CAY-0082 §2).
163
+ */
164
+ | 'marketplace_order_store_not_configured'
165
+ /**
166
+ * The signed order pays a Citizen publisher, and this version serves the
167
+ * house-publisher sale only (CAY-0082 §2). Nothing was checked against the payee and
168
+ * nothing moved. A seam code rather than a {@link MarketplaceOrderRefusal}, because it
169
+ * describes this deployment and not the order; the third-party sale retires it when
170
+ * it ships.
171
+ */
172
+ | 'third_party_marketplace_sale_not_served'
154
173
  /** The request body or parameters did not satisfy the declared schema. */
155
174
  | 'invalid_request'
156
175
  /** There is no such purchase under this caller's wallet. */
package/dist/index.d.ts CHANGED
@@ -71,6 +71,13 @@
71
71
  * this money surface gains that Piper's own contracts lack, since theirs share
72
72
  * one global version bumped across all twenty-two together (CAY-0026).
73
73
  *
74
+ * `0.23.0` → `0.24.0` SERVES `settle-marketplace-order` for a house-publisher sale
75
+ * at `ROUTES.marketplaceOrder` (CAY-0082 §2, CAY-0083 §3), with the client method
76
+ * `settleMarketplaceOrder` and three seam codes: `marketplace_order_keys_not_configured`,
77
+ * `marketplace_order_store_not_configured` and `third_party_marketplace_sale_not_served`.
78
+ * It is BREAKING because two closed tables grew: `ROUTES` (so every total map over it,
79
+ * `OPERATION_FOR_ROUTE` included, needs the entry) and `CaysoApiErrorCode`.
80
+ *
74
81
  * `0.22.0` → `0.23.0` publishes the two money-grade marketplace operations and
75
82
  * CAY-0082 §7's closed refusal unions (CAY-0083 §3, #303), and it is BREAKING because
76
83
  * three closed tables grew:
@@ -479,7 +486,7 @@
479
486
  * have needed a breaking bump on their own. Under semver below `1.0.0` the minor
480
487
  * is where a breaking change goes, so the minor moves and the patch does not.
481
488
  */
482
- export declare const CONTRACT_VERSION: "0.23.0";
489
+ export declare const CONTRACT_VERSION: "0.24.0";
483
490
  /** The package's own name, so a consumer can name what it depends on. */
484
491
  export declare const packageName = "@percayso-community/cayso-contracts";
485
492
  /**
package/dist/index.js CHANGED
@@ -87,6 +87,13 @@
87
87
  * this money surface gains that Piper's own contracts lack, since theirs share
88
88
  * one global version bumped across all twenty-two together (CAY-0026).
89
89
  *
90
+ * `0.23.0` → `0.24.0` SERVES `settle-marketplace-order` for a house-publisher sale
91
+ * at `ROUTES.marketplaceOrder` (CAY-0082 §2, CAY-0083 §3), with the client method
92
+ * `settleMarketplaceOrder` and three seam codes: `marketplace_order_keys_not_configured`,
93
+ * `marketplace_order_store_not_configured` and `third_party_marketplace_sale_not_served`.
94
+ * It is BREAKING because two closed tables grew: `ROUTES` (so every total map over it,
95
+ * `OPERATION_FOR_ROUTE` included, needs the entry) and `CaysoApiErrorCode`.
96
+ *
90
97
  * `0.22.0` → `0.23.0` publishes the two money-grade marketplace operations and
91
98
  * CAY-0082 §7's closed refusal unions (CAY-0083 §3, #303), and it is BREAKING because
92
99
  * three closed tables grew:
@@ -495,7 +502,7 @@
495
502
  * have needed a breaking bump on their own. Under semver below `1.0.0` the minor
496
503
  * is where a breaking change goes, so the minor moves and the patch does not.
497
504
  */
498
- export const CONTRACT_VERSION = '0.23.0';
505
+ export const CONTRACT_VERSION = '0.24.0';
499
506
  /** The package's own name, so a consumer can name what it depends on. */
500
507
  export const packageName = '@percayso-community/cayso-contracts';
501
508
  /**
@@ -10,8 +10,9 @@
10
10
  * `ASSURANCE_POLICY`, which is an allowlist, so `dev-bypass` is never admissible and
11
11
  * a future method is not admissible without a policy decision (CAY-0029).
12
12
  *
13
- * **This is the contract surface only.** No route serves either operation, and
14
- * nothing here settles anything. The sale table, the registry of Store Platform order
13
+ * **This is the contract surface only.** Nothing here settles anything. Since
14
+ * `0.24.0` a route serves `settle-marketplace-order` for a house-publisher sale
15
+ * (`ROUTES.marketplaceOrder`); the third-party sale and the refund are not served. The sale table, the registry of Store Platform order
15
16
  * keys and the ledger stay in this proprietary tree (CAY-0083 §3).
16
17
  *
17
18
  * ## Two operations, because two authorities are checked
@@ -33,7 +34,7 @@
33
34
  * no way for a re-encoding to disagree with the signer by a space. Piper produces
34
35
  * the bytes with Store Platform's own published encoder
35
36
  * (`encodeSignedOrderStatement`, `encodeRefundDecisionStatement` in
36
- * `@percayso/store-contracts`), and never edits them.
37
+ * `@percayso-community/store-contracts`), and never edits them.
37
38
  *
38
39
  * The statements' fields are Store Platform's to define (`STO-0043`) and are not
39
40
  * restated here: a second copy of another pillar's format is two formats that
package/dist/routes.d.ts CHANGED
@@ -148,6 +148,10 @@ export declare const ROUTES: {
148
148
  readonly method: "POST";
149
149
  readonly path: "/api/buy-backs";
150
150
  };
151
+ readonly marketplaceOrder: {
152
+ readonly method: "POST";
153
+ readonly path: "/api/marketplace/orders";
154
+ };
151
155
  readonly version: {
152
156
  readonly method: "GET";
153
157
  readonly path: "/api/version";
package/dist/routes.js CHANGED
@@ -124,5 +124,6 @@ export const ROUTES = {
124
124
  placeQuote: { method: 'POST', path: '/api/quotes' },
125
125
  withdrawQuote: { method: 'POST', path: '/api/quote-withdrawals' },
126
126
  requestBuyBack: { method: 'POST', path: '/api/buy-backs' },
127
+ marketplaceOrder: { method: 'POST', path: '/api/marketplace/orders' },
127
128
  version: { method: 'GET', path: '/api/version' },
128
129
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percayso-community/cayso-contracts",
3
- "version": "0.23.0",
3
+ "version": "0.24.0",
4
4
  "description": "The versioned capability contract surface through which anything outside this repository reads a wallet. Published; keep it the Piper-facing surface only.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {