From 8ae5778801231acd28d2b204c4660679901ed821 Mon Sep 17 00:00:00 2001 From: Mateusz Nastalski Date: Tue, 21 Oct 2025 23:35:02 +0200 Subject: [PATCH 1/3] Add inventory documents --- src/Api/Enum/InventoryDocumentType.php | 13 ++++++ src/Api/Request/InventoryDocuments.php | 63 ++++++++++++++++++++++++++ src/Baselinker.php | 6 +++ tests/BaselinkerTest.php | 10 ++++ 4 files changed, 92 insertions(+) create mode 100644 src/Api/Enum/InventoryDocumentType.php create mode 100644 src/Api/Request/InventoryDocuments.php diff --git a/src/Api/Enum/InventoryDocumentType.php b/src/Api/Enum/InventoryDocumentType.php new file mode 100644 index 0000000..6a1f5f0 --- /dev/null +++ b/src/Api/Enum/InventoryDocumentType.php @@ -0,0 +1,13 @@ +value; + + return new Response( + $this->post('addInventoryDocument', $data) + ); + } + + public function setInventoryDocumentStatusConfirmed(int $documentId): Response + { + return new Response( + $this->post('setInventoryDocumentStatusConfirmed', [ + 'document_type' => $documentId, + ]) + ); + } + + public function getInventoryDocuments(array $filters = []): Response + { + return new Response( + $this->post('getInventoryDocuments', $filters) + ); + } + + public function getInventoryDocumentItems(int $documentId, ?int $page = null): Response + { + return new Response( + $this->post('getInventoryDocumentItems', [ + 'document_id' => $documentId, + 'page' => $page, + ]) + ); + } + + public function addInventoryDocumentItems(int $documentId, array $items): Response + { + return new Response( + $this->post('addInventoryDocumentItems', [ + 'document_id' => $documentId, + 'items' => $items, + ]) + ); + } + + public function getInventoryDocumentSeries(): Response + { + return new Response( + $this->post('getInventoryDocumentSeries') + ); + } +} diff --git a/src/Baselinker.php b/src/Baselinker.php index 7f281ae..05d172c 100644 --- a/src/Baselinker.php +++ b/src/Baselinker.php @@ -5,6 +5,7 @@ use Baselinker\Api\Request\BaselinkerConnect; use Baselinker\Api\Request\CourierShipments; use Baselinker\Api\Request\ExternalStorages; +use Baselinker\Api\Request\InventoryDocuments; use Baselinker\Api\Request\InventoryPayers; use Baselinker\Api\Request\OrderReturns; use Baselinker\Api\Request\Orders; @@ -26,6 +27,11 @@ public function productCatalog(): ProductCatalog return new ProductCatalog($this->config); } + public function inventoryDocuments(): InventoryDocuments + { + return new InventoryDocuments($this->config); + } + public function warehouseDocuments(): WarehouseDocuments { return new WarehouseDocuments($this->config); diff --git a/tests/BaselinkerTest.php b/tests/BaselinkerTest.php index 1fd6c21..8166aa5 100644 --- a/tests/BaselinkerTest.php +++ b/tests/BaselinkerTest.php @@ -5,6 +5,7 @@ use Baselinker\Api\Request\BaselinkerConnect; use Baselinker\Api\Request\CourierShipments; use Baselinker\Api\Request\ExternalStorages; +use Baselinker\Api\Request\InventoryDocuments; use Baselinker\Api\Request\InventoryPayers; use Baselinker\Api\Request\OrderReturns; use Baselinker\Api\Request\Orders; @@ -43,6 +44,15 @@ public function testWarehousePurchaseOrders(): void $this->assertInstanceOf(WarehousePurchaseOrders::class, $warehousePurchaseOrders); } + public function testInventoryDocuments(): void + { + $baselinker = new Baselinker('token'); + + $inventoryDocuments = $baselinker->inventoryDocuments(); + + $this->assertInstanceOf(InventoryDocuments::class, $inventoryDocuments); + } + public function testInventoryPayers(): void { $baselinker = new Baselinker('token'); From 12bfca529729af69791c66515c3a22124fbaa63e Mon Sep 17 00:00:00 2001 From: Mateusz Nastalski Date: Wed, 22 Oct 2025 23:10:01 +0200 Subject: [PATCH 2/3] Add inventory purchase orders --- src/Api/Enum/InventoryPurchaseOrderStatus.php | 13 ++++ src/Api/Request/InventoryPurchaseOrders.php | 69 +++++++++++++++++++ src/Baselinker.php | 6 ++ tests/BaselinkerTest.php | 10 +++ 4 files changed, 98 insertions(+) create mode 100644 src/Api/Enum/InventoryPurchaseOrderStatus.php create mode 100644 src/Api/Request/InventoryPurchaseOrders.php diff --git a/src/Api/Enum/InventoryPurchaseOrderStatus.php b/src/Api/Enum/InventoryPurchaseOrderStatus.php new file mode 100644 index 0000000..bbe1452 --- /dev/null +++ b/src/Api/Enum/InventoryPurchaseOrderStatus.php @@ -0,0 +1,13 @@ +post('getInventoryPurchaseOrders', $data), + ); + } + + public function getInventoryPurchaseOrderItems(int $orderId, ?int $page = null): Response + { + return new Response( + $this->post('getInventoryPurchaseOrderItems', [ + 'order_id' => $orderId, + 'page' => $page, + ]), + ); + } + + public function getInventoryPurchaseOrderSeries(int $warehouseId): Response + { + return new Response( + $this->post('getInventoryPurchaseOrderSeries', [ + 'warehouse_id' => $warehouseId, + ]), + ); + } + + public function addInventoryPurchaseOrder(int $warehouseId, int $supplierId, int $payerId, string $currency = 'PLN', array $data = []): Response + { + $data['warehouse_id'] = $warehouseId; + $data['supplier_id'] = $supplierId; + $data['payer_id'] = $payerId; + $data['currency'] = $currency; + + return new Response( + $this->post('addInventoryPurchaseOrder', $data), + ); + } + + public function addInventoryPurchaseOrderItems(int $orderId, array $items): Response + { + return new Response( + $this->post('addInventoryPurchaseOrderItems', [ + 'order_id' => $orderId, + 'items' => $items, + ]), + ); + } + + public function setInventoryPurchaseOrderStatus(int $orderId, InventoryPurchaseOrderStatus $status, array $completedItems = []): Response + { + return new Response( + $this->post('setInventoryPurchaseOrderStatus', [ + 'order_id' => $orderId, + 'status' => $status->value, + 'completed_items' => $completedItems, + ]), + ); + } +} diff --git a/src/Baselinker.php b/src/Baselinker.php index 05d172c..0104b0f 100644 --- a/src/Baselinker.php +++ b/src/Baselinker.php @@ -7,6 +7,7 @@ use Baselinker\Api\Request\ExternalStorages; use Baselinker\Api\Request\InventoryDocuments; use Baselinker\Api\Request\InventoryPayers; +use Baselinker\Api\Request\InventoryPurchaseOrders; use Baselinker\Api\Request\OrderReturns; use Baselinker\Api\Request\Orders; use Baselinker\Api\Request\ProductCatalog; @@ -32,6 +33,11 @@ public function inventoryDocuments(): InventoryDocuments return new InventoryDocuments($this->config); } + public function inventoryPurchaseOrders(): InventoryPurchaseOrders + { + return new InventoryPurchaseOrders($this->config); + } + public function warehouseDocuments(): WarehouseDocuments { return new WarehouseDocuments($this->config); diff --git a/tests/BaselinkerTest.php b/tests/BaselinkerTest.php index 8166aa5..08e8963 100644 --- a/tests/BaselinkerTest.php +++ b/tests/BaselinkerTest.php @@ -7,6 +7,7 @@ use Baselinker\Api\Request\ExternalStorages; use Baselinker\Api\Request\InventoryDocuments; use Baselinker\Api\Request\InventoryPayers; +use Baselinker\Api\Request\InventoryPurchaseOrders; use Baselinker\Api\Request\OrderReturns; use Baselinker\Api\Request\Orders; use Baselinker\Api\Request\ProductCatalog; @@ -53,6 +54,15 @@ public function testInventoryDocuments(): void $this->assertInstanceOf(InventoryDocuments::class, $inventoryDocuments); } + public function testInventoryPurchaseOrders(): void + { + $baselinker = new Baselinker('token'); + + $inventoryPurchaseOrders = $baselinker->inventoryPurchaseOrders(); + + $this->assertInstanceOf(InventoryPurchaseOrders::class, $inventoryPurchaseOrders); + } + public function testInventoryPayers(): void { $baselinker = new Baselinker('token'); From bcfb56cfdc7ebad0d43ff6923090ae3f2ffec34e Mon Sep 17 00:00:00 2001 From: Mateusz Nastalski Date: Thu, 23 Oct 2025 23:03:01 +0200 Subject: [PATCH 3/3] Add inventory suppliers --- src/Api/Request/InventorySuppliers.php | 32 ++++++++++++++++++++++++++ src/Baselinker.php | 6 +++++ tests/BaselinkerTest.php | 10 ++++++++ 3 files changed, 48 insertions(+) create mode 100644 src/Api/Request/InventorySuppliers.php diff --git a/src/Api/Request/InventorySuppliers.php b/src/Api/Request/InventorySuppliers.php new file mode 100644 index 0000000..bced833 --- /dev/null +++ b/src/Api/Request/InventorySuppliers.php @@ -0,0 +1,32 @@ +post('getInventorySuppliers', $filters) + ); + } + + public function addInventorySupplier(array $data): Response + { + return new Response( + $this->post('addInventorySupplier', $data) + ); + } + + public function deleteInventorySupplier(int $supplierId): Response + { + return new Response( + $this->post('deleteInventorySupplier', [ + 'supplier_id' => $supplierId, + ]) + ); + } +} diff --git a/src/Baselinker.php b/src/Baselinker.php index 0104b0f..446a400 100644 --- a/src/Baselinker.php +++ b/src/Baselinker.php @@ -8,6 +8,7 @@ use Baselinker\Api\Request\InventoryDocuments; use Baselinker\Api\Request\InventoryPayers; use Baselinker\Api\Request\InventoryPurchaseOrders; +use Baselinker\Api\Request\InventorySuppliers; use Baselinker\Api\Request\OrderReturns; use Baselinker\Api\Request\Orders; use Baselinker\Api\Request\ProductCatalog; @@ -38,6 +39,11 @@ public function inventoryPurchaseOrders(): InventoryPurchaseOrders return new InventoryPurchaseOrders($this->config); } + public function inventorySuppliers(): InventorySuppliers + { + return new InventorySuppliers($this->config); + } + public function warehouseDocuments(): WarehouseDocuments { return new WarehouseDocuments($this->config); diff --git a/tests/BaselinkerTest.php b/tests/BaselinkerTest.php index 08e8963..06551d9 100644 --- a/tests/BaselinkerTest.php +++ b/tests/BaselinkerTest.php @@ -8,6 +8,7 @@ use Baselinker\Api\Request\InventoryDocuments; use Baselinker\Api\Request\InventoryPayers; use Baselinker\Api\Request\InventoryPurchaseOrders; +use Baselinker\Api\Request\InventorySuppliers; use Baselinker\Api\Request\OrderReturns; use Baselinker\Api\Request\Orders; use Baselinker\Api\Request\ProductCatalog; @@ -63,6 +64,15 @@ public function testInventoryPurchaseOrders(): void $this->assertInstanceOf(InventoryPurchaseOrders::class, $inventoryPurchaseOrders); } + public function testInventorySuppliers(): void + { + $baselinker = new Baselinker('token'); + + $inventorySuppliers = $baselinker->inventorySuppliers(); + + $this->assertInstanceOf(InventorySuppliers::class, $inventorySuppliers); + } + public function testInventoryPayers(): void { $baselinker = new Baselinker('token');