novitus_gosdk

package module
v0.0.0-...-b16bc39 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 11, 2026 License: GPL-3.0 Imports: 5 Imported by: 0

README

Novitus client SDK for Go

This is a client SDK for the Novitus API, written in Go. It provides a simple and easy-to-use interface for interacting with the Novitus API.

Installation

go get github.com/Hkozacz/novitus_gosdk

Usage

Quick example

	client, err := novitus_gosdk.NewNovitusClient("http://localhost:8888", "")
	if err != nil {
		fmt.Println("Error creating Novitus client:", err)
		return
	}
	var items []interface{}
	var printoutLines []interface{}
	article := map[string]interface{}{
		"article": novitus_gosdk.Article{
			Name:     "Tasty Pizza with Extra Cheese",
			PTU:      "B",
			Quantity: "2",
			Value:    "2.00",
			Price:    "1.00",
		},
	}
	line := map[string]interface{}{
		"textline": novitus_gosdk.TextLine{
			Text:   "Example text line",
			Bold:   true,
			Center: true,
			Masked: false,
		},
	}

	items = append(items, article)
	printoutLines = append(printoutLines, line)
	docResp, err := client.SendReceipt(
		&novitus_gosdk.Receipt{
			Items: items,
			Summary: novitus_gosdk.Summary{
				Total: "2.00",
				PayIn: "2.00",
			},
			PrintoutLines: printoutLines,
		}, false)
	if err != nil {
		fmt.Println("Error sending receipt:", err)
		return
	}
	fmt.Println("Receipt sent successfully:", docResp.Id)
	resp, err := client.GetQueueStatus()
	if err != nil {
		fmt.Println("Error getting queue status:", err)
		return
	}
	fmt.Println("Requests in queue:", resp.RequestsInQueue)
	confirmResp, err := client.Confirm("receipt", docResp.Id)
	if err != nil {
		fmt.Println("Error confirming receipt:", err)
		return
	}
	fmt.Println("Receipt confirmed successfully:", confirmResp.Id, confirmResp.Status)
}

Client creation

To start using the Novitus client, you need to create a new client instance. You can do this by providing the base URL of the Novitus API and optionaly Bearer token. If you provide empty token ("""), the client will generate new one on init.

client, err := novitus_gosdk.NewNovitusClient(baseUrl, token)

(Base URL should be in the format https://example.com)

API calls

API calls that require authentication will automatically try to refresh the token before making the request. But you can also manually refresh the token if needed.

ObtainToken

To obtain a new token, you can use the ObtainToken method. This method will return a TokenResponse struct containing the token and its expiration time.

client, err := novitus_gosdk.NewNovitusClient("example.com", "")
tokenResponse, err := client.ObtainToken()
RefreshToken

RefreshToken will automatically refresh the token inside client instance. It does not return response.

client, err := novitus_gosdk.NewNovitusClient("example.com", "")
err := client.RefreshToken()
GetQueueStatus

To get the status of the queue, you can use the GetQueueStatus method. This method will return a QueueStatusResponse struct containing the status of the queue.

client, err := novitus_gosdk.NewNovitusClient("example.com", "")
queueStatus, err := client.GetQueueStatus()
DeleteQueue

To delete the queue, you can use the DeleteQueue method. This method will return a DeleteQueueResponse struct containing the status of the deletion.

client, err := novitus_gosdk.NewNovitusClient("example.com", "")
deleteQueueResponse, err := client.DeleteQueue()
SendDocument

SendDocument method allows you to send a document to the Novitus API. It requires a documentType string and Document struct as an argument and returns a SendDocumentResponse struct containing the status of the document.

client, err := novitus_gosdk.NewNovitusClient("example.com", "")
SendDocumentResponse, err := client.SendDocument("invoice", invoiceToSend)
Confirm

Confirm method allows you to confirm a request to the Novitus API. It requires a objectType String and requestId as an argument and returns a SendDocumentResponse struct containing the status of the confirmation. requestID can be found in the response of the SendDocument method.

client, err := novitus_gosdk.NewNovitusClient("example.com", "")
confirmResponse, err := client.Confirm("invoice", requestId)
CheckDocumentStatus

CheckDocumentStatus method allows you to check the status of a document in the Novitus API. It requires a objectType String and requestId as an argument and returns a CheckDocumentStatusResponse struct containing the status of the document.

client, err := novitus_gosdk.NewNovitusClient("example.com", "")
checkDocumentStatusResponse, err := client.CheckDocumentStatus("invoice", requestId)
DeleteDocument

DeleteDocument method allows you to delete a document in the Novitus API. It requires a objectType String and requestId as an argument and returns a DeleteDocumentResponse struct containing the status of the deletion.

client, err := novitus_gosdk.NewNovitusClient("example.com", "")
deleteDocumentResponse, err := client.DeleteDocument("invoice", requestId)
SendReceipt

SendReceipt is a wrapper for the SendDocument method, specifically for sending receipts. It requires a Receipt struct as an argument and confirm bool and returns a CheckDocumentStatusResponse struct containing the status of the receipt. If confirm is set to true, the method will automatically confirm the receipt after sending it.

client, err := novitus_gosdk.NewNovitusClient("example.com", "")
receipt := novitus_gosdk.Receipt{
    // fill in the receipt details
}
sendReceiptResponse, err := client.SendReceipt(receipt, true)
SendInvoice

SendInvoice is a wrapper for the SendDocument method, specifically for sending invoices. It requires an Invoice struct as an argument and confirm bool and returns a CheckDocumentStatusResponse struct containing the status of the invoice. If confirm is set to true, the method will automatically confirm the invoice after sending it.

client, err := novitus_gosdk.NewNovitusClient("example.com", "")
invoice := novitus_gosdk.Invoice{
    // fill in the invoice details
}
sendInvoiceResponse, err := client.SendInvoice(invoice, true)
SendNFPrintout

SendNFPrintout is a wrapper for the SendDocument method, specifically for sending nonfiscal printouts. It requires an NFPrintout struct as an argument and confirm bool and returns a CheckDocumentStatusResponse struct containing the status of the NF printout. If confirm is set to true, the method will automatically confirm the NF printout after sending it.

client, err := novitus_gosdk.NewNovitusClient("example.com", "")
nfPrintout := novitus_gosdk.NFPrintout{
    // fill in the NF printout details
}
sendNFPrintoutResponse, err := client.SendNFPrintout(nfPrintout, true)

Validation of inputs

The SDK provides validation for the inputs of the SendReceipt, SendInvoice, and SendNFPrintout methods. If the input is invalid, an error will be returned. You can also use the Validate method on the structs to validate them before sending them to the API.

receipt := novitus_gosdk.Receipt{
    // fill in the receipt details
}
err := receipt.Validate()
if err != nil {
    // handle validation error
}

Structs

Requests
package novitus_gosdk

type Summary struct {
	DiscountMarkup string `json:"discount_markup"`
	Total          string `json:"total"`
	PayIn          string `json:"pay_in"`
	Change         string `json:"change"`
}

type EDocument struct {
	TransactionId string `json:"transaction_id"`
	Protocol      string `json:"protocol"`
	PrintSendMode string `json:"print_send_mode"`
}

type Buyer struct {
	Name      string   `json:"name"`
	IdType    string   `json:"id_type"`
	Id        string   `json:"id"`
	LabelType string   `json:"label_type"`
	Address   []string `json:"address"`
	Nip       string   `json:"nip"`
	EDocument `json:"e_document"`
}

type SystemInfo struct {
	CashierName  string `json:"cashier_name"`
	CashNumer    string `json:"cash_number"`
	SystemNumber string `json:"system_number"`
}

type DeviceControl struct {
	OpenDrawer        bool   `json:"open_drawer"`
	FeedAfterPrintout bool   `json:"feed_after_printout"`
	PaperCut          string `json:"paper_cut"`
}

type Receipt struct {
	Items         []interface{}    `json:"items"` // Required: true
	Payments      []interface{}    `json:"payments"`
	Summary       `json:"summary"` // Required: true
	PrintoutLines []interface{}    `json:"printout_lines"`
	Buyer         `json:"buyer"`
	SystemInfo    `json:"system_info"`
	DeviceControl `json:"device_control"`
}

type Info struct {
	Number        string `json:"number"`
	CopyCount     int    `json:"copy_count"`
	DateOfSell    string `json:"date_of_sell"`
	DateOfPayment string `json:"date_of_payment"`
	PaymentForm   string `json:"payment_form"`
	Paid          string `json:"paid"`
}

type TransactionSide struct {
	Name      string `json:"name"`
	PrintInfo string `json:"print_info"` // Enum: "place_for_signature" "name_and_place_for_signature" "none"
}

type Options struct {
	SkipDescriptionValueToPay                  bool `json:"skip_description_value_to_pay"`
	SkipBlockGrossValueInAccountingTax         bool `json:"skip_block_gross_value_in_accounting_tax"`
	BuyerBold                                  bool `json:"buyer_bold"`
	SellerBold                                 bool `json:"seller_bold"`
	BuyerNipBold                               bool `json:"buyer_nip_bold"`
	SellerNipBold                              bool `json:"seller_nip_bold"`
	PrintLabelDescriptionSymbolInInvoiceHeader bool `json:"print_label_description_symbol_in_invoice_header"`
	PrintPositionNumberInInvoiceHeader         bool `json:"print_position_number_in_invoice_header"`
	PrintPositionNumberInvoice                 bool `json:"print_position_number_invoice"`
	ToPayLabelBeforeAcountingTaxBlock          bool `json:"to_pay_label_before_acounting_tax_block"`
	PrintCentsInWords                          bool `json:"print_cents_in_words"`
	DontPrintSellDateIfEqualCreateDate         bool `json:"dont_print_sell_date_if_equal_create_date"`
	DontPrintSellerDataInHeader                bool `json:"dont_print_seller_data_in_header"`
	DontPrintSellItemsDescription              bool `json:"dont_print_sell_items_description"`
	EnablePaymentForm                          bool `json:"enable_payment_form"`
	DontPrintCustomerData                      bool `json:"dont_print_customer_data"`
	PrintPaydInCash                            bool `json:"print_payd_in_cash"`
	SkipSellerLabel                            bool `json:"skip_seller_label"`
	PrintInvoiceTaxLabel                       bool `json:"print_invoice_tax_label"`
}

type AdditionalInfo struct {
	Text          string `json:"text"`
	Bold          bool   `json:"bold"`
	Justification string `json:"justification"` // Enum: "left" "center" "right"
}

type Invoice struct {
	Info           `json:"info"`   // Required: true
	Buyer          `json:"buyer"`  // Required: true
	Recipient      TransactionSide `json:"recipient"`
	Seller         TransactionSide `json:"seller"`
	Options        `json:"options"`
	Items          []interface{}    `json:"items"` // Required: true
	Payments       []interface{}    `json:"payments"`
	Summary        `json:"summary"` // Required: true
	PrintoutLines  []interface{}    `json:"printout_lines"`
	AdditionalInfo []AdditionalInfo `json:"additional_info"`
	DeviceControl  `json:"device_control"`
	SystemInfo     `json:"system_info"`
}

type PrintoutOptions struct {
	WithoutHeader    bool `json:"without_header"`
	LeftMargin       bool `json:"left_margin"`
	CopyOnly         bool `json:"copy_only"`
	FiscalMarginsOff bool `json:"fiscal_margins_off"`
}

type Printout struct {
	Options       PrintoutOptions `json:"options"`
	Lines         []string        `json:"lines"` // Required: true
	EDocument     `json:"e_document"`
	SystemInfo    `json:"system_info"`
	DeviceControl `json:"device_control"`
}

// Items

type Article struct {
	Name           string `json:"name"`            // Required: true
	PTU            string `json:"ptu"`             // Enum: "A" - "G" Required: true
	Quantity       string `json:"quantity"`        // Quantity in units, e.g. "1.00" Required: true
	Price          string `json:"price"`           // Price in currency, e.g. "1.00" Required: true
	Value          string `json:"value"`           // Total value for the item, e.g. "1.00" Required: true
	Unit           string `json:"unit"`            // Enum: "szt" - "kg", etc.
	DiscountMarkup string `json:"discount_markup"` // Optional, e.g. "0.00"
	Code           string `json:"code"`            // Optional, e.g. "1234567890123" Can be set only if Description is not Set
	Description    string `json:"description"`     // Optional, e.g. "Sample Item"
}

type Advance struct {
	Description string `json:"description"` // Required: true, e.g. "Advance Payment"
	PTU         string `json:"ptu"`         // Enum: "A" - "G" Required: true
	Value       string `json:"value"`       // Value in currency, e.g. "100.00" Required: true
}

type AdvanceReturn struct {
	Description string `json:"description"` // Required: true, e.g. "Advance Return"
	PTU         string `json:"ptu"`         // Enum: "A" - "G" Required: true
	Value       string `json:"value"`       // Value in currency, e.g. "50.00" Required: true
}

type Container struct {
	Name     string `json:"name"`     // e.g. "Container Name"
	Number   string `json:"number"`   // e.g. "12345"
	Quantity string `json:"quantity"` // Quantity in units, e.g. "10.00"
	Value    string `json:"value"`    // Total value for the container, e.g. "100.00" Required: true
}

type ContainerReturn struct {
	Name     string `json:"name"`     // e.g. "Container Name"
	Number   string `json:"number"`   // e.g. "12345"
	Quantity string `json:"quantity"` // Quantity in units, e.g. "10.00"
	Value    string `json:"value"`    // Total value for the container, e.g. "100.00" Required: true
}

// Payments

type Cash struct {
	Value string `json:"value"` // Value in currency, e.g. "100.00" Required: true
}

type TypicalPaymentMethod struct {
	Name  string `json:"name"`  // enum "card", cheque, coupon, other, credit, account, transfer, mobile, voucher
	Value string `json:"value"` // Value in currency, e.g. "100.00" Required: true
}

type Currency struct {
	Course        string `json:"course"`         // e.g. "1.00" Required: true
	CurrencyValue string `json:"currency_value"` // e.g. "USD" Required: true
	LocalValue    string `json:"local_value"`    // e.g. "100.00" Required: true
	IsChange      bool   `json:"is_change"`      // true if this is a change, false otherwise Required: true
	Name          string `json:"name"`           // e.g. "USD" Required: true
}

// Printout Lines

type PrintoutLine struct {
	Text 	  string `json:"text"`        // The text to be printed, e.g. "Sample Text" Required: true
	Masked    bool   `json:"masked"`      // true if the text should be masked, false otherwise Required: true
}

type TextLine struct {
	Bold       bool   `json:"bold"`        // true if the text should be bold, false otherwise
	Invers     bool   `json:"invers"`      // true if the text should be inverted, false otherwise
	Center     bool   `json:"center"`      // true if the text should be centered, false otherwise
	FontNumber int    `json:"font_number"` // Font number, e.g. 1, 2, 3
	Big        bool   `json:"big"`         // true if the text should be big, false otherwise
	Height     int    `json:"height"`      // Height of the text in points, e.g. 12
	Width      int    `json:"width"`       // Width of the text in points, e.g. 100
	Text       string `json:"text"`        // The text to be printed, e.g. "Sample Text" Required: true
	Masked     bool   `json:"masked"`      // true if the text should be masked, false otherwise Required: true
}

Responses
package novitus_gosdk

type Error struct {
	Code        int    `json:"code"`
	Description string `json:"description"`
}

type Request struct {
	Status    string `json:"status"`
	Id        string `json:"id"`
	EDocument string `json:"e_document"`
	JPKID     string `json:"jpkid"`
	Error     `json:"error"`
}

type Device struct {
	Status string `json:"status"`
	Error  `json:"error"`
}

type TokenResponse struct {
	Token          string `json:"token"`
	ExpirationDate string `json:"expiration_date"`
}

type QueueResponse struct {
	RequestsInQueue int `json:"requests_in_queue"`
}

type DeleteQueueResponse struct {
	Status string `json:"status"`
}

type SendDocumentResponse struct {
	Request `json:"request"`
}

type ConfirmDocumentResponse struct {
	Request `json:"request"`
}

type CheckDocumentStatusResponse struct {
	DeviceObj Device `json:"device"`
	Request   `json:"request"`
}

type DeleteDocumentResponse struct {
	Request `json:"request"`
}

type ErrorResponse struct {
	Exception Error `json:"exception"`
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdditionalInfo

type AdditionalInfo struct {
	Text          string `json:"text,omitempty"`
	Bold          bool   `json:"bold,omitempty"`
	Justification string `json:"justification,omitempty"` // Enum: "left" "center" "right"
}

type Advance

type Advance struct {
	Description string `json:"description,omitempty"` // Required: true, e.g. "Advance Payment"
	PTU         string `json:"ptu"`                   // Enum: "A" - "G" Required: true https://www.posnet.com.pl/gdzie-kupic
	Value       string `json:"value"`                 // Value in currency, e.g. "100.00" Required: true
}

func (*Advance) Validate

func (a *Advance) Validate() error

type AdvanceReturn

type AdvanceReturn struct {
	Description string `json:"description,omitempty"` // Required: true, e.g. "Advance Return"
	PTU         string `json:"ptu"`                   // Enum: "A" - "G" Required: true https://www.posnet.com.pl/gdzie-kupic
	Value       string `json:"value"`                 // Value in currency, e.g. "50.00" Required: true
}

func (*AdvanceReturn) Validate

func (a *AdvanceReturn) Validate() error

type Article

type Article struct {
	Name           string          `json:"name"`                      // Required: true
	PTU            string          `json:"ptu"`                       // Enum: "A" - "G" Required: true https://www.posnet.com.pl/gdzie-kupic
	Quantity       string          `json:"quantity"`                  // Quantity in units, e.g. "1.00" Required: true
	Price          string          `json:"price"`                     // Price in currency, e.g. "1.00" Required: true
	Value          string          `json:"value"`                     // Total value for the item, e.g. "1.00" Required: true
	Unit           string          `json:"unit,omitempty"`            // Enum: "szt" - "kg", etc.
	DiscountMarkup *DiscountMarkup `json:"discount_markup,omitempty"` // Optional, e.g. "0.00"
	Code           string          `json:"code,omitempty"`            // Optional, e.g. "1234567890123" Can be set only if Description is not Set
	Description    string          `json:"description,omitempty"`     // Optional, e.g. "Sample Item"
}

func (*Article) Validate

func (a *Article) Validate() error

type Buyer

type Buyer struct {
	Name      string   `json:"name,omitempty"`
	IdType    string   `json:"id_type,omitempty"`
	Id        string   `json:"id,omitempty"`
	LabelType string   `json:"label_type,omitempty"`
	Address   []string `json:"address,omitempty"`
	Nip       string   `json:"nip,omitempty"`
	EDocument `json:"e_document,omitempty"`
}

type Cash

type Cash struct {
	Value string `json:"value"` // Value in currency, e.g. "100.00" Required: true
}

func (*Cash) Validate

func (c *Cash) Validate() error

type CheckDocumentStatusResponse

type CheckDocumentStatusResponse struct {
	DeviceObj Device `json:"device"`
	Request   `json:"request"`
}

type ConfirmDocumentResponse

type ConfirmDocumentResponse struct {
	Request `json:"request"`
}

type Container

type Container struct {
	Name     string `json:"name,omitempty"`     // e.g. "Container Name"
	Number   string `json:"number,omitempty"`   // e.g. "12345"
	Quantity string `json:"quantity,omitempty"` // Quantity in units, e.g. "10.00"
	Value    string `json:"value"`              // Total value for the container, e.g. "100.00" Required: true
}

func (*Container) Validate

func (c *Container) Validate() error

type ContainerReturn

type ContainerReturn struct {
	Name     string `json:"name"`     // e.g. "Container Name"
	Number   string `json:"number"`   // e.g. "12345"
	Quantity string `json:"quantity"` // Quantity in units, e.g. "10.00"
	Value    string `json:"value"`    // Total value for the container, e.g. "100.00" Required: true
}

func (*ContainerReturn) Validate

func (cr *ContainerReturn) Validate() error

type Currency

type Currency struct {
	Course        string `json:"course"`         // e.g. "1.00" Required: true
	CurrencyValue string `json:"currency_value"` // e.g. "USD" Required: true
	LocalValue    string `json:"local_value"`    // e.g. "100.00" Required: true
	IsChange      bool   `json:"is_change"`      // true if this is a change, false otherwise Required: true
	Name          string `json:"name"`           // e.g. "USD" Required: true
}

func (*Currency) Validate

func (c *Currency) Validate() error

type DeleteDocumentResponse

type DeleteDocumentResponse struct {
	Request `json:"request"`
}

type DeleteQueueResponse

type DeleteQueueResponse struct {
	Status string `json:"status"`
}

type Device

type Device struct {
	Status string `json:"status"`
	Error  `json:"error"`
}

type DeviceControl

type DeviceControl struct {
	OpenDrawer        bool   `json:"open_drawer,omitempty"`
	FeedAfterPrintout bool   `json:"feed_after_printout,omitempty"`
	PaperCut          string `json:"paper_cut,omitempty"`
}

type DiscountMarkup

type DiscountMarkup struct {
	Type  string `json:"type"` //Enum: "percent_discount" "percent_markup" "value_discount" "value_markup"
	Name  string `json:"name,omitempty"`
	Value string `json:"value"`
}

type Document

type Document interface {
	Validate() error
}

type EDocument

type EDocument struct {
	TransactionId string `json:"transaction_id,omitempty"`
	Protocol      string `json:"protocol,omitempty"`
	PrintSendMode string `json:"print_send_mode,omitempty"`
}

type Error

type Error struct {
	Code        int      `json:"code"`
	Description string   `json:"description"`
	Errors      []string `json:"errors"`
}

type ErrorResponse

type ErrorResponse struct {
	Exception Error `json:"exception"`
}

type Info

type Info struct {
	Number        string `json:"number,omitempty"`
	CopyCount     int    `json:"copy_count,omitempty"`
	DateOfSell    string `json:"date_of_sell,omitempty"`
	DateOfPayment string `json:"date_of_payment,omitempty"`
	PaymentForm   string `json:"payment_form,omitempty"`
	Paid          string `json:"paid,omitempty"`
}

type Invoice

type Invoice struct {
	Info           `json:"info"`    // Required: true
	Buyer          `json:"buyer"`   // Required: true
	Recipient      *TransactionSide `json:"recipient,omitempty"`
	Seller         *TransactionSide `json:"seller,omitempty"`
	Options        `json:"options"`
	Items          []interface{}    `json:"items"` // Required: true
	Payments       []interface{}    `json:"payments,omitempty"`
	Summary        `json:"summary"` // Required: true
	PrintoutLines  []interface{}    `json:"printout_lines,omitempty"`
	AdditionalInfo []AdditionalInfo `json:"additional_info,omitempty"`
	DeviceControl  `json:"device_control,omitempty"`
	SystemInfo     `json:"system_info,omitempty"`
}

func (*Invoice) Validate

func (i *Invoice) Validate() error

type NovitusClient

type NovitusClient struct {
	// contains filtered or unexported fields
}

func NewNovitusClient

func NewNovitusClient(host, token string) (*NovitusClient, error)

func (*NovitusClient) CheckDocumentStatus

func (n *NovitusClient) CheckDocumentStatus(objectType, requestId string) (CheckDocumentStatusResponse, error)

func (*NovitusClient) Confirm

func (n *NovitusClient) Confirm(objectType, requestId string) (SendDocumentResponse, error)

func (*NovitusClient) DeleteDocument

func (n *NovitusClient) DeleteDocument(objectType, requestId string) (DeleteDocumentResponse, error)

func (*NovitusClient) DeleteQueue

func (n *NovitusClient) DeleteQueue() (DeleteQueueResponse, error)

func (*NovitusClient) GetQueueStatus

func (n *NovitusClient) GetQueueStatus() (QueueResponse, error)

func (*NovitusClient) ObtainToken

func (n *NovitusClient) ObtainToken() (TokenResponse, error)

func (*NovitusClient) RefreshIfNeeded

func (n *NovitusClient) RefreshIfNeeded() error

func (*NovitusClient) RefreshToken

func (n *NovitusClient) RefreshToken() error

func (*NovitusClient) SendDocument

func (n *NovitusClient) SendDocument(documentType string, document Document) (SendDocumentResponse, error)

func (*NovitusClient) SendInvoice

func (n *NovitusClient) SendInvoice(invoice *Invoice, confirm bool) (CheckDocumentStatusResponse, error)

func (*NovitusClient) SendNFPrintout

func (n *NovitusClient) SendNFPrintout(printout *Printout, confirm bool) (CheckDocumentStatusResponse, error)

func (*NovitusClient) SendReceipt

func (n *NovitusClient) SendReceipt(receipt *Receipt, confirm bool) (CheckDocumentStatusResponse, error)

type Options

type Options struct {
	SkipDescriptionValueToPay                  bool `json:"skip_description_value_to_pay"`
	SkipBlockGrossValueInAccountingTax         bool `json:"skip_block_gross_value_in_accounting_tax"`
	BuyerBold                                  bool `json:"buyer_bold"`
	SellerBold                                 bool `json:"seller_bold"`
	BuyerNipBold                               bool `json:"buyer_nip_bold"`
	SellerNipBold                              bool `json:"seller_nip_bold"`
	PrintLabelDescriptionSymbolInInvoiceHeader bool `json:"print_label_description_symbol_in_invoice_header"`
	PrintPositionNumberInInvoiceHeader         bool `json:"print_position_number_in_invoice_header"`
	PrintPositionNumberInvoice                 bool `json:"print_position_number_invoice"`
	ToPayLabelBeforeAcountingTaxBlock          bool `json:"to_pay_label_before_acounting_tax_block"`
	PrintCentsInWords                          bool `json:"print_cents_in_words"`
	DontPrintSellDateIfEqualCreateDate         bool `json:"dont_print_sell_date_if_equal_create_date"`
	DontPrintSellerDataInHeader                bool `json:"dont_print_seller_data_in_header"`
	DontPrintSellItemsDescription              bool `json:"dont_print_sell_items_description"`
	EnablePaymentForm                          bool `json:"enable_payment_form"`
	DontPrintCustomerData                      bool `json:"dont_print_customer_data"`
	PrintPaydInCash                            bool `json:"print_payd_in_cash"`
	SkipSellerLabel                            bool `json:"skip_seller_label"`
	PrintInvoiceTaxLabel                       bool `json:"print_invoice_tax_label"`
}

type Printout

type Printout struct {
	Options        *PrintoutOptions `json:"options,omitempty"`
	Lines          []interface{}    `json:"lines"` // Required: true
	*EDocument     `json:"e_document,omitempty"`
	*SystemInfo    `json:"system_info,omitempty"`
	*DeviceControl `json:"device_control,omitempty"`
}

func (*Printout) Validate

func (p *Printout) Validate() error

type PrintoutLine

type PrintoutLine struct {
	Text   string `json:"text"`   // The text to be printed, e.g. "Sample Text" Required: true
	Masked bool   `json:"masked"` // true if the text should be masked, false otherwise Required: true
}

func (*PrintoutLine) Validate

func (p *PrintoutLine) Validate() error

type PrintoutOptions

type PrintoutOptions struct {
	WithoutHeader    bool `json:"without_header,omitempty"`
	LeftMargin       bool `json:"left_margin,omitempty"`
	CopyOnly         bool `json:"copy_only,omitempty"`
	FiscalMarginsOff bool `json:"fiscal_margins_off,omitempty"`
}

type QueueResponse

type QueueResponse struct {
	RequestsInQueue int `json:"requests_in_queue"`
}

type Receipt

type Receipt struct {
	Items         []interface{}              `json:"items,omitempty"` // Required: true
	Payments      []interface{}              `json:"payments,omitempty"`
	Summary       `json:"summary,omitempty"` // Required: true
	PrintoutLines []interface{}              `json:"printout_lines,omitempty"`
	Buyer         *Buyer                     `json:"buyer,omitempty"`
	SystemInfo    *SystemInfo                `json:"system_info,omitempty"`
	DeviceControl *DeviceControl             `json:"device_control,omitempty"`
}

func (*Receipt) Validate

func (r *Receipt) Validate() error

type Request

type Request struct {
	Status    string `json:"status"`
	Id        string `json:"id"`
	EDocument string `json:"e_document"`
	JPKID     int    `json:"jpkid"`
	Error     `json:"error"`
}

type SendDocumentResponse

type SendDocumentResponse struct {
	Request `json:"request"`
}

type Summary

type Summary struct {
	DiscountMarkup *DiscountMarkup `json:"discount_markup,omitempty"`
	Total          string          `json:"total,omitempty"`
	PayIn          string          `json:"pay_in,omitempty"`
	Change         string          `json:"change,omitempty"`
}

type SystemInfo

type SystemInfo struct {
	CashierName  string `json:"cashier_name,omitempty"`
	CashNumer    string `json:"cash_number,omitempty"`
	SystemNumber string `json:"system_number,omitempty"`
}

type TextLine

type TextLine struct {
	Bold       bool   `json:"bold,omitempty"`        // true if the text should be bold, false otherwise
	Invers     bool   `json:"invers,omitempty"`      // true if the text should be inverted, false otherwise
	Center     bool   `json:"center,omitempty"`      // true if the text should be centered, false otherwise
	FontNumber int    `json:"font_number,omitempty"` // Font number, e.g. 1, 2, 3
	Big        bool   `json:"big,omitempty"`         // true if the text should be big, false otherwise
	Height     int    `json:"height,omitempty"`      // Height of the text in points, e.g. 12
	Width      int    `json:"width,omitempty"`       // Width of the text in points, e.g. 100
	Text       string `json:"text"`                  // The text to be printed, e.g. "Sample Text" Required: true
	Masked     bool   `json:"masked"`                // true if the text should be masked, false otherwise Required: true
}

func (*TextLine) Validate

func (tl *TextLine) Validate() error

type TokenResponse

type TokenResponse struct {
	Token          string `json:"token"`
	ExpirationDate string `json:"expiration_date"`
}

type TransactionSide

type TransactionSide struct {
	Name      string `json:"name,omitempty"`
	PrintInfo string `json:"print_info,omitempty"` // Enum: "place_for_signature" "name_and_place_for_signature" "none"
}

func (*TransactionSide) Validate

func (ts *TransactionSide) Validate() error

type TypicalPaymentMethod

type TypicalPaymentMethod struct {
	Name  string `json:"name,omitempty"` // enum "card", cheque, coupon, other, credit, account, transfer, mobile, voucher
	Value string `json:"value"`          // Value in currency, e.g. "100.00" Required: true
}

func (*TypicalPaymentMethod) Validate

func (t *TypicalPaymentMethod) Validate() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL