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/Api/Request/InventoryPurchaseOrders.php b/src/Api/Request/InventoryPurchaseOrders.php new file mode 100644 index 0000000..df45455 --- /dev/null +++ b/src/Api/Request/InventoryPurchaseOrders.php @@ -0,0 +1,69 @@ +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/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 7f281ae..446a400 100644 --- a/src/Baselinker.php +++ b/src/Baselinker.php @@ -5,7 +5,10 @@ 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\InventoryPurchaseOrders; +use Baselinker\Api\Request\InventorySuppliers; use Baselinker\Api\Request\OrderReturns; use Baselinker\Api\Request\Orders; use Baselinker\Api\Request\ProductCatalog; @@ -26,6 +29,21 @@ public function productCatalog(): ProductCatalog return new ProductCatalog($this->config); } + public function inventoryDocuments(): InventoryDocuments + { + return new InventoryDocuments($this->config); + } + + 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 1fd6c21..06551d9 100644 --- a/tests/BaselinkerTest.php +++ b/tests/BaselinkerTest.php @@ -5,7 +5,10 @@ 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\InventoryPurchaseOrders; +use Baselinker\Api\Request\InventorySuppliers; use Baselinker\Api\Request\OrderReturns; use Baselinker\Api\Request\Orders; use Baselinker\Api\Request\ProductCatalog; @@ -43,6 +46,33 @@ 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 testInventoryPurchaseOrders(): void + { + $baselinker = new Baselinker('token'); + + $inventoryPurchaseOrders = $baselinker->inventoryPurchaseOrders(); + + $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');