Added commentUP field to fiscalAPI

This commit is contained in:
2025-10-13 16:08:02 +03:00
parent 854187f98e
commit 328447f079
3 changed files with 21 additions and 13 deletions

View File

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

View File

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

View File

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