-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 306901e
Showing
50 changed files
with
1,835 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 4 | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.editorconfig export-ignore | ||
.gitattributes export-ignore | ||
.gitignore export-ignore | ||
/.php_cs export-ignore | ||
/tests/ export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[*.yml] | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
on: [ pull_request ] | ||
name: Roave | ||
jobs: | ||
roave_bc_check: | ||
name: BC Check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: Roave BC Check | ||
uses: docker://nyholm/roave-bc-check-ga |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Tests | ||
on: [ pull_request ] | ||
|
||
jobs: | ||
phpunit: | ||
name: PHPUnit | ||
runs-on: ubuntu-latest | ||
strategy: | ||
max-parallel: 10 | ||
matrix: | ||
php: [ '7.4', '8.0' ] | ||
|
||
steps: | ||
- name: Set up PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
coverage: none | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Download dependencies | ||
uses: ramsey/composer-install@v1 | ||
|
||
- name: Run tests | ||
run: ./vendor/bin/phpunit | ||
|
||
lowest: | ||
name: Lowest deps | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 7.4 | ||
coverage: none | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Download dependencies | ||
with: | ||
dependency-versions: "lowest" | ||
uses: ramsey/composer-install@v1 | ||
|
||
- name: Run tests | ||
run: ./vendor/bin/phpunit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
on: [ pull_request ] | ||
name: Static analysis | ||
|
||
jobs: | ||
phpstan: | ||
name: PHPStan | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 8.0 | ||
coverage: none | ||
tools: phpstan:0.12.92, cs2pr | ||
|
||
- name: Download dependencies | ||
uses: ramsey/composer-install@v1 | ||
|
||
- name: PHPStan | ||
run: phpstan analyze --no-progress --error-format=checkstyle | cs2pr | ||
|
||
php-cs-fixer: | ||
name: PHP-CS-Fixer | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 8.0 | ||
coverage: none | ||
tools: php-cs-fixer:2.19.0, cs2pr | ||
|
||
- name: PHP-CS-Fixer | ||
run: php-cs-fixer fix --dry-run --format=checkstyle | cs2pr | ||
|
||
psalm: | ||
name: Psalm | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 8.0 | ||
coverage: none | ||
tools: vimeo/psalm:4.8.1 | ||
|
||
- name: Download dependencies | ||
uses: ramsey/composer-install@v1 | ||
|
||
- name: Psalm | ||
run: psalm --no-progress --output-format=github | ||
|
||
composer-normalize: | ||
name: Composer Normalize | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 8.0 | ||
coverage: none | ||
tools: composer-normalize | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Normalize | ||
run: composer-normalize --dry-run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/.php-cs-fixer.cache | ||
/.phpunit.result.cache | ||
/composer.lock | ||
/phpunit.xml | ||
/vendor/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
$finder = (new PhpCsFixer\Finder()) | ||
->in([ | ||
__DIR__.'/src', | ||
__DIR__.'/tests', | ||
]) | ||
; | ||
|
||
return (new PhpCsFixer\Config()) | ||
->setFinder($finder) | ||
->setRiskyAllowed(true) | ||
->setRules([ | ||
'@PhpCsFixer' => true, | ||
'cast_spaces' => ['space' => 'none'], | ||
'trailing_comma_in_multiline' => true, | ||
'blank_line_after_opening_tag' => false, | ||
'array_indentation' => true, | ||
'void_return' => true, | ||
'trim_array_spaces' => true, | ||
'yoda_style' => ['identical' => false], | ||
'phpdoc_add_missing_param_annotation' => true, | ||
'multiline_whitespace_before_semicolons' => [ | ||
'strategy' => 'new_line_for_chained_calls' | ||
], | ||
'ordered_imports' => [ | ||
'sort_algorithm' => 'alpha', | ||
'imports_order' => [ | ||
'class', | ||
'const', | ||
'function', | ||
], | ||
], | ||
'class_attributes_separation' => [ | ||
'elements' => [ | ||
'const' => 'none', | ||
'method' => 'one', | ||
'property' => 'none', | ||
'trait_import' => 'one', | ||
], | ||
], | ||
'blank_line_before_statement' => [ | ||
'statements' => [ | ||
'break', | ||
'continue', | ||
'return', | ||
'throw', | ||
'try', | ||
], | ||
], | ||
]) | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!--- BEGIN HEADER --> | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
<!--- END HEADER --> | ||
|
||
## [0.1.0](https://github.com/shoman4eg/moy-nalog/compare/...v0.1.0) (2022-02-01) | ||
|
||
--- | ||
Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2019 Tobias Nyholm | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Unofficial MoyNalog API client | ||
|
||
[](https://github.com/shoman4eg/moy-nalog/releases) | ||
[](https://packagist.org/packages/shoman4eg/moy-nalog) | ||
|
||
An unofficial wrapper client for lknpd.nalog.ru API | ||
|
||
## Install | ||
|
||
Via Composer | ||
|
||
``` bash | ||
$ composer require shoman4eg/moy-nalog | ||
``` | ||
|
||
## Usage | ||
|
||
``` php | ||
$apiClient = ApiClient::create(); | ||
$accessToken = $apiClient->createNewAccessToken($username, $password); | ||
$apiClient->authenticate($accessToken); | ||
$name = 'Предоставление информационных услуг #970/2495'; | ||
$quantity = 1; | ||
$amount = 1; | ||
$operationTime = new DateTimeImmutable('2020-12-31 12:12:00'); | ||
$createdIncome = $apiClient->income()->create($name, $amount, $quantity, $operationTime); | ||
``` | ||
|
||
## Changelog | ||
[Changelog](CHANGELOG.md): A complete changelog | ||
|
||
## License | ||
|
||
The MIT License (MIT). Please see [License File](LICENSE) for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"name": "shoman4eg/moy-nalog", | ||
"description": "An unofficial wrapper client for lknpd.nalog.ru API", | ||
"keywords": [ | ||
"api", | ||
"nalog.ru" | ||
], | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Artem Dubinin", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"php": ">=7.4||^8.0", | ||
"ext-json": "*", | ||
"ext-mbstring": "*", | ||
"php-http/client-common": "^2.0", | ||
"php-http/discovery": "^1.7", | ||
"psr/http-client": "^1.0", | ||
"psr/http-factory": "^1.0", | ||
"webmozart/assert": "^1.4", | ||
"brick/math": "^0.9" | ||
}, | ||
"require-dev": { | ||
"roave/security-advisories": "dev-latest", | ||
"php-http/curl-client": "^2.0", | ||
"php-http/message": "^1.0", | ||
"php-http/message-factory": "^1.0", | ||
"phpunit/phpunit": "^9.5", | ||
"nyholm/nsa": "^1.3", | ||
"guzzlehttp/guzzle": "^7.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Shoman4eg\\Nalog\\": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Shoman4eg\\Nalog\\Tests\\": "tests/" | ||
} | ||
}, | ||
"version": "0.1.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
parameters: | ||
level: 5 | ||
paths: | ||
- src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<phpunit backupGlobals="false" | ||
backupStaticAttributes="false" | ||
colors="false" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false" | ||
bootstrap="./vendor/autoload.php" | ||
> | ||
|
||
<testsuites> | ||
<testsuite name="Test Suite"> | ||
<directory>./tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<filter> | ||
<whitelist> | ||
<directory suffix=".php">src</directory> | ||
</whitelist> | ||
</filter> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<files psalm-version="4.8.1@f73f2299dbc59a3e6c4d66cff4605176e728ee69"> | ||
<file src="src/Api/BaseHttpApi.php"> | ||
<PossiblyInvalidArgument occurrences="1"> | ||
<code>$body</code> | ||
</PossiblyInvalidArgument> | ||
<PossiblyNullArgument occurrences="1"> | ||
<code>$this->createJsonBody($params)</code> | ||
</PossiblyNullArgument> | ||
</file> | ||
</files> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0"?> | ||
<psalm | ||
errorLevel="3" | ||
resolveFromConfigFile="true" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns="https://getpsalm.org/schema/config" | ||
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" | ||
errorBaseline="psalm.baseline.xml" | ||
> | ||
<projectFiles> | ||
<directory name="src" /> | ||
<ignoreFiles> | ||
<directory name="vendor" /> | ||
</ignoreFiles> | ||
</projectFiles> | ||
</psalm> |
Oops, something went wrong.