diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9462cac --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +composer.lock +/vendor/ \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..06d6541 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +# Change Log + +## [1.0.0] - 2023-10-25 + + - Initial release diff --git a/README.md b/README.md new file mode 100644 index 0000000..4492db2 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# e-Boekhouden.nl Api Client + +## Installing + +```bash +composer require onetoweb/eboekhouden +``` + +## Usage + +See [Documentation](docs/index.rst) + +## Change Log + +See [Change Log](CHANGELOG.md) \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..68c0153 --- /dev/null +++ b/composer.json @@ -0,0 +1,31 @@ +{ + "name": "onetoweb/eboekhouden", + "description": "e-Boekhouden.nl API Client", + "keywords": [ + "api", + "php", + "e-boekhouden.nl", + "e-boekhouden" + ], + "type": "library", + "homepage": "https://github.com/onetoweb/eboekhouden", + "license": "MIT", + "authors": [ + { + "name": "Jonathan van 't Ende", + "email": "jvantende@onetoweb.nl" + } + ], + "require": { + "php": ">=7.1.0", + "symfony/polyfill-php81": "^1.28" + }, + "require-dev": { + "symfony/error-handler": "^5.1" + }, + "autoload": { + "psr-4": { + "Onetoweb\\Eboekhouden\\": "src/" + } + } +} diff --git a/docs/administration.rst b/docs/administration.rst new file mode 100644 index 0000000..275ce1e --- /dev/null +++ b/docs/administration.rst @@ -0,0 +1,22 @@ +.. _top: +.. title:: Administration + +`Back to index `_ + +============== +Administration +============== + +.. contents:: + :local: + + +List Administrations +```````````````````` + +.. code-block:: php + + $result = $client->administration->list(); + + +`Back to top <#top>`_ \ No newline at end of file diff --git a/docs/article.rst b/docs/article.rst new file mode 100644 index 0000000..6bfbae4 --- /dev/null +++ b/docs/article.rst @@ -0,0 +1,28 @@ +.. _top: +.. title:: Articles + +`Back to index `_ + +======== +Articles +======== + +.. contents:: + :local: + + +List Articles +````````````` + +.. code-block:: php + + $result = $client->article->list([ + 'ArtikelID' => '', + 'ArtikelOmschrijving' => '', + 'ArtikelCode' => '', + 'GroepOmschrijving' => '', + 'GroepCode' => '' + ]); + + +`Back to top <#top>`_ \ No newline at end of file diff --git a/docs/balance.rst b/docs/balance.rst new file mode 100644 index 0000000..1e54db6 --- /dev/null +++ b/docs/balance.rst @@ -0,0 +1,40 @@ +.. _top: +.. title:: Balance + +`Back to index `_ + +======= +Balance +======= + +.. contents:: + :local: + + +List Balance +```````````` + +.. code-block:: php + + $result = $client->balance->list([ + 'KostenPlaatsId' => 0, + 'DatumVan' => '2022-01-01', + 'DatumTot' => '2023-12-31', + 'Categorie' => 'DEB' + ]); + + +Get Balance +``````````` + +.. code-block:: php + + $result = $client->balance->get([ + 'KostenPlaatsId' => 0, + 'DatumVan' => '2022-01-01', + 'DatumTot' => '2023-12-31', + 'GbCode' => '12000' + ]); + + +`Back to top <#top>`_ \ No newline at end of file diff --git a/docs/cost_center.rst b/docs/cost_center.rst new file mode 100644 index 0000000..5997e51 --- /dev/null +++ b/docs/cost_center.rst @@ -0,0 +1,26 @@ +.. _top: +.. title:: Cost Centers + +`Back to index `_ + +============ +Cost Centers +============ + +.. contents:: + :local: + + +List Cost Centers +````````````````` + +.. code-block:: php + + $result = $client->costCenter->list([ + 'KostenplaatsID' => '', + 'KostenplaatsParentID' => '', + 'Omschrijving' => '' + ]); + + +`Back to top <#top>`_ \ No newline at end of file diff --git a/docs/general_ledger.rst b/docs/general_ledger.rst new file mode 100644 index 0000000..df71cdd --- /dev/null +++ b/docs/general_ledger.rst @@ -0,0 +1,54 @@ +.. _top: +.. title:: General Ledger + +`Back to index `_ + +============== +General Ledger +============== + +.. contents:: + :local: + + +List General Ledger Accounts +```````````````````````````` + +.. code-block:: php + + $result = $client->generalLedger->list([ + 'ID' => '', + 'Code' => '', + 'Categorie' => '' + ]); + + +Create General Ledger Account +````````````````````````````` + +.. code-block:: php + + $result = $client->generalLedger->create([ + 'ID' => '', + 'Code' => '800001', + 'Omschrijving' => 'Foo Bar 1', + 'Categorie' => 'BAL', + 'Groep' => '' + ]); + + +Update General Ledger Account +````````````````````````````` + +.. code-block:: php + + $result = $client->generalLedger->update([ + 'ID' => '10000000', + 'Code' => '800002', + 'Omschrijving' => 'Foo Bar 2', + 'Categorie' => 'BAL', + 'Groep' => '' + ]); + + +`Back to top <#top>`_ \ No newline at end of file diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..15a8640 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,36 @@ +.. title:: Index + +=========== +Basic Usage +=========== + +Setup Client + +.. code-block:: php + + require 'vendor/autoload.php'; + + use Onetoweb\Eboekhouden\Client; + + // param + $username = '{username}'; + $securityCode1 = '{security_code_1}'; + $securityCode2 = '{security_code_2}'; + + // setup client + $client = new Client($username, $securityCode1, $securityCode2); + + +======== +Examples +======== + +* `Administration `_ +* `Balance `_ +* `Invoices `_ +* `Mutations `_ +* `General Ledger `_ +* `Relations `_ +* `Open Posts `_ +* `Cost Centers `_ +* `Articles `_ diff --git a/docs/invoice.rst b/docs/invoice.rst new file mode 100644 index 0000000..5cefa01 --- /dev/null +++ b/docs/invoice.rst @@ -0,0 +1,82 @@ +.. _top: +.. title:: Invoice + +`Back to index `_ + +======= +Invoice +======= + +.. contents:: + :local: + + +List Invoices +````````````` + +.. code-block:: php + + $result = $client->invoice->list([ + 'Factuurnummer' => 'F00001', + 'Relatiecode' => 'REL', + 'DatumVan' => '2022-01-01', + 'DatumTm' => '2023-12-31' + ]); + + +Create Invoice +`````````````` + +.. code-block:: php + + $result = $client->invoice->create([ + 'Factuurnummer' => '', + 'Relatiecode' => 'BV42', + 'Datum' => '2023-10-26', + 'Betalingstermijn' => 14, + 'Factuursjabloon' => '', + 'PerEmailVerzenden' => true, + 'EmailOnderwerp' => '', + 'EmailBericht' => '', + 'EmailVanAdres' => '', + 'EmailVanNaam' => '', + 'AutomatischeIncasso' => true, + 'IncassoIBAN' => '', + 'IncassoMachtigingSoort' => '', + 'IncassoMachtigingID' => '', + 'IncassoMachtigingDatumOndertekening' => '2023-10-26', + 'IncassoMachtigingFirst' => true, + 'IncassoRekeningNummer' => '', + 'IncassoTnv' => '', + 'IncassoPlaats' => '', + 'IncassoOmschrijvingRegel1' => '', + 'IncassoOmschrijvingRegel2' => '', + 'IncassoOmschrijvingRegel3' => '', + 'InBoekhoudingPlaatsen' => true, + 'Regels' => [ + 'cFactuurRegel' => [ + [ + 'Aantal' => 1.0, + 'Eenheid' => '', + 'Code' => '', + 'Omschrijving' => '', + 'PrijsPerEenheid' => 0.0, + 'BTWCode' => '', + 'TegenrekeningCode' => '', + 'KostenplaatsID' => 0 + ], [ + 'Aantal' => 1.0, + 'Eenheid' => '', + 'Code' => '', + 'Omschrijving' => '', + 'PrijsPerEenheid' => 0.0, + 'BTWCode' => '', + 'TegenrekeningCode' => '', + 'KostenplaatsID' => 0 + ] + ] + ], + ]); + + +`Back to top <#top>`_ \ No newline at end of file diff --git a/docs/mutation.rst b/docs/mutation.rst new file mode 100644 index 0000000..695dabd --- /dev/null +++ b/docs/mutation.rst @@ -0,0 +1,49 @@ +.. _top: +.. title:: Mutations + +`Back to index `_ + +========= +Mutations +========= + +.. contents:: + :local: + + +List Mutations +`````````````` + +.. code-block:: php + + $result = $client->mutation->list([ + 'MutatieNr' => '', + 'MutatieNrVan' => '', + 'MutatieNrTm' => '', + 'Factuurnummer' => '', + 'DatumVan' => '2022-01-01', + 'DatumTm' => '2023-12-31' + ]); + + +Create Mutation +``````````````` + +.. code-block:: php + + $result = $client->mutation->create([ + 'MutatieNr' => '', + 'Soort' => 'Memoriaal', + 'Datum' => '2023-10-26', + 'Rekening' => '', + 'RelatieCode' => '', + 'Factuurnummer' => '', + 'Boekstuk' => '', + 'Omschrijving' => 'Mutatie', + 'Betalingstermijn' => '', + 'Betalingskenmerk' => '', + 'InExBTW' => 'IN' + ]); + + +`Back to top <#top>`_ \ No newline at end of file diff --git a/docs/open_post.rst b/docs/open_post.rst new file mode 100644 index 0000000..442e43a --- /dev/null +++ b/docs/open_post.rst @@ -0,0 +1,23 @@ +.. _top: +.. title:: Open Posts + +`Back to index `_ + +========== +Open Posts +========== + +.. contents:: + :local: + + +List Open Posts +``````````````` + +.. code-block:: php + + $type = 'Debiteuren'; // or Crediteuren + $result = $client->openPost->list($type); + + +`Back to top <#top>`_ \ No newline at end of file diff --git a/docs/relations.rst b/docs/relations.rst new file mode 100644 index 0000000..fa83165 --- /dev/null +++ b/docs/relations.rst @@ -0,0 +1,128 @@ +.. _top: +.. title:: Relations + +`Back to index `_ + +========= +Relations +========= + +.. contents:: + :local: + + +List Relations +`````````````` + +.. code-block:: php + + $result = $client->relation->list([ + 'Trefwoord' => '', + 'Code' => '', + 'ID' => '' + ]); + + +Create Relation +``````````````` + +.. code-block:: php + + $result = $client->relation->create([ + 'ID' => '', + 'AddDatum' => '2023-10-26', + 'Code' => 'BV42', + 'Bedrijf' => 'Bedrijf B.V.', + 'Contactpersoon' => '', + 'Geslacht' => '', + 'Adres' => '', + 'Postcode' => '', + 'Plaats' => '', + 'Land' => '', + 'Adres2' => '', + 'Postcode2' => '', + 'Plaats2' => '', + 'Land2' => '', + 'Telefoon' => '', + 'GSM' => '', + 'FAX' => '', + 'Email' => '', + 'Site' => '', + 'Notitie' => '', + 'Bankrekening' => '', + 'Girorekening' => '', + 'BTWNummer' => '', + 'KvkNummer' => '', + 'Aanhef' => '', + 'IBAN' => '', + 'BIC' => '', + 'BP' => '', + 'Def1' => '', + 'Def2' => '', + 'Def3' => '', + 'Def4' => '', + 'Def5' => '', + 'Def6' => '', + 'Def7' => '', + 'Def8' => '', + 'Def9' => '', + 'Def10' => '', + 'LA' => '', + 'Gb_ID' => '', + 'GeenEmail' => '', + 'NieuwsbriefgroepenCount' => '' + ]); + + +Update Relation +``````````````` + +.. code-block:: php + + $result = $client->relation->update([ + 'ID' => '10000000', + 'AddDatum' => '2023-10-26', + 'Code' => 'BV42', + 'Bedrijf' => 'Bedrijf B.V.', + 'Contactpersoon' => '', + 'Geslacht' => '', + 'Adres' => '', + 'Postcode' => '', + 'Plaats' => '', + 'Land' => '', + 'Adres2' => '', + 'Postcode2' => '', + 'Plaats2' => '', + 'Land2' => '', + 'Telefoon' => '', + 'GSM' => '', + 'FAX' => '', + 'Email' => '', + 'Site' => '', + 'Notitie' => '', + 'Bankrekening' => '', + 'Girorekening' => '', + 'BTWNummer' => '', + 'KvkNummer' => '', + 'Aanhef' => '', + 'IBAN' => '', + 'BIC' => '', + 'BP' => '', + 'Def1' => '', + 'Def2' => '', + 'Def3' => '', + 'Def4' => '', + 'Def5' => '', + 'Def6' => '', + 'Def7' => '', + 'Def8' => '', + 'Def9' => '', + 'Def10' => '', + 'LA' => '', + 'Gb_ID' => '', + 'GeenEmail' => '', + 'NieuwsbriefgroepenCount' => '' + ]); + + +`Back to top <#top>`_ \ No newline at end of file diff --git a/src/Client.php b/src/Client.php new file mode 100644 index 0000000..d0414d3 --- /dev/null +++ b/src/Client.php @@ -0,0 +1,132 @@ +username = $username; + $this->securityCode1 = $securityCode1; + $this->securityCode2 = $securityCode2; + + // setup soap client + $this->soapClient = new SoapClient(Client::BASE_WDSL, ['trace' => true]); + + // load endpoints + $this->loadEndpoints(); + } + + /** + * @return void + */ + private function loadEndpoints(): void + { + foreach (Endpoints::list() as $name => $class) { + $this->{$name} = new $class($this->soapClient, $this->getSessionId(), $this->securityCode2); + } + } + + /** + * @return SoapClient + */ + public function getSoapClient(): SoapClient + { + return $this->soapClient; + } + + /** + * @return sting + */ + public function getSessionId(): string + { + if ($this->sessionId === null) { + $this->openSession(); + } + + return $this->sessionId; + } + + /** + * @return void + */ + private function openSession(): void + { + // open session + $params = [ + 'Username' => $this->username, + 'SecurityCode1' => $this->securityCode1, + 'SecurityCode2' => $this->securityCode2 + ]; + $response = $this->soapClient->__soapCall('OpenSession', [$params]); + + // get session id + $this->sessionId = $response->OpenSessionResult->SessionID; + } + + /** + * @return void + */ + private function closeSession(): void + { + // open session + $params = [ + 'SessionID' => $this->sessionId, + ]; + $response = $this->soapClient->__soapCall('CloseSession', [$params]); + + // clear session id + $this->sessionId = null; + } + + /** + * Destructor. + */ + public function __destruct() + { + if ($this->sessionId !== null) { + $this->closeSession(); + } + } +} \ No newline at end of file diff --git a/src/Endpoint/AbstractEndpoint.php b/src/Endpoint/AbstractEndpoint.php new file mode 100644 index 0000000..3bc413e --- /dev/null +++ b/src/Endpoint/AbstractEndpoint.php @@ -0,0 +1,69 @@ +soapClient = $soapClient; + $this->sessionId = $sessionId; + $this->securityCode2 = $securityCode2; + } + + /** + * @param mixed $response + * + * @return array|null + */ + protected function proccessResponse($response): ?array + { + return json_decode(json_encode($response), true); + } + + /** + * @param mixed $response + * + * @return array|null + */ + protected function returnList(array $data): ?array + { + return array_is_list($data) ? $data : [$data]; + } + + /** + * @return array $param = [] + */ + protected function addSession(array $param = []) + { + return array_merge([ + 'SessionID' => $this->sessionId, + 'SecurityCode2' => $this->securityCode2, + ], $param); + } +} \ No newline at end of file diff --git a/src/Endpoint/EndpointInterface.php b/src/Endpoint/EndpointInterface.php new file mode 100644 index 0000000..f5fd1fb --- /dev/null +++ b/src/Endpoint/EndpointInterface.php @@ -0,0 +1,5 @@ +addSession(); + + $response = $this->soapClient->__soapCall('GetAdministraties', [$params]); + + $processedResponse = $this->proccessResponse($response); + + if (isset($processedResponse['GetAdministratiesResult']['Administraties']['cAdministratie'])) { + return $processedResponse['GetAdministratiesResult']['Administraties']['cAdministratie']; + } + + return $processedResponse; + } +} \ No newline at end of file diff --git a/src/Endpoint/Endpoints/Article.php b/src/Endpoint/Endpoints/Article.php new file mode 100644 index 0000000..8e2ea35 --- /dev/null +++ b/src/Endpoint/Endpoints/Article.php @@ -0,0 +1,34 @@ +addSession(['cFilter' => $filter]); + + $response = $this->soapClient->__soapCall('GetArtikelen', [$params]); + + $processedResponse = $this->proccessResponse($response); + + dump($processedResponse); + + if (isset($processedResponse['GetArtikelenResult']['Artikelen']['cArtikel'])) { + + return $this->returnList($processedResponse['GetArtikelenResult']['Artikelen']['cArtikel']); + } + + return $processedResponse; + } +} \ No newline at end of file diff --git a/src/Endpoint/Endpoints/Balance.php b/src/Endpoint/Endpoints/Balance.php new file mode 100644 index 0000000..ce63150 --- /dev/null +++ b/src/Endpoint/Endpoints/Balance.php @@ -0,0 +1,53 @@ +addSession(['cFilter' => $filter]); + + $response = $this->soapClient->__soapCall('GetSaldi', [$params]); + + $processedResponse = $this->proccessResponse($response); + + if (isset($processedResponse['GetSaldiResult']['Saldi']['cSaldo'])) { + + return $this->returnList($processedResponse['GetSaldiResult']['Saldi']['cSaldo']); + } + + return $processedResponse; + } + + /** + * @param array $filter = null + * + * @return array|int|null + */ + public function get(array $filter = []) + { + $params = $this->addSession(['cFilter' => $filter]); + + $response = $this->soapClient->__soapCall('GetSaldo', [$params]); + + $processedResponse = $this->proccessResponse($response); + + if (isset($processedResponse['GetSaldoResult']['Saldo'])) { + + return $processedResponse['GetSaldoResult']['Saldo']; + } + + return $processedResponse; + } +} \ No newline at end of file diff --git a/src/Endpoint/Endpoints/CostCenter.php b/src/Endpoint/Endpoints/CostCenter.php new file mode 100644 index 0000000..176ca1b --- /dev/null +++ b/src/Endpoint/Endpoints/CostCenter.php @@ -0,0 +1,32 @@ +addSession(['cFilter' => $filter]); + + $response = $this->soapClient->__soapCall('GetKostenplaatsen', [$params]); + + $processedResponse = $this->proccessResponse($response); + + if (isset($processedResponse['GetKostenplaatsenResult']['Kostenplaatsen']['cKostenplaats'])) { + + return $this->returnList($processedResponse['GetKostenplaatsenResult']['Kostenplaatsen']['cKostenplaats']); + } + + return $processedResponse; + } +} \ No newline at end of file diff --git a/src/Endpoint/Endpoints/GeneralLedger.php b/src/Endpoint/Endpoints/GeneralLedger.php new file mode 100644 index 0000000..9b66be8 --- /dev/null +++ b/src/Endpoint/Endpoints/GeneralLedger.php @@ -0,0 +1,76 @@ +addSession(['cFilter' => $filter]); + + $response = $this->soapClient->__soapCall('GetGrootboekrekeningen', [$params]); + + $processedResponse = $this->proccessResponse($response); + + if (isset($processedResponse['GetGrootboekrekeningenResult']['Rekeningen']['cGrootboekrekening'])) { + + return $this->returnList($processedResponse['GetGrootboekrekeningenResult']['Rekeningen']['cGrootboekrekening']); + } + + return $processedResponse; + } + + /** + * @param array $data = [] + * + * @return array|int|null + */ + public function create(array $data = []) + { + $params = $this->addSession(['oGb' => $data]); + + $response = $this->soapClient->__soapCall('AddGrootboekrekening', [$params]); + + $processedResponse = $this->proccessResponse($response); + + if ( + isset($processedResponse['AddGrootboekrekeningResult']['Gb_ID']) + and !empty($processedResponse['AddGrootboekrekeningResult']['Gb_ID']) + ) { + return $processedResponse['AddGrootboekrekeningResult']['Gb_ID']; + } + + return $processedResponse; + } + + /** + * @param array $data = [] + * + * @return array|null + */ + public function update(array $data = []) + { + $params = $this->addSession(['oGb' => $data]); + + $response = $this->soapClient->__soapCall('UpdateGrootboekrekening', [$params]); + + $processedResponse = $this->proccessResponse($response); + + if (isset($processedResponse['UpdateGrootboekrekeningResult'])) { + + return $processedResponse['UpdateGrootboekrekeningResult']; + } + + return $processedResponse; + } +} \ No newline at end of file diff --git a/src/Endpoint/Endpoints/Invoice.php b/src/Endpoint/Endpoints/Invoice.php new file mode 100644 index 0000000..8d0bf94 --- /dev/null +++ b/src/Endpoint/Endpoints/Invoice.php @@ -0,0 +1,55 @@ +addSession(['cFilter' => $filter]); + + $response = $this->soapClient->__soapCall('GetFacturen', [$params]); + + $processedResponse = $this->proccessResponse($response); + + if (isset($processedResponse['GetFacturenResult']['Facturen']['cFactuurList'])) { + + return $this->returnList($processedResponse['GetFacturenResult']['Facturen']['cFactuurList']); + } + + return $processedResponse; + } + + /** + * @param array $data = [] + * + * @return array|string|null + */ + public function create(array $data = []) + { + $params = $this->addSession(['oFact' => $data]); + + $response = $this->soapClient->__soapCall('AddFactuur', [$params]); + + $processedResponse = $this->proccessResponse($response); + + if ( + isset($processedResponse['AddFactuurResult']['Factuurnummer']) + and !empty($processedResponse['AddFactuurResult']['Factuurnummer']) + ) { + return $processedResponse['AddFactuurResult']['Factuurnummer']; + } + + return $processedResponse; + } +} \ No newline at end of file diff --git a/src/Endpoint/Endpoints/Mutation.php b/src/Endpoint/Endpoints/Mutation.php new file mode 100644 index 0000000..aedff46 --- /dev/null +++ b/src/Endpoint/Endpoints/Mutation.php @@ -0,0 +1,55 @@ +addSession(['cFilter' => $filter]); + + $response = $this->soapClient->__soapCall('GetMutaties', [$params]); + + $processedResponse = $this->proccessResponse($response); + + if (isset($processedResponse['GetMutatiesResult']['Mutaties']['cMutatieList'])) { + + return $this->returnList($processedResponse['GetMutatiesResult']['Mutaties']['cMutatieList']); + } + + return $processedResponse; + } + + /** + * @param array $data = [] + * + * @return array|string|null + */ + public function create(array $data = []) + { + $params = $this->addSession(['oMut' => $data]); + + $response = $this->soapClient->__soapCall('AddMutatie', [$params]); + + $processedResponse = $this->proccessResponse($response); + + if ( + isset($processedResponse['AddMutatieResult']['Mutatienummer']) + and !empty($processedResponse['AddMutatieResult']['Mutatienummer']) + ) { + return $processedResponse['AddMutatieResult']['Mutatienummer']; + } + + return $processedResponse; + } +} \ No newline at end of file diff --git a/src/Endpoint/Endpoints/OpenPost.php b/src/Endpoint/Endpoints/OpenPost.php new file mode 100644 index 0000000..cb7a8fc --- /dev/null +++ b/src/Endpoint/Endpoints/OpenPost.php @@ -0,0 +1,32 @@ +addSession(['OpSoort' => $type]); + + $response = $this->soapClient->__soapCall('GetOpenPosten', [$params]); + + $processedResponse = $this->proccessResponse($response); + + if (isset($processedResponse['GetOpenPostenResult']['Openposten']['cOpenPost'])) { + + return $this->returnList($processedResponse['GetOpenPostenResult']['Openposten']['cOpenPost']); + } + + return $processedResponse; + } +} \ No newline at end of file diff --git a/src/Endpoint/Endpoints/Relation.php b/src/Endpoint/Endpoints/Relation.php new file mode 100644 index 0000000..b44ec3a --- /dev/null +++ b/src/Endpoint/Endpoints/Relation.php @@ -0,0 +1,76 @@ +addSession(['cFilter' => $filter]); + + $response = $this->soapClient->__soapCall('GetRelaties', [$params]); + + $processedResponse = $this->proccessResponse($response); + + if (isset($processedResponse['GetRelatiesResult']['Relaties']['cRelatie'])) { + + return $this->returnList($processedResponse['GetRelatiesResult']['Relaties']['cRelatie']); + } + + return $processedResponse; + } + + /** + * @param array $data = [] + * + * @return array|int|null + */ + public function create(array $data = []) + { + $params = $this->addSession(['oRel' => $data]); + + $response = $this->soapClient->__soapCall('AddRelatie', [$params]); + + $processedResponse = $this->proccessResponse($response); + + if ( + isset($processedResponse['AddRelatieResult']['Rel_ID']) + and !empty($processedResponse['AddRelatieResult']['Rel_ID']) + ) { + return $processedResponse['AddRelatieResult']['Rel_ID']; + } + + return $processedResponse; + } + + /** + * @param array $data = [] + * + * @return array|int|null + */ + public function update(array $data = []) + { + $params = $this->addSession(['oRel' => $data]); + + $response = $this->soapClient->__soapCall('UpdateRelatie', [$params]); + + $processedResponse = $this->proccessResponse($response); + + if (isset($processedResponse['UpdateRelatieResult'])) { + + return $processedResponse['UpdateRelatieResult']; + } + + return $processedResponse; + } +} \ No newline at end of file