diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2b967da --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM php:7.0-cli +RUN apt-get update -yqq +RUN apt-get install -yqq git libmcrypt-dev libpq-dev libcurl4-gnutls-dev libicu-dev libvpx-dev libjpeg-dev libpng-dev libxpm-dev zlib1g-dev libfreetype6-dev libxml2-dev libexpat1-dev libbz2-dev libgmp3-dev libldap2-dev unixodbc-dev libsqlite3-dev libaspell-dev libsnmp-dev libpcre3-dev libtidy-dev +# Install PHP extensions +RUN docker-php-ext-install curl json opcache +COPY ./ /var/www/html/ +WORKDIR /var/www/html/ + diff --git a/README.md b/README.md index 0fc6c34..e578bd9 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # php-dreamkas -Фискализация чека для Дримкас-Ф для PHP 7.2 +Фискализация чека для Дримкас-Ф для PHP 7.0 Для более старых версий PHP придётся править код на предмет типов у функций. diff --git a/composer.json b/composer.json index c45eeca..acfcedb 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "Фискализация чека для Дримкас-Ф на php", "type": "library", "require": { - "php": "~7.2.0", + "php": "~7.0", "guzzlehttp/guzzle": "~6.3.0" }, "require-dev": { diff --git a/composer.lock b/composer.lock index c8100c6..ac6a3d2 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "0990319a17c4027dba33325c569d9220", + "content-hash": "6b56596df8522a59b7ad8cc5365cb7b5", "packages": [ { "name": "guzzlehttp/guzzle", @@ -1570,6 +1570,8 @@ "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, - "platform": [], + "platform": { + "php": "~7.0" + }, "platform-dev": [] } diff --git a/src/Api.php b/src/Api.php index 0e6fb78..2d9d6b3 100644 --- a/src/Api.php +++ b/src/Api.php @@ -9,9 +9,9 @@ */ class Api { - public const MODE_PRODUCTION = 0; - public const MODE_MOCK = 1; - public const MODE_DEBUG = 2; + const MODE_PRODUCTION = 0; + const MODE_MOCK = 1; + const MODE_DEBUG = 2; public $accessToken = ''; public $deviceId = 0; @@ -40,7 +40,7 @@ public function __construct(string $accessToken, int $deviceId, int $mode = self $this->createClient(); } - protected function createClient(): void + protected function createClient() { $baseUri = static::$baseUri[$this->mode] ?? null; if ($baseUri === null) { diff --git a/src/PaymentType.php b/src/PaymentType.php index 7ed3c44..fd213ad 100644 --- a/src/PaymentType.php +++ b/src/PaymentType.php @@ -9,7 +9,7 @@ class PaymentType { // нал - public const TYPE_CASH = 'CASH'; + const TYPE_CASH = 'CASH'; // безнал - public const TYPE_CASHLESS = 'CASHLESS'; + const TYPE_CASHLESS = 'CASHLESS'; } \ No newline at end of file diff --git a/src/Position.php b/src/Position.php index 4dda713..e3db4b1 100644 --- a/src/Position.php +++ b/src/Position.php @@ -9,8 +9,8 @@ */ class Position extends Configurable { - public const TYPE_COUNTABLE = 'COUNTABLE'; - public const TYPE_SCALABLE = 'SCALABLE'; + const TYPE_COUNTABLE = 'COUNTABLE'; + const TYPE_SCALABLE = 'SCALABLE'; public $name = ''; diff --git a/src/Receipt.php b/src/Receipt.php index 80fa2d4..9f6ffb0 100644 --- a/src/Receipt.php +++ b/src/Receipt.php @@ -9,10 +9,10 @@ */ class Receipt extends Configurable { - public const TYPE_SALE = 'SALE'; - public const TYPE_REFUND = 'REFUND'; - public const TYPE_OUTFLOW = 'OUTFLOW'; - public const TYPE_OUTFLOW_REFUND = 'OUTFLOW_REFUND'; + const TYPE_SALE = 'SALE'; + const TYPE_REFUND = 'REFUND'; + const TYPE_OUTFLOW = 'OUTFLOW'; + const TYPE_OUTFLOW_REFUND = 'OUTFLOW_REFUND'; // Тип чека public $type = self::TYPE_SALE; diff --git a/src/TaxMode.php b/src/TaxMode.php index 4fe7a75..3c1635a 100644 --- a/src/TaxMode.php +++ b/src/TaxMode.php @@ -9,15 +9,15 @@ class TaxMode { // ОСНО - public const MODE_DEFAULT = 'DEFAULT'; + const MODE_DEFAULT = 'DEFAULT'; // УСН доход - public const MODE_SIMPLE = 'SIMPLE'; + const MODE_SIMPLE = 'SIMPLE'; // УСН Доход-расход - public const MODE_SIMPLE_WO = 'SIMPLE_WO'; + const MODE_SIMPLE_WO = 'SIMPLE_WO'; // ЕНВД - public const MODE_ENVD = 'ENVD'; + const MODE_ENVD = 'ENVD'; // ЕСХН - public const MODE_AGRICULT = 'AGRICULT'; + const MODE_AGRICULT = 'AGRICULT'; // Патент - public const MODE_PATENT = 'PATENT'; + const MODE_PATENT = 'PATENT'; } diff --git a/src/TaxType.php b/src/TaxType.php index ccfc2de..d6c1d43 100644 --- a/src/TaxType.php +++ b/src/TaxType.php @@ -9,22 +9,22 @@ class TaxType { // Без НДС - public const TYPE_NDS_NO_TAX = 'NDS_NO_TAX'; + const TYPE_NDS_NO_TAX = 'NDS_NO_TAX'; // НДС 0 - public const TYPE_NDS_0 = 'NDS_0'; + const TYPE_NDS_0 = 'NDS_0'; // НДС 10 - public const TYPE_NDS_10 = 'NDS_10'; + const TYPE_NDS_10 = 'NDS_10'; // НДС 18 - public const TYPE_NDS_18 = 'NDS_18'; + const TYPE_NDS_18 = 'NDS_18'; // НДС 10/110 - public const TYPE_NDS_10_CALCULATED = 'NDS_10_CALCULATED'; + const TYPE_NDS_10_CALCULATED = 'NDS_10_CALCULATED'; // НДС 18/118 - public const TYPE_NDS_18_CALCULATED = 'NDS_18_CALCULATED'; + const TYPE_NDS_18_CALCULATED = 'NDS_18_CALCULATED'; } \ No newline at end of file diff --git a/test.sh b/test.sh new file mode 100755 index 0000000..52364bb --- /dev/null +++ b/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +docker build -t php-dreamkas . +docker run -it php-dreamkas vendor/bin/phpunit \ No newline at end of file