From e11425e338949db0cf9624baaa261b88a5cc2fb2 Mon Sep 17 00:00:00 2001 From: Artem Dubinin <2788396+shoman4eg@users.noreply.github.com> Date: Fri, 15 Apr 2022 00:38:38 +0200 Subject: [PATCH] Release 0.2.3 (#13) --- CHANGELOG.md | 9 +++++++++ README.md | 1 + composer.json | 2 +- src/Api/Income.php | 11 ++++------- src/Api/Invoice.php | 7 +++++-- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a5a28d..cf48991 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,12 +4,21 @@ All notable changes to this project will be documented in this file. +## [0.2.3](https://github.com/shoman4eg/moy-nalog/compare/v0.2.2...v0.2.3) (2022-04-11) +### Fix +* Change uses for avoid className conflicts +* Update README + +--- + ## [0.2.2](https://github.com/shoman4eg/moy-nalog/compare/v0.2.1...v0.2.2) (2022-04-11) ### Fix * Remove unused files * Fix composer.json version * Update .gitattributes +--- + ## [0.2.1](https://github.com/shoman4eg/moy-nalog/compare/v0.2.0...v0.2.1) (2022-04-11) ### Documentation diff --git a/README.md b/README.md index 4d7f9ca..85a9fea 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ [![Php version](https://img.shields.io/packagist/php-v/shoman4eg/moy-nalog?style=flat-square)](composer.json) [![Latest Version](https://img.shields.io/github/release/shoman4eg/moy-nalog.svg?style=flat-square)](https://github.com/shoman4eg/moy-nalog/releases) [![Total Downloads](https://img.shields.io/packagist/dt/shoman4eg/moy-nalog.svg?style=flat-square)](https://packagist.org/packages/shoman4eg/moy-nalog) +[![Scrutinizer code quality](https://img.shields.io/scrutinizer/quality/g/shoman4eg/moy-nalog/master?style=flat-square)](https://scrutinizer-ci.com/g/shoman4eg/moy-nalog/?branch=master) [![Packagist License](https://img.shields.io/packagist/l/shoman4eg/moy-nalog?style=flat-square)](LICENSE) An unofficial wrapper client for [lknpd.nalog.ru](https://lknpd.nalog.ru/) API diff --git a/composer.json b/composer.json index 15cfd02..0d4ad92 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "shoman4eg/moy-nalog", "description": "An unofficial wrapper client for lknpd.nalog.ru API", "license": "MIT", - "version": "0.2.2", + "version": "0.2.3", "keywords": [ "api", "nalog.ru" diff --git a/src/Api/Income.php b/src/Api/Income.php index 12b1d07..46c3b42 100644 --- a/src/Api/Income.php +++ b/src/Api/Income.php @@ -1,5 +1,4 @@ getIncomeType() === IncomeTypeEnum::LEGAL_ENTITY) { + if ($client !== null && $client->getIncomeType() === Enum\IncomeType::LEGAL_ENTITY) { Assert::notEmpty($client->getInn(), 'Client INN cannot be empty'); Assert::numeric($client->getInn(), 'Client INN must contain only numbers'); Assert::lengthBetween($client->getInn(), 10, 12, 'Client INN length must been 10 or 12'); @@ -57,7 +54,7 @@ public function create( 'services' => [new DTO\IncomeServiceItem($name, $amount, $quantity)], 'totalAmount' => (string)$totalAmount, 'client' => $client ?? new DTO\IncomeClient(), - 'paymentType' => PaymentType::CASH, + 'paymentType' => Enum\PaymentType::CASH, 'ignoreMaxTotalIncomeRestriction' => false, ]); @@ -81,7 +78,7 @@ public function cancel( ?string $partnerCode = null ): IncomeInfoType { Assert::notEmpty($receiptUuid, 'ReceiptUuid cannot be empty'); - Assert::inArray($comment, CancelCommentType::all(), 'Comment is invalid. Must be one of: %2$s'); + Assert::inArray($comment, Enum\CancelCommentType::all(), 'Comment is invalid. Must be one of: %2$s'); $response = $this->httpPost('/cancel', [ 'operationTime' => new DTO\DateTime($operationTime ?: new \DateTimeImmutable()), diff --git a/src/Api/Invoice.php b/src/Api/Invoice.php index 85d577c..d14ee7f 100644 --- a/src/Api/Invoice.php +++ b/src/Api/Invoice.php @@ -6,11 +6,14 @@ use Brick\Math\BigDecimal; use Psr\Http\Client\ClientExceptionInterface; use Shoman4eg\Nalog\DTO; -use Shoman4eg\Nalog\Enum\PaymentType; +use Shoman4eg\Nalog\Enum; use Shoman4eg\Nalog\Exception; use Shoman4eg\Nalog\Model\Income\IncomeType; use Webmozart\Assert\Assert; +/** + * @author Artem Dubinin + */ class Invoice extends BaseHttpApi { /** @@ -37,7 +40,7 @@ public function create( $totalAmount = BigDecimal::of($amount)->multipliedBy($quantity); $response = $this->httpPost('/invoice', [ - 'paymentType' => PaymentType::ACCOUNT, + 'paymentType' => Enum\PaymentType::ACCOUNT, 'ignoreMaxTotalIncomeRestriction' => false, 'client' => new DTO\IncomeClient(), 'services' => [new DTO\InvoiceServiceItem($name, $amount, $quantity)],