central_payment_device.go 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package dao
  2. import (
  3. "time"
  4. "wails-app/internal/global"
  5. )
  6. // CentralPaymentDevice is an independently authenticated POF payment device.
  7. // It deliberately does not share credentials with a Smart Parking web user.
  8. type CentralPaymentDevice struct {
  9. global.GVA_MODEL
  10. DeviceID string `gorm:"size:64;not null;uniqueIndex" json:"device_id"`
  11. Username string `gorm:"size:64;not null;uniqueIndex" json:"username"`
  12. PasswordHash string `gorm:"size:100;not null" json:"-"`
  13. Enabled bool `gorm:"not null;default:true" json:"enabled"`
  14. ParkingLotID uint `json:"parking_lot_id"`
  15. PaymentEntry string `gorm:"size:32;not null" json:"payment_entry"`
  16. AllowedIPs string `gorm:"size:500" json:"allowed_ips"`
  17. Description string `gorm:"size:200" json:"description"`
  18. }
  19. func (CentralPaymentDevice) TableName() string { return "central_payment_device" }
  20. // CentralPaymentToken keeps only a SHA-256 digest of an issued device token.
  21. type CentralPaymentToken struct {
  22. global.GVA_MODEL
  23. DeviceID string `gorm:"size:64;not null;index" json:"device_id"`
  24. TokenHash string `gorm:"size:64;not null;uniqueIndex" json:"-"`
  25. ExpireAt time.Time `gorm:"not null;index" json:"expire_at"`
  26. }
  27. func (CentralPaymentToken) TableName() string { return "central_payment_token" }
  28. // CentralPaymentRequestLog records POF requests for field verification and
  29. // reconciliation. Token values are intentionally excluded from RequestBody.
  30. type CentralPaymentRequestLog struct {
  31. global.GVA_MODEL
  32. Endpoint string `gorm:"size:64;not null;index" json:"endpoint"`
  33. DeviceID string `gorm:"size:64;index" json:"device_id"`
  34. SourceIP string `gorm:"size:64;index" json:"source_ip"`
  35. RequestBody string `gorm:"type:text" json:"request_body"`
  36. Result int `json:"result"`
  37. Remark string `gorm:"size:500" json:"remark"`
  38. }
  39. func (CentralPaymentRequestLog) TableName() string { return "central_payment_request_log" }