dmt-software/

insolvency-client

破产 SOAP 服务客户端

v1.0.0 2022-07-19 19:07 UTC

This package is auto-updated.

Last update: 2024-09-20 01:41:56 UTC


README

Build Status Scrutinizer Code Quality Code Coverage

这是一个荷兰 rechtspraak.nl 网络服务破产客户端。

安装

composer require dmt-software/insolvency-client

使用

在使用此服务器之前,请访问 rechtspraak.nl 并阅读 技术文档(荷兰语)

use DMT\Insolvency\Client;
use DMT\Insolvency\Config;
use DMT\Insolvency\Exception\Exception;
use DMT\Insolvency\Exception\RequestException;
use DMT\CommandBus\Validator\ValidationException;
use Psr\Http\Client\ClientInterface;
use Psr\Http\Message\RequestFactoryInterface;
 
$client = new Client(
    new Config([
        'user' => '{{ username }}',
        'password' => '{{ password }}'
    ]),
    /** @var ClientInterface $httpClient */
    $httpClient,
    /** @var RequestFactoryInterface $requestFactory */
    $requestFactory,
);

try {
    $publicatieLijst = $client->searchUndertaking(
       '{{ company name }}',
       '{{ kvk-number }}' // chamber of commerce number
    );

    foreach ($publicatieLijst->publicaties as $publicatie) {
        if (!in_array($publicatie->publicatieKenmerk, (array)$cachedPublications)) {
            $insolvente = $publicatie->insolvente; // lazy loads insolvency 
        }
    }
} catch (RequestException $exception) {
    // user input errors
    $message = $exception->getMessage();
    if ($exception->getPrevious() instanceof ValidationException) {
        $message = (string) $exception->getPrevious()->getViolations();
    }
    echo $message;
} catch (Exception $exception) {
    // server error
}