Skip to content
This repository has been archived by the owner on Jul 18, 2024. It is now read-only.

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mlevent committed Dec 18, 2022
0 parents commit 5701d9f
Show file tree
Hide file tree
Showing 9 changed files with 815 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/vendor
209 changes: 209 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
# 💸 İnteraktif Vergi Dairesi

GİB İnteraktif Vergi Dairesi üzerinden şifresiz/şifreli işlemlere olanak tanır.

- https://ivd.gib.gov.tr

## Kurulum

🛠️ Paketi composer ile projenize dahil edin;

```bash
composer require mlevent/ivd
```

## Kullanım

```php
use Mlevent\Ivd\IvdException;
use Mlevent\Ivd\IvdService;

try {

// Şifresiz Giriş
$ivd = (new IvdService)->login();

// Vergi Numarası Doğrulama
$result = $ivd->taxIdVerification(
trId : '11111111111',
province : '016',
taxOffice : '016252'
);

print_r($result);

// Oturumu Sonlandır
$ivd->logout();

} catch(IvdException $e){

print_r($e->getMessage());
print_r($e->getResponse());
print_r($e->getRequest());
}
```

### Gerçek Kullanıcı

Kullanıcı bilgilerinizi `setCredentials` ya da `login` metoduyla tanımlayabilirsiniz.

```php
use Mlevent\Ivd\IvdService;

// Kullanıcı Bilgileriyle Giriş
$ivd = (new IvdService)->login('TC Kimlik No', 'Parola');

// Şirketlerdeki Ortaklık ve Yöneticilik Bilgileri
print_r($ivd->getPartnerships());
```

> Not: Token değerini herhangi bir yerde kullanmanız gerekmeyecek.
## Şifresiz İşlemler

İnteraktif Vergi Dairesi üzerindeki bazı servisler şifresiz/giriş yapmadan kullanılabilir;

#### Vergi Kimlik Numarası Sorgulama

```php
$result = $ivd->taxIdInquiry(
name : 'Mert', // Zorunlu · Ad
lastName : 'Levent', // Zorunlu · Soyad
fatherName : 'Walter', // Zorunlu · Baba Adı
province : '016', // Zorunlu · İl
dateOfBirth : '19890511' // Zorunlu · Doğum Tarihi
);

print_r($result);
```

#### Yabancılar İçin Vergi Kimlik Numarasından Sorgulama

```php
$result = $ivd->taxIdInquiryForForeigners(
taxId : '1234567890' // Zorunlu · Vergi Numarası
);

print_r($result);
```

#### Vergi Kimlik Numarası Doğrulama

```php
$result = $ivd->taxIdVerification(
//taxId : '1234567890', // Opsiyonel · Vergi Numarası
trId : '11111111111', // Opsiyonel · TcKN
province : '016', // Zorunlu · İl
taxOffice : '016252' // Zorunlu · Vergi Dairesi
);

print_r($result);
```

#### Diğer Metodlar

```php
print_r($ivd->getTaxOffices()); // Vergi Daireleri
print_r($ivd->getTaxList()); // Vergiler
print_r($ivd->getCountries()); // Ülkeler
print_r($ivd->getProvinces()); // İller
print_r($ivd->getProvincesAndDistricts()); // İller ve İlçeler
```

## Şifreli İşlemler

İnteraktif Vergi Dairesinde kayıtlı TcKN ve şifre bilgileriyle oturum açılarak kullanılabilecek metodlar;

#### Sicil Kaydı

```php
$ivd->getRegistry();
```

#### Kimlik Bilgileri

```php
$ivd->getIdInformation();
```

#### Şirketlerdeki Ortaklık ve Yöneticilik Bilgileri

```php
$ivd->getPartnerships();
```

#### Borç Durumu

```php
$ivd->getDebtStatus();
```

#### KYK Borç Durumu

```php
$ivd->getKYKDebtStatus();
```

#### Banka Hesaplarına Uygulanan Elektronik Hacizler

