-
Notifications
You must be signed in to change notification settings - Fork 0
/
reseller.go
38 lines (36 loc) · 994 Bytes
/
reseller.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
package anticaptcha
// GenerateCoupons
// generate coupons for specified value and count
func (c *Client) GenerateCoupons(count int, amount float32, purchaseLink string) (*Response_GenerateCoupons, *Error) {
e := NewError()
req := &Reqest{}
if count == 0 {
e.setString("Count required")
return nil, e
}
req.Count = count
if amount == 0 {
e.setString("Amount required")
return nil, e
}
req.Amount = amount
if purchaseLink == "" {
e.setString("PurchaseLink required")
return nil, e
}
req.PurchaseLink = purchaseLink
res := &Response_GenerateCoupons{}
err := c.request(c.URL+EP_generateCoupons, req, res)
return res, err
}
// GetResellerData
// retrieve coupons list and eligible balance
func (c *Client) GetResellerData(minCreateDate int) (*Response_GetResellerData, *Error) {
req := &Reqest{}
if minCreateDate != 0 {
req.MinCreateDate = minCreateDate
}
res := &Response_GetResellerData{}
err := c.request(c.URL+EP_generateCoupons, req, res)
return res, err
}