From 328447f079e66fed7b930b9352086743e54897b8 Mon Sep 17 00:00:00 2001 From: jeezft Date: Mon, 13 Oct 2025 16:08:02 +0300 Subject: [PATCH] Added commentUP field to fiscalAPI --- api/fiscal.go | 13 +++++++------ api/helpers.go | 15 ++++++++------- vchasno.go | 6 ++++++ 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/api/fiscal.go b/api/fiscal.go index 8a4fc5d..d80bb96 100644 --- a/api/fiscal.go +++ b/api/fiscal.go @@ -71,15 +71,16 @@ func (c *Client) CloseShift(ctx context.Context, cashier string) (*ZReportRespon } type SellParams struct { - Cashier string - Source string - Rows []ReceiptRow - Pays []ReceiptPay - Userinfo *Userinfo + Cashier string + Source string + Rows []ReceiptRow + Pays []ReceiptPay + Userinfo *Userinfo + CommentUP string } func (c *Client) Sell(ctx context.Context, params SellParams) (*SellResponse, error) { - receipt := NewReceipt(params.Rows, params.Pays) + receipt := NewReceipt(params.Rows, params.Pays, params.CommentUP) request := FiscalRequest{ Source: params.Source, diff --git a/api/helpers.go b/api/helpers.go index b5791d5..3e4091c 100644 --- a/api/helpers.go +++ b/api/helpers.go @@ -39,13 +39,14 @@ func CalculateReceiptSum(rows []ReceiptRow) float64 { return sum } -func NewReceipt(rows []ReceiptRow, pays []ReceiptPay) Receipt { +func NewReceipt(rows []ReceiptRow, pays []ReceiptPay, commentUp string) Receipt { return Receipt{ - Sum: CalculateReceiptSum(rows), - Round: 0.00, - Disc: 0, - DiscType: 0, - Rows: rows, - Pays: pays, + Sum: CalculateReceiptSum(rows), + Round: 0.00, + CommentUp: commentUp, + Disc: 0, + DiscType: 0, + Rows: rows, + Pays: pays, } } diff --git a/vchasno.go b/vchasno.go index 8b422d8..f795709 100644 --- a/vchasno.go +++ b/vchasno.go @@ -99,6 +99,7 @@ type SellParams struct { PayType int CardParams *CardParams Userinfo *api.Userinfo + CommentUP string } type CardParams struct { @@ -158,6 +159,11 @@ func (b *SellParamsBuilder) Comment(comment string) *SellParamsBuilder { return b } +func (b *SellParamsBuilder) CommentUp(commentUp string) *SellParamsBuilder { + b.params.CommentUP = commentUp + return b +} + func (b *SellParamsBuilder) PayCash() *SellParamsBuilder { b.params.PayType = PayTypeCash b.params.CardParams = nil