Add isDM flag to Client and update FiscalRequest structure for DM support

This commit is contained in:
2026-01-16 02:41:11 +03:00
parent 861a1640d4
commit f23c4ffd1c
3 changed files with 15 additions and 6 deletions

View File

@@ -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,
},
}