/
transfer-money.go
45 lines (36 loc) · 943 Bytes
/
transfer-money.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package transactions
import (
"encoding/json"
"net/http"
)
type RequestForTransferMoney struct {
AccountId string `json:"-"`
To string `json:"to"`
Type TransferMoneyType `json:"type"`
Amount string `json:"amount"`
Currency string `json:"currency"`
Description string `json:"description,omitempty"`
}
type TransferMoneyType string
const (
TransferType TransferMoneyType = "transfer"
)
type ResponseForTransferMoney struct {
Data Transaction `json:"data"`
}
func (req *RequestForTransferMoney) Path() string {
return "/v2/accounts/" + req.AccountId + "/transactions"
}
func (req *RequestForTransferMoney) Method() string {
return http.MethodPost
}
func (req *RequestForTransferMoney) Query() string {
return ""
}
func (req *RequestForTransferMoney) Payload() []byte {
b, err := json.Marshal(req)
if err != nil {
return nil
}
return b
}