1
0
Fork 0
mirror of synced 2025-04-10 04:20:55 +00:00

Compare commits

...

10 commits

Author SHA1 Message Date
Ichern
0adfb9edda
Merge pull request #18 from retailcrm/resolve-logger-version-conflict
Resolve conflict with psr/log
2024-07-17 12:44:28 +03:00
Nikolay Parshakov
aecbdeafcc Resolve conflict with psr/log 2024-07-17 12:12:51 +03:00
Ilyas Salikhov
a857ba561a
Merge pull request #17 from retailcrm/sf6
compability with symfony 6
2024-06-17 18:29:03 +03:00
Ilyas Salikhov
f570c20839 compability with symfony 6 2024-06-17 18:28:35 +03:00
Ilyas Salikhov
726b51151c Check deprecations in tests 2024-01-27 19:40:29 +03:00
Ilyas Salikhov
1b75a04cf9 Compability with guzzlehttp/guzzle:^7.0 2024-01-27 19:37:04 +03:00
Ilyas Salikhov
68df0e1f49 Environment to run test locally 2024-01-27 19:36:37 +03:00
Alexey
5158cf22b3
bump "symfony/validator" version in composer.json (#16)
* bump "symfony/validator" version in composer.json
2022-09-05 13:45:33 +03:00
Alexey
c68448954b
fix jms/serializer versions (#15)
* fix jms/serializer versions
* add php 7.4 to travis
* fix travis badge
2021-10-29 12:39:14 +03:00
raulleo
c9f5fa92af
change quantity type from int to float (#14) 2021-05-27 12:06:51 +03:00
13 changed files with 52 additions and 26 deletions

1
.gitignore vendored
View file

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

View file

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

6
Dockerfile Normal file
View file

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

16
Makefile Normal file
View file

@ -0,0 +1,16 @@
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://img.shields.io/travis/retailcrm/atol-online-client/master.svg?style=flat-square)](https://travis-ci.org/retailcrm/atol-online-client)
[![Build Status](https://app.travis-ci.com/retailcrm/atol-online-client.svg?branch=master)](https://app.travis-ci.com/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",
"jms/serializer": "~0.12|~1.0|~2.0|~3.0",
"symfony/validator": "~2.8|~3.0|~4.0",
"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",
"doctrine/cache": "~1.6",
"psr/log": "~1.0"
"psr/log": "~1.0|^2.0|^3.0"
},
"require-dev": {
"phpunit/phpunit": "~8.0"

11
docker-compose.yml Normal file
View file

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

View file

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

View file

@ -53,11 +53,11 @@ class ReceiptItemRequest
private $price;
/**
* @var integer
* @var float
* required
* @Serializer\Groups({"set", "get"})
* @Serializer\SerializedName("quantity")
* @Serializer\Type("integer")
* @Serializer\Type("float")
*/
private $quantity;
@ -175,17 +175,17 @@ class ReceiptItemRequest
}
/**
* @return int
* @return float
*/
public function getQuantity(): int
public function getQuantity(): float
{
return $this->quantity;
}
/**
* @param int $quantity
* @param float $quantity
*/
public function setQuantity(int $quantity): void
public function setQuantity(float $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'))]);
$api = $this->getApi([new BadResponseException('', new Request('GET', 'test'), new Response())]);
$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,"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.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);
$item->setQuantity(1.1);
$item->setSum(100.1);
$item->setMeasurementUnit('kg');
$item->setPaymentMethod(ReceiptItemRequest::PAYMENT_METHOD_ADVANCE);

View file

@ -1,13 +1,3 @@
<?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;
return require __DIR__.'/../vendor/autoload.php';