@contractspec/example.marketplace 1.56.1 → 1.58.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/browser/docs/index.js +103 -0
- package/dist/browser/docs/marketplace.docblock.js +103 -0
- package/dist/browser/entities/index.js +721 -0
- package/dist/browser/entities/order.js +167 -0
- package/dist/browser/entities/payout.js +142 -0
- package/dist/browser/entities/product.js +152 -0
- package/dist/browser/entities/review.js +129 -0
- package/dist/browser/entities/store.js +97 -0
- package/dist/browser/example.js +42 -0
- package/dist/browser/handlers/index.js +303 -0
- package/dist/browser/handlers/marketplace.handlers.js +303 -0
- package/dist/browser/index.js +2016 -0
- package/dist/browser/marketplace.capability.js +40 -0
- package/dist/browser/marketplace.feature.js +137 -0
- package/dist/browser/order/index.js +307 -0
- package/dist/browser/order/order.enum.js +17 -0
- package/dist/browser/order/order.event.js +131 -0
- package/dist/browser/order/order.operations.js +172 -0
- package/dist/browser/order/order.presentation.js +153 -0
- package/dist/browser/order/order.schema.js +79 -0
- package/dist/browser/payout/index.js +152 -0
- package/dist/browser/payout/payout.enum.js +12 -0
- package/dist/browser/payout/payout.event.js +55 -0
- package/dist/browser/payout/payout.operations.js +94 -0
- package/dist/browser/payout/payout.presentation.js +111 -0
- package/dist/browser/payout/payout.schema.js +61 -0
- package/dist/browser/product/index.js +249 -0
- package/dist/browser/product/product.enum.js +13 -0
- package/dist/browser/product/product.event.js +74 -0
- package/dist/browser/product/product.operations.js +171 -0
- package/dist/browser/product/product.presentation.js +158 -0
- package/dist/browser/product/product.schema.js +84 -0
- package/dist/browser/review/index.js +206 -0
- package/dist/browser/review/review.enum.js +11 -0
- package/dist/browser/review/review.event.js +50 -0
- package/dist/browser/review/review.operations.js +152 -0
- package/dist/browser/review/review.presentation.js +123 -0
- package/dist/browser/review/review.schema.js +74 -0
- package/dist/browser/seeders/index.js +12 -0
- package/dist/browser/store/index.js +142 -0
- package/dist/browser/store/store.enum.js +11 -0
- package/dist/browser/store/store.event.js +52 -0
- package/dist/browser/store/store.operations.js +88 -0
- package/dist/browser/store/store.presentation.js +94 -0
- package/dist/browser/store/store.schema.js +43 -0
- package/dist/browser/tests/operations.test-spec.js +139 -0
- package/dist/browser/ui/MarketplaceDashboard.js +418 -0
- package/dist/browser/ui/hooks/index.js +59 -0
- package/dist/browser/ui/hooks/useMarketplaceData.js +56 -0
- package/dist/browser/ui/index.js +668 -0
- package/dist/browser/ui/renderers/index.js +248 -0
- package/dist/browser/ui/renderers/marketplace.markdown.js +248 -0
- package/dist/docs/index.d.ts +2 -1
- package/dist/docs/index.d.ts.map +1 -0
- package/dist/docs/index.js +104 -1
- package/dist/docs/marketplace.docblock.d.ts +2 -1
- package/dist/docs/marketplace.docblock.d.ts.map +1 -0
- package/dist/docs/marketplace.docblock.js +46 -57
- package/dist/entities/index.d.ts +302 -307
- package/dist/entities/index.d.ts.map +1 -1
- package/dist/entities/index.js +719 -43
- package/dist/entities/order.d.ts +77 -82
- package/dist/entities/order.d.ts.map +1 -1
- package/dist/entities/order.js +162 -167
- package/dist/entities/payout.d.ts +64 -69
- package/dist/entities/payout.d.ts.map +1 -1
- package/dist/entities/payout.js +137 -156
- package/dist/entities/product.d.ts +69 -74
- package/dist/entities/product.d.ts.map +1 -1
- package/dist/entities/product.js +148 -156
- package/dist/entities/review.d.ts +55 -60
- package/dist/entities/review.d.ts.map +1 -1
- package/dist/entities/review.js +124 -146
- package/dist/entities/store.d.ts +40 -45
- package/dist/entities/store.d.ts.map +1 -1
- package/dist/entities/store.js +94 -106
- package/dist/example.d.ts +2 -6
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +40 -55
- package/dist/handlers/index.d.ts +2 -2
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +304 -3
- package/dist/handlers/marketplace.handlers.d.ts +138 -138
- package/dist/handlers/marketplace.handlers.d.ts.map +1 -1
- package/dist/handlers/marketplace.handlers.js +284 -309
- package/dist/index.d.ts +13 -31
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2017 -32
- package/dist/marketplace.capability.d.ts +3 -8
- package/dist/marketplace.capability.d.ts.map +1 -1
- package/dist/marketplace.capability.js +41 -34
- package/dist/marketplace.feature.d.ts +1 -7
- package/dist/marketplace.feature.d.ts.map +1 -1
- package/dist/marketplace.feature.js +136 -313
- package/dist/node/docs/index.js +103 -0
- package/dist/node/docs/marketplace.docblock.js +103 -0
- package/dist/node/entities/index.js +721 -0
- package/dist/node/entities/order.js +167 -0
- package/dist/node/entities/payout.js +142 -0
- package/dist/node/entities/product.js +152 -0
- package/dist/node/entities/review.js +129 -0
- package/dist/node/entities/store.js +97 -0
- package/dist/node/example.js +42 -0
- package/dist/node/handlers/index.js +303 -0
- package/dist/node/handlers/marketplace.handlers.js +303 -0
- package/dist/node/index.js +2016 -0
- package/dist/node/marketplace.capability.js +40 -0
- package/dist/node/marketplace.feature.js +137 -0
- package/dist/node/order/index.js +307 -0
- package/dist/node/order/order.enum.js +17 -0
- package/dist/node/order/order.event.js +131 -0
- package/dist/node/order/order.operations.js +172 -0
- package/dist/node/order/order.presentation.js +153 -0
- package/dist/node/order/order.schema.js +79 -0
- package/dist/node/payout/index.js +152 -0
- package/dist/node/payout/payout.enum.js +12 -0
- package/dist/node/payout/payout.event.js +55 -0
- package/dist/node/payout/payout.operations.js +94 -0
- package/dist/node/payout/payout.presentation.js +111 -0
- package/dist/node/payout/payout.schema.js +61 -0
- package/dist/node/product/index.js +249 -0
- package/dist/node/product/product.enum.js +13 -0
- package/dist/node/product/product.event.js +74 -0
- package/dist/node/product/product.operations.js +171 -0
- package/dist/node/product/product.presentation.js +158 -0
- package/dist/node/product/product.schema.js +84 -0
- package/dist/node/review/index.js +206 -0
- package/dist/node/review/review.enum.js +11 -0
- package/dist/node/review/review.event.js +50 -0
- package/dist/node/review/review.operations.js +152 -0
- package/dist/node/review/review.presentation.js +123 -0
- package/dist/node/review/review.schema.js +74 -0
- package/dist/node/seeders/index.js +12 -0
- package/dist/node/store/index.js +142 -0
- package/dist/node/store/store.enum.js +11 -0
- package/dist/node/store/store.event.js +52 -0
- package/dist/node/store/store.operations.js +88 -0
- package/dist/node/store/store.presentation.js +94 -0
- package/dist/node/store/store.schema.js +43 -0
- package/dist/node/tests/operations.test-spec.js +139 -0
- package/dist/node/ui/MarketplaceDashboard.js +418 -0
- package/dist/node/ui/hooks/index.js +59 -0
- package/dist/node/ui/hooks/useMarketplaceData.js +56 -0
- package/dist/node/ui/index.js +668 -0
- package/dist/node/ui/renderers/index.js +248 -0
- package/dist/node/ui/renderers/marketplace.markdown.js +248 -0
- package/dist/order/index.d.ts +8 -5
- package/dist/order/index.d.ts.map +1 -0
- package/dist/order/index.js +307 -5
- package/dist/order/order.enum.d.ts +1 -6
- package/dist/order/order.enum.d.ts.map +1 -1
- package/dist/order/order.enum.js +16 -20
- package/dist/order/order.event.d.ts +133 -139
- package/dist/order/order.event.d.ts.map +1 -1
- package/dist/order/order.event.js +121 -205
- package/dist/order/order.operations.d.ts +291 -297
- package/dist/order/order.operations.d.ts.map +1 -1
- package/dist/order/order.operations.js +169 -115
- package/dist/order/order.presentation.d.ts +3 -8
- package/dist/order/order.presentation.d.ts.map +1 -1
- package/dist/order/order.presentation.js +149 -81
- package/dist/order/order.schema.d.ts +143 -148
- package/dist/order/order.schema.d.ts.map +1 -1
- package/dist/order/order.schema.js +75 -150
- package/dist/payout/index.d.ts +8 -5
- package/dist/payout/index.d.ts.map +1 -0
- package/dist/payout/index.js +152 -5
- package/dist/payout/payout.enum.d.ts +1 -6
- package/dist/payout/payout.enum.d.ts.map +1 -1
- package/dist/payout/payout.enum.js +11 -15
- package/dist/payout/payout.event.d.ts +54 -60
- package/dist/payout/payout.event.d.ts.map +1 -1
- package/dist/payout/payout.event.js +51 -87
- package/dist/payout/payout.operations.d.ts +82 -88
- package/dist/payout/payout.operations.d.ts.map +1 -1
- package/dist/payout/payout.operations.js +92 -50
- package/dist/payout/payout.presentation.d.ts +2 -7
- package/dist/payout/payout.presentation.d.ts.map +1 -1
- package/dist/payout/payout.presentation.js +108 -56
- package/dist/payout/payout.schema.d.ts +139 -144
- package/dist/payout/payout.schema.d.ts.map +1 -1
- package/dist/payout/payout.schema.js +58 -112
- package/dist/product/index.d.ts +8 -5
- package/dist/product/index.d.ts.map +1 -0
- package/dist/product/index.js +249 -5
- package/dist/product/product.enum.d.ts +1 -6
- package/dist/product/product.enum.d.ts.map +1 -1
- package/dist/product/product.enum.js +12 -16
- package/dist/product/product.event.d.ts +63 -69
- package/dist/product/product.event.d.ts.map +1 -1
- package/dist/product/product.event.js +68 -113
- package/dist/product/product.operations.d.ts +225 -231
- package/dist/product/product.operations.d.ts.map +1 -1
- package/dist/product/product.operations.js +168 -104
- package/dist/product/product.presentation.d.ts +3 -8
- package/dist/product/product.presentation.d.ts.map +1 -1
- package/dist/product/product.presentation.js +154 -81
- package/dist/product/product.schema.d.ts +196 -201
- package/dist/product/product.schema.d.ts.map +1 -1
- package/dist/product/product.schema.js +80 -171
- package/dist/review/index.d.ts +8 -5
- package/dist/review/index.d.ts.map +1 -0
- package/dist/review/index.js +206 -5
- package/dist/review/review.enum.d.ts +1 -6
- package/dist/review/review.enum.d.ts.map +1 -1
- package/dist/review/review.enum.js +10 -14
- package/dist/review/review.event.d.ts +46 -52
- package/dist/review/review.event.d.ts.map +1 -1
- package/dist/review/review.event.js +46 -79
- package/dist/review/review.operations.d.ts +190 -196
- package/dist/review/review.operations.d.ts.map +1 -1
- package/dist/review/review.operations.js +149 -102
- package/dist/review/review.presentation.d.ts +2 -7
- package/dist/review/review.presentation.d.ts.map +1 -1
- package/dist/review/review.presentation.js +120 -56
- package/dist/review/review.schema.d.ts +164 -169
- package/dist/review/review.schema.d.ts.map +1 -1
- package/dist/review/review.schema.js +70 -151
- package/dist/seeders/index.d.ts +4 -8
- package/dist/seeders/index.d.ts.map +1 -1
- package/dist/seeders/index.js +11 -16
- package/dist/store/index.d.ts +8 -5
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +142 -5
- package/dist/store/store.enum.d.ts +1 -6
- package/dist/store/store.enum.d.ts.map +1 -1
- package/dist/store/store.enum.js +10 -14
- package/dist/store/store.event.d.ts +42 -48
- package/dist/store/store.event.d.ts.map +1 -1
- package/dist/store/store.event.js +48 -75
- package/dist/store/store.operations.d.ts +98 -104
- package/dist/store/store.operations.d.ts.map +1 -1
- package/dist/store/store.operations.js +86 -58
- package/dist/store/store.presentation.d.ts +2 -7
- package/dist/store/store.presentation.d.ts.map +1 -1
- package/dist/store/store.presentation.js +91 -56
- package/dist/store/store.schema.d.ts +70 -75
- package/dist/store/store.schema.d.ts.map +1 -1
- package/dist/store/store.schema.js +41 -90
- package/dist/tests/operations.test-spec.d.ts +5 -10
- package/dist/tests/operations.test-spec.d.ts.map +1 -1
- package/dist/tests/operations.test-spec.js +134 -146
- package/dist/ui/MarketplaceDashboard.d.ts +1 -6
- package/dist/ui/MarketplaceDashboard.d.ts.map +1 -1
- package/dist/ui/MarketplaceDashboard.js +413 -313
- package/dist/ui/hooks/index.d.ts +2 -2
- package/dist/ui/hooks/index.d.ts.map +1 -0
- package/dist/ui/hooks/index.js +59 -4
- package/dist/ui/hooks/useMarketplaceData.d.ts +16 -20
- package/dist/ui/hooks/useMarketplaceData.d.ts.map +1 -1
- package/dist/ui/hooks/useMarketplaceData.js +53 -60
- package/dist/ui/index.d.ts +7 -6
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +668 -5
- package/dist/ui/renderers/index.d.ts +2 -2
- package/dist/ui/renderers/index.d.ts.map +1 -0
- package/dist/ui/renderers/index.js +249 -3
- package/dist/ui/renderers/marketplace.markdown.d.ts +13 -15
- package/dist/ui/renderers/marketplace.markdown.d.ts.map +1 -1
- package/dist/ui/renderers/marketplace.markdown.js +241 -236
- package/package.json +529 -110
- package/dist/docs/marketplace.docblock.js.map +0 -1
- package/dist/entities/index.js.map +0 -1
- package/dist/entities/order.js.map +0 -1
- package/dist/entities/payout.js.map +0 -1
- package/dist/entities/product.js.map +0 -1
- package/dist/entities/review.js.map +0 -1
- package/dist/entities/store.js.map +0 -1
- package/dist/example.js.map +0 -1
- package/dist/handlers/marketplace.handlers.js.map +0 -1
- package/dist/marketplace.capability.js.map +0 -1
- package/dist/marketplace.feature.js.map +0 -1
- package/dist/order/order.enum.js.map +0 -1
- package/dist/order/order.event.js.map +0 -1
- package/dist/order/order.operations.js.map +0 -1
- package/dist/order/order.presentation.js.map +0 -1
- package/dist/order/order.schema.js.map +0 -1
- package/dist/payout/payout.enum.js.map +0 -1
- package/dist/payout/payout.event.js.map +0 -1
- package/dist/payout/payout.operations.js.map +0 -1
- package/dist/payout/payout.presentation.js.map +0 -1
- package/dist/payout/payout.schema.js.map +0 -1
- package/dist/product/product.enum.js.map +0 -1
- package/dist/product/product.event.js.map +0 -1
- package/dist/product/product.operations.js.map +0 -1
- package/dist/product/product.presentation.js.map +0 -1
- package/dist/product/product.schema.js.map +0 -1
- package/dist/review/review.enum.js.map +0 -1
- package/dist/review/review.event.js.map +0 -1
- package/dist/review/review.operations.js.map +0 -1
- package/dist/review/review.presentation.js.map +0 -1
- package/dist/review/review.schema.js.map +0 -1
- package/dist/seeders/index.js.map +0 -1
- package/dist/store/store.enum.js.map +0 -1
- package/dist/store/store.event.js.map +0 -1
- package/dist/store/store.operations.js.map +0 -1
- package/dist/store/store.presentation.js.map +0 -1
- package/dist/store/store.schema.js.map +0 -1
- package/dist/tests/operations.test-spec.js.map +0 -1
- package/dist/ui/MarketplaceDashboard.js.map +0 -1
- package/dist/ui/hooks/useMarketplaceData.js.map +0 -1
- package/dist/ui/renderers/marketplace.markdown.js.map +0 -1
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
// src/order/order.enum.ts
|
|
2
|
+
import { defineEnum } from "@contractspec/lib.schema";
|
|
3
|
+
var OrderStatusEnum = defineEnum("OrderStatus", [
|
|
4
|
+
"PENDING",
|
|
5
|
+
"PAID",
|
|
6
|
+
"PROCESSING",
|
|
7
|
+
"SHIPPED",
|
|
8
|
+
"DELIVERED",
|
|
9
|
+
"COMPLETED",
|
|
10
|
+
"CANCELLED",
|
|
11
|
+
"REFUNDED",
|
|
12
|
+
"PARTIALLY_REFUNDED",
|
|
13
|
+
"DISPUTED"
|
|
14
|
+
]);
|
|
15
|
+
|
|
16
|
+
// src/order/order.schema.ts
|
|
17
|
+
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
18
|
+
var OrderItemModel = defineSchemaModel({
|
|
19
|
+
name: "OrderItemModel",
|
|
20
|
+
fields: {
|
|
21
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
22
|
+
productId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
23
|
+
productName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
24
|
+
unitPrice: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
25
|
+
quantity: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
26
|
+
subtotal: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false }
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
var OrderModel = defineSchemaModel({
|
|
30
|
+
name: "OrderModel",
|
|
31
|
+
description: "An order",
|
|
32
|
+
fields: {
|
|
33
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
34
|
+
orderNumber: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
35
|
+
buyerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
36
|
+
storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
37
|
+
status: { type: OrderStatusEnum, isOptional: false },
|
|
38
|
+
subtotal: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
39
|
+
shippingTotal: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
40
|
+
taxTotal: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
41
|
+
total: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
42
|
+
currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
43
|
+
items: { type: OrderItemModel, isArray: true, isOptional: true },
|
|
44
|
+
createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
var CreateOrderInputModel = defineSchemaModel({
|
|
48
|
+
name: "CreateOrderInput",
|
|
49
|
+
fields: {
|
|
50
|
+
storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
51
|
+
items: {
|
|
52
|
+
type: ScalarTypeEnum.JSON(),
|
|
53
|
+
isOptional: false,
|
|
54
|
+
description: "Array of {productId, variantId?, quantity}"
|
|
55
|
+
},
|
|
56
|
+
shippingAddress: { type: ScalarTypeEnum.JSON(), isOptional: true },
|
|
57
|
+
billingAddress: { type: ScalarTypeEnum.JSON(), isOptional: true },
|
|
58
|
+
buyerNote: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
var UpdateOrderStatusInputModel = defineSchemaModel({
|
|
62
|
+
name: "UpdateOrderStatusInput",
|
|
63
|
+
fields: {
|
|
64
|
+
orderId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
65
|
+
status: { type: OrderStatusEnum, isOptional: false },
|
|
66
|
+
trackingNumber: {
|
|
67
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
68
|
+
isOptional: true
|
|
69
|
+
},
|
|
70
|
+
trackingUrl: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
71
|
+
note: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// src/order/order.operations.ts
|
|
76
|
+
import { defineCommand } from "@contractspec/lib.contracts/operations";
|
|
77
|
+
var OWNERS = ["@example.marketplace"];
|
|
78
|
+
var CreateOrderContract = defineCommand({
|
|
79
|
+
meta: {
|
|
80
|
+
key: "marketplace.order.create",
|
|
81
|
+
version: "1.0.0",
|
|
82
|
+
stability: "stable",
|
|
83
|
+
owners: [...OWNERS],
|
|
84
|
+
tags: ["marketplace", "order", "create"],
|
|
85
|
+
description: "Create a new order.",
|
|
86
|
+
goal: "Allow buyers to purchase products.",
|
|
87
|
+
context: "Checkout flow."
|
|
88
|
+
},
|
|
89
|
+
io: { input: CreateOrderInputModel, output: OrderModel },
|
|
90
|
+
policy: { auth: "user" },
|
|
91
|
+
sideEffects: {
|
|
92
|
+
emits: [
|
|
93
|
+
{
|
|
94
|
+
key: "marketplace.order.created",
|
|
95
|
+
version: "1.0.0",
|
|
96
|
+
when: "Order is created",
|
|
97
|
+
payload: OrderModel
|
|
98
|
+
}
|
|
99
|
+
],
|
|
100
|
+
audit: ["marketplace.order.created"]
|
|
101
|
+
},
|
|
102
|
+
acceptance: {
|
|
103
|
+
scenarios: [
|
|
104
|
+
{
|
|
105
|
+
key: "create-order-happy-path",
|
|
106
|
+
given: ["User is authenticated"],
|
|
107
|
+
when: ["User creates order with valid items"],
|
|
108
|
+
then: ["Order is created", "OrderCreated event is emitted"]
|
|
109
|
+
}
|
|
110
|
+
],
|
|
111
|
+
examples: [
|
|
112
|
+
{
|
|
113
|
+
key: "create-basic-order",
|
|
114
|
+
input: {
|
|
115
|
+
storeId: "store-123",
|
|
116
|
+
items: [{ productId: "prod-456", quantity: 1, unitPrice: 100 }]
|
|
117
|
+
},
|
|
118
|
+
output: { id: "order-789", status: "pending", total: 100 }
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
var UpdateOrderStatusContract = defineCommand({
|
|
124
|
+
meta: {
|
|
125
|
+
key: "marketplace.order.updateStatus",
|
|
126
|
+
version: "1.0.0",
|
|
127
|
+
stability: "stable",
|
|
128
|
+
owners: [...OWNERS],
|
|
129
|
+
tags: ["marketplace", "order", "status"],
|
|
130
|
+
description: "Update order status.",
|
|
131
|
+
goal: "Track order fulfillment.",
|
|
132
|
+
context: "Order management."
|
|
133
|
+
},
|
|
134
|
+
io: { input: UpdateOrderStatusInputModel, output: OrderModel },
|
|
135
|
+
policy: { auth: "user" },
|
|
136
|
+
sideEffects: {
|
|
137
|
+
emits: [
|
|
138
|
+
{
|
|
139
|
+
key: "marketplace.order.statusUpdated",
|
|
140
|
+
version: "1.0.0",
|
|
141
|
+
when: "Status changes",
|
|
142
|
+
payload: OrderModel
|
|
143
|
+
}
|
|
144
|
+
],
|
|
145
|
+
audit: ["marketplace.order.statusUpdated"]
|
|
146
|
+
},
|
|
147
|
+
acceptance: {
|
|
148
|
+
scenarios: [
|
|
149
|
+
{
|
|
150
|
+
key: "update-status-happy-path",
|
|
151
|
+
given: ["Order exists"],
|
|
152
|
+
when: ["Seller updates order status"],
|
|
153
|
+
then: ["Status is updated", "OrderStatusUpdated event is emitted"]
|
|
154
|
+
}
|
|
155
|
+
],
|
|
156
|
+
examples: [
|
|
157
|
+
{
|
|
158
|
+
key: "mark-shipped",
|
|
159
|
+
input: {
|
|
160
|
+
orderId: "order-789",
|
|
161
|
+
status: "shipped",
|
|
162
|
+
trackingNumber: "TRACK123"
|
|
163
|
+
},
|
|
164
|
+
output: { id: "order-789", status: "shipped" }
|
|
165
|
+
}
|
|
166
|
+
]
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
export {
|
|
170
|
+
UpdateOrderStatusContract,
|
|
171
|
+
CreateOrderContract
|
|
172
|
+
};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
// src/order/order.enum.ts
|
|
2
|
+
import { defineEnum } from "@contractspec/lib.schema";
|
|
3
|
+
var OrderStatusEnum = defineEnum("OrderStatus", [
|
|
4
|
+
"PENDING",
|
|
5
|
+
"PAID",
|
|
6
|
+
"PROCESSING",
|
|
7
|
+
"SHIPPED",
|
|
8
|
+
"DELIVERED",
|
|
9
|
+
"COMPLETED",
|
|
10
|
+
"CANCELLED",
|
|
11
|
+
"REFUNDED",
|
|
12
|
+
"PARTIALLY_REFUNDED",
|
|
13
|
+
"DISPUTED"
|
|
14
|
+
]);
|
|
15
|
+
|
|
16
|
+
// src/order/order.schema.ts
|
|
17
|
+
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
18
|
+
var OrderItemModel = defineSchemaModel({
|
|
19
|
+
name: "OrderItemModel",
|
|
20
|
+
fields: {
|
|
21
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
22
|
+
productId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
23
|
+
productName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
24
|
+
unitPrice: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
25
|
+
quantity: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
26
|
+
subtotal: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false }
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
var OrderModel = defineSchemaModel({
|
|
30
|
+
name: "OrderModel",
|
|
31
|
+
description: "An order",
|
|
32
|
+
fields: {
|
|
33
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
34
|
+
orderNumber: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
35
|
+
buyerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
36
|
+
storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
37
|
+
status: { type: OrderStatusEnum, isOptional: false },
|
|
38
|
+
subtotal: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
39
|
+
shippingTotal: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
40
|
+
taxTotal: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
41
|
+
total: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
42
|
+
currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
43
|
+
items: { type: OrderItemModel, isArray: true, isOptional: true },
|
|
44
|
+
createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
var CreateOrderInputModel = defineSchemaModel({
|
|
48
|
+
name: "CreateOrderInput",
|
|
49
|
+
fields: {
|
|
50
|
+
storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
51
|
+
items: {
|
|
52
|
+
type: ScalarTypeEnum.JSON(),
|
|
53
|
+
isOptional: false,
|
|
54
|
+
description: "Array of {productId, variantId?, quantity}"
|
|
55
|
+
},
|
|
56
|
+
shippingAddress: { type: ScalarTypeEnum.JSON(), isOptional: true },
|
|
57
|
+
billingAddress: { type: ScalarTypeEnum.JSON(), isOptional: true },
|
|
58
|
+
buyerNote: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
var UpdateOrderStatusInputModel = defineSchemaModel({
|
|
62
|
+
name: "UpdateOrderStatusInput",
|
|
63
|
+
fields: {
|
|
64
|
+
orderId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
65
|
+
status: { type: OrderStatusEnum, isOptional: false },
|
|
66
|
+
trackingNumber: {
|
|
67
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
68
|
+
isOptional: true
|
|
69
|
+
},
|
|
70
|
+
trackingUrl: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
71
|
+
note: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// src/order/order.presentation.ts
|
|
76
|
+
import { definePresentation, StabilityEnum } from "@contractspec/lib.contracts";
|
|
77
|
+
var OrderListPresentation = definePresentation({
|
|
78
|
+
meta: {
|
|
79
|
+
key: "marketplace.order.list",
|
|
80
|
+
version: "1.0.0",
|
|
81
|
+
title: "Order List",
|
|
82
|
+
description: "List of orders with status and tracking",
|
|
83
|
+
domain: "marketplace",
|
|
84
|
+
owners: ["@marketplace-team"],
|
|
85
|
+
tags: ["marketplace", "order", "list"],
|
|
86
|
+
stability: StabilityEnum.Experimental,
|
|
87
|
+
goal: "Provide a comprehensive view of all orders for the user.",
|
|
88
|
+
context: "Used in the buyer and seller dashboards to track order progress."
|
|
89
|
+
},
|
|
90
|
+
source: {
|
|
91
|
+
type: "component",
|
|
92
|
+
framework: "react",
|
|
93
|
+
componentKey: "OrderList",
|
|
94
|
+
props: OrderModel
|
|
95
|
+
},
|
|
96
|
+
targets: ["react", "markdown"],
|
|
97
|
+
policy: {
|
|
98
|
+
flags: ["marketplace.orders.enabled"]
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
var OrderDetailPresentation = definePresentation({
|
|
102
|
+
meta: {
|
|
103
|
+
key: "marketplace.order.detail",
|
|
104
|
+
version: "1.0.0",
|
|
105
|
+
title: "Order Details",
|
|
106
|
+
description: "Order detail with items and shipping info",
|
|
107
|
+
domain: "marketplace",
|
|
108
|
+
owners: ["@marketplace-team"],
|
|
109
|
+
tags: ["marketplace", "order", "detail"],
|
|
110
|
+
stability: StabilityEnum.Experimental,
|
|
111
|
+
goal: "Display all details of a single order.",
|
|
112
|
+
context: "Accessed from the order list to see specific items, shipping, and payment details."
|
|
113
|
+
},
|
|
114
|
+
source: {
|
|
115
|
+
type: "component",
|
|
116
|
+
framework: "react",
|
|
117
|
+
componentKey: "OrderDetail",
|
|
118
|
+
props: OrderModel
|
|
119
|
+
},
|
|
120
|
+
targets: ["react", "markdown"],
|
|
121
|
+
policy: {
|
|
122
|
+
flags: ["marketplace.orders.enabled"]
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
var CheckoutPresentation = definePresentation({
|
|
126
|
+
meta: {
|
|
127
|
+
key: "marketplace.checkout",
|
|
128
|
+
version: "1.0.0",
|
|
129
|
+
title: "Checkout",
|
|
130
|
+
description: "Checkout flow with cart and payment",
|
|
131
|
+
domain: "marketplace",
|
|
132
|
+
owners: ["@marketplace-team"],
|
|
133
|
+
tags: ["marketplace", "checkout", "cart"],
|
|
134
|
+
stability: StabilityEnum.Experimental,
|
|
135
|
+
goal: "Guide the user through the payment and order confirmation process.",
|
|
136
|
+
context: "The final stage of the purchasing journey."
|
|
137
|
+
},
|
|
138
|
+
source: {
|
|
139
|
+
type: "component",
|
|
140
|
+
framework: "react",
|
|
141
|
+
componentKey: "Checkout",
|
|
142
|
+
props: OrderModel
|
|
143
|
+
},
|
|
144
|
+
targets: ["react"],
|
|
145
|
+
policy: {
|
|
146
|
+
flags: ["marketplace.checkout.enabled"]
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
export {
|
|
150
|
+
OrderListPresentation,
|
|
151
|
+
OrderDetailPresentation,
|
|
152
|
+
CheckoutPresentation
|
|
153
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// src/order/order.enum.ts
|
|
2
|
+
import { defineEnum } from "@contractspec/lib.schema";
|
|
3
|
+
var OrderStatusEnum = defineEnum("OrderStatus", [
|
|
4
|
+
"PENDING",
|
|
5
|
+
"PAID",
|
|
6
|
+
"PROCESSING",
|
|
7
|
+
"SHIPPED",
|
|
8
|
+
"DELIVERED",
|
|
9
|
+
"COMPLETED",
|
|
10
|
+
"CANCELLED",
|
|
11
|
+
"REFUNDED",
|
|
12
|
+
"PARTIALLY_REFUNDED",
|
|
13
|
+
"DISPUTED"
|
|
14
|
+
]);
|
|
15
|
+
|
|
16
|
+
// src/order/order.schema.ts
|
|
17
|
+
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
18
|
+
var OrderItemModel = defineSchemaModel({
|
|
19
|
+
name: "OrderItemModel",
|
|
20
|
+
fields: {
|
|
21
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
22
|
+
productId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
23
|
+
productName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
24
|
+
unitPrice: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
25
|
+
quantity: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
26
|
+
subtotal: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false }
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
var OrderModel = defineSchemaModel({
|
|
30
|
+
name: "OrderModel",
|
|
31
|
+
description: "An order",
|
|
32
|
+
fields: {
|
|
33
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
34
|
+
orderNumber: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
35
|
+
buyerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
36
|
+
storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
37
|
+
status: { type: OrderStatusEnum, isOptional: false },
|
|
38
|
+
subtotal: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
39
|
+
shippingTotal: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
40
|
+
taxTotal: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
41
|
+
total: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
42
|
+
currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
43
|
+
items: { type: OrderItemModel, isArray: true, isOptional: true },
|
|
44
|
+
createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
var CreateOrderInputModel = defineSchemaModel({
|
|
48
|
+
name: "CreateOrderInput",
|
|
49
|
+
fields: {
|
|
50
|
+
storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
51
|
+
items: {
|
|
52
|
+
type: ScalarTypeEnum.JSON(),
|
|
53
|
+
isOptional: false,
|
|
54
|
+
description: "Array of {productId, variantId?, quantity}"
|
|
55
|
+
},
|
|
56
|
+
shippingAddress: { type: ScalarTypeEnum.JSON(), isOptional: true },
|
|
57
|
+
billingAddress: { type: ScalarTypeEnum.JSON(), isOptional: true },
|
|
58
|
+
buyerNote: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
var UpdateOrderStatusInputModel = defineSchemaModel({
|
|
62
|
+
name: "UpdateOrderStatusInput",
|
|
63
|
+
fields: {
|
|
64
|
+
orderId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
65
|
+
status: { type: OrderStatusEnum, isOptional: false },
|
|
66
|
+
trackingNumber: {
|
|
67
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
68
|
+
isOptional: true
|
|
69
|
+
},
|
|
70
|
+
trackingUrl: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
71
|
+
note: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
export {
|
|
75
|
+
UpdateOrderStatusInputModel,
|
|
76
|
+
OrderModel,
|
|
77
|
+
OrderItemModel,
|
|
78
|
+
CreateOrderInputModel
|
|
79
|
+
};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
// src/payout/payout.enum.ts
|
|
2
|
+
import { defineEnum } from "@contractspec/lib.schema";
|
|
3
|
+
var PayoutStatusEnum = defineEnum("PayoutStatus", [
|
|
4
|
+
"PENDING",
|
|
5
|
+
"PROCESSING",
|
|
6
|
+
"PAID",
|
|
7
|
+
"FAILED",
|
|
8
|
+
"CANCELLED"
|
|
9
|
+
]);
|
|
10
|
+
|
|
11
|
+
// src/payout/payout.schema.ts
|
|
12
|
+
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
13
|
+
var PayoutModel = defineSchemaModel({
|
|
14
|
+
name: "PayoutModel",
|
|
15
|
+
description: "A payout to seller",
|
|
16
|
+
fields: {
|
|
17
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
18
|
+
payoutNumber: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
19
|
+
storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
20
|
+
status: { type: PayoutStatusEnum, isOptional: false },
|
|
21
|
+
grossAmount: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
22
|
+
platformFees: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
23
|
+
netAmount: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
24
|
+
currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
25
|
+
periodStart: { type: ScalarTypeEnum.DateTime(), isOptional: false },
|
|
26
|
+
periodEnd: { type: ScalarTypeEnum.DateTime(), isOptional: false },
|
|
27
|
+
orderCount: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
28
|
+
createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
|
|
29
|
+
paidAt: { type: ScalarTypeEnum.DateTime(), isOptional: true }
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
var ListPayoutsInputModel = defineSchemaModel({
|
|
33
|
+
name: "ListPayoutsInput",
|
|
34
|
+
fields: {
|
|
35
|
+
storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
36
|
+
status: { type: PayoutStatusEnum, isOptional: true },
|
|
37
|
+
limit: {
|
|
38
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
39
|
+
isOptional: true,
|
|
40
|
+
defaultValue: 20
|
|
41
|
+
},
|
|
42
|
+
offset: {
|
|
43
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
44
|
+
isOptional: true,
|
|
45
|
+
defaultValue: 0
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
var ListPayoutsOutputModel = defineSchemaModel({
|
|
50
|
+
name: "ListPayoutsOutput",
|
|
51
|
+
fields: {
|
|
52
|
+
payouts: { type: PayoutModel, isArray: true, isOptional: false },
|
|
53
|
+
total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
54
|
+
totalPending: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false }
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// src/payout/payout.operations.ts
|
|
59
|
+
import { defineQuery } from "@contractspec/lib.contracts/operations";
|
|
60
|
+
var OWNERS = ["@example.marketplace"];
|
|
61
|
+
var ListPayoutsContract = defineQuery({
|
|
62
|
+
meta: {
|
|
63
|
+
key: "marketplace.payout.list",
|
|
64
|
+
version: "1.0.0",
|
|
65
|
+
stability: "stable",
|
|
66
|
+
owners: [...OWNERS],
|
|
67
|
+
tags: ["marketplace", "payout", "list"],
|
|
68
|
+
description: "List payouts for a store.",
|
|
69
|
+
goal: "View payout history.",
|
|
70
|
+
context: "Seller dashboard."
|
|
71
|
+
},
|
|
72
|
+
io: { input: ListPayoutsInputModel, output: ListPayoutsOutputModel },
|
|
73
|
+
policy: { auth: "user" },
|
|
74
|
+
acceptance: {
|
|
75
|
+
scenarios: [
|
|
76
|
+
{
|
|
77
|
+
key: "list-payouts-happy-path",
|
|
78
|
+
given: ["Store has payout history"],
|
|
79
|
+
when: ["Seller lists payouts"],
|
|
80
|
+
then: ["List of payouts is returned"]
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
examples: [
|
|
84
|
+
{
|
|
85
|
+
key: "list-recent",
|
|
86
|
+
input: { limit: 10, offset: 0 },
|
|
87
|
+
output: { items: [], total: 5, hasMore: false }
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
// src/payout/payout.event.ts
|
|
94
|
+
import { ScalarTypeEnum as ScalarTypeEnum2, defineSchemaModel as defineSchemaModel2 } from "@contractspec/lib.schema";
|
|
95
|
+
import { defineEvent } from "@contractspec/lib.contracts";
|
|
96
|
+
var PayoutCreatedPayload = defineSchemaModel2({
|
|
97
|
+
name: "PayoutCreatedEventPayload",
|
|
98
|
+
fields: {
|
|
99
|
+
payoutId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
100
|
+
payoutNumber: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
101
|
+
storeId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
102
|
+
netAmount: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false },
|
|
103
|
+
currency: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
104
|
+
orderCount: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
|
|
105
|
+
timestamp: { type: ScalarTypeEnum2.DateTime(), isOptional: false }
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
var PayoutPaidPayload = defineSchemaModel2({
|
|
109
|
+
name: "PayoutPaidEventPayload",
|
|
110
|
+
fields: {
|
|
111
|
+
payoutId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
112
|
+
payoutNumber: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
113
|
+
storeId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
114
|
+
netAmount: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false },
|
|
115
|
+
paymentReference: {
|
|
116
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
117
|
+
isOptional: true
|
|
118
|
+
},
|
|
119
|
+
timestamp: { type: ScalarTypeEnum2.DateTime(), isOptional: false }
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
var PayoutCreatedEvent = defineEvent({
|
|
123
|
+
meta: {
|
|
124
|
+
key: "marketplace.payout.created",
|
|
125
|
+
version: "1.0.0",
|
|
126
|
+
description: "A payout has been created.",
|
|
127
|
+
stability: "experimental",
|
|
128
|
+
owners: ["@marketplace-team"],
|
|
129
|
+
tags: ["marketplace", "payout"]
|
|
130
|
+
},
|
|
131
|
+
payload: PayoutCreatedPayload
|
|
132
|
+
});
|
|
133
|
+
var PayoutPaidEvent = defineEvent({
|
|
134
|
+
meta: {
|
|
135
|
+
key: "marketplace.payout.paid",
|
|
136
|
+
version: "1.0.0",
|
|
137
|
+
description: "A payout has been sent.",
|
|
138
|
+
stability: "experimental",
|
|
139
|
+
owners: ["@marketplace-team"],
|
|
140
|
+
tags: ["marketplace", "payout"]
|
|
141
|
+
},
|
|
142
|
+
payload: PayoutPaidPayload
|
|
143
|
+
});
|
|
144
|
+
export {
|
|
145
|
+
PayoutStatusEnum,
|
|
146
|
+
PayoutPaidEvent,
|
|
147
|
+
PayoutModel,
|
|
148
|
+
PayoutCreatedEvent,
|
|
149
|
+
ListPayoutsOutputModel,
|
|
150
|
+
ListPayoutsInputModel,
|
|
151
|
+
ListPayoutsContract
|
|
152
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// src/payout/payout.event.ts
|
|
2
|
+
import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
|
|
3
|
+
import { defineEvent } from "@contractspec/lib.contracts";
|
|
4
|
+
var PayoutCreatedPayload = defineSchemaModel({
|
|
5
|
+
name: "PayoutCreatedEventPayload",
|
|
6
|
+
fields: {
|
|
7
|
+
payoutId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
8
|
+
payoutNumber: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
9
|
+
storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
10
|
+
netAmount: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
11
|
+
currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
12
|
+
orderCount: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
13
|
+
timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
var PayoutPaidPayload = defineSchemaModel({
|
|
17
|
+
name: "PayoutPaidEventPayload",
|
|
18
|
+
fields: {
|
|
19
|
+
payoutId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
20
|
+
payoutNumber: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
21
|
+
storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
22
|
+
netAmount: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
23
|
+
paymentReference: {
|
|
24
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
25
|
+
isOptional: true
|
|
26
|
+
},
|
|
27
|
+
timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
var PayoutCreatedEvent = defineEvent({
|
|
31
|
+
meta: {
|
|
32
|
+
key: "marketplace.payout.created",
|
|
33
|
+
version: "1.0.0",
|
|
34
|
+
description: "A payout has been created.",
|
|
35
|
+
stability: "experimental",
|
|
36
|
+
owners: ["@marketplace-team"],
|
|
37
|
+
tags: ["marketplace", "payout"]
|
|
38
|
+
},
|
|
39
|
+
payload: PayoutCreatedPayload
|
|
40
|
+
});
|
|
41
|
+
var PayoutPaidEvent = defineEvent({
|
|
42
|
+
meta: {
|
|
43
|
+
key: "marketplace.payout.paid",
|
|
44
|
+
version: "1.0.0",
|
|
45
|
+
description: "A payout has been sent.",
|
|
46
|
+
stability: "experimental",
|
|
47
|
+
owners: ["@marketplace-team"],
|
|
48
|
+
tags: ["marketplace", "payout"]
|
|
49
|
+
},
|
|
50
|
+
payload: PayoutPaidPayload
|
|
51
|
+
});
|
|
52
|
+
export {
|
|
53
|
+
PayoutPaidEvent,
|
|
54
|
+
PayoutCreatedEvent
|
|
55
|
+
};
|