Add isDM flag to Client and update FiscalRequest structure for DM support
This commit is contained in:
@@ -20,6 +20,11 @@ func (e *APIError) Error() string {
|
||||
func (c *Client) executeRequest(ctx context.Context, request FiscalRequest, response interface{}) error {
|
||||
request.Device = c.device
|
||||
|
||||
if c.isDM {
|
||||
request.Ver = 6
|
||||
request.Type = 1
|
||||
}
|
||||
|
||||
reqJson, err := json.Marshal(request)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to marshal request: %w", err)
|
||||
@@ -71,8 +76,7 @@ func (c *Client) executeRequest(ctx context.Context, request FiscalRequest, resp
|
||||
func (c *Client) OpenShift(ctx context.Context, cashier string) (*SellResponse, error) {
|
||||
request := FiscalRequest{
|
||||
Fiscal: Fiscal{
|
||||
Task: TaskOpenShift,
|
||||
Cashier: cashier,
|
||||
Task: TaskOpenShift,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -87,8 +91,7 @@ func (c *Client) OpenShift(ctx context.Context, cashier string) (*SellResponse,
|
||||
func (c *Client) CloseShift(ctx context.Context, cashier string) (*ZReportResponse, error) {
|
||||
request := FiscalRequest{
|
||||
Fiscal: Fiscal{
|
||||
Task: TaskZReport,
|
||||
Cashier: cashier,
|
||||
Task: TaskZReport,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user