payment_method_config.go 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package dao
  2. import "wails-app/internal/global"
  3. // PaymentEntryConfig describes where a payment is initiated.
  4. type PaymentEntryConfig struct {
  5. global.GVA_MODEL
  6. Code string `gorm:"size:32;not null;uniqueIndex" json:"code"`
  7. Name string `gorm:"size:50;not null" json:"name"`
  8. Enabled bool `gorm:"not null;default:false" json:"enabled"`
  9. Sort int `gorm:"not null;default:0" json:"sort"`
  10. IsSystem bool `gorm:"not null;default:false" json:"is_system"`
  11. Description string `gorm:"size:200" json:"description"`
  12. MethodCodes []string `gorm:"-" json:"method_codes"`
  13. }
  14. func (PaymentEntryConfig) TableName() string {
  15. return "payment_entry_config"
  16. }
  17. // PaymentEntryMethod links a payment entry to the payment methods it accepts.
  18. type PaymentEntryMethod struct {
  19. global.GVA_MODEL
  20. EntryCode string `gorm:"size:32;not null;uniqueIndex:idx_payment_entry_method" json:"entry_code"`
  21. MethodCode string `gorm:"size:32;not null;uniqueIndex:idx_payment_entry_method" json:"method_code"`
  22. Sort int `gorm:"not null;default:0" json:"sort"`
  23. }
  24. func (PaymentEntryMethod) TableName() string {
  25. return "payment_entry_method"
  26. }
  27. // PaymentMethodConfig describes how money is settled. It is deliberately
  28. // independent from the entry that initiated the payment.
  29. type PaymentMethodConfig struct {
  30. global.GVA_MODEL
  31. Code string `gorm:"size:32;not null;uniqueIndex" json:"code"`
  32. Name string `gorm:"size:50;not null" json:"name"`
  33. InputMode string `gorm:"size:24;not null" json:"input_mode"`
  34. Enabled bool `gorm:"not null;default:false" json:"enabled"`
  35. Sort int `gorm:"not null;default:0" json:"sort"`
  36. IsSystem bool `gorm:"not null;default:false" json:"is_system"`
  37. IsLegacy bool `gorm:"not null;default:false" json:"is_legacy"`
  38. Description string `gorm:"size:200" json:"description"`
  39. EntryCodes []string `gorm:"-" json:"entry_codes"`
  40. // Scenes is kept only to read the pre-split schema during startup upgrade.
  41. Scenes []string `gorm:"serializer:json;type:text;column:scenes" json:"-"`
  42. }
  43. func (PaymentMethodConfig) TableName() string {
  44. return "payment_method_config"
  45. }