Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Azare77 committed Nov 4, 2023
0 parents commit 9b5212a
Show file tree
Hide file tree
Showing 32 changed files with 7,775 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Test

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Validate composer.json and composer.lock
run: composer validate --strict

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: Run test suite
run: composer run-script test
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
vendor
.idea
.vscode
.php-cs-fixer.cache
52 changes: 52 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php

declare(strict_types=1);

$finder = PhpCsFixer\Finder::create()
->in([
__DIR__ . '/src',
__DIR__ . '/tests',
])
->name('*.php')
->ignoreDotFiles(true)
->ignoreVCS(true);

$config = (new PhpCsFixer\Config())
->setRules([
'@PSR12' => true,
'@PSR12:risky' => true,
'array_syntax' => ['syntax' => 'short'],
'ordered_imports' => [
'imports_order' => null,
'sort_algorithm' => 'alpha',
],
'phpdoc_types_order' => [
'null_adjustment' => 'always_last',
'sort_algorithm' => 'alpha',
],
'multiline_whitespace_before_semicolons' => [
'strategy' => 'no_multi_line',
],
'comment_to_phpdoc' => true,
'no_empty_phpdoc' => true,
'no_superfluous_phpdoc_tags' => [
'allow_mixed' => true,
'allow_unused_params' => false,
'remove_inheritdoc' => true,
],
'array_indentation' => true,
'binary_operator_spaces' => ['default' => 'single_space'],
'concat_space' => ['spacing' => 'one'],
'no_unused_imports' => true,
'phpdoc_scalar' => true,
'simple_to_complex_string_variable' => true,
'single_quote' => [
'strings_containing_single_quote_chars' => true,
],
'class_attributes_separation' => [
'elements' => ['method' => 'one']
],
]);


return $config->setFinder($finder);
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Ali Zare

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.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Moadian - سامانه مودیان مالیانی

کد PHP برای اتصال به سامانه مودیان مالیاتی (نظام پایانه های فروشگاهی و سامانه مودیان).

PHP code for connecting to Moadian Maliati Organization (Store Terminals and Taxpayer System).

## Disclaimer
This software is provided as is without any warranty whatsoever, including accuracy and comprehensiveness. We are not associated with Moadian Maliati Organization and we have worked with the API just as simple clients so we are limited in the amount of support and help we can give regarding the functionality of the API. We have however personally used this package and have successfully submitted tens of thousands of invoices.

## Installation

```bash
composer require snapp-market-pro/moadian
```

## Usage

1. Generate an RSA key pair according to specifications in moadian admin panel.
2. Upload the public key of that key pair and get a username.
3. Following [get-tax-org-public-key](examples/get-tax-org-public-key.php) get Tax Organization public key and key ID and store them somewhere.
4. Construct the `Moadian` class with your private key, tax org public key, tax org key ID, your username and base url of tax org api if needed.
5. Login and set the received token on `Moadian` class.
6. Send Invoices or Inquire their status by reference numbers following [send-invoices](examples/send-invoices.php) or [inquire-by-reference-numbers](examples/inquire-by-reference-numbers.php).
51 changes: 51 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"name": "baradaran-co/moadian",
"type": "library",
"description": "PHP SDK for working with tp.tax.gov.ir (سامانه مودیان مالیاتی)",
"license": "MIT",
"autoload": {
"psr-4": {
"Baradaran\\Moadian\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Baradaran\\Moadian\\Tests\\": "tests"
}
},
"authors": [
{
"name": "Ali Rahimi",
"email": "[email protected]"
},
{
"name": "Amir Reza Mehbakhsh",
"email": "[email protected]"
},
{
"name": "Soheil Yousefi",
"email": "[email protected]"
},
{
"name": "Ali Zare",
"email": "[email protected]"
}
],
"require": {
"php": "^8.0",
"ext-openssl": "*",
"guzzlehttp/guzzle": "^7.5",
"ramsey/uuid": "^4.7",
"phpseclib/phpseclib": "~3.0"
},
"require-dev": {
"phpunit/phpunit": "^10.0",
"monolog/monolog": "^3.3",
"symfony/var-dumper": "^6.2",
"friendsofphp/php-cs-fixer": "^3.17"
},
"scripts": {
"test": "vendor/bin/phpunit tests --colors",
"cs-fix": "vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --diff --allow-risky=yes"
}
}
Loading

0 comments on commit 9b5212a

Please sign in to comment.