From 8082c081aae94aaa8a162eb4f4cc652c77cfbcaa Mon Sep 17 00:00:00 2001 From: Stefan Ninic Date: Fri, 6 Mar 2020 10:49:32 +0100 Subject: [PATCH] Dynamically set shipment as picked, default is true --- src/Models/Lot.php | 4 +--- src/Models/OrderShipment.php | 16 ++++++++++++---- src/Models/Product.php | 8 ++------ 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/Models/Lot.php b/src/Models/Lot.php index a136e92..ded2a96 100644 --- a/src/Models/Lot.php +++ b/src/Models/Lot.php @@ -23,9 +23,7 @@ public function variations( $variation_id = 1001 ) $response = $this->request->client->get("variations/{$this->url_friendly_id}/variation-matrix"); - $html = (string) $response->getBody(); - - return $html; + return (string)$response->getBody(); } ); } diff --git a/src/Models/OrderShipment.php b/src/Models/OrderShipment.php index 8b51fac..7456f3b 100644 --- a/src/Models/OrderShipment.php +++ b/src/Models/OrderShipment.php @@ -13,18 +13,26 @@ class OrderShipment extends Model { - protected $entity = 'order-shipments'; + protected $entity = 'order-shipments'; protected $primaryKey = 'id'; - public function markShipped() + /** + * Mark shipment as shipped + * + * @param bool $pick Mark all shipment lines as picked + * @return mixed + * @throws \Rackbeat\Exceptions\RackbeatClientException + * @throws \Rackbeat\Exceptions\RackbeatRequestException + */ + public function markShipped($pick = true) { - return $this->request->handleWithExceptions(function () { + return $this->request->handleWithExceptions(function () use ($pick) { return $this->request->client->post("orders/shipments/{$this->url_friendly_id}/mark-shipped", [ 'json' => [ - 'pick' => true, + 'pick' => $pick, ], ]) ->getBody() diff --git a/src/Models/Product.php b/src/Models/Product.php index c366c87..6c104c9 100644 --- a/src/Models/Product.php +++ b/src/Models/Product.php @@ -47,9 +47,7 @@ public function inventoryMatrix( $location_id = null, array $filter = null ) $response = $this->request->client->get("{$this->entity}/{$this->url_friendly_id}/variation-matrix" . $query); - $html = (string) $response->getBody(); - - return $html; + return (string)$response->getBody(); } ); } @@ -60,9 +58,7 @@ public function variations( $variation_id = 1001 ) $response = $this->request->client->get("variations/{$this->url_friendly_id}/variation-matrix"); - $html = (string) $response->getBody(); - - return $html; + return (string)$response->getBody(); } ); }