tdev-agency/checkbox-ua

0.0.1 2022-07-15 07:57 UTC

This package is auto-updated.

Last update: 2024-05-15 12:59:10 UTC


README

PHP SDK for Checkbox.ua

  1. Installation
  2. Usage
  3. Cashier
    1. Completion of the session of a cashier with the current access token
    2. Getting information about the current user (cashier)
    3. Receiving information about an active change of user (cashier)
    4. Check signature
  4. Organization
    1. Get current organization receipt settings
    2. Get current organization logo
    3. Get current organization text logo
  5. Shifts
    1. [Creating a Z-Report and closing the current shift by the user (cashier)](Creating a Z-Report and closing the current shift by the user (cashier))
    2. Opening a new shift by a cashier
    3. Getting current cashier shifts
    4. Receiving information about the current shift

Installation

The recommended way to install Guzzle is through Composer.

composer require tdev-agency/checkbox-ua

Usage

Create SignIn entity:

  1. SignIn with login and password:
$entity = \TDevAgency\CheckboxUa\Entities\Requests\SignInRequestEntity::create([
            'login' => 'login',
            'password' => 'password',
            'license_key' => 'license_key'
]);
  1. SignIn with pin code:
$entity = \TDevAgency\CheckboxUa\Entities\Requests\SignInRequestEntity::create([
            'pin_code' => 'pin_code',
            'license_key' => 'license_key'
]);

Initialize checkbox.ua instance

// For pin code sign in
$client = new CheckboxUa(CheckboxUa::DRIVER_SIGNIN_PIN_CODE, $entity);
// For sign in with login and password
$client = new CheckboxUa(CheckboxUa::DRIVER_SIGNIN, $entity);

Tags of api endpoints

Tags based on the official documentation of the checkbox.ua

There are two ways to call required tag.

E.g.: $cashier = $client->getCashier(); or by using helper method $cashier = $client->make(\TDevAgency\CheckboxUa\Tags\Cashier::class);

Cashier

Completion of the session of a cashier with the current access token

$client->getCashier()->signOut()

Getting information about the current user (cashier)

$client->getCashier()->me()

Receiving information about an active change of user (cashier)

$client->getCashier()->shift()

Check signature

$client->getCashier()->checkSignature()

Organization

Get current organization receipt settings

$client->make(\TDevAgency\CheckboxUa\Tags\Organization::class)->receiptConfig()

Get current organization logo

$client->make(\TDevAgency\CheckboxUa\Tags\Organization::class)->logoPng()

Get current organization text logo

$client->make(\TDevAgency\CheckboxUa\Tags\Organization::class)->textLogoPng()

Shifts

Creating a Z-Report and closing the current shift by the user (cashier)

$client->make(\TDevAgency\CheckboxUa\Tags\Shifts::class)->closeShift()

Optionally, a Z-Report can be generated on the client side and passed in the body of this request

$entity = \TDevAgency\CheckboxUa\Entities\Requests\ShiftCloseRequestEntity::create($data)
$client->make(\TDevAgency\CheckboxUa\Tags\Shifts::class)->closeShift($entity)

$data values:

Param Default type Description
skip_client_name_check false boolean Skip Client Name Check
fiscal_code null string Offline fiscal number
fiscal_date null string Offline fiscal number
report null \TDevAgency\CheckboxUa\Entities\Requests\ReportRequestEntity Offline shift close time (ignored when online shift close)

Opening a new shift by a cashier

$client->make(\TDevAgency\CheckboxUa\Tags\Shifts::class)->createShift($id, $fiscal_code, $fiscal_date)
Param Default type Description
id null string The shift id is generated on the client side
fiscal_code null string Offline fiscal number
fiscal_date null string Offline fiscal number

Getting current cashier shifts

$client->make(\TDevAgency\CheckboxUa\Tags\Shifts::class)->getShifts($statuses, $limit, $offset, $desc)
Param Default type Description
statuses [] array Array of any (Shift Status) Items Enum: "CREATED" "OPENING" "OPENED" "CLOSING" "CLOSED" Shift status
limit 25 int Limit
offset 0 int Offset
desc false boolean Reverse sort order

Receiving information about the current shift

$client->make(\TDevAgency\CheckboxUa\Tags\Shifts::class)->getShift($id, $options)
Param Default type Description
id int Required. Shift ID

Receipts

Obtaining a list of checks within the current shift or according to filter parameters

$entity = \TDevAgency\CheckboxUa\Entities\Requests\ReceiptQueryRequestEntity::create($data)
$client->getReceipts()->index($requestEntity)

$data params for ReceiptQueryRequestEntity:

Param Default type Description
fiscal_code null string Fiscal number
serial null string Serial
desc false boolean Reverse sort order
limit 25 int Limit
offset 0 int Offset

TODO

  1. Create Receipt
  2. Get Receipt Html
  3. Webhooks