tdev-agency / checkbox-ua
Checkbox.ua SDK
0.0.1
2022-07-15 07:57 UTC
Requires
- php: ^7.4|^8
- ext-json: *
- guzzlehttp/guzzle: ^7
- illuminate/collections: ^7|^8|^9
Requires (Dev)
- brainmaestro/composer-git-hooks: ^2.8
- fakerphp/faker: ^1.19
- friendsofphp/php-cs-fixer: ^3.6
- phpstan/phpstan: ^1.7
- phpunit/phpunit: *
- squizlabs/php_codesniffer: ^3.6
README
PHP SDK for Checkbox.ua
- Installation
- Usage
- Cashier
- Organization
- Shifts
- [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))
- Opening a new shift by a cashier
- Getting current cashier shifts
- 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:
- SignIn with login and password:
$entity = \TDevAgency\CheckboxUa\Entities\Requests\SignInRequestEntity::create([ 'login' => 'login', 'password' => 'password', 'license_key' => 'license_key' ]);
- 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:
Opening a new shift by a cashier
$client->make(\TDevAgency\CheckboxUa\Tags\Shifts::class)->createShift($id, $fiscal_code, $fiscal_date)
Getting current cashier shifts
$client->make(\TDevAgency\CheckboxUa\Tags\Shifts::class)->getShifts($statuses, $limit, $offset, $desc)
Receiving information about the current shift
$client->make(\TDevAgency\CheckboxUa\Tags\Shifts::class)->getShift($id, $options)
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
: