Add payout req parsing

This commit is contained in:
2026-03-14 17:52:10 +03:00
parent 17bd6114b7
commit 35f6dc6ca0
4 changed files with 36 additions and 10 deletions

View File

@@ -8,15 +8,15 @@ import (
type PayoutType int64
const (
SBP PayoutType = iota
YooMoney
TypeSBP PayoutType = iota
TypeYooMoney
)
func (r PayoutType) String() string {
switch r {
case SBP:
case TypeSBP:
return "spb"
case YooMoney:
case TypeYooMoney:
return "yoo_money"
}
return "unknown"
@@ -30,9 +30,9 @@ func (r *PayoutType) UnmarshalText(text []byte) (err error) {
s := strings.ToLower(string(text))
switch s {
case "spb":
*r = SBP
*r = TypeSBP
case "yoo_money":
*r = YooMoney
*r = TypeYooMoney
default:
err = fmt.Errorf("invalid payment type: %s", s)
}
@@ -44,3 +44,8 @@ type PayoutReq struct {
AccountNumber string `json:"account_number"`
Amount float32 `json:"amount"`
}
type PayoutResp struct {
Success bool `json:"success"`
Reason string `json:"reason,omitempty"`
}