-
Notifications
You must be signed in to change notification settings - Fork 16
/
finance.go
46 lines (41 loc) · 1.36 KB
/
finance.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
package tiktok
import "context"
const (
_SearchSettlementsPATH = "/api/finance/settlements/search"
_GetOrderSettlementsPATH = "/api/finance/order/settlements"
_SearchTransactionsPATH = "/api/finance/transactions/search"
)
// SearchSettlements search settlements. Default PageSize is 100.
func (c *Client) SearchSettlements(ctx context.Context, p Param, query SearchSettlementsRequest) (list SettlementsList, err error) {
param, err := c.params(p)
if err != nil {
return
}
if err = c.validate.Struct(query); err != nil {
return
}
err = c.Post(ctx, _SearchSettlementsPATH, param, query, &list)
return
}
// GetOrderSettlements get order settlements.
func (c *Client) GetOrderSettlements(ctx context.Context, p Param, ordersID string) (list SettlementsList, err error) {
param, err := c.params(p)
if err != nil {
return
}
param.Set("order_id", ordersID)
err = c.Get(ctx, _GetOrderSettlementsPATH, param, &list)
return
}
// SearchTransactions search your seller account's transactions within a certain timeframe. Default PageSize is 100.
func (c *Client) SearchTransactions(ctx context.Context, p Param, query SearchTransactionsRequest) (list TransactionsList, err error) {
param, err := c.params(p)
if err != nil {
return
}
if err = c.validate.Struct(query); err != nil {
return
}
err = c.Post(ctx, _SearchTransactionsPATH, param, query, &list)
return
}