Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/lexesv/checkbox-ua-api-sdk

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/lexesv/checkbox-ua-api-sdk

  • v0.0.0-20221211134719-da5fc7937dd7
  • Source
  • Go
  • Socket score

Version published
Created
Source

checkbox-ua-api-sdk

Golang SDK для роботи з API Checkbox.ua

(under development)

Реалізовані деякі базові функції, яких достатньо для відкриття зміни і створення фіскальних чеків. Implemented some basic functions.

Alternative: Auto generated Checkbox SDK

Usage

Приклад:

package main

import (
	"log"
	"github.com/lexesv/checkbox-ua-api-sdk"
)

func main() {
	LicenseKey := "<LicenseKey>"
	CashierLogin := "<CashierLogin>"
	CashierPassword := "<CashierPassword>"
	CashierPinCode := "<CashierPinCode>"

	ChBox := checkbox.New(LicenseKey, CashierLogin, CashierPassword, CashierPinCode)

	sign, err := ChBox.SignIn()
	if err != nil {
		log.Fatal(err)
	}

	log.Println("AccessToken:", sign.AccessToken)

	profile, err := ChBox.GetCashierProfile(sign.AccessToken)
	if err != nil {
		log.Fatal(err)
	}
	log.Printf("ID: %s; FullName: %s\n", profile.Id, profile.FullName)

	rinfo, err := ChBox.GetCashRegistersInfo()
	if err != nil {
		log.Fatal(err)
	}
	log.Println("Has open Shift:", rinfo.HasShift)

	shift, err := ChBox.CreateShift(sign.AccessToken)
	if err != nil {
		//log.Fatal(err)
		log.Println(err)
	}
	if shift.Serial > 0 {
		log.Println("Shift success created")
		time.Sleep(time.Second * 7)
	}

	req := ChBox.NewSimpleReceipt("1", "Продаж ПЗ", 10000, 1000, "CARD", 10000)
	receipt, err := ChBox.CreateReceipt(sign.AccessToken, req)
	if err != nil {
		log.Fatal(err)
	}
	if receipt.Serial > 0 {
		log.Println("Receipt success created")
	}

	time.Sleep(time.Second * 15)

	_, err = ChBox.CloseShift(sign.AccessToken, nil)
	if err != nil {
		log.Fatal(err.Error())
	} else {
		log.Println("Shift success closed")
	}
}

FAQs

Package last updated on 11 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc