1
0
Fork 0
mirror of synced 2025-04-19 00:40:58 +00:00

Compare commits

..

No commits in common. "master" and "3.1.0" have entirely different histories.

13 changed files with 26 additions and 52 deletions

1
.gitignore vendored
View file

@ -2,4 +2,3 @@
/vendor
composer.lock
.phpunit.result.cache
.env

View file

@ -3,7 +3,6 @@ language: php
php:
- 7.2
- 7.3
- 7.4
env:
- JMS=0.12

View file

@ -1,6 +0,0 @@
ARG PHP_IMAGE_TAG
FROM php:${PHP_IMAGE_TAG}-cli-alpine
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
WORKDIR /opt/test

View file

@ -1,16 +0,0 @@
ifneq (,$(shell (type docker-compose 2>&1 >/dev/null && echo 1) || true))
PHP=docker-compose run --rm --no-deps php
else
PHP=php
endif
PHP_CONSOLE_DEPS=vendor
vendor: composer.json
@$(PHP) composer install -o -n --no-ansi
@touch vendor || true
phpunit: $(PHP_CONSOLE_DEPS)
@$(PHP) vendor/bin/phpunit --color=always
check: phpunit

View file

@ -1,9 +1,9 @@
[![Build Status](https://app.travis-ci.com/retailcrm/atol-online-client.svg?branch=master)](https://app.travis-ci.com/retailcrm/atol-online-client)
[![Build Status](https://img.shields.io/travis/retailcrm/atol-online-client/master.svg?style=flat-square)](https://travis-ci.org/retailcrm/atol-online-client)
[![Latest stable](https://img.shields.io/packagist/v/retailcrm/atol-online-client.svg?style=flat-square)](https://packagist.org/packages/retailcrm/atol-online-client)
# API-клиент для АТОЛ.Онлайн
API-клиент на PHP для сервиса онлайн-фискализации платежей АТОЛ.Онлайн
API-клиент на PHP для сервиса онлайн-фискализации платежей АТОЛ.Онлайн.
## Требования

View file

@ -13,11 +13,11 @@
"php": ">=7.2",
"ext-curl": "*",
"ext-json": "*",
"guzzlehttp/guzzle": "~6.3|^7.0",
"jms/serializer": "^0.12|^1.0|^2.0|^3.0",
"symfony/validator": "~2.8|~3.0|~4.0|^5.0|^6.0",
"guzzlehttp/guzzle": "~6.3",
"jms/serializer": "~0.12|~1.0|~2.0|~3.0",
"symfony/validator": "~2.8|~3.0|~4.0",
"doctrine/cache": "~1.6",
"psr/log": "~1.0|^2.0|^3.0"
"psr/log": "~1.0"
},
"require-dev": {
"phpunit/phpunit": "~8.0"

View file

@ -1,11 +0,0 @@
version: '3.4'
services:
php:
build:
context: .
args:
PHP_IMAGE_TAG: ${PHP_IMAGE_TAG:-7.4}
volumes:
- "./:/opt/test"

View file

@ -8,7 +8,6 @@
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
convertDeprecationsToExceptions="true"
processIsolation="false"
stopOnFailure="false">

View file

@ -53,11 +53,11 @@ class ReceiptItemRequest
private $price;
/**
* @var float
* @var integer
* required
* @Serializer\Groups({"set", "get"})
* @Serializer\SerializedName("quantity")
* @Serializer\Type("float")
* @Serializer\Type("integer")
*/
private $quantity;
@ -175,17 +175,17 @@ class ReceiptItemRequest
}
/**
* @return float
* @return int
*/
public function getQuantity(): float
public function getQuantity(): int
{
return $this->quantity;
}
/**
* @param float $quantity
* @param int $quantity
*/
public function setQuantity(float $quantity): void
public function setQuantity(int $quantity): void
{
$this->quantity = $quantity;
}

View file

@ -143,7 +143,7 @@ class AtolOnlineApiTest extends TestCase
*/
public function testGetTokenBadResponse(): void
{
$api = $this->getApi([new BadResponseException('', new Request('GET', 'test'), new Response())]);
$api = $this->getApi([new BadResponseException('', new Request('GET', 'test'))]);
$this->assertFalse($this->callMethod($api, 'getToken'));
}

View file

@ -160,7 +160,7 @@ class AtolOnlineTest extends TestCase
$request->setTimestamp('17.07.2019 10:14:22');
$this->assertEquals(
'{"external_id":"test","receipt":{"client":{"email":"test@test.local"},"company":{"email":"test@test.local","inn":"11111111","payment_address":"address"},"items":[{"name":"test item","price":100.1,"quantity":1.1,"sum":100.1,"measurement_unit":"kg","payment_method":"advance","payment_object":"agent_commission","vat":{"type":"vat20","sum":20.2},"nomenclature_code":"00"}],"payments":[{"type":0,"sum":100.1}],"vats":[{"type":"vat20","sum":20.2}],"total":100.1},"timestamp":"17.07.2019 10:14:22","service":{"callback_url":"test.local"}}',
'{"external_id":"test","receipt":{"client":{"email":"test@test.local"},"company":{"email":"test@test.local","inn":"11111111","payment_address":"address"},"items":[{"name":"test item","price":100.1,"quantity":1,"sum":100.1,"measurement_unit":"kg","payment_method":"advance","payment_object":"agent_commission","vat":{"type":"vat20","sum":20.2},"nomenclature_code":"00"}],"payments":[{"type":0,"sum":100.1}],"vats":[{"type":"vat20","sum":20.2}],"total":100.1},"timestamp":"17.07.2019 10:14:22","service":{"callback_url":"test.local"}}',
$this->atol->serializeOperationRequest($request)
);
}

View file

@ -31,7 +31,7 @@ trait PaymentReceiptRequestTrait
$item = new ReceiptItemRequest();
$item->setName('test item');
$item->setPrice(100.1);
$item->setQuantity(1.1);
$item->setQuantity(1);
$item->setSum(100.1);
$item->setMeasurementUnit('kg');
$item->setPaymentMethod(ReceiptItemRequest::PAYMENT_METHOD_ADVANCE);

View file

@ -1,3 +1,13 @@
<?php
return require __DIR__.'/../vendor/autoload.php';
use Composer\Autoload\ClassLoader;
use Doctrine\Common\Annotations\AnnotationRegistry;
/**
* @var ClassLoader $loader
*/
$loader = require __DIR__.'/../vendor/autoload.php';
AnnotationRegistry::registerLoader('class_exists');
return $loader;