- Added `virkdata` class to handle API operations for company information retrieval and config validation. - Introduced `virkdata_i` interface and supporting helpers: `virkdata_request_parameters`, `virkdata_response`, and enums for formats, countries, and error codes. - Implemented new routes: `/worker/debug`, `/worker/licenseplates`, `/cvr/lookup`, and `/economic/doesCustomerExist`. - Added module `Virkdata` route for searching company data and fetching/updating configurations (`moduleVirkDataRoute`). - Created `virkdata` module configurations: `enabled`, `secret_key`, and `monthly_limit`. - Integrated virkdata initialization in `index.php`.
54 lines
1.9 KiB
PHP
54 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace interfaces;
|
|
|
|
use Exception;
|
|
use modules\virkdata\helpers\virkdata_response;
|
|
|
|
interface virkdata_i
|
|
{
|
|
/**
|
|
* Get company information from the virkdata module
|
|
* @return virkdata_response The response from the virkdata module
|
|
* @param string $search The search term to use
|
|
* @param string $endpoint The endpoint to send the request to (e.g. "search")
|
|
* @param array $data The data to send with the request (e.g. ["key" => "value"])
|
|
* @return virkdata_response The response from the virkdata module
|
|
*/
|
|
function getCompanyInformation(string $search, string $endpoint, array $data): virkdata_response;
|
|
|
|
|
|
/**
|
|
* Send a request to the
|
|
* @param string $search The search term to use
|
|
* @param string $endpoint The endpoint to send the request to (e.g. "latest")
|
|
* @param array $data The data to send with the request (e.g. ["key" => "value"])
|
|
* @param string $method The method to use for the request (e.g. "GET")
|
|
* @return object The response from the virkdata module
|
|
*/
|
|
function sendRequest(string $search, string $endpoint, array $data, string $method): object;
|
|
|
|
/**
|
|
* Require the module to be enabled
|
|
* @return void
|
|
* @throws Exception If the module is not enabled
|
|
*/
|
|
function requireModuleEnabled(): void;
|
|
|
|
|
|
/**
|
|
* Require the secret key to be valid
|
|
* @return void
|
|
* @throws Exception If the secret key is not valid
|
|
*/
|
|
function requireValidSecretKey(): void;
|
|
|
|
/**
|
|
* Send a GET request to the virkdata
|
|
* @param string $search The search term to use
|
|
* @param string $endpoint The endpoint to send the request to (e.g. "latest")
|
|
* @param array $data The data to send with the request (e.g. ["key" => "value"])
|
|
* @return object The response from the virkdata
|
|
*/
|
|
function sendGetRequest(string $search, string $endpoint, array $data): object;
|
|
} |