tarfin-labs/tax-identification-number

用于验证税识别号的API客户端。

v1.2.0 2023-05-11 14:25 UTC

This package is auto-updated.

Last update: 2024-09-11 17:28:28 UTC


README

Latest Version on Packagist Total Downloads GitHub Actions

简介

使用此包,您可以通过城市车牌获取税务机关,并在GIB(Gelir İdaresi Başkanlığı)上验证税识别号。

此包需要PHP 7.4 或更高版本。

安装

您可以通过composer安装此包

composer require tarfin-labs/tax-identification-number

用法

按城市车牌列出税务机关

use TarfinLabs\TaxIdentificationNumber\Validation;
use TarfinLabs\TaxIdentificationNumber\Exceptions\NotFoundException;

try {
    $offices = Validation::init()->getTaxOfficesByCityPlate(34);
} catch (NotFoundException $e) {
    echo $e->getMessage();
}

输出

[
    [
        "code" => "034XXX",
        "name" => "TAX OFFICE NAME 1",
    ],
    [
        "code" => "034XXY",
        "name" => "TAX OFFICE NAME 2
    ],
]

验证税识别号

use TarfinLabs\TaxIdentificationNumber\Validation;

try {
    $response = Validation::init()->validate(1234567890, '034455');
    
    $response->isValid(); // boolean
    $response->getStatus(); // "1"
    $response->getTckn(); // ""
    $response->getStatusText(); // "FAAL"
    $response->getTaxNumber(); // "123123123"
    $response->getTaxOfficeNumber(); // "034455"
    $response->getCompanyTitle(); // "ACME INC."
} catch (\Throwable $e) {
    echo $e->getMessage();
}

如果您想验证个体工商户的TCKN,您需要将TCKN(11位)作为第一个参数传递给validate()方法。

use TarfinLabs\TaxIdentificationNumber\Validation;

try {
    $response = Validation::init()->validate(12345678902, '034455');
    
    $response->isValid(); // boolean
    $response->getStatus(); // "1"
    $response->getTckn(); // "12345678902"
    $response->getStatusText(); // "FAAL"
    $response->getTaxNumber(); // "9999999999"
    $response->getTaxOfficeNumber(); // "034455"
    $response->getCompanyTitle(); // "METİN KAYA"
} catch (\Throwable $e) {
    echo $e->getMessage();
}

测试

composer test

变更日志

有关最近更改的更多信息,请参阅CHANGELOG

贡献

有关详细信息,请参阅CONTRIBUTING

安全性

如果您发现任何安全相关的问题,请通过电子邮件development@tarfin.com联系,而不是使用问题跟踪器。

鸣谢

许可证

MIT许可证(MIT)。有关更多信息,请参阅许可证文件