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
26 lines
610 B
Go
26 lines
610 B
Go
package discount
|
|
|
|
import (
|
|
"math/rand"
|
|
"time"
|
|
|
|
"github.com/hanzoai/commerce/datastore"
|
|
"github.com/hanzoai/commerce/models/discount/scope"
|
|
"github.com/hanzoai/commerce/models/discount/target"
|
|
"github.com/hanzoai/commerce/util/fake"
|
|
)
|
|
|
|
func Fake(db *datastore.Datastore) *Discount {
|
|
d := New(db)
|
|
d.Name = fake.Word()
|
|
|
|
d.StartDate = time.Date(rand.Intn(25)+2000, time.Month(rand.Intn(12)+1), rand.Intn(25)+1, 0, 0, 0, 0, time.UTC)
|
|
d.EndDate = d.StartDate.AddDate(0, 0, rand.Intn(30))
|
|
d.Type = FreeShipping
|
|
|
|
d.Scope = Scope{Type: scope.Organization}
|
|
d.Target = Target{Type: target.Cart}
|
|
|
|
return d
|
|
}
|