```php
$ivd->getGarnishmentsAppliedToBankAccounts();
```

#### Araçlara Uygulanan Elektronik Hacizler

```php
$ivd->getGarnishmentsAppliedToVehicles();
```

#### Mevcut Araç Bilgileri

```php
$ivd->getCurrentVehicles();
```

#### Geçmiş Araç Bilgileri

```php
$ivd->getPreviousVehicles();
```

#### Vergi Ceza İhbarname Bilgileri

```php
$ivd->getTaxPenaltyNoticeInformation();
```

#### Sanal Pos Ödemeleri

```php
$ivd->getVirtualPosPayments(
year: 2018 // Zorunlu · Yıl
);
```

#### E-Devlet Ödemeleri

```php
$ivd->getEDevletPayments(
year: 2018 // Zorunlu · Yıl
);
```

#### Diğer Ödemeler

```php
$ivd->getOtherPayments(
year: 2018 // Zorunlu · Yıl
);
```

#### Servis Mesajları

```php
$ivd->getServiceMessages();
```

## 📧İletişim

İletişim için [email protected] adresine e-posta gönderin.
27 changes: 27 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "mlevent/ivd",
"description": "İnternet Vergi Dairesi Yardımcı Aracı",
"keywords": [
"gib",
"ivd",
"interaktif vergi dairesi",
"maliye",
"vergi"
],
"autoload": {
"psr-4": {
"Mlevent\\Ivd\\": "src/"
}
},
"authors": [
{
"name": "mlevent",
"email": "[email protected]"
}
],
"require": {
"php": "^8.0"
},
"minimum-stability": "dev",
"prefer-stable": true
}
20 changes: 20 additions & 0 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions examples/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php declare(strict_types=1); error_reporting(E_ALL); require dirname(__DIR__).'/vendor/autoload.php';

use Mlevent\Ivd\IvdException;
use Mlevent\Ivd\IvdService;

try {

$ivd = (new IvdService())->login();

var_dump($ivd->getTaxList());

$ivd->logout();

} catch(IvdException $e){

print_r($e->getMessage());
print_r($e->getResponse());
print_r($e->getRequest());
}
33 changes: 33 additions & 0 deletions src/Autoload.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

spl_autoload_register(
function ($class) {
// project-specific namespace prefix. Will only kicks in for Mlevent namespace.
$prefix = 'Mlevent\\';

// base directory for the namespace prefix.
$base_dir = __DIR__; // By default, it points to this same folder.
// You may change this path if having trouble detecting the path to
// the source files.

// does the class use the namespace prefix?
$len = strlen($prefix);
if (strncmp($prefix, $class, $len) !== 0) {
// no, move to the next registered autoloader.
return;
}

// get the relative class name.
$relative_class = substr($class, $len);

// replace the namespace prefix with the base directory, replace namespace
// separators with directory separators in the relative class name, append
// with .php
$file = $base_dir . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $relative_class) . '.php';

// if the file exists, require it
if (file_exists($file)) {
require $file;
}
}
);
62 changes: 62 additions & 0 deletions src/IvdException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php

declare(strict_types=1);

namespace Mlevent\Ivd;

use Exception;

class IvdException extends Exception
{
/**
* @var array
*/
private $request;

/**
* @var array
*/
private $response;

public function __construct(
string $message = null,
mixed $request = null,
mixed $response = null,
int $code = 0,
Exception $previous = null,
) {
parent::__construct($message, $code, $previous);
$this->response = $response;
$this->request = $request;
}

/**
* getResponse
*
* @return mixed
*/
public function getResponse(): mixed
{
return $this->response;
}

/**
* hasResponse
*
* @return boolean
*/
public function hasResponse(): bool
{
return $this->response !== null;
}

/**
* getRequest
*
* @return mixed
*/
public function getRequest(): mixed
{
return $this->request;
}
}
Loading

0 comments on commit 5701d9f

Please sign in to comment.