mirror of
https://github.com/hanzoai/commerce.git
synced 2026-10-30 15:08:42 +00:00
Multi-tenant commerce and billing: orders, subscriptions, invoices, plans, usage metering and a credit ledger. One Go binary. MIT OR Apache-2.0. Claude-Session: https://claude.ai/code/session_01SAtaDFm8VDiWrhYHNNtxMw
59 lines
1.1 KiB
Go
59 lines
1.1 KiB
Go
package fixtures
|
||
|
||
import (
|
||
"github.com/zap-proto/zip"
|
||
|
||
"github.com/hanzoai/commerce/models/product"
|
||
"github.com/hanzoai/commerce/models/types/currency"
|
||
)
|
||
|
||
var Product = New("product", func(c *zip.Ctx) *product.Product {
|
||
// Get namespaced db
|
||
db := getNamespaceDb(c)
|
||
|
||
// Doge shirt
|
||
prod := product.New(db)
|
||
prod.Slug = "doge-shirt"
|
||
prod.GetOrCreate("Slug=", prod.Slug)
|
||
prod.Name = "Such T-shirt"
|
||
prod.Headline = "wow such shirt much tee"
|
||
prod.Description = `wow
|
||
such shirt
|
||
much tee
|
||
|
||
nice shop
|
||
|
||
so hip
|
||
|
||
so doge
|
||
`
|
||
prod.Options = []*product.Option{
|
||
&product.Option{
|
||
Name: "Size",
|
||
Values: []string{"Much", "Wow"},
|
||
},
|
||
}
|
||
prod.Price = 2000
|
||
prod.Currency = currency.USD
|
||
prod.MustPut()
|
||
|
||
// Sad Keanu shirt
|
||
prod = product.New(db)
|
||
prod.Slug = "sad-keanu-shirt"
|
||
prod.GetOrCreate("Slug=", prod.Slug)
|
||
prod.Name = "Sad Keanu T-shirt"
|
||
prod.Headline = "Oh Keanu"
|
||
prod.Description = "Sad Keanu is sad."
|
||
prod.Options = []*product.Option{
|
||
&product.Option{
|
||
Name: "Size",
|
||
Values: []string{"Sadness"},
|
||
},
|
||
}
|
||
prod.Price = 2500
|
||
prod.Currency = currency.USD
|
||
prod.MustPut()
|
||
|
||
return prod
|
||
})
|