2021-10-29 12:39:14 +03:00
|
|
|
[![Build Status](https://app.travis-ci.com/retailcrm/atol-online-client.svg?branch=master)](https://app.travis-ci.com/retailcrm/atol-online-client)
|
2019-07-24 17:46:59 +03:00
|
|
|
[![Latest stable](https://img.shields.io/packagist/v/retailcrm/atol-online-client.svg?style=flat-square)](https://packagist.org/packages/retailcrm/atol-online-client)
|
|
|
|
|
2018-06-28 10:44:21 +03:00
|
|
|
# API-клиент для АТОЛ.Онлайн
|
2018-06-20 15:35:38 +03:00
|
|
|
|
2021-10-29 12:39:14 +03:00
|
|
|
API-клиент на PHP для сервиса онлайн-фискализации платежей АТОЛ.Онлайн
|
2018-06-28 10:44:21 +03:00
|
|
|
|
|
|
|
## Требования
|
|
|
|
|
2019-12-26 11:36:49 +03:00
|
|
|
* PHP 7.2 и выше
|
2018-06-28 10:44:21 +03:00
|
|
|
* PHP extension cURL
|
|
|
|
|
|
|
|
## Пример использования
|
2018-06-20 15:35:38 +03:00
|
|
|
|
|
|
|
```php
|
|
|
|
$atol = new \AtolOnlineClient\AtolOnline();
|
|
|
|
|
|
|
|
$connection = new \AtolOnlineClient\Configuration\Connection();
|
|
|
|
$connection->version = \AtolOnlineClient\AtolOnlineApi::API_VERSION_V4;
|
|
|
|
$connection->login = 'login';
|
|
|
|
$connection->pass = 'pass';
|
|
|
|
$connection->group = 'group';
|
|
|
|
|
|
|
|
$config = new \AtolOnlineClient\Configuration();
|
|
|
|
$config->connections = [$connection];
|
|
|
|
|
2018-06-28 10:44:21 +03:00
|
|
|
$client = new \Guzzle\Http\Client();
|
|
|
|
|
|
|
|
$api = $atol->createApi($client, $connection);
|
|
|
|
|
|
|
|
// $api->setLogger(...);
|
|
|
|
// $api->setCache(...);
|
|
|
|
|
|
|
|
// собираем объект запроса
|
2018-06-20 15:35:38 +03:00
|
|
|
$request = new \AtolOnlineClient\Request\V4\PaymentReceiptRequest();
|
|
|
|
$paymentReceiptRequest = $atol->serializeOperationRequest($request);
|
|
|
|
|
|
|
|
$response = $atol->getApi()->sell($paymentReceiptRequest);
|
|
|
|
|
|
|
|
if ($response) {
|
|
|
|
$postOperationResponse = $atol->deserializeOperationResponse($response);
|
|
|
|
}
|
|
|
|
```
|