Conditions | 4 |
Total Lines | 21 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | package afrikpay |
||
15 | func (service *accountService) Balance(ctx context.Context) (*AccountBalanceResponse, *Response, error) { |
||
16 | request, err := service.client.newRequest(ctx, http.MethodPost, "/api/account/agent/balance/v2/", map[string]string{ |
||
17 | "agentid": service.client.agentID, |
||
18 | "agentplatform": service.client.agentPlatform, |
||
19 | "hash": service.client.hash(service.client.agentID, service.client.apiKey), |
||
20 | }) |
||
21 | if err != nil { |
||
22 | return nil, nil, err |
||
23 | } |
||
24 | |||
25 | response, err := service.client.do(request) |
||
26 | if err != nil { |
||
27 | return nil, response, err |
||
28 | } |
||
29 | |||
30 | balance := new(AccountBalanceResponse) |
||
31 | if err = json.Unmarshal(*response.Body, &balance); err != nil { |
||
32 | return nil, response, err |
||
33 | } |
||
34 | |||
35 | return balance, response, nil |
||
36 | } |
||
37 |