/
RequestPaymentByToken.go
54 lines (37 loc) · 1.16 KB
/
RequestPaymentByToken.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
46
47
48
49
50
51
52
53
54
package fondy_api
import "github.com/pkg/errors"
//easyjson:json
type PaymentByToken struct {
OrderID string `json:"order_id"`
OrderDescription string `json:"order_desc"`
Amount FondyFloat `json:"amount"`
Currency string `json:"currency"`
SenderEmail string `json:"sender_email,omitempty"`
MerchantData interface{} `json:"merchant_data,omitempty"`
LanguageCode string `json:"lang,omitempty"`
Rectoken string `json:"rectoken,omitempty"`
Lifetime FondySeconds `json:"lifetime,omitempty"`
ServerCallbackURL string `json:"server_callback_url,omitempty"`
CVV2 string `json:"cvv2,omitempty"`
ClientIP string `json:"client_ip,omitempty"`
Preauth FondyBool `json:"preauth"`
response finalResponseWrapper
}
func (r *PaymentByToken) ResponseObject() Response {
return &r.response
}
func (r PaymentByToken) URLSuffix() string {
return "recurring/"
}
func (r *PaymentByToken) PrepareData() error {
if r.OrderID == "" {
return errors.New("OrderID is required")
}
if r.OrderDescription == "" {
return errors.New("OrderDescription is required")
}
if r.Amount == 0 {
return errors.New("Amount is required")
}
return nil
}