@happyvertical/smrt-commerce 0.40.13 → 0.40.15
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 +10 -5
- package/dist/index.js +1 -1
- package/dist/manifest.json +2 -2
- package/dist/smrt-knowledge.json +4 -4
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @happyvertical/smrt-commerce
|
|
2
2
|
|
|
3
|
-
Commerce models for the
|
|
3
|
+
Commerce models for the s-m-r-t framework. Covers customers, vendors, contracts (5 STI types), invoices with ledger integration, payments, and fulfillment tracking.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
} from '@happyvertical/smrt-commerce';
|
|
21
21
|
|
|
22
22
|
// Create a customer linked to a profile
|
|
23
|
-
const customers =
|
|
23
|
+
const customers = await CustomerCollection.create({ db });
|
|
24
24
|
const customer = await customers.create({
|
|
25
25
|
profileId: 'profile-uuid',
|
|
26
26
|
creditLimit: 10000.00,
|
|
@@ -29,7 +29,7 @@ const customer = await customers.create({
|
|
|
29
29
|
await customer.save();
|
|
30
30
|
|
|
31
31
|
// Create an order (STI contract type)
|
|
32
|
-
const contracts =
|
|
32
|
+
const contracts = await ContractCollection.create({ db });
|
|
33
33
|
const order = await contracts.create({
|
|
34
34
|
_meta_type: 'Order',
|
|
35
35
|
customerId: customer.id,
|
|
@@ -41,7 +41,7 @@ const order = await contracts.create({
|
|
|
41
41
|
await order.save();
|
|
42
42
|
|
|
43
43
|
// Create an invoice for the order
|
|
44
|
-
const invoices =
|
|
44
|
+
const invoices = await InvoiceCollection.create({ db });
|
|
45
45
|
const invoiceNumber = await invoices.generateInvoiceNumber();
|
|
46
46
|
const invoice = await invoices.create({
|
|
47
47
|
customerId: customer.id,
|
|
@@ -61,7 +61,7 @@ await invoice.recognizeRevenue({
|
|
|
61
61
|
});
|
|
62
62
|
|
|
63
63
|
// Record a payment
|
|
64
|
-
const payments =
|
|
64
|
+
const payments = await PaymentCollection.create({ db });
|
|
65
65
|
const payment = await payments.create({
|
|
66
66
|
contractId: order.id,
|
|
67
67
|
customerId: customer.id,
|
|
@@ -144,3 +144,8 @@ Customer and Vendor link to `@happyvertical/smrt-profiles` via plain `profileId`
|
|
|
144
144
|
- `@happyvertical/smrt-tenancy` -- multi-tenant scoping
|
|
145
145
|
- `@happyvertical/smrt-types` -- shared type definitions
|
|
146
146
|
- Peer: `@happyvertical/smrt-ledgers`, `@happyvertical/smrt-profiles`, `@happyvertical/smrt-svelte`
|
|
147
|
+
|
|
148
|
+
## Contributor guide
|
|
149
|
+
|
|
150
|
+
See [`AGENTS.md`](./AGENTS.md) for package architecture, invariants, validation,
|
|
151
|
+
and contributor guidance.
|