├── src ├── ClientInterface.php ├── Api │ ├── ApiInterface.php │ ├── AbstractApi.php │ ├── OrdersLine.php │ ├── InvoicesLine.php │ ├── PriceQuotesLine.php │ ├── CreditInvoicesLine.php │ ├── Attachments.php │ ├── Groups.php │ ├── Products.php │ ├── Services.php │ ├── Handles.php │ ├── Creditors.php │ ├── Orders.php │ ├── Tickets.php │ ├── Debtors.php │ ├── CreditInvoices.php │ ├── Vps.php │ ├── PriceQuotes.php │ ├── Hosting.php │ ├── Ssl.php │ ├── Domains.php │ └── Invoices.php ├── helpers.php ├── Facade.php ├── HttpClient │ ├── HttpClientInterface.php │ └── HttpClient.php ├── Authentication │ └── User.php ├── ServiceProvider.php ├── Providers │ └── HostFactProvider.php ├── HostFact.php └── Client.php ├── .github ├── dependabot.yml └── workflows │ └── run-tests.yml ├── config └── hostfact.php ├── CHANGELOG.md ├── LICENSE.md ├── composer.json ├── CONTRIBUTING.md └── README.md /src/ClientInterface.php: -------------------------------------------------------------------------------- 1 | env('HOSTFACT_CONNECTION', 'default'), 6 | 7 | 'panels' => [ 8 | 9 | 'default' => [ 10 | 'url' => env('HOSTFACT_DEFAULT_URL'), 11 | 'key' => env('HOSTFACT_DEFAULT_KEY'), 12 | ], 13 | 14 | ], 15 | 16 | 'client_options' => [ 17 | 18 | \GuzzleHttp\RequestOptions::COOKIES => true, 19 | \GuzzleHttp\RequestOptions::CONNECT_TIMEOUT => 10, 20 | \GuzzleHttp\RequestOptions::TIMEOUT => 10, 21 | \GuzzleHttp\RequestOptions::ALLOW_REDIRECTS => false, 22 | 23 | ], 24 | 25 | ]; 26 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to `laravel-hostfact` will be documented in this file 4 | 5 | ## 1.7.0 - 2020-12-06 6 | 7 | - Adding support for PHP 8.0, ditched PHP 7.2 and PHP 7.3 8 | 9 | ## 1.6.0 - 2020-09-18 10 | 11 | - Adding support for Laravel 8 12 | 13 | ## 1.5.0 - 2020-02-24 14 | 15 | - Adding support for Laravel 7 16 | - Dropping support for Laravel 5.8 17 | 18 | ## 1.4.0 - 2019-12-02 19 | 20 | - Added support for PHP 7.4 21 | 22 | ## 1.3.1 - 2019-09-11 23 | 24 | - Fixed 'Call to a member function request() on null' 25 | 26 | ## 1.3.0 - 2019-09-04 27 | 28 | - Added support for Laravel 6 29 | -------------------------------------------------------------------------------- /src/HttpClient/HttpClientInterface.php: -------------------------------------------------------------------------------- 1 | client = $client; 19 | } 20 | 21 | /** 22 | * @param array $parameters 23 | * @return mixed 24 | * @throws \GuzzleHttp\Exception\GuzzleException 25 | */ 26 | protected function post($parameters) 27 | { 28 | return $this->client->getHttpClient()->post(array_merge([ 29 | 'api_key' => $this->client->getHttpClient()->getOptions()['key'] 30 | ], $parameters)); 31 | } 32 | } -------------------------------------------------------------------------------- /src/Api/OrdersLine.php: -------------------------------------------------------------------------------- 1 | post(array_merge(['controller' => 'orderline', 'action' => 'add'], $params)); 16 | } 17 | 18 | /** 19 | * @see https://www.hostfact.nl/developer/api/bestellingen/orderline-delete 20 | * @param $params 21 | * @return mixed 22 | * @throws \GuzzleHttp\Exception\GuzzleException 23 | */ 24 | public function delete($params) 25 | { 26 | return $this->post(array_merge(['controller' => 'orderline', 'action' => 'delete'], $params)); 27 | } 28 | } -------------------------------------------------------------------------------- /src/Api/InvoicesLine.php: -------------------------------------------------------------------------------- 1 | post(array_merge(['controller' => 'invoiceline', 'action' => 'add'], $params)); 16 | } 17 | 18 | /** 19 | * @see https://www.hostfact.nl/developer/api/facturen/invoiceline-delete 20 | * @param $params 21 | * @return mixed 22 | * @throws \GuzzleHttp\Exception\GuzzleException 23 | */ 24 | public function delete($params) 25 | { 26 | return $this->post(array_merge(['controller' => 'invoiceline', 'action' => 'delete'], $params)); 27 | } 28 | } -------------------------------------------------------------------------------- /src/Api/PriceQuotesLine.php: -------------------------------------------------------------------------------- 1 | post(array_merge(['controller' => 'pricequoteline', 'action' => 'add'], $params)); 16 | } 17 | 18 | /** 19 | * @see https://www.hostfact.nl/developer/api/offertes/pricequoteline-delete 20 | * @param $params 21 | * @return mixed 22 | * @throws \GuzzleHttp\Exception\GuzzleException 23 | */ 24 | public function delete($params) 25 | { 26 | return $this->post(array_merge(['controller' => 'pricequoteline', 'action' => 'delete'], $params)); 27 | } 28 | } -------------------------------------------------------------------------------- /src/Api/CreditInvoicesLine.php: -------------------------------------------------------------------------------- 1 | post(array_merge(['controller' => 'creditinvoiceline', 'action' => 'add'], $params)); 16 | } 17 | 18 | /** 19 | * @see https://www.hostfact.nl/developer/api/inkoopfacturen/creditinvoiceline-delete 20 | * @param $params 21 | * @return mixed 22 | * @throws \GuzzleHttp\Exception\GuzzleException 23 | */ 24 | public function delete($params) 25 | { 26 | return $this->post(array_merge(['controller' => 'creditinvoiceline', 'action' => 'delete'], $params)); 27 | } 28 | } -------------------------------------------------------------------------------- /src/Api/Attachments.php: -------------------------------------------------------------------------------- 1 | post(array_merge(['controller' => 'attachment', 'action' => 'add'], $params)); 15 | } 16 | 17 | /** 18 | * @param $params 19 | * @return mixed 20 | * @throws \GuzzleHttp\Exception\GuzzleException 21 | */ 22 | public function delete($params) 23 | { 24 | return $this->post(array_merge(['controller' => 'attachment', 'action' => 'delete'], $params)); 25 | } 26 | 27 | /** 28 | * @param $params 29 | * @return mixed 30 | * @throws \GuzzleHttp\Exception\GuzzleException 31 | */ 32 | public function download($params) 33 | { 34 | return $this->post(array_merge(['controller' => 'attachment', 'action' => 'download'], $params)); 35 | } 36 | } -------------------------------------------------------------------------------- /src/Authentication/User.php: -------------------------------------------------------------------------------- 1 | Identifier; 15 | } 16 | 17 | /** 18 | * @return string 19 | */ 20 | public function getAuthIdentifierName() 21 | { 22 | return 'Identifier'; 23 | } 24 | 25 | /** 26 | * @return string 27 | */ 28 | public function getAuthPassword() 29 | { 30 | return $this->SecurePassword; 31 | } 32 | 33 | /** 34 | * @return string 35 | */ 36 | public function getRememberToken() 37 | { 38 | // 39 | } 40 | 41 | /** 42 | * @return string 43 | */ 44 | public function getRememberTokenName() 45 | { 46 | // 47 | } 48 | 49 | /** 50 | * @param string $value 51 | * @return void 52 | */ 53 | public function setRememberToken($value) 54 | { 55 | // 56 | } 57 | } -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) nickurt 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nickurt/laravel-hostfact", 3 | "description": "HostFact for Laravel 6.x/7.x/8.x", 4 | "keywords": ["hostfact", "laravel"], 5 | "license": "MIT", 6 | "require": { 7 | "php": "^8.0|^7.4", 8 | "laravel/framework": "^6.0|^7.0|^8.0", 9 | "guzzlehttp/guzzle": "^6.3.1|^7.0.1" 10 | }, 11 | "require-dev": { 12 | "phpunit/phpunit" : "^7.5.15|^8.4|^9.3.3", 13 | "orchestra/testbench": "^4.0|^5.0|^6.0" 14 | }, 15 | "autoload": { 16 | "psr-4": { 17 | "nickurt\\HostFact\\": "src/" 18 | }, 19 | "files": [ 20 | "src/helpers.php" 21 | ] 22 | }, 23 | "autoload-dev": { 24 | "psr-4": { 25 | "nickurt\\HostFact\\tests\\": "tests" 26 | } 27 | }, 28 | "scripts": { 29 | "test": "vendor/bin/phpunit", 30 | "test-coverage": "vendor/bin/phpunit --coverage-html coverage" 31 | }, 32 | "minimum-stability": "dev", 33 | "prefer-stable": true, 34 | "extra": { 35 | "laravel": { 36 | "providers": [ 37 | "nickurt\\HostFact\\ServiceProvider" 38 | ], 39 | "aliases": { 40 | "HostFact": "nickurt\\HostFact\\Facade" 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/ServiceProvider.php: -------------------------------------------------------------------------------- 1 | publishes([ 15 | __DIR__ . '/../config/hostfact.php' => config_path('hostfact.php') 16 | ], 'config'); 17 | 18 | \Auth::provider('hostfact', function ($app, array $config) { 19 | return new \nickurt\HostFact\Providers\HostFactProvider(); 20 | }); 21 | } 22 | 23 | /** 24 | * Get the services provided by the provider. 25 | * 26 | * @return array 27 | */ 28 | public function provides() 29 | { 30 | return ['nickurt\HostFact\HostFact', 'HostFact']; 31 | } 32 | 33 | /** 34 | * Register the service provider. 35 | * 36 | * @return void 37 | */ 38 | public function register() 39 | { 40 | $this->app->singleton('nickurt\HostFact\HostFact', function ($app) { 41 | $hostFact = new HostFact($app); 42 | $hostFact->panel($hostFact->getDefaultPanel()); 43 | 44 | return $hostFact; 45 | }); 46 | 47 | $this->app->alias('nickurt\HostFact\HostFact', 'HostFact'); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /.github/workflows/run-tests.yml: -------------------------------------------------------------------------------- 1 | name: tests 2 | 3 | on: 4 | push: 5 | pull_request: 6 | schedule: 7 | - cron: '0 0 * * *' 8 | 9 | jobs: 10 | php-tests: 11 | runs-on: ${{ matrix.os }} 12 | 13 | strategy: 14 | matrix: 15 | php: [8.0, 7.4] 16 | laravel: [8.*, 7.*, 6.*] 17 | dependency-version: [prefer-lowest, prefer-stable] 18 | os: [ubuntu-latest] 19 | include: 20 | - laravel: 8.* 21 | testbench: 6.* 22 | - laravel: 7.* 23 | testbench: 5.* 24 | - laravel: 6.* 25 | testbench: 4.* 26 | 27 | name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} 28 | 29 | steps: 30 | - name: Checkout code 31 | uses: actions/checkout@v2 32 | 33 | - name: Setup PHP 34 | uses: shivammathur/setup-php@v2 35 | with: 36 | php-version: ${{ matrix.php }} 37 | extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick 38 | coverage: none 39 | 40 | - name: Install dependencies 41 | run: | 42 | composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update 43 | composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest 44 | 45 | - name: Execute tests 46 | run: vendor/bin/phpunit 47 | -------------------------------------------------------------------------------- /src/Providers/HostFactProvider.php: -------------------------------------------------------------------------------- 1 | debtors()->checkLogin($credentials); 17 | 18 | if ($checkLogin['status'] != 'error') { 19 | $user = new \nickurt\HostFact\Authentication\User(); 20 | $user->forceFill($checkLogin['debtor']); 21 | 22 | return $user; 23 | } 24 | 25 | return null; 26 | } 27 | 28 | /** 29 | * @param mixed $identifier 30 | * @return Authenticatable|mixed|null 31 | * @throws \Exception 32 | */ 33 | public function retrieveById($identifier) 34 | { 35 | return cache()->remember('hostfact_debtor_id_' . $identifier, 60, function () use ($identifier) { 36 | $response = app('HostFact')->debtors()->show(['Identifier' => $identifier]); 37 | 38 | $user = new \nickurt\HostFact\Authentication\User(); 39 | $user->forceFill($response['debtor']); 40 | 41 | return $user; 42 | }); 43 | } 44 | 45 | public function retrieveByToken($identifier, $token) 46 | { 47 | // 48 | } 49 | 50 | public function updateRememberToken(Authenticatable $user, $token) 51 | { 52 | // 53 | } 54 | 55 | /** 56 | * @param Authenticatable $user 57 | * @param array $credentials 58 | * @return bool 59 | */ 60 | public function validateCredentials(Authenticatable $user, array $credentials) 61 | { 62 | return true; 63 | } 64 | } -------------------------------------------------------------------------------- /src/Api/Groups.php: -------------------------------------------------------------------------------- 1 | post(array_merge(['controller' => 'group', 'action' => 'add'], $params)); 16 | } 17 | 18 | /** 19 | * @see https://www.hostfact.nl/developer/api/groepen/delete 20 | * @param $params 21 | * @return mixed 22 | * @throws \GuzzleHttp\Exception\GuzzleException 23 | */ 24 | public function delete($params) 25 | { 26 | return $this->post(array_merge(['controller' => 'group', 'action' => 'delete'], $params)); 27 | } 28 | 29 | /** 30 | * @see https://www.hostfact.nl/developer/api/groepen/edit 31 | * @param $params 32 | * @return mixed 33 | * @throws \GuzzleHttp\Exception\GuzzleException 34 | */ 35 | public function edit($params) 36 | { 37 | return $this->post(array_merge(['controller' => 'group', 'action' => 'edit'], $params)); 38 | } 39 | 40 | /** 41 | * @see https://www.hostfact.nl/developer/api/groepen/list 42 | * @param $params 43 | * @return mixed 44 | * @throws \GuzzleHttp\Exception\GuzzleException 45 | */ 46 | public function list($params) 47 | { 48 | return $this->post(array_merge(['controller' => 'group', 'action' => 'list'], $params)); 49 | } 50 | 51 | /** 52 | * @see https://www.hostfact.nl/developer/api/groepen/show 53 | * @param $params 54 | * @return mixed 55 | * @throws \GuzzleHttp\Exception\GuzzleException 56 | */ 57 | public function show($params) 58 | { 59 | return $this->post(array_merge(['controller' => 'group', 'action' => 'show'], $params)); 60 | } 61 | } -------------------------------------------------------------------------------- /src/Api/Products.php: -------------------------------------------------------------------------------- 1 | post(array_merge(['controller' => 'product', 'action' => 'add'], $params)); 16 | } 17 | 18 | /** 19 | * @see https://www.hostfact.nl/developer/api/producten/delete 20 | * @param $params 21 | * @return mixed 22 | * @throws \GuzzleHttp\Exception\GuzzleException 23 | */ 24 | public function delete($params) 25 | { 26 | return $this->post(array_merge(['controller' => 'product', 'action' => 'delete'], $params)); 27 | } 28 | 29 | /** 30 | * @see https://www.hostfact.nl/developer/api/producten/edit 31 | * @param $params 32 | * @return mixed 33 | * @throws \GuzzleHttp\Exception\GuzzleException 34 | */ 35 | public function edit($params) 36 | { 37 | return $this->post(array_merge(['controller' => 'product', 'action' => 'edit'], $params)); 38 | } 39 | 40 | /** 41 | * @see https://www.hostfact.nl/developer/api/producten/list 42 | * @param $params 43 | * @return mixed 44 | * @throws \GuzzleHttp\Exception\GuzzleException 45 | */ 46 | public function list($params) 47 | { 48 | return $this->post(array_merge(['controller' => 'product', 'action' => 'list'], $params)); 49 | } 50 | 51 | /** 52 | * @see https://www.hostfact.nl/developer/api/producten/show 53 | * @param $params 54 | * @return mixed 55 | * @throws \GuzzleHttp\Exception\GuzzleException 56 | */ 57 | public function show($params) 58 | { 59 | return $this->post(array_merge(['controller' => 'product', 'action' => 'show'], $params)); 60 | } 61 | } -------------------------------------------------------------------------------- /src/Api/Services.php: -------------------------------------------------------------------------------- 1 | post(array_merge(['controller' => 'service', 'action' => 'add'], $params)); 16 | } 17 | 18 | /** 19 | * @see https://www.hostfact.nl/developer/api/overige-diensten/edit 20 | * @param $params 21 | * @return mixed 22 | * @throws \GuzzleHttp\Exception\GuzzleException 23 | */ 24 | public function edit($params) 25 | { 26 | return $this->post(array_merge(['controller' => 'service', 'action' => 'edit'], $params)); 27 | } 28 | 29 | /** 30 | * @see https://www.hostfact.nl/developer/api/overige-diensten/list 31 | * @param $params 32 | * @return mixed 33 | * @throws \GuzzleHttp\Exception\GuzzleException 34 | */ 35 | public function list($params) 36 | { 37 | return $this->post(array_merge(['controller' => 'service', 'action' => 'list'], $params)); 38 | } 39 | 40 | /** 41 | * @see https://www.hostfact.nl/developer/api/overige-diensten/show 42 | * @param $params 43 | * @return mixed 44 | * @throws \GuzzleHttp\Exception\GuzzleException 45 | */ 46 | public function show($params) 47 | { 48 | return $this->post(array_merge(['controller' => 'service', 'action' => 'show'], $params)); 49 | } 50 | 51 | /** 52 | * @see https://www.hostfact.nl/developer/api/overige-diensten/terminate 53 | * @param $params 54 | * @return mixed 55 | * @throws \GuzzleHttp\Exception\GuzzleException 56 | */ 57 | public function terminate($params) 58 | { 59 | return $this->post(array_merge(['controller' => 'service', 'action' => 'terminate'], $params)); 60 | } 61 | } -------------------------------------------------------------------------------- /src/HttpClient/HttpClient.php: -------------------------------------------------------------------------------- 1 | client)) { 19 | $this->client = new \GuzzleHttp\Client(config('hostfact.client_options', [])); 20 | 21 | return $this->client; 22 | } 23 | 24 | return $this->client; 25 | } 26 | 27 | /** 28 | * @param $client 29 | * @return \GuzzleHttp\Client 30 | */ 31 | public function setClient($client) 32 | { 33 | $this->client = $client; 34 | 35 | return $this->client; 36 | } 37 | 38 | /** 39 | * @param array $body 40 | * @return mixed 41 | * @throws \GuzzleHttp\Exception\GuzzleException 42 | */ 43 | public function post($body = []) 44 | { 45 | return $this->request($body, 'POST'); 46 | } 47 | 48 | /** 49 | * @param $body 50 | * @param $method 51 | * @return mixed 52 | * @throws \GuzzleHttp\Exception\GuzzleException 53 | */ 54 | public function request($body, $method) 55 | { 56 | $response = $this->getClient()->request( 57 | $method, 58 | $this->getOptions()['base_url'], 59 | [ 60 | 'form_params' => $body 61 | ] 62 | ); 63 | 64 | return json_decode((string)$response->getBody(), true); 65 | } 66 | 67 | /** 68 | * @return array 69 | */ 70 | public function getOptions() 71 | { 72 | return $this->options; 73 | } 74 | 75 | /** 76 | * @param array $options 77 | */ 78 | public function setOptions(array $options) 79 | { 80 | $this->options = array_merge($this->options, $options); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/HostFact.php: -------------------------------------------------------------------------------- 1 | app = $app; 23 | } 24 | 25 | /** 26 | * @param $method 27 | * @param $args 28 | * @return mixed 29 | */ 30 | public function __call($method, $args) 31 | { 32 | return call_user_func_array([$this->client, $method], $args); 33 | } 34 | 35 | /** 36 | * @param null|string $name 37 | * @return \nickurt\HostFact\Client 38 | */ 39 | public function panel($name = null) 40 | { 41 | $name = $name ?: $this->getDefaultPanel(); 42 | 43 | return $this->panels[$name] = $this->get($name); 44 | } 45 | 46 | /** 47 | * @return string 48 | */ 49 | public function getDefaultPanel() 50 | { 51 | return $this->app['config']['hostfact.default']; 52 | } 53 | 54 | /** 55 | * @param string $name 56 | * @return \nickurt\HostFact\Client 57 | */ 58 | protected function get($name) 59 | { 60 | return $this->panels[$name] ?? $this->resolve($name); 61 | } 62 | 63 | /** 64 | * @param string $name 65 | * @return \nickurt\HostFact\Client 66 | */ 67 | protected function resolve($name) 68 | { 69 | $config = $this->getConfig($name); 70 | 71 | $this->client = new \nickurt\HostFact\Client(); 72 | $this->client->setOptions([ 73 | 'base_url' => $config['url'], 74 | 'key' => $config['key'] 75 | ]); 76 | 77 | return $this->client; 78 | } 79 | 80 | /** 81 | * @param string $name 82 | * @return array 83 | */ 84 | protected function getConfig($name) 85 | { 86 | return $this->app['config']["hostfact.panels.{$name}"]; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src/Api/Handles.php: -------------------------------------------------------------------------------- 1 | post(array_merge(['controller' => 'handle', 'action' => 'add'], $params)); 16 | } 17 | 18 | /** 19 | * @see https://www.hostfact.nl/developer/api/domein-contacten/delete 20 | * @param $params 21 | * @return mixed 22 | * @throws \GuzzleHttp\Exception\GuzzleException 23 | */ 24 | public function delete($params) 25 | { 26 | return $this->post(array_merge(['controller' => 'handle', 'action' => 'delete'], $params)); 27 | } 28 | 29 | /** 30 | * @see https://www.hostfact.nl/developer/api/domein-contacten/edit 31 | * @param $params 32 | * @return mixed 33 | * @throws \GuzzleHttp\Exception\GuzzleException 34 | */ 35 | public function edit($params) 36 | { 37 | return $this->post(array_merge(['controller' => 'handle', 'action' => 'edit'], $params)); 38 | } 39 | 40 | /** 41 | * @see https://www.hostfact.nl/developer/api/domein-contacten/list 42 | * @param $params 43 | * @return mixed 44 | * @throws \GuzzleHttp\Exception\GuzzleException 45 | */ 46 | public function list($params) 47 | { 48 | return $this->post(array_merge(['controller' => 'handle', 'action' => 'list'], $params)); 49 | } 50 | 51 | /** 52 | * @see https://www.hostfact.nl/developer/api/domein-contacten/listdomain 53 | * @param $params 54 | * @return mixed 55 | * @throws \GuzzleHttp\Exception\GuzzleException 56 | */ 57 | public function listDomain($params) 58 | { 59 | return $this->post(array_merge(['controller' => 'handle', 'action' => 'listdomain'], $params)); 60 | } 61 | 62 | /** 63 | * @see https://www.hostfact.nl/developer/api/domein-contacten/show 64 | * @param $params 65 | * @return mixed 66 | * @throws \GuzzleHttp\Exception\GuzzleException 67 | */ 68 | public function show($params) 69 | { 70 | return $this->post(array_merge(['controller' => 'handle', 'action' => 'show'], $params)); 71 | } 72 | } -------------------------------------------------------------------------------- /src/Api/Creditors.php: -------------------------------------------------------------------------------- 1 | post(array_merge(['controller' => 'creditor', 'action' => 'add'], $params)); 16 | } 17 | 18 | /** 19 | * @see https://www.hostfact.nl/developer/api/crediteuren/attachment-add 20 | * @see https://www.hostfact.nl/developer/api/crediteuren/attachment-delete 21 | * @see https://www.hostfact.nl/developer/api/crediteuren/attachment-download 22 | * @return Attachments 23 | */ 24 | public function attachments() 25 | { 26 | return new \nickurt\HostFact\Api\Attachments($this->client); 27 | } 28 | 29 | /** 30 | * @see https://www.hostfact.nl/developer/api/crediteuren/delete 31 | * @param $params 32 | * @return mixed 33 | * @throws \GuzzleHttp\Exception\GuzzleException 34 | */ 35 | public function delete($params) 36 | { 37 | return $this->post(array_merge(['controller' => 'creditor', 'action' => 'delete'], $params)); 38 | } 39 | 40 | /** 41 | * @see https://www.hostfact.nl/developer/api/crediteuren/edit 42 | * @param $params 43 | * @return mixed 44 | * @throws \GuzzleHttp\Exception\GuzzleException 45 | */ 46 | public function edit($params) 47 | { 48 | return $this->post(array_merge(['controller' => 'creditor', 'action' => 'edit'], $params)); 49 | } 50 | 51 | /** 52 | * @see https://www.hostfact.nl/developer/api/crediteuren/list 53 | * @param $params 54 | * @return mixed 55 | * @throws \GuzzleHttp\Exception\GuzzleException 56 | */ 57 | public function list($params) 58 | { 59 | return $this->post(array_merge(['controller' => 'creditor', 'action' => 'list'], $params)); 60 | } 61 | 62 | /** 63 | * @see https://www.hostfact.nl/developer/api/crediteuren/show 64 | * @param $params 65 | * @return mixed 66 | * @throws \GuzzleHttp\Exception\GuzzleException 67 | */ 68 | public function show($params) 69 | { 70 | return $this->post(array_merge(['controller' => 'creditor', 'action' => 'show'], $params)); 71 | } 72 | } -------------------------------------------------------------------------------- /src/Client.php: -------------------------------------------------------------------------------- 1 | 'Attachments', 12 | 'creditinvoices' => 'CreditInvoices', 13 | 'creditors' => 'Creditors', 14 | 'debtors' => 'Debtors', 15 | 'domains' => 'Domains', 16 | 'groups' => 'Groups', 17 | 'handles' => 'Handles', 18 | 'hosting' => 'Hosting', 19 | 'invoices' => 'Invoices', 20 | 'orders' => 'Orders', 21 | 'pricequotes' => 'PriceQuotes', 22 | 'products' => 'Products', 23 | 'services' => 'Services', 24 | 'ssl' => 'Ssl', 25 | 'tickets' => 'Tickets', 26 | 'vps' => 'Vps', 27 | ]; 28 | 29 | /** @var \nickurt\HostFact\HttpClient */ 30 | protected $httpClient; 31 | 32 | /** @var array */ 33 | protected $options = []; 34 | 35 | /** 36 | * @param $method 37 | * @param $args 38 | * @return mixed 39 | */ 40 | public function __call($method, $args) 41 | { 42 | try { 43 | return $this->api($method); 44 | } catch (InvalidArgumentException $e) { 45 | throw new \BadMethodCallException(sprintf('Undefined method called:"%s"', $method)); 46 | } 47 | } 48 | 49 | /** 50 | * @param $name 51 | * @return mixed 52 | */ 53 | public function api($name) 54 | { 55 | if (!isset($this->classes[$name])) { 56 | throw new \InvalidArgumentException(sprintf('Undefined method called:"%s"', $name)); 57 | } 58 | 59 | $class = '\\nickurt\\HostFact\\Api\\' . $this->classes[$name]; 60 | 61 | return new $class($this); 62 | } 63 | 64 | /** 65 | * @return HttpClient 66 | */ 67 | public function getHttpClient() 68 | { 69 | if (!isset($this->httpClient)) { 70 | $this->httpClient = new HttpClient(); 71 | } 72 | 73 | $this->httpClient->setOptions($this->getOptions()); 74 | 75 | return $this->httpClient; 76 | } 77 | 78 | /** 79 | * @return array 80 | */ 81 | public function getOptions() 82 | { 83 | return $this->options; 84 | } 85 | 86 | /** 87 | * @param $options 88 | */ 89 | public function setOptions($options) 90 | { 91 | $this->options = $options; 92 | } 93 | } -------------------------------------------------------------------------------- /src/Api/Orders.php: -------------------------------------------------------------------------------- 1 | post(array_merge(['controller' => 'order', 'action' => 'add'], $params)); 16 | } 17 | 18 | /** 19 | * @see https://www.hostfact.nl/developer/api/bestellingen/delete 20 | * @param $params 21 | * @return mixed 22 | * @throws \GuzzleHttp\Exception\GuzzleException 23 | */ 24 | public function delete($params) 25 | { 26 | return $this->post(array_merge(['controller' => 'order', 'action' => 'delete'], $params)); 27 | } 28 | 29 | /** 30 | * @see https://www.hostfact.nl/developer/api/bestellingen/edit 31 | * @param $params 32 | * @return mixed 33 | * @throws \GuzzleHttp\Exception\GuzzleException 34 | */ 35 | public function edit($params) 36 | { 37 | return $this->post(array_merge(['controller' => 'order', 'action' => 'edit'], $params)); 38 | } 39 | 40 | /** 41 | * @see https://www.hostfact.nl/developer/api/bestellingen/orderline-add 42 | * @see https://www.hostfact.nl/developer/api/bestellingen/orderline-delete 43 | * @return OrdersLine 44 | */ 45 | public function line() 46 | { 47 | return new \nickurt\HostFact\Api\OrdersLine($this->client); 48 | } 49 | 50 | /** 51 | * @see https://www.hostfact.nl/developer/api/bestellingen/list 52 | * @param $params 53 | * @return mixed 54 | * @throws \GuzzleHttp\Exception\GuzzleException 55 | */ 56 | public function list($params) 57 | { 58 | return $this->post(array_merge(['controller' => 'order', 'action' => 'list'], $params)); 59 | } 60 | 61 | /** 62 | * @see https://www.hostfact.nl/developer/api/bestellingen/process 63 | * @param $params 64 | * @return mixed 65 | * @throws \GuzzleHttp\Exception\GuzzleException 66 | */ 67 | public function process($params) 68 | { 69 | return $this->post(array_merge(['controller' => 'order', 'action' => 'process'], $params)); 70 | } 71 | 72 | /** 73 | * @see https://www.hostfact.nl/developer/api/bestellingen/show 74 | * @param $params 75 | * @return mixed 76 | * @throws \GuzzleHttp\Exception\GuzzleException 77 | */ 78 | public function show($params) 79 | { 80 | return $this->post(array_merge(['controller' => 'order', 'action' => 'show'], $params)); 81 | } 82 | } -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Contributions are **welcome** and will be fully **credited**. 4 | 5 | Please read and understand the contribution guide before creating an issue or pull request. 6 | 7 | ## Etiquette 8 | 9 | This project is open source, and as such, the maintainers give their free time to build and maintain the source code 10 | held within. They make the code freely available in the hope that it will be of use to other developers. It would be 11 | extremely unfair for them to suffer abuse or anger for their hard work. 12 | 13 | Please be considerate towards maintainers when raising issues or presenting pull requests. Let's show the 14 | world that developers are civilized and selfless people. 15 | 16 | It's the duty of the maintainer to ensure that all submissions to the project are of sufficient 17 | quality to benefit the project. Many developers have different skillsets, strengths, and weaknesses. Respect the maintainer's decision, and do not be upset or abusive if your submission is not used. 18 | 19 | ## Viability 20 | 21 | When requesting or submitting new features, first consider whether it might be useful to others. Open 22 | source projects are used by many developers, who may have entirely different needs to your own. Think about 23 | whether or not your feature is likely to be used by other users of the project. 24 | 25 | ## Procedure 26 | 27 | Before filing an issue: 28 | 29 | - Attempt to replicate the problem, to ensure that it wasn't a coincidental incident. 30 | - Check to make sure your feature suggestion isn't already present within the project. 31 | - Check the pull requests tab to ensure that the bug doesn't have a fix in progress. 32 | - Check the pull requests tab to ensure that the feature isn't already in progress. 33 | 34 | Before submitting a pull request: 35 | 36 | - Check the codebase to ensure that your feature doesn't already exist. 37 | - Check the pull requests to ensure that another person hasn't already submitted the feature or fix. 38 | 39 | ## Requirements 40 | 41 | If the project maintainer has any additional requirements, you will find them listed here. 42 | 43 | - **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](https://pear.php.net/package/PHP_CodeSniffer). 44 | 45 | - **Add tests!** - Your patch won't be accepted if it doesn't have tests. 46 | 47 | - **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date. 48 | 49 | - **Consider our release cycle** - We try to follow [SemVer v2.0.0](https://semver.org/). Randomly breaking public APIs is not an option. 50 | 51 | - **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. 52 | 53 | - **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](https://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting. 54 | 55 | **Happy coding**! 56 | -------------------------------------------------------------------------------- /src/Api/Tickets.php: -------------------------------------------------------------------------------- 1 | post(array_merge(['controller' => 'ticket', 'action' => 'add'], $params)); 16 | } 17 | 18 | /** 19 | * @see https://www.hostfact.nl/developer/api/tickets/addmessage 20 | * @param $params 21 | * @return mixed 22 | * @throws \GuzzleHttp\Exception\GuzzleException 23 | */ 24 | public function addMessage($params) 25 | { 26 | return $this->post(array_merge(['controller' => 'ticket', 'action' => 'addmessage'], $params)); 27 | } 28 | 29 | /** 30 | * @see https://www.hostfact.nl/developer/api/tickets/attachment-download 31 | * @return Attachments 32 | */ 33 | public function attachments() 34 | { 35 | return new \nickurt\HostFact\Api\Attachments($this->client); 36 | } 37 | 38 | /** 39 | * https://www.hostfact.nl/developer/api/tickets/changeowner 40 | * @param $params 41 | * @return mixed 42 | * @throws \GuzzleHttp\Exception\GuzzleException 43 | */ 44 | public function changeOwner($params) 45 | { 46 | return $this->post(array_merge(['controller' => 'ticket', 'action' => 'changeowner'], $params)); 47 | } 48 | 49 | /** 50 | * https://www.hostfact.nl/developer/api/tickets/changestatus 51 | * @param $params 52 | * @return mixed 53 | * @throws \GuzzleHttp\Exception\GuzzleException 54 | */ 55 | public function changeStatus($params) 56 | { 57 | return $this->post(array_merge(['controller' => 'ticket', 'action' => 'changestatus'], $params)); 58 | } 59 | 60 | /** 61 | * https://www.hostfact.nl/developer/api/tickets/delete 62 | * @param $params 63 | * @return mixed 64 | * @throws \GuzzleHttp\Exception\GuzzleException 65 | */ 66 | public function delete($params) 67 | { 68 | return $this->post(array_merge(['controller' => 'ticket', 'action' => 'delete'], $params)); 69 | } 70 | 71 | /** 72 | * https://www.hostfact.nl/developer/api/tickets/edit 73 | * @param $params 74 | * @return mixed 75 | * @throws \GuzzleHttp\Exception\GuzzleException 76 | */ 77 | public function edit($params) 78 | { 79 | return $this->post(array_merge(['controller' => 'ticket', 'action' => 'edit'], $params)); 80 | } 81 | 82 | /** 83 | * https://www.hostfact.nl/developer/api/tickets/list 84 | * @param $params 85 | * @return mixed 86 | * @throws \GuzzleHttp\Exception\GuzzleException 87 | */ 88 | public function list($params) 89 | { 90 | return $this->post(array_merge(['controller' => 'ticket', 'action' => 'list'], $params)); 91 | } 92 | 93 | /** 94 | * https://www.hostfact.nl/developer/api/tickets/show 95 | * @param $params 96 | * @return mixed 97 | * @throws \GuzzleHttp\Exception\GuzzleException 98 | */ 99 | public function show($params) 100 | { 101 | return $this->post(array_merge(['controller' => 'ticket', 'action' => 'show'], $params)); 102 | } 103 | } -------------------------------------------------------------------------------- /src/Api/Debtors.php: -------------------------------------------------------------------------------- 1 | post(array_merge(['controller' => 'debtor', 'action' => 'add'], $params)); 16 | } 17 | 18 | /** 19 | * @see https://www.hostfact.nl/developer/api/debiteuren/attachment-add 20 | * @see https://www.hostfact.nl/developer/api/debiteuren/attachment-delete 21 | * @see https://www.hostfact.nl/developer/api/debiteuren/attachment-download 22 | * @return Attachments 23 | */ 24 | public function attachments() 25 | { 26 | return new \nickurt\HostFact\Api\Attachments($this->client); 27 | } 28 | 29 | /** 30 | * @see https://www.hostfact.nl/developer/api/debiteuren/checklogin 31 | * @param $params 32 | * @return mixed 33 | * @throws \GuzzleHttp\Exception\GuzzleException 34 | */ 35 | public function checkLogin($params) 36 | { 37 | return $this->post(array_merge(['controller' => 'debtor', 'action' => 'checkLogin'], $params)); 38 | } 39 | 40 | /** 41 | * @see https://www.hostfact.nl/developer/api/debiteuren/edit 42 | * @param $params 43 | * @return mixed 44 | * @throws \GuzzleHttp\Exception\GuzzleException 45 | */ 46 | public function edit($params) 47 | { 48 | return $this->post(array_merge(['controller' => 'debtor', 'action' => 'edit'], $params)); 49 | } 50 | 51 | /** 52 | * @see https://www.hostfact.nl/developer/api/debiteuren/generatepdf 53 | * @param $params 54 | * @return mixed 55 | * @throws \GuzzleHttp\Exception\GuzzleException 56 | */ 57 | public function generatePdf($params) 58 | { 59 | return $this->post(array_merge(['controller' => 'debtor', 'action' => 'generatepdf'], $params)); 60 | } 61 | 62 | /** 63 | * @see https://www.hostfact.nl/developer/api/debiteuren/list 64 | * @param array $params 65 | * @return mixed 66 | * @throws \GuzzleHttp\Exception\GuzzleException 67 | */ 68 | public function list($params = []) 69 | { 70 | return $this->post(array_merge(['controller' => 'debtor', 'action' => 'list'], $params)); 71 | } 72 | 73 | /** 74 | * @see https://www.hostfact.nl/developer/api/debiteuren/sendemail 75 | * @param $params 76 | * @return mixed 77 | * @throws \GuzzleHttp\Exception\GuzzleException 78 | */ 79 | public function sendEmail($params) 80 | { 81 | return $this->post(array_merge(['controller' => 'debtor', 'action' => 'sendemail'], $params)); 82 | } 83 | 84 | /** 85 | * @see https://www.hostfact.nl/developer/api/debiteuren/show 86 | * @param $params 87 | * @return mixed 88 | * @throws \GuzzleHttp\Exception\GuzzleException 89 | */ 90 | public function show($params) 91 | { 92 | return $this->post(array_merge(['controller' => 'debtor', 'action' => 'show'], $params)); 93 | } 94 | 95 | /** 96 | * @see https://www.hostfact.nl/developer/api/debiteuren/updatelogincredentials 97 | * @param $params 98 | * @return mixed 99 | * @throws \GuzzleHttp\Exception\GuzzleException 100 | */ 101 | public function updateLoginCredentials($params) 102 | { 103 | return $this->post(array_merge(['controller' => 'debtor', 'action' => 'updatelogincredentials'], $params)); 104 | } 105 | } -------------------------------------------------------------------------------- /src/Api/CreditInvoices.php: -------------------------------------------------------------------------------- 1 | post(array_merge(['controller' => 'creditinvoice', 'action' => 'add'], $params)); 16 | } 17 | 18 | /** 19 | * @see https://www.hostfact.nl/developer/api/inkoopfacturen/attachment-add 20 | * @see https://www.hostfact.nl/developer/api/inkoopfacturen/attachment-delete 21 | * @see https://www.hostfact.nl/developer/api/inkoopfacturen/attachment-download 22 | * @return Attachments 23 | */ 24 | public function attachments() 25 | { 26 | return new \nickurt\HostFact\Api\Attachments($this->client); 27 | } 28 | 29 | /** 30 | * @see https://www.hostfact.nl/developer/api/inkoopfacturen/delete 31 | * @param $params 32 | * @return mixed 33 | * @throws \GuzzleHttp\Exception\GuzzleException 34 | */ 35 | public function delete($params) 36 | { 37 | return $this->post(array_merge(['controller' => 'creditinvoice', 'action' => 'delete'], $params)); 38 | } 39 | 40 | /** 41 | * @see https://www.hostfact.nl/developer/api/inkoopfacturen/edit 42 | * @param $params 43 | * @return mixed 44 | * @throws \GuzzleHttp\Exception\GuzzleException 45 | */ 46 | public function edit($params) 47 | { 48 | return $this->post(array_merge(['controller' => 'creditinvoice', 'action' => 'edit'], $params)); 49 | } 50 | 51 | /** 52 | * @see https://www.hostfact.nl/developer/api/inkoopfacturen/creditinvoiceline-add 53 | * @see https://www.hostfact.nl/developer/api/inkoopfacturen/creditinvoiceline-delete 54 | * @return CreditInvoicesLine 55 | */ 56 | public function line() 57 | { 58 | return new \nickurt\HostFact\Api\CreditInvoicesLine($this->client); 59 | } 60 | 61 | /** 62 | * @see https://www.hostfact.nl/developer/api/inkoopfacturen/list 63 | * @param $params 64 | * @return mixed 65 | * @throws \GuzzleHttp\Exception\GuzzleException 66 | */ 67 | public function list($params) 68 | { 69 | return $this->post(array_merge(['controller' => 'creditinvoice', 'action' => 'list'], $params)); 70 | } 71 | 72 | /** 73 | * @see https://www.hostfact.nl/developer/api/inkoopfacturen/markaspaid 74 | * @param $params 75 | * @return mixed 76 | * @throws \GuzzleHttp\Exception\GuzzleException 77 | */ 78 | public function markAsPaid($params) 79 | { 80 | return $this->post(array_merge(['controller' => 'creditinvoice', 'action' => 'markaspaid'], $params)); 81 | } 82 | 83 | /** 84 | * @see https://www.hostfact.nl/developer/api/inkoopfacturen/partpayment 85 | * @param $params 86 | * @return mixed 87 | * @throws \GuzzleHttp\Exception\GuzzleException 88 | */ 89 | public function partPayment($params) 90 | { 91 | return $this->post(array_merge(['controller' => 'creditinvoice', 'action' => 'partpayment'], $params)); 92 | } 93 | 94 | /** 95 | * @see https://www.hostfact.nl/developer/api/inkoopfacturen/show 96 | * @param $params 97 | * @return mixed 98 | * @throws \GuzzleHttp\Exception\GuzzleException 99 | */ 100 | public function show($params) 101 | { 102 | return $this->post(array_merge(['controller' => 'creditinvoice', 'action' => 'show'], $params)); 103 | } 104 | } -------------------------------------------------------------------------------- /src/Api/Vps.php: -------------------------------------------------------------------------------- 1 | post(array_merge(['controller' => 'vps', 'action' => 'add'], $params)); 15 | } 16 | 17 | /** 18 | * @param $params 19 | * @return mixed 20 | * @throws \GuzzleHttp\Exception\GuzzleException 21 | */ 22 | public function create($params) 23 | { 24 | return $this->post(array_merge(['controller' => 'vps', 'action' => 'create'], $params)); 25 | } 26 | 27 | /** 28 | * @param $params 29 | * @return mixed 30 | * @throws \GuzzleHttp\Exception\GuzzleException 31 | */ 32 | public function downloadAccountData($params) 33 | { 34 | return $this->post(array_merge(['controller' => 'vps', 'action' => 'downloadaccountdata'], $params)); 35 | } 36 | 37 | /** 38 | * @param $params 39 | * @return mixed 40 | * @throws \GuzzleHttp\Exception\GuzzleException 41 | */ 42 | public function edit($params) 43 | { 44 | return $this->post(array_merge(['controller' => 'vps', 'action' => 'edit'], $params)); 45 | } 46 | 47 | /** 48 | * @param $params 49 | * @return mixed 50 | * @throws \GuzzleHttp\Exception\GuzzleException 51 | */ 52 | public function list($params) 53 | { 54 | return $this->post(array_merge(['controller' => 'vps', 'action' => 'list'], $params)); 55 | } 56 | 57 | /** 58 | * @param $params 59 | * @return mixed 60 | * @throws \GuzzleHttp\Exception\GuzzleException 61 | */ 62 | public function pause($params) 63 | { 64 | return $this->post(array_merge(['controller' => 'vps', 'action' => 'pause'], $params)); 65 | } 66 | 67 | /** 68 | * @param $params 69 | * @return mixed 70 | * @throws \GuzzleHttp\Exception\GuzzleException 71 | */ 72 | public function restart($params) 73 | { 74 | return $this->post(array_merge(['controller' => 'vps', 'action' => 'restart'], $params)); 75 | } 76 | 77 | /** 78 | * @param $params 79 | * @return mixed 80 | * @throws \GuzzleHttp\Exception\GuzzleException 81 | */ 82 | public function sendAccountDataByEmail($params) 83 | { 84 | return $this->post(array_merge(['controller' => 'vps', 'action' => 'sendaccountdatabyemail'], $params)); 85 | } 86 | 87 | /** 88 | * @param $params 89 | * @return mixed 90 | * @throws \GuzzleHttp\Exception\GuzzleException 91 | */ 92 | public function show($params) 93 | { 94 | return $this->post(array_merge(['controller' => 'vps', 'action' => 'show'], $params)); 95 | } 96 | 97 | /** 98 | * @param $params 99 | * @return mixed 100 | * @throws \GuzzleHttp\Exception\GuzzleException 101 | */ 102 | public function start($params) 103 | { 104 | return $this->post(array_merge(['controller' => 'vps', 'action' => 'start'], $params)); 105 | } 106 | 107 | /** 108 | * @param $params 109 | * @return mixed 110 | * @throws \GuzzleHttp\Exception\GuzzleException 111 | */ 112 | public function suspend($params) 113 | { 114 | return $this->post(array_merge(['controller' => 'vps', 'action' => 'suspend'], $params)); 115 | } 116 | 117 | /** 118 | * @param $params 119 | * @return mixed 120 | * @throws \GuzzleHttp\Exception\GuzzleException 121 | */ 122 | public function terminate($params) 123 | { 124 | return $this->post(array_merge(['controller' => 'vps', 'action' => 'terminate'], $params)); 125 | } 126 | 127 | /** 128 | * @param $params 129 | * @return mixed 130 | * @throws \GuzzleHttp\Exception\GuzzleException 131 | */ 132 | public function unsuspend($params) 133 | { 134 | return $this->post(array_merge(['controller' => 'vps', 'action' => 'unsuspend'], $params)); 135 | } 136 | } -------------------------------------------------------------------------------- /src/Api/PriceQuotes.php: -------------------------------------------------------------------------------- 1 | post(array_merge(['controller' => 'pricequote', 'action' => 'accept'], $params)); 16 | } 17 | 18 | /** 19 | * @see https://www.hostfact.nl/developer/api/offertes/add 20 | * @param $params 21 | * @return mixed 22 | * @throws \GuzzleHttp\Exception\GuzzleException 23 | */ 24 | public function add($params) 25 | { 26 | return $this->post(array_merge(['controller' => 'pricequote', 'action' => 'add'], $params)); 27 | } 28 | 29 | /** 30 | * @see https://www.hostfact.nl/developer/api/offertes/attachment-add 31 | * @see https://www.hostfact.nl/developer/api/offertes/attachment-delete 32 | * @see https://www.hostfact.nl/developer/api/offertes/attachment-download 33 | * @return Attachments 34 | */ 35 | public function attachments() 36 | { 37 | return new \nickurt\HostFact\Api\Attachments($this->client); 38 | } 39 | 40 | /** 41 | * @see https://www.hostfact.nl/developer/api/offertes/decline 42 | * @param $params 43 | * @return mixed 44 | * @throws \GuzzleHttp\Exception\GuzzleException 45 | */ 46 | public function decline($params) 47 | { 48 | return $this->post(array_merge(['controller' => 'pricequote', 'action' => 'decline'], $params)); 49 | } 50 | 51 | /** 52 | * @see https://www.hostfact.nl/developer/api/offertes/delete 53 | * @param $params 54 | * @return mixed 55 | * @throws \GuzzleHttp\Exception\GuzzleException 56 | */ 57 | public function delete($params) 58 | { 59 | return $this->post(array_merge(['controller' => 'pricequote', 'action' => 'delete'], $params)); 60 | } 61 | 62 | /** 63 | * @see https://www.hostfact.nl/developer/api/offertes/download 64 | * @param $params 65 | * @return mixed 66 | * @throws \GuzzleHttp\Exception\GuzzleException 67 | */ 68 | public function download($params) 69 | { 70 | return $this->post(array_merge(['controller' => 'pricequote', 'action' => 'download'], $params)); 71 | } 72 | 73 | /** 74 | * @see https://www.hostfact.nl/developer/api/offertes/edit 75 | * @param $params 76 | * @return mixed 77 | * @throws \GuzzleHttp\Exception\GuzzleException 78 | */ 79 | public function edit($params) 80 | { 81 | return $this->post(array_merge(['controller' => 'pricequote', 'action' => 'edit'], $params)); 82 | } 83 | 84 | /** 85 | * @see https://www.hostfact.nl/developer/api/offertes/pricequoteline-add 86 | * @see https://www.hostfact.nl/developer/api/offertes/pricequoteline-delete 87 | * @return PriceQuotesLine 88 | */ 89 | public function line() 90 | { 91 | return new \nickurt\HostFact\Api\PriceQuotesLine($this->client); 92 | } 93 | 94 | /** 95 | * @see https://www.hostfact.nl/developer/api/offertes/list 96 | * @param $params 97 | * @return mixed 98 | * @throws \GuzzleHttp\Exception\GuzzleException 99 | */ 100 | public function list($params) 101 | { 102 | return $this->post(array_merge(['controller' => 'pricequote', 'action' => 'list'], $params)); 103 | } 104 | 105 | /** 106 | * @see https://www.hostfact.nl/developer/api/offertes/sendbyemail 107 | * @param $params 108 | * @return mixed 109 | * @throws \GuzzleHttp\Exception\GuzzleException 110 | */ 111 | public function sendByEmail($params) 112 | { 113 | return $this->post(array_merge(['controller' => 'pricequote', 'action' => 'sendbyemail'], $params)); 114 | } 115 | 116 | /** 117 | * @see https://www.hostfact.nl/developer/api/offertes/show 118 | * @param $params 119 | * @return mixed 120 | * @throws \GuzzleHttp\Exception\GuzzleException 121 | */ 122 | public function show($params) 123 | { 124 | return $this->post(array_merge(['controller' => 'pricequote', 'action' => 'show'], $params)); 125 | } 126 | } -------------------------------------------------------------------------------- /src/Api/Hosting.php: -------------------------------------------------------------------------------- 1 | post(array_merge(['controller' => 'hosting', 'action' => 'add'], $params)); 16 | } 17 | 18 | /** 19 | * @see https://www.hostfact.nl/developer/api/hosting/create 20 | * @param $params 21 | * @return mixed 22 | * @throws \GuzzleHttp\Exception\GuzzleException 23 | */ 24 | public function create($params) 25 | { 26 | return $this->post(array_merge(['controller' => 'hosting', 'action' => 'create'], $params)); 27 | } 28 | 29 | /** 30 | * @see https://www.hostfact.nl/developer/api/hosting/delete 31 | * @param $params 32 | * @return mixed 33 | * @throws \GuzzleHttp\Exception\GuzzleException 34 | */ 35 | public function delete($params) 36 | { 37 | return $this->post(array_merge(['controller' => 'hosting', 'action' => 'delete'], $params)); 38 | } 39 | 40 | /** 41 | * @see https://www.hostfact.nl/developer/api/hosting/edit 42 | * @param $params 43 | * @return mixed 44 | * @throws \GuzzleHttp\Exception\GuzzleException 45 | */ 46 | public function edit($params) 47 | { 48 | return $this->post(array_merge(['controller' => 'hosting', 'action' => 'edit'], $params)); 49 | } 50 | 51 | /** 52 | * @see https://www.hostfact.nl/developer/api/hosting/getdomainlist 53 | * @param $params 54 | * @return mixed 55 | * @throws \GuzzleHttp\Exception\GuzzleException 56 | */ 57 | public function getDomainList($params) 58 | { 59 | return $this->post(array_merge(['controller' => 'hosting', 'action' => 'getdomainlist'], $params)); 60 | } 61 | 62 | /** 63 | * @see https://www.hostfact.nl/developer/api/hosting/list 64 | * @param $params 65 | * @return mixed 66 | * @throws \GuzzleHttp\Exception\GuzzleException 67 | */ 68 | public function list($params) 69 | { 70 | return $this->post(array_merge(['controller' => 'hosting', 'action' => 'list'], $params)); 71 | } 72 | 73 | /** 74 | * @see https://www.hostfact.nl/developer/api/hosting/removefromserver 75 | * @param $params 76 | * @return mixed 77 | * @throws \GuzzleHttp\Exception\GuzzleException 78 | */ 79 | public function removeFromServer($params) 80 | { 81 | return $this->post(array_merge(['controller' => 'hosting', 'action' => 'removefromserver'], $params)); 82 | } 83 | 84 | /** 85 | * @see https://www.hostfact.nl/developer/api/hosting/sendaccountinfobyemail 86 | * @param $params 87 | * @return mixed 88 | * @throws \GuzzleHttp\Exception\GuzzleException 89 | */ 90 | public function sendAccountInfoByEmail($params) 91 | { 92 | return $this->post(array_merge(['controller' => 'hosting', 'action' => 'sendaccountinfobyemail'], $params)); 93 | } 94 | 95 | /** 96 | * @see https://www.hostfact.nl/developer/api/hosting/show 97 | * @param $params 98 | * @return mixed 99 | * @throws \GuzzleHttp\Exception\GuzzleException 100 | */ 101 | public function show($params) 102 | { 103 | return $this->post(array_merge(['controller' => 'hosting', 'action' => 'show'], $params)); 104 | } 105 | 106 | /** 107 | * @see https://www.hostfact.nl/developer/api/hosting/suspend 108 | * @param $params 109 | * @return mixed 110 | * @throws \GuzzleHttp\Exception\GuzzleException 111 | */ 112 | public function suspend($params) 113 | { 114 | return $this->post(array_merge(['controller' => 'hosting', 'action' => 'suspend'], $params)); 115 | } 116 | 117 | /** 118 | * @see https://www.hostfact.nl/developer/api/hosting/terminate 119 | * @param $params 120 | * @return mixed 121 | * @throws \GuzzleHttp\Exception\GuzzleException 122 | */ 123 | public function terminate($params) 124 | { 125 | return $this->post(array_merge(['controller' => 'hosting', 'action' => 'terminate'], $params)); 126 | } 127 | 128 | /** 129 | * @see https://www.hostfact.nl/developer/api/hosting/unsuspend 130 | * @param $params 131 | * @return mixed 132 | * @throws \GuzzleHttp\Exception\GuzzleException 133 | */ 134 | public function unsuspend($params) 135 | { 136 | return $this->post(array_merge(['controller' => 'hosting', 'action' => 'unsuspend'], $params)); 137 | } 138 | 139 | /** 140 | * @see https://www.hostfact.nl/developer/api/hosting/updowngrade 141 | * @param $params 142 | * @return mixed 143 | * @throws \GuzzleHttp\Exception\GuzzleException 144 | */ 145 | public function upDownGrade($params) 146 | { 147 | return $this->post(array_merge(['controller' => 'hosting', 'action' => 'updowngrade'], $params)); 148 | } 149 | } -------------------------------------------------------------------------------- /src/Api/Ssl.php: -------------------------------------------------------------------------------- 1 | post(array_merge(['controller' => 'ssl', 'action' => 'add'], $params)); 16 | } 17 | 18 | /** 19 | * @see https://www.hostfact.nl/developer/api/ssl-certificaten/download 20 | * @param $params 21 | * @return mixed 22 | * @throws \GuzzleHttp\Exception\GuzzleException 23 | */ 24 | public function download($params) 25 | { 26 | return $this->post(array_merge(['controller' => 'ssl', 'action' => 'download'], $params)); 27 | } 28 | 29 | /** 30 | * @see https://www.hostfact.nl/developer/api/ssl-certificaten/edit 31 | * @param $params 32 | * @return mixed 33 | * @throws \GuzzleHttp\Exception\GuzzleException 34 | */ 35 | public function edit($params) 36 | { 37 | return $this->post(array_merge(['controller' => 'ssl', 'action' => 'edit'], $params)); 38 | } 39 | 40 | /** 41 | * @see https://www.hostfact.nl/developer/api/ssl-certificaten/getstats 42 | * @param $params 43 | * @return mixed 44 | * @throws \GuzzleHttp\Exception\GuzzleException 45 | */ 46 | public function getStatus($params) 47 | { 48 | return $this->post(array_merge(['controller' => 'ssl', 'action' => 'getstatus'], $params)); 49 | } 50 | 51 | /** 52 | * @see https://www.hostfact.nl/developer/api/ssl-certificaten/installed 53 | * @param $params 54 | * @return mixed 55 | * @throws \GuzzleHttp\Exception\GuzzleException 56 | */ 57 | public function installed($params) 58 | { 59 | return $this->post(array_merge(['controller' => 'ssl', 'action' => 'installed'], $params)); 60 | } 61 | 62 | /** 63 | * @see https://www.hostfact.nl/developer/api/ssl-certificaten/list 64 | * @param $params 65 | * @return mixed 66 | * @throws \GuzzleHttp\Exception\GuzzleException 67 | */ 68 | public function list($params) 69 | { 70 | return $this->post(array_merge(['controller' => 'ssl', 'action' => 'list'], $params)); 71 | } 72 | 73 | /** 74 | * @see https://www.hostfact.nl/developer/api/ssl-certificaten/reissue 75 | * @param $params 76 | * @return mixed 77 | * @throws \GuzzleHttp\Exception\GuzzleException 78 | */ 79 | public function reissue($params) 80 | { 81 | return $this->post(array_merge(['controller' => 'ssl', 'action' => 'reissue'], $params)); 82 | } 83 | 84 | /** 85 | * @see https://www.hostfact.nl/developer/api/ssl-certificaten/renew 86 | * @param $params 87 | * @return mixed 88 | * @throws \GuzzleHttp\Exception\GuzzleException 89 | */ 90 | public function renew($params) 91 | { 92 | return $this->post(array_merge(['controller' => 'ssl', 'action' => 'renew'], $params)); 93 | } 94 | 95 | /** 96 | * @see https://www.hostfact.nl/developer/api/ssl-certificaten/request 97 | * @param $params 98 | * @return mixed 99 | * @throws \GuzzleHttp\Exception\GuzzleException 100 | */ 101 | public function request($params) 102 | { 103 | return $this->post(array_merge(['controller' => 'ssl', 'action' => 'request'], $params)); 104 | } 105 | 106 | /** 107 | * @see https://www.hostfact.nl/developer/api/ssl-certificaten/resendapprovermail 108 | * @param $params 109 | * @return mixed 110 | * @throws \GuzzleHttp\Exception\GuzzleException 111 | */ 112 | public function resendApproverMail($params) 113 | { 114 | return $this->post(array_merge(['controller' => 'ssl', 'action' => 'resendapprovermail'], $params)); 115 | } 116 | 117 | /** 118 | * @see https://www.hostfact.nl/developer/api/ssl-certificaten/revoke 119 | * @param $params 120 | * @return mixed 121 | * @throws \GuzzleHttp\Exception\GuzzleException 122 | */ 123 | public function revoke($params) 124 | { 125 | return $this->post(array_merge(['controller' => 'ssl', 'action' => 'revoke'], $params)); 126 | } 127 | 128 | /** 129 | * @see https://www.hostfact.nl/developer/api/ssl-certificaten/show 130 | * @param $params 131 | * @return mixed 132 | * @throws \GuzzleHttp\Exception\GuzzleException 133 | */ 134 | public function show($params) 135 | { 136 | return $this->post(array_merge(['controller' => 'ssl', 'action' => 'show'], $params)); 137 | } 138 | 139 | /** 140 | * @see https://www.hostfact.nl/developer/api/ssl-certificaten/terminate 141 | * @param $params 142 | * @return mixed 143 | * @throws \GuzzleHttp\Exception\GuzzleException 144 | */ 145 | public function terminate($params) 146 | { 147 | return $this->post(array_merge(['controller' => 'ssl', 'action' => 'terminate'], $params)); 148 | } 149 | 150 | /** 151 | * @see https://www.hostfact.nl/developer/api/ssl-certificaten/uninstalled 152 | * @param $params 153 | * @return mixed 154 | * @throws \GuzzleHttp\Exception\GuzzleException 155 | */ 156 | public function uninstalled($params) 157 | { 158 | return $this->post(array_merge(['controller' => 'ssl', 'action' => 'uninstalled'], $params)); 159 | } 160 | } -------------------------------------------------------------------------------- /src/Api/Domains.php: -------------------------------------------------------------------------------- 1 | post(array_merge(['controller' => 'domain', 'action' => 'add'], $params)); 16 | } 17 | 18 | /** 19 | * @see https://www.hostfact.nl/developer/api/domeinnamen/autorenew 20 | * @param $params 21 | * @return mixed 22 | * @throws \GuzzleHttp\Exception\GuzzleException 23 | */ 24 | public function autoRenew($params) 25 | { 26 | return $this->post(array_merge(['controller' => 'domain', 'action' => 'autorenew'], $params)); 27 | } 28 | 29 | /** 30 | * @see https://www.hostfact.nl/developer/api/domeinnamen/changenameserver 31 | * @param $params 32 | * @return mixed 33 | * @throws \GuzzleHttp\Exception\GuzzleException 34 | */ 35 | public function changeNameServer($params) 36 | { 37 | return $this->post(array_merge(['controller' => 'domain', 'action' => 'changenameserver'], $params)); 38 | } 39 | 40 | /** 41 | * @see https://www.hostfact.nl/developer/api/domeinnamen/check 42 | * @param $params 43 | * @return mixed 44 | * @throws \GuzzleHttp\Exception\GuzzleException 45 | */ 46 | public function check($params) 47 | { 48 | return $this->post(array_merge(['controller' => 'domain', 'action' => 'check'], $params)); 49 | } 50 | 51 | /** 52 | * @see https://www.hostfact.nl/developer/api/domeinnamen/delete 53 | * @param $params 54 | * @return mixed 55 | * @throws \GuzzleHttp\Exception\GuzzleException 56 | */ 57 | public function delete($params) 58 | { 59 | return $this->post(array_merge(['controller' => 'domain', 'action' => 'delete'], $params)); 60 | } 61 | 62 | /** 63 | * @see https://www.hostfact.nl/developer/api/domeinnamen/edit 64 | * @param $params 65 | * @return mixed 66 | * @throws \GuzzleHttp\Exception\GuzzleException 67 | */ 68 | public function edit($params) 69 | { 70 | return $this->post(array_merge(['controller' => 'domain', 'action' => 'edit'], $params)); 71 | } 72 | 73 | /** 74 | * @see https://www.hostfact.nl/developer/api/domeinnamen/editdnszone 75 | * @param $params 76 | * @return mixed 77 | * @throws \GuzzleHttp\Exception\GuzzleException 78 | */ 79 | public function editDnsZone($params) 80 | { 81 | return $this->post(array_merge(['controller' => 'domain', 'action' => 'editdnszone'], $params)); 82 | } 83 | 84 | /** 85 | * @see https://www.hostfact.nl/developer/api/domeinnamen/editwhois 86 | * @param $params 87 | * @return mixed 88 | * @throws \GuzzleHttp\Exception\GuzzleException 89 | */ 90 | public function editWhois($params) 91 | { 92 | return $this->post(array_merge(['controller' => 'domain', 'action' => 'editwhois'], $params)); 93 | } 94 | 95 | /** 96 | * @see https://www.hostfact.nl/developer/api/domeinnamen/getdnszone 97 | * @param $params 98 | * @return mixed 99 | * @throws \GuzzleHttp\Exception\GuzzleException 100 | */ 101 | public function getDnsZone($params) 102 | { 103 | return $this->post(array_merge(['controller' => 'domain', 'action' => 'getdnszone'], $params)); 104 | } 105 | 106 | /** 107 | * @see https://www.hostfact.nl/developer/api/domeinnamen/gettoken 108 | * @param $params 109 | * @return mixed 110 | * @throws \GuzzleHttp\Exception\GuzzleException 111 | */ 112 | public function getToken($params) 113 | { 114 | return $this->post(array_merge(['controller' => 'domain', 'action' => 'gettoken'], $params)); 115 | } 116 | 117 | /** 118 | * @see https://www.hostfact.nl/developer/api/domeinnamen/list 119 | * @param $params 120 | * @return mixed 121 | * @throws \GuzzleHttp\Exception\GuzzleException 122 | */ 123 | public function list($params) 124 | { 125 | return $this->post(array_merge(['controller' => 'domain', 'action' => 'list'], $params)); 126 | } 127 | 128 | /** 129 | * @see https://www.hostfact.nl/developer/api/domeinnamen/listdnstemplates 130 | * @param $params 131 | * @return mixed 132 | * @throws \GuzzleHttp\Exception\GuzzleException 133 | */ 134 | public function listDnsTemplates($params) 135 | { 136 | return $this->post(array_merge(['controller' => 'domain', 'action' => 'listdnstemplates'], $params)); 137 | } 138 | 139 | /** 140 | * @see https://www.hostfact.nl/developer/api/domeinnamen/lock 141 | * @param $params 142 | * @return mixed 143 | * @throws \GuzzleHttp\Exception\GuzzleException 144 | */ 145 | public function lock($params) 146 | { 147 | return $this->post(array_merge(['controller' => 'domain', 'action' => 'lock'], $params)); 148 | } 149 | 150 | /** 151 | * @see https://www.hostfact.nl/developer/api/domeinnamen/register 152 | * @param $params 153 | * @return mixed 154 | * @throws \GuzzleHttp\Exception\GuzzleException 155 | */ 156 | public function register($params) 157 | { 158 | return $this->post(array_merge(['controller' => 'domain', 'action' => 'register'], $params)); 159 | } 160 | 161 | /** 162 | * @see https://www.hostfact.nl/developer/api/domeinnamen/show 163 | * @param $params 164 | * @return mixed 165 | * @throws \GuzzleHttp\Exception\GuzzleException 166 | */ 167 | public function show($params) 168 | { 169 | return $this->post(array_merge(['controller' => 'domain', 'action' => 'show'], $params)); 170 | } 171 | 172 | /** 173 | * @see https://www.hostfact.nl/developer/api/domeinnamen/syncwhois 174 | * @param $params 175 | * @return mixed 176 | * @throws \GuzzleHttp\Exception\GuzzleException 177 | */ 178 | public function syncWhois($params) 179 | { 180 | return $this->post(array_merge(['controller' => 'domain', 'action' => 'syncwhois'], $params)); 181 | } 182 | 183 | /** 184 | * @see https://www.hostfact.nl/developer/api/domeinnamen/terminate 185 | * @param $params 186 | * @return mixed 187 | * @throws \GuzzleHttp\Exception\GuzzleException 188 | */ 189 | public function terminate($params) 190 | { 191 | return $this->post(array_merge(['controller' => 'domain', 'action' => 'terminate'], $params)); 192 | } 193 | 194 | /** 195 | * @see https://www.hostfact.nl/developer/api/domeinnamen/transfer 196 | * @param $params 197 | * @return mixed 198 | * @throws \GuzzleHttp\Exception\GuzzleException 199 | */ 200 | public function transfer($params) 201 | { 202 | return $this->post(array_merge(['controller' => 'domain', 'action' => 'transfer'], $params)); 203 | } 204 | 205 | /** 206 | * @see https://www.hostfact.nl/developer/api/domeinnamen/unlock 207 | * @param $params 208 | * @return mixed 209 | * @throws \GuzzleHttp\Exception\GuzzleException 210 | */ 211 | public function unlock($params) 212 | { 213 | return $this->post(array_merge(['controller' => 'domain', 'action' => 'unlock'], $params)); 214 | } 215 | } -------------------------------------------------------------------------------- /src/Api/Invoices.php: -------------------------------------------------------------------------------- 1 | post(array_merge(['controller' => 'invoice', 'action' => 'add'], $params)); 16 | } 17 | 18 | /** 19 | * @see https://www.hostfact.nl/developer/api/facturen/attachment-add 20 | * @see https://www.hostfact.nl/developer/api/facturen/attachment-delete 21 | * @see https://www.hostfact.nl/developer/api/facturen/attachment-download 22 | * @return Attachments 23 | */ 24 | public function attachments() 25 | { 26 | return new \nickurt\HostFact\Api\Attachments($this->client); 27 | } 28 | 29 | /** 30 | * @see https://www.hostfact.nl/developer/api/facturen/block 31 | * @param $params 32 | * @return mixed 33 | * @throws \GuzzleHttp\Exception\GuzzleException 34 | */ 35 | public function block($params) 36 | { 37 | return $this->post(array_merge(['controller' => 'invoice', 'action' => 'block'], $params)); 38 | } 39 | 40 | /** 41 | * @see https://www.hostfact.nl/developer/api/facturen/cancelschedule 42 | * @param $params 43 | * @return mixed 44 | * @throws \GuzzleHttp\Exception\GuzzleException 45 | */ 46 | public function cancelSchedule($params) 47 | { 48 | return $this->post(array_merge(['controller' => 'invoice', 'action' => 'cancelschedule'], $params)); 49 | } 50 | 51 | /** 52 | * @see https://www.hostfact.nl/developer/api/facturen/credit 53 | * @param $params 54 | * @return mixed 55 | * @throws \GuzzleHttp\Exception\GuzzleException 56 | */ 57 | public function credit($params) 58 | { 59 | return $this->post(array_merge(['controller' => 'invoice', 'action' => 'credit'], $params)); 60 | } 61 | 62 | /** 63 | * @see https://www.hostfact.nl/developer/api/facturen/delete 64 | * @param $params 65 | * @return mixed 66 | * @throws \GuzzleHttp\Exception\GuzzleException 67 | */ 68 | public function delete($params) 69 | { 70 | return $this->post(array_merge(['controller' => 'invoice', 'action' => 'delete'], $params)); 71 | } 72 | 73 | /** 74 | * @see https://www.hostfact.nl/developer/api/facturen/download 75 | * @param $params 76 | * @return mixed 77 | * @throws \GuzzleHttp\Exception\GuzzleException 78 | */ 79 | public function download($params) 80 | { 81 | return $this->post(array_merge(['controller' => 'invoice', 'action' => 'download'], $params)); 82 | } 83 | 84 | /** 85 | * @see https://www.hostfact.nl/developer/api/facturen/edit 86 | * @param $params 87 | * @return mixed 88 | * @throws \GuzzleHttp\Exception\GuzzleException 89 | */ 90 | public function edit($params) 91 | { 92 | return $this->post(array_merge(['controller' => 'invoice', 'action' => 'edit'], $params)); 93 | } 94 | 95 | /** 96 | * @see https://www.hostfact.nl/developer/api/facturen/invoiceline-add 97 | * @see https://www.hostfact.nl/developer/api/facturen/invoiceline-delete 98 | * @return InvoicesLine 99 | */ 100 | public function line() 101 | { 102 | return new \nickurt\HostFact\Api\InvoicesLine($this->client); 103 | } 104 | 105 | /** 106 | * @see https://www.hostfact.nl/developer/api/facturen/list 107 | * @param $params 108 | * @return mixed 109 | * @throws \GuzzleHttp\Exception\GuzzleException 110 | */ 111 | public function list($params) 112 | { 113 | return $this->post(array_merge(['controller' => 'invoice', 'action' => 'list'], $params)); 114 | } 115 | 116 | /** 117 | * @see https://www.hostfact.nl/developer/api/facturen/markaspaid 118 | * @param $params 119 | * @return mixed 120 | * @throws \GuzzleHttp\Exception\GuzzleException 121 | */ 122 | public function markAsPaid($params) 123 | { 124 | return $this->post(array_merge(['controller' => 'invoice', 'action' => 'markaspaid'], $params)); 125 | } 126 | 127 | /** 128 | * @see https://www.hostfact.nl/developer/api/facturen/markasunpaid 129 | * @param $params 130 | * @return mixed 131 | * @throws \GuzzleHttp\Exception\GuzzleException 132 | */ 133 | public function markAsUnpaid($params) 134 | { 135 | return $this->post(array_merge(['controller' => 'invoice', 'action' => 'markasunpaid'], $params)); 136 | } 137 | 138 | /** 139 | * @see https://www.hostfact.nl/developer/api/facturen/partpayment 140 | * @param $params 141 | * @return mixed 142 | * @throws \GuzzleHttp\Exception\GuzzleException 143 | */ 144 | public function partPayment($params) 145 | { 146 | return $this->post(array_merge(['controller' => 'invoice', 'action' => 'partpayment'], $params)); 147 | } 148 | 149 | /** 150 | * @see https://www.hostfact.nl/developer/api/facturen/paymentprocesspause 151 | * @param $params 152 | * @return mixed 153 | * @throws \GuzzleHttp\Exception\GuzzleException 154 | */ 155 | public function paymentProcessPause($params) 156 | { 157 | return $this->post(array_merge(['controller' => 'invoice', 'action' => 'paymentprocesspause'], $params)); 158 | } 159 | 160 | /** 161 | * @see https://www.hostfact.nl/developer/api/facturen/paymentprocessreactivate 162 | * @param $params 163 | * @return mixed 164 | * @throws \GuzzleHttp\Exception\GuzzleException 165 | */ 166 | public function paymentProcessReactivate($params) 167 | { 168 | return $this->post(array_merge(['controller' => 'invoice', 'action' => 'paymentprocessreactivate'], $params)); 169 | } 170 | 171 | /** 172 | * @see https://www.hostfact.nl/developer/api/facturen/schedule 173 | * @param $params 174 | * @return mixed 175 | * @throws \GuzzleHttp\Exception\GuzzleException 176 | */ 177 | public function schedule($params) 178 | { 179 | return $this->post(array_merge(['controller' => 'invoice', 'action' => 'schedule'], $params)); 180 | } 181 | 182 | /** 183 | * @see https://www.hostfact.nl/developer/api/facturen/sendbyemail 184 | * @param $params 185 | * @return mixed 186 | * @throws \GuzzleHttp\Exception\GuzzleException 187 | */ 188 | public function sendByEmail($params) 189 | { 190 | return $this->post(array_merge(['controller' => 'invoice', 'action' => 'sendbyemail'], $params)); 191 | } 192 | 193 | /** 194 | * @see https://www.hostfact.nl/developer/api/facturen/sendreminderbyemail 195 | * @param $params 196 | * @return mixed 197 | * @throws \GuzzleHttp\Exception\GuzzleException 198 | */ 199 | public function sendReminderByEmail($params) 200 | { 201 | return $this->post(array_merge(['controller' => 'invoice', 'action' => 'sendreminderbyemail'], $params)); 202 | } 203 | 204 | /** 205 | * @see https://www.hostfact.nl/developer/api/facturen/sendsummationbyemail 206 | * @param $params 207 | * @return mixed 208 | * @throws \GuzzleHttp\Exception\GuzzleException 209 | */ 210 | public function sendSummationByEmail($params) 211 | { 212 | return $this->post(array_merge(['controller' => 'invoice', 'action' => 'sendsummationbyemail'], $params)); 213 | } 214 | 215 | /** 216 | * @see https://www.hostfact.nl/developer/api/facturen/show 217 | * @param $params 218 | * @return mixed 219 | * @throws \GuzzleHttp\Exception\GuzzleException 220 | */ 221 | public function show($params) 222 | { 223 | return $this->post(array_merge(['controller' => 'invoice', 'action' => 'show'], $params)); 224 | } 225 | 226 | /** 227 | * @see https://www.hostfact.nl/developer/api/facturen/unblock 228 | * @param $params 229 | * @return mixed 230 | * @throws \GuzzleHttp\Exception\GuzzleException 231 | */ 232 | public function unblock($params) 233 | { 234 | return $this->post(array_merge(['controller' => 'invoice', 'action' => 'unblock'], $params)); 235 | } 236 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Laravel HostFact 2 | [![Build Status](https://github.com/nickurt/laravel-hostfact/workflows/tests/badge.svg)](https://github.com/nickurt/laravel-hostfact/actions) 3 | [![Total Downloads](https://poser.pugx.org/nickurt/laravel-hostfact/d/total.svg)](https://packagist.org/packages/nickurt/laravel-hostfact) 4 | [![Latest Stable Version](https://poser.pugx.org/nickurt/laravel-hostfact/v/stable.svg)](https://packagist.org/packages/nickurt/laravel-hostfact) 5 | [![MIT Licensed](https://poser.pugx.org/nickurt/laravel-hostfact/license.svg)](LICENSE.md) 6 | 7 | HostFact is an easy-to-use billing and automation solution for hosting companies 8 | ### Table of contents 9 | - [Installation](#installation) 10 | - [Usage](#usage) 11 | - [Tests](#tests) 12 | ### Installation 13 | Install this package with composer: 14 | ``` 15 | composer require nickurt/laravel-hostfact 16 | ``` 17 | Copy the config files for the HostFact-plugin 18 | ``` 19 | php artisan vendor:publish --provider="nickurt\HostFact\ServiceProvider" --tag="config" 20 | ``` 21 | Add the HostFact credentials to your `.env` file 22 | ``` 23 | HOSTFACT_DEFAULT_URL= 24 | HOSTFACT_DEFAULT_KEY= 25 | ``` 26 | ### Usage 27 | #### Authentication [debtors] 28 | It's possible to use a custom `hostfact` authentication driver to login debtors in your application, by default the UserProfile will be cached for 60 minutes 29 | ```php 30 | // config/auth.php 31 | 'providers' => [ 32 | 'hostfact' => [ 33 | 'driver' => 'hostfact' 34 | ], 35 | ] 36 | 37 | // Auth::attempt 38 | if(Auth::attempt(['username' => $username, 'password' => $password])) 39 | { 40 | dd(Auth::user(), Auth::id()); 41 | } 42 | ``` 43 | #### Multiple Panels [config] 44 | If you want to work with more HostFact panels, you can define more panels in the `config/hostfact.php` file 45 | ```php 46 | // config/hostfact.php 47 | 'panels' => [ 48 | 49 | 'default' => [ 50 | 'url' => env('HOSTFACT_DEFAULT_URL'), 51 | 'key' => env('HOSTFACT_DEFAULT_KEY'), 52 | ], 53 | 54 | 'ppe' => [ 55 | 'url' => env('HOSTFACT_PPE_URL'), 56 | 'key' => env('HOSTFACT_PPE_KEY'), 57 | ], 58 | 59 | ], 60 | ``` 61 | #### Multiple Panels [normal usage] 62 | To use another panel than your default one, you can specify it with the panel-method 63 | ```php 64 | // DebtorsController 65 | public function getIndex() 66 | { 67 | $debtors = HostFact::panel('ppe')->debtors()->all([ 68 | 'Sort' => 'DebtorCode', 69 | 'limit' => 20 70 | ]); 71 | 72 | // 73 | } 74 | ``` 75 | #### Multiple Panels [dependency injection] 76 | ```php 77 | // Route 78 | Route::get('/hostfact/{hostFact}/debtors', ['as' => 'hostfact/debtors', 'uses' => 'DebtorsController@getIndex']); 79 | 80 | Route::bind('hostFact', function ($value, $route) { 81 | app('HostFact')->panel($value); 82 | 83 | return app('HostFact'); 84 | }); 85 | 86 | // DebtorsController 87 | public function getIndex(HostFact $hostFact) 88 | { 89 | $debtors = $hostFact->debtors()->all([ 90 | 'Sort' => 'DebtorCode', 91 | 'limit' => 20 92 | ]); 93 | 94 | // 95 | } 96 | ``` 97 | #### Attachments 98 | ```php 99 | HostFact::attachments()->add(array $params) 100 | HostFact::attachments()->delete(array $params) 101 | HostFact::attachments()->download(array $params) 102 | ``` 103 | #### CreditInvoices 104 | ```php 105 | HostFact::creditinvoices()->add(array $params) 106 | HostFact::creditinvoices()->delete(array $params) 107 | HostFact::creditinvoices()->edit(array $params) 108 | HostFact::creditinvoices()->list(array $params) 109 | HostFact::creditinvoices()->markAsPaid(array $params) 110 | HostFact::creditinvoices()->partPayment(array $params) 111 | HostFact::creditinvoices()->show(array $params) 112 | ``` 113 | #### Creditors 114 | ```php 115 | HostFact::creditors()->add(array $params) 116 | HostFact::creditors()->delete(array $params) 117 | HostFact::creditors()->edit(array $params) 118 | HostFact::creditors()->list(array $params) 119 | HostFact::creditors()->show(array $params) 120 | ``` 121 | #### Debtors 122 | ```php 123 | HostFact::debtors()->add(array $params) 124 | HostFact::debtors()->checkLogin(array $params) 125 | HostFact::debtors()->edit(array $params) 126 | HostFact::debtors()->generatePdf(array $params) 127 | HostFact::debtors()->list(array $params) 128 | HostFact::debtors()->sendEmail(array $params) 129 | HostFact::debtors()->show(array $params) 130 | HostFact::debtors()->updateLoginCredentials(array $params) 131 | ``` 132 | #### Domains 133 | ```php 134 | HostFact::domains()->add(array $params) 135 | HostFact::domains()->autoRenew(array $params) 136 | HostFact::domains()->changeNameServer(array $params) 137 | HostFact::domains()->check(array $params) 138 | HostFact::domains()->delete(array $params) 139 | HostFact::domains()->edit(array $params) 140 | HostFact::domains()->editDnsZone(array $params) 141 | HostFact::domains()->editWhois(array $params) 142 | HostFact::domains()->getDnsZone(array $params) 143 | HostFact::domains()->getToken(array $params) 144 | HostFact::domains()->list(array $params) 145 | HostFact::domains()->listDnsTemplates(array $params) 146 | HostFact::domains()->lock(array $params) 147 | HostFact::domains()->register(array $params) 148 | HostFact::domains()->show(array $params) 149 | HostFact::domains()->syncWhois(array $params) 150 | HostFact::domains()->terminate(array $params) 151 | HostFact::domains()->transfer(array $params) 152 | HostFact::domains()->unlock(array $params) 153 | ``` 154 | #### Groups 155 | ```php 156 | HostFact::groups()->add(array $params) 157 | HostFact::groups()->delete(array $params) 158 | HostFact::groups()->edit(array $params) 159 | HostFact::groups()->list(array $params) 160 | HostFact::groups()->show(array $params) 161 | ``` 162 | #### Handles 163 | ```php 164 | HostFact::handles()->add(array $params) 165 | HostFact::handles()->delete(array $params) 166 | HostFact::handles()->edit(array $params) 167 | HostFact::handles()->list(array $params) 168 | HostFact::handles()->listDomain(array $params) 169 | HostFact::handles()->show(array $params) 170 | ``` 171 | #### Hosting 172 | ```php 173 | HostFact::hosting()->add(array $params) 174 | HostFact::hosting()->create(array $params) 175 | HostFact::hosting()->delete(array $params) 176 | HostFact::hosting()->edit(array $params) 177 | HostFact::hosting()->getDomainList(array $params) 178 | HostFact::hosting()->list(array $params) 179 | HostFact::hosting()->removeFromServer(array $params) 180 | HostFact::hosting()->sendAccountInfoByEmail(array $params) 181 | HostFact::hosting()->show(array $params) 182 | HostFact::hosting()->suspend(array $params) 183 | HostFact::hosting()->terminate(array $params) 184 | HostFact::hosting()->unsuspend(array $params) 185 | HostFact::hosting()->upDownGrade(array $params) 186 | ``` 187 | #### Invoices 188 | ```php 189 | HostFact::invoices()->add(array $params) 190 | HostFact::invoices()->block(array $params) 191 | HostFact::invoices()->cancelSchedule(array $params) 192 | HostFact::invoices()->credit(array $params) 193 | HostFact::invoices()->delete(array $params) 194 | HostFact::invoices()->download(array $params) 195 | HostFact::invoices()->edit(array $params) 196 | HostFact::invoices()->list(array $params) 197 | HostFact::invoices()->markAsPaid(array $params) 198 | HostFact::invoices()->markAsUnpaid(array $params) 199 | HostFact::invoices()->partPayment(array $params) 200 | HostFact::invoices()->paymentProcessPause(array $params) 201 | HostFact::invoices()->paymentProcessReactivate(array $params) 202 | HostFact::invoices()->schedule(array $params) 203 | HostFact::invoices()->sendByEmail(array $params) 204 | HostFact::invoices()->sendReminderByEmail(array $params) 205 | HostFact::invoices()->sendSummationByEmail(array $params) 206 | HostFact::invoices()->show(array $params) 207 | HostFact::invoices()->unblock(array $params) 208 | ``` 209 | #### Orders 210 | ```php 211 | HostFact::orders()->add(array $params) 212 | HostFact::orders()->delete(array $params) 213 | HostFact::orders()->edit(array $params) 214 | HostFact::orders()->list(array $params) 215 | HostFact::orders()->process(array $params) 216 | HostFact::orders()->show(array $params) 217 | ``` 218 | #### PriceQuotes 219 | ```php 220 | HostFact::pricequotes()->accept(array $params) 221 | HostFact::pricequotes()->add(array $params) 222 | HostFact::pricequotes()->decline(array $params) 223 | HostFact::pricequotes()->delete(array $params) 224 | HostFact::pricequotes()->download(array $params) 225 | HostFact::pricequotes()->edit(array $params) 226 | HostFact::pricequotes()->list(array $params) 227 | HostFact::pricequotes()->sendByEmail(array $params) 228 | HostFact::pricequotes()->show(array $params) 229 | ``` 230 | #### Products 231 | ```php 232 | HostFact::products()->add(array $params) 233 | HostFact::products()->delete(array $params) 234 | HostFact::products()->edit(array $params) 235 | HostFact::products()->list(array $params) 236 | HostFact::products()->show(array $params) 237 | ``` 238 | #### Services 239 | ```php 240 | HostFact::services()->add(array $params) 241 | HostFact::services()->edit(array $params) 242 | HostFact::services()->list(array $params) 243 | HostFact::services()->show(array $params) 244 | HostFact::services()->terminate(array $params) 245 | ``` 246 | #### Ssl 247 | ```php 248 | HostFact::ssl()->add(array $params) 249 | HostFact::ssl()->download(array $params) 250 | HostFact::ssl()->edit(array $params) 251 | HostFact::ssl()->getStatus(array $params) 252 | HostFact::ssl()->installed(array $params) 253 | HostFact::ssl()->list(array $params) 254 | HostFact::ssl()->reissue(array $params) 255 | HostFact::ssl()->renew(array $params) 256 | HostFact::ssl()->request(array $params) 257 | HostFact::ssl()->resendApproverMail(array $params) 258 | HostFact::ssl()->revoke(array $params) 259 | HostFact::ssl()->show(array $params) 260 | HostFact::ssl()->terminate(array $params) 261 | HostFact::ssl()->uninstalled(array $params) 262 | ``` 263 | #### Tickets 264 | ```php 265 | HostFact::tickets()->add(array $params) 266 | HostFact::tickets()->addMessage(array $params) 267 | HostFact::tickets()->changeOwner(array $params) 268 | HostFact::tickets()->changeStatus(array $params) 269 | HostFact::tickets()->delete(array $params) 270 | HostFact::tickets()->edit(array $params) 271 | HostFact::tickets()->list(array $params) 272 | HostFact::tickets()->show(array $params) 273 | ``` 274 | #### Vps 275 | ```php 276 | HostFact::vps()->add(array $params) 277 | HostFact::vps()->create(array $params) 278 | HostFact::vps()->downloadAccountData(array $params) 279 | HostFact::vps()->edit(array $params) 280 | HostFact::vps()->list(array $params) 281 | HostFact::vps()->pause(array $params) 282 | HostFact::vps()->restart(array $params) 283 | HostFact::vps()->sendAccountDataByEmail(array $params) 284 | HostFact::vps()->show(array $params) 285 | HostFact::vps()->start(array $params) 286 | HostFact::vps()->suspend(array $params) 287 | HostFact::vps()->terminate(array $params) 288 | HostFact::vps()->unsuspend(array $params) 289 | ``` 290 | ### Tests 291 | ```sh 292 | composer test 293 | ``` 294 | - - - 295 | --------------------------------------------------------------------------------