From 3d0ad2d34e9b509ef1b5133fbf8c2340cfa1d9ea Mon Sep 17 00:00:00 2001 From: Stephan Groen Date: Sun, 25 Oct 2020 13:24:44 +0100 Subject: [PATCH 1/4] Adds some API calls that were missing --- src/Client.php | 108 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 106 insertions(+), 2 deletions(-) diff --git a/src/Client.php b/src/Client.php index bde0cfd..2c3a950 100644 --- a/src/Client.php +++ b/src/Client.php @@ -144,6 +144,16 @@ public function addProduct($params) return $this->sendRequest('/products', $params, self::METHOD_POST); } + public function inactivateProduct($idproduct) + { + return $this->sendRequest('/products/' . $idproduct . '/inactivate', [], self::METHOD_POST); + } + + public function activateProduct($idproduct) + { + return $this->sendRequest('/products/' . $idproduct . '/activate', [], self::METHOD_POST); + } + public function getProductStock($idproduct) { return $this->sendRequest('/products/' . $idproduct . '/stock'); @@ -305,9 +315,9 @@ public function addOrder($params) return $this->sendRequest('/orders', $params, self::METHOD_POST); } - public function cancelOrder($idorder) + public function cancelOrder($idorder, $params = []) { - return $this->sendRequest('/orders/' . $idorder, [], self::METHOD_DELETE); + return $this->sendRequest('/orders/' . $idorder, $params, self::METHOD_DELETE); } public function getOrderProductStatus($idorder) @@ -331,6 +341,11 @@ public function processOrder($idorder) return $this->sendRequest('/orders/' . $idorder . '/process', null, self::METHOD_POST); } + public function getOrderNotes($idorder) + { + return $this->sendRequest('/orders/' . $idorder . '/notes'); + } + public function addOrderNote($idorder, $note) { return $this->sendRequest('/orders/' . $idorder . '/notes', ['note' => $note], self::METHOD_POST); @@ -364,6 +379,21 @@ public function updateOrder($idorder, $params) return $this->sendRequest('/orders/' . $idorder, $params, self::METHOD_PUT); } + public function allocateOrder($idorder) + { + return $this->sendRequest('/orders/' . $idorder . '/allocate', null, self::METHOD_POST); + } + + public function deAllocateOrder($idorder) + { + return $this->sendRequest('/orders/' . $idorder . '/deallocate', null, self::METHOD_POST); + } + + public function prioritiseOrder($idorder) + { + return $this->sendRequest('/orders/' . $idorder . '/prioritise', null, self::METHOD_POST); + } + /* * Picklists */ @@ -393,11 +423,31 @@ public function getPicklistByPicklistid($picklistid) return $result; } + public function updatePicklist($idpicklist, $params) + { + return $this->sendRequest('/picklists/' . $idpicklist, $params, self::METHOD_PUT); + } + public function closePicklist($idpicklist) { return $this->sendRequest('/picklists/' . $idpicklist . '/close', null, self::METHOD_POST); } + public function cancelPicklist($idpicklist) + { + return $this->sendRequest('/picklists/' . $idpicklist . '/cancel', null, self::METHOD_POST); + } + + public function pickProductOnPicklist($idpicklist, $product, $amount) + { + $params = [ + 'product' => $product, + 'amount' => $amount + ]; + + return $this->sendRequest('/picklists/' . $idpicklist . '/pick', $params, self::METHOD_POST); + } + public function pickallPicklist($idpicklist) { return $this->sendRequest('/picklists/' . $idpicklist . '/pickall', null, self::METHOD_POST); @@ -496,6 +546,39 @@ public function cancelPurchaseorder($idpurchaseorder) return $this->sendRequest('/purchaseorders/' . $idpurchaseorder . '/cancel', null, self::METHOD_POST); } + public function getPurchaseorderProducts($idpurchaseorder) + { + return $this->sendRequest('/purchaseorders/' . $idpurchaseorder . '/products'); + } + + public function addProductToPurchaseorder($idpurchaseorder, $idproduct, $amount, $price = null, $deliverydate = null) + { + $params = [ + 'idproduct' => $idproduct, + 'amount' => $amount + ]; + + if (! is_null($price)) { + $params['price'] = $price; + } + + if (! is_null($deliverydate)) { + $params['delivery_date'] = $deliverydate; + } + + return $this->sendRequest('/purchaseorders/' . $idpurchaseorder . '/products', $params, self::METHOD_POST); + } + + public function updatePurchaseorderProduct($idpurchaseorder, $idpurchaseorder_product, $params) + { + return $this->sendRequest('/purchaseorders/' . $idpurchaseorder . '/products/' . $idpurchaseorder_product, $params, self::METHOD_PUT); + } + + public function removePurchaseorderProduct($idpurchaseorder, $idpurchaseorder_product) + { + return $this->sendRequest('/purchaseorders/' . $idpurchaseorder . '/products/' . $idpurchaseorder_product, [], self::METHOD_DELETE); + } + public function getReceiptsFromPurchaseorder($idpurchaseorder) { return $this->sendRequest('/purchaseorders/' . $idpurchaseorder . '/receipts'); @@ -540,6 +623,17 @@ public function updateReturn($idreturn, $params) return $this->sendRequest('/returns/' . $idreturn, $params, self::METHOD_PUT); } + public function getReturnLogAndComments($idreturn) + { + return $this->sendRequest('/returns/' . $idreturn . '/logs'); + } + + public function addReturnLogOrChangeStatus($idreturn, $params) + { + return $this->sendRequest('/returns/' . $idreturn . '/logs', $params, self::METHOD_POST); + + } + /* * Returned Products */ @@ -564,6 +658,11 @@ public function removeReturnedProduct($idreturn, $idreturn_product) return $this->sendRequest('/returns/' . $idreturn . '/returned_products/' . $idreturn_product, null,self::METHOD_DELETE); } + public function receiveReturnedProducts($idreturn, $params) + { + return $this->sendRequest('/returns/' . $idreturn . '/receive', $params, self::METHOD_POST); + } + /* * Replacement Products */ @@ -660,6 +759,11 @@ public function deleteBackorder($idbackorder) return $this->sendRequest('/backorders/' . $idbackorder, null, self::METHOD_DELETE); } + public function getBackordersForOrder($idorder) + { + return $this->sendRequest('/order/' . $idorder . '/backorders'); + } + /* * Warehouses */ From 57556373179a7c11c789ba23c8415fd13e62d5d9 Mon Sep 17 00:00:00 2001 From: Stephan Groen Date: Sun, 25 Oct 2020 13:25:19 +0100 Subject: [PATCH 2/4] Bump version --- src/Client.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Client.php b/src/Client.php index 2c3a950..6d19594 100644 --- a/src/Client.php +++ b/src/Client.php @@ -20,7 +20,7 @@ class Client protected $apiVersion = 'v1'; protected $userAgent = 'Picqer PHP API Client (picqer.com)'; - protected $clientVersion = '0.21.1'; + protected $clientVersion = '0.22.0'; protected $debug = false; protected $skipSslVerification = false; From 6e6dbaa0f9da6f032a04def5c25bafcf05ad1199 Mon Sep 17 00:00:00 2001 From: Stephan Groen Date: Sun, 25 Oct 2020 13:32:26 +0100 Subject: [PATCH 3/4] Update Client.php --- src/Client.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Client.php b/src/Client.php index 6d19594..1b9c6b8 100644 --- a/src/Client.php +++ b/src/Client.php @@ -379,12 +379,12 @@ public function updateOrder($idorder, $params) return $this->sendRequest('/orders/' . $idorder, $params, self::METHOD_PUT); } - public function allocateOrder($idorder) + public function allocateStockForOrder($idorder) { return $this->sendRequest('/orders/' . $idorder . '/allocate', null, self::METHOD_POST); } - public function deAllocateOrder($idorder) + public function deAllocateStockForOrder($idorder) { return $this->sendRequest('/orders/' . $idorder . '/deallocate', null, self::METHOD_POST); } From 3b8a2426c3a324b89d5628dfd2a7438cbaa06fe9 Mon Sep 17 00:00:00 2001 From: Stephan Groen Date: Sun, 25 Oct 2020 13:33:16 +0100 Subject: [PATCH 4/4] Update Client.php --- src/Client.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Client.php b/src/Client.php index 1b9c6b8..6eaa2e9 100644 --- a/src/Client.php +++ b/src/Client.php @@ -384,7 +384,7 @@ public function allocateStockForOrder($idorder) return $this->sendRequest('/orders/' . $idorder . '/allocate', null, self::METHOD_POST); } - public function deAllocateStockForOrder($idorder) + public function deallocateStockForOrder($idorder) { return $this->sendRequest('/orders/' . $idorder . '/deallocate', null, self::METHOD_POST); }