-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathapi_merchant.go
62 lines (49 loc) · 1.41 KB
/
api_merchant.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
55
56
57
58
59
60
61
62
package sdk
import (
"errors"
"fmt"
)
// ResponseMerchantItem :
type ResponseMerchantItem struct {
Item Merchant `json:"item"`
Code string `json:"code"`
Err *Error `json:"error"`
}
// ResponseMerchantSubscriptions :
type ResponseMerchantSubscriptions struct {
Item []MerchantSubscription `json:"item"`
Code string `json:"code"`
Err *Error `json:"error"`
}
// GetMerchantProfile :
func (c Client) GetMerchantProfile() (*ResponseMerchantItem, error) {
if c.err != nil {
return nil, c.err
}
method := pathAPIGetMerchantURL.method
requestURL := c.prepareAPIURL(pathAPIGetMerchantURL)
response := new(ResponseMerchantItem)
if err := c.httpAPI(method, fmt.Sprintf("%s", requestURL), nil, response); err != nil {
return nil, err
}
if response.Err != nil {
return response, errors.New(response.Err.Message)
}
return response, nil
}
// GetMerchantSubscriptions :
func (c Client) GetMerchantSubscriptions() (*ResponseMerchantSubscriptions, error) {
if c.err != nil {
return nil, c.err
}
method := pathAPIGetMerchantSubscriptionsURL.method
requestURL := c.prepareAPIURL(pathAPIGetMerchantSubscriptionsURL)
response := new(ResponseMerchantSubscriptions)
if err := c.httpAPI(method, fmt.Sprintf("%s", requestURL), nil, response); err != nil {
return nil, err
}
if response.Err != nil {
return response, errors.New(response.Err.Message)
}
return response, nil
}