From 5dc2eea09dd0dfc794ccbef158100bff89bce9f9 Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Mon, 16 Feb 2026 21:31:48 +0000
Subject: [PATCH] ContractorSynchronizer: set tax ID type on contractor

---
 src/UcrmHelper.php |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/UcrmHelper.php b/src/UcrmHelper.php
index ccdd37e..93fb323 100644
--- a/src/UcrmHelper.php
+++ b/src/UcrmHelper.php
@@ -3,46 +3,46 @@
 namespace SIPL\UCRM\wFirma;
 
 class UcrmHelper {
-	protected $rootDirectory;
-	protected $api = NULL;
-	protected $attributes = NULL;
-	protected $paymentMethods = NULL;
+	protected string $rootDirectory;
+	protected ?\Ubnt\UcrmPluginSdk\Service\UcrmApi $api = NULL;
+	protected ?UcrmAttributes $attributes = NULL;
+	protected ?UcrmPaymentMethods $paymentMethods = NULL;
 	protected $config = NULL;
 	protected $event = NULL;
 
 	function __construct(?string $rootDirectory = NULL) {
 		if ($rootDirectory === NULL) {
-			$rootDirectory = __DIR__ . '/..';
+			$rootDirectory = dirname(__DIR__);
 		}
 		$this->rootDirectory = $rootDirectory;
 	}
 
-	function getRootDirectory() {
+	function getRootDirectory(): string {
 		return $this->rootDirectory;
 	}
 
-	function getApi() {
+	function getApi(): \Ubnt\UcrmPluginSdk\Service\UcrmApi {
 		if ($this->api === NULL) {
 			$this->api = \Ubnt\UcrmPluginSdk\Service\UcrmApi::create($this->rootDirectory);
 		}
 		return $this->api;
 	}
 
-	function getAttributes() {
+	function getAttributes(): UcrmAttributes {
 		if ($this->attributes === NULL) {
 			$this->attributes = new UcrmAttributes($this);
 		}
 		return $this->attributes;
 	}
 
-	function getPaymentMethods() {
+	function getPaymentMethods(): UcrmPaymentMethods {
 		if ($this->paymentMethods === NULL) {
 			$this->paymentMethods = new UcrmPaymentMethods($this);
 		}
 		return $this->paymentMethods;
 	}
 
-	function getConfig() {
+	function getConfig(): array {
 		if ($this->config === NULL) {
 			$configManager = \Ubnt\UcrmPluginSdk\Service\PluginConfigManager::create($this->rootDirectory);
 			$this->config = $configManager->loadConfig();
@@ -50,12 +50,12 @@
 		return $this->config;
 	}
 
-	function getVersion() {
+	function getVersion(): string {
 		$response = $this->getApi()->get('/version');
 		return $response['version'];
 	}
 
-	function getCurrentEvent() {
+	function getCurrentEvent(): array {
 		if ($this->event === NULL) {
 			try {
 				if (($_SERVER['REQUEST_METHOD'] ?? '') !== 'POST') {
@@ -79,7 +79,7 @@
 					throw new \RuntimeException('Failed to process event - event not found');
 				}
 
-				if (!is_int($event['entityId'])) {
+				if (!ctype_digit($event['entityId'])) {
 					throw new \RuntimeException('Failed to process event - invalid entity ID');
 				}
 

--
Gitblit v1.10.0