@happyvertical/smrt-commerce 0.51.31 → 0.51.33
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/__tests__/foreign-key-fixtures.d.ts +13 -0
- package/dist/__tests__/foreign-key-fixtures.d.ts.map +1 -0
- package/dist/__tests__/helpers/anchor-fixture.d.ts +36 -0
- package/dist/__tests__/helpers/anchor-fixture.d.ts.map +1 -0
- package/dist/__tests__/helpers/billing-fixture.d.ts +51 -0
- package/dist/__tests__/helpers/billing-fixture.d.ts.map +1 -0
- package/dist/__tests__/helpers/consumer-license-sale.d.ts +13 -0
- package/dist/__tests__/helpers/consumer-license-sale.d.ts.map +1 -0
- package/dist/__tests__/helpers/fake-stripe.d.ts +146 -0
- package/dist/__tests__/helpers/fake-stripe.d.ts.map +1 -0
- package/dist/billing/cards.d.ts +14 -4
- package/dist/billing/credits.d.ts +2 -2
- package/dist/billing/cycles.d.ts +21 -1
- package/dist/billing/events.d.ts +14 -4
- package/dist/billing/jobs.d.ts +3 -3
- package/dist/billing/period-close.d.ts +1 -1
- package/dist/billing/provider.d.ts +12 -2
- package/dist/billing/runtime.d.ts +17 -12
- package/dist/billing/stripe.d.ts +11 -2
- package/dist/billing/top-up.d.ts +4 -4
- package/dist/collections/ContractCollection.d.ts +4 -0
- package/dist/collections/ContractLineItemCollection.d.ts +4 -0
- package/dist/collections/CustomerCollection.d.ts +4 -0
- package/dist/collections/FulfillmentCollection.d.ts +5 -1
- package/dist/collections/FulfillmentLineItemCollection.d.ts +4 -0
- package/dist/collections/InvoiceCollection.d.ts +4 -0
- package/dist/collections/InvoiceLineItemCollection.d.ts +5 -1
- package/dist/collections/PaymentAllocationCollection.d.ts +4 -0
- package/dist/collections/PaymentCollection.d.ts +5 -1
- package/dist/collections/PaymentInstrumentCollection.d.ts +4 -0
- package/dist/collections/PaymentIntentCollection.d.ts +12 -1
- package/dist/collections/PayoutCollection.d.ts +12 -1
- package/dist/collections/VendorCollection.d.ts +4 -0
- package/dist/index.d.ts +63 -0
- package/dist/index.js +1 -1
- package/dist/manifest.json +1 -1
- package/dist/migrations/moneyMinorUnits.d.ts +61 -1
- package/dist/models/Contract.d.ts +6 -2
- package/dist/models/ContractLineItem.d.ts +5 -1
- package/dist/models/Customer.d.ts +5 -1
- package/dist/models/Fulfillment.d.ts +5 -1
- package/dist/models/FulfillmentLineItem.d.ts +5 -1
- package/dist/models/Invoice.d.ts +6 -2
- package/dist/models/InvoiceLineItem.d.ts +5 -1
- package/dist/models/Payment.d.ts +6 -2
- package/dist/models/PaymentAllocation.d.ts +5 -1
- package/dist/models/PaymentInstrument.d.ts +5 -1
- package/dist/models/PaymentIntent.d.ts +24 -1
- package/dist/models/Payout.d.ts +24 -1
- package/dist/models/Vendor.d.ts +5 -1
- package/dist/models/billing.d.ts +8 -1
- package/dist/smrt-knowledge.json +4 -4
- package/dist/types/index.d.ts +5 -1
- package/dist/ui.d.ts +14 -1
- package/package.json +10 -10
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @happyvertical/smrt-commerce
|
|
3
|
+
*
|
|
4
|
+
* Commerce models for the SMRT framework - contracts, fulfillments, payments.
|
|
5
|
+
*
|
|
6
|
+
* Key concepts:
|
|
7
|
+
* - Customer/Vendor link to Profile (from smrt-profiles)
|
|
8
|
+
* - Contract uses STI for different types (Estimate, Order, Lease, etc.)
|
|
9
|
+
* - Payment integrates with smrt-ledgers for journal entries
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import {
|
|
14
|
+
* Customer,
|
|
15
|
+
* CustomerCollection,
|
|
16
|
+
* Order,
|
|
17
|
+
* ContractCollection,
|
|
18
|
+
* Payment,
|
|
19
|
+
* PaymentCollection,
|
|
20
|
+
* } from '@happyvertical/smrt-commerce';
|
|
21
|
+
*
|
|
22
|
+
* // Create collections
|
|
23
|
+
* const customers = await CustomerCollection.create({
|
|
24
|
+
* persistence: { type: 'sql', url: 'commerce.db' }
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* // Create a customer linked to a profile
|
|
28
|
+
* // Every money value is integer minor units — $100.00 is 10000 (#2401).
|
|
29
|
+
* const customer = await customers.create({
|
|
30
|
+
* profileId: 'profile-uuid',
|
|
31
|
+
* creditLimit: 1000000, // $10,000.00
|
|
32
|
+
* paymentTerms: 'Net 30'
|
|
33
|
+
* });
|
|
34
|
+
* await customer.save();
|
|
35
|
+
*
|
|
36
|
+
* // Create an order
|
|
37
|
+
* const contracts = await ContractCollection.create(customer.options);
|
|
38
|
+
* const order = await contracts.create({
|
|
39
|
+
* _meta_type: 'Order',
|
|
40
|
+
* customerId: customer.id,
|
|
41
|
+
* totalAmount: 150000 // $1,500.00
|
|
42
|
+
* });
|
|
43
|
+
* await order.save();
|
|
44
|
+
*
|
|
45
|
+
* // Record payment with ledger integration
|
|
46
|
+
* const payments = await PaymentCollection.create(order.options);
|
|
47
|
+
* const payment = await payments.create({
|
|
48
|
+
* contractId: order.id,
|
|
49
|
+
* customerId: customer.id,
|
|
50
|
+
* amount: 150000
|
|
51
|
+
* });
|
|
52
|
+
* await payment.save();
|
|
53
|
+
*
|
|
54
|
+
* await payment.recordPayment({
|
|
55
|
+
* ledgerId: ledger.id,
|
|
56
|
+
* receivablesAccountId: arAccount.id,
|
|
57
|
+
* cashAccountId: bankAccount.id
|
|
58
|
+
* });
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* @packageDocumentation
|
|
62
|
+
*/
|
|
63
|
+
import './__smrt-register__.js';
|
|
1
64
|
export * from './billing/index.js';
|
|
2
65
|
export { ContractCollection, ContractLineItemCollection, type CreatePayoutFromPaymentArgs, CustomerCollection, FulfillmentCollection, FulfillmentLineItemCollection, InvoiceCollection, InvoiceLineItemCollection, type InvoiceNumberOptions, PaymentAllocationCollection, PaymentCollection, PaymentInstrumentCollection, PaymentIntentCollection, type PaymentIntentIdempotencyArgs, type PaymentIntentSeed, PayoutCollection, UNPAID_STATUSES, VendorCollection, } from './collections/index.js';
|
|
3
66
|
export { COMMERCE_MONEY_COLUMNS, COMMERCE_MONEY_MINOR_UNITS_BACKFILL, COMMERCE_NATIVE_UNIT_COLUMNS, migrateCommerceMoneyToMinorUnits, preflightCommerceMoneyMinorUnits, } from './migrations/moneyMinorUnits.js';
|