-
Notifications
You must be signed in to change notification settings - Fork 0
/
balance.go
45 lines (35 loc) · 1.58 KB
/
balance.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 ebct
const balanceTrackingNumbers = DefaultEndPoint + Version + "packages/tracking-numbers/balance"
const balanceUnitsCode = DefaultEndPoint + Version + "units/unit-codes/balance"
const balance = DefaultEndPoint + Version + "balance"
type BalanceResponse struct {
MaxQuantity *int `json:"maxQuantity,omitempty"` // Postage card number used in the requisition.
RequestedQuantity *int `json:"requestedQuantity,omitempty"` // Contract number associated with the postage card used.
AvailableQuantity *int `json:"availableQuantity,omitempty"` // Correios sales team managing the contract and client.
TotalUsed *int `json:"totalUsed,omitempty"` // não tem o que é isso no layout
TotalUnused *int `json:"totalUnused,omitempty"` // não tem o que é isso no layout
}
func (n BalanceResponse) Error() string {
panic("implement me")
}
type BalanceInput struct {
CurrentBalance *float64 `json:"currentBalance,omitempty"` // Existing balance in Reais, the Brazilian currency
}
func (n BalanceInput) Error() string {
panic("implement me")
}
func (c *Client) GetBalance() (*BalanceResponse, error) {
newBalance := &BalanceResponse{}
err := c.Get(balanceTrackingNumbers, nil, nil, newBalance)
return newBalance, err
}
func (c *Client) GetUnitCodeBalance() (*BalanceResponse, error) {
newBalance := &BalanceResponse{}
err := c.Get(balanceUnitsCode, nil, nil, newBalance)
return newBalance, err
}
func (c *Client) GetBalanceInput() (*BalanceInput, error) {
newBalance := &BalanceInput{}
err := c.Get(balance, nil, nil, newBalance)
return newBalance, err
}