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
69 lines
1.4 KiB
Go
69 lines
1.4 KiB
Go
package tokentransaction
|
|
|
|
import (
|
|
"github.com/hanzoai/commerce/models/mixin"
|
|
"github.com/hanzoai/commerce/util/search"
|
|
)
|
|
|
|
type Document struct {
|
|
mixin.DocumentSaveLoad `datastore:"-" json:"-"`
|
|
|
|
// Special Kind Facet
|
|
Kind search.Atom `search:",facet"`
|
|
|
|
Id_ string
|
|
|
|
CreatedAt float64
|
|
UpdatedAt float64
|
|
|
|
Timestamp float64
|
|
|
|
SendingAddress string
|
|
SendingUserId string
|
|
SendingName string
|
|
SendingState string
|
|
SendingCountry string
|
|
ReceivingAddress string
|
|
ReceivingUserId string
|
|
ReceivingName string
|
|
ReceivingState string
|
|
ReceivingCountry string
|
|
Protocol string
|
|
TransactionHash string
|
|
}
|
|
|
|
func (d Document) Id() string {
|
|
return string(d.Id_)
|
|
}
|
|
|
|
func (d *Document) Init() {
|
|
d.SetDocument(d)
|
|
}
|
|
|
|
func (t Transaction) Document() mixin.Document {
|
|
|
|
doc := &Document{}
|
|
doc.Init()
|
|
doc.Kind = search.Atom(kind)
|
|
doc.Id_ = t.Id()
|
|
|
|
doc.CreatedAt = float64(t.CreatedAt.Unix())
|
|
doc.UpdatedAt = float64(t.UpdatedAt.Unix())
|
|
doc.Timestamp = float64(t.Timestamp.Unix())
|
|
|
|
doc.SendingAddress = t.SendingAddress
|
|
doc.SendingUserId = t.SendingUserId
|
|
doc.SendingName = t.SendingName
|
|
doc.SendingState = t.SendingState
|
|
doc.SendingCountry = t.SendingCountry
|
|
doc.ReceivingAddress = t.ReceivingAddress
|
|
doc.ReceivingUserId = t.ReceivingUserId
|
|
doc.ReceivingName = t.ReceivingName
|
|
doc.ReceivingState = t.ReceivingState
|
|
doc.ReceivingCountry = t.ReceivingCountry
|
|
doc.Protocol = t.Protocol
|
|
doc.TransactionHash = t.TransactionHash
|
|
|
|
return doc
|
|
}
|