39 lines
708 B
Go
39 lines
708 B
Go
package purchase
|
|
|
|
import (
|
|
"encoding/json"
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
//go:generate stringer -type=PurchaseStatus
|
|
type PurchaseStatus int
|
|
|
|
const (
|
|
PurchaseStatusPending PurchaseStatus = iota
|
|
PurchaseStatusCompleted
|
|
PurchaseStatusFailed
|
|
PurchaseStatusRefunded
|
|
)
|
|
|
|
type PurchasedAsset struct {
|
|
ID uuid.UUID
|
|
UserID uuid.UUID
|
|
Asset PurchasedAssetInfo
|
|
PurchaseDate time.Time
|
|
PurchasePrice int // in cents or smallest currency unit
|
|
PurchaseCurrency string
|
|
PurchaseStatus PurchaseStatus
|
|
PurchaseReceipt string
|
|
}
|
|
|
|
type PurchasedAssetInfo struct {
|
|
ID uuid.UUID
|
|
Name string
|
|
Description string
|
|
RestOfFields json.RawMessage
|
|
}
|
|
|
|
|