Reorganaze modules, add auth processing.

This commit is contained in:
2026-03-13 00:07:23 +03:00
parent 95b1b867db
commit 970e64745b
14 changed files with 220 additions and 97 deletions

46
internal/models/payout.go Normal file
View File

@@ -0,0 +1,46 @@
package models
import (
"fmt"
"strings"
)
type PayoutType int64
const (
SBP PayoutType = iota
YooMoney
)
func (r PayoutType) String() string {
switch r {
case SBP:
return "spb"
case YooMoney:
return "yoo_money"
}
return "unknown"
}
func (r PayoutType) MarshalText() (text []byte, err error) {
return []byte(r.String()), nil
}
func (r *PayoutType) UnmarshalText(text []byte) (err error) {
s := strings.ToLower(string(text))
switch s {
case "spb":
*r = SBP
case "yoo_money":
*r = YooMoney
default:
err = fmt.Errorf("invalid payment type: %s", s)
}
return err
}
type PayoutReq struct {
PayoutType PayoutType `json:"payout_type"`
AccountNumber string `json:"account_number"`
Amount float32 `json:"amount"`
}