Skip to content

Commit

Permalink
Release 0.2.3 (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
shoman4eg authored Apr 14, 2022
1 parent 6563d91 commit e11425e
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,21 @@
All notable changes to this project will be documented in this file.
<!--- END HEADER -->

## [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
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
11 changes: 4 additions & 7 deletions src/Api/Income.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
<?php

declare(strict_types=1);

namespace Shoman4eg\Nalog\Api;

use Brick\Math\BigDecimal;
use Psr\Http\Client\ClientExceptionInterface;
use Shoman4eg\Nalog\DTO;
use Shoman4eg\Nalog\Enum\CancelCommentType;
use Shoman4eg\Nalog\Enum\IncomeType as IncomeTypeEnum;
use Shoman4eg\Nalog\Enum\PaymentType;
use Shoman4eg\Nalog\Enum;
use Shoman4eg\Nalog\Exception;
use Shoman4eg\Nalog\Model\Income\IncomeInfoType;
use Shoman4eg\Nalog\Model\Income\IncomeType;
Expand Down Expand Up @@ -42,7 +39,7 @@ public function create(
Assert::numeric($quantity, 'Quantity must be int or float');
Assert::greaterThan($quantity, 0, 'Quantity must be greater than %2$s');

if ($client !== null && $client->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');
Expand All @@ -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,
]);

Expand All @@ -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()),
Expand Down
7 changes: 5 additions & 2 deletions src/Api/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 <artem@dubinin.me>
*/
class Invoice extends BaseHttpApi
{
/**
Expand All @@ -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)],
Expand Down

0 comments on commit e11425e

Please sign in to comment.