Add payout req parsing
This commit is contained in:
@@ -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"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user