Compare commits
3 Commits
v0.0.4fixA
...
v0.0.9
| Author | SHA1 | Date | |
|---|---|---|---|
| 4a8b5cf0c5 | |||
| b33620f629 | |||
| 8006fd0935 |
@@ -8,10 +8,17 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (c *Client) executeRequest(ctx context.Context, request FiscalRequest, response interface{}) error {
|
func (c *Client) executeRequest(ctx context.Context, request FiscalRequest, response interface{}) error {
|
||||||
|
//execute request with json body in request
|
||||||
|
reqJson, err := json.Marshal(request)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to marshal request: %w", err)
|
||||||
|
}
|
||||||
|
fmt.Println(string(reqJson))
|
||||||
|
|
||||||
resp, err := c.resty.R().
|
resp, err := c.resty.R().
|
||||||
SetContext(ctx).
|
SetContext(ctx).
|
||||||
SetHeader("Authorization", c.token).
|
SetHeader("Authorization", c.token).
|
||||||
SetBody(request).
|
SetBody(reqJson).
|
||||||
Post(c.apiBaseURL + "/fiscal/execute")
|
Post(c.apiBaseURL + "/fiscal/execute")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -95,6 +102,12 @@ func (c *Client) Sell(ctx context.Context, params SellParams) (*SellResponse, er
|
|||||||
request.Userinfo = *params.Userinfo
|
request.Userinfo = *params.Userinfo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reqJson, err := json.Marshal(request)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
fmt.Println(string(reqJson))
|
||||||
|
|
||||||
var response SellResponse
|
var response SellResponse
|
||||||
if err := c.executeRequest(ctx, request, &response); err != nil {
|
if err := c.executeRequest(ctx, request, &response); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
Reference in New Issue
Block a user