39 lines
1.1 KiB
Go
39 lines
1.1 KiB
Go
// Package customerverification lets a customer submit an identity document
|
|
// (front/back) for manual admin review, gating checkout when the admin has
|
|
// turned on site.Settings.CustomerVerificationRequired -- e.g. for
|
|
// age/ID-restricted goods. Documents are stored privately (never through
|
|
// the public media module) and served only to the admin and the owning
|
|
// customer through authenticated endpoints.
|
|
package customerverification
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
const (
|
|
StatusPending = "pending"
|
|
StatusApproved = "approved"
|
|
StatusRejected = "rejected"
|
|
)
|
|
|
|
var ValidStatuses = map[string]bool{
|
|
StatusPending: true,
|
|
StatusApproved: true,
|
|
StatusRejected: true,
|
|
}
|
|
|
|
type CustomerVerification struct {
|
|
ID uuid.UUID `gorm:"type:uuid;primaryKey"`
|
|
UserID uuid.UUID `gorm:"type:uuid;uniqueIndex;not null"`
|
|
FrontKey string `gorm:"not null"`
|
|
BackKey string `gorm:"not null"`
|
|
Status string `gorm:"not null;default:pending"`
|
|
AdminNote string `gorm:"not null;default:''"`
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
}
|
|
|
|
func (CustomerVerification) TableName() string { return "customer_verifications" }
|